Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ERC721Permit #210
ERC721Permit #210
Changes from 2 commits
0c159e2
d13fbe7
ff0b56e
558b621
36ccc28
86e520b
e0ec23c
fc539e3
095ad00
85390a6
b5d18dc
1521e70
16939fb
ed59b58
b0559b8
e458882
88981c1
9ba2556
3cc8407
a229cf8
76a5e47
cdde9e6
c0a26b8
834f331
019bad1
0d445f2
741e660
8dc0ca3
85eae38
ff5bb68
d188aa2
600dd6d
3cab51c
b15da09
750dcba
5c566d6
6eafa63
ce52a7f
e58f516
ff6e58c
33832c0
d59bd1d
42c8268
57542bd
778d7f3
9021dd8
9732562
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
natspec that the word is actually max type(uint248).max
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.
is it more expensive if we did nonces[owner][wordPos].flipBit(bitPos)? can you see? i think i just like that abstraction a little better
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.
its not as friendly since
flipBit
would calculate the new bitmap and return it so the caller can set it in storagethe alternative/cleaner syntax might be
nonces[owner].spendNonce(nonce)
wherespendNonce
does the wordPos/bitPos logicThere 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.
hmmm
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.
ok i misunderstood - now i see it lol
i agree that doing it on the word would be messy becaus eyou have to write
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.
i think i still prefer the abstraction where we were to change it to
nonces[owner][wordPos].flipTick bc the functions become more reusable (to extract bitPos and wordPos) from nonce, then to get the new bitmap...
buttt i get it if its too expensive
maybe we could still have nonces[owner].spendNonce() that still use other helpers for those two things? im just noticing that we have to rewrite helpers in tests to do the same thing weve written here/ I could see those functions being helpful generally in a library
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.
Can you see how much gas is saved not doing it this way? @saucepoint
like is it significantly more expsenive to do
nonces[owner][wordPos] = nonces[owner][wordPos].flipTick(bitPos) ?
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.
i will also say tho.. this is not a super heavily used codepath so we could just go back to the solidity version and be done w it, theres no need to hyper optimize this path
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.
yeah im happy with that 🤷 no strong opinions