-
Notifications
You must be signed in to change notification settings - Fork 471
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
Algod: State Proofs #4226
Merged
Merged
Algod: State Proofs #4226
Conversation
This file contains 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
* adding version check for falcon signatures * go.mod tidy * removed from merklesig Verify func: version inspection * using in32 in compcert * added unit test to validation of falcon sig version * unit test to inspect correct version of signature * refactor, no need to hold a whole verify in order to verify sig version * fix: untidy gomod * repositioned error var * fix: using assert.ErrorIs instead of Equals * renamed func
* [WIP] merge master and cry * [WIP] Refactoring and changing the message compact certificates attest to * [WIP] fix dependencies * Replace hashable with []byte in some tests and refactor * dog fix * refactor + dog * . * refactor and delete comments * Fixes and added CertMsg field to TX * fix tests * Add CertMsg to txn and fix unit tests * Update field in TX * Refactor * Refactor and add unit test * rename CertRound field, update the V1 API model and regenerate swagger.json
* unit test error type check * removed unneeded err * fix error text
* removed unneeded wrapper for the cert signature * removed unused struct
* Network: Change the message compact certificate is attesting to (#3668) * [WIP] merge master and cry * [WIP] Refactoring and changing the message compact certificates attest to * [WIP] fix dependencies * Replace hashable with []byte in some tests and refactor * dog fix * refactor + dog * . * refactor and delete comments * Fixes and added CertMsg field to TX * fix tests * Add CertMsg to txn and fix unit tests * Update field in TX * Refactor * Refactor and add unit test * rename CertRound field, update the V1 API model and regenerate swagger.json * Add suuport for Sha256 and build merkle tree of the block headers from it * update unit test * Add unit test to make sure merkle tree is built correctly for each supported hash function * fix test * Refactor unit tests and add checks for different hash functions * Update openAPI spec and regenerate * refactor
* verifying registry deletes state proof keys from DB * removed unneeded comment * fix: import grouping * using prepared statements to select from db fixing error comments * removed unused delete code for stateproof keys * removing unneeded comment * fix: using participationRegistry to safely delete compcert signer keys. * removed test for removed function * unit tests: checking that compcert delete keys, and avoid deletion when no sig is stored * making certain key deletion is done once there is a signal that the sig was stored in db * fix: imports * fix: closing prepared statement * removing unneeded sigStatus type * refactor: splitting builder.Add into multiple functions. changing order of sig storage (store in db and then add to builder) * fix: unit-test * fix: unit-test * fix: avoid changing gomod and gosum * removed unused func * fix: closing prepared statement after error check * removed unneeded return statement Co-authored-by: algoidan <[email protected]>
* compactcert msgpo type and domain separator * compactcert msgpo type and domain separator * compcerts to work with fixed size messages * copying message.Hash instead of saving it while cfalcon isn't fixec * fix: working with Message struct instead of []byte * fix: import order * fix: used the wrong variable inside test * Renamed message into stateproofMessage * Renamed message into stateproofMessage * added todo comment * renamed the hashtype * moving stateProofMessage from crypto/compcert to compcert * moving stateProofMessage from crypto/compcert to data/stateproof * using stateproof messages * fix: unit test which i've edited by accident * fix: e2e-test * fix: e2e-test * fix: missing liscense * removed empty line * removing pointer usage * modified v1 certMsg into a msgpacked msg * modified v1 certMsg into a msgpacked msg * adding '.' at end of sentence * renaming stateproof.Message field name * rebuild_swagger * changed comment * ToBeHashed using protocol.Encode * ToBeHashed using protocol.Encode * import order * removed extra space * moved creating the messageGeneration out of the loop * fix: changed by accident some unit test * fix: ordering the domain separators
* fix firstvalid issue * reverting +2 changes * scripts changes for testing * more debug * remove +2 * remove debugging * extend CC rounds
…headers (#3765) * Implemented a new caching mechanism for the ledger - latest 512 block headers. * Fix small bug and add init for cache * Add unit tests * small fix to unit test * added some benchmarks and unit test * rename * change Put signature * refactor * dog * . * refactor, add some comments and extend unit tests * fix test * Update ledger/blockHeaderCache.go Co-authored-by: Shant Karakashian <[email protected]> * Update ledger/blockHeaderCache.go Co-authored-by: Shant Karakashian <[email protected]> * more refactoring * last touches and renaming Co-authored-by: Shant Karakashian <[email protected]>
* add mss-kats generator * using JSON and fix CRs * use os.Getenv as skip flag
* adding new API to daemon/algod * stateproof api added * relocated code inside file * WIP: unit-tests * adding range of possible rounds to look for state-proofs. * stateproof retrival * fix: import order * fix: removed comment * fix: watchdog comments * restraining the minimum round given to stateproof api * fix: using latest round as max round to look for the stateproof * fix name of test * change in test * added a possible sort * fix: import order Co-authored-by: algoidan <[email protected]> Co-authored-by: algoidan <[email protected]>
* change coin filps to be shake(sumhash(seed)) * add sequence of coin positions to the cert * compute CC security using implied provenWeight * create a log2 appr func * fix stateproof message issues. * remove proven weight form the coin hash * fix cc test * use reject sampling in coin hash. * use logarithmic approximation * refactoring * builder uses same appox function * comments and doc * handle negative value in number of reveals equation * add lnProvenWe to coinhash * fixed hash representation for coinhash * fix CC benchmark * refactor * remove old numberofreveals code * change secKQ to 256 * fix CRs * CR fixes + rename * more CR fix * refactor the trusted params on the verifer. * more refactoring * fix flaky test * remove Param structure * more fixes * update falcon lib + use byte as salt version * add coinhash kat generator * fix some CR comments * clear out some documentation * Apply suggestions from code review Co-authored-by: Shant Karakashian <[email protected]> * fix comments * refactor rejection sampling * CR fix * refactoring * fix comments * reduce the bytes allocated for stateproof message * Apply suggestions from code review Co-authored-by: Shant Karakashian <[email protected]> * fix test since stateproof message hash was reduce * fix CR comments * more refactoring Co-authored-by: Shant Karakashian <[email protected]>
Algod: Merge stateproof with master
Merge master into stateproof
* rename compcat cert to stateproof in transcation and blockheader * rename stateproof package to stateproof msg * rename cc on header * change txn type and rename ledger state * rename compact cert type * ledger renaming * rename compactcert package * rename crypto cert package * more rename * complete crypto rename + swagger * rename cc e2e test * rename hash id * more renaming * fix comments and names
* fill up all stateproof message fields * fix source of provenWeight * rename cert in builder * create stateproofmessage test * add commitment on the sha256 header * using stateproof message data on e2e * rename file * refactoring * fix some linter comments * add some tests * fix linter and testing * fix comments
I don't follow how a newly caught up node is going to be able to participate in state proofs if the sp chain is backed up and needs to look back 2000 rounds. Chris, what do you mean by "I assume SP state is assumed to be empty at fast catchup time"? |
There is an currently an issue with fast-catchup. |
The test is randomly failing. The test expects the message decoding to fail. The message is random bytes, but occasionally, the random bytes are accepted by the decoder, causing the test to fail.
* Removed StateProofIntervalLastRound and usages * Removed redundant code in handle corrupted sig test * replaced make with var * Removed more instances of unnecessary make usage
* fix fast catchup bug * fix partition issue * fix CR comments.
* add some logs and reduce number of reveals * defining specific prints to the crypto/stateproof struct * fix: thread unsafe unit test * fix: thread unsafe unit test * move TestStateProofOverlappingKeys to nightly * fix max reveals test * fix CR comments * fix comments Co-authored-by: Jonathan Weiss <[email protected]>
Allow a single SP transaction to the pool when the pool is full. Allow again after a round.
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
cce
reviewed
Aug 6, 2022
* Better error message for when an invalid txid is specified. * Rename variable name.
algorandskiy
approved these changes
Aug 9, 2022
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.
Summary
In this PR we enable state proofs on Algorand's Blockchain. Small proofs that allow external parties to efficiently validate Algorand stake.
We introduce the following changes:
1 - make state proof verifier SNARK friendly
2- Relaxing the Merkle signature scheme ephemerality.
3- define lightBlockHeaders
4- define Algorand's state as a commitment on the lightBlockHeaders within a state proof interval.
5- limit the resources (memory and network bandwidth) if state proofs chain stalls.
Test Plan
Expend the tests coverage for the existing compact cert implementation.