-
Notifications
You must be signed in to change notification settings - Fork 1
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
Make Round
dyn-safe
#94
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 13443457877Details
💛 - Coveralls |
The only comment I have on this is that we have a fair bit of work to do to design our error handling – in particular what to do about panics and our usage of asserts. Do you think we should return
I think they now refer to it as "dyn safety". I don't think it's a great name but I think we should use it.
Sounds reasonable. |
We only have a few outside of
What method are you referring to? |
I haven't read the code yet, but can you elaborate on why you prefer |
Dyn-safe traits cannot have |
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.
LGTM
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(ChainedRound::< | ||
Id, | ||
T, | ||
> { | ||
state: ChainState::Protocol2(round), | ||
}))) |
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.
Maybe do something like this to help with the wonky formatting here?
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(ChainedRound::< | |
Id, | |
T, | |
> { | |
state: ChainState::Protocol2(round), | |
}))) | |
let round = entry_point2.make_round(rng, &shared_randomness, &id)?; | |
let round = BoxedRound::new_dynamic(ChainedRound::<_, T> { | |
state: ChainState::Protocol2(round), | |
}); | |
Ok(FinalizeOutcome::AnotherRound(round)) | |
Payload::try_to_typed()
andArtifact::try_to_typed()
todowncast()
(for uniformity withBox
andBoxedRound
)Round
methods takedyn CryptoRngCore
. This lead to an avalanche of changes, see below.dyn-safe
Round
I started with adding
?Sized
toCryptoRngCore
inRound
methods and removingBoxedRng
. For now it is a separate commit. But with that,ObjectSafeRound
became extremely close toRound
, so I tried removing it completely and makeRound
itself dyn-safe.As a result:
BoxedFormat
(since we need both inMisbehave
, even if the round itself only needs a serializer to serialize messages)Round::finalize
hasself: Box<Self>
as the first parameter instead of justself