-
Notifications
You must be signed in to change notification settings - Fork 68
WIP: A0-1820: Add justifications and validator implementations #840
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
Conversation
maciejnems
left a comment
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.
From what I understand outside of session map, the only write lock we have is for subscribing for authority list, so there is no possibility of new deadlocks to occur after changing it to sync code.
| impl<H: SubstrateHeader<Number = BlockNumber>> Verifier<Justification<H>> for FullVerifier { | ||
| type Error = VerificationError; | ||
|
|
||
| fn verify(&self, justification: Justification<H>) -> Result<Justification<H>, Self::Error> { |
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.
This verify seems to be pretty heavy. On each call it locks on SessionMap, clones authorities and creates a new verifier. Still I'm not sure if there is a better way, to create a full verifier.
I guess we would have to somehow cache already existing verifiers and remove them from cache once they are not needed, which is already done in SessionMap :// maybe @DamianStraszak has an idea for that.
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.
I agree this is annoying... I'll look into how hard it would be to rewrite ROSM some more to avoid this.
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.
Ok, it seems I'll rewrite much more here after all, I'll open a separate PR for some smaller part of this and then write one for the verifier (although it will take longer). This one will likely get closed.
| fn from(authority_data: SessionAuthorityData) -> Self { | ||
| SessionVerifier { | ||
| authority_verifier: AuthorityVerifier::new(authority_data.authorities().to_vec()), | ||
| emergency_signer: authority_data.emergency_finalizer().clone(), |
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.
Also this clone should probably not happen, as we move SessionAuthorityData. That said I'm not sure how to get authorities and signer out of SessionAuthorityData ://
Description
Implements the validator and justifications. Makes the code a bit of a mess, mostly because some of this stuff was already there and still needs to be used externally while we still have the legacy justification sync.
Type of change
Checklist: