-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update Synedrion usage to v0.0.12 #535
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 already approved the PR from the fork version - assuming this is the same
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.
Mostly just questions since I'm not familiar with this stuff yet 😄
.into_iter() | ||
.map(|acc| VerifierWrapper(sr25519::Public(acc.0))) | ||
.collect::<Vec<_>>(); | ||
let pair = PairWrapper(threshold_pair.clone()); | ||
|
||
// TODO (#375): this should come from whoever initiates the signing process, | ||
// (or as some deterministic function, e.g. the hash of the last block mined) | ||
// and be the same for all participants. | ||
let shared_randomness = b"123456"; |
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.
lol
@@ -27,7 +27,6 @@ pub async fn do_dkg( | |||
signer: &PairSigner<EntropyConfig, sr25519::Pair>, | |||
state: &ListenerState, | |||
sig_request_account: AccountId32, | |||
my_subgroup: &u8, |
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.
We'll need to remove this from the fields
list above
from: &PartyId, | ||
to: &PartyId, | ||
payload: SignedMessage<sr25519::Signature>, | ||
) -> Self { | ||
Self { from: from.clone(), to: Some(to.clone()), payload } | ||
Self { from: from.clone(), to: to.clone(), payload } |
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 know you didn't introduce this, but it might be nicer to take owned values in the function and have the caller potentially allocate up-front
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.
Even better, PartyId
should just implement Copy
.
fn to_public(&self) -> sr25519::Public { | ||
// TODO (#376): assuming that `Public` and `AccountId32` represent the same 32 bytes. | ||
// Ideally we should use only one of those throughout the code, probably `Public`. | ||
sr25519::Public(self.0 .0) |
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.
Bit of a random question, but do you know why this gets formatted like this instead of self.0.0
?
// Send out broadcasts | ||
let destinations = session.broadcast_destinations(); | ||
if let Some(destinations) = destinations { | ||
// TODO: this can happen in a spawned task |
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.
We should make an issue for this and either annotate the TODO
s or get rid of them
tx.send(ProtocolMessage::new(&my_id, destination, message))?; | ||
|
||
// This will happen in a host task | ||
accum.add_artefact(artefact)?; |
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.
accum.add_artefact(artefact)?; | |
accum.add_artifact(artifact)?; |
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.
Sorry, I was using British spelling here, which I thought was the only one, but only later realized that there are two variants. I don't mind switching to the American spelling, but I need to change it in Synedrion for consistency.
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.
Gotcha, didn't realize there was a British spelling for this. For APIs though I'd stick to American English since that's the most common thing in tech
Ok(()) | ||
} else { | ||
Err(signature::Error::new()) | ||
async fn execute_protocol_generic<Res: ProtocolResult>( |
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.
Could be useful to annotate this with #[tracing::instrument]
and have some events throughout the execution flow
loop { | ||
let mut accum = session.make_accumulator(); | ||
|
||
// Send out broadcasts |
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.
Since I'm not familiar with this bit of the code, can you explain the difference between sending out and broadcast and sending direct messages and why both are needed?
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 difference is basically that the broadcast message is prepared once for all destinations, and the direct ones are prepared for each destination separately. Since it takes some times to generate the proofs (and I wanted to leave a possibility of parallelizing the process), it is a meaningful distinction. It could also affect the way we send the messages out, but since we don't have access to a broadcast channel, it doesn't.
That said, I'm planning to simplify the API by only sending one message per destination - entropyxyz/synedrion#62
accum.add_processed_message(processed)??; | ||
} | ||
|
||
while !session.can_finalize(&accum)? { |
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.
What does it mean for a session to get "finalized"?
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.
Good question, perhaps a better name for this object is Round
, since we create a new one for every round. If that is what you meant.
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.
Or I suppose the method can be called finalize_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.
I was more asking about the conditions around a session/round being finalized, and any guarantees or assumptions that can come afterwards
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.
Basically, at this stage you merge the info you got from all the other parties during the round. finalize()
contains anything that needs more than just the initial state of the round and the message from one node. For example, summing up secret share changes coming from other nodes. If it fails, that's when the "correctness proofs" become necessary, because you can't pinpoint the malicious node, so you can only generate a proof that you yourself did everything correctly and publish it.
(had to move #525 from my fork to the main repo because CircleCI sucks)
synedrion
, not a branch with a fix #509Public
vsAccountId32
#376 is still open: even though we're usingPublicKey
instead ofPublic
now, the problem still stands: we haveAccountId32
andPublic
with identical contents.VerifierWrapper
was removed,PartyId
now implements the necessary traits directly.ProtocolMessage
does not make a distinction between broadcast and direct messages anymore, since our messaging is direct-only. There is still a distinction in the protocol execution loop, but it will be removed when message bundling is implemented (see Message bundling synedrion#62)protocol_transport/mod.rs
synedrion::sessions::Error::Local
).