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

Init ccipReader e2e tests #1203

wants to merge 4 commits into from

Conversation

dimkouv
Copy link
Contributor

@dimkouv dimkouv commented Jul 17, 2024

Init test helper contract and add e2e test for ccipReader NextSeqNum method.

Copy link
Contributor

github-actions bot commented Jul 17, 2024

LCOV of commit 2e516fa during Solidity Foundry #6648

Summary coverage rate:
  lines......: 98.7% (1851 of 1876 lines)
  functions..: 96.3% (341 of 354 functions)
  branches...: 90.3% (791 of 876 branches)

Files changed coverage rate: n/a

go.sum Outdated
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240708100035-6d7cad39cc74 h1:dsRsqoCRF+SrIvARgJXs6RQcJ6oGfh3XigIfrrEWO2E=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240708100035-6d7cad39cc74/go.mod h1:gyODeD1uMobe5VWRwVRiEXzL9wUzFTI80VvyCNLqWcw=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240716114142-65c4a791cd3d h1:k4+p4XTsws++V369bWzfnEut3A5mxKxqbMBZKfIF/2I=
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a make gomodtidy

},
})
assert.NoError(t, err)
err = cr.Start(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

One liner for this is good. Also using require makes it stop instead of continuing with the rest of the tests afterwards and failing all of them making the logs pretty noisy.

Suggested change
err = cr.Start(ctx)
require.NoError(t, cr.Start(ctx))

Copy link
Contributor

Choose a reason for hiding this comment

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

Same applies for the rest of the test

Comment on lines +164 to +165
contractAddr common.Address
contract *ccip_reader_tester.CCIPReaderTester
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit,
Remove address as you already can get it from the contract like contract.Address()
rename contract for readability

Suggested change
contractAddr common.Address
contract *ccip_reader_tester.CCIPReaderTester
ccipTester *ccip_reader_tester.CCIPReaderTester

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)

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

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

evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types"
)

func TestCCIPReader_CommitReportsGTETimestamp(t *testing.T) {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: tests are empty - missing TODOs?

for sourceChain, seqNum := range onChainSeqNums {
_, err := contract.SetSourceChainConfig(auth, uint64(sourceChain), ccip_reader_tester.CCIPReaderTesterSourceChainConfig{
IsEnabled: true,
MinSeqNr: uint64(seqNum),
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: minSeqNr is actually not settable on the OffRamp. Does it make sense to set it in the tests?

@dimkouv dimkouv closed this Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants