Skip to content

Commit

Permalink
core/state: do not journal preimages
Browse files Browse the repository at this point in the history
We do not strictly need to journal preimages: preimages are stored and
served for the benefit of remote RPC users, e.g. for debugging solidity
storage. There is no 'consensus requirement' for these keys to be
reverted in case of reverted scopes.
  • Loading branch information
holiman committed Apr 25, 2024
1 parent 064d618 commit c802f78
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
21 changes: 0 additions & 21 deletions core/state/journal.go
Expand Up @@ -160,10 +160,6 @@ func (j *journal) JournalLog(txHash common.Hash) {
j.append(addLogChange{txhash: txHash})
}

func (j *journal) JournalAddPreimage(hash common.Hash) {
j.append(addPreimageChange{hash: hash})
}

func (j *journal) JournalCreate(addr common.Address) {
j.append(createObjectChange{account: &addr})
}
Expand Down Expand Up @@ -263,9 +259,6 @@ type (
addLogChange struct {
txhash common.Hash
}
addPreimageChange struct {
hash common.Hash
}
touchChange struct {
account *common.Address
}
Expand Down Expand Up @@ -454,20 +447,6 @@ func (ch addLogChange) copy() journalEntry {
}
}

func (ch addPreimageChange) revert(s *StateDB) {
delete(s.preimages, ch.hash)
}

func (ch addPreimageChange) dirtied() *common.Address {
return nil
}

func (ch addPreimageChange) copy() journalEntry {
return addPreimageChange{
hash: ch.hash,
}
}

func (ch accessListAddAccountChange) revert(s *StateDB) {
/*
One important invariant here, is that whenever a (addr, slot) is added, if the
Expand Down
1 change: 0 additions & 1 deletion core/state/statedb.go
Expand Up @@ -265,7 +265,6 @@ func (s *StateDB) Logs() []*types.Log {
// AddPreimage records a SHA3 preimage seen by the VM.
func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
if _, ok := s.preimages[hash]; !ok {
s.journal.JournalAddPreimage(hash)
s.preimages[hash] = slices.Clone(preimage)
}
}
Expand Down

0 comments on commit c802f78

Please sign in to comment.