Skip to content

Commit eb39ec4

Browse files
ogtownsendarchseer
andauthored
Add config poller V2 implementation for use with ChainAccessor (#1136)
* Add config poller V2 impl * delete README and add TODO * add some documentation to config poller v2 * implement fetchFreshSourceChainConfigsViaAccessor * migrate getFeeQuoterTokenPriceUSD to use accessor * goimports * Attempt to fix integration test issues * Use v17 since that's the expected pg_dump version * Revert back to v16 * Work around preparetest issues --------- Co-authored-by: Blaž Hrastnik <[email protected]>
1 parent 1ac44ca commit eb39ec4

21 files changed

+2496
-698
lines changed

.github/actions/setup-postgres/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
ports:
55
- "5432:5432"
66
container_name: cl_pg
7-
image: postgres:14-alpine
7+
image: postgres:16-alpine
88
command: postgres ${POSTGRES_OPTIONS}
99
env_file:
1010
- .env

.github/workflows/ccip-integration-test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,18 @@ jobs:
201201
run: |
202202
cd $GITHUB_WORKSPACE/chainlink
203203
go build -o ccip.test .
204+
# TEMP: workaround issues with db schema pinning (https://github.com/smartcontractkit/capabilities/pull/234)
205+
# - name: Setup DB
206+
# run: |
207+
# cd $GITHUB_WORKSPACE/chainlink
208+
# ./ccip.test local db preparetest
209+
# env:
210+
# CL_DATABASE_URL: ${{ env.DB_URL }}
204211
- name: Setup DB
212+
shell: bash
205213
run: |
206-
cd $GITHUB_WORKSPACE/chainlink
207-
./ccip.test local db preparetest
214+
go get github.com/smartcontractkit/chainlink/v2/core/store/cmd/preparetest@d2c56f4161f3431268cb52e717a77b7ea7dcef09
215+
go run github.com/smartcontractkit/chainlink/v2/core/store/cmd/preparetest
208216
env:
209217
CL_DATABASE_URL: ${{ env.DB_URL }}
210218
- name: Run ${{ matrix.type.name }}

commit/merkleroot/observation_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
common_mock "github.com/smartcontractkit/chainlink-ccip/mocks/internal_/plugincommon"
3838
reader_mock "github.com/smartcontractkit/chainlink-ccip/mocks/pkg/reader"
3939
readerpkg_mock "github.com/smartcontractkit/chainlink-ccip/mocks/pkg/reader"
40-
"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
4140
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"
4241
)
4342

@@ -205,7 +204,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
205204
chainSupport.EXPECT().KnownSourceChainsSlice().Return(knownSourceChains, nil)
206205
ccipReader := reader_mock.NewMockCCIPReader(t)
207206
ccipReader.EXPECT().NextSeqNum(mock.Anything, knownSourceChains).Return(nextSeqNums, nil)
208-
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(reader.CurseInfo{}, nil)
207+
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(cciptypes.CurseInfo{}, nil)
209208
return chainSupport, ccipReader
210209
},
211210
expResult: []plugintypes.SeqNumChain{
@@ -259,7 +258,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
259258

260259
ccipReader.EXPECT().NextSeqNum(mock.Anything, knownSourceChains).Return(nextSeqNumsCp, nil)
261260
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).
262-
Return(reader.CurseInfo{}, nil)
261+
Return(cciptypes.CurseInfo{}, nil)
263262
return chainSupport, ccipReader
264263
},
265264
expResult: []plugintypes.SeqNumChain{
@@ -274,7 +273,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
274273
chainSupport.EXPECT().SupportsDestChain(nodeID).Return(true, nil)
275274
chainSupport.EXPECT().KnownSourceChainsSlice().Return(knownSourceChains, nil)
276275
ccipReader := reader_mock.NewMockCCIPReader(t)
277-
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(reader.CurseInfo{
276+
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(cciptypes.CurseInfo{
278277
CursedSourceChains: nil,
279278
CursedDestination: true,
280279
GlobalCurse: false,
@@ -289,7 +288,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
289288
chainSupport.EXPECT().SupportsDestChain(nodeID).Return(true, nil)
290289
chainSupport.EXPECT().KnownSourceChainsSlice().Return(knownSourceChains, nil)
291290
ccipReader := reader_mock.NewMockCCIPReader(t)
292-
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(reader.CurseInfo{
291+
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(cciptypes.CurseInfo{
293292
CursedSourceChains: nil,
294293
CursedDestination: false,
295294
GlobalCurse: true,
@@ -313,7 +312,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
313312
ccipReader.EXPECT().NextSeqNum(mock.Anything, knownSourceChainsExcludingCursed).
314313
Return(nextSeqNumsExcludingCursed, nil)
315314

316-
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(reader.CurseInfo{
315+
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(cciptypes.CurseInfo{
317316
CursedSourceChains: cursedSourceChains,
318317
CursedDestination: false,
319318
GlobalCurse: false,
@@ -336,7 +335,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
336335
chainSupport.EXPECT().KnownSourceChainsSlice().Return(knownSourceChains, nil)
337336
ccipReader := reader_mock.NewMockCCIPReader(t)
338337

339-
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(reader.CurseInfo{
338+
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(cciptypes.CurseInfo{
340339
CursedSourceChains: cursedSourceChains,
341340
CursedDestination: false,
342341
GlobalCurse: false,
@@ -353,7 +352,7 @@ func Test_ObserveOffRampNextSeqNums(t *testing.T) {
353352
ccipReader := reader_mock.NewMockCCIPReader(t)
354353

355354
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).
356-
Return(reader.CurseInfo{}, fmt.Errorf("some error"))
355+
Return(cciptypes.CurseInfo{}, fmt.Errorf("some error"))
357356
return chainSupport, ccipReader
358357
},
359358
},

commit/plugin_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ func prepareCcipReaderMock(
747747
GetContractAddress(mock.Anything, mock.Anything).
748748
Return(ccipocr3.Bytes{1}, nil).Maybe()
749749
ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).
750-
Return(reader2.CurseInfo{}, nil).Maybe()
750+
Return(ccipocr3.CurseInfo{}, nil).Maybe()
751751
ccipReader.EXPECT().GetOffRampSourceChainsConfig(mock.Anything, mock.Anything).
752752
Return(sourceChainConfigs, nil).Maybe()
753753

commit/plugin_roledon_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func TestPlugin_RoleDonE2E_NoPrevOutcome(t *testing.T) {
112112
// Dest Chain Expectations - Makes sure only oracles that support the destination chain are reading it.
113113
{
114114
if oracleChains.Contains(s.destChain) {
115-
deps.ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(ccipreader.CurseInfo{}, nil)
115+
deps.ccipReader.EXPECT().GetRmnCurseInfo(mock.Anything).Return(cciptypes.CurseInfo{}, nil)
116116

117117
nextSeqNums := make(map[cciptypes.ChainSelector]cciptypes.SeqNum)
118118
for _, ch := range s.sourceChains {

execute/observation.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/smartcontractkit/chainlink-ccip/execute/exectypes"
1818
dt "github.com/smartcontractkit/chainlink-ccip/internal/plugincommon/discovery/discoverytypes"
1919
"github.com/smartcontractkit/chainlink-ccip/pkg/logutil"
20-
"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
2120
)
2221

2322
// Observation collects data across two phases which happen in separate rounds.
@@ -130,11 +129,11 @@ func (p *Plugin) Observation(
130129
return p.ocrTypeCodec.EncodeObservation(observation)
131130
}
132131

133-
func (p *Plugin) getCurseInfo(ctx context.Context, lggr logger.Logger) (reader.CurseInfo, error) {
132+
func (p *Plugin) getCurseInfo(ctx context.Context, lggr logger.Logger) (cciptypes.CurseInfo, error) {
134133
curseInfo, err := p.ccipReader.GetRmnCurseInfo(ctx)
135134
if err != nil {
136135
lggr.Errorw("get rmn curse info: rmn read error", "err", err)
137-
return reader.CurseInfo{}, fmt.Errorf("get rmn curse info: rmn read error: %w", err)
136+
return cciptypes.CurseInfo{}, fmt.Errorf("get rmn curse info: rmn read error: %w", err)
138137
}
139138

140139
return curseInfo, nil

execute/plugin_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import (
4242
reader_mock "github.com/smartcontractkit/chainlink-ccip/mocks/internal_/reader"
4343
readerpkg_mock "github.com/smartcontractkit/chainlink-ccip/mocks/pkg/reader"
4444
"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
45-
reader2 "github.com/smartcontractkit/chainlink-ccip/pkg/reader"
4645
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"
4746
)
4847

@@ -1210,7 +1209,7 @@ func TestPlugin_Observation_EligibilityCheckFailure(t *testing.T) {
12101209

12111210
mockCCIPReader.EXPECT().
12121211
GetRmnCurseInfo(mock.Anything).
1213-
Return(reader2.CurseInfo{}, nil).Maybe()
1212+
Return(cciptypes.CurseInfo{}, nil).Maybe()
12141213

12151214
// Create a simplified plugin structure that will test the eligibility failure
12161215
// This removes the dependency on actual cache implementations
@@ -1645,7 +1644,7 @@ func TestPlugin_ShouldAcceptAttestedReport_ShouldAccept(t *testing.T) {
16451644
) {
16461645
mockReader := basicCCIPReader()
16471646
mockReader.EXPECT().GetRmnCurseInfo(mock.Anything).
1648-
Return(reader2.CurseInfo{
1647+
Return(cciptypes.CurseInfo{
16491648
CursedSourceChains: map[cciptypes.ChainSelector]bool{
16501649
cciptypes.ChainSelector(sourceChain): false,
16511650
}}, nil)
@@ -1667,7 +1666,7 @@ func TestPlugin_ShouldAcceptAttestedReport_ShouldAccept(t *testing.T) {
16671666
) {
16681667
mockReader := basicCCIPReader()
16691668
mockReader.EXPECT().GetRmnCurseInfo(mock.Anything).
1670-
Return(reader2.CurseInfo{}, fmt.Errorf("test error"))
1669+
Return(cciptypes.CurseInfo{}, fmt.Errorf("test error"))
16711670

16721671
homeChain := basicHomeChain()
16731672
codec := basicMockCodec()
@@ -1687,7 +1686,7 @@ func TestPlugin_ShouldAcceptAttestedReport_ShouldAccept(t *testing.T) {
16871686
) {
16881687
mockReader := basicCCIPReader()
16891688
mockReader.EXPECT().GetRmnCurseInfo(mock.Anything).
1690-
Return(reader2.CurseInfo{GlobalCurse: true}, nil)
1689+
Return(cciptypes.CurseInfo{GlobalCurse: true}, nil)
16911690

16921691
homeChain := basicHomeChain()
16931692
codec := basicMockCodec()
@@ -1707,7 +1706,7 @@ func TestPlugin_ShouldAcceptAttestedReport_ShouldAccept(t *testing.T) {
17071706
) {
17081707
mockReader := basicCCIPReader()
17091708
mockReader.EXPECT().GetRmnCurseInfo(mock.Anything).
1710-
Return(reader2.CurseInfo{CursedDestination: true}, nil)
1709+
Return(cciptypes.CurseInfo{CursedDestination: true}, nil)
17111710

17121711
homeChain := basicHomeChain()
17131712
codec := basicMockCodec()
@@ -1727,7 +1726,7 @@ func TestPlugin_ShouldAcceptAttestedReport_ShouldAccept(t *testing.T) {
17271726
) {
17281727
mockReader := basicCCIPReader()
17291728
mockReader.EXPECT().GetRmnCurseInfo(mock.Anything).
1730-
Return(reader2.CurseInfo{CursedSourceChains: map[cciptypes.ChainSelector]bool{
1729+
Return(cciptypes.CurseInfo{CursedSourceChains: map[cciptypes.ChainSelector]bool{
17311730
cciptypes.ChainSelector(sourceChain): true,
17321731
},
17331732
}, nil)

internal/mocks/inmem/ccipreader_inmem.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ func (r InMemoryCCIPReader) GetRMNRemoteConfig(ctx context.Context) (cciptypes.R
204204
return cciptypes.RemoteConfig{}, nil
205205
}
206206

207-
func (r InMemoryCCIPReader) GetRmnCurseInfo(ctx context.Context) (reader.CurseInfo, error) {
208-
return reader.CurseInfo{
207+
func (r InMemoryCCIPReader) GetRmnCurseInfo(ctx context.Context) (cciptypes.CurseInfo, error) {
208+
return cciptypes.CurseInfo{
209209
CursedSourceChains: map[cciptypes.ChainSelector]bool{},
210210
CursedDestination: false,
211211
GlobalCurse: false,

mocks/pkg/reader/ccip_reader.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)