Commit Graph

98 Commits

Author SHA1 Message Date
holisticode 441ac2b765 fix merge issues; unpack message at node 2024-07-19 13:11:03 -05:00
holisticode 30ea9f9de4 Merge branch 'da-poc-tests' into da-poc 2024-07-19 11:34:02 -05:00
gusto 4d49fba52a
Direct DA connection protocol (#100)
* WIP: Direct DA connection protocol

* Dispersal wrapper messages for executor to node communication

* Reusable types in dispersal.proto

* Add helper methods for dispersal errors

* Remove redundant BlobId type

* Write to connections in parallel

* Explicite package name for dispersal proto messages

* Parse length+message in the proto module

* Move dispersal proto into subnets poc

* Test for protocol message helper functions

* Use dispersal proto message in poc executor
2024-07-19 10:10:56 +03:00
holisticode 6a3d0cb83a added test runs 2024-07-18 17:09:54 -05:00
holisticode 376c66485b add readme, comment code, add sync for dispersal 2024-07-11 15:29:16 -05:00
holisticode 2c899518be
Make things configurable (cli args) 2024-07-11 14:02:10 +03:00
holisticode 43c6e7e672
finalized first roundtrip; has bugs 2024-07-11 14:02:10 +03:00
holisticode 59f328c117
fixed sending and storing hashes; fixed proper test shutdown 2024-07-11 14:02:10 +03:00
holisticode e95d7e27ca
added 1st version executor 2024-07-11 14:02:10 +03:00
holisticode 0d3331c103
initial iteration 2024-07-11 14:02:10 +03:00
davidrusu 3d2459052c
Cl: nullifier proof statement (#102)
* cl: nullifier proof

* cl: cli action to select proof type
2024-07-11 12:45:09 +04:00
davidrusu 2c7c483707
CL spec (#92)
* feat(cl/noir): provide an ergonomic Noir api for use within Python.

* Add a python wrapper over the bigger constraint

* Add the Bigger wrapper

* cl/noir: document the NargoConstraint wrapper api

* rewrite Bigger constraint as a dataclass

* WIP: Cl/executable spec (#93)

* wip: executable spec

* WIP: test_1_to_1_transfer

* hack: Vacous hash function

* crypto: make sure prf returns field elements, fix ECC math in pedcom

* hack(crypto): mock up a hash_to_curve implementation

* feat(cl/1to1_xfr): fungibility domain uses hash_to_curve

* cl: add type checking to InnerNote

* cl/ptx: get balance commitments working

* cl/noir: mv noir_constraint wrapper into cl/constraints/...

* cl/ptx-note-proofs: start data modelling input and outputs

* cl/ptx: 1-to-1 test is passing, but still, not quite finished

* cl: remove tx_output from 1-to-1 transfer

* cl: remove unused classes

* cl: testing the balance commitments

* wip: cl

* cl: split main.rs into crypto.rs and note.rs

* cl: split balance test

* cl: add nullifier module

* cl: partial_tx; input; output

* cl: output proof tests

* cl: partial transactions can now be built and verified

* drop python cl spec

* cl: test partial transaction balance commitment

* cl: reverse partial tx balance (inputs are neg, outputs are pos)

* cl: bundle of ptx

* cl: verify bundle isn't balanced with just one unbalanced partial tx

* cl: swap out ExtendedPoint for SubgroupPoint

* cl: integrate groth16 death constraint validation

* add risc0 zone

* refactor risc0 zone

* fix zone PoC

* Add separate bin for stark2snark conv

* cl: rename Note to NoteWitness

* cl: merkle proofs

* cl: merkle tree helper to pad elements

* cl: ptx root implemented via merkle roots over inputs and outputs

* cl: move from Commitment::from_witness to Witness::commit()

* cl: tests passing again

* cl: turn data model into library

* cl: partial tx can compute paths to inputs / outputs

* cl: begin integrating zone into cl data modal

* cl: integrate simple zone into CL data model

* cl: add missing cl patches

* cl: swap jubjub for accel k256

* cl: pre-compute balance unit point outside stark

* switch balance commitment to linear combination

* cl: pre-compute pederson blinding

* fix risc0 patching

* switch to curve25519-dalek

* cl: drop blake2; print prover time

---------

Co-authored-by: Giacomo Pasini <g.pasini98@gmail.com>

---------

Co-authored-by: Giacomo Pasini <g.pasini98@gmail.com>
2024-07-09 17:10:32 +04:00
Daniel Sanchez 84130ba58a
Da: fk20 fixes (#96)
* Simplify ranges

* Fix and beautify code
2024-06-26 17:27:29 +02:00
Daniel Sanchez 422359acd7
Da: fk20 proof generation (#95)
* Kickstart fk20

* Implement i/fft from ethspecs

* Expand test to different sizes

* Implement toeplizt

* Finish implementing fk20

* Fix roots of unity generation

* Implement fft for g1 values

* Fix fk20 and tests

* Add len assertion in test

* Fix roots computations

* Fix test

* Fix imports

* Fmt

* Docs and format
2024-06-17 09:20:11 +02:00
gusto c9b2c7c5c5
DA domain specific tag in bls (#94) 2024-05-27 12:38:18 +03:00
Daniel Sanchez 9390d481ba
Use blake2b for 31 bytes digests (#91) 2024-04-15 12:12:50 +02:00
Daniel Sanchez 8bb5160ff2
Fix rs encoding to fit with missing points (#90) 2024-04-09 07:55:17 +02:00
Daniel Sanchez f29869c029
Remove indexing from dablob (#89)
Verifier resolves by syncing with state public keys
2024-03-25 11:30:44 +01:00
davidrusu d2f6ad579a
Stake Relativization Specification + Fixes (#86)
* cryptarchia/relative-stake: failing test showing lack of inference

* implement stake-relativization spec

* test total stake inference in empty epoch

* move TestNode to test_common

* fix bug in Follower re-org logic

* improve orphan proof test coverage

* force orphans to already have been in one of the existing branches

* rename initial_inferred_total_stake ==> initial_total_stake

* add simple orphan import test

* Follower.unimported_orphans: ensure no orphans from same branch

* remove unnecessary LedgerState.slot

* cryptarchia: doc fixes

* factor out total stake inference

* docs for total stake inference

* rename total_stake to total_active_stake

* replace prints in cryptarchia with logging.logger
2024-03-23 05:50:00 +04:00
gusto 53b8be7a05
DA Api Tests (#83)
* Tests for da api full flow

* Fix test issues

* Da api ext tests (#85)

* Index store links blob to cert_id

* Tests for multiple indexes pointing to the same blob

* Test multiple indexes to the same blob in the full flow

* Update bytes_per_chunk to 31 bytes

---------

Co-authored-by: Daniel Sanchez Quiros <sanchez.quiros.daniel@gmail.com>
2024-03-22 13:01:13 +02:00
Daniel Sanchez 8dd2dabb7d
DA: Verifier skip duplicated blobs intents (#88)
* Make verifier skip duplicated blobs intents

* Add case in where verifier data is the same but column is different
2024-03-22 10:36:00 +01:00
Youngjoon Lee 601598f814
cryptarchia: fix try_create_fork to find parent block (#84) 2024-03-21 09:55:38 +09:00
Daniel Sanchez a0175e16f3
Chunkify up to 31byte elements (#87) 2024-03-20 11:03:39 +01:00
gusto b1e13f79c5
Initial DA API Spec structure (#72)
* Initial da_api spec structure

* Node definition for testing different actors in da api

* Connect zone, producer and da nodes in tests

* Remove da mock module

* Add da api module with flow tests

* Comments for read and write methods in BlobStore

* Fix nitpicks (formatting and typing)

---------

Co-authored-by: Daniel Sanchez Quiros <sanchez.quiros.daniel@gmail.com>
2024-03-15 12:37:56 +02:00
Daniel Sanchez 0e142c0888
Added verification to certificate (#82)
* Added verification method to certificate

* Update da/common.py

typo short -> sort

Co-authored-by: gusto <bacv@users.noreply.github.com>

* Fix test imports

* Added verification comment

---------

Co-authored-by: gusto <bacv@users.noreply.github.com>
2024-03-15 11:34:43 +01:00
Daniel Sanchez bd964e7b27
Threshold bitfield on certificate (#81)
* Added threshold bitfield to certificate

* Short nodes_ids and public_keys
2024-03-14 12:20:46 +01:00
Daniel Sanchez 8c34f8a39e
Da Dispersal (#80)
* Added common bls types

* Added verifier attestation build

* Implement verification and aggregation in dispersal

* Added certificate building tests

* Added dispersal test
2024-03-13 14:59:27 +01:00
Daniel Sanchez 7ffb7cc7ed
Da verifier protocol (#78)
* Implement generator polynomial and rs encoding

* Implement encode/decode+test using fft. Non-working

* Use lagrange for interpolation

* Remove fft, use evaluations instead

* Move and rename kzg and rs test modules

* Update docs

* Added columns property to chunks matrix
Added test for columns

* Added chunkify and test

* Added compute row commitments
Added row commitments size test

* Fix poly from evaluations method

* Implement encode rows and test

* Update encode row test

* Implement compute row proofs (not working on extended data)

* Use same polynomials for commitment and proof creation after extend

* Fix polynomial from/to evaluations

* Use chunks for verification

* Refactor interpolate

* Implement chunks matrix transposed method

* Added compute column kzg commitments

* Use square size data for encoder tests

* Add column type to columns method

* Added compute columns aggregated commitment
Added aggregated commitment test
Fixed and expanded encode test

* Use sha3 for hashing

* Make encoder hashing method public

* Fill up verifier implementation

* Added verify column test

* Implement verier verify test
Fixed small issues

* Implement verier verify test
Extend verify test for all columns
2024-03-11 10:01:34 +01:00
davidrusu 2d3f463bb7
cryptarchia: Update epoch stabilization schedule to 334 (from 433) (#79)
* feat(cryptarchia/epoch-schedule): switch to 334 schedule (from 433)

* factor out common test config building code

* feat(cryptarchia): test_leader uses common test config object

* cryptarchia: update test_ledger_state_is_properly_updated_on_reorg

* cryptarchia: update test_epoch_transition test

* move to .tip() in tests instead of tip_id()

* cryptarchia: wrap long comments

* cryptarchia: move mk_block to test_common

* cryptarchia: move mk_genesis_state to test_common

* cryptarchia: refactor fork test to use mk_chain

* cryptarchia: fork choice rules tests use mk_chain helper

* cryptarchia: rename fork choice test suite to TestForkChoice

* cryptarchia: config.s is always 3k/f or 3*base_period_length

* cryptarchia: hardcode epoch schedule in specification

* un-hard code epoch sched. params + provide a v0.0.1 spec for params
2024-03-09 17:34:08 +04:00
Daniel Sanchez cf899d2384
Da encoding protocol (#76)
* Implement generator polynomial and rs encoding

* Implement encode/decode+test using fft. Non-working

* Use lagrange for interpolation

* Remove fft, use evaluations instead

* Move and rename kzg and rs test modules

* Update docs

* Added columns property to chunks matrix
Added test for columns

* Added chunkify and test

* Added compute row commitments
Added row commitments size test

* Fix poly from evaluations method

* Implement encode rows and test

* Update encode row test

* Implement compute row proofs (not working on extended data)

* Use same polynomials for commitment and proof creation after extend

* Fix polynomial from/to evaluations

* Use chunks for verification

* Refactor interpolate

* Implement chunks matrix transposed method

* Added compute column kzg commitments

* Use square size data for encoder tests

* Add column type to columns method

* Added compute columns aggregated commitment
Added aggregated commitment test
Fixed and expanded encode test

* Use sha3 for hashing
2024-03-08 14:16:14 +01:00
Daniel Sanchez 09c9b7e4ec
Da rs core (#75)
* Implement generator polynomial and rs encoding

* Implement encode/decode+test using fft. Non-working

* Use lagrange for interpolation

* Remove fft, use evaluations instead

* Move and rename kzg and rs test modules

* Update docs
2024-03-05 16:53:14 +01:00
Daniel Sanchez d15eaa2d98
KZG core functionality (#73)
* Added polynomial class

* Added common types and constants

* Implement commitment and proof generation

* Added basic tests

* Use custom polynomial

* use evaluation form for building polynomial

* Use fast division on polynomials

* Fix poly operations

* Add non working verification

* Make verification work

* Expand verify test

* Cleanup imports

* Update deps

* Update common.py

added verify setup mechanism

* Added trusted setup, updated common to use gp generator and added setup verification test

* Added comments

---------

Co-authored-by: megonen <146561843+megonen@users.noreply.github.com>
2024-02-27 17:49:27 +01:00
Daniel Sanchez 9a54d90d14
Da specs main structure (#70)
* Added da encoder pipeline draft

* Remove unnecessary method

* Added verifier module and blob type

* Fill verifier skeleton

* Add comments on implementation, remove unnecessary intermediary method

* Added dispersal skeleton

* Added test modules for dispersal and verifier

* Added test modules for encoder, implemented basic test

* Added missing test cases

* Added missing calls to encode method

* Use single megabyte test in encoder

* Added basic testcases for dispersal

* Added basic testcases for verifier

* Remove duplicated column proofs from encoding schema

* Remove parameters from test functions in encoder

* Extract common types to common module

* Make test pass

* Remove node id dep from mixnet and fix columns access
2024-02-12 15:35:23 +01:00
Daniel Sanchez bcde60a97f
Arkworks dependency utility script (#71)
* Added install script for building in arm64 in osx arkworks bls dep

* Added install script for building in arm64 in osx arkworks bls dep
2024-02-11 23:15:15 +01:00
Giacomo Pasini 495e0c119a
Add orphan proofs validation (#69)
* Add orphan proofs validation

* Update cryptarchia/cryptarchia.py

Co-authored-by: davidrusu <davidrusu.me@gmail.com>

---------

Co-authored-by: davidrusu <davidrusu.me@gmail.com>
2024-02-09 15:12:12 +01:00
Youngjoon Lee 5dd7b2730a
Embed Robustness into `mixnet.py` (#61) 2024-02-08 15:39:50 +09:00
davidrusu cde1e92c9e
Leader VRF uses coin nonce as well as sk (#68)
* standardize endianness to "big"

* slot.encode()

* include coin nonce in leader election VRF

---------

Co-authored-by: David Rusu <davidrusu@Davids-MacBook-Pro.local>
2024-02-07 18:28:36 +04:00
Giacomo Pasini 6f05392693
Add slot contribution to nonce (#67) 2024-02-07 12:31:31 +01:00
davidrusu 0c447881ca
Merge pull request #65 from logos-co/evolve-leader-coin
Spec. Leader Coin Evolution
2024-02-07 01:53:26 +04:00
David Rusu 2a9ec4bc86 distinguish thew two commitments in the leader prf abnf 2024-02-06 22:21:16 +04:00
David Rusu bddaa40d63 test coin minting and stake stabilizing 2024-02-06 22:19:08 +04:00
David Rusu 3f681fc51f update block id spec; typo 2024-02-06 20:19:30 +04:00
David Rusu 5c3de9ab84 implement support for leader-proofs generated from evolved coins 2024-02-06 20:07:26 +04:00
Giacomo Pasini 8a82517fdd
Add nonce specification (#64)
* Add nonce specification

* tweak nonce definition
2024-02-06 16:37:49 +01:00
David Rusu eebf439a30 feat(leader_coin): add nonce and coin.evolve() api 2024-02-06 19:31:34 +04:00
Giacomo Pasini c1e12d6ce8
Add epoch transition to spec (#63)
* Add epoch transition to spec

* add tests

* Add block to fork after validation

* Add configs for steps inside an epoch

* rename get_last_valid_state to state_at_slot_beginning
2024-02-06 14:38:20 +01:00
Youngjoon Lee fe7d47caee
Mixnet: integrate all the pieces together (#57) 2024-02-05 09:04:02 +01:00
Youngjoon Lee b1ffb4d62d
Mixnet: topology update (#56) 2024-02-05 07:47:36 +01:00
davidrusu d7b5e0b529
Merge pull request #62 from logos-co/epoch-state-spec
Follower maintains ledger state as it follows the blockchain
2024-02-02 13:29:41 +04:00
David Rusu 9f6b9eb242 Specify mock-leader-proof in message spec 2024-02-02 01:16:14 +04:00