Skip to content

Commit

Permalink
Merge branch 'dev' into eip7002
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Jun 26, 2023
2 parents 2f4ce8f + f1aabcd commit 7b771cc
Show file tree
Hide file tree
Showing 38 changed files with 1,294 additions and 1,061 deletions.
16 changes: 1 addition & 15 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ defaults:

env:
TEST_PRESET_TYPE: "minimal"
DEFAULT_BRANCH: "dev"

# Run tests on workflow_Dispatch
on:
on:
push:
branches:
- dev
Expand All @@ -22,10 +20,6 @@ on:
description: Type of test to run, either mainnet or minimal
type: string
required: true
commitRef:
description: The branch, tag or SHA to checkout and build from
default: dev
required: true
schedule:
- cron: '0 0 * * *'

Expand All @@ -47,8 +41,6 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/checkout@v3.2.0
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: Check table of contents
run: sudo npm install -g doctoc@2.2.0 && make check_toc

Expand All @@ -58,8 +50,6 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/checkout@v3.2.0
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: Check codespell
run: pip install 'codespell<3.0.0,>=2.0.0' --user && make codespell

Expand All @@ -69,8 +59,6 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/checkout@v3.2.0
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: Install pyspec requirements
run: make install_test
- name: Run linter for pyspec
Expand All @@ -87,8 +75,6 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/checkout@v3.2.0
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: set TEST_PRESET_TYPE
if: github.event.inputs.test_preset_type != ''
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ venv
.venvs
.venv
/.pytest_cache
*.swp

build/
output/
Expand Down
14 changes: 7 additions & 7 deletions docs/docs/new-feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ For example, if the latest fork is Capella, use `./specs/capella` content as you
### 4. Add `fork.md`
You can refer to the previous fork's `fork.md` file.
### 5. Make it executable
- Update [`constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/constants.py) with the new feature name.
- Update [`setup.py`](https://github.com/ethereum/consensus-specs/blob/dev/setup.py):
- Add a new `SpecBuilder` with the new feature name constant. e.g., `EIP9999SpecBuilder`
- Add the new `SpecBuilder` to `spec_builders` list.
- Add the path of the new markdown files in `finalize_options` function.
- Update Pyspec [`constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/constants.py) with the new feature name.
- Update helpers for [`setup.py`](https://github.com/ethereum/consensus-specs/blob/dev/setup.py) for building the spec:
- Update [`pysetup/constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/constants.py) with the new feature name as Pyspec `constants.py` defined.
- Update [`pysetup/spec_builders/__init__.py`](https://github.com/ethereum/consensus-specs/blob/dev/pysetup/spec_builders/__init__.py). Implement a new `<FEATURE_NAME>SpecBuilder` in `pysetup/spec_builders/<FEATURE_NAME>.py` with the new feature name. e.g., `EIP9999SpecBuilder`. Append it to the `spec_builders` list.
- Update [`pysetup/md_doc_paths.py`](https://github.com/ethereum/consensus-specs/blob/dev/pysetup/md_doc_paths.py): add the path of the new markdown files in `get_md_doc_paths` function if needed.

## B: Make it executable for pytest and test generator

### 1. Add `light-client/*` docs if you updated the content of `BeaconBlock`
### 1. [Optional] Add `light-client/*` docs if you updated the content of `BeaconBlock`
- You can refer to the previous fork's `light-client/*` file.
- Add the path of the new markdown files in `setup.py`'s `finalize_options` function.
- Add the path of the new markdown files in [`pysetup/md_doc_paths.py`](https://github.com/ethereum/consensus-specs/blob/dev/pysetup/md_doc_paths.py)'s `get_md_doc_paths` function.

### 2. Add the mainnet and minimal presets and update the configs
- Add presets: `presets/mainnet/<new-feature-name>.yaml` and `presets/minimal/<new-feature-name>.yaml`
Expand Down
20 changes: 20 additions & 0 deletions presets/mainnet/whisk.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions presets/minimal/whisk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal preset - Whisk

# Misc
# ---------------------------------------------------------------
# [customized]
CURDLEPROOFS_N_BLINDERS: 4
# [customized]
WHISK_CANDIDATE_TRACKERS_COUNT: 32
# [customized]
WHISK_PROPOSER_TRACKERS_COUNT: 16
# [customized]
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4
# [customized]
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
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
Empty file added pysetup/__init__.py
Empty file.
34 changes: 34 additions & 0 deletions pysetup/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Definitions in context.py
PHASE0 = 'phase0'
ALTAIR = 'altair'
BELLATRIX = 'bellatrix'
CAPELLA = 'capella'
DENEB = 'deneb'
EIP6110 = 'eip6110'
EIP7002 = 'eip7002'
WHISK = 'whisk'



# The helper functions that are used when defining constants
CONSTANT_DEP_SUNDRY_CONSTANTS_FUNCTIONS = '''
def ceillog2(x: int) -> uint64:
if x < 1:
raise ValueError(f"ceillog2 accepts only positive values, x={x}")
return uint64((x - 1).bit_length())
def floorlog2(x: int) -> uint64:
if x < 1:
raise ValueError(f"floorlog2 accepts only positive values, x={x}")
return uint64(x.bit_length() - 1)
'''


OPTIMIZED_BLS_AGGREGATE_PUBKEYS = '''
def eth_aggregate_pubkeys(pubkeys: Sequence[BLSPubkey]) -> BLSPubkey:
return bls.AggregatePKs(pubkeys)
'''


ETH2_SPEC_COMMENT_PREFIX = "eth2spec:"
Loading

0 comments on commit 7b771cc

Please sign in to comment.