You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regarding unordered nonce there is a documentation fragment that is also confusing: https://docs.uniswap.org/contracts/permit2/reference/signature-transfer#nonce-schema
"...There are 2248 possible indices and this 2248 possible bitmaps..."
it probably originally was "... 2^248 possible indices and 2^248 possible bitmaps..." but was damaged by markup.
It would be nice to fix that typo (just for that created a PR Uniswap/docs#641), and add something like:
uint256 contains 256 single bits that could be used as bit flags for a nonce, this is 256 = 2^8.
So the offset for nonce bitmap is calculated as dividing the nonce provided by 256 (bit shifting right >> 8), and lower 8 bits are location of the bit flag for the nonce.
One more moment:
There is no method provided to get a free ("non-dirty") nonce value for the SignatureTransfer. Using something simple (as just a wallet's transaction nonce) may collide as other protocols can use same numbers before.
The numerical space for unordered nonces is huge, regardless, probably it would be very useful for Uniswap Permit2 to provide more clarity and some 'official' way of generating nonce number for signature transfers, e.g.:
'A reasonable method of getting free nonce number can be: get a large fixed offset (e.g. ascii to hex value of the protocol name) and add wallet's nonce'. This would also provide some example of how this parameter should be obtained.
The text was updated successfully, but these errors were encountered:
https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/interfaces/IAllowanceTransfer.sol#L110C165-L110C165
"current nonce thats updated on any signature based approvals"
in fact, signagure-based (not allowance-based) transfers use unordered nonce, so this comment probably to be rephrased more clearly (even if permit2 overall is 'signature-based approvals').
https://docs.uniswap.org/contracts/permit2/reference/signature-transfer#nonce-schema
"...There are 2248 possible indices and this 2248 possible bitmaps..."
it probably originally was "... 2^248 possible indices and 2^248 possible bitmaps..." but was damaged by markup.
It would be nice to fix that typo (just for that created a PR Uniswap/docs#641), and add something like:
uint256 contains 256 single bits that could be used as bit flags for a nonce, this is 256 = 2^8.
So the offset for nonce bitmap is calculated as dividing the nonce provided by 256 (bit shifting right >> 8), and lower 8 bits are location of the bit flag for the nonce.
There is no method provided to get a free ("non-dirty") nonce value for the SignatureTransfer. Using something simple (as just a wallet's transaction nonce) may collide as other protocols can use same numbers before.
The numerical space for unordered nonces is huge, regardless, probably it would be very useful for Uniswap Permit2 to provide more clarity and some 'official' way of generating nonce number for signature transfers, e.g.:
'A reasonable method of getting free nonce number can be: get a large fixed offset (e.g. ascii to hex value of the protocol name) and add wallet's nonce'. This would also provide some example of how this parameter should be obtained.
The text was updated successfully, but these errors were encountered: