Skip to content

Commit

Permalink
txdag: fix system tx finalise issue; (bnb-chain#33)
Browse files Browse the repository at this point in the history
* txdag: fix system tx finalise issue;

* txdag: fix system tx finalise issue;

---------

Co-authored-by: galaio <[email protected]>
  • Loading branch information
2 people authored and sunny2022da committed Nov 14, 2024
1 parent 5f2b561 commit e1fda81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e1fda81

Please sign in to comment.