-
Notifications
You must be signed in to change notification settings - Fork 1
Example: Dining cryptographers #102
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
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
R2Err, | ||
} | ||
// TODO: for protocols that do not have "provable errors" we should have a shortcut and/or blanket impls. | ||
// TODO: Why does ProtocolError require Display? |
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, to show some short version of the error in a debugging/logging scenario, where an actual Debug
would be too long (because it may contain auxiliary information)
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'd argue that it's prooobably not our business (as library authors) to decide if a Debug
output is "too long" and imposing Display
as a stand-in for Debug
is a bit odd.
/// bla | ||
R2Err, | ||
} | ||
// TODO: for protocols that do not have "provable errors" we should have a shortcut and/or blanket impls. |
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.
There is an empty NoProtocolErrors
that implements ProtocolError
.
|
||
type ProtocolError = DiningError; | ||
|
||
// TODO: Having blanket impls for these methods would cut down on the boilerplate a bit. |
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.
True, but what would be the default behavior? If it's just ignoring the error, there is a danger of forgetting to implement them.
That said, I am not happy with these methods. They are far away from the message type, and not very convenient to write and debug. There should be a better way - somehow bundle these checks with the message type itself.
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.
You mean: protocols are so different that there's no reasonable default here? That's fair I guess. OTOH there's a limit to the amnount of hand-holding a library can provide beyond "make it easy to do the right thing". Tricky to know, but I guess the it's an indication that writing examples is useful to see where the sore spots are.
payloads: BTreeMap<Verifier, Payload>, | ||
artifacts: BTreeMap<Verifier, Artifact>, | ||
) -> Result<FinalizeOutcome<Verifier, Self::Protocol>, LocalError> { | ||
// Prolly just a NOP in this protocol? Maybe its artifact are the two bits (one private, one shared)? |
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 you have the second round, it should at least return Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(Round2 { .. })))
(yep, ergonomics is not great here. Can be improved)
} | ||
} | ||
|
||
// TODO: I don't understand why there needs to be a Signer and a Verifier type. Suspect it's a CGGMP "contamination" and that they are not needed at all for this protocol. |
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.
It's rather that manul
assumes you need authentication and evidence generation for your protocol (which you generally would in a production setting). Not needing those leads to unused arguments.
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.
You can also use manul::dev::TestSigner
/TestVerifier
which do pretty much what you've done here.
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.
Yeah, I tried to do without using manul::dev
but ended up doing pretty much exactly the same thing.
DRAFT
Implement Dining cryptographers problem in
manul
, as an example of a non-trivial protocol.