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

[BOOST-4785] Correctly masking leading bits for incentives in SignerValidator #138

Conversation

topocount
Copy link
Contributor

We were only shifting the trailing bits off the stack but not masking
the leading bits, leading to a situation where incentives could not be
claimed out of order.

This is fixed by and-masking against 1 after shifting the incentive index to
the least significant bit.

@topocount topocount requested a review from a team as a code owner September 30, 2024 20:41
@github-actions github-actions bot added the EVM label Sep 30, 2024
Copy link
Contributor

github-actions bot commented Sep 30, 2024

Warnings
⚠️

Are you sure you want to be submitting a change without including a changeset? If you're just changing docs or tests, you probably don't need to. See the publishing section of the README for more info.

Generated by 🚫 dangerJS against 580e13c

@@ -141,7 +142,7 @@ library IncentiveBits {
// toggle the value that was stored inline on stack with xor
let updatedStorageValue := xor(sload(storageSlot), shl(incentive, 1))
// isolate the toggled bit and see if it's been unset back to zero
let alreadySet := xor(1, shr(incentive, updatedStorageValue))
let alreadySet := xor(1, and(1, shr(incentive, updatedStorageValue)))
Copy link
Member

Choose a reason for hiding this comment

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

tfw no NAND

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Legend has it you can build a whole computer with those things

@topocount topocount force-pushed the kevin/boost-4785-fix-incentivebitssetorthrow-will-revert-leading-to-a-dos branch from a5c7f04 to 5b1c4f2 Compare October 1, 2024 19:29
@topocount topocount enabled auto-merge (rebase) October 1, 2024 19:30
We were only shifting the trailing bits off the stack but not masking
the leading bits, leading to a situation where incentives could not be
claimed out of order.

This is fixed by and-masking against 1 after shifting the incentive index to
the least significant bit.
@topocount topocount force-pushed the kevin/boost-4785-fix-incentivebitssetorthrow-will-revert-leading-to-a-dos branch from 5b1c4f2 to 580e13c Compare October 1, 2024 19:32
@topocount topocount merged commit 0dfa048 into main Oct 1, 2024
5 checks passed
@topocount topocount deleted the kevin/boost-4785-fix-incentivebitssetorthrow-will-revert-leading-to-a-dos branch October 1, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants