From a49d56fb65e67ed1e8de84f8194ecc0af89cbd81 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 21 Aug 2024 08:53:16 -0700 Subject: [PATCH] Fix TestFilterTxConditional Explicitly call state.Finalize in order to flush the writes to storage trie. Root cause was because finalise called within state object were removed by this commit: https://github.com/ethereum/go-ethereum/commit/be3284373f0761b35c38416f7e7aba5dee163e91 --- core/txpool/legacypool/list_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/txpool/legacypool/list_test.go b/core/txpool/legacypool/list_test.go index 544b1b9634..f6330ea294 100644 --- a/core/txpool/legacypool/list_test.go +++ b/core/txpool/legacypool/list_test.go @@ -27,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/holiman/uint256" @@ -130,15 +131,19 @@ func TestFilterTxConditional(t *testing.T) { options.KnownAccounts = types.KnownAccounts{ common.Address{19: 1}: &types.Value{ - Single: common.HexToRefHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"), + Single: common.HexToRefHash("0xe734938daf39aae1fa4ee64dc3155d7c049f28b57a8ada8ad9e86832e0253bef"), }, } + state.AddBalance(common.Address{19: 1}, uint256.NewInt(1000), tracing.BalanceChangeTransfer) + trie, _ := state.StorageTrie(common.Address{19: 1}) fmt.Println("before", trie) state.SetState(common.Address{19: 1}, common.Hash{}, common.Hash{30: 1}) + state.Finalise(true) + trie, _ = state.StorageTrie(common.Address{19: 1}) fmt.Println("after", trie.Hash()) @@ -154,6 +159,8 @@ func TestFilterTxConditional(t *testing.T) { // Set state that conflicts with tx2's policy state.SetState(common.Address{19: 1}, common.Hash{}, common.Hash{31: 1}) + state.Finalise(true) + trie, _ = state.StorageTrie(common.Address{19: 1}) fmt.Println("after2", trie.Hash())