Skip to content

Commit

Permalink
Get rid of err type check since it's done in go-sdk (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 authored Sep 24, 2023
1 parent 893a6ea commit 8b6763f
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions assembler/bsc_assembler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"time"

"cosmossdk.io/errors"
sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
oracletypes "github.com/cosmos/cosmos-sdk/x/oracle/types"

"github.com/bnb-chain/greenfield-relayer/common"
"github.com/bnb-chain/greenfield-relayer/config"
"github.com/bnb-chain/greenfield-relayer/db"
Expand Down Expand Up @@ -186,18 +182,16 @@ func (a *BSCAssembler) process(channelId types.ChannelId) error {
// broadcast on Node2 will fail due to inconsistency of nonce and channel sequence.
// Even the inturn relayer can resume crosschain delivery at next block(Because realyer would retry batch2 at block H+1). But it would
// waste plenty of gas. In that case, pasue the relayer 1 block. calibrate inturn relayer nonce and sequence
if errors.IsOf(err, sdkErrors.ErrWrongSequence, sdkErrors.ErrTxInMempoolCache, oracletypes.ErrInvalidReceiveSequence) {
newNonce, nonceErr := a.greenfieldExecutor.GetNonceOnNextBlock()
if nonceErr != nil {
return nonceErr
}
a.relayerNonce = newNonce
newNextDeliveryOracleSeq, seqErr := a.bscExecutor.GetNextDeliveryOracleSequenceWithRetry(a.getChainId())
if seqErr != nil {
return seqErr
}
a.inturnRelayerSequenceStatus.NextDeliverySeq = newNextDeliveryOracleSeq
newNonce, nonceErr := a.greenfieldExecutor.GetNonceOnNextBlock()
if nonceErr != nil {
return nonceErr
}
a.relayerNonce = newNonce
newNextDeliveryOracleSeq, seqErr := a.bscExecutor.GetNextDeliveryOracleSequenceWithRetry(a.getChainId())
if seqErr != nil {
return seqErr
}
a.inturnRelayerSequenceStatus.NextDeliverySeq = newNextDeliveryOracleSeq
return err
}
logging.Logger.Infof("relayed packages with oracle sequence %d ", i)
Expand Down

0 comments on commit 8b6763f

Please sign in to comment.