core/state: fix committed-state expectations in StateDB tests (#32678)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This commit is contained in:
GarmashAlex 2025-09-22 05:30:29 +03:00 committed by GitHub
parent 4414e2833f
commit 479b8031dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -772,7 +772,7 @@ func TestCopyCommitCopy(t *testing.T) {
t.Fatalf("second copy non-committed storage slot mismatch: have %x, want %x", val, sval) t.Fatalf("second copy non-committed storage slot mismatch: have %x, want %x", val, sval)
} }
if val := copyTwo.GetCommittedState(addr, skey); val != (common.Hash{}) { if val := copyTwo.GetCommittedState(addr, skey); val != (common.Hash{}) {
t.Fatalf("second copy committed storage slot mismatch: have %x, want %x", val, sval) t.Fatalf("second copy committed storage slot mismatch: have %x, want %x", val, common.Hash{})
} }
// Commit state, ensure states can be loaded from disk // Commit state, ensure states can be loaded from disk
root, _ := state.Commit(0, false, false) root, _ := state.Commit(0, false, false)
@ -859,7 +859,7 @@ func TestCopyCopyCommitCopy(t *testing.T) {
t.Fatalf("third copy non-committed storage slot mismatch: have %x, want %x", val, sval) t.Fatalf("third copy non-committed storage slot mismatch: have %x, want %x", val, sval)
} }
if val := copyThree.GetCommittedState(addr, skey); val != (common.Hash{}) { if val := copyThree.GetCommittedState(addr, skey); val != (common.Hash{}) {
t.Fatalf("third copy committed storage slot mismatch: have %x, want %x", val, sval) t.Fatalf("third copy committed storage slot mismatch: have %x, want %x", val, common.Hash{})
} }
} }
@ -912,10 +912,10 @@ func TestCommitCopy(t *testing.T) {
} }
// Slots cached in the stateDB, available after commit // Slots cached in the stateDB, available after commit
if val := copied.GetState(addr, skey2); val != sval2 { if val := copied.GetState(addr, skey2); val != sval2 {
t.Fatalf("unexpected storage slot: have %x", sval1) t.Fatalf("unexpected storage slot: have %x, want %x", val, sval2)
} }
if val := copied.GetCommittedState(addr, skey2); val != sval2 { if val := copied.GetCommittedState(addr, skey2); val != sval2 {
t.Fatalf("unexpected storage slot: have %x", val) t.Fatalf("unexpected storage slot: have %x, want %x", val, sval2)
} }
} }