The setMarketParameters function in the contract lacks a duplicate check, allowing identical market parameter entries to be added multiple times to the marketParameters array. This can lead to inefficiencies, increased gas costs, and potential errors if the contract relies on unique entries. Implementing a duplicate check within the function would prevent redundant entries, enhancing contract reliability and data integrity.
Here is a reference to the code:
Issue in Code: The function currently appends each set of parameters to marketParameters without checking for existing duplicates.
Cause: The absence of a check that verifies if a similar set of parameters has already been added to marketParameters.
How the Vulnerability Manifests: Repeated calls to setMarketParameters with the same parameters will insert identical entries into marketParameters. This could occur if an external script or contract unintentionally calls this function multiple times with the same parameters.
The setMarketParameters function currently lacks a check to prevent duplicate entries in the marketParameters array. As a result, identical sets of market parameters can be added multiple times. This redundancy can lead to inefficiencies, increased gas costs, and potential confusion in the contract's logic where unique entries are assumed. If other parts of the contract depend on each entry in marketParameters being distinct, duplicates could cause unintended behavior or complicate data processing.
Manual code review
Implement a duplicate check in the setMarketParameters function. Here is an example modification:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.