Skip to content

Commit

Permalink
contracts-bedrock: Add test to ensure delayed vetoable returns the co…
Browse files Browse the repository at this point in the history
…rrect data (#8725)
  • Loading branch information
maurelian committed Dec 21, 2023
1 parent 313596d commit 21d2413
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/contracts-bedrock/test/L1/DelayedVetoable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,31 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
success2;
}

function testFuzz_handleCall_forwardingTargetRetValue_succeeds(
bytes calldata inData,
bytes calldata outData
)
external
{
assumeNoClash(inData);

// Initiate the call
vm.prank(initiator);
(bool success,) = address(delayedVetoable).call(inData);
success;

vm.warp(block.timestamp + operatingDelay);
vm.expectEmit(true, false, false, true, address(delayedVetoable));
emit Forwarded(keccak256(inData), inData);

vm.mockCall(target, inData, outData);

// Forward the call
(bool success2, bytes memory retData) = address(delayedVetoable).call(inData);
assertTrue(success2);
assertEq(keccak256(retData), keccak256(outData));
}

/// @dev A test documenting the single instance in which the contract is not 'transparent' to the initiator.
function testFuzz_handleCall_queuedAtClash_reverts(bytes memory outData) external {
// This will get us calldata with the same function selector as the queuedAt function, but
Expand Down

0 comments on commit 21d2413

Please sign in to comment.