-
Notifications
You must be signed in to change notification settings - Fork 167
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
Generalize Vote and SignatureAggregator over type of value they hold. #2887
Merged
+142
−64
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
99042b8
SignatureAggregator over GenericCertificate
deuszx 7ecabc9
Vote is generic over value it contains
deuszx a1e3418
Use actual Timeout type in ChainManager instead
deuszx bdbad2f
Replace From with TryFrom
deuszx dcf0a66
Replace TODO with a comment.
deuszx b4e8e64
Replace hand-written Deserialize for Vote with derive
deuszx 07bb76a
Simplify call to extract ChainId
deuszx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 not use a constructor for a
Hashed<Timeout>
directly? (Also below.)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.
b/c the hashes would change, and we still haven't done that.actually let me check.
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.
Oh, we are currently instantiating
Hashed<T>
s usingnew_unchecked
that actually don't match whatHashed::new
would do? 😬 Would be good to fix that as soon as possible and have only one way to hash things.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.
With this change I get a test failure (without passes fine):
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.
The only way to fix this is to get rid of
CertificateValue
(andCertificate
) entirely.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.
Exactly: We could serialize
Timeout
as if it were aCertificateValue::Timeout
.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.
do the transformation in the
Serialize
(andDeserialize
)? Not a bad idea, I'll give it a try.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.
And maybe not even do a transformation, but serialize a struct that only borrows the payload but is otherwise identical to
CertificateValue
?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.
Here we go again...
This won't work. In the deserializer for
Timeout
:the last line will "hint" the
serde-reflection
to generate an instance ofCertificateValue
enum but it will generate the first enum variant -CertificateValue::ValidatedBlock
and theformat.yaml
test will fail. I think we need to get rid of that enum ASAP to get any further - right now a mix of an enum and howserde-reflection
behaves with enums is blocking us.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.
CertifivateValue
is an enum so my "temporary struct" would have to reflect its structure b/cserde
(-reflection
) uses that to derive the binary format.