[pallets/weaver] Reorg re-confirmation double mint: claim keys bind submitted proof bytes, not canonical txid (latent; currently unreachable)

Component: ghost-node @ 0162da46, pallets/weaver claim key derivation.

Latency caveat (read first): this path is currently NOT reachable end to end. Round-1 finding W3 established that pull_thread is not whitelisted in validate_unsigned, so dispatch cannot reach it today. Everything below is verified at the pallet level; it becomes live the moment the unsigned gating is fixed.

Description: The replay key binds the submitted proof bytes, not the canonical txid. The same deposit re-confirmed under a second attested root (a chain reorg on the external network) therefore mints again under a different key. Varint canonicalization (atla #111 / Sands #91) does not fix this; only txid-bound keys do. This is a new variant, not a re-report of the varint findings. Killed sub-variant: non-canonical varints inside gettxproof_bytes parse identically but leave the key unchanged (32-byte truncation window), so that path is blocked.

Impact: Double mint per reorg-confirmed deposit, gated behind W3 like all weaver mint paths.

Reproduction: PoC in pallets/weaver/src/poc_r2.rs: same raw tx, synthetic fork block, 2x mint observed.

Severity: Medium (latent). Reason: requires a reorg plus a second attestation of the same deposit, plus the W3 precondition.

Recommendation: Bind claim keys to the canonical txid (recomputed from canonical encoding), never to submitted proof bytes.

Verification: VERIFIED (executed pallet-level PoC).

Thank you for your report!

A bit of context: we’re emulating the finalization delay by going back in time and reading all blocks. This is the straightforward approach for the majority of validators who will run the nodes as-is, in order to avoid soft forks.

But you’re right here - it would be good to do that just to be safe. One more thing: do you observe similar behavior on EVM chains?

Thanks for the context — emulating the finalization delay by going back in time is the pragmatic call, and I agree it keeps validators from needing to change anything.

To your question: yes, the same structural gap exists on the EVM path. The EVM claim key binds (session, slot_index, proof_index, network_id) and never the EVM transaction hash — I checked EvmThreadProof::get_unique_key, and the slot leaf itself is only hash(amount, receiver, slot_index, network_id). Dedup is purely the PulledThreads map on that key, with no per-txhash claimed set.

So same-session replay is blocked, but a reorg deeper than your delay window that produces a second attested root advances the session, and the same deposit re-confirmed there mints again under a different key. Same root cause as the UTXO report, just wearing the session number instead of the proof bytes.

The fix direction is the same one you already agreed to: bind the EVM claim key to the canonical EVM tx hash (or keep a per-txhash claimed set), so re-confirmation across sessions dedups. The W3 latency caveat from my report still applies — none of this is reachable end to end until the unsigned gating is fixed.