Skip to content
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

Merged
merged 2 commits into from
Nov 6, 2018
Merged

Conversation

ebuchman
Copy link
Contributor

We weren't returning error when failing PreCheck before.

@ebuchman ebuchman requested review from melekes and xla as code owners October 29, 2018 12:58
Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍇

@@ -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")
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Copy link
Contributor

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎃 👻

@melekes
Copy link
Contributor

melekes commented Nov 1, 2018

--- FAIL: TestMempoolFilters (0.00s)
	mempool_test.go:69: Error after CheckTx: Tx failed precheck

@melekes
Copy link
Contributor

melekes commented Nov 1, 2018

I will fix.

also, continue execution when checking txs in mempool_test if
err=PreCheckErr
@codecov-io
Copy link

Codecov Report

Merging #2724 into develop will decrease coverage by 0.13%.
The diff coverage is 93.75%.

@@             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
Impacted Files Coverage Δ
mempool/mempool.go 78.52% <93.75%> (+4.34%) ⬆️
privval/ipc_server.go 64.15% <0%> (-5.67%) ⬇️
consensus/state.go 75.93% <0%> (-3.06%) ⬇️
state/store.go 67.47% <0%> (-2.6%) ⬇️
consensus/reactor.go 71.22% <0%> (-0.78%) ⬇️
blockchain/pool.go 65.73% <0%> (-0.7%) ⬇️
privval/tcp_server.go 81.42% <0%> (+2.85%) ⬆️

Copy link
Contributor Author

@ebuchman ebuchman left a 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 {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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?

Copy link
Contributor

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ebuchman ebuchman merged commit 7246ffc into develop Nov 6, 2018
@ebuchman ebuchman deleted the bucky/mempool-err-and-log branch November 6, 2018 06:32
melekes added a commit that referenced this pull request Nov 6, 2018
This is a follow-up from #2724
melekes added a commit that referenced this pull request Nov 6, 2018
This is a follow-up from #2724

Closes #2761
@melekes melekes mentioned this pull request Nov 6, 2018
4 tasks
ebuchman pushed a commit that referenced this pull request Nov 7, 2018
This is a follow-up from #2724

Closes #2761
maxim-levy pushed a commit to maxim-levy/tendermint that referenced this pull request Nov 13, 2018
* '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)
  ...
iKapitonau pushed a commit to scrtlabs/tendermint that referenced this pull request Jul 10, 2024
…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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants