Skip to content

Commit 2145065

Browse files
pxrlmrice32nicholaspai
authored
improve: Mark functions that are soon to be deprecated post USS deployment (#3) (#413)
Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: nicholaspai <npai.nyc@gmail.com>
1 parent 67a4450 commit 2145065

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

contracts/MerkleLib.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ library MerkleLib {
3333
* @param proof the merkle proof.
3434
* @return bool to signal if the relayer refund proof correctly shows inclusion of the refund within the tree.
3535
*/
36+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
3637
function verifyRelayerRefund(
3738
bytes32 root,
3839
SpokePoolInterface.RelayerRefundLeaf memory refund,
@@ -56,6 +57,7 @@ library MerkleLib {
5657
* @param proof the merkle proof.
5758
* @return bool to signal if the slow relay's proof correctly shows inclusion of the slow relay within the tree.
5859
*/
60+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
5961
function verifySlowRelayFulfillment(
6062
bytes32 root,
6163
SpokePoolInterface.SlowFill memory slowRelayFulfillment,

contracts/Polygon_SpokePool.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool, CircleCCTPAdapter
203203
super.executeUSSRelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof);
204204
}
205205

206+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
206207
function executeRelayerRefundLeaf(
207208
uint32 rootBundleId,
208209
SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,

contracts/SpokePool.sol

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import "@openzeppelin/contracts/utils/math/SignedMath.sol";
1818

1919
// This interface is expected to be implemented by any contract that expects to receive messages from the SpokePool.
2020
interface AcrossMessageHandler {
21+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
2122
function handleAcrossMessage(
2223
address tokenSent,
2324
uint256 amount,
@@ -143,10 +144,11 @@ abstract contract SpokePool is
143144
// their fees are negative.
144145
// It's important that it isn't too large, however, as it should be multipliable by ~2e18 without overflowing.
145146
// 1e40 * 2e18 = 2e58 << 2^255 ~= 5e76
147+
/// @custom:audit FOLLOWING VARIABLE TO BE DEPRECATED
146148
uint256 public constant SLOW_FILL_MAX_TOKENS_TO_SEND = 1e40;
147149

148150
// Set max payout adjustment to something
149-
151+
/// @custom:audit FOLLOWING VARIABLE TO BE DEPRECATED
150152
bytes32 public constant UPDATE_DEPOSIT_DETAILS_HASH =
151153
keccak256(
152154
"UpdateDepositDetails(uint32 depositId,uint256 originChainId,int64 updatedRelayerFeePct,address updatedRecipient,bytes updatedMessage)"
@@ -162,6 +164,7 @@ abstract contract SpokePool is
162164
event SetXDomainAdmin(address indexed newAdmin);
163165
event SetHubPool(address indexed newHubPool);
164166
event EnabledDepositRoute(address indexed originToken, uint256 indexed destinationChainId, bool enabled);
167+
/// @custom:audit FOLLOWING EVENT TO BE DEPRECATED
165168
event RequestedSpeedUpDeposit(
166169
int64 newRelayerFeePct,
167170
uint32 indexed depositId,
@@ -170,6 +173,7 @@ abstract contract SpokePool is
170173
bytes updatedMessage,
171174
bytes depositorSignature
172175
);
176+
/// @custom:audit FOLLOWING EVENT TO BE DEPRECATED
173177
event FilledRelay(
174178
uint256 amount,
175179
uint256 totalFilledAmount,
@@ -187,6 +191,7 @@ abstract contract SpokePool is
187191
bytes message,
188192
RelayExecutionInfo updatableRelayData
189193
);
194+
/// @custom:audit FOLLOWING EVENT TO BE DEPRECATED
190195
event RefundRequested(
191196
address indexed relayer,
192197
address refundToken,
@@ -203,6 +208,7 @@ abstract contract SpokePool is
203208
bytes32 indexed relayerRefundRoot,
204209
bytes32 indexed slowRelayRoot
205210
);
211+
/// @custom:audit FOLLOWING EVENT TO BE DEPRECATED
206212
event ExecutedRelayerRefundRoot(
207213
uint256 amountToReturn,
208214
uint256 indexed chainId,
@@ -237,6 +243,7 @@ abstract contract SpokePool is
237243
* @param payoutAdjustmentPct Adjustment to the payout amount. Can be used to increase or decrease the payout to
238244
* allow for rewards or penalties. Used in slow fills.
239245
*/
246+
/// @custom:audit FOLLOWING STRUCT TO BE DEPRECATED
240247
struct RelayExecution {
241248
RelayData relay;
242249
bytes32 relayHash;
@@ -260,6 +267,7 @@ abstract contract SpokePool is
260267
* @param isSlowRelay Whether this is a slow relay.
261268
* @param payoutAdjustmentPct Adjustment to the payout amount.
262269
*/
270+
/// @custom:audit FOLLOWING STRUCT TO BE DEPRECATED
263271
struct RelayExecutionInfo {
264272
address recipient;
265273
bytes message;
@@ -437,10 +445,6 @@ abstract contract SpokePool is
437445
* DEPOSITOR FUNCTIONS *
438446
**************************************/
439447

440-
// Note: The following deposit functions will be removed in favor of the
441-
// depositUSS_ functions. These are maintained for backwards compatibility with
442-
// UI's that expect to call this interface.
443-
444448
/**
445449
* @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock
446450
* tokens in this contract and receive a destination token on the destination chain. The origin => destination
@@ -501,6 +505,7 @@ abstract contract SpokePool is
501505
* @param message Arbitrary data that can be used to pass additional information to the recipient along with the tokens.
502506
* Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
503507
*/
508+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
504509
function depositFor(
505510
address depositor,
506511
address recipient,
@@ -530,6 +535,7 @@ abstract contract SpokePool is
530535
* Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
531536
* @param maxCount used to protect the depositor from frontrunning to guarantee their quote remains valid.
532537
*/
538+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
533539
function depositNow(
534540
address recipient,
535541
address originToken,
@@ -567,6 +573,7 @@ abstract contract SpokePool is
567573
* Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
568574
* @param maxCount used to protect the depositor from frontrunning to guarantee their quote remains valid.
569575
*/
576+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
570577
function depositForNow(
571578
address depositor,
572579
address recipient,
@@ -611,6 +618,7 @@ abstract contract SpokePool is
611618
* relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the
612619
* EIP-712 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.
613620
*/
621+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
614622
function speedUpDeposit(
615623
address depositor,
616624
int64 updatedRelayerFeePct,
@@ -806,12 +814,6 @@ abstract contract SpokePool is
806814
* RELAYER FUNCTIONS *
807815
**************************************/
808816

809-
// Note: The following fill functions will be removed in favor of the
810-
// fillRelayUSS_ functions. These are maintained for backwards compatibility with
811-
// relayers so that they can fill old deposits that emitted FundsDepositted events
812-
// pre-upgrade. All future deposits that emit USSFundsDeposited events will be
813-
// fillable only with fillRelayUSS_ functions.
814-
815817
/**
816818
/**
817819
* @notice Called by relayer to fulfill part of a deposit by sending destination tokens to the recipient.
@@ -840,6 +842,7 @@ abstract contract SpokePool is
840842
* @param message Message to send to recipient along with tokens.
841843
* @param maxCount Max count to protect the relayer from frontrunning.
842844
*/
845+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
843846
function fillRelay(
844847
address depositor,
845848
address recipient,
@@ -912,6 +915,7 @@ abstract contract SpokePool is
912915
* EIP-712 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.
913916
* @param maxCount Max fill count to protect the relayer from frontrunning.
914917
*/
918+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
915919
function fillRelayWithUpdatedDeposit(
916920
address depositor,
917921
address recipient,
@@ -1153,6 +1157,7 @@ abstract contract SpokePool is
11531157
* for rewards or penalties.
11541158
* @param proof Inclusion proof for this leaf in slow relay root in root bundle.
11551159
*/
1160+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
11561161
function executeSlowRelayLeaf(
11571162
address depositor,
11581163
address recipient,
@@ -1447,6 +1452,7 @@ abstract contract SpokePool is
14471452
}
14481453

14491454
// Verifies inclusion proof of leaf in root and sends recipient remainder of relay. Marks relay as filled.
1455+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
14501456
function _executeSlowRelayLeaf(
14511457
address depositor,
14521458
address recipient,
@@ -1531,6 +1537,7 @@ abstract contract SpokePool is
15311537
MerkleLib.setClaimed(rootBundle.claimedBitmap, leafId);
15321538
}
15331539

1540+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
15341541
function _verifyUpdateDepositMessage(
15351542
address depositor,
15361543
uint32 depositId,
@@ -1617,6 +1624,7 @@ abstract contract SpokePool is
16171624
require(isValid, "invalid signature");
16181625
}
16191626

1627+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
16201628
function _verifySlowFill(
16211629
RelayExecution memory relayExecution,
16221630
uint32 rootBundleId,
@@ -1648,6 +1656,7 @@ abstract contract SpokePool is
16481656
revert InvalidMerkleProof();
16491657
}
16501658

1659+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
16511660
function _computeAmountPreFees(uint256 amount, int64 feesPct) private pure returns (uint256) {
16521661
return (1e18 * amount) / uint256((int256(1e18) - feesPct));
16531662
}
@@ -1656,6 +1665,7 @@ abstract contract SpokePool is
16561665
return (amount * uint256(int256(1e18) - feesPct)) / 1e18;
16571666
}
16581667

1668+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
16591669
function _getRelayHash(SpokePoolInterface.RelayData memory relayData) private pure returns (bytes32) {
16601670
return keccak256(abi.encode(relayData));
16611671
}
@@ -1684,6 +1694,7 @@ abstract contract SpokePool is
16841694
* @dev Caller must approve this contract to transfer up to maxTokensToSend of the relayData.destinationToken.
16851695
* The amount to be sent might end up less if there is insufficient relay amount remaining to be sent.
16861696
*/
1697+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
16871698
function _fillRelay(RelayExecution memory relayExecution) internal returns (uint256 fillAmountPreFees) {
16881699
RelayData memory relayData = relayExecution.relay;
16891700
// We limit the relay fees to prevent the user spending all their funds on fees. Note that 0.5e18 (i.e. 50%)
@@ -1918,6 +1929,7 @@ abstract contract SpokePool is
19181929
}
19191930
}
19201931

1932+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
19211933
function _emitFillRelay(RelayExecution memory relayExecution, uint256 fillAmountPreFees) internal {
19221934
RelayExecutionInfo memory relayExecutionInfo = RelayExecutionInfo({
19231935
relayerFeePct: relayExecution.updatedRelayerFeePct,

contracts/interfaces/SpokePoolInterface.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pragma solidity ^0.8.0;
55
* @notice Contains common data structures and functions used by all SpokePool implementations.
66
*/
77
interface SpokePoolInterface {
8+
/// @custom:audit FOLLOWING STRUCT TO BE DEPRECATED
89
// This leaf is meant to be decoded in the SpokePool to pay out successful relayers.
910
struct RelayerRefundLeaf {
1011
// This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that
@@ -26,6 +27,7 @@ interface SpokePoolInterface {
2627
// considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be
2728
// considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an off
2829
// chain validator can choose when to refund slow relayers.
30+
/// @custom:audit FOLLOWING STRUCT TO BE DEPRECATED
2931
struct RelayData {
3032
// The address that made the deposit on the origin chain.
3133
address depositor;
@@ -50,6 +52,7 @@ interface SpokePoolInterface {
5052
bytes message;
5153
}
5254

55+
/// @custom:audit FOLLOWING STRUCT TO BE DEPRECATED
5356
struct SlowFill {
5457
RelayData relayData;
5558
int256 payoutAdjustmentPct;
@@ -96,6 +99,7 @@ interface SpokePoolInterface {
9699
uint256 maxCount
97100
) external payable;
98101

102+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
99103
function depositFor(
100104
address depositor,
101105
address recipient,
@@ -108,6 +112,7 @@ interface SpokePoolInterface {
108112
uint256 maxCount
109113
) external payable;
110114

115+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
111116
function depositNow(
112117
address recipient,
113118
address originToken,
@@ -118,6 +123,7 @@ interface SpokePoolInterface {
118123
uint256 maxCount
119124
) external payable;
120125

126+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
121127
function speedUpDeposit(
122128
address depositor,
123129
int64 updatedRelayerFeePct,
@@ -127,6 +133,7 @@ interface SpokePoolInterface {
127133
bytes memory depositorSignature
128134
) external;
129135

136+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
130137
function fillRelay(
131138
address depositor,
132139
address recipient,
@@ -142,6 +149,7 @@ interface SpokePoolInterface {
142149
uint256 maxCount
143150
) external;
144151

152+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
145153
function fillRelayWithUpdatedDeposit(
146154
address depositor,
147155
address recipient,
@@ -161,6 +169,7 @@ interface SpokePoolInterface {
161169
uint256 maxCount
162170
) external;
163171

172+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
164173
function executeSlowRelayLeaf(
165174
address depositor,
166175
address recipient,
@@ -176,6 +185,7 @@ interface SpokePoolInterface {
176185
bytes32[] memory proof
177186
) external;
178187

188+
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED
179189
function executeRelayerRefundLeaf(
180190
uint32 rootBundleId,
181191
SpokePoolInterface.RelayerRefundLeaf memory relayerRefundLeaf,

0 commit comments

Comments
 (0)