SNARKeling Treasure Hunt

First Flight #59
Beginner FriendlyGameFiFoundry
100 EXP
Submission Details
Impact: low
Likelihood: high

L-02 Duplicate Allowed-Hash Entry Reduces Circuit Uniqueness

Author Revealed upon completion

Description

The Noir circuit defines ALLOWED_TREASURE_HASHES as an array of 10 elements, but the final two entries are identical. As a result, the circuit contains only 9 unique allowed treasure hashes.

This weakens the clarity of the intended treasure inventory and creates ambiguity between “10 slots” and “10 unique treasures.”

Risk

This issue does not by itself demonstrate a direct exploit, but it creates correctness and maintenance risk:

  • reviewers may incorrectly assume there are 10 unique treasure hashes

  • operators may misunderstand the actual treasure inventory

  • future changes become riskier because the source does not clearly express the intended unique set

Proof of Concept

The duplicated entries are visible directly in the circuit:

global ALLOWED_TREASURE_HASHES: [Field; 10] = [
...,
-961435057317293580094826482786572873533235701183329831124091847635547871092,
-961435057317293580094826482786572873533235701183329831124091847635547871092
];

Because is_allowed() only checks whether a hash appears anywhere in the list, the duplicate final entry does not add a new claimable treasure. It only repeats an already-allowed value.

Recommended Mitigation

Replace the duplicate entry with the intended unique treasure hash and regenerate any dependent artifacts.

diff --git a/circuits/src/main.nr b/circuits/src/main.nr
--- a/circuits/src/main.nr
+++ b/circuits/src/main.nr
@@ -61,6 +61,6 @@ global ALLOWED_TREASURE_HASHES: [Field; 10] = [
-5697637861416433807484703347699404695743570043365849280798663758395067508,
-2009295789879562882359281321158573810642695913475210803991480097462832104806,
8931814952839857299896840311953754931787080333405300398787637512717059406908,
- -961435057317293580094826482786572873533235701183329831124091847635547871092,
+ -4417726114039171734934559783368726413190541565291523767661452385022043124552,
-961435057317293580094826482786572873533235701183329831124091847635547871092
];

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!