From fdef95424fe66da132211d53cbca5df297ede2be Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:41:50 +0300 Subject: [PATCH 1/3] Add Whisk preset files --- presets/mainnet/whisk.yaml | 20 ++++++++++++++++++++ presets/minimal/whisk.yaml | 20 ++++++++++++++++++++ specs/_features/whisk/beacon-chain.md | 21 ++++++++++++++------- 3 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 presets/mainnet/whisk.yaml create mode 100644 presets/minimal/whisk.yaml diff --git a/presets/mainnet/whisk.yaml b/presets/mainnet/whisk.yaml new file mode 100644 index 0000000000..3086ff29de --- /dev/null +++ b/presets/mainnet/whisk.yaml @@ -0,0 +1,20 @@ +# Mainnet preset - Whisk + +# Misc +# --------------------------------------------------------------- +# `uint64(4)` +CURDLEPROOFS_N_BLINDERS: 4 +# `uint64(2**14)` +WHISK_CANDIDATE_TRACKERS_COUNT: 16384 +# `uint64(2**13)` must be < WHISK_CANDIDATE_TRACKERS_COUNT +WHISK_PROPOSER_TRACKERS_COUNT: 8192 +# `Epoch(2**8)` +WHISK_EPOCHS_PER_SHUFFLING_PHASE: 256 +# `uint64(2**7 - CURDLEPROOFS_N_BLINDERS)` +WHISK_VALIDATORS_PER_SHUFFLE: 124 +# `Epoch(2)` +WHISK_PROPOSER_SELECTION_GAP: 2 +# `uint64(2**15)` TODO: will be replaced by a fix format once there's a serialized format +WHISK_MAX_SHUFFLE_PROOF_SIZE: 32768 +# `uint64(2**10)` TODO: will be replaced by a fix format once there's a serialized format +WHISK_MAX_OPENING_PROOF_SIZE: 1024 diff --git a/presets/minimal/whisk.yaml b/presets/minimal/whisk.yaml new file mode 100644 index 0000000000..43e533aeb1 --- /dev/null +++ b/presets/minimal/whisk.yaml @@ -0,0 +1,20 @@ +# Minimal preset - Whisk + +# Misc +# --------------------------------------------------------------- +# [customized] +CURDLEPROOFS_N_BLINDERS: 2 +# [customized] +WHISK_CANDIDATE_TRACKERS_COUNT: 32 +# [customized] +WHISK_PROPOSER_TRACKERS_COUNT: 16 +# [customized] +WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4 +# [customized] +WHISK_VALIDATORS_PER_SHUFFLE: 2 +# [customized] +WHISK_PROPOSER_SELECTION_GAP: 1 +# `uint64(2**15)` TODO: will be replaced by a fix format once there's a serialized format +WHISK_MAX_SHUFFLE_PROOF_SIZE: 32768 +# `uint64(2**10)` TODO: will be replaced by a fix format once there's a serialized format +WHISK_MAX_OPENING_PROOF_SIZE: 1024 diff --git a/specs/_features/whisk/beacon-chain.md b/specs/_features/whisk/beacon-chain.md index bad8188378..38afac080c 100644 --- a/specs/_features/whisk/beacon-chain.md +++ b/specs/_features/whisk/beacon-chain.md @@ -10,6 +10,8 @@ - [Introduction](#introduction) - [Constants](#constants) + - [Domain types](#domain-types) +- [Preset](#preset) - [Cryptography](#cryptography) - [BLS](#bls) - [Curdleproofs and opening proofs](#curdleproofs-and-opening-proofs) @@ -35,22 +37,27 @@ This document details the beacon chain additions and changes of to support the W ## Constants +### Domain types + +| Name | Value | +| ---------------------------------- | -------------------------- | +| `DOMAIN_WHISK_CANDIDATE_SELECTION` | `DomainType('0x07000000')` | +| `DOMAIN_WHISK_SHUFFLE` | `DomainType('0x07100000')` | +| `DOMAIN_WHISK_PROPOSER_SELECTION` | `DomainType('0x07200000')` | + +## Preset + | Name | Value | Description | | ---------------------------------- | -------------------------- | ----------------------------------------------------------- | +| `CURDLEPROOFS_N_BLINDERS` | `uint64(4)` | number of blinders for curdleproofs | | `WHISK_CANDIDATE_TRACKERS_COUNT` | `uint64(2**14)` (= 16,384) | number of candidate trackers | | `WHISK_PROPOSER_TRACKERS_COUNT` | `uint64(2**13)` (= 8,192) | number of proposer trackers | | `WHISK_EPOCHS_PER_SHUFFLING_PHASE` | `Epoch(2**8)` (= 256) | epochs per shuffling phase | -| `WHISK_VALIDATORS_PER_SHUFFLE` | `uint64(2**7)` (= 128) | number of validators shuffled per shuffle step | +| `WHISK_VALIDATORS_PER_SHUFFLE` | `uint64(2**7 - 4)` (= 124) | number of validators shuffled per shuffle step | | `WHISK_PROPOSER_SELECTION_GAP` | `Epoch(2)` | gap between proposer selection and the block proposal phase | | `WHISK_MAX_SHUFFLE_PROOF_SIZE` | `uint64(2**15)` | max size of a shuffle proof | | `WHISK_MAX_OPENING_PROOF_SIZE` | `uint64(2**10)` | max size of a opening proof | -| Name | Value | -| ---------------------------------- | -------------------------- | -| `DOMAIN_WHISK_CANDIDATE_SELECTION` | `DomainType('0x07000000')` | -| `DOMAIN_WHISK_SHUFFLE` | `DomainType('0x07100000')` | -| `DOMAIN_WHISK_PROPOSER_SELECTION` | `DomainType('0x07200000')` | - ## Cryptography ### BLS From f3430459e268fed2b9aa9b8bcbeed00d23f7c270 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:52:18 +0300 Subject: [PATCH 2/3] Use N=8 for minimal preset --- presets/minimal/whisk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presets/minimal/whisk.yaml b/presets/minimal/whisk.yaml index 43e533aeb1..1a726f79c2 100644 --- a/presets/minimal/whisk.yaml +++ b/presets/minimal/whisk.yaml @@ -3,7 +3,7 @@ # Misc # --------------------------------------------------------------- # [customized] -CURDLEPROOFS_N_BLINDERS: 2 +CURDLEPROOFS_N_BLINDERS: 4 # [customized] WHISK_CANDIDATE_TRACKERS_COUNT: 32 # [customized] @@ -11,7 +11,7 @@ WHISK_PROPOSER_TRACKERS_COUNT: 16 # [customized] WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4 # [customized] -WHISK_VALIDATORS_PER_SHUFFLE: 2 +WHISK_VALIDATORS_PER_SHUFFLE: 4 # [customized] WHISK_PROPOSER_SELECTION_GAP: 1 # `uint64(2**15)` TODO: will be replaced by a fix format once there's a serialized format From 2eb09ce464cbff70bde2a6ed19b5d087bc507a14 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Thu, 15 Jun 2023 20:42:19 +0300 Subject: [PATCH 3/3] Update spec_object var location --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f12800a621..cc1fcca098 100644 --- a/setup.py +++ b/setup.py @@ -793,8 +793,8 @@ def imports(cls, preset_name: str): def hardcoded_custom_type_dep_constants(cls, spec_object) -> str: # Necessary for custom types `WhiskShuffleProof` and `WhiskTrackerProof` constants = { - 'WHISK_MAX_SHUFFLE_PROOF_SIZE': spec_object.constant_vars['WHISK_MAX_SHUFFLE_PROOF_SIZE'].value, - 'WHISK_MAX_OPENING_PROOF_SIZE': spec_object.constant_vars['WHISK_MAX_OPENING_PROOF_SIZE'].value, + 'WHISK_MAX_SHUFFLE_PROOF_SIZE': spec_object.preset_vars['WHISK_MAX_SHUFFLE_PROOF_SIZE'].value, + 'WHISK_MAX_OPENING_PROOF_SIZE': spec_object.preset_vars['WHISK_MAX_OPENING_PROOF_SIZE'].value, } return {**super().hardcoded_custom_type_dep_constants(spec_object), **constants}