47 Commits

Author SHA1 Message Date
David Rusu
dca237fc51 cryptachia/ghost: update fork choice rule comments 2024-11-14 16:08:38 +04:00
David Rusu
55da6dd79d cryptarchia: remove height from ledger state 2024-11-02 00:08:08 +04:00
David Rusu
9eabadd22d cryptarchia: cleanup 2024-11-02 00:01:20 +04:00
David Rusu
987060da31 cryptarchia: cleanup 2024-11-01 23:48:43 +04:00
David Rusu
c33365b48c cryptarchia: remove unused imports 2024-11-01 23:29:47 +04:00
David Rusu
e4d8887fe4 cryptarchia/ghost: integrate GHOST with maxvalid fork choice 2024-11-01 23:21:49 +04:00
David Rusu
adaeba2493 cryptarchia/ghost: impl GHOST fork choice rule 2024-11-01 20:36:45 +04:00
David Rusu
5050f4636e cryptarchia/ghost: rewrite common_prefix_depth in terms of iter_chain 2024-11-01 17:59:18 +04:00
David Rusu
0421e9f8be cryptarchia/ghost: remove local / fork naming in common_prefix_depth 2024-11-01 12:22:59 +04:00
David Rusu
91e1482761 cryptarchia/ghost: remove Chain abstraction 2024-11-01 12:16:06 +04:00
David Rusu
170b825d5b cryptachia/ghost: rewrite on_block to remove dependency on Chain 2024-11-01 12:09:44 +04:00
David Rusu
639b7444c4 cryptarchia/ghost: validate_header w.r.t. block parent 2024-11-01 10:49:09 +04:00
David Rusu
cc50e2e897 cryptarchia/ghost: rewrite unimported_orphan w/ common_prefix_depths 2024-11-01 10:17:37 +04:00
David Rusu
d1b567835f cryptarchia/ghost: remove redundant check 2024-11-01 09:52:04 +04:00
David Rusu
363ca76ff6 cryptarchia/ghost: unimported_orphans returns orphans w.r.t. to tip 2024-11-01 09:49:59 +04:00
David Rusu
30bc359a77 cryptarchia/ghost: maxvalid_bg uses block ids rather than chains 2024-10-31 02:37:37 +04:00
David Rusu
e9d4793287 cryptarchia/ghost: fix chain density calculation 2024-10-31 02:31:52 +04:00
David Rusu
37eb040a99 cryptarchia/ghost: common_prefix_depth returns depth of both chains 2024-10-31 02:10:19 +04:00
David Rusu
893ffb5915 cryptarchia/ghost: remove common_prefix_len helper 2024-10-31 01:55:36 +04:00
David Rusu
bf5ef98174 cryptarchia/ghost: prep for move to weight based fork choice 2024-10-31 01:52:42 +04: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
Youngjoon Lee
601598f814
cryptarchia: fix try_create_fork to find parent block (#84) 2024-03-21 09:55:38 +09: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
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
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
David Rusu
9f6b9eb242 Specify mock-leader-proof in message spec 2024-02-02 01:16:14 +04:00
David Rusu
9345af0614 test ledger state is properly updated on re-org 2024-02-01 21:33:37 +04:00
David Rusu
62ea40ba5e address CR 2024-02-01 20:25:49 +04:00
David Rusu
45bddc0e21 Follower maintains ledger state as it follows the chain 2024-02-01 15:08:50 +04:00
David Rusu
7d8e4d72d9 setup for ledger state update 2024-02-01 15:08:50 +04:00
David Rusu
66239b3913 checkpoint work on ledger-state 2024-02-01 15:08:50 +04:00
Giacomo Pasini
734b038c50
Add header id and message format specification (#52)
* Create messages.abnf

* add missing block rule

* Add content id to header message

* add header id definition + implementation in python

* address review comments
2024-01-31 23:09:03 +01:00
Youngjoon Lee
1d3bf3c6d8
Clarify Cryptarchia slot calcuation (#59) 2024-01-30 11:57:54 +01:00
Giacomo Pasini
45c303ef14
Add fork choice rule (#58)
* add fork choice rule

* add comments explaining k and s

* add tests

* fix test import
2024-01-29 14:29:56 +01: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
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