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

[BCF-3143] multiple address bindings #13992

Merged
merged 11 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
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
5 changes: 5 additions & 0 deletions .changeset/short-candles-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal `ContractReader` interface update to accept `BoundContract` for all methods
11 changes: 9 additions & 2 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,13 @@ packages:
interfaces:
ExternalInitiatorManager:
HTTPClient:
github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/read:
config:
dir: "{{ .InterfaceDir }}/mocks"
interfaces:
Registrar:
Reader:
BatchCaller:
github.com/smartcontractkit/chainlink/v2/core/sessions:
interfaces:
BasicAdminUsersORM:
Expand All @@ -341,7 +348,7 @@ packages:
Codec:
config:
dir: core/services/relay/evm/mocks
ChainReader:
ContractReader:
ChainWriter:
github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp:
config:
Expand Down Expand Up @@ -581,4 +588,4 @@ packages:
mockname: "Mock{{ .InterfaceName }}"
github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer:
interfaces:
ORM:
ORM:
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ func testSetup(ctx context.Context, t *testing.T, readerChain, destChain cciptyp

contractReaders := map[cciptypes.ChainSelector]contractreader.Extended{readerChain: extendedCr}
contractWriters := make(map[cciptypes.ChainSelector]types.ChainWriter)
reader := ccipreaderpkg.NewCCIPReaderWithExtendedContractReaders(lggr, contractReaders, contractWriters, destChain)
reader := ccipreaderpkg.NewCCIPReaderWithExtendedContractReaders(lggr, contractReaders, contractWriters, destChain, nil)

t.Cleanup(func() {
require.NoError(t, cr.Close())
Expand Down
24 changes: 15 additions & 9 deletions core/capabilities/ccip/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@
capabilityLabelledName,
capabilityVersion string,
) (boundReader types.ContractReader, ccipConfigBinding types.BoundContract, err error) {
err = reader.Bind(ctx, []types.BoundContract{
{
Address: capRegAddress,
Name: consts.ContractNameCapabilitiesRegistry,
},
})
boundContract := types.BoundContract{

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / goreleaser-build-publish-chainlink

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_fuzz)

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / lint

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Flakey Test Detection

boundContract declared and not used

Check failure on line 306 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Analyze go

boundContract declared and not used
Address: capRegAddress,
Name: consts.ContractNameCapabilitiesRegistry,
}

err = reader.Bind(ctx, []types.BoundContract{binding})

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / goreleaser-build-publish-chainlink

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_fuzz)

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / lint

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Flakey Test Detection

undefined: binding

Check failure on line 311 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Analyze go

undefined: binding
if err != nil {
return nil, types.BoundContract{}, fmt.Errorf("failed to bind home chain contract reader: %w", err)
}
Expand All @@ -319,9 +319,15 @@
}

var ccipCapabilityInfo kcr.CapabilitiesRegistryCapabilityInfo
err = reader.GetLatestValue(ctx, consts.ContractNameCapabilitiesRegistry, consts.MethodNameGetCapability, primitives.Unconfirmed, map[string]any{
"hashedId": hid,
}, &ccipCapabilityInfo)
err = reader.GetLatestValue(
ctx,
binding.ReadIdentifier(consts.MethodNameGetCapability),

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / goreleaser-build-publish-chainlink

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_fuzz)

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / lint

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Flakey Test Detection

undefined: binding

Check failure on line 324 in core/capabilities/ccip/delegate.go

View workflow job for this annotation

GitHub Actions / Analyze go

undefined: binding
primitives.Unconfirmed,
map[string]any{
"hashedId": hid,
},
&ccipCapabilityInfo,
)
if err != nil {
return nil, types.BoundContract{}, fmt.Errorf("failed to get CCIP capability info from chain reader: %w", err)
}
Expand Down
Loading
Loading