Commit Graph

86 Commits

Author SHA1 Message Date
davidrusu 0c4bfa4d03
Merge branch 'master' into cryptarchia 2024-01-26 00:14:22 +04:00
davidrusu 8c43b68c35
Merge pull request #55 from logos-co/cryptarchia-leader-lottery
feat(lottery): spec out basic leader slot check
2024-01-25 16:30:14 +04:00
David Rusu 94f97caab0 rename EpochState.stake_distribution() to EpochState.total_stake() 2024-01-25 15:26:54 +04:00
David Rusu 1420117e9a rename LedgerState.head to LedgerState.block 2024-01-25 14:25:37 +04:00
Youngjoon Lee ebc069b112
Mixnet: Refactor with asyncio (#53) 2024-01-25 18:04:55 +09:00
David Rusu b8966762e0 feat(lottery): spec out basic leader slot check 2024-01-25 02:04:35 +04:00
Giacomo Pasini c4c52fbff4
TMP 2024-01-24 12:52:30 +01:00
Youngjoon Lee 30d52791c3
Mixnet: mix client emission (#50) 2024-01-23 10:46:00 +09:00
Youngjoon Lee d963d6cb51
Mixnet: Packet delay in mix node (#49) 2024-01-23 10:29:14 +09:00
Youngjoon Lee 1fc319de9e
Mixnet: Sphinx packet builder for mix clients (#47) 2024-01-15 15:17:35 +09:00
Youngjoon Lee 2263327320
Use Python 3.12 and install setuptools (#48) 2024-01-12 19:27:09 +09:00
Youngjoon Lee 55f4702e0b
Run CI even on master (#45) 2024-01-11 18:22:19 +09:00
Youngjoon Lee ef65355bf7
Mixnet: Add basic structure and topology construction (#44) 2024-01-10 20:47:13 +09:00
Youngjoon Lee 879e023790
Upgrade actions/setup-python to v5 (#42) 2024-01-10 10:23:14 +09:00
Youngjoon Lee 8be2750c75
Use package prefix to run unittests at the root dir (#41) 2024-01-10 10:23:03 +09:00
Giacomo Pasini 6f0e8a95c0
Add clarifying comment to forward_vote (#38) 2023-11-02 10:40:30 +01:00
Daniel Sanchez f635996d10
Tree overlay (#34)
* Start implementing TreeOverlay

* Implement tree overlay

* Add basic tests

* Fixes

* Fill leaves with extra nodes one by one

* Handle missing optional value

* Parenting fixes

* Parenting tests

* Remove unnecesary number of committes

* Fill from root committee

* Adapt tests to root filling

* Root parent is None

* Typo: committee_idx

* Fix leader supermajority threshold

* Fix type signature on building committee data

* Use plain carnot tree for carnot tree tests

* Add tree implementation explanation

* Fmt

* Use blake2b

* Fix idx signature on membership committees

* Check on committee child existence
2023-07-04 12:10:48 +02:00
Alexander Mozeika 4320e3aaa3
Merge pull request #35 from logos-co/committee-sizes-AM
Added description  and reviewed  comm. sizes  algorithm
2023-06-27 18:29:22 +01:00
Alexander Mozeika 380af083ea
Merge branch 'master' into committee-sizes-AM 2023-06-27 18:28:29 +01:00
Daniel Sanchez 9b87f8e733
Committee sizes computation (#33)
* Added optimal number of committees and sizes function

* Remove main

* Extract common scope code snippet

* Fmt
2023-06-27 17:39:31 +02:00
Alexander Mozeika 90ab66a4dc
Added algorithm description 2023-06-27 15:14:15 +01:00
Alexander Mozeika 8e05937715
Edited comments 2023-06-27 14:10:35 +01:00
danielsanchezq 143c009e8e Fmt 2023-06-27 14:10:39 +02:00
danielsanchezq 18c8407edb Extract common scope code snippet 2023-06-27 13:12:06 +02:00
danielsanchezq 7528506b21 Remove main 2023-06-23 11:05:15 +02:00
danielsanchezq 3d0aa49b9e Added optimal number of committees and sizes function 2023-06-23 10:36:33 +02:00
Youngjoon Lee a4d07256d6
test: make the committed_blocks test more strict (#31) 2023-06-07 17:04:30 +09:00
Daniel Sanchez 630dd3ac5c
EntropyOverlay refactor (#30)
* Refactor FlatOverlay

* Refactor EntropyOverlay and usages
2023-05-30 21:15:56 +02:00
Giacomo Pasini 34617dc911
Random Beacon revision (#29)
* Random Beacon revision

This is a proposed revision of the random beacon specification.
First of all it fixes a few little mistakes in the signing
process:
* Use BasicSchemeMPL instead of PoPSchemeMPL since we don't use
  Proof of Possession.
* Hashing the values prior to the call to BasicSchemeMPL.sing()
  is not necessary. This step has been removed.

In addition, all data inside the random beacon state that
anyone willing to verify must know anyway has been removed.
In the current version this includes the 'context' and the public
key of the signer. The verifier has to independently check that
those values have been correctly obtained anyway, so there's no
need to include them in the state that is passed around.

Lastly, the beacon context view has been changed from using a
string encoding to a little endian variable-length encoding and
is now tied to qc.view instead of current_view of the processing
node.

* actually use the version const
2023-05-25 10:26:35 +02:00
Daniel Sanchez b0edea6a98
Tiny fixes (#28) 2023-05-24 13:44:23 +02:00
Daniel Sanchez 5a169039b5
Random beacon v1 (#24)
* Implement beacon verification and handling module

* Create beacon tests and fix encountered problems

* Refactor tests

* Add mixed happy/unhappy test

* Clean unused import

* Add requirements.txt

* Add beacon to package

* Resolve relative import

* Fmt

* Refactor BeaconHandler -> RandomBeaconHandler
Remove unused verification calls

* Change view bytes encoding
Extract generating private key

* Bring back old trusty carnot

* Added beaconized carnot module

* Implement flat overlay

* Refactor overlay next leader

* Implement beaconized carnot

* Fill proposed block on beaconized carnot

* Sketch and update for testing purposes

* Step up beaconized test

* Fix missing leader selection

* Fix random beacon test

* Use recovery mode for random beacon initialization

* Expose entropy as constructor parameter
2023-05-18 18:29:28 +02:00
Daniel Sanchez c2e05a48c5
Runnable Python implementation (#7)
* use coarse grained events

* Add timeout handler

* Added runnable carnot implementation bare bones

* Removed rusty_results dependency

* Make easy tests

* Python impl tests (#9)

* Make easy tests

* Made sure an old aggregatedQC is not used.

* Test when a block has an old qc

* adding highest voted view so that a node doesn't vote twice.

* adding highest voted view so that a node doesn't vote twice.

* Tests for voting

* Tests for voting

* Tests for voting

* Tests for voting

* Update test_happy_path.py

---------

Co-authored-by: mjalalzai <33738574+MForensic@users.noreply.github.com>

* Fix commit grandparent

* Add tests assertions

* Added base vote test

* Tests for updating latest_committed_view and high_qc.

* Vote tests

* Vote tests

* Get max timeout by highQC

* Received Votes tests

* Receive timeout msgs

* Receive timeout msgs

* Remove local files

* Stylish, adjustments and fixes

* Start unhappy path and update tests (#10)

* Tests for updating latest_committed_view and high_qc.

* Vote tests

* Vote tests

* Get max timeout by highQC

* Received Votes tests

* Receive timeout msgs

* Receive timeout msgs

* Remove local files

* Stylish, adjustments and fixes

---------

Co-authored-by: mjalalzai <33738574+MForensic@users.noreply.github.com>

* Update build timeout qc test

* Added block content

* Fix tests with block content and comments

* Fix all timeouts are from the same view in timeout call

* Add check for double view seen different block

* Store just highest qc and aggregated views in AggregatedQc,

* Fix timeout preconditions

* Happy + Unhappy path implementation and tests (#15)

* Implement timeouts unhappy path

* views are sequential or consecutive.

* Make sure view changes are incrementally done in ascending order.

* Make sure view changes are incrementally done in ascending order.

* Make sure view changes are incrementally done in ascending order.

* Cleanup

* refactor

* Overlay based happy tests (#11)

* Cleanup

* Leaf committee member vote.

* Leaf committee member vote, test.

* Leaf committee member vote, test.

* Description

* Description

* Description-refactoring

* Cleanup

* Fix leaf votes test

* Clean overlay

* Test single committee advances

* Remove unhappy path test file

* Update carnot description

* Refactor local_timeout for NewView

* Fix unhappy path conditions and added broadcasting

* Unhappy path tests description

* Commit all grandparents of a block from latest_committed view

* Cleanup docs

* Add unhappy path test vector

* Remove block content

---------

Co-authored-by: mjalalzai <33738574+MForensic@users.noreply.github.com>

* Extract MockCarnot in happy path tests

* Add is_safe_to_timeout checks on unhappy path methods

* Fix happy math mockoverlay missing methods

* Fix unhappy path double increments
Fill missing qc building implementations

* Implement first case of unhappy path with simple overlay
Missing final assertions

* Unhappy path base test assertions (#14)

* Unhappy path tests replacing timeout msgs with NewView. Also revising the conditions to enter into the unhappy path.

* Unhappy path tests assertions.

* Fix assertions on test

* Cleanup

---------

Co-authored-by: mjalalzai <33738574+MForensic@users.noreply.github.com>

* Remove redundant code and fix commit parent (#16)

* Fix unhappy path tests (#17)

* fix test

* get highest qc from new view votes

* Add missing assertion

* Cleanup approve new view function

* Remove calls to safe_timeout invariant

* Fix approve new view

* Make unhappy test continuously timeout

* Increment current view on reciving a new qc
Refactor reset last timeout qc

* Fix happy path current view after receiving block qc

* Complete mix succeed fails unhappy test

* Refactor timeout_high_qc test to use fail method

* Add block assertions on mixed unhappy test

* Simplify approve block

* add spec tests to ci

* Extract implicit information from safe blocks (#19)

* extract implicit information from safe blocks

* fix test

* Refactor last_view_timeout_qc and update calls on unhappy path

* Update view upon reception of timeout qc (#20)

* update view upon reception of timeout qc

* only increase highest_voted_view

* fix comments

* [WIP] Use events instead of send/broadcast methods (#21)

* Remove send and broadcast, use events

* Adjust tests to use events

* Adjust unhappy path tests to use events

* Fix missing wrongly optional return types

* Extrac common assert on propose_block

* add informative comments and remove panic (#22)

* add disclaimer (#23)

* fix approve_new_view preconditions

---------

Co-authored-by: mjalalzai <33738574+MForensic@users.noreply.github.com>
Co-authored-by: Giacomo Pasini <g.pasini98@gmail.com>
Co-authored-by: Giacomo Pasini <Zeegomo@users.noreply.github.com>

---------

Co-authored-by: Giacomo Pasini <g.pasini98@gmail.com>
Co-authored-by: mjalalzai <33738574+MForensic@users.noreply.github.com>
Co-authored-by: Giacomo Pasini <Zeegomo@users.noreply.github.com>
2023-05-05 09:58:58 +02:00
Daniel Sanchez 26501440b1
Timout python version (#3) 2023-03-22 04:13:30 -07:00
Daniel Sanchez dfbea2ce64
Added gitignore (#4) 2023-03-22 02:47:25 -07:00
Daniel Sanchez 4f6c297815
Initial python translation of specification (#1)
* Added spec file
Translate to python except unhappy path

* Fix pr review comments
Cleanup
2023-03-21 05:09:28 -07:00
Daniel Sanchez 0f0ccc3487
Initial commit 2023-03-20 06:07:52 -07:00