genesis-constants
Skill458 starsChanged 2 months agoApache-2.0View on GitHub
Regenerate the canonical genesis constants (GENESIS_NULLIFIER_TREE_ROOT, GENESIS_BLOCK_HEADER_HASH, GENESIS_ARCHIVE_ROOT), the C++ genesis seed vector, and the L1 checkpoint fixtures. Use when a protocol contract, the Noir compiler, or the AVM transpiler changed and a genesis root assertion fails, on a request to "regenerate the genesis constants/roots", or when the precommit reminder about rotating a protocol class id fires.
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Run the single source-of-truth script:
- Distinctive: line 62
After regenerating, the tests that assert these values are:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Genesis constants
A production network's genesis world state seeds the protocol contracts' registration nullifiers. Those are derived from the protocol contract class ids, so anything that rotates a class id — a protocol contract source change, a compiler bump, a transpiler change — moves the genesis roots with it.
Run the single source-of-truth script:
noir-projects/fnd/scripts/regenerate_genesis_constants.sh --fixturesIt measures the canonical genesis from a real ephemeral world state, rewrites every pinned site, re-runs the constants generators in the right order, verifies the derived outputs picked up the new values, and stages the result. It does not commit.
| flag | effect |
| (none) | rewrites the constants and the C++ seed vector; reports the L1 fixtures as outstanding |
--fixtures | also regenerates the six L1 checkpoint fixtures. Needs anvil on PATH; takes a few minutes |
--check | measures and compares only, writes nothing, exits non-zero if anything is stale |
Prerequisites
The measurement runs through the built client, so the tree must be built first:
make labs-yarn-projectThe script refuses to run against a build older than the protocol contract sources, rather than reporting stale numbers. It is fail-fast throughout: a missing dependency, a failed measurement, or a replacement that did not match is a hard error, because a half-applied regeneration leaves constants that disagree with each other.
What it rewrites
noir-projects/fnd/noir-protocol-circuits/crates/types/src/constants.nr— the threeGENESIS_*constants. Everything else derives from here:aztec_constants.hpp,ConstantsGen.sol, labs'constants.gen.ts.native-packages/wsdb/cpp/src/world_state/genesis_protocol_nullifiers.hpp— the seed vector the C++ world-state test builds its genesis from.l1-contracts/test/fixtures/{empty,mixed,single_tx}_checkpoint_{1,2}.json— with--fixtures. All six move: checkpoint 1 of each family starts from the genesis archive, and checkpoint 2 chains off checkpoint 1.
Their producer picks a wall-clock timestamp and a random coinbase and fee recipient per run, so --fixtures
rewrites all six every time, whether or not the genesis actually moved. Only lastArchiveRoot is stable, which is
what --check keys on. Do not pass --fixtures unless the roots really moved — otherwise you commit pure churn.
What it deliberately does NOT rewrite
mainnet_compatibility.test.ts and testnet_compatibility.test.ts in labs/yarn-project/aztec/src/ pin what a
live network was actually deployed with — its VK tree root, protocol contracts hash and genesis archive root.
A class id rotation will make those fail too. That is correct and expected: they change only at a governance
upgrade. Never "fix" them by pasting in the new values; that silently claims the deployed network moved.
Verifying
After regenerating, the tests that assert these values are:
nargo test --package types hash_of_genesis(Noir)world_state_tests --gtest_filter='*GetInitialTreeInfoForAllTrees*'(C++)world-state/src/testing.test.ts(labs — this is the one that compares a live genesis against the pinnedGENESIS_ARCHIVE_ROOT, i.e. the real drift detector)forge test --match-contract 'CheckpointPreflight|Rollup'(L1, against the regenerated fixtures)
Note that protocol-contracts/src/genesis_data.test.ts does not detect drift: protocol_contract_data.ts is
generated at build time from the same artifacts it recomputes from, so both sides move together.
Why this is breaking
The genesis archive root is what a rollup stores in archives[0] at deployment, and that slot is immutable. New
roots therefore apply only to a network initialized from the new genesis; already-deployed networks keep theirs.
In this repository22 other files it gives its agents.
- avm-transpiler/CLAUDE.mdCLAUDE.md
- barretenberg/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- acir-formal-proofsSkill
- adding-benchmarksSkill
- bench-regressionSkill
- capture-app-flowSkill
- chonk-inputsSkill
- ci-logsSkill
- create-issueSkill
- cycleSkill
- fixSkill
- merge-train-infraSkill
- merge-trainsSkill
- noir-sync-updateSkill
- prep-cycleSkill
- release-docsSkill
- release-network-docsSkill
- update-doc-referencesSkill
- updating-changelogSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

