Skip to content

Commit

Permalink
Address message replay
Browse files Browse the repository at this point in the history
  • Loading branch information
yorhodes committed Feb 12, 2025
1 parent 57137da commit bd1e263
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion solidity/contracts/hooks/CCIPHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ contract CCIPHook is AbstractMessageIdAuthHook {
receiver: abi.encode(ism),
data: abi.encode(message.id()),
tokenAmounts: new Client.EVMTokenAmount[](0),
extraArgs: "",
extraArgs: Client._argsToBytes(
Client.EVMExtraArgsV2({
gasLimit: 60_000,
allowOutOfOrderExecution: true
})
),
feeToken: address(0)
});
}
Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/isms/hook/CCIPIsm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract CCIPIsm is AbstractMessageIdAuthorizedIsm, CCIPReceiver {
require(sender == authorizedHook, "Unauthorized hook");

bytes32 messageId = abi.decode(any2EvmMessage.data, (bytes32));
preVerifyMessage(messageId, msg.value);
preVerifyMessage(messageId, 0);

Check warning on line 64 in solidity/contracts/isms/hook/CCIPIsm.sol

View check run for this annotation

Codecov / codecov/patch

solidity/contracts/isms/hook/CCIPIsm.sol#L64

Added line #L64 was not covered by tests
}

function _isAuthorized() internal view override returns (bool) {
Expand Down
3 changes: 3 additions & 0 deletions solidity/test/isms/CCIPIsm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ contract CCIPIsmTest is Test {
Client.Any2EVMMessage memory message = _encodeCCIPReceiveMessage();

vm.prank(OP_ROUTER_ADDRESS);
uint256 beforeCall = gasleft();
ccipISMOptimism.ccipReceive(message);
uint256 afterCall = gasleft();
console.log("Gas used: ", beforeCall - afterCall);

assertTrue(ccipISMOptimism.verifiedMessages(messageId).isBitSet(255));
}
Expand Down

0 comments on commit bd1e263

Please sign in to comment.