Skip to content

vote: Use wrapping pow with min lockout history in lockout() calculation#92

Merged
jstarry merged 1 commit intoanza-xyz:masterfrom
mjain-jump:master
Mar 31, 2025
Merged

vote: Use wrapping pow with min lockout history in lockout() calculation#92
jstarry merged 1 commit intoanza-xyz:masterfrom
mjain-jump:master

Conversation

@mjain-jump
Copy link
Copy Markdown
Contributor

The default behavior in the vote lockouts calculation is to panic on larger confirmation counts. This case never gets hit in production / mainnet, but our fuzzers often hit this case when fuzzing at the instruction / transaction level and providing arbitrary confirmation counts within the account data. Since this case is incredibly difficult to prevent in the fuzzer's mutations, we choose to handle this behavior more gracefully by avoiding the panic due to overflow.

@mjain-jump mjain-jump changed the title Use wrapping pow with min lockout history in lockout() calculation vote: Use wrapping pow with min lockout history in lockout() calculation Mar 26, 2025
@jstarry
Copy link
Copy Markdown
Contributor

jstarry commented Mar 27, 2025

This seems reasonable but I have a slight preference to saturating_pow because then lockouts from invalid conf counts would be a bit more apparent vs hidden with your current approach, @AshwinSekar thoughts?

@mjain-jump
Copy link
Copy Markdown
Contributor Author

This seems reasonable but I have a slight preference to saturating_pow because then lockouts from invalid conf counts would be a bit more apparent vs hidden with your current approach, @AshwinSekar thoughts?

How about standard pow() with the min() call? With saturating operations you still run the risk of hitting overflow where the caller doesn't handle the return value properly, and it makes sense to constrain it to the maximum expected return value.

Copy link
Copy Markdown
Contributor

@AshwinSekar AshwinSekar left a comment

Choose a reason for hiding this comment

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

I'm fine with the min approach

@jstarry jstarry merged commit 53872f3 into anza-xyz:master Mar 31, 2025
20 checks passed
grod220 added a commit that referenced this pull request Mar 9, 2026
* Add support for PodList

* Review updates

* Fix test + add more specific doc string

* Review updates

* ListView entrypoint pattern

* Add sizing methods to trait

* Review updates
grod220 added a commit that referenced this pull request Mar 16, 2026
* Add support for PodList

* Review updates

* Fix test + add more specific doc string

* Review updates

* ListView entrypoint pattern

* Add sizing methods to trait

* Review updates
grod220 added a commit that referenced this pull request Mar 18, 2026
* Add support for PodList

* Review updates

* Fix test + add more specific doc string

* Review updates

* ListView entrypoint pattern

* Add sizing methods to trait

* Review updates
grod220 added a commit that referenced this pull request Mar 19, 2026
* Add support for PodList

* Review updates

* Fix test + add more specific doc string

* Review updates

* ListView entrypoint pattern

* Add sizing methods to trait

* Review updates
grod220 added a commit that referenced this pull request Mar 19, 2026
* Add support for PodList

* Review updates

* Fix test + add more specific doc string

* Review updates

* ListView entrypoint pattern

* Add sizing methods to trait

* Review updates
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.

3 participants