mempool: ErrPreCheck and more log info#2724
Conversation
mempool/mempool.go
Outdated
| ErrMempoolIsFull = errors.New("Mempool is full") | ||
|
|
||
| // ErrPreCheck means the tx bytes are invalid - ie. too big. | ||
| ErrPreCheck = errors.New("Tx failed precheck") |
There was a problem hiding this comment.
Should we be explicit about the reason in the msg / logs? Otherwise devs will have to dig into the code in order to figure out what precheck is.
There was a problem hiding this comment.
Yeh that would be nice - maybe those funcs should return errors instead of bool?
|
|
I will fix. |
also, continue execution when checking txs in mempool_test if err=PreCheckErr
Codecov Report
@@ Coverage Diff @@
## develop #2724 +/- ##
===========================================
- Coverage 61.72% 61.58% -0.14%
===========================================
Files 207 207
Lines 16942 16951 +9
===========================================
- Hits 10458 10440 -18
- Misses 5622 5644 +22
- Partials 862 867 +5
|
| if mem.postCheck == nil { | ||
| return true | ||
| } | ||
| if err := mem.postCheck(tx, r); err != nil { |
There was a problem hiding this comment.
I think we probably want to report this through the logger. Looks like right now we just swallow it, so it won't be obvious why a tx failed
| } | ||
| if err := mempool.CheckTx(txBytes, nil); err != nil { | ||
| t.Fatalf("Error after CheckTx: %v", err) | ||
| if IsPreCheckError(err) { |
There was a problem hiding this comment.
why are these happening here?
There was a problem hiding this comment.
TestMempoolFilters will fail otherwise (it asserts a number of txs created, not panic)
| nopPreFilter := func(tx types.Tx) bool { return true } | ||
| nopPostFilter := func(tx types.Tx, res *abci.ResponseCheckTx) bool { return true } | ||
|
|
||
| // This is the same filter we expect to be used within node/node.go and state/execution.go |
* 'master' of https://github.com/tendermint/tendermint: (330 commits) Release/v0.26.1 (tendermint#2803) fix amino overhead computation for Tx (tendermint#2792) p2p: re-check after sleeps (tendermint#2664) check the result of `ps.peer.Send` before calling `ps.setHasVote` (tendermint#2787) p2p: AddressBook requires addresses to have IDs; Do not close conn immediately after sending pex addrs in seed mode (tendermint#2797) test AutoFile#Size (happy path) [autofile/group] do not panic when checking size openFile creates a file if not exist => ErrNotExist is not possible use our logger in autofile/group Add tests for ValidateBasic methods (tendermint#2754) [docs] improve organization of ABCI docs & fix links (tendermint#2749) p2p: peer-id -> peer_id (tendermint#2771) mempool: print postCheck error (tendermint#2762) Fix crypto/merkle ProofOperators.Verify to check bounds on keypath pa… (tendermint#2756) Mempool WAL is still created by default in home directory, leads to permission errors (tendermint#2758) mempool: ErrPreCheck and more log info (tendermint#2724) Release/v0.26.0 (tendermint#2726) [ADR] [DRAFT] pubsub 2.0 (tendermint#2532) validate reactor messages (tendermint#2711) TMHASH is 32 bytes. Closes tendermint#1990 (tendermint#2732) ...
…r) (backport tendermint#2715) (tendermint#2724) close: tendermint#779 This PR adds additional information on `ExtendedCommitInfo` and `CommitInfo` data types about the validator set ordering (total power) guarantees. #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [X] Updated relevant documentation (`docs/` or `spec/`) and code comments - [X] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec <hr>This is an automatic backport of pull request tendermint#2715 done by [Mergify](https://mergify.com). Co-authored-by: Andy Nogueira <me@andynogueira.dev>
We weren't returning error when failing PreCheck before.