Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init ccipReader e2e tests #1203

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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 contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ compileContract ccip/NonceManager.sol
# Test helpers
compileContract ccip/test/helpers/BurnMintERC677Helper.sol
compileContract ccip/test/helpers/CommitStoreHelper.sol
compileContract ccip/test/helpers/CCIPReaderTester.sol
compileContract ccip/test/helpers/MessageHasher.sol
compileContract ccip/test/helpers/ReportCodec.sol
compileContract ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol
Expand Down
64 changes: 64 additions & 0 deletions contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;

contract CCIPReaderTester {
struct SourceChainConfig {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we can use the struct directly:

import {EVM2EVMMultiOffRamp} from "../../offRamp/EVM2EVMMultiOffRamp.sol";

Usage:

EVM2EVMMultiOffRamp.SourceChainConfig

bool isEnabled;
uint64 minSeqNr;
bytes onRamp;
}

struct EVM2AnyRampMessage {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we can use the structs directly, they are already defined:

import {Internal} from "../../libraries/Internal.sol";

Would it cause issues off-chain if we use the full EVM2AnyRampMessage struct? (for the header - the struct is exactly as you've defined it in L16-22 so we can definitely de-dupe it)

RampMessageHeader header;
address sender;
}

struct RampMessageHeader {
bytes32 messageId;
uint64 sourceChainSelector;
uint64 destChainSelector;
uint64 sequenceNumber;
uint64 nonce;
}

mapping(uint64 sourceChainSelector => SourceChainConfig sourceChainConfig) internal s_sourceChainConfigs;

function getSourceChainConfig(uint64 sourceChainSelector) external view returns (SourceChainConfig memory) {
return s_sourceChainConfigs[sourceChainSelector];
}

function setSourceChainConfig(uint64 sourceChainSelector, SourceChainConfig memory sourceChainConfig) external {
s_sourceChainConfigs[sourceChainSelector] = sourceChainConfig;
}

event CCIPSendRequested(uint64 indexed destChainSelector, EVM2AnyRampMessage message);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I think you might also be able to use the event directly without re-defining it: EVM2EVMMultiOffRamp.CCIPSendRequested

Though this might be limited to test files


function EmitCCIPSendRequested(uint64 destChainSelector, EVM2AnyRampMessage memory message) external {
emit CCIPSendRequested(destChainSelector, message);
}

enum MessageExecutionState {
UNTOUCHED,
IN_PROGRESS,
SUCCESS,
FAILURE
}

event ExecutionStateChanged(
uint64 indexed sourceChainSelector,
uint64 indexed sequenceNumber,
bytes32 indexed messageId,
MessageExecutionState state,
bytes returnData
);

function EmitExecutionStateChanged(
uint64 sourceChainSelector,
uint64 sequenceNumber,
bytes32 messageId,
MessageExecutionState state,
bytes memory returnData
) external {
emit ExecutionStateChanged(sourceChainSelector, sequenceNumber, messageId, state, returnData);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading