agentleFS
AztecProtocolAztecProtocol/aztec-packages/.claude/skills/genesis-constants/SKILL.md

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
  1. Distinctive:

    Run the single source-of-truth script:

    line 12
  2. Distinctive:

    After regenerating, the tests that assert these values are:

    line 62

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 --fixtures

It 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.

flageffect
(none)rewrites the constants and the C++ seed vector; reports the L1 fixtures as outstanding
--fixturesalso regenerates the six L1 checkpoint fixtures. Needs anvil on PATH; takes a few minutes
--checkmeasures 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-project

The 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

  1. noir-projects/fnd/noir-protocol-circuits/crates/types/src/constants.nr — the three GENESIS_* constants. Everything else derives from here: aztec_constants.hpp, ConstantsGen.sol, labs' constants.gen.ts.
  2. native-packages/wsdb/cpp/src/world_state/genesis_protocol_nullifiers.hpp — the seed vector the C++ world-state test builds its genesis from.
  3. 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 pinned GENESIS_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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.