Skip to content

Commit 7839b29

Browse files
authored
Merge branch 'master' into eip8025-clean-up
2 parents 4373370 + 3be9b68 commit 7839b29

92 files changed

Lines changed: 559 additions & 698 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ build/
1111
output/
1212
dist/
1313

14-
.mypy_cache
1514
.pytest_cache
1615
.ruff_cache
1716

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ help-verbose:
9393
@echo " - mdformat: Formats markdown files"
9494
@echo " - codespell: Checks for spelling mistakes"
9595
@echo " - ruff: Python linter and formatter"
96-
@echo " - mypy: Static type checker for Python"
96+
@echo " - ty: Static type checker for Python"
9797
@echo " - Fork comments validation (scripts/check_fork_comments.py)"
9898
@echo " - Markdown headings validation (scripts/check_markdown_headings.py)"
9999
@echo " - Markdown note style fix (scripts/fix_note_style.py)"
@@ -257,8 +257,6 @@ serve_docs: _pyspec _copy_docs
257257
LINT_DIFF_BEFORE := .lint_diff_before
258258
LINT_DIFF_AFTER := .lint_diff_after
259259
MARKDOWN_FILES := $(shell find $(CURDIR) -name '*.md' -not -path '$(CURDIR)/.git/*' -not -path '$(CURDIR)/.venv/*')
260-
MYPY_PACKAGE_BASE := $(subst /,.,$(PYSPEC_DIR:$(CURDIR)/%=%))
261-
MYPY_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), -p $(MYPY_PACKAGE_BASE).eth_consensus_specs.$S)
262260

263261
# Check for mistakes.
264262
lint: _pyspec
@@ -275,8 +273,9 @@ lint: _pyspec
275273
@$(UV_RUN) ruff check --fix --quiet $(CURDIR)/tests $(CURDIR)/pysetup $(CURDIR)/specs
276274
@$(UV_RUN) ruff format --quiet $(CURDIR)/tests $(CURDIR)/pysetup
277275
@$(UV_RUN) ruff format --preview --quiet $(CURDIR)/specs
278-
@output="$$($(UV_RUN) mypy $(MYPY_SCOPE) 2>&1)" || \
279-
{ echo "$$output"; exit 1; }
276+
@$(UV_RUN) ty check --no-progress \
277+
$(PYSPEC_DIR)/eth_consensus_specs/*/mainnet.py \
278+
$(PYSPEC_DIR)/eth_consensus_specs/*/minimal.py
280279
@git diff > $(LINT_DIFF_AFTER)
281280
@diff -q $(LINT_DIFF_BEFORE) $(LINT_DIFF_AFTER) >/dev/null 2>&1 || \
282281
echo "$(BOLD)Note: make lint modified tracked files$(NORM)"

presets/mainnet/heze.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ INCLUSION_LIST_COMMITTEE_SIZE: 16
99
# ---------------------------------------------------------------
1010
# 196,934 bytes, ~192 KiB
1111
MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE_HEZE: 196934
12-
# 8,348 bytes, ~8 KiB
13-
MAX_SIGNED_INCLUSION_LIST_SIZE: 8348
12+
# 41,112 bytes, ~40 KiB
13+
MAX_SIGNED_INCLUSION_LIST_SIZE: 41112

presets/minimal/heze.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ INCLUSION_LIST_COMMITTEE_SIZE: 16
99
# ---------------------------------------------------------------
1010
# 196,934 bytes, ~192 KiB
1111
MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE_HEZE: 196934
12-
# 8,348 bytes, ~8 KiB
13-
MAX_SIGNED_INCLUSION_LIST_SIZE: 8348
12+
# 41,112 bytes, ~40 KiB
13+
MAX_SIGNED_INCLUSION_LIST_SIZE: 41112

pyproject.toml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ requires-python = ">=3.12, <3.15"
1313
urls = { homepage = "https://github.com/ethereum/consensus-specs" }
1414
dependencies = [
1515
"blake3==1.0.9",
16-
"eth-ssz-specs==0.0.1.dev2",
16+
"eth-ssz-specs==0.1.0",
1717
"eth-utils==6.0.0",
1818
"frozendict==2.4.7",
1919
"lru-dict==1.4.1",
@@ -45,8 +45,8 @@ lint = [
4545
"mdformat-gfm==1.0.0",
4646
"mdformat-toc==0.5.0",
4747
"mdformat==1.0.0",
48-
"mypy==2.3.1",
4948
"ruff-md==0.16.2",
49+
"ty==0.0.77",
5050
]
5151
docs = [
5252
"mdx-truly-sane-lists==1.3",
@@ -76,14 +76,6 @@ specs = ["**/*.md"]
7676
pythonpath = ["."]
7777
testpaths = ["tests"]
7878

79-
[tool.mypy]
80-
disallow_incomplete_defs = true
81-
disallow_untyped_defs = true
82-
warn_unused_ignores = true
83-
warn_unused_configs = true
84-
warn_redundant_casts = true
85-
ignore_missing_imports = true
86-
8779
[tool.ruff]
8880
line-length = 100
8981
namespace-packages = ["scripts"]
@@ -148,7 +140,8 @@ ignore = [
148140

149141
[tool.ruff.lint.per-file-ignores]
150142
"**/*.md" = [
151-
"F821", # https://docs.astral.sh/ruff/rules/undefined-name/
143+
"F821", # https://docs.astral.sh/ruff/rules/undefined-name/
144+
"FBT003", # https://docs.astral.sh/ruff/rules/boolean-positional-value-in-call/
152145
]
153146
"!specs/**" = [
154147
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg

pysetup/md_to_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _process_table(self, table: Table) -> None:
307307
# It is a constant variable or a preset_dep_constant_vars
308308
else:
309309
if name == "ENDIANNESS":
310-
# Deal with mypy Literal typing check
310+
# Deal with Literal typing check
311311
value_def = _parse_value(name, value, type_hint="Final")
312312
if any(k in value for k in self.preset) or any(
313313
k in value for k in self.spec["preset_dep_constant_vars"]

pysetup/spec_builders/altair.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def sundry_functions(cls) -> str:
2727
return """
2828
def compute_merkle_proof(object: SSZObject,
2929
index: GeneralizedIndex) -> list[Bytes32]:
30-
return build_proof(object, index)"""
30+
return [Bytes32(chunk) for chunk in build_proof(object, index)]"""
3131

3232
@classmethod
3333
def hardcoded_ssz_dep_constants(cls) -> dict[str, str]:
@@ -61,6 +61,7 @@ def deprecate_functions(cls) -> set[str]:
6161
"get_matching_head_attestations",
6262
"get_matching_source_attestations",
6363
"get_matching_target_attestations",
64+
"get_pending_attesting_indices",
6465
"get_proposer_reward",
6566
"get_source_deltas",
6667
"get_target_deltas",

pysetup/spec_builders/bellatrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def sundry_functions(cls) -> str:
2121
ExecutionState = Any
2222
2323
24-
def get_pow_block(hash: Bytes32) -> Optional[PowBlock]:
25-
return PowBlock(block_hash=hash, parent_hash=Bytes32(), total_difficulty=Uint256(0))
24+
def get_pow_block(hash: Hash32) -> Optional[PowBlock]:
25+
return PowBlock(block_hash=hash, parent_hash=Hash32(), total_difficulty=Uint256(0))
2626
2727
2828
def validator_is_connected(validator_index: ValidatorIndex) -> bool:

pysetup/spec_builders/capella.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,21 @@ def deprecate_containers(cls) -> set[str]:
2424
"HistoricalBatch",
2525
}
2626

27+
@classmethod
28+
def deprecate_constants(cls) -> set[str]:
29+
return {
30+
"SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY",
31+
}
32+
2733
@classmethod
2834
def deprecate_functions(cls) -> set[str]:
2935
return {
3036
"get_terminal_pow_block",
37+
"is_execution_block",
3138
"is_execution_enabled",
3239
"is_merge_transition_block",
3340
"is_merge_transition_complete",
41+
"is_optimistic_candidate_block",
3442
"process_historical_roots_update",
3543
"upgrade_to_bellatrix",
3644
"validate_merge_block",

pysetup/spec_builders/eip8148.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ def imports(cls, preset_name: str):
1111
return f"""
1212
from eth_consensus_specs.heze import {preset_name} as heze
1313
"""
14+
15+
@classmethod
16+
def deprecate_functions(cls) -> set[str]:
17+
return {
18+
"upgrade_to_heze",
19+
}

0 commit comments

Comments
 (0)