Conversation
…chain. Remove unnecessary enforcer variations.
Co-authored-by: Hanzel Anchia Mena <33629234+hanzel98@users.noreply.github.com>
|
@MoMannn Please add the deployment script for the new caveats that you create, and add them to the verification scripts too |
|
Please add any documentation needed to explain how the enforced outcomes can be achieved with this enforcer and what is expected when people don't want to use Gators. Also please explain how the total enforcer works when mixing decrease and increase |
|
Please add a brief explanation comment in each of the test |
Co-authored-by: Hanzel Anchia Mena <33629234+hanzel98@users.noreply.github.com>
Co-authored-by: Hanzel Anchia Mena <33629234+hanzel98@users.noreply.github.com>
…ry imports, add missing tests
McOso
left a comment
There was a problem hiding this comment.
Looking good! Just a little check to short circuit if the amount in terms is greater than 0. Not critical, but might prevent some improper use
…m/MetaMask/delegation-framework into chore/balance-payment-enforcement
There was a problem hiding this comment.
Bug: Script Fails Verifying Contracts at Zero Addresses
The script/verification/verify-enforcer-contracts.sh script adds four new Total Balance Change Enforcers to the ENFORCERS array and corresponding placeholder zero addresses (0x0000000000000000000000000000000000000000) to the ADDRESSES array. The script then attempts to verify contracts at these zero addresses, which causes verification failures.
script/verification/verify-enforcer-contracts.sh#L92-L96
delegation-framework/script/verification/verify-enforcer-contracts.sh
Lines 92 to 96 in 73ca695
Bug: Unreachable Hooks and Missing Prank Directive
Multiple afterAllHook calls are unreachable as they immediately follow an expectRevert statement. Additionally, one of these unreachable calls is missing a vm.prank(dm) directive, which would lead to an incorrect msg.sender and flawed BalanceTracker logic if the code were reachable.
test/enforcers/ERC20TotalBalanceChangeEnforcer.t.sol#L376-L380
delegation-framework/test/enforcers/ERC20TotalBalanceChangeEnforcer.t.sol
Lines 376 to 380 in 73ca695
test/enforcers/ERC20TotalBalanceChangeEnforcer.t.sol#L442-L445
delegation-framework/test/enforcers/ERC20TotalBalanceChangeEnforcer.t.sol
Lines 442 to 445 in 73ca695
test/enforcers/ERC20TotalBalanceChangeEnforcer.t.sol#L467-L470
delegation-framework/test/enforcers/ERC20TotalBalanceChangeEnforcer.t.sol
Lines 467 to 470 in 73ca695
Was this report helpful? Give feedback by reacting with 👍 or 👎
|
I can't approve it because I created the PR, but it looks good to me. Thanks @MoMannn |
What?
ERC20TotalBalanceChangeEnforcerERC721TotalBalanceChangeEnforcerERC1155TotalBalanceChangeEnforcerNativeTotalBalanceChangeEnforcerThese enforcers can enforce balance change across a delegation chain where multiple same enforcers are present.
Why?
How?
beforeAllHookandafterAllHook: These hooks enable proper handling of inner delegations and ensure all enforcers in the chain are processed together.BalanceTrackerstruct that accumulates the expected increases and decreases for a specific recipient + token combination across all enforcers in the delegation chain.afterAllHookcombines all expected changes and validates the total net change against the actual balance change.