Skip to content

fix(precompiles): gate PQ verifier on Zero6 - #389

Open
kriss39 wants to merge 2 commits into
circlefin:mainfrom
kriss39:fix/pq-zero6-gating
Open

kriss39 wants to merge 2 commits into
circlefin:mainfrom
kriss39:fix/pq-zero6-gating

Conversation

@kriss39

@kriss39 kriss39 commented Sep 12, 2026

Copy link
Copy Markdown

Summary

  • register the PQ verifier precompile only when Zero6 is active
  • cover both pre-Zero6 and post-Zero6 availability

Testing

  • cargo fmt --check
  • cargo test -p arc-precompiles precompile_provider

Fixes #293

@kriss39

kriss39 commented Sep 27, 2026

Copy link
Copy Markdown
Author

@ZhiyuCircle gentle ping on this one when you have time.

@osr21

osr21 commented Oct 29, 2026

Copy link
Copy Markdown

One additional regression would help verify the fork wiring, not just the precompile-map branch: the current tests construct ArcHardforkFlags directly, so they do not show that block execution derives and passes the correct flags from each block's chain-spec activation.

Because precompile registration is selected per block, please consider testing a pre-Zero6 block and the first Zero6-active block using chain-spec-derived activation (or the closest integration-level fixture). Zero6 is active from genesis on mainnet, but activated later on testnet and devnet; historical execution of pre-activation blocks must retain the earlier precompile set. This also guards against a future change that accidentally makes PQ registration unconditional.

@kriss39

kriss39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Author

Thanks, good point. Added factory_registers_pq_precompile_from_block_derived_zero6 in ba2a57b: it builds a localdev chain spec with Zero6 at block 10 and creates the EVM through ArcEvmFactory (both create_evm and create_evm_with_inspector), so the flags come from get_hardfork_flags on the block env. PQ is absent at block 9 and present at block 10. With the gate reverted the test fails at block 9.

@kriss39
kriss39 force-pushed the fix/pq-zero6-gating branch from 24e6932 to ba2a57b Compare November 3, 2026 18:00
@osr21

osr21 commented Nov 3, 2026

Copy link
Copy Markdown

Thanks, this closes the key wiring gap: the test derives Zero6 from the block environment and checks both factory construction paths on either side of the activation boundary. One optional follow-up, if production chain-spec fixtures are readily available, would be to assert the configured boundary for each network (including mainnet’s genesis activation and pre-activation historical blocks on networks where it activates later). That would protect the network schedules as well as the factory wiring; if those schedules are already covered elsewhere, the localdev block-9/block-10 regression looks well scoped for this PR.

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.

pq-precompile doc claims "Zero6-gated" but hardfork_flags is never read in the dispatch or execution path

2 participants