mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 07:58:40 +00:00
core: apply fixes for 8037
This commit is contained in:
parent
c6c5536226
commit
2d708415d7
1 changed files with 4 additions and 7 deletions
|
|
@ -576,9 +576,8 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
|
||||||
st.state.Prepare(rules, msg.From, st.evm.Context.Coinbase, msg.To, vm.ActivePrecompiles(rules), msg.AccessList)
|
st.state.Prepare(rules, msg.From, st.evm.Context.Coinbase, msg.To, vm.ActivePrecompiles(rules), msg.AccessList)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ret []byte
|
ret []byte
|
||||||
vmerr error // vm errors do not effect consensus and are therefore not assigned to err
|
vmerr error // vm errors do not effect consensus and are therefore not assigned to err
|
||||||
authRefund uint64
|
|
||||||
)
|
)
|
||||||
var execGasUsed vm.GasUsed
|
var execGasUsed vm.GasUsed
|
||||||
if contractCreation {
|
if contractCreation {
|
||||||
|
|
@ -591,8 +590,7 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
|
||||||
if msg.SetCodeAuthorizations != nil {
|
if msg.SetCodeAuthorizations != nil {
|
||||||
for _, auth := range msg.SetCodeAuthorizations {
|
for _, auth := range msg.SetCodeAuthorizations {
|
||||||
// Note errors are ignored, we simply skip invalid authorizations here.
|
// Note errors are ignored, we simply skip invalid authorizations here.
|
||||||
refund, _ := st.applyAuthorization(rules, &auth)
|
st.applyAuthorization(rules, &auth)
|
||||||
authRefund += refund
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -639,8 +637,7 @@ func (st *stateTransition) execute() (*ExecutionResult, error) {
|
||||||
// EIP-8037: 2D gas accounting for Amsterdam.
|
// EIP-8037: 2D gas accounting for Amsterdam.
|
||||||
// tx_regular = intrinsic_regular + exec_regular_gas_used
|
// tx_regular = intrinsic_regular + exec_regular_gas_used
|
||||||
// tx_state = intrinsic_state (adjusted) + exec_state_gas_used
|
// tx_state = intrinsic_state (adjusted) + exec_state_gas_used
|
||||||
// These are tracked independently, not derived from remaining gas.
|
txState := cost.StateGas + execGasUsed.StateGas
|
||||||
txState := (cost.StateGas - authRefund) + execGasUsed.StateGas
|
|
||||||
txRegular := cost.RegularGas + execGasUsed.RegularGas
|
txRegular := cost.RegularGas + execGasUsed.RegularGas
|
||||||
txRegular = max(txRegular, floorDataGas)
|
txRegular = max(txRegular, floorDataGas)
|
||||||
if err := st.gp.ReturnGasAmsterdam(txRegular, txState, st.gasUsed()); err != nil {
|
if err := st.gp.ReturnGasAmsterdam(txRegular, txState, st.gasUsed()); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue