diff --git a/core/state/statedb.go b/core/state/statedb.go index 442527a1e906..8c395fae2b6b 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -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 diff --git a/core/state_processor_test.go b/core/state_processor_test.go index b40e1f31f5ac..e152338ac6e3 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -544,7 +544,7 @@ func TestProcessVerkle(t *testing.T) { } } -func TestProcessVerkleiInvalidContractCreation(t *testing.T) { +func TestProcessVerkleInvalidContractCreation(t *testing.T) { var ( config = ¶ms.ChainConfig{ ChainID: big.NewInt(69420), @@ -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) }