-
Notifications
You must be signed in to change notification settings - Fork 490
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 stateproof verifier snark friendly #3895
Changes from 1 commit
ebd1016
5446cae
4363c91
3ee4616
6f4de56
92ce531
a21f7b7
f8168fe
0afd674
b548344
27c4e11
b4c9be4
4ce22b6
40a9de2
2f275f3
c76184b
ac4df71
8911552
593b62f
e794180
c13ce05
106e6f4
a3507ad
3789b44
ec0543c
6e35aad
867d2cc
cffa28a
dd70755
485b44d
2cea300
2f03f65
b566381
ab2a2ff
112e5e7
b7f38d9
25a33d3
30ee541
ed9f141
5ae415b
32a8164
9c6a06a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,8 @@ type sigslot struct { | |
// a compact certificate for that message. | ||
type Builder struct { | ||
Params | ||
data StateProofMessageHash | ||
round uint64 | ||
sigs []sigslot // Indexed by pos in participants | ||
sigsHasValidL bool // The L values in sigs are consistent with weights | ||
id-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
signedWeight uint64 // Total weight of signatures so far | ||
|
@@ -57,16 +59,17 @@ type Builder struct { | |
// to be signed, as well as other security parameters, are specified in | ||
// param. The participants that will sign the message are in part and | ||
// parttree. | ||
id-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
func MkBuilder(param Params, part []basics.Participant, parttree *merklearray.Tree) (*Builder, error) { | ||
func MkBuilder(param Params, data StateProofMessageHash, round uint64, part []basics.Participant, parttree *merklearray.Tree) (*Builder, error) { | ||
npart := len(part) | ||
lnProvenWt, err := lnIntApproximation(param.ProvenWeight) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
b := &Builder{ | ||
Params: param, | ||
|
||
Params: param, | ||
data: data, | ||
round: round, | ||
sigs: make([]sigslot, npart), | ||
sigsHasValidL: false, | ||
signedWeight: 0, | ||
|
@@ -104,9 +107,9 @@ func (b *Builder) IsValid(pos uint64, sig merklesignature.Signature, verifySig b | |
return err | ||
} | ||
|
||
cpy := make([]byte, len(b.Params.Data)) | ||
copy(cpy, b.Params.Data[:]) // TODO: onmce cfalcon is fixed can remove this copy. | ||
if err := p.PK.VerifyBytes(uint64(b.Round), cpy, sig); err != nil { | ||
cpy := make([]byte, len(b.data)) | ||
copy(cpy, b.data[:]) // TODO: onmce cfalcon is fixed can remove this copy. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this copy still needed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we still have a might have problem with c-falcon. when everything will be ready to merge into master we will remove it. |
||
if err := p.PK.VerifyBytes(b.round, cpy, sig); err != nil { | ||
id-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return err | ||
} | ||
} | ||
|
@@ -213,7 +216,7 @@ func (b *Builder) Build() (*Cert, error) { | |
lnProvenWeight: b.lnProvenWeight, | ||
sigCommitment: c.SigCommit, | ||
signedWeight: c.SignedWeight, | ||
data: b.Params.Data, | ||
data: b.data, | ||
} | ||
|
||
coinHash := makeCoinGenerator(&choice) | ||
|
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.
Returning the error directly like this is problematic. When eventually the error is logged or reported to the user, it will be very difficult, if not impossible, to know where the error came from.
The convention followed is to wrap the received error before reporting it upwards.
For example, see below (which should be %w and not %v):