Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell/custom-dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Custom Dictionary Words
Aptos
CCTP
Devnet
hashv
idls
Expand Down
9 changes: 9 additions & 0 deletions evm/src/libraries/ExecutorMessages.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ library ExecutorMessages {
bytes4 private constant REQ_MM = "ERM1";
bytes4 private constant REQ_VAA_V1 = "ERV1";
bytes4 private constant REQ_NTT_V1 = "ERN1";
bytes4 private constant REQ_CCTP_V1 = "ERC1";

/// @notice Payload length will not fit in a uint32.
/// @dev Selector: 492f620d.
Expand Down Expand Up @@ -54,4 +55,12 @@ library ExecutorMessages {
{
return abi.encodePacked(REQ_NTT_V1, srcChain, srcManager, messageId);
}

/// @notice Encodes a version 1 CCTP request payload.
/// @param sourceDomain The source chain for the CCTP transfer.
/// @param nonce The nonce of the CCTP transfer.
/// @return bytes The encoded request.
function makeCCTPv1Request(uint32 sourceDomain, uint64 nonce) internal pure returns (bytes memory) {
return abi.encodePacked(REQ_CCTP_V1, sourceDomain, nonce);
}
}
8 changes: 8 additions & 0 deletions evm/test/ExecutorMessages.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ contract ExecutorMessagesTest is Test {
bytes memory buf = ExecutorMessages.makeNTTv1Request(srcChain, srcManager, messageId);
assertEq(keccak256(expected), keccak256(buf));
}

function test_makeCCTPv1Request() public pure {
uint32 srcDomain = 7;
uint64 nonce = 42;
bytes memory expected = abi.encodePacked("ERC1", srcDomain, nonce);
bytes memory buf = ExecutorMessages.makeCCTPv1Request(srcDomain, nonce);
assertEq(keccak256(expected), keccak256(buf));
}
}
Loading