#37791 [SC - Insight] consensus contract distributes algo for proposers that are offline that cause
#37791 [SC-Insight] Consensus contract distributes Algo for proposers that are offline that cause losing of reward
Submitted on Dec 16th 2024 at 07:44:30 UTC by @perseverance for Audit Comp | Folks: Liquid Staking
Report ID: #37791
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:
Contract fails to deliver promised returns, but doesn't lose value
Description
Description
Brief/Intro
When users mint XALGO, they can use "immediate_mint" or "delayed_mint" by sending ALGO to the consensus contract. Then the consensus will distribute the ALGO to all Proposers almost evenly.
The register_admin or proposer_admin can register the proposer to be offline by calling "register_offline" function.
The vulnerability
Vulnerability Details
When distributing the ALGO, the consensus contract does not check if the proposer is offline, but still distributes the ALGO evenly. So if in case, that the register_admin or proposer_admin register the proposer to be offline, then the proposer status is offline, then the proposer will not earn any reward. By still distributing the ALGO to offline proposers, this will cause losing of the reward, because the user's capital is not used for active proposers.
So if the offline period and number of offline proposers is high enough, then this will significantly impact users' interest.
Impacts
About the severity assessment
Bug Severity: Low
Impact category:
Contract fails to deliver promised returns, but doesn't lose value
Likelyhood: Very Likely
Recommendation: Implement the status tracking of proposer status and prioritize ALGO distribution for online proposers to maximize the reward earning.
Proof of Concept
Proof of concept
Steps to reproduce the bug:
Step 1: The register_admin or proposer_admin can register the proposer to be offline by calling "register_offline" function.
Step 2: User call "immediate_mint" to mint the XALGO. The ALGO received is distributed for offline proposers.
Test code:
I modify the test case "succeeds and splits between proposers" in algo-liquid-staking-contracts\test\xAlgoConsensusV2.test.ts and add the code to register_offline
So the full test case. Just copy the test case to file: algo-liquid-staking-contracts\test\xAlgoConsensusV2.test.ts
Run test case:
Test results:
Explanation:
The test code first register proposer_0 offline.
But when user call "immediate_mint" the contract still distributes the ALGO to node proposer_0.
Full log for reference:
Last updated
Was this helpful?