The init function in the InitBipSeedGauge contract is intended to initialize the contract's state, including setting gauge points, updating BDV values, and modifying whitelist statuses. If this function can be called more than once, it could lead to unintended consequences, such as repeatedly altering state variables and emitting events that should only occur once during the contract's lifecycle.
the init function does not have proper access controls, it can be called by any user, potentially leading to the following
Duplicate updates to the milestoneStem for whitelisted tokens.
Repeated dewhitelisting of the C.CURVE_BEAN_METAPOOL token.
Multiple increments to totalDepositedBdv for certain tokens, inflating their values.
Repeatedly setting gauge-related parameters, which could disrupt the staking and reward mechanisms.
Emitting initialization events multiple times, causing confusion and potential off-chain integration issues.
manual review
Implement access controls to ensure that the init function can only be called once. This can be achieved by the following
Adding a modifier that checks a state variable, such as bool private initialized, which is set to true after the first successful execution of init.
Using the constructor for initialization logic, ensuring it's only executed once when the contract is deployed.
Implementing role-based access control (RBAC) to restrict the execution of init to only authorized addresses, such as the contract deployer or a governance mechanism.
an example implementation is
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.