From 1d61cc8dc259ecfa1fca9494f1a5d35b1da1dda5 Mon Sep 17 00:00:00 2001 From: Alexxxxxx <118710506+alexgao001@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:37:53 +0800 Subject: [PATCH 1/2] fix tx already sent by inturn relayer but fail to udpate DB tx status (#88) --- assembler/bsc_assembler.go | 2 +- executor/greenfield_executor.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/assembler/bsc_assembler.go b/assembler/bsc_assembler.go index 79a7fc6..6cb4308 100644 --- a/assembler/bsc_assembler.go +++ b/assembler/bsc_assembler.go @@ -186,7 +186,7 @@ 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, oracletypes.ErrInvalidReceiveSequence) { + if errors.IsOf(err, sdkErrors.ErrWrongSequence, sdkErrors.ErrTxInMempoolCache, oracletypes.ErrInvalidReceiveSequence) { newNonce, nonceErr := a.greenfieldExecutor.GetNonceOnNextBlock() if nonceErr != nil { return nonceErr diff --git a/executor/greenfield_executor.go b/executor/greenfield_executor.go index 968bf6a..ac39a63 100644 --- a/executor/greenfield_executor.go +++ b/executor/greenfield_executor.go @@ -327,6 +327,10 @@ func (e *GreenfieldExecutor) ClaimPackages(client *GreenfieldClient, payloadBts return "", sdkErrors.ErrWrongSequence } + if txRes.Codespace == sdkErrors.RootCodespace && txRes.Code == sdkErrors.ErrTxInMempoolCache.ABCICode() { + return "", sdkErrors.ErrTxInMempoolCache + } + if txRes.Code != 0 { return "", fmt.Errorf("claim error, code=%d, log=%s", txRes.Code, txRes.RawLog) } From 893a6eab80b3fd7121efb128dc3231601f50fb42 Mon Sep 17 00:00:00 2001 From: Alexxxxxx <118710506+alexgao001@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:28:11 +0800 Subject: [PATCH 2/2] bump version (#89) --- executor/client.go | 8 +++++--- go.mod | 6 +++--- go.sum | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/executor/client.go b/executor/client.go index 785941b..9b33c84 100644 --- a/executor/client.go +++ b/executor/client.go @@ -10,7 +10,7 @@ import ( ) type GreenfieldClient struct { - sdkclient.Client + sdkclient.IClient Height int64 } @@ -27,7 +27,7 @@ func NewGnfdCompositClients(rpcAddrs []string, chainId string, account *types.Ac continue } clients = append(clients, &GreenfieldClient{ - Client: sdkClient, + IClient: sdkClient, }) if len(clients) == 0 { panic("no Greenfield client available") @@ -67,7 +67,9 @@ func (gc *GnfdCompositeClients) GetClient() *GreenfieldClient { func getClientBlockHeight(clientChan chan *GreenfieldClient, wg *sync.WaitGroup, client *GreenfieldClient) { defer wg.Done() - status, err := client.GetStatus(context.Background()) + ctxWithTimeout, cancel := context.WithTimeout(context.Background(), RPCTimeout) + defer cancel() + status, err := client.GetStatus(ctxWithTimeout) if err != nil { return } diff --git a/go.mod b/go.mod index 8b33203..09d67e9 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( cosmossdk.io/errors v1.0.0-beta.7 github.com/avast/retry-go/v4 v4.3.1 github.com/aws/aws-sdk-go v1.40.45 - github.com/bnb-chain/greenfield v0.2.5 - github.com/bnb-chain/greenfield-go-sdk v0.2.5 + github.com/bnb-chain/greenfield v0.2.6 + github.com/bnb-chain/greenfield-go-sdk v0.2.6 github.com/cometbft/cometbft v0.37.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/ethereum/go-ethereum v1.11.3 @@ -178,7 +178,7 @@ replace ( github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 github.com/consensys/gnark-crypto => github.com/consensys/gnark-crypto v0.7.0 - github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v0.2.5 + github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v0.2.6 github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) diff --git a/go.sum b/go.sum index 333f8a9..d6c0d98 100644 --- a/go.sum +++ b/go.sum @@ -158,22 +158,22 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield v0.2.5 h1:AmHvGfJmHm7FXB4II4mAB6i68bw98p86ZlIs9r6YeRM= -github.com/bnb-chain/greenfield v0.2.5/go.mod h1:nNsy8QGR8+R0j6Qz/duNE94NDDNuomC6wWDCzfl7jKc= +github.com/bnb-chain/greenfield v0.2.6 h1:U40wmSBQR4Wd0HiVCu/J6zqoLS4YUrvNgyuX71kgK3U= +github.com/bnb-chain/greenfield v0.2.6/go.mod h1:8kGVzKu3BEbpotk2Lmp/OzPh+nhbMsuUJueZtn0he4s= github.com/bnb-chain/greenfield-cometbft v0.0.3 h1:tv8NMy3bzX/1urqXGQIIAZSLy83loiI+dG0VKeyh1CY= github.com/bnb-chain/greenfield-cometbft v0.0.3/go.mod h1:f35mk/r5ab6yvzlqEWZt68LfUje68sYgMpVlt2CUYMk= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI= github.com/bnb-chain/greenfield-common/go v0.0.0-20230830120314-a54ffd6da39f h1:zJvB2wCd80DQ9Nh/ZNQiP8MrHygSpDoav7OzHyIi/pM= github.com/bnb-chain/greenfield-common/go v0.0.0-20230830120314-a54ffd6da39f/go.mod h1:it3JJVHeG9Wp4QED2GkY/7V9Qo3BuPdoC5/4/U6ecJM= -github.com/bnb-chain/greenfield-cosmos-sdk v0.2.5 h1:8zIn/ExfMHZVBbVwhILG9KYO1m3pZO8I8stpqbFgzkk= -github.com/bnb-chain/greenfield-cosmos-sdk v0.2.5/go.mod h1:y3hDhQhil5hMIhwBTpu07RZBF30ZITkoE+GHhVZChtY= +github.com/bnb-chain/greenfield-cosmos-sdk v0.2.6 h1:aPrd2nG2nYZr8nSmGgN8efus6sni4OIZ1Bdx6s+mS3A= +github.com/bnb-chain/greenfield-cosmos-sdk v0.2.6/go.mod h1:y3hDhQhil5hMIhwBTpu07RZBF30ZITkoE+GHhVZChtY= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210 h1:GHPbV2bC+gmuO6/sG0Tm8oGal3KKSRlyE+zPscDjlA8= github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210/go.mod h1:vhsZxXE9tYJeYB5JR4hPhd6Pc/uPf7j1T8IJ7p9FdeM= github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230816082903-b48770f5e210 h1:FLVOn4+OVbsKi2+YJX5kmD27/4dRu4FW7xCXFhzDO5s= github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230816082903-b48770f5e210/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM= -github.com/bnb-chain/greenfield-go-sdk v0.2.5 h1:ErI7nUtNCRDvpXSVaG/XKXEBhTcmiofg/2ciKU1uBag= -github.com/bnb-chain/greenfield-go-sdk v0.2.5/go.mod h1:rWI9Xgcto7ujajNfG6x7+lW1SzbJWBkIgnOcoNjWS7U= +github.com/bnb-chain/greenfield-go-sdk v0.2.6 h1:CGmMK+Ie3ZXae86rGYJnaF7FmO+y92S4a/Qp7DzxhLU= +github.com/bnb-chain/greenfield-go-sdk v0.2.6/go.mod h1:MrxZcdoK/YC8o0wECOv8fskozBokekxApLbi1P6qeTI= github.com/bnb-chain/greenfield-iavl v0.20.1 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM= github.com/bnb-chain/greenfield-iavl v0.20.1/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=