Skip to content

Commit bd7fa38

Browse files
chrismareeChris Mareemrice32
authored
feat: update function and event naming for backwards compatibility (#805)
* WIP Signed-off-by: Chris Maree <chris@mac.speedport.ip> * WIP Signed-off-by: Chris Maree <chris@mac.speedport.ip> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * refined overfloaded function structure Signed-off-by: Chris Maree <christopher.maree@gmail.com> * Discard changes to test/evm/hardhat/chain-specific-spokepools/Polygon_SpokePool.ts * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * update event names Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * fix tests Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * update function Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * update naming Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * drop unintended svm changes Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> * feat: extend current add-legacy-fill-method-svm-dev (#864) * WIP Signed-off-by: Chris Maree <christopher.maree@gmail.com> --------- Signed-off-by: Chris Maree <chris@mac.speedport.ip> Signed-off-by: Chris Maree <christopher.maree@gmail.com> Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Chris Maree <chris@mac.speedport.ip> Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
1 parent a6ed1d1 commit bd7fa38

17 files changed

+635
-346
lines changed

contracts/SpokePool.sol

Lines changed: 76 additions & 89 deletions
Large diffs are not rendered by default.

contracts/SpokePoolVerifier.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ contract SpokePoolVerifier {
2121
error InvalidSpokePool();
2222

2323
/**
24-
* @notice Passthrough function to `depositV3()` on the SpokePool contract.
24+
* @notice Passthrough function to `deposit()` on the SpokePool contract.
2525
* @dev Protects the caller from losing their ETH (or other native token) by reverting if the SpokePool address
2626
* they intended to call does not exist on this chain. Because this contract can be deployed at the same address
2727
* everywhere callers should be protected even if the transaction is submitted to an unintended network.
@@ -58,7 +58,7 @@ contract SpokePoolVerifier {
5858
if (msg.value != inputAmount) revert InvalidMsgValue();
5959
if (!address(spokePool).isContract()) revert InvalidSpokePool();
6060
// Set msg.sender as the depositor so that msg.sender can speed up the deposit.
61-
spokePool.depositV3{ value: msg.value }(
61+
spokePool.deposit{ value: msg.value }(
6262
msg.sender.toBytes32(),
6363
recipient,
6464
inputToken,

contracts/SwapAndBridge.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ abstract contract SwapAndBridgeBase is Lockable, MultiCaller {
183183
DepositData calldata depositData
184184
) internal {
185185
_acrossInputToken.safeIncreaseAllowance(address(spokePool), _acrossInputAmount);
186-
spokePool.depositV3(
186+
spokePool.deposit(
187187
depositData.depositor.toBytes32(),
188188
depositData.recipient.toBytes32(),
189189
address(_acrossInputToken).toBytes32(), // input token

contracts/erc7683/ERC7683OrderDepositorExternal.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ contract ERC7683OrderDepositorExternal is ERC7683OrderDepositor, Ownable, MultiC
7575
message
7676
);
7777
} else {
78-
SPOKE_POOL.unsafeDepositV3(
79-
depositor,
80-
recipient,
81-
inputToken,
82-
outputToken,
78+
SPOKE_POOL.unsafeDeposit(
79+
depositor.toBytes32(),
80+
recipient.toBytes32(),
81+
inputToken.toBytes32(),
82+
outputToken.toBytes32(),
8383
inputAmount,
8484
outputAmount,
8585
destinationChainId,
86-
exclusiveRelayer,
86+
exclusiveRelayer.toBytes32(),
8787
depositNonce,
8888
quoteTimestamp,
8989
fillDeadline,

contracts/interfaces/SpokePoolInterface.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ interface SpokePoolInterface {
5252

5353
function emergencyDeleteRootBundle(uint256 rootBundleId) external;
5454

55-
function deposit(
55+
function depositDeprecated_5947912356(
5656
address recipient,
5757
address originToken,
5858
uint256 amount,

contracts/interfaces/V3SpokePoolInterface.sol

Lines changed: 133 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ interface V3SpokePoolInterface {
6262
bytes message;
6363
}
6464

65+
// Same as V3RelayData but using addresses instead of bytes32 & depositId is uint32.
66+
// Will be deprecated in favor of V3RelayData in the future.
67+
struct V3RelayDataLegacy {
68+
address depositor;
69+
address recipient;
70+
address exclusiveRelayer;
71+
address inputToken;
72+
address outputToken;
73+
uint256 inputAmount;
74+
uint256 outputAmount;
75+
uint256 originChainId;
76+
uint32 depositId;
77+
uint32 fillDeadline;
78+
uint32 exclusivityDeadline;
79+
bytes message;
80+
}
81+
6582
// Contains parameters passed in by someone who wants to execute a slow relay leaf.
6683
struct V3SlowFill {
6784
V3RelayData relayData;
@@ -82,7 +99,7 @@ interface V3SpokePoolInterface {
8299
uint256 repaymentChainId;
83100
}
84101

85-
// Packs together parameters emitted in FilledV3Relay because there are too many emitted otherwise.
102+
// Packs together parameters emitted in FilledRelay because there are too many emitted otherwise.
86103
// Similar to V3RelayExecutionParams, these parameters are not used to uniquely identify the deposit being
87104
// filled so they don't have to be unpacked by all clients.
88105
struct V3RelayExecutionEventInfo {
@@ -113,7 +130,7 @@ interface V3SpokePoolInterface {
113130
* EVENTS *
114131
**************************************/
115132

116-
event V3FundsDeposited(
133+
event FundsDeposited(
117134
bytes32 inputToken,
118135
bytes32 outputToken,
119136
uint256 inputAmount,
@@ -129,7 +146,7 @@ interface V3SpokePoolInterface {
129146
bytes message
130147
);
131148

132-
event RequestedSpeedUpV3Deposit(
149+
event RequestedSpeedUpDeposit(
133150
uint256 updatedOutputAmount,
134151
uint256 indexed depositId,
135152
bytes32 indexed depositor,
@@ -138,7 +155,7 @@ interface V3SpokePoolInterface {
138155
bytes depositorSignature
139156
);
140157

141-
event FilledV3Relay(
158+
event FilledRelay(
142159
bytes32 inputToken,
143160
bytes32 outputToken,
144161
uint256 inputAmount,
@@ -156,7 +173,7 @@ interface V3SpokePoolInterface {
156173
V3RelayExecutionEventInfo relayExecutionInfo
157174
);
158175

159-
event RequestedV3SlowFill(
176+
event RequestedSlowFill(
160177
bytes32 inputToken,
161178
bytes32 outputToken,
162179
uint256 inputAmount,
@@ -182,7 +199,7 @@ interface V3SpokePoolInterface {
182199
* FUNCTIONS *
183200
**************************************/
184201

185-
function depositV3(
202+
function deposit(
186203
bytes32 depositor,
187204
bytes32 recipient,
188205
bytes32 inputToken,
@@ -212,7 +229,7 @@ interface V3SpokePoolInterface {
212229
bytes calldata message
213230
) external payable;
214231

215-
function depositV3Now(
232+
function depositNow(
216233
bytes32 depositor,
217234
bytes32 recipient,
218235
bytes32 inputToken,
@@ -226,7 +243,37 @@ interface V3SpokePoolInterface {
226243
bytes calldata message
227244
) external payable;
228245

229-
function speedUpV3Deposit(
246+
function depositV3Now(
247+
address depositor,
248+
address recipient,
249+
address inputToken,
250+
address outputToken,
251+
uint256 inputAmount,
252+
uint256 outputAmount,
253+
uint256 destinationChainId,
254+
address exclusiveRelayer,
255+
uint32 fillDeadlineOffset,
256+
uint32 exclusivityDeadline,
257+
bytes calldata message
258+
) external payable;
259+
260+
function unsafeDeposit(
261+
bytes32 depositor,
262+
bytes32 recipient,
263+
bytes32 inputToken,
264+
bytes32 outputToken,
265+
uint256 inputAmount,
266+
uint256 outputAmount,
267+
uint256 destinationChainId,
268+
bytes32 exclusiveRelayer,
269+
uint256 depositNonce,
270+
uint32 quoteTimestamp,
271+
uint32 fillDeadline,
272+
uint32 exclusivityParameter,
273+
bytes calldata message
274+
) external payable;
275+
276+
function speedUpDeposit(
230277
bytes32 depositor,
231278
uint256 depositId,
232279
uint256 updatedOutputAmount,
@@ -235,13 +282,24 @@ interface V3SpokePoolInterface {
235282
bytes calldata depositorSignature
236283
) external;
237284

238-
function fillV3Relay(
285+
function speedUpV3Deposit(
286+
address depositor,
287+
uint256 depositId,
288+
uint256 updatedOutputAmount,
289+
address updatedRecipient,
290+
bytes calldata updatedMessage,
291+
bytes calldata depositorSignature
292+
) external;
293+
294+
function fillRelay(
239295
V3RelayData calldata relayData,
240296
uint256 repaymentChainId,
241297
bytes32 repaymentAddress
242298
) external;
243299

244-
function fillV3RelayWithUpdatedDeposit(
300+
function fillV3Relay(V3RelayDataLegacy calldata relayData, uint256 repaymentChainId) external;
301+
302+
function fillRelayWithUpdatedDeposit(
245303
V3RelayData calldata relayData,
246304
uint256 repaymentChainId,
247305
bytes32 repaymentAddress,
@@ -251,9 +309,9 @@ interface V3SpokePoolInterface {
251309
bytes calldata depositorSignature
252310
) external;
253311

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

256-
function executeV3SlowRelayLeaf(
314+
function executeSlowRelayLeaf(
257315
V3SlowFill calldata slowFillLeaf,
258316
uint32 rootBundleId,
259317
bytes32[] calldata proof
@@ -284,4 +342,67 @@ interface V3SpokePoolInterface {
284342
error LowLevelCallFailed(bytes data);
285343
error InsufficientSpokePoolBalanceToExecuteLeaf();
286344
error NoRelayerRefundToClaim();
345+
346+
/**************************************
347+
* LEGACY EVENTS *
348+
**************************************/
349+
350+
// Note: these events are unused, but included in the ABI for ease of migration.
351+
event V3FundsDeposited(
352+
address inputToken,
353+
address outputToken,
354+
uint256 inputAmount,
355+
uint256 outputAmount,
356+
uint256 indexed destinationChainId,
357+
uint32 indexed depositId,
358+
uint32 quoteTimestamp,
359+
uint32 fillDeadline,
360+
uint32 exclusivityDeadline,
361+
address indexed depositor,
362+
address recipient,
363+
address exclusiveRelayer,
364+
bytes message
365+
);
366+
367+
event RequestedSpeedUpV3Deposit(
368+
uint256 updatedOutputAmount,
369+
uint32 indexed depositId,
370+
address indexed depositor,
371+
address updatedRecipient,
372+
bytes updatedMessage,
373+
bytes depositorSignature
374+
);
375+
376+
event FilledV3Relay(
377+
address inputToken,
378+
address outputToken,
379+
uint256 inputAmount,
380+
uint256 outputAmount,
381+
uint256 repaymentChainId,
382+
uint256 indexed originChainId,
383+
uint32 indexed depositId,
384+
uint32 fillDeadline,
385+
uint32 exclusivityDeadline,
386+
address exclusiveRelayer,
387+
address indexed relayer,
388+
address depositor,
389+
address recipient,
390+
bytes message,
391+
V3RelayExecutionEventInfo relayExecutionInfo
392+
);
393+
394+
event RequestedV3SlowFill(
395+
address inputToken,
396+
address outputToken,
397+
uint256 inputAmount,
398+
uint256 outputAmount,
399+
uint256 indexed originChainId,
400+
uint32 indexed depositId,
401+
uint32 fillDeadline,
402+
uint32 exclusivityDeadline,
403+
address exclusiveRelayer,
404+
address depositor,
405+
address recipient,
406+
bytes message
407+
);
287408
}

contracts/permit2-order/Permit2Depositor.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ contract Permit2Depositor {
5959
uint256 amountToDeposit = order.input.amount + order.fillerCollateral.amount;
6060

6161
IERC20(order.input.token).safeIncreaseAllowance(address(SPOKE_POOL), amountToDeposit);
62-
SPOKE_POOL.depositV3(
62+
SPOKE_POOL.deposit(
6363
order.info.offerer.toBytes32(),
6464
// Note: Permit2OrderLib checks that order only has a single output.
6565
order.outputs[0].recipient.toBytes32(),

contracts/test/MockSpokePool.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ contract MockSpokePool is SpokePool, MockV2SpokePoolInterface, OwnableUpgradeabl
8585
_verifyDepositorSignature(depositor, expectedTypedDataV4Hash, depositorSignature);
8686
}
8787

88-
function verifyUpdateV3DepositMessage(
88+
function verifyUpdateV3DepositMessageBytes32(
8989
bytes32 depositor,
9090
uint256 depositId,
9191
uint256 originChainId,
@@ -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

foundry.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ remappings = [
2323
"hardhat/=node_modules/hardhat/",
2424
]
2525
via_ir = true
26-
optimizer_runs = 1_000_000
27-
solc_version = "0.8.25"
26+
optimizer_runs = 800
27+
solc_version = "0.8.23"
2828
revert_strings = "strip"
2929

30-
solc = "0.8.25"
30+
solc = "0.8.23"
3131
evm_version = "shanghai"
3232

3333
[rpc_endpoints]

hardhat.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const mnemonic = getMnemonic();
4747
const LARGE_CONTRACT_COMPILER_SETTINGS = {
4848
version: solcVersion,
4949
settings: {
50-
optimizer: { enabled: true, runs: 1000 },
50+
optimizer: { enabled: true, runs: 800 },
5151
viaIR: true,
5252
debug: { revertStrings: isTest ? "debug" : "strip" },
5353
},
@@ -68,7 +68,7 @@ const config: HardhatUserConfig = {
6868
overrides: {
6969
"contracts/HubPool.sol": LARGE_CONTRACT_COMPILER_SETTINGS,
7070
"contracts/Linea_SpokePool.sol": {
71-
...DEFAULT_CONTRACT_COMPILER_SETTINGS,
71+
...LARGE_CONTRACT_COMPILER_SETTINGS,
7272
// NOTE: Linea only supports 0.8.19.
7373
// See https://docs.linea.build/build-on-linea/ethereum-differences#evm-opcodes
7474
version: "0.8.19",

0 commit comments

Comments
 (0)