Repository navigation
test(contracts): cover the registry double-init guard - #285
Merged
lolaaimar merged 1 commit intoNov 25, 2026
Merged
Conversation
nicolasLuduena
force-pushed
the
fix/240-registry-double-init-test
branch
from
November 25, 2026 02:11
9c85d71 to
e472e40
Compare
This was referenced Nov 25, 2026
lolaaimar
force-pushed
the
fix/240-registry-double-init-test
branch
from
November 25, 2026 19:49
e472e40 to
6854a49
Compare
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
lolaaimar
force-pushed
the
fix/240-registry-double-init-test
branch
from
November 25, 2026 20:47
6854a49 to
53781a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #240. Stacked on #294 (stack: #291 → #292 → #293 → #294 → #285); it shares no files with them.
No test reached the
Registry already initializedassert inattestor_registry.compact, so a change that dropped it would pass CI.initRegistrywrites the sealedkeysledger, so only a constructor can call it. A new mock calls it twice there:registry.test.tsdeploys that mock with three distinct keys and expects the deploy to fail withRegistry already initialized.package.json, packages/contracts/package.json compact, compact:no-zk MockAttestation → artifacts/mock_attestation MockAttestationBytes → artifacts/mock_attestation_bytes MockAddressHash → artifacts/mock_address_hash + MockRegistryDoubleInit → artifacts/mock_registry_double_initThe
registry.test.tsheader used to point atsealed-init.test.ts, which doesn't exist; it now lists the double-init guard among its own tests. AGENTS.md's Testing section names the new mock. The compiler stays at+0.36.1andcompact-runtimeat0.21.0.The header's other guard, the compile error you get if you export
initRegistry, still has no test. That needs a test that runs the compiler, and #240 doesn't ask for one.Evidence
Before: with the assert commented out in
attestor_registry.compact, every registry test passes, so nothing guarded it.After: the same mutation fails the new test, and restoring the assert makes all 10 registry tests pass:
With the full stack below it, all four mocks compile with
npm run compact:no-zk. Build,npm run typesandnpm run check(Biome andcompact format -c) pass. The full suite passes: 775 passed, 4 skipped (the opt-in live checks).No verification skill in this repo.
Merge Danger
Door: two-way
Blast Radius: none
A test, a test-only mock and the scripts that compile it. Nothing published changes, so there is no changeset.
npm testcompiles one more mock, which adds a few seconds.