chore: low-hanging deviations in integ tests#2135
chore: low-hanging deviations in integ tests#2135jcsec-security wants to merge 8 commits intodraft-v31from
Conversation
|
Open question:
|
| function test_handleFinalizeBaseTokenBridgingOnL2_revertUnauthorized() public { | ||
| vm.prank(address(0xDEAD)); | ||
| vm.expectRevert(); | ||
| vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, address(0xDEAD))); |
There was a problem hiding this comment.
maybe makes sense to make a dedicated constants for 0xdead?
There was a problem hiding this comment.
We can just add address constant RAND_ADDRESS = address(0xDEAD); to a new TestConstants.sol, for example at l1-contracts/test/foundry . We can also use foundry labeling through address randomAddress = makeAddr("randomAddress");, it gives clearer traces but we will have to sprinkle it around the test-suite.
| assertEq(BridgedStandardERC20(l2TokenAddress).symbol(), TOKEN_DEFAULT_SYMBOL); | ||
| assertEq(BridgedStandardERC20(l2TokenAddress).decimals(), TOKEN_DEFAULT_DECIMALS); | ||
|
|
||
| // Verify Transfer event (mint: from address(0) to receiver) |
There was a problem hiding this comment.
can we use standard foundry assertions for events?
if not, is it possible to make a standalone function for checking these events? So that it could reused in the future
There was a problem hiding this comment.
I think not, as these events are not emitted by the fn being called, but by subsequent calls along the line, that is why I was using vm.getRecordedLogs and then iterating over the contents.
I added a library in l1-contracts/test/foundry/l1/integration/utils/, please check and let me know.
What ❔
Part of the hardening efforts to adhere to the new testing guidelines. Limited to our current integration tests.
vm.expectRevert()instaces.assert*statements instead of require for outcome validation for consistency.L2GatewayTestAbstract.t.sol139-140 did not validate anything in reality, as the values of those variables were manually set in ln 117 andSharedL2ContractDeployer.sol:101Checklist