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

feat: Initial implementation of rebate via priority fee #103

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zhongeric
Copy link
Collaborator

@zhongeric zhongeric commented Jun 12, 2024

should be gas savings when rebate token is either output token or gas token

Copy link

Forge code coverage:

[PASS] test_RelayOrderInfoTypestring_isCorrect() (gas: 18553)
[PASS] test_hash_isDifferentBy_deadline() (gas: 10145)
[PASS] test_hash_isDifferentBy_nonce() (gas: 10124)
[PASS] test_hash_isDifferentBy_reactor() (gas: 4852)
[PASS] test_hash_isDifferentBy_swapper() (gas: 10139)
[PASS] test_hash_isEqual() (gas: 9698)
Suite result: ok. 6 passed; 0 failed; 0 skipped; finished in 4.03ms (3.67ms CPU time)

[FAIL. Reason: log != expected log] testDeploy() (gas: 3051281)
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 9.94ms (7.36ms CPU time)

[FAIL. Reason: revert: TRANSFER_FAILED] test_excecute_succeeds_universalRouter() (gas: 229198)
[FAIL. Reason: log != expected log] test_execute_NoFeeRecipient() (gas: 265856)
[PASS] test_execute_noInputsOrFee() (gas: 153362)
[PASS] test_execute_reverts_DeadlineBeforeEndTime() (gas: 66637)
[PASS] test_execute_reverts_EndTimeBeforeStartTime() (gas: 83653)
[FAIL. Reason: log != expected log] test_execute_reverts_InvalidNonce() (gas: 265928)
[PASS] test_execute_reverts_InvalidReactor() (gas: 65675)
[PASS] test_execute_reverts_NoInputsSignatureExpired() (gas: 106225)
[PASS] test_execute_reverts_SignatureExpired() (gas: 106105)
[PASS] test_execute_reverts_universalRouter() (gas: 221434)
[FAIL. Reason: log != expected log] test_execute_withDecay() (gas: 266433)
[FAIL. Reason: revert: TRANSFER_FAILED] test_multicall_execute_noDecay() (gas: 294060)
[FAIL. Reason: revert: TRANSFER_FAILED] test_multicall_execute_noDecay_multipleFeeRecipients() (gas: 293967)
[FAIL. Reason: revert: TRANSFER_FAILED] test_multicall_execute_noDecay_specifiedInputRecipients() (gas: 269695)
[FAIL. Reason: revert: TRANSFER_FAILED] test_multicall_permitAndExecute_succeeds() (gas: 1582965)
[PASS] test_multicall_reverts_universalRouter() (gas: 249066)
[PASS] test_permit2_address_correctness() (gas: 6105)
[PASS] test_permit_succeeds() (gas: 1398341)
Suite result: FAILED. 10 passed; 8 failed; 0 skipped; finished in 92.64ms (86.61ms CPU time)

[PASS] test_InputTypeString_isCorrect() (gas: 13022)
[PASS] test_hash_isDifferentBy_amount() (gas: 9095)
[PASS] test_hash_isDifferentBy_recipient() (gas: 9129)
[PASS] test_hash_isDifferentBy_token() (gas: 3863)
[PASS] test_hash_isEqual() (gas: 8705)
Suite result: ok. 5 passed; 0 failed; 0 skipped; finished in 2.66ms (2.49ms CPU time)

[PASS] testRelayFeeEscalation() (gas: 6818)
[PASS] testRelayFeeEscalationBounded(uint256,uint256,uint256,uint256) (runs: 256, μ: 4848, ~: 4847)
[PASS] testRelayFeeEscalationEqualAmounts(uint256,uint256,uint256) (runs: 256, μ: 9005, ~: 9006)
[PASS] testRelayFeeEscalationFullyEscalated() (gas: 4404)
[PASS] testRelayFeeEscalationInvalidAmounts() (gas: 3309)
[PASS] testRelayFeeEscalationNoEscalation(uint256,uint256,uint256) (runs: 256, μ: 4077, ~: 4075)
[PASS] testRelayFeeEscalationNoEscalationYet() (gas: 4383)
[PASS] testRelayFeeEscalationRevertsWithWrongEndStartTimes() (gas: 3334)
[PASS] testToTokenPermissions() (gas: 5572)
[PASS] testToTransferDetails() (gas: 5721)
[PASS] test_FeeEscalatorTypestring_isCorrect() (gas: 23172)
[PASS] test_fuzz_resolve_startTimeEqualsEndTime(uint256,uint256) (runs: 256, μ: 2382, ~: 3745)
[PASS] test_hash_isDifferentBy_endAmount() (gas: 5470)
[PASS] test_hash_isDifferentBy_endTime() (gas: 5468)
[PASS] test_hash_isDifferentBy_startAmount() (gas: 5491)
[PASS] test_hash_isDifferentBy_startTime() (gas: 5469)
[PASS] test_hash_isDifferentBy_token() (gas: 4987)
[PASS] test_hash_isEqual() (gas: 4998)
Suite result: ok. 18 passed; 0 failed; 0 skipped; finished in 248.33ms (370.03ms CPU time)

[FAIL. Reason: assertion failed] test_Permit2WitnessStubTypestring_isCorrect() (gas: 38311)
[FAIL. Reason: assertion failed] test_RelayOrderTypestring_isCorrect() (gas: 49788)
[PASS] test_fuzz_toTokenPermissions(uint256,uint256,uint256) (runs: 256, μ: 12031, ~: 12031)
[PASS] test_fuzz_toTransferDetails_noEscalation_afterBlockTimestamp(uint256,uint256) (runs: 256, μ: 15383, ~: 15230)
[PASS] test_fuzz_toTransferDetails_noEscalation_atBlockTimestamp(uint256,uint256) (runs: 256, μ: 12738, ~: 13786)
[PASS] test_fuzz_toTransferDetails_noEscalation_beforeBlockTimestamp(uint256,uint256) (runs: 256, μ: 13581, ~: 14618)
[PASS] test_hash_isDifferentByCalldata() (gas: 41982)
[PASS] test_hash_isDifferentByFeeEscalator() (gas: 45114)
[PASS] test_hash_isDifferentByInput() (gas: 42294)
[PASS] test_hash_isDifferentByOrderInfo() (gas: 42399)
[PASS] test_hash_isEqual() (gas: 41794)
[PASS] test_toTokenPermissions_default() (gas: 10681)
[PASS] test_toTransferDetails_midPointEscalation() (gas: 14909)
[PASS] test_toTransferDetails_noEscalation() (gas: 10651)
[PASS] test_transferInputTokens_noEscalation_toAddressThis() (gas: 172406)
[PASS] test_validate_reverts_DeadlineBeforeEndTime() (gas: 12930)
[PASS] test_validate_reverts_InvalidReactor() (gas: 23472)
[PASS] test_validate_succeeds() (gas: 20423)
Suite result: FAILED. 16 passed; 2 failed; 0 skipped; finished in 272.75ms (537.90ms CPU time)

Ran 6 test suites in 287.28ms (630.36ms CPU time): 55 tests passed, 11 failed, 0 skipped (66 total tests)

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)
script/RelayOrderReactorInitBytecode.s.sol 0.00% (0/6) 0.00% (0/9) 100.00% (0/0) 0.00% (0/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 100.00% (15/15) 100.00% (19/19) 100.00% (8/8) 100.00% (4/4)
src/lib/InputLib.sol 100.00% (1/1) 100.00% (2/2) 100.00% (0/0) 100.00% (1/1)
src/lib/RebateLib.sol 100.00% (5/5) 100.00% (8/8) 100.00% (2/2) 100.00% (2/2)
src/lib/RelayOrderInfoLib.sol 100.00% (1/1) 100.00% (2/2) 100.00% (0/0) 100.00% (1/1)
src/lib/RelayOrderLib.sol 100.00% (17/17) 100.00% (23/23) 100.00% (6/6) 100.00% (6/6)
src/reactors/RelayOrderReactor.sol 100.00% (12/12) 100.00% (15/15) 100.00% (4/4) 100.00% (4/4)
Total 88.55% (116/131) 89.08% (155/174) 100.00% (22/22) 86.21% (50/58)

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.

1 participant