Skip to content

refactor: refer to ASM programs by spec ID in runner config - #298

Merged
prajwolrg merged 2 commits into
mainfrom
refactor/genesis-spec-id
Oct 1, 2026
Merged

prajwolrg merged 2 commits into
mainfrom
refactor/genesis-spec-id

Conversation

@prajwolrg

Copy link
Copy Markdown
Collaborator

Description

The runner config repeated each ASM predicate up to three times: in [[execution.targets]], as execution.genesis_predicate, and in each [[orchestrator.asm_artifacts]] entry. An SP1 Groth16 predicate is about 1 KB of hex, so each copy was a chance to paste the wrong key.

The execution registry already maps each spec ID to exactly one predicate, so a spec ID is enough to refer to a program. This PR keeps the predicate only in [[execution.targets]]. Everything else now refers to programs by spec ID:

[execution]
genesis_spec_id = 0

[[execution.targets]]
predicate = "Sp1Groth16:…"
spec_id = 0

[[orchestrator.asm_artifacts]]
spec_id = 0
[orchestrator.asm_artifacts.source]
kind = "sp1"
elf_path = "/elfs/asm/asm.elf"

The ELF is still checked at boot. The loader derives the predicate from the ELF or signing key and compares it with the predicate of the matching target, so a wrong artifact still fails startup.

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor

Notes to Reviewers

This changes the config format. Any deployed runner config needs genesis_predicate replaced with genesis_spec_id, and predicate replaced with spec_id in each asm_artifacts entry.

genesis_spec_id stays a separate field on purpose. Once an upgrade adds a second target, nothing else says which spec the chain started under.

Validated with cargo clippy --all-features, unit tests for the worker, prover-worker and runner crates, and the fn_asm_block_test, fn_asm_proof_test and fn_asm_proof_follower_sync_test functional tests on the native backend.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

None.

🤖 Generated with Claude Code

The genesis predicate duplicated a key already listed in
[[execution.targets]], and an SP1 Groth16 key is about 1 KB of hex.
Spec IDs map one-to-one to predicates in the registry, so the spec ID
alone identifies the genesis program. It still has to be named
explicitly: after an upgrade the targets list holds several specs and
nothing else says which one the chain started under.
@prajwolrg
prajwolrg requested a review from irnb September 30, 2026 13:53
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Commit: e672f47
Baseline: #296 (af03330)
SP1 Execution Results

program cycles gas Δ cycles Δ gas
asm-stf 177,777,373 175,551,011 0 (0.0%) 0 (0.0%)
moho 5,193,682 5,504,558 0 (0.0%) 0 (0.0%)

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bin/asm-runner/src/bootstrap.rs 91.66% 1 Missing ⚠️
Files with missing lines Coverage Δ
bin/asm-runner/src/config.rs 100.00% <ø> (ø)
crates/extensions/prover/worker/src/backend/mod.rs 81.81% <100.00%> (+0.56%) ⬆️
crates/extensions/prover/worker/src/config.rs 89.83% <ø> (ø)
crates/worker/src/registry.rs 98.07% <100.00%> (+0.02%) ⬆️
bin/asm-runner/src/bootstrap.rs 97.91% <91.66%> (+0.02%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The loader already derives the predicate from the ELF or signing key.
The configured copy only named which execution target the artifact
belongs to and gave bind_expected something to compare against. The
spec ID does the first job, and the target's predicate does the second,
so a wrong ELF still fails boot without the key being pasted twice.
@prajwolrg
prajwolrg force-pushed the refactor/genesis-spec-id branch from 9981c99 to 64e37a9 Compare September 30, 2026 16:14
@prajwolrg
prajwolrg marked this pull request as ready for review October 1, 2026 01:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T01:46:17.213854Z 64e37a9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

🔒 AI Security Review (claude-opus-5-5)

✅ No security issues found.

@prajwolrg
prajwolrg added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit 22030b8 Oct 1, 2026
26 checks passed
@prajwolrg
prajwolrg deleted the refactor/genesis-spec-id branch October 1, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants