Skip to content
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

Release v1.5.0-alpha.7 #3954

Merged
merged 128 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
fd75470
Add pending_deposits queue and queue deposit requests
mkalinin Jun 20, 2024
2a202c8
Refactor pending deposit processing
mkalinin Jun 20, 2024
0b7fef3
Limit number of pending deposits to be processed per epoch
mkalinin Jun 20, 2024
5c3a51a
Process deposit requests after Eth1 bridge deposits are applied
mkalinin Jun 25, 2024
179ee8e
Finalize deposit requests before processing
mkalinin Jun 25, 2024
43e7344
Refactor process_pending_deposits
mkalinin Jun 26, 2024
8f6b1e0
Merge remote-tracking branch 'origin/dev' into deposit-queue
mkalinin Jun 28, 2024
e1a4d8b
added some simple tests
james-prysm Jul 1, 2024
5c0a8d3
Fix off-by-one found by @james-prysm
mkalinin Jul 2, 2024
2af84d8
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 2, 2024
8099f39
merging upstream
james-prysm Jul 2, 2024
750f7a1
adding new test
james-prysm Jul 2, 2024
077edf8
Merge branch 'deposit-queue' of github.com:james-prysm/eth2.0-specs-m…
james-prysm Jul 2, 2024
b31fa63
apply pending deposit tests
james-prysm Jul 2, 2024
b2cd3ce
fixing comment
james-prysm Jul 2, 2024
03071df
preston's feedback
james-prysm Jul 3, 2024
5a2f887
Merge remote-tracking branch 'origin/dev' into deposit-queue
mkalinin Jul 3, 2024
ee4da7b
Refactor postponed deposit processing
mkalinin Jul 5, 2024
6ed15b2
Fix electra fork tests
mkalinin Jul 5, 2024
093590e
Merge remote-tracking branch 'upstream/deposit-queue' into deposit-queue
james-prysm Jul 8, 2024
1a19d82
updating tests based on mikhail changes
james-prysm Jul 9, 2024
85b752b
Fix by @pawanjay176
mkalinin Jul 9, 2024
1e9337e
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 10, 2024
577b028
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 10, 2024
8b191e6
fixing linting
james-prysm Jul 10, 2024
2c8dd39
updating tests
james-prysm Jul 11, 2024
320a692
adding test for chrun
james-prysm Jul 12, 2024
48b9928
adding out of validator range test
james-prysm Jul 12, 2024
bf03d78
fixing linting
james-prysm Jul 12, 2024
ea33eac
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
1feb1fb
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
d62559f
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
6903bab
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
4a4cdfc
revert beacon-chain.md changes
james-prysm Jul 26, 2024
077fd44
Merge branch 'deposit-queue' of github.com:james-prysm/eth2.0-specs-m…
james-prysm Jul 26, 2024
e80c39b
mikhail's feedback
james-prysm Jul 29, 2024
6a7bfe9
removed wrong balance
james-prysm Jul 29, 2024
824e374
applying feedback fir add validator test
james-prysm Jul 30, 2024
0a51fe0
updating tests
james-prysm Aug 2, 2024
1afa514
adding test_process_pending_deposits_limit_is_reached
james-prysm Aug 2, 2024
336c6f1
adding some more tests based on test plan
james-prysm Aug 5, 2024
3593a0c
adding 3 more tests
james-prysm Aug 5, 2024
2cf7de9
updating bridge tests
james-prysm Aug 6, 2024
337726c
adding no compounding test
james-prysm Aug 6, 2024
56fe310
adding run_process_pending_deposits to deposit request tests to prope…
james-prysm Aug 6, 2024
c5db6df
adding fork version tests
james-prysm Aug 6, 2024
698367e
Merge pull request #18 from james-prysm/deposit-queue
mkalinin Aug 7, 2024
ada5524
Use the right MaxEB to create validator from deposit
mkalinin Aug 23, 2024
a6864d4
Merge branch 'dev' into deposit-queue
mkalinin Aug 23, 2024
97e6166
Move switch to compounding to process_deposit_request
mkalinin Aug 26, 2024
990de16
Add more deposit tests
mkalinin Aug 26, 2024
c183be4
Update consolidation tests with pending deposit
mkalinin Aug 26, 2024
7afe8e0
Update eip7732 with pending_deposits
mkalinin Aug 26, 2024
ad8f54f
Update pending deposits tests
mkalinin Aug 27, 2024
22bb1de
Fix code spell
mkalinin Aug 27, 2024
0526592
Do state.pending_deposits update in a single line
mkalinin Aug 27, 2024
3ebddad
Merge branch 'dev' into deposit-queue
mkalinin Sep 4, 2024
8c726ff
Fix get_max_effective_balance call
mkalinin Sep 4, 2024
67cc3a5
Rename MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING to MAX_PENDING_DEPOS…
mkalinin Sep 5, 2024
0eda70c
Switch to compounding when consolidating with source==target
mkalinin Sep 12, 2024
747a5a7
Apply suggestions from @dapplion
mkalinin Sep 16, 2024
1bf8ca5
Apply suggestions by @ralexstokes
mkalinin Sep 18, 2024
b29a1d3
Isolate switch to compounding flow
mkalinin Sep 18, 2024
d71d9dd
Fix lint
mkalinin Sep 18, 2024
1513492
Merge branch 'dev' into deposit-queue
mkalinin Sep 18, 2024
083402f
Remove switch_to_compounding from deposit flow
mkalinin Sep 18, 2024
23699f5
Undo MAX_EB to MIN_AB switch in withdrawal helper
mkalinin Sep 19, 2024
0c5ad81
Fix merkle multiproof documentation (#3928)
EchoAlice Sep 20, 2024
0c9762f
Improve check_toc rule in Makefile
jtraglia Sep 20, 2024
e0651d3
Revert some changes
jtraglia Sep 20, 2024
eff5e8f
Remove ONESHELL stuff
jtraglia Sep 20, 2024
c1507f0
Add notice on attester_slashing topic modification
mkalinin Sep 24, 2024
c6d4c2e
Merge pull request #3937 from jtraglia/improve-check-toc
hwwhww Sep 24, 2024
865dff0
Merge pull request #3941 from ethereum/mkalinin-patch-7
hwwhww Sep 24, 2024
dcdcf25
Fix electra sanity testgen for blocks (#3939)
jtraglia Sep 24, 2024
5913960
Add notes on add_validator_to_registry, process_deposit modifications
mkalinin Sep 25, 2024
72e9a31
Replace links to eth2.0-specs with consensus-specs (#3934)
jtraglia Sep 26, 2024
3162c91
Simplify output from make pyspec (#3938)
jtraglia Sep 26, 2024
3196f32
Add testgen badge to readme (#3933)
jtraglia Sep 26, 2024
8385726
Add a negative test for full exit has partial withdrawal
terencechain Sep 26, 2024
2bc2604
Apply suggestions from @jtraglia
mkalinin Sep 27, 2024
3330265
Apply suggestions from @jtraglia
mkalinin Sep 27, 2024
a9e3aad
Use `bls.Scalar` as the base class for `BLSFieldElement` (#3907)
jtraglia Sep 27, 2024
e46ba7f
Fix insufficient effective bal test and add a bal test
terencechain Sep 28, 2024
0301ec7
EIP7251: Revamp process_effective_balance_updates
ppopth Sep 29, 2024
29552a7
Capitalize comment
jtraglia Sep 30, 2024
bda8957
Merge pull request #3948 from ppopth/refactor-get-max-effective-balance
ralexstokes Sep 30, 2024
0c8645e
EIP-7251: Flatten get_active_balance (#3949)
ppopth Sep 30, 2024
ecb4c2a
eip7251: Fix partial withdrawals count (#3943)
mkalinin Sep 30, 2024
85e2452
Remove queue_entire_balance_and_reset_validator (#3951)
ppopth Sep 30, 2024
a7b0d6f
Apply suggestions from code review
mkalinin Oct 1, 2024
11cfd96
Merge branch 'dev' into consolidation-switch-to-comp
mkalinin Oct 1, 2024
4ee4105
Merge branch 'dev' into deposit-queue
mkalinin Oct 2, 2024
a04e4c3
Fix fork logic
mkalinin Oct 2, 2024
e8a013b
Merge pull request #3947 from terencechain/withdrawal-request-balance…
mkalinin Oct 2, 2024
111a658
Merge branch 'dev' into full-exit-has-partial-withdrawal-test
mkalinin Oct 2, 2024
21179dd
Merge pull request #3946 from terencechain/full-exit-has-partial-with…
mkalinin Oct 2, 2024
a6294c6
Add a negative test for inactive validator for withdrawal request (#3…
terencechain Oct 2, 2024
578407a
Reject invalid DataColumnSidecar for zero blobs
jtraglia Oct 2, 2024
3f49e6c
Deepcopy sidecar before modifying it
jtraglia Oct 2, 2024
4578b59
Use wrapper function which does the deepcopy
jtraglia Oct 2, 2024
df987b5
Create new verify_data_column_sidecar() function
jtraglia Oct 2, 2024
09cc204
Add an extra blank line for consistency
jtraglia Oct 2, 2024
e02cbab
Move index check to top
jtraglia Oct 2, 2024
3984bd3
Convert assert to return False
jtraglia Oct 2, 2024
3196487
Add missing semicolon
jtraglia Oct 2, 2024
2ceb0fd
Fix some nits
jtraglia Oct 2, 2024
3e80dc8
Add new verification to is_data_available
jtraglia Oct 3, 2024
1329410
Bump version to 1.5.0-alpha.7 (#3955)
jtraglia Oct 3, 2024
2dd9e82
Remove blank lines
mkalinin Oct 3, 2024
66f5c37
Fix switch to compounding tests
mkalinin Oct 3, 2024
beb2718
Apply suggestions by @ppopth
mkalinin Oct 3, 2024
30f6aba
Put "and" at the beginning of the next line
jtraglia Oct 3, 2024
62c32da
Be more consistent with test names
jtraglia Oct 3, 2024
f081b1b
Merge pull request #3918 from mkalinin/consolidation-switch-to-comp
jtraglia Oct 3, 2024
24874f3
Merge pull request #3953 from jtraglia/reject-invalid-dcs
jtraglia Oct 3, 2024
f97cd61
Correct the use of get_data_column_sidecars
ppopth Oct 3, 2024
61669ea
Merge pull request #3957 from ethereum/master
jtraglia Oct 3, 2024
3ffaf68
Merge pull request #3958 from ppopth/correct-get-data-column-sidecars…
jtraglia Oct 3, 2024
358378d
Merge branch 'dev' into deposit-queue
jtraglia Oct 3, 2024
82d2bc0
Fix two tests by replacing old PendingBalanceDeposit
jtraglia Oct 3, 2024
ef65fbc
Fix EIP reference
lucassaldanha Oct 3, 2024
233afd5
Merge pull request #3959 from lucassaldanha/patch-1
jtraglia Oct 3, 2024
7705984
Fix consolidation test
mkalinin Oct 4, 2024
77d2865
Rename test_apply_pending_deposit to test_process_pending_deposit
jtraglia Oct 4, 2024
3befc42
Rename test_apply_pending_deposit* to test_process_pending_deposit*
jtraglia Oct 4, 2024
ad42273
Use pending_deposits format for both test files
jtraglia Oct 4, 2024
7df1ce3
Merge pull request #3818 from mkalinin/deposit-queue
jtraglia Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/generate_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ jobs:
cp -r presets/ ../consensus-spec-tests/presets
cp -r configs/ ../consensus-spec-tests/configs
find . -type d -empty -delete
- name: Check for errors
run: |
if grep -q "\[ERROR\]" consensustestgen.log; then
echo "There is an error in the log"
exit 1
fi
if find . -type f -name "INCOMPLETE" | grep -q "INCOMPLETE"; then
echo "There is an INCOMPLETE file"
exit 1
fi
- name: Archive configurations
run: |
cd consensus-spec-tests
Expand Down
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/*/*.md) \
$(wildcard $(SPEC_DIR)/_features/*/*/*.md) \
$(wildcard $(SSZ_DIR)/*.md)

ALL_EXECUTABLE_SPEC_NAMES = phase0 altair bellatrix capella deneb electra whisk eip6800 eip7732
ALL_EXECUTABLE_SPEC_NAMES = phase0 altair bellatrix capella deneb electra whisk eip6800 eip7594 eip7732
# The parameters for commands. Use `foreach` to avoid listing specs again.
COVERAGE_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), --cov=eth2spec.$S.$(TEST_PRESET_TYPE))
PYLINT_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), ./eth2spec/$S)
Expand Down Expand Up @@ -105,7 +105,7 @@ generate_tests: $(GENERATOR_TARGETS)

# "make pyspec" to create the pyspec for all phases.
pyspec:
python3 -m venv venv; . venv/bin/activate; python3 setup.py pyspecdev
@python3 -m venv venv; . venv/bin/activate; python3 setup.py pyspecdev

# check the setup tool requirements
preinstallation:
Expand Down Expand Up @@ -141,13 +141,21 @@ endif
open_cov:
((open "$(COV_INDEX_FILE)" || xdg-open "$(COV_INDEX_FILE)") &> /dev/null) &

# Check all files and error if any ToC were modified.
check_toc: $(MARKDOWN_FILES:=.toc)
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0

# Generate ToC sections & save copy of original if modified.
%.toc:
cp $* $*.tmp && \
doctoc $* && \
diff -q $* $*.tmp && \
rm $*.tmp
@cp $* $*.tmp; \
doctoc $* > /dev/null; \
if diff -q $* $*.tmp > /dev/null; then \
echo "Good $*"; \
rm $*.tmp; \
else \
echo "\033[1;33m Bad $*\033[0m"; \
echo "\033[1;34m See $*.tmp\033[0m"; \
fi

codespell:
codespell . --skip "./.git,./venv,$(PY_SPEC_DIR)/.mypy_cache" -I .codespell-whitelist
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repository hosts the current Ethereum proof-of-stake specifications. Discus

## Specs

[![GitHub release](https://img.shields.io/github/v/release/ethereum/eth2.0-specs)](https://github.com/ethereum/eth2.0-specs/releases/) [![PyPI version](https://badge.fury.io/py/eth2spec.svg)](https://badge.fury.io/py/eth2spec)
[![GitHub release](https://img.shields.io/github/v/release/ethereum/consensus-specs)](https://github.com/ethereum/consensus-specs/releases/) [![PyPI version](https://badge.fury.io/py/eth2spec.svg)](https://badge.fury.io/py/eth2spec) [![testgen](https://github.com/ethereum/consensus-specs/actions/workflows/generate_vectors.yml/badge.svg?branch=dev&event=schedule)](https://github.com/ethereum/consensus-specs/actions/workflows/generate_vectors.yml)

Core specifications for Ethereum proof-of-stake clients can be found in [specs](specs/). These are divided into features.
Features are researched and developed in parallel, and then consolidated into sequential upgrades when ready.
Expand Down
7 changes: 6 additions & 1 deletion presets/mainnet/electra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# `uint64(2**27)` (= 134,217,728)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 134217728
# `uint64(2**18)` (= 262,144)
Expand Down Expand Up @@ -43,3 +43,8 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
# ---------------------------------------------------------------
# 2**3 ( = 8) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
11 changes: 8 additions & 3 deletions presets/minimal/electra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# [customized] `uint64(2**6)` (= 64)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 64
# [customized] `uint64(2**6)` (= 64)
Expand Down Expand Up @@ -41,5 +41,10 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2

# Withdrawals processing
# ---------------------------------------------------------------
# 2**0 ( = 1) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1
# 2**1 ( = 2) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 2

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH: 16
3 changes: 3 additions & 0 deletions pysetup/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def format_constant(name: str, vardef: VariableDefinition) -> str:
hardcoded_func_dep_presets = reduce(lambda obj, builder: {**obj, **builder.hardcoded_func_dep_presets(spec_object)}, builders, {})
# Concatenate all strings
imports = reduce(lambda txt, builder: (txt + "\n\n" + builder.imports(preset_name) ).strip("\n"), builders, "")
classes = reduce(lambda txt, builder: (txt + "\n\n" + builder.classes() ).strip("\n"), builders, "")
preparations = reduce(lambda txt, builder: (txt + "\n\n" + builder.preparations() ).strip("\n"), builders, "")
sundry_functions = reduce(lambda txt, builder: (txt + "\n\n" + builder.sundry_functions() ).strip("\n"), builders, "")
# Keep engine from the most recent fork
Expand Down Expand Up @@ -154,6 +155,8 @@ def format_constant(name: str, vardef: VariableDefinition) -> str:
constant_vars_spec,
preset_vars_spec,
config_spec,
# Custom classes which are not required to be SSZ containers.
classes,
ordered_class_objects_spec,
protocols_spec,
functions_spec,
Expand Down
7 changes: 7 additions & 0 deletions pysetup/spec_builders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def imports(cls, preset_name: str) -> str:
"""
return ""

@classmethod
def classes(cls) -> str:
"""
Define special classes.
"""
return ""

@classmethod
def preparations(cls) -> str:
"""
Expand Down
15 changes: 15 additions & 0 deletions pysetup/spec_builders/deneb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ def imports(cls, preset_name: str):
from eth2spec.capella import {preset_name} as capella
'''

@classmethod
def classes(cls):
return f'''
class BLSFieldElement(bls.Scalar):
pass
class Polynomial(list):
def __init__(self, evals: Optional[Sequence[BLSFieldElement]] = None):
if evals is None:
evals = [BLSFieldElement(0)] * FIELD_ELEMENTS_PER_BLOB
if len(evals) != FIELD_ELEMENTS_PER_BLOB:
raise ValueError("expected FIELD_ELEMENTS_PER_BLOB evals")
super().__init__(evals)
'''

@classmethod
def preparations(cls):
Expand Down
31 changes: 30 additions & 1 deletion pysetup/spec_builders/eip7594.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,41 @@ def imports(cls, preset_name: str):
return f'''
from eth2spec.deneb import {preset_name} as deneb
'''



@classmethod
def classes(cls):
return f'''
class PolynomialCoeff(list):
def __init__(self, coeffs: Sequence[BLSFieldElement]):
if len(coeffs) > FIELD_ELEMENTS_PER_EXT_BLOB:
raise ValueError("expected <= FIELD_ELEMENTS_PER_EXT_BLOB coeffs")
super().__init__(coeffs)


class Coset(list):
def __init__(self, coeffs: Optional[Sequence[BLSFieldElement]] = None):
if coeffs is None:
coeffs = [BLSFieldElement(0)] * FIELD_ELEMENTS_PER_CELL
if len(coeffs) != FIELD_ELEMENTS_PER_CELL:
raise ValueError("expected FIELD_ELEMENTS_PER_CELL coeffs")
super().__init__(coeffs)


class CosetEvals(list):
def __init__(self, evals: Optional[Sequence[BLSFieldElement]] = None):
if evals is None:
evals = [BLSFieldElement(0)] * FIELD_ELEMENTS_PER_CELL
if len(evals) != FIELD_ELEMENTS_PER_CELL:
raise ValueError("expected FIELD_ELEMENTS_PER_CELL coeffs")
super().__init__(evals)
'''

@classmethod
def sundry_functions(cls) -> str:
return """
def retrieve_column_sidecars(beacon_block_root: Root) -> Sequence[DataColumnSidecar]:
# pylint: disable=unused-argument
return []
"""

Expand Down
27 changes: 21 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
)
from pysetup.md_doc_paths import get_md_doc_paths

# Ignore '1.5.0-alpha.*' to '1.5.0a*' messages.
import warnings
warnings.filterwarnings('ignore', message='Normalizing .* to .*')

# Ignore 'running' and 'creating' messages
import logging
class PyspecFilter(logging.Filter):
def filter(self, record):
return not record.getMessage().startswith(('running ', 'creating '))
logging.getLogger().addFilter(PyspecFilter())

# NOTE: have to programmatically include third-party dependencies in `setup.py`.
def installPackage(package: str):
Expand Down Expand Up @@ -173,7 +183,7 @@ def _update_constant_vars_with_kzg_setups(constant_vars, preset_name):
constant_vars['KZG_SETUP_G1_MONOMIAL'] = VariableDefinition(constant_vars['KZG_SETUP_G1_MONOMIAL'].value, str(kzg_setups[0]), comment, None)
constant_vars['KZG_SETUP_G1_LAGRANGE'] = VariableDefinition(constant_vars['KZG_SETUP_G1_LAGRANGE'].value, str(kzg_setups[1]), comment, None)
constant_vars['KZG_SETUP_G2_MONOMIAL'] = VariableDefinition(constant_vars['KZG_SETUP_G2_MONOMIAL'].value, str(kzg_setups[2]), comment, None)


def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], preset_name=str) -> SpecObject:
functions: Dict[str, str] = {}
Expand Down Expand Up @@ -251,10 +261,17 @@ def get_spec(file_name: Path, preset: Dict[str, str], config: Dict[str, str], pr
# marko parses `**X**` as a list containing a X
description = description[0].children

if isinstance(name, list):
# marko parses `[X]()` as a list containing a X
name = name[0].children
if isinstance(value, list):
# marko parses `**X**` as a list containing a X
value = value[0].children

# Skip types that have been defined elsewhere
if description is not None and description.startswith("<!-- predefined-type -->"):
continue

if not _is_constant_id(name):
# Check for short type declarations
if value.startswith(("uint", "Bytes", "ByteList", "Union", "Vector", "List", "ByteVector")):
Expand Down Expand Up @@ -394,8 +411,6 @@ def initialize_options(self):
def finalize_options(self):
"""Post-process options."""
if len(self.md_doc_paths) == 0:
print("no paths were specified, using default markdown file paths for pyspec"
" build (spec fork: %s)" % self.spec_fork)
self.md_doc_paths = get_md_doc_paths(self.spec_fork)
if len(self.md_doc_paths) == 0:
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)
Expand Down Expand Up @@ -428,6 +443,7 @@ def run(self):
if not self.dry_run:
dir_util.mkpath(self.out_dir)

print(f'Building pyspec: {self.spec_fork}')
for (name, preset_paths, config_path) in self.parsed_build_targets:
spec_str = build_spec(
spec_builders[self.spec_fork].fork,
Expand Down Expand Up @@ -492,7 +508,6 @@ def run_pyspec_cmd(self, spec_fork: str, **opts):
self.run_command('pyspec')

def run(self):
print("running build_py command")
for spec_fork in spec_builders:
self.run_pyspec_cmd(spec_fork=spec_fork)

Expand Down Expand Up @@ -561,7 +576,7 @@ def run(self):
RUAMEL_YAML_VERSION,
"lru-dict==1.2.0",
MARKO_VERSION,
"py_arkworks_bls12381==0.3.4",
"curdleproofs==0.1.1",
"py_arkworks_bls12381==0.3.8",
"curdleproofs==0.1.2",
]
)
2 changes: 1 addition & 1 deletion specs/_features/eip7594/das-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ In this construction, we extend the blobs using a one-dimensional erasure coding

### Parameters

For each column -- use `data_column_sidecar_{subnet_id}` subnets, where `subnet_id` can be computed with the `compute_subnet_for_data_column_sidecar(column_index: ColumnIndex)` helper. The sidecars can be computed with the `get_data_column_sidecars(signed_block: SignedBeaconBlock, blobs: Sequence[Blob])` helper.
For each column -- use `data_column_sidecar_{subnet_id}` subnets, where `subnet_id` can be computed with the `compute_subnet_for_data_column_sidecar(column_index: ColumnIndex)` helper. The sidecars can be computed with `cells_and_kzg_proofs = [compute_cells_and_kzg_proofs(blob) for blob in blobs]` and then `get_data_column_sidecars(signed_block, cells_and_kzg_proofs)`.

Verifiable samples from their respective column are distributed on the assigned subnet. To custody a particular column, a node joins the respective gossipsub subnet. If a node fails to get a column on the column subnet, a node can also utilize the Req/Resp protocol to query the missing column from other peers.

Expand Down
3 changes: 2 additions & 1 deletion specs/_features/eip7594/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def is_data_available(beacon_block_root: Root) -> bool:
# `MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS` epochs.
column_sidecars = retrieve_column_sidecars(beacon_block_root)
return all(
verify_data_column_sidecar_kzg_proofs(column_sidecar)
verify_data_column_sidecar(column_sidecar)
and verify_data_column_sidecar_kzg_proofs(column_sidecar)
for column_sidecar in column_sidecars
)
```
Expand Down
30 changes: 25 additions & 5 deletions specs/_features/eip7594/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [Containers](#containers)
- [`DataColumnIdentifier`](#datacolumnidentifier)
- [Helpers](#helpers)
- [`verify_data_column_sidecar`](#verify_data_column_sidecar)
- [`verify_data_column_sidecar_kzg_proofs`](#verify_data_column_sidecar_kzg_proofs)
- [`verify_data_column_sidecar_inclusion_proof`](#verify_data_column_sidecar_inclusion_proof)
- [`compute_subnet_for_data_column_sidecar`](#compute_subnet_for_data_column_sidecar)
Expand Down Expand Up @@ -64,16 +65,35 @@ class DataColumnIdentifier(Container):

### Helpers

##### `verify_data_column_sidecar`

```python
def verify_data_column_sidecar(sidecar: DataColumnSidecar) -> bool:
"""
Verify if the data column sidecar is valid.
"""
# The sidecar index must be within the valid range
if sidecar.index >= NUMBER_OF_COLUMNS:
return False

# A sidecar for zero blobs is invalid
if len(sidecar.kzg_commitments) == 0:
return False

# The column length must be equal to the number of commitments/proofs
if len(sidecar.column) != len(sidecar.kzg_commitments) or len(sidecar.column) != len(sidecar.kzg_proofs):
return False

return True
```

##### `verify_data_column_sidecar_kzg_proofs`

```python
def verify_data_column_sidecar_kzg_proofs(sidecar: DataColumnSidecar) -> bool:
"""
Verify if the proofs are correct.
Verify if the KZG proofs are correct.
"""
assert sidecar.index < NUMBER_OF_COLUMNS
assert len(sidecar.column) == len(sidecar.kzg_commitments) == len(sidecar.kzg_proofs)

# The column index also represents the cell index
cell_indices = [CellIndex(sidecar.index)] * len(sidecar.column)

Expand Down Expand Up @@ -148,7 +168,7 @@ The *type* of the payload of this topic is `DataColumnSidecar`.

The following validations MUST pass before forwarding the `sidecar: DataColumnSidecar` on the network, assuming the alias `block_header = sidecar.signed_block_header.message`:

- _[REJECT]_ The sidecar's index is consistent with `NUMBER_OF_COLUMNS` -- i.e. `sidecar.index < NUMBER_OF_COLUMNS`.
- _[REJECT]_ The sidecar is valid as verified by `verify_data_column_sidecar(sidecar)`.
- _[REJECT]_ The sidecar is for the correct subnet -- i.e. `compute_subnet_for_data_column_sidecar(sidecar.index) == subnet_id`.
- _[IGNORE]_ The sidecar is not from a future slot (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance) -- i.e. validate that `block_header.slot <= current_slot` (a client MAY queue future sidecars for processing at the appropriate slot).
- _[IGNORE]_ The sidecar is from a slot greater than the latest finalized slot -- i.e. validate that `block_header.slot > compute_start_slot_at_epoch(state.finalized_checkpoint.epoch)`
Expand Down
Loading