Skip to content

Commit 66fc14a

Browse files
committed
core/state: do not journal preimages
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.
1 parent dad62bc commit 66fc14a

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

core/state/journal.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@ func (j *journal) JournalLog(txHash common.Hash) {
160160
j.append(addLogChange{txhash: txHash})
161161
}
162162

163-
func (j *journal) JournalAddPreimage(hash common.Hash) {
164-
j.append(addPreimageChange{hash: hash})
165-
}
166-
167163
func (j *journal) JournalCreate(addr common.Address) {
168164
j.append(createObjectChange{account: &addr})
169165
}
@@ -265,9 +261,6 @@ type (
265261
addLogChange struct {
266262
txhash common.Hash
267263
}
268-
addPreimageChange struct {
269-
hash common.Hash
270-
}
271264
touchChange struct {
272265
account *common.Address
273266
}
@@ -456,20 +449,6 @@ func (ch addLogChange) copy() journalEntry {
456449
}
457450
}
458451

459-
func (ch addPreimageChange) revert(s *StateDB) {
460-
delete(s.preimages, ch.hash)
461-
}
462-
463-
func (ch addPreimageChange) dirtied() *common.Address {
464-
return nil
465-
}
466-
467-
func (ch addPreimageChange) copy() journalEntry {
468-
return addPreimageChange{
469-
hash: ch.hash,
470-
}
471-
}
472-
473452
func (ch accessListAddAccountChange) revert(s *StateDB) {
474453
/*
475454
One important invariant here, is that whenever a (addr, slot) is added, if the

core/state/statedb.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ func (s *StateDB) Logs() []*types.Log {
282282
// AddPreimage records a SHA3 preimage seen by the VM.
283283
func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
284284
if _, ok := s.preimages[hash]; !ok {
285-
s.journal.JournalAddPreimage(hash)
286285
s.preimages[hash] = slices.Clone(preimage)
287286
}
288287
}

0 commit comments

Comments
 (0)