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
Based on the discussion in #120, I understand that the double assignment was implemented for gas efficiency purposes (that is, for the happy execution paths). However, this is an uncommon design choice, so it would be helpful to explain the order of operations, i.e. that the storage assignment is performed first, and then the resulting value is assigned to the flipped variable (generally speaking, it's not obvious that y = z is performed first in x = y = z).
Also, the NatSpec comments mention the check before the storage update, although in practice the reverse order of operations applies:
/// @notice Checks whether a nonce is taken and sets the bit at the bit position in the bitmap at the word position
Side note: this design deviates from the Checks-Effects-Interactions pattern, which is not a bad thing in and of itself, but this is worth mentioning FYI.
The text was updated successfully, but these errors were encountered:
In
SignatureTransfer._userUnorderedNonce
, there is this line:permit2/src/SignatureTransfer.sol
Line 153 in bbbc92f
Based on the discussion in #120, I understand that the double assignment was implemented for gas efficiency purposes (that is, for the happy execution paths). However, this is an uncommon design choice, so it would be helpful to explain the order of operations, i.e. that the storage assignment is performed first, and then the resulting value is assigned to the
flipped
variable (generally speaking, it's not obvious thaty = z
is performed first inx = y = z
).Also, the NatSpec comments mention the check before the storage update, although in practice the reverse order of operations applies:
permit2/src/SignatureTransfer.sol
Line 147 in bbbc92f
Side note: this design deviates from the Checks-Effects-Interactions pattern, which is not a bad thing in and of itself, but this is worth mentioning FYI.
The text was updated successfully, but these errors were encountered: