-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update function and event naming for backwards compatibility #805
Open
chrismaree
wants to merge
25
commits into
svm-dev
Choose a base branch
from
chrismaree/add-legacy-fill-method-svm-dev
base: svm-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+578
−283
Open
Changes from 5 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
84c618f
WIP
775128c
WIP
326600c
WIP
chrismaree 863f485
WIP
chrismaree c4d1b5f
refined overfloaded function structure
chrismaree 7972b05
Discard changes to test/evm/hardhat/chain-specific-spokepools/Polygon…
chrismaree 5862c65
WIP
chrismaree 4573e42
WIP
chrismaree ba3bc6b
Merge branch 'svm-dev' into chrismaree/add-legacy-fill-method-svm-dev
chrismaree 8c223e8
WIP
chrismaree fba5970
WIP
chrismaree 53a0ab0
WIP
mrice32 460abc9
WIP
mrice32 54a9289
WIP
mrice32 db8f298
WIP
mrice32 d134e81
update event names
mrice32 5b23245
fix tests
mrice32 fe738af
update function
mrice32 788682d
update naming
mrice32 29e28d5
drop unintended svm changes
mrice32 41bb920
rebase
chrismaree 244b16c
Merge branch 'svm-dev' into chrismaree/add-legacy-fill-method-svm-dev
chrismaree 32731e7
WIP
chrismaree a934570
WIP
chrismaree de61c0a
WIP
chrismaree File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -504,7 +504,7 @@ abstract contract SpokePool is | |
* @param message The message to send to the recipient on the destination chain if the recipient is a contract. | ||
* If the message is not empty, the recipient contract must implement handleV3AcrossMessage() or the fill will revert. | ||
*/ | ||
function depositV3( | ||
function depositV3Bytes32( | ||
bytes32 depositor, | ||
bytes32 recipient, | ||
bytes32 inputToken, | ||
|
@@ -596,7 +596,7 @@ abstract contract SpokePool is | |
uint32 exclusivityParameter, | ||
bytes calldata message | ||
) public payable override { | ||
depositV3( | ||
depositV3Bytes32( | ||
depositor.toBytes32(), | ||
recipient.toBytes32(), | ||
inputToken.toBytes32(), | ||
|
@@ -633,8 +633,8 @@ abstract contract SpokePool is | |
uint32 fillDeadline, | ||
uint32 exclusivityParameter, | ||
bytes calldata message | ||
) public payable { | ||
unsafeDepositV3( | ||
) public payable override { | ||
unsafeDepositV3Bytes32( | ||
depositor.toBytes32(), | ||
recipient.toBytes32(), | ||
inputToken.toBytes32(), | ||
|
@@ -683,7 +683,7 @@ abstract contract SpokePool is | |
* @param exclusivityParameter See identically named parameter in depositV3() comments. | ||
* @param message See identically named parameter in depositV3() comments. | ||
*/ | ||
function unsafeDepositV3( | ||
function unsafeDepositV3Bytes32( | ||
bytes32 depositor, | ||
bytes32 recipient, | ||
bytes32 inputToken, | ||
|
@@ -754,7 +754,7 @@ abstract contract SpokePool is | |
* @param message The message to send to the recipient on the destination chain if the recipient is a contract. | ||
* If the message is not empty, the recipient contract must implement handleV3AcrossMessage() or the fill will revert. | ||
*/ | ||
function depositV3Now( | ||
function depositV3NowBytes32( | ||
bytes32 depositor, | ||
bytes32 recipient, | ||
bytes32 inputToken, | ||
|
@@ -766,8 +766,8 @@ abstract contract SpokePool is | |
uint32 fillDeadlineOffset, | ||
uint32 exclusivityPeriod, | ||
bytes calldata message | ||
) external payable { | ||
depositV3( | ||
) external payable override { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was also missing from interface. |
||
depositV3Bytes32( | ||
depositor, | ||
recipient, | ||
inputToken, | ||
|
@@ -827,7 +827,7 @@ abstract contract SpokePool is | |
uint32 fillDeadlineOffset, | ||
uint32 exclusivityPeriod, | ||
bytes calldata message | ||
) external payable { | ||
) external payable override { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was also missing from interface. |
||
depositV3( | ||
depositor, | ||
recipient, | ||
|
@@ -862,7 +862,7 @@ abstract contract SpokePool is | |
* account. If depositor is a contract, then should implement EIP1271 to sign as a contract. See | ||
* _verifyUpdateV3DepositMessage() for more details about how this signature should be constructed. | ||
*/ | ||
function speedUpV3Deposit( | ||
function speedUpV3DepositBytes32( | ||
bytes32 depositor, | ||
uint256 depositId, | ||
uint256 updatedOutputAmount, | ||
|
@@ -994,7 +994,7 @@ abstract contract SpokePool is | |
* @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has | ||
* passed. Will receive inputAmount of the equivalent token to inputToken on the repayment chain. | ||
*/ | ||
function fillV3Relay( | ||
function fillV3RelayBytes32( | ||
V3RelayData calldata relayData, | ||
uint256 repaymentChainId, | ||
bytes32 repaymentAddress | ||
|
@@ -1020,6 +1020,39 @@ abstract contract SpokePool is | |
_fillRelayV3(relayExecution, repaymentAddress, false); | ||
} | ||
|
||
// Exposes the same function as fillV3Relay but with a legacy V3RelayData struct that takes in address types. Inner | ||
// function fillV3Relay() applies reentrancy & non-paused checks. | ||
function fillV3Relay(V3RelayDataLegacy calldata relayData, uint256 repaymentChainId) public override { | ||
// Convert V3RelayDataLegacy to V3RelayData using the .toBytes32() method | ||
V3RelayData memory convertedRelayData = V3RelayData({ | ||
depositor: relayData.depositor.toBytes32(), | ||
recipient: relayData.recipient.toBytes32(), | ||
exclusiveRelayer: relayData.exclusiveRelayer.toBytes32(), | ||
inputToken: relayData.inputToken.toBytes32(), | ||
outputToken: relayData.outputToken.toBytes32(), | ||
inputAmount: relayData.inputAmount, | ||
outputAmount: relayData.outputAmount, | ||
originChainId: relayData.originChainId, | ||
depositId: relayData.depositId, | ||
fillDeadline: relayData.fillDeadline, | ||
exclusivityDeadline: relayData.exclusivityDeadline, | ||
message: relayData.message | ||
}); | ||
|
||
// Call the existing fillV3Relay function | ||
(bool success, bytes memory data) = address(this).delegatecall( | ||
abi.encodeWithSignature( | ||
"fillV3RelayBytes32((bytes32,bytes32,bytes32,bytes32,bytes32,uint256,uint256,uint256,uint256,uint32,uint32,bytes),uint256,bytes32)", | ||
convertedRelayData, | ||
repaymentChainId, | ||
msg.sender.toBytes32() | ||
) | ||
); | ||
if (!success) { | ||
revert LowLevelCallFailed(data); | ||
} | ||
} | ||
|
||
/** | ||
* @notice Identical to fillV3Relay except that the relayer wants to use a depositor's updated output amount, | ||
* recipient, and/or message. The relayer should only use this function if they can supply a message signed | ||
|
@@ -1149,9 +1182,11 @@ abstract contract SpokePool is | |
|
||
// Must do a delegatecall because the function requires the inputs to be calldata. | ||
(bool success, bytes memory data) = address(this).delegatecall( | ||
abi.encodeCall( | ||
V3SpokePoolInterface.fillV3Relay, | ||
(relayData, destinationFillerData.repaymentChainId, msg.sender.toBytes32()) | ||
abi.encode( | ||
"fillV3Relay((bytes32,bytes32,bytes32,bytes32,bytes32,uint256,uint256,uint256,uint256,uint32,uint32,bytes),uint256,bytes32)", | ||
relayData, | ||
destinationFillerData.repaymentChainId, | ||
msg.sender.toBytes32() | ||
) | ||
); | ||
if (!success) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this did not have
override
, so I've added it to the interface.