Skip to content
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

Decode router params calldata #230

Merged
merged 7 commits into from
Aug 2, 2024
Merged

Decode router params calldata #230

merged 7 commits into from
Aug 2, 2024

Conversation

hensha256
Copy link
Contributor

Copy link
Member

@snreynolds snreynolds left a comment

Choose a reason for hiding this comment

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

lgtm, 1 little comment but if you disagree then feel free to merge

@@ -83,6 +87,56 @@ contract CalldataDecoderTest is Test {
_assertEq(_config, config);
}

function test_fuzz_decodeSwapExactInParams(IV4Router.ExactInputParams calldata _swapParams) public view {
Copy link
Member

Choose a reason for hiding this comment

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

Ok hm I just had this thought which I think relates to all of these tests... Basically we encode the fuzz, and decode it with the library. But we never decode it regularly... shouldnt we be testing it against abi.decode9) not just the raw passed in data?

ie

_encodedParams = abi.encode(_swapParams)
_params = abi.decode(_encodedParams, IV4Router.ExactInputParams)

and then all the asserts are against _params

but lmk if you dont agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hensha256 hensha256 merged commit 1bbeef5 into main Aug 2, 2024
3 checks passed
@hensha256 hensha256 deleted the router-decode-calldata branch August 2, 2024 16: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.

2 participants