Open hats-bug-reporter[bot] opened 1 month ago
To create second question with the same question_id
of the first question is impossible in RealityETH-3.0.
File: contracts\src\interaction\reality\RealityETH-3.0.sol
335: function _askQuestion(bytes32 question_id, bytes32 content_hash, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 min_bond)
336: stateNotCreated(question_id)
176: modifier stateNotCreated(bytes32 question_id) {
177: require(questions[question_id].timeout == 0, "question must not exist");
178: _;
179: }
180:
@Auditor0x18 yes, but we make sure not to ask the question if it was asked already.
It is possible for 2 markets to reference the same question. This is good as it prevents having multiple bonds and disputes on the same question. We expect this to be used quite often to create conditional markets (like "Who will win the US election?" TRUMP / HARRIS and then two condition markets on "What will be the inflation in the US in 2025?" one conditional on TRUMP the other on HARRIS, but sharing the same question for inflation).
Github username: -- Twitter username: -- Submission hash (on-chain): 0x24a915ee6bc6a35843f696d8d38ca7803e67d7499a774f800e020bff060ea789 Severity: medium
Description:
Details
The Seer Protocol's
MarketFactory
contract creates prediction markets linked to Reality.eth questions. TheaskRealityQuestion
function is responsible for generating unique question IDs and submitting these questions to Reality.eth.The current implementation of
askRealityQuestion
generates aquestion_id
based on a set of parameters that don't include any user-specific or time-specific data. This could potentially lead to question ID collisions in some cases, where two different markets end up referencing the same Reality.eth question.Code Snippet
Impact
Scenario
question_id
generation, both markets generate the samequestion_id
.Fix
Modify the
question_id
calculation to include the sender's address and the current block timestamp. This ensures uniqueness even if all other parameters are identical:Poc
This test does the following:
This test demonstrates that creating two markets with identical parameters results in the same question ID being used