Skip to content

Commit

Permalink
Assume stake is elevated if currentRequiredStake reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed May 10, 2024
1 parent d9a3ec2 commit b744328
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 b744328

Please sign in to comment.