-
Notifications
You must be signed in to change notification settings - Fork 224
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
abci: Add domain types #862
abci: Add domain types #862
Conversation
Update 2021-09-10, some of these are no longer relevant, so I've crossed them out.
|
29bf6b3
to
1175d4f
Compare
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.
Thanks so much for all this work! 🎉 I've done a first pass here and had a few comments/questions, but it's already looking like it's in really good shape.
tendermint::abci
.
Bump. What's the status here / is there anything we can help with? (ref penumbra-zone#1) |
Also happy to help on this! |
1175d4f
to
e6d14ac
Compare
Hey, sorry for the delay -- I wasn't able to pick it up again in June after the initial review because of some other work, but I've rebased it on top of the current state of the |
36069f3
to
2a78e5f
Compare
Update:
Remaining work:
I'll post an update when I've finished those two and this is ready for re-review. |
26f9ef5
to
dd59660
Compare
I've rebased this branch on top of current Currently, it's broken, because the conversions between the domain types and the proto types used Before trying to correct this, I'd like to make sure I understand how the error modeling is supposed to work. I looked at the |
726beaa
to
45c3946
Compare
Sure I can give some context there! flex-error does, as you say, abstract over other error handling crates, and our main goals there are:
|
This is useful until informalsystems/tendermint-rs#862 is merged upstream.
The BlockParams and ConsensusParams structs moved out of the ABCI protos.
This fixes a compile error introduced by upstream proto changes that add an Sr25519 variant.
The previous data modeling allowed a user to construct an `Err(0)` value that would be serialized and deserialized as `Ok`.
This changes the Serialize/Deserialize implementations for Block to convert to/from the proto-generated `RawBlock`, and use the derived serialization for that type. This is much cleaner and more maintainable than keeping Serde annotations for each sub-member of the data structure, because all of the serialization code is kept in one place, and there's only one validation path (the TryFrom conversion from RawBlock to Block) that applies to both kinds of serialization.
This changes the Block type to hold the transactions as a plain `Vec<Vec<u8>>`, rather than as a custom `abci::transaction::Data` type (which is itself a wrapper for an `Option<Vec<Transaction>>`, the `Transaction` type being a wrapper for a `Vec<u8>`). This also updates the `Block` getter functions; it's not clear (to me) why they're there, since they access the public fields and aren't used anywhere else.
The existing contents of the `tendermint::abci` module note that they're only for the purpose of implementing the RPC endpoints, not a general ABCI implementation. Moving that code from the `tendermint` crate to the `tendermint-rpc` crate decouples the RPC interface from improvements to the ABCI domain modeling. Eventually, it would be good to eliminate this code and align it with the new ABCI domain types.
These types mirror the generated types in tendermint_proto, but have better naming. The documentation for each request type is adapted from the ABCI Methods and Types spec document. However, the same logical request may appear three times, as a struct with the request data, as a Request variant, and as a CategoryRequest variant. To avoid duplication, this PR uses the `#[doc = include_str!(...)]` functionality stabilized in Rust 1.54 to keep common definitions of the documentation.
The code in the `abci` module had more complete documentation from the ABCI docs, so I copied it onto the existing structure.
fde6080
to
9660feb
Compare
@thanethomson I've rebased this again and deduplicated types per your suggestions (thanks for pointing those out!). I also aligned all the errors, and then rebased again to eliminate the placeholder commits labeled "drop me". So, this should be good to go. |
Superseded by (and included in) #1022. |
🎊 Thanks so much for getting this over the finish line!! |
Now that informalsystems/tendermint-rs#862 is merged, we can stop using our own branch.
Now that informalsystems/tendermint-rs#862 is merged, we can stop using our own branch.
Incomplete implementation of #856
Still to do: