Skip to content

Commit

Permalink
state: avoid EIP-158 for history storage address (#359)
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign authored Feb 3, 2024
1 parent 28ec376 commit 4efa34d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
// Thus, we can safely ignore it here
continue
}
if obj.selfDestructed || (deleteEmptyObjects && obj.empty()) {
if (obj.selfDestructed || (deleteEmptyObjects && obj.empty())) && addr != params.HistoryStorageAddress {
obj.deleted = true

// We need to maintain account deletions explicitly (will remain
Expand Down
8 changes: 7 additions & 1 deletion core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func TestProcessVerkle(t *testing.T) {
}
}

func TestProcessVerkleiInvalidContractCreation(t *testing.T) {
func TestProcessVerkleInvalidContractCreation(t *testing.T) {
var (
config = &params.ChainConfig{
ChainID: big.NewInt(69420),
Expand Down Expand Up @@ -682,6 +682,12 @@ func TestProcessVerkleiInvalidContractCreation(t *testing.T) {
if stemStateDiff.SuffixDiffs[0].Suffix != 65 {
t.Fatalf("invalid suffix diff value found for BLOCKHASH contract at block #2: %d != 65", stemStateDiff.SuffixDiffs[0].Suffix)
}
if stemStateDiff.SuffixDiffs[0].NewValue == nil {
t.Fatalf("missing post state value for BLOCKHASH contract at block #2")
}
if *stemStateDiff.SuffixDiffs[0].NewValue != common.HexToHash("53abcdfb284720ea59efe923d3dc774bbb7e787d829599f8ec7a81d344dd3d17") {
t.Fatalf("invalid post state value for BLOCKHASH contract at block #2: %x != ", (*stemStateDiff.SuffixDiffs[0].NewValue)[:])
}
} else if suffixDiff.Suffix > 4 {
t.Fatalf("invalid suffix diff found for %x in block #2: %d\n", stemStateDiff.Stem, suffixDiff.Suffix)
}
Expand Down

0 comments on commit 4efa34d

Please sign in to comment.