Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
fix(mempool): allow sdk.Tx's to not fail checkTx (#1318)
Browse files Browse the repository at this point in the history
this is bad but required


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
itsdevbear authored Nov 20, 2023
1 parent 4948099 commit b12b9a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cosmos/runtime/txpool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions cosmos/runtime/txpool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
})
})
Expand Down

0 comments on commit b12b9a5

Please sign in to comment.