Skip to content

Commit ff5fcbc

Browse files
authored
feat: extend current add-legacy-fill-method-svm-dev (#864)
1 parent de61c0a commit ff5fcbc

File tree

5 files changed

+61
-65
lines changed

5 files changed

+61
-65
lines changed

contracts/SpokePool.sol

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ abstract contract SpokePool is
6464
// It is a uint32 that increments with each `depositV3` call. In the `FundsDeposited` event, it is
6565
// implicitly cast to uint256 by setting its most significant bits to 0, reducing the risk of ID collisions
6666
// with unsafe deposits. However, this variable's name could be improved (e.g., `depositNonceCounter`)
67-
// since it does not accurately reflect the total number of deposits, as `unsafeDepositV3` can bypass this increment.
67+
// since it does not accurately reflect the total number of deposits, as `unsafeDeposit` can bypass this increment.
6868
uint32 public numberOfDeposits;
6969

7070
// Whether deposits and fills are disabled.
@@ -137,12 +137,12 @@ abstract contract SpokePool is
137137

138138
uint256 public constant MAX_TRANSFER_SIZE = 1e36;
139139

140-
bytes32 public constant UPDATE_V3_DEPOSIT_DETAILS_HASH =
140+
bytes32 public constant UPDATE_BYTES32_DEPOSIT_DETAILS_HASH =
141141
keccak256(
142142
"UpdateDepositDetails(uint256 depositId,uint256 originChainId,uint256 updatedOutputAmount,bytes32 updatedRecipient,bytes updatedMessage)"
143143
);
144144

145-
bytes32 public constant UPDATE_V3_DEPOSIT_ADDRESS_OVERLOAD_DETAILS_HASH =
145+
bytes32 public constant UPDATE_ADDRESS_DEPOSIT_DETAILS_HASH =
146146
keccak256(
147147
"UpdateDepositDetails(uint256 depositId,uint256 originChainId,uint256 updatedOutputAmount,address updatedRecipient,bytes updatedMessage)"
148148
);
@@ -814,7 +814,7 @@ abstract contract SpokePool is
814814
* and/or message.
815815
* @dev the depositor and depositId must match the params in a FundsDeposited event that the depositor
816816
* wants to speed up. The relayer has the option but not the obligation to use this updated information
817-
* when filling the deposit via fillV3RelayWithUpdatedDeposit().
817+
* when filling the deposit via fillRelayWithUpdatedDeposit().
818818
* @param depositor Depositor that must sign the depositorSignature and was the original depositor.
819819
* @param depositId Deposit ID to speed up.
820820
* @param updatedOutputAmount New output amount to use for this deposit. Should be lower than previous value
@@ -843,7 +843,7 @@ abstract contract SpokePool is
843843
updatedRecipient,
844844
updatedMessage,
845845
depositorSignature,
846-
UPDATE_V3_DEPOSIT_DETAILS_HASH
846+
UPDATE_BYTES32_DEPOSIT_DETAILS_HASH
847847
);
848848

849849
// Assuming the above checks passed, a relayer can take the signature and the updated deposit information
@@ -866,7 +866,7 @@ abstract contract SpokePool is
866866
*
867867
* @dev The `depositor` and `depositId` must match the parameters in a `FundsDeposited` event that the depositor wants to speed up.
868868
* The relayer is not obligated but has the option to use this updated information when filling the deposit using
869-
* `fillV3RelayWithUpdatedDeposit()`. This version uses `address` types for compatibility with systems relying on
869+
* `fillRelayWithUpdatedDeposit()`. This version uses `address` types for compatibility with systems relying on
870870
* `address`-based implementations.
871871
*
872872
* @param depositor The depositor that must sign the `depositorSignature` and was the original depositor.
@@ -897,7 +897,7 @@ abstract contract SpokePool is
897897
updatedRecipient.toBytes32(),
898898
updatedMessage,
899899
depositorSignature,
900-
UPDATE_V3_DEPOSIT_ADDRESS_OVERLOAD_DETAILS_HASH
900+
UPDATE_ADDRESS_DEPOSIT_DETAILS_HASH
901901
);
902902

903903
// Assuming the above checks passed, a relayer can take the signature and the updated deposit information
@@ -926,8 +926,8 @@ abstract contract SpokePool is
926926
* window in the HubPool, and a system fee charged to relayers.
927927
* @dev The hash of the relayData will be used to uniquely identify the deposit to fill, so
928928
* modifying any params in it will result in a different hash and a different deposit. The hash will comprise
929-
* all parameters passed to depositV3() on the origin chain along with that chain's chainId(). This chain's
930-
* chainId() must therefore match the destinationChainId passed into depositV3.
929+
* all parameters passed to deposit() on the origin chain along with that chain's chainId(). This chain's
930+
* chainId() must therefore match the destinationChainId passed into deposit.
931931
* Relayers are only refunded for filling deposits with deposit hashes that map exactly to the one emitted by the
932932
* origin SpokePool therefore the relayer should not modify any params in relayData.
933933
* @dev Cannot fill more than once. Partial fills are not supported.
@@ -951,9 +951,9 @@ abstract contract SpokePool is
951951
* - fillDeadline The deadline for the caller to fill the deposit. After this timestamp,
952952
* the fill will revert on the destination chain.
953953
* - exclusivityDeadline: The deadline for the exclusive relayer to fill the deposit. After this
954-
* timestamp, anyone can fill this deposit. Note that if this value was set in depositV3 by adding an offset
954+
* timestamp, anyone can fill this deposit. Note that if this value was set in deposit by adding an offset
955955
* to the deposit's block.timestamp, there is re-org risk for the caller of this method because the event's
956-
* block.timestamp can change. Read the comments in `depositV3` about the `exclusivityParameter` for more details.
956+
* block.timestamp can change. Read the comments in `deposit` about the `exclusivityParameter` for more details.
957957
* - message The message to send to the recipient if the recipient is a contract that implements a
958958
* handleV3AcrossMessage() public function
959959
* @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has
@@ -1026,7 +1026,7 @@ abstract contract SpokePool is
10261026
* @param depositorSignature Signed EIP712 hashstruct containing the deposit ID. Should be signed by the depositor
10271027
* account.
10281028
*/
1029-
function fillV3RelayWithUpdatedDeposit(
1029+
function fillRelayWithUpdatedDeposit(
10301030
V3RelayData calldata relayData,
10311031
uint256 repaymentChainId,
10321032
bytes32 repaymentAddress,
@@ -1061,7 +1061,7 @@ abstract contract SpokePool is
10611061
updatedRecipient,
10621062
updatedMessage,
10631063
depositorSignature,
1064-
UPDATE_V3_DEPOSIT_DETAILS_HASH
1064+
UPDATE_BYTES32_DEPOSIT_DETAILS_HASH
10651065
);
10661066

10671067
_fillRelayV3(relayExecution, repaymentAddress, false);
@@ -1075,14 +1075,14 @@ abstract contract SpokePool is
10751075
* @dev Slow fills are created by inserting slow fill objects into a merkle tree that is included
10761076
* in the next HubPool "root bundle". Once the optimistic challenge window has passed, the HubPool
10771077
* will relay the slow root to this chain via relayRootBundle(). Once the slow root is relayed,
1078-
* the slow fill can be executed by anyone who calls executeV3SlowRelayLeaf().
1078+
* the slow fill can be executed by anyone who calls executeSlowRelayLeaf().
10791079
* @dev Cannot request a slow fill if the fill deadline has passed.
10801080
* @dev Cannot request a slow fill if the relay has already been filled or a slow fill has already been requested.
10811081
* @param relayData struct containing all the data needed to identify the deposit that should be
10821082
* slow filled. If any of the params are missing or different from the origin chain deposit,
10831083
* then Across will not include a slow fill for the intended deposit.
10841084
*/
1085-
function requestV3SlowFill(V3RelayData calldata relayData) public override nonReentrant unpausedFills {
1085+
function requestSlowFill(V3RelayData calldata relayData) public override nonReentrant unpausedFills {
10861086
uint32 currentTime = uint32(getCurrentTime());
10871087
// If a depositor has set an exclusivity deadline, then only the exclusive relayer should be able to
10881088
// fast fill within this deadline. Moreover, the depositor should expect to get *fast* filled within
@@ -1158,7 +1158,7 @@ abstract contract SpokePool is
11581158
* @notice Executes a slow relay leaf stored as part of a root bundle relayed by the HubPool.
11591159
* @dev Executing a slow fill leaf is equivalent to filling the relayData so this function cannot be used to
11601160
* double fill a recipient. The relayData that is filled is included in the slowFillLeaf and is hashed
1161-
* like any other fill sent through fillV3Relay().
1161+
* like any other fill sent through a fill method.
11621162
* @dev There is no relayer credited with filling this relay since funds are sent directly out of this contract.
11631163
* @param slowFillLeaf Contains all data necessary to uniquely identify a relay for this chain. This struct is
11641164
* hashed and included in a merkle root that is relayed to all spoke pools.
@@ -1171,7 +1171,7 @@ abstract contract SpokePool is
11711171
* @param rootBundleId Unique ID of root bundle containing slow relay root that this leaf is contained in.
11721172
* @param proof Inclusion proof for this leaf in slow relay root in root bundle.
11731173
*/
1174-
function executeV3SlowRelayLeaf(
1174+
function executeSlowRelayLeaf(
11751175
V3SlowFill calldata slowFillLeaf,
11761176
uint32 rootBundleId,
11771177
bytes32[] calldata proof
@@ -1284,7 +1284,7 @@ abstract contract SpokePool is
12841284

12851285
/**
12861286
* @notice Returns the deposit ID for an unsafe deposit. This function is used to compute the deposit ID
1287-
* in unsafeDepositV3 and is provided as a convenience.
1287+
* in unsafeDeposit and is provided as a convenience.
12881288
* @dev msgSender and depositor are both used as inputs to allow passthrough depositors to create unique
12891289
* deposit hash spaces for unique depositors.
12901290
* @param msgSender The caller of the transaction used as input to produce the deposit ID.

contracts/interfaces/V3SpokePoolInterface.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ interface V3SpokePoolInterface {
299299

300300
function fillV3Relay(V3RelayDataLegacy calldata relayData, uint256 repaymentChainId) external;
301301

302-
function fillV3RelayWithUpdatedDeposit(
302+
function fillRelayWithUpdatedDeposit(
303303
V3RelayData calldata relayData,
304304
uint256 repaymentChainId,
305305
bytes32 repaymentAddress,
@@ -309,9 +309,9 @@ interface V3SpokePoolInterface {
309309
bytes calldata depositorSignature
310310
) external;
311311

312-
function requestV3SlowFill(V3RelayData calldata relayData) external;
312+
function requestSlowFill(V3RelayData calldata relayData) external;
313313

314-
function executeV3SlowRelayLeaf(
314+
function executeSlowRelayLeaf(
315315
V3SlowFill calldata slowFillLeaf,
316316
uint32 rootBundleId,
317317
bytes32[] calldata proof

contracts/test/MockSpokePool.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ contract MockSpokePool is SpokePool, MockV2SpokePoolInterface, OwnableUpgradeabl
103103
updatedRecipient,
104104
updatedMessage,
105105
depositorSignature,
106-
UPDATE_V3_DEPOSIT_DETAILS_HASH
106+
UPDATE_BYTES32_DEPOSIT_DETAILS_HASH
107107
);
108108
}
109109

@@ -125,7 +125,7 @@ contract MockSpokePool is SpokePool, MockV2SpokePoolInterface, OwnableUpgradeabl
125125
updatedRecipient.toBytes32(),
126126
updatedMessage,
127127
depositorSignature,
128-
UPDATE_V3_DEPOSIT_ADDRESS_OVERLOAD_DETAILS_HASH
128+
UPDATE_ADDRESS_DEPOSIT_DETAILS_HASH
129129
);
130130
}
131131

test/evm/hardhat/SpokePool.Relay.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ describe("SpokePool Relayer Logic", async function () {
421421
);
422422
});
423423
});
424-
describe("fillV3RelayWithUpdatedDeposit", function () {
424+
describe("fillRelayWithUpdatedDeposit", function () {
425425
let updatedOutputAmount: BigNumber, updatedRecipient: string, updatedMessage: string, signature: string;
426426
beforeEach(async function () {
427427
updatedOutputAmount = relayData.outputAmount.add(1);
@@ -443,7 +443,7 @@ describe("SpokePool Relayer Logic", async function () {
443443
await expect(
444444
spokePool
445445
.connect(relayer)
446-
.fillV3RelayWithUpdatedDeposit(
446+
.fillRelayWithUpdatedDeposit(
447447
{ ...relayData, exclusivityDeadline: 0 },
448448
repaymentChainId,
449449
addressToBytes(relayer.address),
@@ -464,7 +464,7 @@ describe("SpokePool Relayer Logic", async function () {
464464
await expect(
465465
spokePool
466466
.connect(relayer)
467-
.fillV3RelayWithUpdatedDeposit(
467+
.fillRelayWithUpdatedDeposit(
468468
_relayData,
469469
repaymentChainId,
470470
addressToBytes(relayer.address),
@@ -477,7 +477,7 @@ describe("SpokePool Relayer Logic", async function () {
477477

478478
// Even if not exclusive relayer, can send it after exclusivity deadline
479479
await expect(
480-
spokePool.connect(relayer).fillV3RelayWithUpdatedDeposit(
480+
spokePool.connect(relayer).fillRelayWithUpdatedDeposit(
481481
{
482482
..._relayData,
483483
exclusivityDeadline: 0,
@@ -500,7 +500,7 @@ describe("SpokePool Relayer Logic", async function () {
500500
await expect(
501501
spokePool
502502
.connect(relayer)
503-
.fillV3RelayWithUpdatedDeposit(
503+
.fillRelayWithUpdatedDeposit(
504504
relayData,
505505
repaymentChainId,
506506
addressToBytes(relayer.address),
@@ -545,7 +545,7 @@ describe("SpokePool Relayer Logic", async function () {
545545
await expect(
546546
spokePool
547547
.connect(relayer)
548-
.fillV3RelayWithUpdatedDeposit(
548+
.fillRelayWithUpdatedDeposit(
549549
{ ...relayData, depositor: addressToBytes(relayer.address) },
550550
repaymentChainId,
551551
addressToBytes(relayer.address),
@@ -568,7 +568,7 @@ describe("SpokePool Relayer Logic", async function () {
568568
await expect(
569569
spokePool
570570
.connect(relayer)
571-
.fillV3RelayWithUpdatedDeposit(
571+
.fillRelayWithUpdatedDeposit(
572572
relayData,
573573
repaymentChainId,
574574
addressToBytes(relayer.address),
@@ -583,7 +583,7 @@ describe("SpokePool Relayer Logic", async function () {
583583
await expect(
584584
spokePool
585585
.connect(relayer)
586-
.fillV3RelayWithUpdatedDeposit(
586+
.fillRelayWithUpdatedDeposit(
587587
{ ...relayData, originChainId: relayData.originChainId + 1 },
588588
repaymentChainId,
589589
addressToBytes(relayer.address),
@@ -598,7 +598,7 @@ describe("SpokePool Relayer Logic", async function () {
598598
await expect(
599599
spokePool
600600
.connect(relayer)
601-
.fillV3RelayWithUpdatedDeposit(
601+
.fillRelayWithUpdatedDeposit(
602602
{ ...relayData, depositId: relayData.depositId.add(toBN(1)) },
603603
repaymentChainId,
604604
addressToBytes(relayer.address),
@@ -613,7 +613,7 @@ describe("SpokePool Relayer Logic", async function () {
613613
await expect(
614614
spokePool
615615
.connect(relayer)
616-
.fillV3RelayWithUpdatedDeposit(
616+
.fillRelayWithUpdatedDeposit(
617617
relayData,
618618
repaymentChainId,
619619
addressToBytes(relayer.address),
@@ -628,7 +628,7 @@ describe("SpokePool Relayer Logic", async function () {
628628
await expect(
629629
spokePool
630630
.connect(relayer)
631-
.fillV3RelayWithUpdatedDeposit(
631+
.fillRelayWithUpdatedDeposit(
632632
relayData,
633633
repaymentChainId,
634634
addressToBytes(relayer.address),
@@ -643,7 +643,7 @@ describe("SpokePool Relayer Logic", async function () {
643643
await expect(
644644
spokePool
645645
.connect(relayer)
646-
.fillV3RelayWithUpdatedDeposit(
646+
.fillRelayWithUpdatedDeposit(
647647
relayData,
648648
repaymentChainId,
649649
addressToBytes(relayer.address),
@@ -668,7 +668,7 @@ describe("SpokePool Relayer Logic", async function () {
668668
await expect(
669669
spokePool
670670
.connect(relayer)
671-
.fillV3RelayWithUpdatedDeposit(
671+
.fillRelayWithUpdatedDeposit(
672672
{ ...relayData, depositor: addressToBytes(erc1271.address) },
673673
repaymentChainId,
674674
addressToBytes(relayer.address),
@@ -681,7 +681,7 @@ describe("SpokePool Relayer Logic", async function () {
681681
await expect(
682682
spokePool
683683
.connect(relayer)
684-
.fillV3RelayWithUpdatedDeposit(
684+
.fillRelayWithUpdatedDeposit(
685685
{ ...relayData, depositor: addressToBytes(erc1271.address) },
686686
repaymentChainId,
687687
addressToBytes(relayer.address),
@@ -697,7 +697,7 @@ describe("SpokePool Relayer Logic", async function () {
697697
await expect(
698698
spokePool
699699
.connect(relayer)
700-
.fillV3RelayWithUpdatedDeposit(
700+
.fillRelayWithUpdatedDeposit(
701701
relayData,
702702
repaymentChainId,
703703
addressToBytes(relayer.address),
@@ -711,7 +711,7 @@ describe("SpokePool Relayer Logic", async function () {
711711
it("cannot send updated fill after slow fill", async function () {
712712
await spokePool
713713
.connect(relayer)
714-
.fillV3RelayWithUpdatedDeposit(
714+
.fillRelayWithUpdatedDeposit(
715715
relayData,
716716
repaymentChainId,
717717
addressToBytes(relayer.address),

0 commit comments

Comments
 (0)