Summary
Packed custom share storage uses u8 slot indexes. With 15 shares per slot, the practical maximum is 3,840 shares. Larger arrays panic through try_into().unwrap() instead of failing with a clear validation error.
Affected Code
packages/metagame/src/prize/prize_store.cairo:184
packages/metagame/src/prize/prize_store.cairo:102
packages/utilities/src/distribution/packed_shares.cairo:100
packages/utilities/src/distribution/packed_shares.cairo:107
Risk
Configuration failure and poor error behavior for oversized custom distributions.
Suggested Fix
Define a max custom share count constant and reject larger arrays before storage loops.
Suggested Tests
Add boundary tests for:
3840 shares succeeds
3841 shares reverts with a clear error
Summary
Packed custom share storage uses
u8slot indexes. With 15 shares per slot, the practical maximum is 3,840 shares. Larger arrays panic throughtry_into().unwrap()instead of failing with a clear validation error.Affected Code
packages/metagame/src/prize/prize_store.cairo:184packages/metagame/src/prize/prize_store.cairo:102packages/utilities/src/distribution/packed_shares.cairo:100packages/utilities/src/distribution/packed_shares.cairo:107Risk
Configuration failure and poor error behavior for oversized custom distributions.
Suggested Fix
Define a max custom share count constant and reject larger arrays before storage loops.
Suggested Tests
Add boundary tests for:
3840shares succeeds3841shares reverts with a clear error