Skip to content

Commit

Permalink
code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
krehermann committed Dec 18, 2024
1 parent c6f4799 commit 73b8fb8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
45 changes: 38 additions & 7 deletions deployment/keystone/changeset/compatiblity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 6 additions & 6 deletions deployment/keystone/changeset/deploy_forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down Expand Up @@ -69,23 +69,23 @@ 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,
})
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,
})
Expand Down
2 changes: 1 addition & 1 deletion deployment/keystone/changeset/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion deployment/keystone/changeset/internal/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 73b8fb8

Please sign in to comment.