From e1fda817f46614c5a103ebc4ae4857a8a57c09d4 Mon Sep 17 00:00:00 2001 From: galaio <12880651+galaio@users.noreply.github.com> Date: Wed, 14 Aug 2024 17:50:58 +0800 Subject: [PATCH] txdag: fix system tx finalise issue; (#33) * txdag: fix system tx finalise issue; * txdag: fix system tx finalise issue; --------- Co-authored-by: galaio --- core/state/statedb.go | 1 + core/state_transition.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 52eb7911fb..f3661546ec 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -2528,6 +2528,7 @@ func (s *StateDB) RecordSystemTxRWSet(index int) { s.mvStates.FulfillRWSet(types.NewRWSet(types.StateVersion{ TxIndex: index, }).WithExcludedTxFlag(), types.NewExeStat(index).WithExcludedTxFlag()) + s.mvStates.Finalise(index) } // copySet returns a deep-copied set. diff --git a/core/state_transition.go b/core/state_transition.go index 5e1865d949..2bce4e6a56 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -448,7 +448,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { } // just record error tx here if ferr := st.state.FinaliseRWSet(); ferr != nil { - log.Error("finalise error deposit tx rwSet fail", "block", st.evm.Context.BlockNumber, "tx", st.evm.StateDB.TxIndex()) + log.Error("finalise error deposit tx rwSet fail", "block", st.evm.Context.BlockNumber, "tx", st.evm.StateDB.TxIndex(), "err", ferr) } result = &ExecutionResult{ UsedGas: gasUsed, @@ -460,7 +460,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { if err != nil { // just record error tx here if ferr := st.state.FinaliseRWSet(); ferr != nil { - log.Error("finalise error tx rwSet fail", "block", st.evm.Context.BlockNumber, "tx", st.evm.StateDB.TxIndex()) + log.Error("finalise error tx rwSet fail", "block", st.evm.Context.BlockNumber, "tx", st.evm.StateDB.TxIndex(), "err", ferr) } } return result, err @@ -545,7 +545,7 @@ func (st *StateTransition) innerTransitionDb() (*ExecutionResult, error) { // stop record rw set in here, skip gas fee distribution if ferr := st.state.FinaliseRWSet(); ferr != nil { - log.Error("finalise tx rwSet fail", "block", st.evm.Context.BlockNumber, "tx", st.evm.StateDB.TxIndex()) + log.Error("finalise tx rwSet fail", "block", st.evm.Context.BlockNumber, "tx", st.evm.StateDB.TxIndex(), "err", ferr) } // if deposit: skip refunds, skip tipping coinbase