From 73b8fb8809c0f770b144863c35ec317f4d97257f Mon Sep 17 00:00:00 2001 From: krehermann <16602512+krehermann@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:46:01 -0700 Subject: [PATCH] code comments --- deployment/keystone/changeset/compatiblity.go | 45 ++++++++++++++++--- .../keystone/changeset/deploy_forwarder.go | 12 ++--- deployment/keystone/changeset/helpers_test.go | 2 +- .../keystone/changeset/internal/deploy.go | 1 - 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/deployment/keystone/changeset/compatiblity.go b/deployment/keystone/changeset/compatiblity.go index fc2d8d6c04f..7f18d40f6ee 100644 --- a/deployment/keystone/changeset/compatiblity.go +++ b/deployment/keystone/changeset/compatiblity.go @@ -2,46 +2,77 @@ package changeset import "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" -type GetContractSetsRequest = internal.GetContractSetsRequest -type GetContractSetsResponse = internal.GetContractSetsResponse +//TODO: KS-673 refactor internal package to reduce and remove the duplication -var GetContractSets = internal.GetContractSets - -// func GetContractSets internal.GetContractSets +// OracleConfig is the configuration for an oracle type OracleConfig = internal.OracleConfig +// FeedConsumer is a feed consumer contract type var FeedConsumer = internal.FeedConsumer + +// KeystoneForwarder is a keystone forwarder contract type var KeystoneForwarder = internal.KeystoneForwarder +// GetContractSetsRequest is a request to get contract sets +type GetContractSetsRequest = internal.GetContractSetsRequest + +// GetContractSetsResponse is a response to get contract sets +type GetContractSetsResponse = internal.GetContractSetsResponse + +// GetContractSets gets contract sets +var GetContractSets = internal.GetContractSets + +// RegisterCapabilitiesRequest is a request to register capabilities type RegisterCapabilitiesRequest = internal.RegisterCapabilitiesRequest + +// RegisterCapabilitiesResponse is a response to register capabilities type RegisterCapabilitiesResponse = internal.RegisterCapabilitiesResponse +// RegisterCapabilities registers capabilities var RegisterCapabilities = internal.RegisterCapabilities +// RegisterNOPSRequest is a request to register NOPS type RegisterNOPSRequest = internal.RegisterNOPSRequest + +// RegisterNOPSResponse is a response to register NOPS type RegisterNOPSResponse = internal.RegisterNOPSResponse +// RegisterNOPS registers NOPS var RegisterNOPS = internal.RegisterNOPS +// RegisterNodesRequest is a request to register nodes with the capabilities registry type RegisterNodesRequest = internal.RegisterNodesRequest + +// RegisterNodesResponse is a response to register nodes with the capabilities registry type RegisterNodesResponse = internal.RegisterNodesResponse +// RegisterNodes registers nodes with the capabilities registry var RegisterNodes = internal.RegisterNodes +// RegisteredCapability is a wrapper of a capability and its ID type RegisteredCapability = internal.RegisteredCapability +// FromCapabilitiesRegistryCapability converts a capabilities registry capability to a registered capability var FromCapabilitiesRegistryCapability = internal.FromCapabilitiesRegistryCapability +// RegisterDonsRequest is a request to register Dons with the capabilities registry type RegisterDonsRequest = internal.RegisterDonsRequest + +// RegisterDonsResponse is a response to register Dons with the capabilities registry type RegisterDonsResponse = internal.RegisterDonsResponse +// RegisterDons registers Dons with the capabilities registry var RegisterDons = internal.RegisterDons +// DONToRegister is the minimal information needed to register a DON with the capabilities registry type DONToRegister = internal.DONToRegister +// ConfigureContractsRequest is a request to configure ALL the contracts type ConfigureContractsRequest = internal.ConfigureContractsRequest + +// ConfigureContractsResponse is a response to configure ALL the contracts type ConfigureContractsResponse = internal.ConfigureContractsResponse +// DonCapabilities is a set of capabilities hosted by a set of node operators +// in is in a convenient form to handle the CLO representation of the nop data type DonCapabilities = internal.DonCapabilities - -//var DeployForwarder = internal.DeployForwarder diff --git a/deployment/keystone/changeset/deploy_forwarder.go b/deployment/keystone/changeset/deploy_forwarder.go index 8922ed09d10..b2dab1bda08 100644 --- a/deployment/keystone/changeset/deploy_forwarder.go +++ b/deployment/keystone/changeset/deploy_forwarder.go @@ -10,7 +10,7 @@ import ( "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) var _ deployment.ChangeSet[DeployForwarderRequest] = DeployForwarder @@ -35,7 +35,7 @@ func DeployForwarder(env deployment.Environment, cfg DeployForwarderRequest) (de return deployment.ChangesetOutput{}, fmt.Errorf("chain with selector %d not found", sel) } lggr.Infow("deploying forwarder", "chainSelector", chain.Selector) - forwarderResp, err := kslib.DeployForwarder(chain, ab) + forwarderResp, err := internal.DeployForwarder(chain, ab) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to deploy KeystoneForwarder to chain selector %d: %w", chain.Selector, err) } @@ -69,7 +69,7 @@ func (r ConfigureForwardContractsRequest) UseMCMS() bool { } func ConfigureForwardContracts(env deployment.Environment, req ConfigureForwardContractsRequest) (deployment.ChangesetOutput, error) { - wfDon, err := kslib.NewRegisteredDon(env, kslib.RegisteredDonConfig{ + wfDon, err := internal.NewRegisteredDon(env, internal.RegisteredDonConfig{ NodeIDs: req.WFNodeIDs, Name: req.WFDonName, RegistryChainSel: req.RegistryChainSel, @@ -77,15 +77,15 @@ func ConfigureForwardContracts(env deployment.Environment, req ConfigureForwardC if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create registered don: %w", err) } - r, err := kslib.ConfigureForwardContracts(&env, kslib.ConfigureForwarderContractsRequest{ - Dons: []kslib.RegisteredDon{*wfDon}, + r, err := internal.ConfigureForwardContracts(&env, internal.ConfigureForwarderContractsRequest{ + Dons: []internal.RegisteredDon{*wfDon}, UseMCMS: req.UseMCMS(), }) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to configure forward contracts: %w", err) } - cresp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + cresp, err := internal.GetContractSets(env.Logger, &internal.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/helpers_test.go b/deployment/keystone/changeset/helpers_test.go index 72ea44c11e5..c75a73b4e81 100644 --- a/deployment/keystone/changeset/helpers_test.go +++ b/deployment/keystone/changeset/helpers_test.go @@ -140,7 +140,7 @@ func SetupTestEnv(t *testing.T, c TestConfig) TestEnv { }, { Changeset: commonchangeset.WrapChangeSet(kschangeset.DeployForwarder), - Config: registryChainSel, + Config: kschangeset.DeployForwarderRequest{}, }, }) require.NoError(t, err) diff --git a/deployment/keystone/changeset/internal/deploy.go b/deployment/keystone/changeset/internal/deploy.go index e9a45e31374..f3393026d63 100644 --- a/deployment/keystone/changeset/internal/deploy.go +++ b/deployment/keystone/changeset/internal/deploy.go @@ -619,7 +619,6 @@ type RegisterNodesResponse struct { // registerNodes registers the nodes with the registry. it assumes that the deployer key in the Chain // can sign the transactions update the contract state -// TODO: 467 refactor to support MCMS. Specifically need to separate the call data generation from the actual contract call func RegisterNodes(lggr logger.Logger, req *RegisterNodesRequest) (*RegisterNodesResponse, error) { registry, registryChain, err := GetRegistryContract(req.Env, req.RegistryChainSelector) if err != nil {