From 550ddf9f132687e8efe773aaa70fe1aa714a3845 Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 26 Nov 2024 16:23:16 +0100 Subject: [PATCH 1/2] core: fix call to post-validation evm message hook --- core/state_transition.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/state_transition.go b/core/state_transition.go index 2de1cad762..a3b05705c9 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -155,6 +155,8 @@ type Message struct { Mint *big.Int // Mint is the amount to mint before EVM processing, or nil if there is no minting. RollupCostData types.RollupCostData // RollupCostData caches data to compute the fee we charge for data availability + // PostValidation is an optional check of the resulting post-state, if and when the message is + // applied fully to the EVM. This function may return an error to deny inclusion of the message. PostValidation func(evm *vm.EVM, result *ExecutionResult) error } @@ -450,7 +452,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { err = nil } - if st.msg.PostValidation != nil { + if err == nil && st.msg.PostValidation != nil { if err := st.msg.PostValidation(st.evm, result); err != nil { return nil, err } From da595e374515e4b93430e0c5fd8d1616aa1ab229 Mon Sep 17 00:00:00 2001 From: protolambda Date: Tue, 26 Nov 2024 16:46:29 +0100 Subject: [PATCH 2/2] miner: fix TestRejectedConditionalTx flake --- miner/miner_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/miner/miner_test.go b/miner/miner_test.go index d365ee18ac..e038b02f61 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -188,8 +188,8 @@ func TestRejectedConditionalTx(t *testing.T) { }) tx.SetConditional(&types.TransactionConditional{TimestampMax: uint64Ptr(timestamp - 1)}) - // 1 pending tx - miner.txpool.Add(types.Transactions{tx}, true, false) + // 1 pending tx (synchronously, it has to be there before it can be rejected) + miner.txpool.Add(types.Transactions{tx}, true, true) if !miner.txpool.Has(tx.Hash()) { t.Fatalf("conditional tx is not in the mempool") }