@@ -60,7 +60,12 @@ abstract contract SpokePool is
6060 WETH9Interface private DEPRECATED_wrappedNativeToken;
6161 uint32 private DEPRECATED_depositQuoteTimeBuffer;
6262
63- // Count of deposits is used to construct a unique deposit identifier for this spoke pool.
63+ // Count of deposits is used to construct a unique deposit identifier for this spoke pool. This value
64+ // gets emitted and incremented on each depositV3 call. Because its a uint32, it will get implicitly cast to
65+ // uint256 in the emitted V3FundsDeposited event by setting its most significant bits to 0.
66+ // This variable name `numberOfDeposits` should ideally be re-named to
67+ // depositNonceCounter or something similar because its not a true representation of the number of deposits
68+ // because `unsafeDepositV3` can be called directly and bypass this increment.
6469 uint32 public numberOfDeposits;
6570
6671 // Whether deposits and fills are disabled.
@@ -514,6 +519,13 @@ abstract contract SpokePool is
514519 uint32 exclusivityParameter ,
515520 bytes calldata message
516521 ) public payable override nonReentrant unpausedDeposits {
522+ // Increment deposit nonce variable `numberOfDeposits` so that deposit ID for this deposit on this
523+ // spoke pool is unique. This variable `numberOfDeposits` should ideally be re-named to
524+ // depositNonceCounter or something similar because its not a true representation of the number of deposits
525+ // because `unsafeDepositV3` can be called directly and bypass this increment.
526+ // The `numberOfDeposits` is a uint32 that will get implicitly cast to uint256 by setting the
527+ // most significant bits to 0, which creates very little chance this an unsafe deposit ID collides
528+ // with a safe deposit ID.
517529 DepositV3Params memory params = DepositV3Params ({
518530 depositor: depositor,
519531 recipient: recipient,
0 commit comments