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

use nested structs for hashing the relay order #95

Merged
merged 4 commits into from
Feb 16, 2024
Merged

Conversation

snreynolds
Copy link
Member

TODO: Add tests to the relay order lib, needs to merge main

Copy link

github-actions bot commented Feb 15, 2024

Forge code coverage:

File % Lines % Statements % Branches % Funcs
script/DeployRelayOrderReactor.s.sol 100.00% (4/4) 100.00% (4/4) 100.00% (0/0) 50.00% (1/2)
src/base/Multicall.sol 100.00% (6/6) 100.00% (8/8) 100.00% (2/2) 100.00% (1/1)
src/lib/FeeEscalatorLib.sol 0.00% (0/15) 0.00% (0/19) 0.00% (0/8) 0.00% (0/4)
src/lib/InputLib.sol 0.00% (0/1) 0.00% (0/2) 100.00% (0/0) 0.00% (0/1)
src/lib/OrderInfoLib.sol 0.00% (0/1) 0.00% (0/2) 100.00% (0/0) 0.00% (0/1)
src/lib/RelayOrderLib.sol 85.71% (12/14) 84.21% (16/19) 75.00% (3/4) 80.00% (4/5)
src/reactors/RelayOrderReactor.sol 100.00% (9/9) 100.00% (12/12) 100.00% (4/4) 100.00% (2/2)
Total 32.08% (34/106) 30.50% (43/141) 50.00% (9/18) 26.09% (12/46)

Copy link
Collaborator

@zhongeric zhongeric left a comment

Choose a reason for hiding this comment

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

looks great! just a few nits

src/lib/InputLib.sol Show resolved Hide resolved
src/lib/OrderInfoLib.sol Outdated Show resolved Hide resolved
test/foundry-tests/lib/FeeEscalatorLib.t.sol Show resolved Hide resolved
test/foundry-tests/lib/InputLib.t copy.sol Outdated Show resolved Hide resolved
"FeeEscalator(",
"address token,",
"uint256 startAmount,",
"uint256 endAmount,",
Copy link
Contributor

Choose a reason for hiding this comment

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

previously you were skipping endAmount since it's included in the tokenpermissions - any reason we decided to add it back in?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah we are changing the entire hash function of the RelayOrder because otherwise order hashes are not collision resistant. Ie a change in endAmount or even the token but everything else is kept the same would result in the same hash

@snreynolds snreynolds merged commit 4d17086 into main Feb 16, 2024
6 checks passed
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.

3 participants