-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changes from all commits
7344b9f
1a67785
cacaacd
28cf284
cb2ea3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]), | ||
}) | ||
}) | ||
} | ||
} | ||
|
@@ -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], | ||
) | ||
}) | ||
} | ||
} | ||
|
@@ -185,19 +193,50 @@ 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
if executionState == EXECUTION_STATE_SUCCESS { | ||
t.Logf("Observed SUCCESS execution state on chain %d (offramp %s) from chain %d with expected sequence number %d", | ||
dest.Selector, offRamp.Address().String(), source.Selector, expectedSeqNr) | ||
return nil | ||
} | ||
Comment on lines
+202
to
+206
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding this because in the flakes I observed the following phenomenon:
i.e even before subscribing it seems that we successfully executed some messages. The subscription never ended up picking up these logs and relaying them to the channel. So this is hopefully going to aid in those cases. |
||
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) | ||
} | ||
} | ||
} | ||
|
||
const ( | ||
EXECUTION_STATE_UNTOUCHED = 0 | ||
EXECUTION_STATE_INPROGRESS = 1 | ||
EXECUTION_STATE_SUCCESS = 2 | ||
EXECUTION_STATE_FAILURE = 3 | ||
) | ||
|
||
func executionStateToString(state uint8) string { | ||
switch state { | ||
case EXECUTION_STATE_UNTOUCHED: | ||
return "UNTOUCHED" | ||
case EXECUTION_STATE_INPROGRESS: | ||
return "IN_PROGRESS" | ||
case EXECUTION_STATE_SUCCESS: | ||
return "SUCCESS" | ||
case EXECUTION_STATE_FAILURE: | ||
return "FAILURE" | ||
default: | ||
return "UNKNOWN" | ||
} | ||
} |
There was a problem hiding this comment.
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.