Open sherlock-admin2 opened 3 months ago
2 comment(s) were left on this issue during the judging contest.
0xmystery commented:
Function loop
continue
s even after error when it should likelybreak
0xmystery commented:
Errors in
RemoveStakes
/RemoveDelegateStakes
are silently handled inEndBlocker
The protocol team fixed this issue in the following PRs/commits: https://github.com/allora-network/allora-chain/pull/437
defsec
Medium
Incomplete Topic Processing Due to Continuous Retry on Pagination Error
Summary
The
SafeApplyFuncOnAllActiveEpochEndingTopics
function continues to the next iteration when failing to get IDs of active topics, potentially causing an infinite loop or skipping all topics.Vulnerability Detail
In the current implementation, when
k.GetIdsOfActiveTopics()
fails, the function logs a warning and continues to the next iteration of the main loop. This behavior can lead to repeated failures and potentially skip processing all topics.Description: The problematic code section is:
This
continue
statement causes the function to retry getting the same page of topic IDs indefinitely if there's a persistent error, without moving to the next page or terminating the loop.Impact
Code Snippet
topic_rewards.go#L75
Tool used
Manual Review
Recommendation
Change the
continue
statement tobreak
when failing to get IDs of active topics: