-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mempool: ErrPreCheck and more log info #2724
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍇
mempool/mempool.go
Outdated
@@ -66,6 +66,9 @@ var ( | |||
|
|||
// ErrMempoolIsFull means Tendermint & an application can't handle that much load | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh that would be nice - maybe those funcs should return errors instead of bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎃 👻
|
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if mem.postCheck == nil { | ||
return true | ||
} | ||
if err := mem.postCheck(tx, r); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -66,7 +65,10 @@ func checkTxs(t *testing.T, mempool *Mempool, count int) types.Txs { | |||
t.Error(err) | |||
} | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
* '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.