Skip to content

Commit

Permalink
Test_CCIPMessaging_Solana skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jan 21, 2025
1 parent 52ecab8 commit 2274b90
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions integration-tests/smoke/ccip/ccip_messaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,72 @@ func Test_CCIPMessaging(t *testing.T) {
})
}

func Test_CCIPMessaging_Solana(t *testing.T) {
// Setup 2 chains (EVM and Solana) and a single lane.
ctx := changeset.Context(t)
e, _ := testsetups.NewIntegrationEnvironment(t, changeset.WithSolChains(1))

state, err := changeset.LoadOnchainState(e.Env)
require.NoError(t, err)

allChainSelectors := maps.Keys(e.Env.Chains)
allSolChainSelectors := maps.Keys(e.Env.SolChains)
sourceChain := allChainSelectors[0]
destChain := allSolChainSelectors[1]
t.Log("All chain selectors:", allChainSelectors,
", sol chain selectors:", allSolChainSelectors,
", home chain selector:", e.HomeChainSel,
", feed chain selector:", e.FeedChainSel,
", source chain selector:", sourceChain,
", dest chain selector:", destChain,
)
// connect a single lane, source to dest
changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, sourceChain, destChain, false)

var (
replayed bool
nonce uint64
sender = common.LeftPadBytes(e.Env.Chains[sourceChain].DeployerKey.From.Bytes(), 32)
out messagingTestCaseOutput
setup = testCaseSetup{
t: t,
sender: sender,
deployedEnv: e,
onchainState: state,
sourceChain: sourceChain,
destChain: destChain,
}
)

t.Run("message to contract implementing CCIPReceiver", func(t *testing.T) {
latestHead, err := e.Env.Chains[destChain].Client.HeaderByNumber(ctx, nil)
require.NoError(t, err)
receiver := state.SolChains[destChain].SolCcipReceiver.Bytes()
out = runMessagingTestCase(
messagingTestCase{
testCaseSetup: setup,
replayed: replayed,
nonce: nonce,
},
receiver,
[]byte("hello CCIPReceiver"),
nil, // default extraArgs
changeset.EXECUTION_STATE_SUCCESS,
func(t *testing.T) {
iter, err := state.Chains[destChain].Receiver.FilterMessageReceived(&bind.FilterOpts{
Context: ctx,
Start: latestHead.Number.Uint64(),
})
require.NoError(t, err)
require.True(t, iter.Next())
// MessageReceived doesn't emit the data unfortunately, so can't check that.
},
)
})

fmt.Printf("out: %v\n", out)
}

func manuallyExecute(
ctx context.Context,
t *testing.T,
Expand Down

0 comments on commit 2274b90

Please sign in to comment.