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 natspecs and tiny refactor to follow checks-effects-interactions #180

Merged
merged 3 commits into from
Mar 15, 2024

Conversation

kevincheng96
Copy link
Collaborator

Fixes some natspecs, removes some outdated documentation, and moves the setNonceInternal call in setActiveNonceAndCallback to until after all the checks are done.

Copy link
Contributor

@hayesgm hayesgm left a comment

Choose a reason for hiding this comment

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

lgtm

address cachedScriptAddress = nonceScriptAddress[msg.sender][nonce];
// if the nonce has been used before, check if the script address matches, and revert if not
if ((cachedScriptAddress != address(0)) && (cachedScriptAddress != scriptAddress)) {
revert NonceScriptMismatch();
}

// spend the nonce; only if the callee chooses to clear it will it get un-set and become replayable
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have no observable difference right, since we're not making external calls in the intermediate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this will have no functional difference. The change just makes our code conform better to checks-effects-interactions.

@kevincheng96 kevincheng96 merged commit 8d25fdf into main Mar 15, 2024
4 checks passed
@kevincheng96 kevincheng96 deleted the kevin/moar-3 branch March 15, 2024 20:35
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