remove precompile check for newAccount

This commit is contained in:
Sina Mahmoodi 2024-02-05 18:37:57 +01:00
parent 6c44a594f4
commit 188cd4182e
2 changed files with 1 additions and 19 deletions

View File

@ -125,9 +125,6 @@ type StateDB struct {
// Preimages occurred seen by VM in the scope of block.
preimages map[common.Hash][]byte
// Enabled precompile contracts
precompiles map[common.Address]struct{}
// Per-transaction access list
accessList *accessList
@ -184,7 +181,6 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
stateObjectsDestruct: make(map[common.Address]*types.StateAccount),
logs: make(map[common.Hash][]*types.Log),
preimages: make(map[common.Hash][]byte),
precompiles: make(map[common.Address]struct{}),
journal: newJournal(),
accessList: newAccessList(),
transientStorage: newTransientStorage(),
@ -668,12 +664,8 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
prev = s.getDeletedStateObject(addr) // Note, prev might have been deleted, we need that!
newobj = newObject(s, addr, nil)
if s.logger != nil {
// Precompiled contracts are touched during a call.
// Make sure we avoid emitting a new account event for them.
if _, ok := s.precompiles[addr]; !ok {
s.logger.OnNewAccount(addr, prev != nil)
}
}
if prev == nil {
s.journal.append(createObjectChange{account: &addr})
} else {
@ -1389,14 +1381,6 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
s.transientStorage = newTransientStorage()
}
// PrepareBlock prepares the statedb for execution of a block. It tracks
// the addresses of enabled precompiles for debugging purposes.
func (s *StateDB) PrepareBlock(precompiles []common.Address) {
for _, addr := range precompiles {
s.precompiles[addr] = struct{}{}
}
}
// AddAddressToAccessList adds the given address to the access list
func (s *StateDB) AddAddressToAccessList(addr common.Address) {
if s.accessList.AddAddress(addr) {

View File

@ -75,13 +75,11 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
var (
context = NewEVMBlockContext(header, p.bc, nil)
vmenv = vm.NewEVM(context, vm.TxContext{}, statedb, p.config, cfg)
rules = vmenv.ChainConfig().Rules(context.BlockNumber, context.Random != nil, context.Time)
signer = types.MakeSigner(p.config, header.Number, header.Time)
)
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
ProcessBeaconBlockRoot(*beaconRoot, vmenv, statedb, p.bc.logger)
}
statedb.PrepareBlock(vm.ActivePrecompiles(rules))
// Iterate over and process the individual transactions
for i, tx := range block.Transactions() {
msg, err := TransactionToMessage(tx, signer, header.BaseFee)