Skip to content

Commit 579bbf2

Browse files
unnawuttcoratgerfselmo
authored
framework: ability to use test or prod signature scheme in tests (#230)
* feat: specifically signature scheme switching * fix: linting * chore: simplify filler * fix: don't preset current signature scheme * fix: minor polish * fix: linting * feat: use env var instead of cli flag * refactor: move signature_scheme inside keys module * refactor: more pydantic signature_scheme field * refactor remove solo key manger from verify_signatures suite * refactor: simplify keys module * refactor: use LEAN_ENV var instead * refactor: rename XMSS_CONFIG to ENV_CONFIG * fix: linting * rename XMSS_SIGNATURE_SCHEME to ENV_SIGNATURE_SCHEME * refactor: move custom key manager logic in ForkChoiceTest into the get_shared_key_manager() * refactor: rename ENV_ prefix to TARGET_ * feat: default to LEAN_ENV=test for testing * fix: linting * feat: downloadable test keys * feat: enable prod test filling on main branch * chore: more verbose keygen logging * fix: percentage calc * feat: fill prod vectors on main push * refactor: cleaner LEAN_ENV retrieval * refactor: remove os.environ.get from key manager * refactor: remove keygen logs * fix: linting * Update packages/testing/src/consensus_testing/test_types/genesis.py Co-authored-by: Thomas Coratger <[email protected]> * fix: remove explicit variable name from code comment * Update packages/testing/src/framework/test_fixtures/base.py Co-authored-by: felipe <[email protected]> * fix: remove LEAN_ENV default from conftest * refactor: consolidate LEAN_ENV parsing to lean_spec.config * fix: bring back LEAN_ENV default in conftest.py * feat(fill): set sig scheme via CLI flag for filler, default to test * feat: use leanEthereum/leansig-test-keys * feat: download test keys before filling * fix: linting * fix: rebase --------- Co-authored-by: Thomas Coratger <[email protected]> Co-authored-by: felipe <[email protected]>
1 parent 2937bcf commit 579bbf2

File tree

31 files changed

+443
-186
lines changed

31 files changed

+443
-186
lines changed

.github/workflows/prod-vectors.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Production Test Vectors
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
fill-prod-vectors:
12+
name: Fill production test fixtures - Python 3.14
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout leanSpec
16+
uses: actions/checkout@v4
17+
18+
- name: Install uv and Python 3.14
19+
uses: astral-sh/setup-uv@v4
20+
with:
21+
enable-cache: true
22+
cache-dependency-glob: "pyproject.toml"
23+
python-version: "3.14"
24+
25+
- name: Sync dependencies
26+
run: uv sync --no-progress
27+
28+
- name: Get production keys URL hash
29+
id: prod-keys-url
30+
run: |
31+
URL=$(uv run python -c "from consensus_testing.keys import KEY_DOWNLOAD_URLS; print(KEY_DOWNLOAD_URLS['prod'])")
32+
HASH=$(echo -n "$URL" | sha256sum | awk '{print $1}')
33+
echo "hash=$HASH" >> $GITHUB_OUTPUT
34+
35+
- name: Cache production keys
36+
id: cache-prod-keys
37+
uses: actions/cache@v4
38+
with:
39+
path: packages/testing/src/consensus_testing/test_keys/prod_scheme
40+
key: prod-keys-${{ steps.prod-keys-url.outputs.hash }}
41+
42+
- name: Download production keys
43+
if: steps.cache-prod-keys.outputs.cache-hit != 'true'
44+
run: uv run python -m consensus_testing.keys --download --scheme prod
45+
46+
- name: Fill production test fixtures
47+
env:
48+
LEAN_ENV: prod
49+
run: uv run fill --fork=Devnet --clean -n auto
50+
51+
- name: Create fixtures archive
52+
run: tar -czf fixtures-prod-scheme.tar.gz fixtures/
53+
54+
- name: Upload production test fixtures
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: fixtures-prod-scheme
58+
path: fixtures-prod-scheme.tar.gz
59+
if-no-files-found: error

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,6 @@ site/
156156

157157
# Ruff
158158
.ruff_cache/
159+
160+
# PQ test keys
161+
packages/testing/src/consensus_testing/test_keys/prod_scheme/

0 commit comments

Comments
 (0)