You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(lee): reject duplicate witness keys in public and private transactions #893
A transaction may list the same public key more than once in its witness set. Nothing rejects it, and the nonce is then advanced once per entry.
authenticate_public_transaction_signers (lee/state_machine/src/validated_state_diff/mod.rs:755-785) checks only that message.nonces.len() equals the witness count, verifies each signature independently, and zips signers against nonces comparing each pair to the unmodified pre-state. So a duplicate signer [A, A] with nonces [n, n] validates because they both become [n+1, n+1].
The private path (from_privacy_preserving_transaction, mod.rs:618-640) does the same. Its n_unique guards cover public_account_ids, nullifiers and commitments, not the witness set.
apply_state_diff (lee/state_machine/src/state/mod.rs:253-257) iterates signer_account_ids as a Vec and increments A's nonce twice.
Stateless admission (lez/common/src/transaction.rs, transaction_stateless_check) verifies signatures only, so the tx reaches the mempool.
Impact
Not exploitable against others: only the key holder can produce the duplicate signature, program authorization is set-based, fee authorization scans for any valid payer signature, and nothing derives value or ordering from the nonce. Deterministic across nodes, so no fork risk.
The effect is a self-inflicted nonce burn: the signer's next tx (expecting n+1, chain at n+2) fails strict equality and is dropped. With #880 that dropped tx also occupies its signer's mempool lane head for a turn.
Fix
Reject duplicate witness keys in both authentication paths, reusing n_unique over signer_account_ids, with a test per path mirroring account_id_list_cant_have_duplicates (lee/state_machine/src/public_transaction/transaction.rs:166). Optionally reject at transaction_stateless_check too, so the tx never takes a mempool slot.
Warning
The fix would be a block-validity rule change: a block containing such a tx is valid today and becomes invalid after.
Activity