From 0b18c9259415cb3090db2cf1ddcca9f7d659b139 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Mon, 22 Jul 2024 12:49:27 -0700 Subject: [PATCH 1/2] fix(e2e): ignore context cancelled --- cmd/zetae2e/local/local.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 887a21d43a..0a7c0fedca 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -2,6 +2,7 @@ package local import ( "context" + "errors" "os" "path/filepath" "time" @@ -331,7 +332,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { // if all tests pass, cancel txs priority monitoring and check if tx priority is not correct in some blocks logger.Print("⏳ e2e tests passed,checking tx priority") monitorPriorityCancel() - if err := <-txPriorityErrCh; err != nil { + if err := <-txPriorityErrCh; err != nil && !errors.Is(err, context.Canceled) { logger.Print("❌ %v", err) logger.Print("❌ e2e tests failed after %s", time.Since(testStartTime).String()) os.Exit(1) From dec172d80a1c7e4ca5d3bccaf81ec07ab986c010 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Tue, 23 Jul 2024 09:25:15 -0700 Subject: [PATCH 2/2] use sentinel error --- cmd/zetae2e/local/local.go | 2 +- cmd/zetae2e/local/monitor_priority_txs.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 0a7c0fedca..da31a30f7d 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -332,7 +332,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { // if all tests pass, cancel txs priority monitoring and check if tx priority is not correct in some blocks logger.Print("⏳ e2e tests passed,checking tx priority") monitorPriorityCancel() - if err := <-txPriorityErrCh; err != nil && !errors.Is(err, context.Canceled) { + if err := <-txPriorityErrCh; err != nil && errors.Is(err, errWrongTxPriority) { logger.Print("❌ %v", err) logger.Print("❌ e2e tests failed after %s", time.Since(testStartTime).String()) os.Exit(1) diff --git a/cmd/zetae2e/local/monitor_priority_txs.go b/cmd/zetae2e/local/monitor_priority_txs.go index 8fce9dda79..f77e79d74c 100644 --- a/cmd/zetae2e/local/monitor_priority_txs.go +++ b/cmd/zetae2e/local/monitor_priority_txs.go @@ -13,6 +13,8 @@ import ( "github.com/zeta-chain/zetacore/e2e/config" ) +var errWrongTxPriority = errors.New("wrong tx priority, system tx not on top") + // monitorTxPriorityInBlocks checks for transaction priorities in blocks and reports errors func monitorTxPriorityInBlocks(ctx context.Context, conf config.Config, errCh chan error) { rpcClient, err := rpchttp.New(conf.RPCs.ZetaCoreRPC, "/websocket") @@ -71,7 +73,7 @@ func processTx(txResult *coretypes.ResultTx, nonSystemTxFound *bool, errCh chan if isMsgTypeURLSystemTx(attr) { // a non system tx has been found in the block before a system tx if *nonSystemTxFound { - errCh <- errors.New("wrong tx priority, system tx not on top") + errCh <- errWrongTxPriority return } } else {