From 8b6763fe7802c5ccd6ecd3dbb3c19c86fcd0bd31 Mon Sep 17 00:00:00 2001 From: Alexxxxxx <118710506+alexgao001@users.noreply.github.com> Date: Sun, 24 Sep 2023 14:18:04 +0800 Subject: [PATCH] Get rid of err type check since it's done in go-sdk (#92) --- assembler/bsc_assembler.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/assembler/bsc_assembler.go b/assembler/bsc_assembler.go index 6cb4308..4560c8d 100644 --- a/assembler/bsc_assembler.go +++ b/assembler/bsc_assembler.go @@ -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" @@ -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)