Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Tendermint 0.26 + Fix panic on too many/large transactions #21

Merged
merged 2 commits into from
Nov 30, 2018

Conversation

tomtau
Copy link
Contributor

@tomtau tomtau commented Nov 22, 2018

Fixes #20

Tested with Tendermint 0.26.3

@zramsay
Copy link
Contributor

zramsay commented Nov 28, 2018

thanks! We'll get to this shortly :)

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.

🎄 🎅 🦌 🌟

@melekes
Copy link
Contributor

melekes commented Nov 29, 2018

Looks good to me!

@JacksonCoder @davebryson I'd appreciate if you guys find some time for a quick review.

@melekes melekes changed the title Upgraded to Tendermint 0.26 + fixed #20 Tendermint 0.26 + Fix panic on too many/large transactions Nov 29, 2018
@melekes
Copy link
Contributor

melekes commented Nov 29, 2018

@tomtau can we get this rebased against latest master? thanks

@davebryson
Copy link
Contributor

This will work for sure. It'd be nice to add more tests since NetStream has been added.

While we're fiddling with this, I wonder though if it would be better to do a bit of refactoring and just allocate (create) BytesMut based on the actual size of the response - versus preallocating it with BUFFER_SIZE and then doing the additional checks and the potential call to reserve?

Tomas Tauber added 2 commits November 30, 2018 10:45
…in tendermint/rust-tsp)

* added a mock stream to test the code and wrote a test to isolate the issue

* regenerated protobuf code with the latest rust-protobuf crate

* fixed the panic issue by checking the needed space and reserving more (if needed) before writing into the buffer
updated protos, build.rs...
@tomtau
Copy link
Contributor Author

tomtau commented Nov 30, 2018

@melekes rebased.

@davebryson I agree, but it may be better to open separate smaller issues and PRs for that. Besides more tests, here are a few points I'd like to fix:

  1. The current fix only helps with responses, but it's still possible to get a panic here:
    let _ = stream.read(bytes.as_mut());

    e.g. if one sends a very large QueryRequest. But this is a separate issue and I'm not yet sure what the best way to pre-allocate is for requests from streams -- perhaps bound it to the max block bytes consensus parameter? Or make use of that TM convention (https://tendermint.com/docs/spec/abci/client-server.html#server-implementations) on the receiving side?

Messages are serialized using Protobuf3 and length-prefixed with a signed Varint

  1. Add support for unix sockets to NetStream.

  2. Have a way to distinguish between connections (info, mempool, consensus) and have a relaxed trait that wouldn't need to mutate the app on requests from info and mempool, so that there's no need for that mutex.

  3. async processing for DeliverTx and CheckTx requests

  4. Have additional sanity checks on the ABCI protocol execution, so that client apps don't need to worry about them -- e.g. use https://docs.rs/session_types/0.2.0/session_types/

  5. instead of that nested if and unwrapping, just directly pattern match on request.value

  6. trait (e.g. ResponseTx) for ResponseCheckTx and ResponseDeliverTx, since they contain the same fields

@melekes melekes merged commit 6210e0d into tendermint:master Nov 30, 2018
@melekes
Copy link
Contributor

melekes commented Nov 30, 2018

Merged. Thanks everyone 👍

@tomtau feel free to open a new issue (or many small ones).

This was referenced Nov 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants