Skip to content

Commit f669216

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 0379c92 commit f669216

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

core/state/journal.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ func (j *journal) JournalLog(txHash common.Hash) {
132132
j.append(addLogChange{txhash: txHash})
133133
}
134134

135-
func (j *journal) JournalAddPreimage(hash common.Hash) {
136-
j.append(addPreimageChange{hash: hash})
137-
}
138-
139135
func (j *journal) JournalRefund(prev uint64) {
140136
j.append(refundChange{prev: prev})
141137
}
@@ -207,7 +203,6 @@ func (j *journal) JournalReset(address common.Address,
207203
prevAccountOriginExist bool,
208204
prevAccountOrigin []byte,
209205
prevStorageOrigin map[common.Hash][]byte) {
210-
211206
j.append(resetObjectChange{
212207
account: &address,
213208
prev: prev,
@@ -264,9 +259,6 @@ type (
264259
addLogChange struct {
265260
txhash common.Hash
266261
}
267-
addPreimageChange struct {
268-
hash common.Hash
269-
}
270262
touchChange struct {
271263
account *common.Address
272264
}
@@ -399,14 +391,6 @@ func (ch addLogChange) dirtied() *common.Address {
399391
return nil
400392
}
401393

402-
func (ch addPreimageChange) revert(s *StateDB) {
403-
delete(s.preimages, ch.hash)
404-
}
405-
406-
func (ch addPreimageChange) dirtied() *common.Address {
407-
return nil
408-
}
409-
410394
func (ch accessListAddAccountChange) revert(s *StateDB) {
411395
/*
412396
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
@@ -230,7 +230,6 @@ func (s *StateDB) Logs() []*types.Log {
230230
// AddPreimage records a SHA3 preimage seen by the VM.
231231
func (s *StateDB) AddPreimage(hash common.Hash, preimage []byte) {
232232
if _, ok := s.preimages[hash]; !ok {
233-
s.journal.JournalAddPreimage(hash)
234233
pi := make([]byte, len(preimage))
235234
copy(pi, preimage)
236235
s.preimages[hash] = pi

0 commit comments

Comments
 (0)