Skip to content

Commit

Permalink
Merge pull request ethereum#47 from OffchainLabs/remove-state-transit…
Browse files Browse the repository at this point in the history
…ion-leniency

Remove state transition leniency
  • Loading branch information
PlasmaPower authored Feb 5, 2022
2 parents 0ba62aa + 8323fa4 commit 558ca7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
16 changes: 3 additions & 13 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package core

import (
"errors"
"fmt"
"math"
"math/big"
Expand Down Expand Up @@ -374,25 +373,16 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
}

res, err := st.transitionDbImpl()
transitionSuccess := true
if err != nil && !errors.Is(err, ErrNonceTooLow) && !errors.Is(err, ErrNonceTooHigh) && st.msg.UnderlyingTransaction() != nil {
transitionSuccess = false
res = &ExecutionResult{
UsedGas: st.gasUsed(),
Err: err,
ReturnData: nil,
}
err = nil
}

if err == nil {
st.evm.ProcessingHook.EndTxHook(st.gas, transitionSuccess, res.Err == nil)
st.evm.ProcessingHook.EndTxHook(st.gas, res.Err == nil)
}
return res, err
}

func (st *StateTransition) refundGas(refundQuotient uint64) {

st.gas += st.evm.ProcessingHook.ForceRefundGas()

nonrefundable := st.evm.ProcessingHook.NonrefundableGas()
if nonrefundable < st.gasUsed() {
// Apply refund counter, capped to a refund quotient
Expand Down
9 changes: 7 additions & 2 deletions core/vm/evm_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ func (evm *EVM) Depth() int {
type TxProcessingHook interface {
StartTxHook() (bool, uint64, error, []byte) // return 4-tuple rather than *struct to avoid an import cycle
GasChargingHook(gasRemaining *uint64) error
EndTxHook(totalGasUsed uint64, transitionSuccess bool, evmSuccess bool)
EndTxHook(totalGasUsed uint64, success bool)
NonrefundableGas() uint64
ForceRefundGas() uint64
PushCaller(addr common.Address)
PopCaller()
L1BlockNumber(blockCtx BlockContext) (uint64, error)
Expand All @@ -46,14 +47,18 @@ func (p DefaultTxProcessor) GasChargingHook(gasRemaining *uint64) error {
return nil
}

func (p DefaultTxProcessor) EndTxHook(totalGasUsed uint64, transitionSuccess bool, evmSuccess bool) {
func (p DefaultTxProcessor) EndTxHook(totalGasUsed uint64, success bool) {
return
}

func (p DefaultTxProcessor) NonrefundableGas() uint64 {
return 0
}

func (p DefaultTxProcessor) ForceRefundGas() uint64 {
return 0
}

func (p DefaultTxProcessor) PushCaller(addr common.Address) {
return
}
Expand Down

0 comments on commit 558ca7f

Please sign in to comment.