-
Notifications
You must be signed in to change notification settings - Fork 34
pqdevnet0: client specs #8
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
Changes from 17 commits
2f6a6e8
1dca1e0
b2bb6be
4872e53
f7b237b
eb8e1d5
7203fb5
36db569
e6b93ff
6f81d11
20f5237
c5d936d
9883d92
acccf3e
63717aa
d4881e1
a599d14
c67e397
e38593e
4c3099c
ebaf501
d84d5da
1b469e8
a236de3
ad9bc63
dd98282
ab3943a
29913a2
65daac2
52e8e9f
e600336
6ef1f10
cdcf9ae
d19d93d
0788d88
14d5ac2
72909be
64acd24
c551aa2
884cc1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,5 +9,7 @@ keccak | |
| blake | ||
| merkle | ||
| trie | ||
| ream | ||
| rlp | ||
| ssz | ||
| zeam | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Lean Consensus Experimental Chain | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Time parameters | ||
|
|
||
| | Name | Value | Unit | Duration | | ||
| | ------------------------------------- | ------------------------- | :----------: | :-----------: | | ||
| | `SLOT_DURATION_MS` | `uint64(4000)` | milliseconds | 4 seconds | | ||
| | `PROPOSER_REORG_CUTOFF_BPS` | `uint64(2500)` | bps | 25% into slot | | ||
| | `VOTE_DUE_BPS` | `uint64(5000)` | bps | 50% into slot | | ||
| | `FAST_CONFIRM_DUE_BPS` | `uint64(7500)` | bps | 75% into slot | | ||
| | `VIEW_FREEZE_CUTOFF_BPS` | `uint64(7500)` | bps | 75% into slot | | ||
|
|
||
| ## Presets | ||
|
|
||
| ### State list lengths | ||
|
|
||
| | Name | Value | Unit | Duration | | ||
| | ------------------------------ | ------------------------------------- | :--------------: | :-----------: | | ||
| | `HISTORICAL_ROOTS_LIMIT` | `uint64(2**18)` (= 262,144) | historical roots | 12.1 days | | ||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | `VALIDATOR_REGISTRY_LIMIT` | `uint64(2**12)` (= 4,096) | validators | | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Containers | ||
|
|
||
| ## `Config` | ||
|
|
||
| ```python | ||
| class Config(Container): | ||
| num_validators: uint64 | ||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ## `Checkpoint` | ||
|
|
||
| ```python | ||
| class Checkpoint(Container): | ||
| root: Bytes32 | ||
| slot: uint64 | ||
| ``` | ||
|
|
||
| ## `State` | ||
|
|
||
| ```python | ||
| class State(Container): | ||
| config: Config | ||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| latest_justified: Checkpoint | ||
| latest_finalized: Checkpoint | ||
|
|
||
| historical_block_hashes: List[Bytes32, HISTORICAL_ROOTS_LIMIT] | ||
| justified_slots: List[bool, HISTORICAL_ROOTS_LIMIT] | ||
|
|
||
| # Diverged from 3SF-mini.py: | ||
| # Flattened `justifications: Dict[str, List[bool]]` for SSZ compatibility | ||
| justifications_roots: List[Bytes32, HISTORICAL_ROOTS_LIMIT] | ||
| justifications_validators: Bitlist[ | ||
| HISTORICAL_ROOTS_LIMIT * VALIDATOR_REGISTRY_LIMIT | ||
| ] | ||
| ``` | ||
|
|
||
| ## `Block` | ||
|
|
||
| ```python | ||
| class Block(Container): | ||
| slot: uint64 | ||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| parent: Bytes32 | ||
unnawut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| votes: List[Vote, VALIDATOR_REGISTRY_LIMIT] | ||
unnawut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| state_root: Bytes32 | ||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ## `SignedBlock` | ||
|
|
||
| ```python | ||
| class SignedBlock(Container): | ||
| data: Block, | ||
unnawut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| signature: Bytes32, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To update to exact size (~3KiB) based on researchers' input |
||
| ``` | ||
|
|
||
| ## `Vote` | ||
|
|
||
| ```python | ||
| class Vote(Container): | ||
| validator_id: uint64 | ||
| slot: uint64 | ||
| head: Checkpoint | ||
| target: Checkpoint | ||
| source: Checkpoint | ||
| ``` | ||
|
|
||
| ## `SignedVote` | ||
|
|
||
| ```python | ||
| class SignedVote(Container): | ||
| data: Vote, | ||
| signature: Bytes32, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To update to exact size (~3KiB) based on researchers' input |
||
| ``` | ||
|
|
||
| ## Remarks | ||
|
|
||
| - The signature type is still to be determined so `Bytes32` is used in the | ||
| interim. The actual signature size is expected to be a lot larger (~3 KiB). | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,151 @@ | ||||||
| # Networking | ||||||
|
|
||||||
| ## Setup | ||||||
|
|
||||||
| - Transport: QUIC on IPv4 | ||||||
| - Encryption and identification: [Libp2p-noise](https://github.com/libp2p/specs/tree/master/noise) with `secp256k1` identities | ||||||
unnawut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
unnawut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - Protocol negotiation: [multistream-select 1.0](https://github.com/multiformats/multistream-select/) | ||||||
| - Multiplexing: Native support by QUIC | ||||||
| - Gossip: [gossipsub v1](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md) | ||||||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ## Node identification | ||||||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Nodes are defined as a list of their ENRs in a yaml file at [`src/lean_spec/client/nodes.yaml`](../../src/lean_spec/client/nodes.yaml). | ||||||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| For example: | ||||||
|
|
||||||
| ```yaml | ||||||
| - enr:-Ku4QHqVeJ8PPICcWk1vSn_XcSkjOkNiTg6Fmii5j6vUQgvzMc9L1goFnLKgXqBJspJjIsB91LTOleFmyWWrFVATGngBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhAMRHkWJc2VjcDI1NmsxoQKLVXFOhp2uX6jeT0DvvDpPcU8FWMjQdR4wMuORMhpX24N1ZHCCIyg | ||||||
| - enr:-Ku4QPn5eVhcoF1opaFEvg1b6JNFD2rqVkHQ8HApOKK61OIcIXD127bKWgAtbwI7pnxx6cDyk_nI88TrZKQaGMZj0q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDayLMaJc2VjcDI1NmsxoQK2sBOLGcUb4AwuYzFuAVCaNHA-dy24UuEKkeFNgCVCsIN1ZHCCIyg | ||||||
| - enr:-Ku4QG-2_Md3sZIAUebGYT6g0SMskIml77l6yR-M_JXc-UdNHCmHQeOiMLbylPejyJsdAPsTHJyjJB2sYGDLe0dn8uYBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhBLY-NyJc2VjcDI1NmsxoQORcM6e19T1T9gi7jxEZjk_sjVLGFscUNqAY9obgZaxbIN1ZHCCIyg | ||||||
| ``` | ||||||
|
|
||||||
| ## Gossip domain | ||||||
|
|
||||||
| **Protocol ID:** `/meshsub/1.1.0` | ||||||
|
|
||||||
| **Gossipsub Parameters** | ||||||
|
|
||||||
| The following gossipsub | ||||||
| [parameters](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#parameters) | ||||||
| will be used: | ||||||
|
|
||||||
| - `D` (topic stable mesh target count): 8 | ||||||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| - `D_low` (topic stable mesh low watermark): 6 | ||||||
| - `D_high` (topic stable mesh high watermark): 12 | ||||||
| - `D_lazy` (gossip target): 6 | ||||||
| - `heartbeat_interval` (frequency of heartbeat, seconds): 0.7 | ||||||
| - `fanout_ttl` (ttl for fanout maps for topics we are not subscribed to but have | ||||||
| published to, seconds): 60 | ||||||
| - `mcache_len` (number of windows to retain full messages in cache for `IWANT` | ||||||
| responses): 6 | ||||||
| - `mcache_gossip` (number of windows to gossip about): 3 | ||||||
| - `seen_ttl` (expiry time for cache of seen message ids, seconds): | ||||||
| SECONDS_PER_SLOT * SLOTS_PER_EPOCH * 2 | ||||||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| #### Topics and messages | ||||||
|
|
||||||
| Topics are plain UTF-8 strings and are encoded on the wire as determined by | ||||||
| protobuf (gossipsub messages are enveloped in protobuf messages). Topic strings | ||||||
| have form: `/leanconsensus/devnet0/Name/Encoding`. This defines both the type of | ||||||
|
||||||
| have form: `/leanconsensus/devnet0/Name/Encoding`. This defines both the type of | |
| have form: `/ethconsensus/lean/Name/Encoding`. This defines both the type of |
or how about this? ties into narrative that lean is a fork not a separate chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For "lean is a fork not a separate chain", wouldn't it be /eth2/lean/Name/Encoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
topic_prefix/fork/kind/encoding
I think it should be lean_consensus/devnet0/Name/Encoding
For "lean is a fork not a separate chain", wouldn't it be
/eth2/lean/Name/Encoding?
Lean Consensus isn't eth2, eth2 means Beacon Chain. We should have a fork id or devnet0 or B32::from_slice("devnet0".as_bytes()). Eth1 Would be the execution chain etc.
The Execution Chain and Beacon Chain are separate chains. The Lean Consensus Chain is separate from the Beacon Chain they are distinct.
We will have forks of the lean chain, also we will have multiple different devnets. We want to distinguish to p2p peers that devnet0 and devnet1 and mainnet aren't the same fork.
We are swapping the Consensus chain from Beacon to Lean, well maintaining the Execution Chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lean_consensus/devnet0/Name/Encoding makes sense. But will wait to hear from @g11tech
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without getting into the discussions of if lean will be fork or a chain now, lets do /consensus/lean/Name/Encoding i just feel devnet0 there is a bit weird, but as such this isn't a blocker anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will be having multiple devnets and testnets, so I think we should have a fork field. We shouldn't have lean be the fork for all of our devnet's and testnet's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devnet0 hence should be the fork digest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if lean was a fork of the beacon chain we would use eth2/fork_digest/Name/Encoding etc
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
unnawut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally /eth2/446a7232/beacon_aggregate_and_proof/ssz_snappy
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally /eth2/beacon_chain/req/beacon_blocks_by_root/1/
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a status message too, so we know what our peer's perceived head is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is hard to use lean_blocks_by_root to forward sync unless we plan to solely use gossip messages to determine what to backfill from I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we define MAX_REQUEST_BLOCKS here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied over 2*10 (= 1024) from beacon specs: d19d93
This is 1024 * 4 / 60 = 68 minutes worth of block under 4s block time
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Validator | ||
|
|
||
| ## Validator identification | ||
|
|
||
| To ensure a good distribution of block proposer duties in a round-robin manner | ||
| and avoid clashing IDs, validator IDs are pre-assigned to each client | ||
| implementation in a yaml file at | ||
| [`src/lean_spec/client/validators.yaml`](../../src/lean_spec/client/validators.yaml). | ||
unnawut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| For example: | ||
|
|
||
| ```yaml | ||
| ream: [0, 3, 6, 9, 12, 15, 18, 21, 24, 27] | ||
| zeam: [1, 4, 7, 10, 13, 16, 19, 22, 25, 28] | ||
| quadrivium: [2, 5, 8, 11, 14, 17, 20, 23, 26, 29] | ||
| ``` | ||
|
|
||
| ## Block proposer selection | ||
|
|
||
| The block proposer shall be determined by the modulo of the current slot number | ||
| by the total number of validators, such that block proposers are determined in | ||
| a round-robin manner by the validator IDs. | ||
|
|
||
| ```py | ||
| def is_proposer(state: BeaconState, validator_index: ValidatorIndex) -> bool: | ||
| return get_current_slot() % state.config.num_validators == validator_index | ||
| ``` | ||
|
|
||
| ## Remarks | ||
|
|
||
| - This spec is still missing the file format for the centralized, pre-generated | ||
| OTS keys (if any) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| - enr:-Ku4QHqVeJ8PPICcWk1vSn_XcSkjOkNiTg6Fmii5j6vUQgvzMc9L1goFnLKgXqBJspJjIsB91LTOleFmyWWrFVATGngBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhAMRHkWJc2VjcDI1NmsxoQKLVXFOhp2uX6jeT0DvvDpPcU8FWMjQdR4wMuORMhpX24N1ZHCCIyg | ||
| - enr:-Ku4QPn5eVhcoF1opaFEvg1b6JNFD2rqVkHQ8HApOKK61OIcIXD127bKWgAtbwI7pnxx6cDyk_nI88TrZKQaGMZj0q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDayLMaJc2VjcDI1NmsxoQK2sBOLGcUb4AwuYzFuAVCaNHA-dy24UuEKkeFNgCVCsIN1ZHCCIyg | ||
| - enr:-Ku4QG-2_Md3sZIAUebGYT6g0SMskIml77l6yR-M_JXc-UdNHCmHQeOiMLbylPejyJsdAPsTHJyjJB2sYGDLe0dn8uYBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhBLY-NyJc2VjcDI1NmsxoQORcM6e19T1T9gi7jxEZjk_sjVLGFscUNqAY9obgZaxbIN1ZHCCIyg |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ream: [0, 3, 6, 9, 12, 15, 18, 21, 24, 27] | ||
| zeam: [1, 4, 7, 10, 13, 16, 19, 22, 25, 28] | ||
| quadrivium: [2, 5, 8, 11, 14, 17, 20, 23, 26, 29] |

Uh oh!
There was an error while loading. Please reload this page.