From d3eb59691d01507c269f698ad3eea794c3cc615f Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Tue, 15 Mar 2022 10:47:42 -0400 Subject: [PATCH 1/4] improve: Change time-related variables to type uint64 --- contracts/HubPool.sol | 28 ++++++++++++++++------------ contracts/HubPoolInterface.sol | 2 +- contracts/SpokePool.sol | 16 ++++++++-------- contracts/SpokePoolInterface.sol | 4 ++-- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/contracts/HubPool.sol b/contracts/HubPool.sol index c10d7fb4a..f777645a7 100644 --- a/contracts/HubPool.sol +++ b/contracts/HubPool.sol @@ -64,7 +64,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // of leaves are executed, a new root bundle can be proposed uint8 unclaimedPoolRebalanceLeafCount; // When root bundle challenge period passes and this root bundle becomes executable. - uint32 requestExpirationTimestamp; + uint64 requestExpirationTimestamp; } // Only one root bundle can be stored at a time. Once all pool rebalance leaves are executed, a new proposal @@ -84,7 +84,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // True if accepting new LP's. bool isEnabled; // Timestamp of last LP fee update. - uint32 lastLpFeeUpdate; + uint64 lastLpFeeUpdate; // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent // back later. int256 utilizedReserves; @@ -137,7 +137,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized. // It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem. - uint32 public liveness = 7200; + uint64 public liveness = 7200; event Paused(bool indexed isPaused); @@ -185,7 +185,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { ); event ProposeRootBundle( - uint32 requestExpirationTimestamp, + uint64 requestExpirationTimestamp, uint64 unclaimedPoolRebalanceLeafCount, uint256[] bundleEvaluationBlockNumbers, bytes32 indexed poolRebalanceRoot, @@ -334,7 +334,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { * @notice Sets root bundle proposal liveness period. Callable only by owner. * @param newLiveness New liveness period. */ - function setLiveness(uint32 newLiveness) public override onlyOwner { + function setLiveness(uint64 newLiveness) public override onlyOwner { require(newLiveness > 10 minutes, "Liveness too short"); liveness = newLiveness; emit LivenessSet(newLiveness); @@ -415,7 +415,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { pooledTokens[l1Token].lpToken = lpTokenFactory.createLpToken(l1Token); pooledTokens[l1Token].isEnabled = true; - pooledTokens[l1Token].lastLpFeeUpdate = uint32(getCurrentTime()); + pooledTokens[l1Token].lastLpFeeUpdate = uint64(getCurrentTime()); emit L1TokenEnabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken); } @@ -561,7 +561,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // technically valid but not useful. This could also potentially be enforced at the UMIP-level. require(poolRebalanceLeafCount > 0, "Bundle must have at least 1 leaf"); - uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness; + uint64 requestExpirationTimestamp = uint64(getCurrentTime()) + liveness; delete rootBundleProposal; // Only one bundle of roots can be executed at a time. @@ -665,7 +665,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { * optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal. */ function disputeRootBundle() public nonReentrant zeroOptimisticOracleApproval { - uint32 currentTime = uint32(getCurrentTime()); + uint64 currentTime = uint64(getCurrentTime()); require(currentTime <= rootBundleProposal.requestExpirationTimestamp, "Request passed liveness"); // Request price from OO and dispute it. @@ -686,7 +686,9 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { try optimisticOracle.requestAndProposePriceFor( identifier, - currentTime, + uint32(currentTime), // Note: Because the skinny OO interface requires a uint32 value here, this code + // will be unreliable beginning around the year 2106 because casting the time to a uint32 will overflow + // to 0 at that point. requestAncillaryData, bondToken, // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root @@ -711,6 +713,8 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { } // Dispute the request that we just sent. + // Note: We might as well cast the expiration time similarly to + // uint32 so at least if the time rolls over to 0 after the year 2106, proposals can still expire. SkinnyOptimisticOracleInterface.Request memory ooPriceRequest = SkinnyOptimisticOracleInterface.Request({ proposer: rootBundleProposal.proposer, disputer: address(0), @@ -718,7 +722,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { settled: false, proposedPrice: int256(1e18), resolvedPrice: 0, - expirationTime: currentTime + liveness, + expirationTime: uint256(uint32(currentTime + liveness)), reward: 0, finalFee: finalFee, bond: bondAmount - finalFee, @@ -729,7 +733,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount); optimisticOracle.disputePriceFor( identifier, - currentTime, + uint32(currentTime), requestAncillaryData, ooPriceRequest, msg.sender, @@ -936,7 +940,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { function _updateAccumulatedLpFees(PooledToken storage pooledToken) internal { uint256 accumulatedFees = _getAccumulatedFees(pooledToken.undistributedLpFees, pooledToken.lastLpFeeUpdate); pooledToken.undistributedLpFees -= accumulatedFees; - pooledToken.lastLpFeeUpdate = uint32(getCurrentTime()); + pooledToken.lastLpFeeUpdate = uint64(getCurrentTime()); } // Calculate the unallocated accumulatedFees from the last time the contract was called. diff --git a/contracts/HubPoolInterface.sol b/contracts/HubPoolInterface.sol index a13f61193..9edc7a089 100644 --- a/contracts/HubPoolInterface.sol +++ b/contracts/HubPoolInterface.sol @@ -44,7 +44,7 @@ interface HubPoolInterface { function setBond(IERC20 newBondToken, uint256 newBondAmount) external; - function setLiveness(uint32 newLiveness) external; + function setLiveness(uint64 newLiveness) external; function setIdentifier(bytes32 newIdentifier) external; diff --git a/contracts/SpokePool.sol b/contracts/SpokePool.sol index e31c73412..29dc63a71 100644 --- a/contracts/SpokePool.sol +++ b/contracts/SpokePool.sol @@ -46,7 +46,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces // caller to use an approximately "current" realized fee. Defaults to 10 minutes. - uint32 public depositQuoteTimeBuffer = 600; + uint64 public depositQuoteTimeBuffer = 600; // Count of deposits is used to construct a unique deposit identifier for this spoke pool. uint32 public numberOfDeposits; @@ -82,14 +82,14 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall event SetXDomainAdmin(address indexed newAdmin); event SetHubPool(address indexed newHubPool); event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled); - event SetDepositQuoteTimeBuffer(uint32 newBuffer); + event SetDepositQuoteTimeBuffer(uint64 newBuffer); event FundsDeposited( uint256 amount, uint256 originChainId, uint256 destinationChainId, uint64 relayerFeePct, uint32 indexed depositId, - uint32 quoteTimestamp, + uint64 quoteTimestamp, address indexed originToken, address recipient, address indexed depositor @@ -211,7 +211,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only. * @param newDepositQuoteTimeBuffer New quote time buffer. */ - function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin { + function setDepositQuoteTimeBuffer(uint64 newDepositQuoteTimeBuffer) public override onlyAdmin { depositQuoteTimeBuffer = newDepositQuoteTimeBuffer; emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer); } @@ -270,7 +270,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall uint256 amount, uint256 destinationChainId, uint64 relayerFeePct, - uint32 quoteTimestamp + uint64 quoteTimestamp ) public payable override onlyEnabledRoute(originToken, destinationChainId) nonReentrant { // We limit the relay fees to prevent the user spending all their funds on fees. require(relayerFeePct < 0.5e18, "invalid relayer fee"); @@ -280,8 +280,8 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients. require( - getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer && - getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer, + uint64(getCurrentTime()) >= quoteTimestamp - depositQuoteTimeBuffer && + uint64(getCurrentTime()) <= quoteTimestamp + depositQuoteTimeBuffer, "invalid quote time" ); // If the address of the origin token is a WETH contract and there is a msg.value with the transaction @@ -822,7 +822,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall uint256 destinationChainId, uint64 relayerFeePct, uint32 depositId, - uint32 quoteTimestamp, + uint64 quoteTimestamp, address originToken, address recipient, address depositor diff --git a/contracts/SpokePoolInterface.sol b/contracts/SpokePoolInterface.sol index 5f49b0ca8..82850c11d 100644 --- a/contracts/SpokePoolInterface.sol +++ b/contracts/SpokePoolInterface.sol @@ -58,7 +58,7 @@ interface SpokePoolInterface { bool enable ) external; - function setDepositQuoteTimeBuffer(uint32 buffer) external; + function setDepositQuoteTimeBuffer(uint64 buffer) external; function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external; @@ -70,7 +70,7 @@ interface SpokePoolInterface { uint256 amount, uint256 destinationChainId, uint64 relayerFeePct, - uint32 quoteTimestamp + uint64 quoteTimestamp ) external payable; function speedUpDeposit( From 58d224ae62661b0b35810a21c9c39286ff9d9c20 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Tue, 15 Mar 2022 10:52:07 -0400 Subject: [PATCH 2/4] Update HubPool.sol --- contracts/HubPool.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contracts/HubPool.sol b/contracts/HubPool.sol index f777645a7..62fc3db69 100644 --- a/contracts/HubPool.sol +++ b/contracts/HubPool.sol @@ -33,6 +33,11 @@ import "@openzeppelin/contracts/utils/Address.sol"; * responsible for publishing relayer refund and slow relay merkle roots to SpokePools. * @notice This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all * governance actions and pool rebalances originate from here and bridge instructions to L2s. + * @dev This contract should be deprecated by the year 2106, at which point uint32 timestamps will roll over. This is + * an issue for this contract because the SkinnyOptimisticOracleInterface expects request timestamps to be uint32, + * which will create uncertain behavior for disputes sent after that year. In all likelihood, the SkinnyOptimisticOracle + * will be deprecated by 2106 and upgraded to an interface that can handle at least uint64 timestamps, and this + * contract can be upgraded to handle that new interface. */ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { using SafeERC20 for IERC20; From 2d6b1d388c4ba797674ec07904e4245ca3fbfb6a Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Tue, 15 Mar 2022 12:07:34 -0400 Subject: [PATCH 3/4] Update HubPool.sol --- contracts/HubPool.sol | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contracts/HubPool.sol b/contracts/HubPool.sol index 62fc3db69..aab37b634 100644 --- a/contracts/HubPool.sol +++ b/contracts/HubPool.sol @@ -34,10 +34,9 @@ import "@openzeppelin/contracts/utils/Address.sol"; * @notice This contract is meant to act as the cross chain administrator and owner of all L2 spoke pools, so all * governance actions and pool rebalances originate from here and bridge instructions to L2s. * @dev This contract should be deprecated by the year 2106, at which point uint32 timestamps will roll over. This is - * an issue for this contract because the SkinnyOptimisticOracleInterface expects request timestamps to be uint32, - * which will create uncertain behavior for disputes sent after that year. In all likelihood, the SkinnyOptimisticOracle - * will be deprecated by 2106 and upgraded to an interface that can handle at least uint64 timestamps, and this - * contract can be upgraded to handle that new interface. + * an issue for this contract because fee calculations will become bizarre when multiplying by negative time deltas. + * Before this date, this contract should be paused from accepting new root bundles and all LP tokens should be + * disabled by the admin. */ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { using SafeERC20 for IERC20; From 2f59388906346780e729f2b879b643941ea314c9 Mon Sep 17 00:00:00 2001 From: nicholaspai Date: Tue, 15 Mar 2022 12:07:46 -0400 Subject: [PATCH 4/4] Revert "improve: Change time-related variables to type uint64" This reverts commit d3eb59691d01507c269f698ad3eea794c3cc615f. --- contracts/HubPool.sol | 28 ++++++++++++---------------- contracts/HubPoolInterface.sol | 2 +- contracts/SpokePool.sol | 16 ++++++++-------- contracts/SpokePoolInterface.sol | 4 ++-- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/contracts/HubPool.sol b/contracts/HubPool.sol index aab37b634..b9c59bbfa 100644 --- a/contracts/HubPool.sol +++ b/contracts/HubPool.sol @@ -68,7 +68,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // of leaves are executed, a new root bundle can be proposed uint8 unclaimedPoolRebalanceLeafCount; // When root bundle challenge period passes and this root bundle becomes executable. - uint64 requestExpirationTimestamp; + uint32 requestExpirationTimestamp; } // Only one root bundle can be stored at a time. Once all pool rebalance leaves are executed, a new proposal @@ -88,7 +88,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // True if accepting new LP's. bool isEnabled; // Timestamp of last LP fee update. - uint64 lastLpFeeUpdate; + uint32 lastLpFeeUpdate; // Number of LP funds sent via pool rebalances to SpokePools and are expected to be sent // back later. int256 utilizedReserves; @@ -141,7 +141,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // Each root bundle proposal must stay in liveness for this period of time before it can be considered finalized. // It can be disputed only during this period of time. Defaults to 2 hours, like the rest of the UMA ecosystem. - uint64 public liveness = 7200; + uint32 public liveness = 7200; event Paused(bool indexed isPaused); @@ -189,7 +189,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { ); event ProposeRootBundle( - uint64 requestExpirationTimestamp, + uint32 requestExpirationTimestamp, uint64 unclaimedPoolRebalanceLeafCount, uint256[] bundleEvaluationBlockNumbers, bytes32 indexed poolRebalanceRoot, @@ -338,7 +338,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { * @notice Sets root bundle proposal liveness period. Callable only by owner. * @param newLiveness New liveness period. */ - function setLiveness(uint64 newLiveness) public override onlyOwner { + function setLiveness(uint32 newLiveness) public override onlyOwner { require(newLiveness > 10 minutes, "Liveness too short"); liveness = newLiveness; emit LivenessSet(newLiveness); @@ -419,7 +419,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { pooledTokens[l1Token].lpToken = lpTokenFactory.createLpToken(l1Token); pooledTokens[l1Token].isEnabled = true; - pooledTokens[l1Token].lastLpFeeUpdate = uint64(getCurrentTime()); + pooledTokens[l1Token].lastLpFeeUpdate = uint32(getCurrentTime()); emit L1TokenEnabledForLiquidityProvision(l1Token, pooledTokens[l1Token].lpToken); } @@ -565,7 +565,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { // technically valid but not useful. This could also potentially be enforced at the UMIP-level. require(poolRebalanceLeafCount > 0, "Bundle must have at least 1 leaf"); - uint64 requestExpirationTimestamp = uint64(getCurrentTime()) + liveness; + uint32 requestExpirationTimestamp = uint32(getCurrentTime()) + liveness; delete rootBundleProposal; // Only one bundle of roots can be executed at a time. @@ -669,7 +669,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { * optimistic oracle to be adjudicated. Can only be called within the liveness period of the current proposal. */ function disputeRootBundle() public nonReentrant zeroOptimisticOracleApproval { - uint64 currentTime = uint64(getCurrentTime()); + uint32 currentTime = uint32(getCurrentTime()); require(currentTime <= rootBundleProposal.requestExpirationTimestamp, "Request passed liveness"); // Request price from OO and dispute it. @@ -690,9 +690,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { try optimisticOracle.requestAndProposePriceFor( identifier, - uint32(currentTime), // Note: Because the skinny OO interface requires a uint32 value here, this code - // will be unreliable beginning around the year 2106 because casting the time to a uint32 will overflow - // to 0 at that point. + currentTime, requestAncillaryData, bondToken, // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a root @@ -717,8 +715,6 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { } // Dispute the request that we just sent. - // Note: We might as well cast the expiration time similarly to - // uint32 so at least if the time rolls over to 0 after the year 2106, proposals can still expire. SkinnyOptimisticOracleInterface.Request memory ooPriceRequest = SkinnyOptimisticOracleInterface.Request({ proposer: rootBundleProposal.proposer, disputer: address(0), @@ -726,7 +722,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { settled: false, proposedPrice: int256(1e18), resolvedPrice: 0, - expirationTime: uint256(uint32(currentTime + liveness)), + expirationTime: currentTime + liveness, reward: 0, finalFee: finalFee, bond: bondAmount - finalFee, @@ -737,7 +733,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { bondToken.safeIncreaseAllowance(address(optimisticOracle), bondAmount); optimisticOracle.disputePriceFor( identifier, - uint32(currentTime), + currentTime, requestAncillaryData, ooPriceRequest, msg.sender, @@ -944,7 +940,7 @@ contract HubPool is HubPoolInterface, Testable, Lockable, MultiCaller, Ownable { function _updateAccumulatedLpFees(PooledToken storage pooledToken) internal { uint256 accumulatedFees = _getAccumulatedFees(pooledToken.undistributedLpFees, pooledToken.lastLpFeeUpdate); pooledToken.undistributedLpFees -= accumulatedFees; - pooledToken.lastLpFeeUpdate = uint64(getCurrentTime()); + pooledToken.lastLpFeeUpdate = uint32(getCurrentTime()); } // Calculate the unallocated accumulatedFees from the last time the contract was called. diff --git a/contracts/HubPoolInterface.sol b/contracts/HubPoolInterface.sol index 9edc7a089..a13f61193 100644 --- a/contracts/HubPoolInterface.sol +++ b/contracts/HubPoolInterface.sol @@ -44,7 +44,7 @@ interface HubPoolInterface { function setBond(IERC20 newBondToken, uint256 newBondAmount) external; - function setLiveness(uint64 newLiveness) external; + function setLiveness(uint32 newLiveness) external; function setIdentifier(bytes32 newIdentifier) external; diff --git a/contracts/SpokePool.sol b/contracts/SpokePool.sol index 29dc63a71..e31c73412 100644 --- a/contracts/SpokePool.sol +++ b/contracts/SpokePool.sol @@ -46,7 +46,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // Any deposit quote times greater than or less than this value to the current contract time is blocked. Forces // caller to use an approximately "current" realized fee. Defaults to 10 minutes. - uint64 public depositQuoteTimeBuffer = 600; + uint32 public depositQuoteTimeBuffer = 600; // Count of deposits is used to construct a unique deposit identifier for this spoke pool. uint32 public numberOfDeposits; @@ -82,14 +82,14 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall event SetXDomainAdmin(address indexed newAdmin); event SetHubPool(address indexed newHubPool); event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled); - event SetDepositQuoteTimeBuffer(uint64 newBuffer); + event SetDepositQuoteTimeBuffer(uint32 newBuffer); event FundsDeposited( uint256 amount, uint256 originChainId, uint256 destinationChainId, uint64 relayerFeePct, uint32 indexed depositId, - uint64 quoteTimestamp, + uint32 quoteTimestamp, address indexed originToken, address recipient, address indexed depositor @@ -211,7 +211,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall * @notice Change allowance for deposit quote time to differ from current block time. Callable by admin only. * @param newDepositQuoteTimeBuffer New quote time buffer. */ - function setDepositQuoteTimeBuffer(uint64 newDepositQuoteTimeBuffer) public override onlyAdmin { + function setDepositQuoteTimeBuffer(uint32 newDepositQuoteTimeBuffer) public override onlyAdmin { depositQuoteTimeBuffer = newDepositQuoteTimeBuffer; emit SetDepositQuoteTimeBuffer(newDepositQuoteTimeBuffer); } @@ -270,7 +270,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall uint256 amount, uint256 destinationChainId, uint64 relayerFeePct, - uint64 quoteTimestamp + uint32 quoteTimestamp ) public payable override onlyEnabledRoute(originToken, destinationChainId) nonReentrant { // We limit the relay fees to prevent the user spending all their funds on fees. require(relayerFeePct < 0.5e18, "invalid relayer fee"); @@ -280,8 +280,8 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall // Note also that quoteTimestamp cannot be less than the buffer otherwise the following arithmetic can result // in underflow. This isn't a problem as the deposit will revert, but the error might be unexpected for clients. require( - uint64(getCurrentTime()) >= quoteTimestamp - depositQuoteTimeBuffer && - uint64(getCurrentTime()) <= quoteTimestamp + depositQuoteTimeBuffer, + getCurrentTime() >= quoteTimestamp - depositQuoteTimeBuffer && + getCurrentTime() <= quoteTimestamp + depositQuoteTimeBuffer, "invalid quote time" ); // If the address of the origin token is a WETH contract and there is a msg.value with the transaction @@ -822,7 +822,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall uint256 destinationChainId, uint64 relayerFeePct, uint32 depositId, - uint64 quoteTimestamp, + uint32 quoteTimestamp, address originToken, address recipient, address depositor diff --git a/contracts/SpokePoolInterface.sol b/contracts/SpokePoolInterface.sol index 82850c11d..5f49b0ca8 100644 --- a/contracts/SpokePoolInterface.sol +++ b/contracts/SpokePoolInterface.sol @@ -58,7 +58,7 @@ interface SpokePoolInterface { bool enable ) external; - function setDepositQuoteTimeBuffer(uint64 buffer) external; + function setDepositQuoteTimeBuffer(uint32 buffer) external; function relayRootBundle(bytes32 relayerRefundRoot, bytes32 slowRelayRoot) external; @@ -70,7 +70,7 @@ interface SpokePoolInterface { uint256 amount, uint256 destinationChainId, uint64 relayerFeePct, - uint64 quoteTimestamp + uint32 quoteTimestamp ) external payable; function speedUpDeposit(