Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/huge-voting-detection-after-restart #500

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Ivan-Feofanov
Copy link
Contributor

The bot detected the difference in votes based on the previous state of the block stored in memory. If the bot was restarted and the current block is the very first one, detection did not occur.

@Ivan-Feofanov Ivan-Feofanov requested a review from a team as a code owner March 21, 2024 15:40
@@ -127,25 +126,32 @@ async function handleActiveVotes(blockEvent: BlockEvent, findings: Finding[]) {
}

async function handleHugeVotes(blockEvent: BlockEvent, findings: Finding[]) {
const prevActiveVotes = await getActiveVotes(blockEvent.blockNumber - 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to reduce call count?

activeVotes = await getActiveVotes(currentBlock);

// Get previous block votes to correctly compare with the current one after the restart.
prevBlockVotes = await getActiveVotes(currentBlock - 1);
Copy link
Contributor

@BATMAH69 BATMAH69 Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skip request if no active votes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants