Skip to content

Conversation

@bmzig
Copy link
Contributor

@bmzig bmzig commented Nov 11, 2024

The fill function of the SpokePool contract is meant to adhere to the IDestinationSettler interface, as dictated by the latest update to the ERC-7683 specifications. The fill function is meant to internally call the fillV3Relay function in order to process the order data, and it does so by making a delegatecall to its own fillV3Relay function, passing abi.encodePacked(originData, fillerData) as the parameter.

However, the fillV3Relay function accepts two parameters, having the repaymentChainId as the second parameter. Since the call is constructed using encodeWithSelector, which is not type-safe, the compiler does not complain about the missing parameter. As an incorrect number of parameters is passed, the call to fillV3Relay will always revert when trying to decode the input parameters, breaking the entire execution flow. Moreover, the input data is encoded with abi.encodePacked the use of which is discouraged, especially when dealing with structs and dynamic types like arrays.

Consider using encodeCall instead of encodeWithSelector to ensure type safety, and providing the parameters required by the fillV3Relay function separately. In addition, consider explicitly making the SpokePool contract inherit from the IDestinationSettler interface as required by the ERC-7683 standard.

This PR performs the suggested change and decodes the input data to fields of fillV3Relay, so that abi.encodeCall can be used.

Signed-off-by: bennett <bennett@umaproject.org>
Signed-off-by: bennett <bennett@umaproject.org>
@bmzig bmzig marked this pull request as ready for review November 14, 2024 01:32
Copy link
Member

@nicholaspai nicholaspai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much safer, LGTM

@bmzig bmzig merged commit 5de3d62 into master Nov 15, 2024
9 checks passed
@bmzig bmzig deleted the 1124oz/h01 branch November 15, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants