snapshot-labs / sx-starknet

Core smart contracts of Snapshot X for Starknet
https://docs.snapshotx.xyz
MIT License
118 stars 71 forks source link

audit: C-01 Votes Can Be Overcounted #552

Closed Orland0x closed 1 year ago

Orland0x commented 1 year ago

When making a proposal or voting on a proposal, the total voting power across multiple strategies is combined. In both cases, the strategies are deduplicated. This is achieved by incrementally constructing a bitmap with all the strategy indices. Each index should be checked against the bitmap before being included. However, the deduplication condition only checks index 0, so it is possible for any other strategy index to be repeated. This means that the voting power for all other strategies can be counted multiple times. Consider ensuring the deduplication condition covers all indices. In particular, it should assert that (bit_map & s) == 0_u256 .