mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-10 08:51:38 +00:00
core: fix
This commit is contained in:
parent
891ec8d128
commit
95574903c0
1 changed files with 4 additions and 9 deletions
|
|
@ -673,16 +673,11 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
|
||||||
returned := st.returnGas()
|
returned := st.returnGas()
|
||||||
if rules.IsAmsterdam {
|
if rules.IsAmsterdam {
|
||||||
// EIP-8037: 2D gas accounting for Amsterdam.
|
// EIP-8037: 2D gas accounting for Amsterdam.
|
||||||
// tx_regular = intrinsic_regular + exec_regular_gas_used
|
// tx_regular = initialBudget.RegularGas - gasRemaining.RegularGas
|
||||||
// tx_state = intrinsic_state (adjusted) + exec_state_gas_used
|
// tx_state = initialBudget.StateGas - gasRemaining.StateGas
|
||||||
// execGasUsed.StateGas may be negative when an SSTORE 0→x→0 refund
|
txRegular := st.initialBudget.RegularGas - st.gasRemaining.RegularGas
|
||||||
// exceeded the intrinsic-charged state gas
|
|
||||||
txState := uint64(cost.StateGas)
|
|
||||||
if execGasUsed.StateGas > 0 {
|
|
||||||
txState += uint64(execGasUsed.StateGas)
|
|
||||||
}
|
|
||||||
txRegular := cost.RegularGas + execGasUsed.RegularGas
|
|
||||||
txRegular = max(txRegular, floorDataGas)
|
txRegular = max(txRegular, floorDataGas)
|
||||||
|
txState := st.initialBudget.StateGas - st.gasRemaining.StateGas
|
||||||
if err := st.gp.ReturnGasAmsterdam(txRegular, txState, st.gasUsed()); err != nil {
|
if err := st.gp.ReturnGasAmsterdam(txRegular, txState, st.gasUsed()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue