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

integration-tests/deployment/ccip: fix assertion fns #14482

Merged
merged 5 commits into from
Sep 18, 2024
Merged
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
75 changes: 50 additions & 25 deletions integration-tests/deployment/ccip/test_assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ func ConfirmCommitForAllWithExpectedSeqNums(
srcChain := srcChain
dstChain := dstChain
wg.Go(func() error {
return func(src, dest uint64) error {
var startBlock *uint64
if startBlocks != nil {
startBlock = startBlocks[dest]
}
return ConfirmCommitWithExpectedSeqNumRange(t, srcChain, dstChain, state.Chains[dest].OffRamp, startBlock,
ccipocr3.SeqNumRange{ccipocr3.SeqNum(expectedSeqNums[dest]), ccipocr3.SeqNum(expectedSeqNums[dest])})
}(src, dest)
var startBlock *uint64
if startBlocks != nil {
startBlock = startBlocks[dstChain.Selector]
}
return ConfirmCommitWithExpectedSeqNumRange(
t,
srcChain,
dstChain,
state.Chains[dstChain.Selector].OffRamp,
startBlock,
ccipocr3.SeqNumRange{
ccipocr3.SeqNum(expectedSeqNums[dstChain.Selector]),
ccipocr3.SeqNum(expectedSeqNums[dstChain.Selector]),
Comment on lines +51 to +52
Copy link
Contributor

@winder winder Sep 18, 2024

Choose a reason for hiding this comment

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

Input should probably be expectedSeqNums map[uint64]SeqNumRange since we'll need that eventually.

})
})
}
}
Expand Down Expand Up @@ -131,16 +137,18 @@ func ConfirmExecWithSeqNrForAll(
srcChain := srcChain
dstChain := dstChain
wg.Go(func() error {
return func(src, dest deployment.Chain) error {
var startBlock *uint64
if startBlocks != nil {
startBlock = startBlocks[dest.Selector]
}
return ConfirmExecWithSeqNr(
t, src, dest, state.Chains[dest.Selector].OffRamp, startBlock,
expectedSeqNums[dstChain.Selector],
)
}(srcChain, dstChain)
var startBlock *uint64
if startBlocks != nil {
startBlock = startBlocks[dstChain.Selector]
}
return ConfirmExecWithSeqNr(
t,
srcChain,
dstChain,
state.Chains[dstChain.Selector].OffRamp,
startBlock,
expectedSeqNums[dstChain.Selector],
)
})
}
}
Expand Down Expand Up @@ -185,19 +193,36 @@ func ConfirmExecWithSeqNr(
if err != nil {
return fmt.Errorf("error to get source chain config : %w", err)
}
t.Logf("Waiting for ExecutionStateChanged on chain %d from chain %d with expected sequence number %d, current onchain minSeqNr: %d",
dest.Selector, source.Selector, expectedSeqNr, scc.MinSeqNr)
executionState, err := offRamp.GetExecutionState(nil, source.Selector, expectedSeqNr)
if err != nil {
return fmt.Errorf("error to get execution state : %w", err)
}
t.Logf("Waiting for ExecutionStateChanged on chain %d (offramp %s) from chain %d with expected sequence number %d, current onchain minSeqNr: %d, execution state: %s",
dest.Selector, offRamp.Address().String(), source.Selector, expectedSeqNr, scc.MinSeqNr, executionStateToString(executionState))
Comment on lines +200 to +201
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding these logs to aid in test debugging - in case the log fetching is (for whatever reason) not working.

case execEvent := <-sink:
if execEvent.SequenceNumber == expectedSeqNr && execEvent.SourceChainSelector == source.Selector {
t.Logf("Received ExecutionStateChanged on chain %d from chain %d with expected sequence number %d",
dest.Selector, source.Selector, expectedSeqNr)
t.Logf("Received ExecutionStateChanged on chain %d (offramp %s) from chain %d with expected sequence number %d",
dest.Selector, offRamp.Address().String(), source.Selector, expectedSeqNr)
return nil
}
case <-timer.C:
return fmt.Errorf("timed out waiting for ExecutionStateChanged on chain %d from chain %d with expected sequence number %d",
dest.Selector, source.Selector, expectedSeqNr)
return fmt.Errorf("timed out waiting for ExecutionStateChanged on chain %d (offramp %s) from chain %d with expected sequence number %d",
dest.Selector, offRamp.Address().String(), source.Selector, expectedSeqNr)
case subErr := <-subscription.Err():
return fmt.Errorf("Subscription error: %w", subErr)
return fmt.Errorf("subscription error: %w", subErr)
}
}
}

func executionStateToString(state uint8) string {
switch state {
case 0:
return "UNTOUCHED"
case 1:
return "IN_PROGRESS"
case 2:
return "SUCCESS"
default:
return "FAILURE"
}
}
Loading