-
Notifications
You must be signed in to change notification settings - Fork 305
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
component: eliminate TOCTOU bug factory #3962
Conversation
Closes #3690 This renames the previous `check_stateful` method to `check_historical`, renames `execute` to `check_and_execute`, and by default moves all of the content of `check_stateful` into `check_and_execute`, unless there's an obvious and LOCAL reason why it's safe to do so that can be written into the body of the method. IMO it's still worth it to have the method in the trait. We may wish to take advantage of it later, when we can spend more time carefully reasoning about performance. Note: we've left behind two versions of the trait, which will be reconciled in a later commit.
Turns out we still need this trait; I commented why
// These should be redundant given the choice to move these checks into check_and_execute | ||
// but are left here for reference and as a defense in depth. | ||
no_duplicate_spends(self)?; | ||
no_duplicate_votes(self)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly ambivalent on this point -- should we just delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point in favor of deleting: people (me) might be tempted to add other such checks here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, looks like our test suite is checking the exact error message, so we'll need to patch up the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't want to just change the error message, but instead modify those tests to actually have the right FMD clues, to actually exercise duplicate nullifiers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great work 🎉
This temporarily disables a few relevant tests; these should be restored later.
This renames the previous
check_stateful
method tocheck_historical
,renames
execute
tocheck_and_execute
, and by default moves all of thecontent of
check_stateful
intocheck_and_execute
, unless there's an obviousand LOCAL reason why it's safe to do so that can be written into the body of
the method.
IMO it's still worth it to have the method in the trait. We may wish to take
advantage of it later, when we can spend more time carefully reasoning about
performance.