-
Notifications
You must be signed in to change notification settings - Fork 207
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
Incorrect canonical block id #663
Comments
Good catch, let me check. |
Ok, this is one of the interesting edge-cases. Apparently, a If you check the protobuf messages, CanonicalBlockId is used by CanonicalVote and CanonicalProposal and in both cases, it's an optional field. If you encode CanonicalBlockId directly, it needs to inherit the property of being able to be nil, by becoming an enum that has its None and Some(fields) structure. In some cases this is inevitable, but seeing that anywhere we use CanonicalBlockId, it is already enclosed in an If we want to strictly adhere to the Go implementation's specifications, a CanonicalBlockId should be able to encode into a None by itself. Which I believe we won't ever do. Option number 1: Add a CanonicalBlockId domain type that is an enum of an empty None or a Some(CanonicalBlockId_structure). Strictly speaking this is in line with our expectations: our domain knowledge of CanonicalBlockId tells us that it can be a Option number 2: Keep the I've tried implementing both versions but the first option becomes a rabbit hole of caveats for the developer. The second one is straightforward, although sometimes leaves the developer needing to implement their own |
In Go tendermint: https://github.com/tendermint/tendermint/blob/master/types/canonical.go#L18
If block id hash is empty,
CanonicalizeBlockID
will returnnil
for CanonicalBlockID.In current tendermint-rs, one will get an empty struct (as with non-canonical Block ID): https://github.com/informalsystems/tendermint-rs/blob/master/tendermint/src/block/id.rs#L116
The text was updated successfully, but these errors were encountered: