From 194e1812d4035861fae838e5453801e41ba10f83 Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Mon, 20 Nov 2023 17:44:02 -0500 Subject: [PATCH] fix(mempool): allow sdk.Tx's to not fail `checkTx` (#1318) this is bad but required ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling for transaction processing, allowing for smoother handling of non-Ethereum transactions. - **Tests** - Updated test cases to reflect new behavior in transaction processing, ensuring non-Ethereum transactions are accepted without errors. (cherry picked from commit b12b9a5f802f221dfedaaaf86e80a92065187d3f) --- cosmos/runtime/txpool/mempool.go | 3 ++- cosmos/runtime/txpool/mempool_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cosmos/runtime/txpool/mempool.go b/cosmos/runtime/txpool/mempool.go index cbe3f3775..b0d6ad3f6 100644 --- a/cosmos/runtime/txpool/mempool.go +++ b/cosmos/runtime/txpool/mempool.go @@ -102,7 +102,8 @@ func (m *Mempool) Insert(ctx context.Context, sdkTx sdk.Tx) error { } if wet, ok := utils.GetAs[*types.WrappedEthereumTransaction](msgs[0]); !ok { - return errors.New("only WrappedEthereumTransactions are supported") + // We have to return nil for non-ethereum transactions as to not fail check-tx. + return nil } else if errs := m.txpool.Add( []*coretypes.Transaction{wet.Unwrap()}, false, false, ); len(errs) != 0 { diff --git a/cosmos/runtime/txpool/mempool_test.go b/cosmos/runtime/txpool/mempool_test.go index 61e1e074f..7c2ea7933 100644 --- a/cosmos/runtime/txpool/mempool_test.go +++ b/cosmos/runtime/txpool/mempool_test.go @@ -81,9 +81,9 @@ var _ = Describe("", func() { }) }) When("we use an that is not an ethereum msg", func() { - It("errors", func() { + It("does not error", func() { sdkTx.On("GetMsgs").Return([]sdk.Msg{nil}).Once() - Expect(mempool.Insert(ctx, sdkTx)).To(HaveOccurred()) + Expect(mempool.Insert(ctx, sdkTx)).ToNot(HaveOccurred()) }) }) })