Merged
Conversation
gbotrel
reviewed
Apr 21, 2021
fiat-shamir/transcript_test.go
Outdated
| return fs | ||
| } | ||
|
|
||
| func eq(a, b []byte) bool { |
Collaborator
There was a problem hiding this comment.
use bytes.Equal(...) here
gbotrel
reviewed
Apr 21, 2021
| @@ -32,6 +32,7 @@ type Polynomial interface { | |||
| type Digest interface { | |||
| io.WriterTo | |||
Collaborator
There was a problem hiding this comment.
are these two interfaces used? (io.WriterTo, io.ReaderFrom) on Digest?
Contributor
Author
There was a problem hiding this comment.
Currently there are not used, but they will be eventually (the commitments need to be passed to the rollup operator/blockchain at some point).
gbotrel
reviewed
Apr 21, 2021
| // are added is important. Once a challenge is computed, it cannot be | ||
| // binded to other values. | ||
| func (m *Transcript) Bind(challenge string, value []byte) error { | ||
|
|
Collaborator
There was a problem hiding this comment.
cleaner to deal with error first ("idiomatic go"):
challengeNumber, ok := m.challengeOrder[challenge]
if !ok {
return err
}
// deal with nominal case. Same remark in ComputeChallenge
gbotrel
reviewed
Apr 21, 2021
gbotrel
reviewed
Apr 21, 2021
fiat-shamir/transcript.go
Outdated
| } | ||
|
|
||
| // write the binded values in the order they were added | ||
| m.h.Write(m.bindings[challengeNumber]) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds a transcript object to apply Fiat Shamir transform.
API breaking change
Addition of method
Bytes() []byteon Digest struct:Transcript
To apply Fiat Shamir one needs to create a transcript while providing the hash function used for challenges derivation as well as a list of names for the challenges. No challenges can be added afterwards:
func NewTranscript(h HashFS, challenges ...string) TranscriptTranscript object offers the following API:
(m *Transcript) Bind(challenge string, value []byte) error: binds a challenge (referred to by its name) to a value. An error is returned when the challenge has already been computed or if the name is not recorded(m *Transcript) ComputeChallenge(challenge string) ([]byte, error): computes the challenge linked to the name. It returns an error if the previous challenge (in the order defined during the Transcript creation) is not computed.