Skip to content

Commit

Permalink
Merge pull request #2293 from OffchainLabs/stake-revert-elevated
Browse files Browse the repository at this point in the history
Assume stake is elevated if currentRequiredStake reverts
  • Loading branch information
joshuacolvin0 authored May 13, 2024
2 parents 7f37b08 + aef2bb3 commit 51189e4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions staker/l1_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/offchainlabs/nitro/staker/txbuilder"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/headerreader"
"github.com/offchainlabs/nitro/validator"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down Expand Up @@ -187,12 +188,16 @@ func (v *L1Validator) resolveNextNode(ctx context.Context, info *StakerInfo, lat

func (v *L1Validator) isRequiredStakeElevated(ctx context.Context) (bool, error) {
callOpts := v.getCallOpts(ctx)
requiredStake, err := v.rollup.CurrentRequiredStake(callOpts)
baseStake, err := v.rollup.BaseStake(callOpts)
if err != nil {
return false, err
}
baseStake, err := v.rollup.BaseStake(callOpts)
requiredStake, err := v.rollup.CurrentRequiredStake(callOpts)
if err != nil {
if headerreader.ExecutionRevertedRegexp.MatchString(err.Error()) {
log.Warn("execution reverted checking if required state is elevated; assuming elevated", "err", err)
return true, nil
}
return false, err
}
return requiredStake.Cmp(baseStake) > 0, nil
Expand Down

0 comments on commit 51189e4

Please sign in to comment.