Skip to content

Commit 02b8e0b

Browse files
committed
use pluginNext in unit e2e tests
1 parent 314d0fa commit 02b8e0b

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

commit/plugin_e2e_test.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func TestPlugin_E2E_AllNodesAgree_MerkleRoots(t *testing.T) {
236236
if i == 0 {
237237
reportCodec = n.reportCodec
238238
}
239-
prepareCcipReaderMock(n.ccipReader, false, tc.enableDiscovery, true)
239+
prepareCcipReaderMock(n.ccipReader, false, tc.enableDiscovery, true, 0)
240240

241241
if len(tc.offRampNextSeqNumDefaultOverrideKeys) > 0 {
242242
require.Equal(t, len(tc.offRampNextSeqNumDefaultOverrideKeys), len(tc.offRampNextSeqNumDefaultOverrideValues))
@@ -284,6 +284,7 @@ func TestPlugin_E2E_AllNodesAgree_TokenPrices(t *testing.T) {
284284
mockPriceReader func(*readerpkg_mock.MockPriceReader)
285285
expTransmittedReports []ccipocr3.CommitPluginReport
286286
enableDiscovery bool
287+
onChainPriceSeqNr uint64
287288
}{
288289
{
289290
name: "empty fee_quoter token updates, should select all token prices for update",
@@ -334,15 +335,16 @@ func TestPlugin_E2E_AllNodesAgree_TokenPrices(t *testing.T) {
334335
{
335336
name: "prices already inflight, no prices to report",
336337
prevOutcome: committypes.Outcome{
337-
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 1, RemainingPriceChecks: 4},
338+
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 4, RemainingPriceChecks: 4},
338339
},
339340
mockPriceReader: func(m *readerpkg_mock.MockPriceReader) {},
340341
expOutcome: committypes.Outcome{
341342
MerkleRootOutcome: merkleOutcome,
342343
TokenPriceOutcome: tokenprice.Outcome{},
343-
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 1, RemainingPriceChecks: 3},
344+
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 4, RemainingPriceChecks: 3},
344345
},
345346
expTransmittedReports: []ccipocr3.CommitPluginReport{},
347+
onChainPriceSeqNr: 2,
346348
},
347349
{
348350
name: "fresh tokens don't need new updates",
@@ -444,7 +446,7 @@ func TestPlugin_E2E_AllNodesAgree_TokenPrices(t *testing.T) {
444446
reportCodec = n.reportCodec
445447
}
446448

447-
prepareCcipReaderMock(n.ccipReader, true, false, true)
449+
prepareCcipReaderMock(n.ccipReader, true, false, true, tc.onChainPriceSeqNr)
448450
tc.mockPriceReader(n.priceReader)
449451
}
450452

@@ -492,6 +494,7 @@ func TestPlugin_E2E_AllNodesAgree_ChainFee(t *testing.T) {
492494
prevOutcome committypes.Outcome
493495
expOutcome committypes.Outcome
494496
expTransmittedReportLen int
497+
onChainPriceSeqNr uint64
495498

496499
mockCCIPReader func(*readerpkg_mock.MockCCIPReader)
497500
}{
@@ -560,17 +563,18 @@ func TestPlugin_E2E_AllNodesAgree_ChainFee(t *testing.T) {
560563
{
561564
name: "fee components should not be updated when there's a subset of chains but we wait for prices",
562565
prevOutcome: committypes.Outcome{
563-
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 1, RemainingPriceChecks: 4},
566+
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 3, RemainingPriceChecks: 4},
564567
},
565568
expOutcome: committypes.Outcome{
566569
MerkleRootOutcome: merkleOutcome,
567-
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 1, RemainingPriceChecks: 3},
570+
MainOutcome: committypes.MainOutcome{InflightPriceOcrSequenceNumber: 3, RemainingPriceChecks: 3},
568571
},
569572
expTransmittedReportLen: 0,
570573
mockCCIPReader: func(m *readerpkg_mock.MockCCIPReader) {
571574
m.EXPECT().GetLatestPriceSeqNr(mock.Anything).Unset()
572-
m.EXPECT().GetLatestPriceSeqNr(mock.Anything).Return(0, nil).Maybe()
575+
m.EXPECT().GetLatestPriceSeqNr(mock.Anything).Return(2, nil).Maybe()
573576
},
577+
onChainPriceSeqNr: 2,
574578
},
575579
{
576580
name: "fee components should not be updated within deviation",
@@ -688,7 +692,7 @@ func TestPlugin_E2E_AllNodesAgree_ChainFee(t *testing.T) {
688692
n := setupNode(paramsCp)
689693
nodes[i] = n.node
690694

691-
prepareCcipReaderMock(n.ccipReader, true, false, false)
695+
prepareCcipReaderMock(n.ccipReader, true, false, false, tc.onChainPriceSeqNr)
692696

693697
preparePriceReaderMock(n.priceReader)
694698

@@ -724,6 +728,7 @@ func prepareCcipReaderMock(
724728
mockEmptySeqNrs bool,
725729
enableDiscovery bool,
726730
mockChainFee bool,
731+
onChainPriceSeqNr uint64,
727732
) {
728733
if mockChainFee {
729734
ccipReader.EXPECT().
@@ -735,7 +740,7 @@ func prepareCcipReaderMock(
735740
}
736741
ccipReader.EXPECT().
737742
GetLatestPriceSeqNr(mock.Anything).
738-
Return(0, nil).Maybe()
743+
Return(onChainPriceSeqNr, nil).Maybe()
739744
ccipReader.EXPECT().
740745
GetChainFeePriceUpdate(mock.Anything, mock.Anything).
741746
Return(map[ccipocr3.ChainSelector]ccipocr3.TimestampedBig{}).Maybe()
@@ -1003,6 +1008,7 @@ func defaultNodeParams(t *testing.T) SetupNodeParams {
10031008
MerkleRootAsyncObserverDisabled: true, // we want to keep it disabled since this test is deterministic
10041009
ChainFeeAsyncObserverDisabled: true,
10051010
TokenPriceAsyncObserverDisabled: true,
1011+
EnableDonBreakingChanges: true,
10061012
}
10071013

10081014
reportingCfg := ocr3types.ReportingPluginConfig{F: 1, ConfigDigest: digest}

0 commit comments

Comments
 (0)