#37768 [SC-Insight] Missing Event Emission when proposer are added prevents safe retrieval of index for subsequent operations
Submitted on Dec 15th 2024 at 11:28:16 UTC by @danvinci_20 for Audit Comp | Folks: Liquid Staking
Report ID: #37768
Report Type: Smart Contract
Report severity: Insight
Target: https://github.com/Folks-Finance/algo-liquid-staking-contracts/blob/8bd890fde7981335e9b042a99db432e327681e1a/contracts/xalgo/consensus_v2.py
Impacts:
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Design Flaw
Description
Brief/Intro
It's a common design pattern to emit event/log when crucial operation are carried out onchain to be used by offchain systems, adding a proposer to the to the proposers box is an important onchain action that events/log are to be emitted when a proposer is successfully added, but this was not implemented in the current version of the consensus_v2.py
Vulnerability Details
The add_proposer
method does not return or emit event when a proposer is added this can lead to lack of transparency or easy retrievability of the proposer index for subsequent operations. This will lead to lack of usability and introduce vulnerability in dependent workflow like
Adding of proposer admin
Offline and Online Registration
Subscribe xgov and unsubscribe xgov This is the current implementation of the add_proposer function
Impact Details
The impact caused by this are
It leads to disruption of workflow, The absence of an event or explicit return value providing the proposer's index makes it challenging for users to correctly interact with functions that require the index as a parameter.
Increased computational complexity and taking of unnecessary risk, for user must guess or calculate the proposer's index manually by iterating through the stored data (ProposersBox), which is computationally expensive.
Proof of Concept
Proof of Concept
This issue can be resolved by:
The system should implement mechanism to retrieve the proposer index given a particular address
The protocol should emit an event when proposer is added