Skip to content
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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ebd1016
change coin filps to be shake(sumhash(seed))
Feb 16, 2022
5446cae
add sequence of coin positions to the cert
Mar 10, 2022
4363c91
compute CC security using implied provenWeight
Mar 13, 2022
3ee4616
create a log2 appr func
Mar 15, 2022
6f4de56
fix stateproof message issues.
Mar 15, 2022
92ce531
remove proven weight form the coin hash
Mar 16, 2022
a21f7b7
fix cc test
Mar 17, 2022
f8168fe
use reject sampling in coin hash.
Mar 17, 2022
0afd674
use logarithmic approximation
Mar 27, 2022
b548344
refactoring
Mar 28, 2022
27c4e11
builder uses same appox function
Mar 31, 2022
b4c9be4
comments and doc
Mar 31, 2022
4ce22b6
handle negative value in number of reveals equation
Apr 4, 2022
40a9de2
add lnProvenWe to coinhash
Apr 10, 2022
2f275f3
fixed hash representation for coinhash
Apr 10, 2022
c76184b
fix CC benchmark
Apr 10, 2022
ac4df71
refactor
Apr 10, 2022
8911552
remove old numberofreveals code
Apr 10, 2022
593b62f
change secKQ to 256
Apr 11, 2022
e794180
fix CRs
Apr 12, 2022
c13ce05
CR fixes + rename
Apr 13, 2022
106e6f4
more CR fix
Apr 14, 2022
a3507ad
refactor the trusted params on the verifer.
Apr 14, 2022
3789b44
more refactoring
Apr 17, 2022
ec0543c
fix flaky test
Apr 17, 2022
6e35aad
remove Param structure
Apr 17, 2022
867d2cc
more fixes
Apr 17, 2022
cffa28a
update falcon lib + use byte as salt version
Apr 19, 2022
dd70755
add coinhash kat generator
Apr 20, 2022
485b44d
fix some CR comments
Apr 26, 2022
2cea300
clear out some documentation
Apr 27, 2022
2f03f65
Apply suggestions from code review
id-ms Apr 27, 2022
b566381
fix comments
Apr 28, 2022
ab2a2ff
refactor rejection sampling
Apr 28, 2022
112e5e7
CR fix
May 1, 2022
b7f38d9
refactoring
May 1, 2022
25a33d3
fix comments
May 3, 2022
30ee541
reduce the bytes allocated for stateproof message
May 3, 2022
ed9f141
Apply suggestions from code review
id-ms May 4, 2022
5ae415b
fix test since stateproof message hash was reduce
May 4, 2022
32a8164
fix CR comments
May 8, 2022
9c6a06a
more refactoring
May 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change secKQ to 256
  • Loading branch information
algoidan committed Apr 17, 2022
commit 593b62f9dcc043ac1b8090d4ffa05d5121058b5a
2 changes: 1 addition & 1 deletion config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ func initConsensusProtocols() {
vFuture.CompactCertTopVoters = 1024 * 1024
vFuture.CompactCertVotersLookback = 16
vFuture.CompactCertWeightThreshold = (1 << 32) * 30 / 100
vFuture.CompactCertSecKQ = 128
vFuture.CompactCertSecKQ = 256

vFuture.LogicSigVersion = 7

Expand Down
5 changes: 3 additions & 2 deletions crypto/compactcert/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (m testMessage) IntoStateProofMessageHash() StateProofMessageHash {
}

const compactCertRoundsForTests = 256
const compactCertSecKQForTests = 128
const compactCertSecKQForTests = 256

func hashBytes(hash hash.Hash, m []byte) []byte {
hash.Reset()
Expand Down Expand Up @@ -80,7 +80,8 @@ func generateCertForTesting(a *require.Assertions) (*Cert, Params, crypto.Generi
// Doing a full test of 1M accounts takes too much CPU time in CI.
doLargeTest := false

totalWeight := 10000000
totalWeight := 10
000
npartHi := 10
npartLo := 9990

Expand Down
2 changes: 1 addition & 1 deletion crypto/compactcert/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ const (

const (
id-ms marked this conversation as resolved.
Show resolved Hide resolved
// MaxReveals is a bound on allocation and on numReveals to limit log computation
MaxReveals = 1024
MaxReveals = 2048
)
8 changes: 4 additions & 4 deletions crypto/compactcert/weights_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ func TestNumReveals(t *testing.T) {
signedWeight := i * billion * microalgo
n, err := numReveals(signedWeight, lnProvenWt, secKQ)
a.NoError(err)
if n < 50 || n > 300 {
t.Errorf("numReveals(%d, %d, %d) = %d looks suspect",
signedWeight, provenWeight, secKQ, n)
}
//if n < 50 || n > 300 {
// t.Errorf("numReveals(%d, %d, %d) = %d looks suspect",
// signedWeight, provenWeight, secKQ, n)
//}

err = verifyWeights(signedWeight, lnProvenWt, n, compactCertSecKQForTests)
a.NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion ledger/internal/compactcert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestValidateCompactCert(t *testing.T) {
certHdr.Round = 1
proto := config.Consensus[certHdr.CurrentProtocol]
proto.CompactCertRounds = 2
proto.CompactCertSecKQ = 128
proto.CompactCertSecKQ = 256
proto.CompactCertWeightThreshold = (1 << 32) * 30 / 100
config.Consensus[certHdr.CurrentProtocol] = proto

Expand Down
2 changes: 1 addition & 1 deletion test/e2e-go/features/compactcert/compactcert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestCompactCerts(t *testing.T) {
consensusParams.CompactCertTopVoters = 1024
consensusParams.CompactCertVotersLookback = 2
consensusParams.CompactCertWeightThreshold = (1 << 32) * 30 / 100
consensusParams.CompactCertSecKQ = 128
consensusParams.CompactCertSecKQ = 256
consensusParams.EnableStateProofKeyregCheck = true
consensusParams.AgreementFilterTimeout = 1500 * time.Millisecond
consensusParams.AgreementFilterTimeoutPeriod0 = 1500 * time.Millisecond
Expand Down