Skip to content

Commit

Permalink
[BCF-3143] multiple address bindings (#13992)
Browse files Browse the repository at this point in the history
* complete support and implementation for multiple addresses

* update feeds to pass contract downstream

* address comments and errors

* update ccip dep

* update deps

* update deps

* update ccip dep

* address comments

* address more comments

* Update core/capabilities/ccip/delegate.go

Co-authored-by: Jordan Krage <[email protected]>

* fix issue from github commit

---------

Co-authored-by: Jordan Krage <[email protected]>
  • Loading branch information
EasterTheBunny and jmank88 authored Sep 9, 2024
1 parent 0efcf38 commit c1878f7
Show file tree
Hide file tree
Showing 52 changed files with 3,203 additions and 1,630 deletions.
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 @@ func bindReader(ctx context.Context,
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{
Address: capRegAddress,
Name: consts.ContractNameCapabilitiesRegistry,
}

err = reader.Bind(ctx, []types.BoundContract{boundContract})
if err != nil {
return nil, types.BoundContract{}, fmt.Errorf("failed to bind home chain contract reader: %w", err)
}
Expand All @@ -319,9 +319,15 @@ func bindReader(ctx context.Context,
}

var ccipCapabilityInfo kcr.CapabilitiesRegistryCapabilityInfo
err = reader.GetLatestValue(ctx, consts.ContractNameCapabilitiesRegistry, consts.MethodNameGetCapability, primitives.Unconfirmed, map[string]any{
"hashedId": hid,
}, &ccipCapabilityInfo)
err = reader.GetLatestValue(
ctx,
boundContract.ReadIdentifier(consts.MethodNameGetCapability),
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

0 comments on commit c1878f7

Please sign in to comment.