Skip to content

Commit b816515

Browse files
committed
feat(fill): set sig scheme via CLI flag for filler, default to test
1 parent f130fac commit b816515

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

packages/testing/src/consensus_testing/test_types/genesis.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from lean_spec.subspecs.containers.state import State, Validators
66
from lean_spec.subspecs.containers.validator import Validator
7-
from lean_spec.types import Uint64
7+
from lean_spec.types import Bytes52, Uint64
88

99
from ..keys import get_shared_key_manager
1010

@@ -35,7 +35,10 @@ def generate_pre_state(**kwargs: Any) -> State:
3535

3636
validators = Validators(
3737
data=[
38-
Validator(pubkey=key_manager[Uint64(i)].public.encode_bytes(), index=Uint64(i))
38+
Validator(
39+
pubkey=Bytes52(key_manager[Uint64(i)].public.encode_bytes()),
40+
index=Uint64(i),
41+
)
3942
for i in range(num_validators)
4043
]
4144
)

packages/testing/src/framework/cli/fill.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Unified CLI command for generating Ethereum test fixtures across all layers."""
22

3+
import os
34
import sys
45
from pathlib import Path
56
from typing import Sequence
@@ -37,6 +38,12 @@
3738
is_flag=True,
3839
help="Clean output directory before generating",
3940
)
41+
@click.option(
42+
"--scheme",
43+
type=click.Choice(["test", "prod"], case_sensitive=False),
44+
default="test",
45+
help="XMSS signature scheme (default: test)",
46+
)
4047
@click.pass_context
4148
def fill(
4249
ctx: click.Context,
@@ -45,6 +52,7 @@ def fill(
4552
fork: str,
4653
layer: str,
4754
clean: bool,
55+
scheme: str,
4856
) -> None:
4957
"""
5058
Generate Ethereum test fixtures from test specifications.
@@ -61,7 +69,15 @@ def fill(
6169
6270
# Default layer is consensus
6371
fill tests/spec_tests/devnet --fork=Devnet --clean -v
72+
73+
# Use specific XMSS scheme (overrides LEAN_ENV env var)
74+
fill --fork=Devnet --scheme=prod --clean -v
6475
"""
76+
# Note: It's important to never import any leanSpec modules in this file, so the
77+
# `LEAN_ENV` variable can be set before the config loads its value from the
78+
# environment.
79+
os.environ["LEAN_ENV"] = scheme.lower()
80+
6581
config_path = Path(__file__).parent / "pytest_ini_files" / "pytest-fill.ini"
6682
# Find project root by looking for pyproject.toml with [tool.uv.workspace]
6783
project_root = Path.cwd()

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
if "LEAN_ENV" not in os.environ:
88
os.environ["LEAN_ENV"] = "test"
99

10-
import lean_spec.subspecs.xmss as xmss
11-
1210
# Create a profile named "no_deadline" with deadline disabled.
1311
settings.register_profile("no_deadline", deadline=None)
1412
settings.load_profile("no_deadline")

0 commit comments

Comments
 (0)