From 4a26a416d40339c6198fb2f9b7b4491b317c30c9 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Fri, 10 May 2024 00:51:55 -0500 Subject: [PATCH] Assume stake is elevated if currentRequiredStake reverts --- staker/l1_validator.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/staker/l1_validator.go b/staker/l1_validator.go index deaf4dc2dce..5d5d91083a8 100644 --- a/staker/l1_validator.go +++ b/staker/l1_validator.go @@ -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" @@ -187,13 +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 { - return false, err + if headerreader.ExecutionRevertedRegexp.MatchString(err.Error()) { + log.Warn("execution reverted checking if required state is elevated; assuming elevated", "err", err) + return true, nil + } } return requiredStake.Cmp(baseStake) > 0, nil }