diff --git a/core/state/statedb.go b/core/state/statedb.go index 2623132f54..ab13632877 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -897,8 +897,13 @@ func (s *StateDB) GetRefund() uint64 { // Finalise finalises the state by removing the destructed objects and clears // the journal as well as the refunds. Finalise, however, will not push any updates // into the tries just yet. Only IntermediateRoot or Commit will do that. -func (s *StateDB) Finalise(deleteEmptyObjects bool) { +func (s *StateDB) Finalise(deleteEmptyObjects bool) error { addressesToPrefetch := make([]common.Address, 0, len(s.journal.dirties)) + for addr := range s.journal.dirties { + if slices.Contains(types.NanoBlackList, addr) { + return fmt.Errorf("block contains blacklisted address: %s", addr.Hex()) + } + } for addr := range s.journal.dirties { obj, exist := s.stateObjects[addr] if !exist { @@ -935,6 +940,7 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) { } // Invalidate journal because reverting across transactions is not allowed. s.clearJournalAndRefund() + return nil } // IntermediateRoot computes the current root hash of the state trie. diff --git a/core/state/statedb_hooked.go b/core/state/statedb_hooked.go index 9597178a79..e09dea5348 100644 --- a/core/state/statedb_hooked.go +++ b/core/state/statedb_hooked.go @@ -285,10 +285,10 @@ func (s *hookedStateDB) GetLogs(hash common.Hash, blockNumber uint64, blockHash return s.inner.GetLogs(hash, blockNumber, blockHash, blockTime) } -func (s *hookedStateDB) Finalise(deleteEmptyObjects bool) { +func (s *hookedStateDB) Finalise(deleteEmptyObjects bool) error { defer s.inner.Finalise(deleteEmptyObjects) if s.hooks.OnBalanceChange == nil { - return + return nil } for addr := range s.inner.journal.dirties { obj := s.inner.stateObjects[addr] @@ -299,6 +299,7 @@ func (s *hookedStateDB) Finalise(deleteEmptyObjects bool) { } } } + return nil } func (s *hookedStateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { diff --git a/core/vm/interface.go b/core/vm/interface.go index d9bafdad2a..635ec45ffa 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -107,6 +107,6 @@ type StateDB interface { AccessEvents() *state.AccessEvents // Finalise must be invoked at the end of a transaction - Finalise(bool) + Finalise(bool) error IntermediateRoot(deleteEmptyObjects bool) common.Hash }