Skip to content

Commit

Permalink
take new code
Browse files Browse the repository at this point in the history
  • Loading branch information
krehermann committed Nov 4, 2024
1 parent 59e4b19 commit de7b7b0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deployment/keystone/changeset/append_node_capbilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (req *AppendNodeCapabilitiesRequest) convert(e deployment.Environment) (*in
if !ok {
return nil, fmt.Errorf("registry chain selector %d does not exist in environment", req.RegistryChainSel)
}
contracts, err := kslib.GetContractSets(&kslib.GetContractSetsRequest{
contracts, err := kslib.GetContractSets(e.Logger, &kslib.GetContractSetsRequest{
Chains: map[uint64]deployment.Chain{req.RegistryChainSel: registryChain},
AddressBook: req.AddressBook,
})
Expand Down
2 changes: 1 addition & 1 deletion deployment/keystone/changeset/update_node_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (req *UpdateNodeCapabilitiesRequest) updateNodeCapabilitiesImplRequest(e de
if !ok {
return nil, fmt.Errorf("registry chain selector %d does not exist in environment", req.RegistryChainSel)
}
contracts, err := kslib.GetContractSets(&kslib.GetContractSetsRequest{
contracts, err := kslib.GetContractSets(e.Logger, &kslib.GetContractSetsRequest{
Chains: map[uint64]deployment.Chain{req.RegistryChainSel: registryChain},
AddressBook: req.AddressBook,
})
Expand Down
2 changes: 1 addition & 1 deletion deployment/keystone/changeset/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var _ deployment.ViewState = ViewKeystone

func ViewKeystone(e deployment.Environment) (json.Marshaler, error) {
state, err := keystone.GetContractSets(&keystone.GetContractSetsRequest{
state, err := keystone.GetContractSets(e.Logger, &keystone.GetContractSetsRequest{
Chains: e.Chains,
AddressBook: e.ExistingAddresses,
})
Expand Down
8 changes: 4 additions & 4 deletions deployment/keystone/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func ConfigureRegistry(ctx context.Context, lggr logger.Logger, req ConfigureCon
return nil, fmt.Errorf("chain %d not found in environment", req.RegistryChainSel)
}

contractSetsResp, err := GetContractSets(&GetContractSetsRequest{
contractSetsResp, err := GetContractSets(req.Env.Logger, &GetContractSetsRequest{
Chains: req.Env.Chains,
AddressBook: addrBook,
})
Expand Down Expand Up @@ -244,7 +244,7 @@ func ConfigureRegistry(ctx context.Context, lggr logger.Logger, req ConfigureCon
// ConfigureForwardContracts configures the forwarder contracts on all chains for the given DONS
// the address book is required to contain the an address of the deployed forwarder contract for every chain in the environment
func ConfigureForwardContracts(env *deployment.Environment, dons []RegisteredDon, addrBook deployment.AddressBook) error {
contractSetsResp, err := GetContractSets(&GetContractSetsRequest{
contractSetsResp, err := GetContractSets(env.Logger, &GetContractSetsRequest{
Chains: env.Chains,
AddressBook: addrBook,
})
Expand Down Expand Up @@ -279,7 +279,7 @@ func ConfigureOCR3Contract(env *deployment.Environment, chainSel uint64, dons []
return fmt.Errorf("chain %d not found in environment", chainSel)
}

contractSetsResp, err := GetContractSets(&GetContractSetsRequest{
contractSetsResp, err := GetContractSets(env.Logger, &GetContractSetsRequest{
Chains: env.Chains,
AddressBook: addrBook,
})
Expand Down Expand Up @@ -319,7 +319,7 @@ func ConfigureOCR3ContractFromCLO(env *deployment.Environment, chainSel uint64,
if !ok {
return fmt.Errorf("chain %d not found in environment", chainSel)
}
contractSetsResp, err := GetContractSets(&GetContractSetsRequest{
contractSetsResp, err := GetContractSets(env.Logger, &GetContractSetsRequest{
Chains: env.Chains,
AddressBook: addrBook,
})
Expand Down
2 changes: 1 addition & 1 deletion deployment/keystone/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestDeploy(t *testing.T) {
AddressBook: ad,
}

contractSetsResp, err := keystone.GetContractSets(req)
contractSetsResp, err := keystone.GetContractSets(lggr, req)
require.NoError(t, err)
require.Len(t, contractSetsResp.ContractSets, len(env.Chains))
// check the registry
Expand Down
10 changes: 6 additions & 4 deletions deployment/keystone/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/ethereum/go-ethereum/common"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink/deployment"
common_v1_0 "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0"
"github.com/smartcontractkit/chainlink/deployment/keystone/view"
Expand Down Expand Up @@ -40,7 +41,7 @@ func (cs ContractSet) View() (view.KeystoneChainView, error) {
return out, nil
}

func GetContractSets(req *GetContractSetsRequest) (*GetContractSetsResponse, error) {
func GetContractSets(lggr logger.Logger, req *GetContractSetsRequest) (*GetContractSetsResponse, error) {
resp := &GetContractSetsResponse{
ContractSets: make(map[uint64]ContractSet),
}
Expand All @@ -49,7 +50,7 @@ func GetContractSets(req *GetContractSetsRequest) (*GetContractSetsResponse, err
if err != nil {
return nil, fmt.Errorf("failed to get addresses for chain %d: %w", id, err)
}
cs, err := loadContractSet(chain, addrs)
cs, err := loadContractSet(lggr, chain, addrs)
if err != nil {
return nil, fmt.Errorf("failed to load contract set for chain %d: %w", id, err)
}
Expand All @@ -58,7 +59,7 @@ func GetContractSets(req *GetContractSetsRequest) (*GetContractSetsResponse, err
return resp, nil
}

func loadContractSet(chain deployment.Chain, addresses map[string]deployment.TypeAndVersion) (*ContractSet, error) {
func loadContractSet(lggr logger.Logger, chain deployment.Chain, addresses map[string]deployment.TypeAndVersion) (*ContractSet, error) {
var out ContractSet

for addr, tv := range addresses {
Expand All @@ -83,7 +84,8 @@ func loadContractSet(chain deployment.Chain, addresses map[string]deployment.Typ
}
out.OCR3 = c
default:
return nil, fmt.Errorf("unknown contract type %s", tv.Type)
lggr.Warnw("unknown contract type", "type", tv.Type)
// ignore unknown contract types
}
}
return &out, nil
Expand Down

0 comments on commit de7b7b0

Please sign in to comment.