Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
connorwstein committed Dec 18, 2024
1 parent ab08090 commit 9d870e1
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 69 deletions.
68 changes: 34 additions & 34 deletions deployment/ccip/changeset/cs_ccip_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ func DefaultOCRParams(
type PromoteAllCandidatesChangesetConfig struct {
HomeChainSelector uint64

// DONChainSelectors is the chain selector of the DONs that we want to promote the candidate config of.
// RemoteChainSelectors is the chain selector of the DONs that we want to promote the candidate config of.
// Note that each (chain, ccip capability version) pair has a unique DON ID.
DONChainSelectors []uint64
RemoteChainSelectors []uint64

// MCMS is optional MCMS configuration, if provided the changeset will generate an MCMS proposal.
// If nil, the changeset will execute the commands directly using the deployer key
Expand All @@ -136,7 +136,7 @@ func (p PromoteAllCandidatesChangesetConfig) Validate(e deployment.Environment)
}

var donIDs []uint32
for _, chainSelector := range p.DONChainSelectors {
for _, chainSelector := range p.RemoteChainSelectors {
if err := deployment.IsValidChainSelector(chainSelector); err != nil {
return nil, fmt.Errorf("don chain selector invalid: %w", err)
}
Expand All @@ -158,7 +158,7 @@ func (p PromoteAllCandidatesChangesetConfig) Validate(e deployment.Environment)
return nil, fmt.Errorf("fetch don id for chain: %w", err)
}
if donID == 0 {
return nil, fmt.Errorf("don doesn't exist in CR for chain %d", p.DONChainSelectors)
return nil, fmt.Errorf("don doesn't exist in CR for chain %d", p.RemoteChainSelectors)
}
// Check that candidate digest and active digest are not both zero - this is enforced onchain.
commitConfigs, err := state.Chains[p.HomeChainSelector].CCIPHome.GetAllConfigs(&bind.CallOpts{
Expand Down Expand Up @@ -282,8 +282,8 @@ type SetCandidateConfigBase struct {
HomeChainSelector uint64
FeedChainSelector uint64

// DONChainSelector is the chain selector of the chain where the DON will be added.
DONChainSelector map[uint64]CCIPOCRParams
// OCRConfigPerRemoteChainSelector is the chain selector of the chain where the DON will be added.
OCRConfigPerRemoteChainSelector map[uint64]CCIPOCRParams

// Only set one plugin at a time. TODO
// come back and allow both.
Expand All @@ -310,7 +310,7 @@ func (s SetCandidateConfigBase) Validate(e deployment.Environment, state CCIPOnC
return err
}

for chainSelector, params := range s.DONChainSelector {
for chainSelector, params := range s.OCRConfigPerRemoteChainSelector {
if err := deployment.IsValidChainSelector(chainSelector); err != nil {
return fmt.Errorf("don chain selector invalid: %w", err)
}
Expand Down Expand Up @@ -341,7 +341,7 @@ func (s SetCandidateConfigBase) Validate(e deployment.Environment, state CCIPOnC
}

// TODO: validate token config in the commit config, if commit is the plugin.
// TODO: validate gas config in the chain config in cciphome for this DONChainSelectors.
// TODO: validate gas config in the chain config in cciphome for this RemoteChainSelectors.
}
if len(e.NodeIDs) == 0 {
return fmt.Errorf("nodeIDs must be set")
Expand Down Expand Up @@ -373,7 +373,7 @@ func (a AddDonAndSetCandidateChangesetConfig) Validate(e deployment.Environment,
return err
}

for chainSelector := range a.DONChainSelector {
for chainSelector := range a.OCRConfigPerRemoteChainSelector {
// check if a DON already exists for this chain
donID, err := internal.DonIDForChain(
state.Chains[a.HomeChainSelector].CapabilityRegistry,
Expand Down Expand Up @@ -425,7 +425,7 @@ func AddDonAndSetCandidateChangeset(
txOpts = deployment.SimTransactOpts()
}
var donOps []mcms.Operation
for chainSelector, params := range cfg.DONChainSelector {
for chainSelector, params := range cfg.OCRConfigPerRemoteChainSelector {
newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome(
e.OCRSecrets,
state.Chains[chainSelector].OffRamp,
Expand Down Expand Up @@ -556,7 +556,7 @@ func (s SetCandidateChangesetConfig) Validate(e deployment.Environment, state CC
}

chainToDonIDs := make(map[uint64]uint32)
for chainSelector := range s.DONChainSelector {
for chainSelector := range s.OCRConfigPerRemoteChainSelector {
donID, err := internal.DonIDForChain(
state.Chains[s.HomeChainSelector].CapabilityRegistry,
state.Chains[s.HomeChainSelector].CCIPHome,
Expand Down Expand Up @@ -600,7 +600,7 @@ func SetCandidateChangeset(
txOpts = deployment.SimTransactOpts()
}
var setCandidateOps []mcms.Operation
for chainSelector, params := range cfg.DONChainSelector {
for chainSelector, params := range cfg.OCRConfigPerRemoteChainSelector {
newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome(
e.OCRSecrets,
state.Chains[chainSelector].OffRamp,
Expand Down Expand Up @@ -834,9 +834,9 @@ func promoteAllCandidatesForChainOps(
type RevokeCandidateChangesetConfig struct {
HomeChainSelector uint64

// DONChainSelector is the chain selector whose candidate config we want to revoke.
DONChainSelector uint64
PluginType types.PluginType
// RemoteChainSelector is the chain selector whose candidate config we want to revoke.
RemoteChainSelector uint64
PluginType types.PluginType

// MCMS is optional MCMS configuration, if provided the changeset will generate an MCMS proposal.
// If nil, the changeset will execute the commands directly using the deployer key
Expand All @@ -848,7 +848,7 @@ func (r RevokeCandidateChangesetConfig) Validate(e deployment.Environment, state
if err := deployment.IsValidChainSelector(r.HomeChainSelector); err != nil {
return 0, fmt.Errorf("home chain selector invalid: %w", err)
}
if err := deployment.IsValidChainSelector(r.DONChainSelector); err != nil {
if err := deployment.IsValidChainSelector(r.RemoteChainSelector); err != nil {
return 0, fmt.Errorf("don chain selector invalid: %w", err)
}
if len(e.NodeIDs) == 0 {
Expand All @@ -872,13 +872,13 @@ func (r RevokeCandidateChangesetConfig) Validate(e deployment.Environment, state
donID, err = internal.DonIDForChain(
state.Chains[r.HomeChainSelector].CapabilityRegistry,
state.Chains[r.HomeChainSelector].CCIPHome,
r.DONChainSelector,
r.RemoteChainSelector,
)
if err != nil {
return 0, fmt.Errorf("fetch don id for chain: %w", err)
}
if donID == 0 {
return 0, fmt.Errorf("don doesn't exist in CR for chain %d", r.DONChainSelector)
return 0, fmt.Errorf("don doesn't exist in CR for chain %d", r.RemoteChainSelector)
}

// check that candidate digest is not zero - this is enforced onchain.
Expand Down Expand Up @@ -943,7 +943,7 @@ func RevokeCandidateChangeset(e deployment.Environment, cfg RevokeCandidateChang
ChainIdentifier: mcms.ChainIdentifier(cfg.HomeChainSelector),
Batch: ops,
}},
fmt.Sprintf("revokeCandidate for don %d", cfg.DONChainSelector),
fmt.Sprintf("revokeCandidate for don %d", cfg.RemoteChainSelector),
cfg.MCMS.MinDelay,
)
if err != nil {
Expand Down Expand Up @@ -1019,14 +1019,14 @@ func revokeCandidateOps(
type ChainConfig struct {
Readers [][32]byte
FChain uint8
EncodableChainConifg chainconfig.ChainConfig
EncodableChainConfig chainconfig.ChainConfig
}

type UpdateChainConfigConfig struct {
HomeChainSelector uint64
ChainRemoves []uint64
ChainAdds map[uint64]ChainConfig
MCMS *MCMSConfig
HomeChainSelector uint64
RemoteChainRemoves []uint64
RemoteChainAdds map[uint64]ChainConfig
MCMS *MCMSConfig
}

func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error {
Expand All @@ -1037,7 +1037,7 @@ func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error {
if err := deployment.IsValidChainSelector(c.HomeChainSelector); err != nil {
return fmt.Errorf("home chain selector invalid: %w", err)
}
if len(c.ChainRemoves) == 0 && len(c.ChainAdds) == 0 {
if len(c.RemoteChainRemoves) == 0 && len(c.RemoteChainAdds) == 0 {
return fmt.Errorf("no chain adds or removes")
}
homeChainState, exists := state.Chains[c.HomeChainSelector]
Expand All @@ -1047,15 +1047,15 @@ func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error {
if err := commoncs.ValidateOwnership(e.GetContext(), c.MCMS != nil, e.Chains[c.HomeChainSelector].DeployerKey.From, homeChainState.Timelock.Address(), homeChainState.CCIPHome); err != nil {
return err
}
for _, remove := range c.ChainRemoves {
for _, remove := range c.RemoteChainRemoves {
if err := deployment.IsValidChainSelector(remove); err != nil {
return fmt.Errorf("chain remove selector invalid: %w", err)
}
if _, ok := state.SupportedChains()[remove]; !ok {
return fmt.Errorf("chain to remove %d is not supported", remove)
}
}
for add, ccfg := range c.ChainAdds {
for add, ccfg := range c.RemoteChainAdds {
if err := deployment.IsValidChainSelector(add); err != nil {
return fmt.Errorf("chain remove selector invalid: %w", err)
}
Expand Down Expand Up @@ -1086,11 +1086,11 @@ func UpdateChainConfig(e deployment.Environment, cfg UpdateChainConfigConfig) (d
txOpts = deployment.SimTransactOpts()
}
var adds []ccip_home.CCIPHomeChainConfigArgs
for chain, ccfg := range cfg.ChainAdds {
for chain, ccfg := range cfg.RemoteChainAdds {
encodedChainConfig, err := chainconfig.EncodeChainConfig(chainconfig.ChainConfig{
GasPriceDeviationPPB: ccfg.EncodableChainConifg.GasPriceDeviationPPB,
DAGasPriceDeviationPPB: ccfg.EncodableChainConifg.DAGasPriceDeviationPPB,
OptimisticConfirmations: ccfg.EncodableChainConifg.OptimisticConfirmations,
GasPriceDeviationPPB: ccfg.EncodableChainConfig.GasPriceDeviationPPB,
DAGasPriceDeviationPPB: ccfg.EncodableChainConfig.DAGasPriceDeviationPPB,
OptimisticConfirmations: ccfg.EncodableChainConfig.OptimisticConfirmations,
})
if err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("encoding chain config: %w", err)
Expand All @@ -1117,13 +1117,13 @@ func UpdateChainConfig(e deployment.Environment, cfg UpdateChainConfigConfig) (d
})
}

tx, err := state.Chains[cfg.HomeChainSelector].CCIPHome.ApplyChainConfigUpdates(txOpts, cfg.ChainRemoves, adds)
tx, err := state.Chains[cfg.HomeChainSelector].CCIPHome.ApplyChainConfigUpdates(txOpts, cfg.RemoteChainRemoves, adds)
if cfg.MCMS == nil {
_, err = deployment.ConfirmIfNoError(e.Chains[cfg.HomeChainSelector], tx, err)
if err != nil {
return deployment.ChangesetOutput{}, err
}
e.Logger.Infof("Updated chain config on chain %d removes %v, adds %v", cfg.HomeChainSelector, cfg.ChainRemoves, cfg.ChainAdds)
e.Logger.Infof("Updated chain config on chain %d removes %v, adds %v", cfg.HomeChainSelector, cfg.RemoteChainRemoves, cfg.RemoteChainAdds)
return deployment.ChangesetOutput{}, nil
}

Expand All @@ -1150,7 +1150,7 @@ func UpdateChainConfig(e deployment.Environment, cfg UpdateChainConfigConfig) (d
if err != nil {
return deployment.ChangesetOutput{}, err
}
e.Logger.Infof("Proposed chain config update on chain %d removes %v, adds %v", cfg.HomeChainSelector, cfg.ChainRemoves, cfg.ChainAdds)
e.Logger.Infof("Proposed chain config update on chain %d removes %v, adds %v", cfg.HomeChainSelector, cfg.RemoteChainRemoves, cfg.RemoteChainAdds)
return deployment.ChangesetOutput{Proposals: []timelock.MCMSWithTimelockProposal{
*p,
}}, nil
Expand Down
46 changes: 23 additions & 23 deletions deployment/ccip/changeset/cs_ccip_home_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ func Test_PromoteCandidate(t *testing.T) {
{
Changeset: commonchangeset.WrapChangeSet(PromoteAllCandidatesChangeset),
Config: PromoteAllCandidatesChangesetConfig{
HomeChainSelector: tenv.HomeChainSel,
DONChainSelectors: []uint64{dest},
MCMS: mcmsConfig,
HomeChainSelector: tenv.HomeChainSel,
RemoteChainSelectors: []uint64{dest},
MCMS: mcmsConfig,
},
},
})
Expand Down Expand Up @@ -180,7 +180,7 @@ func Test_SetCandidate(t *testing.T) {
SetCandidateConfigBase: SetCandidateConfigBase{
HomeChainSelector: tenv.HomeChainSel,
FeedChainSelector: tenv.FeedChainSel,
DONChainSelector: map[uint64]CCIPOCRParams{
OCRConfigPerRemoteChainSelector: map[uint64]CCIPOCRParams{
dest: DefaultOCRParams(
tenv.FeedChainSel,
tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken, state.Chains[dest].Weth9),
Expand All @@ -198,7 +198,7 @@ func Test_SetCandidate(t *testing.T) {
SetCandidateConfigBase: SetCandidateConfigBase{
HomeChainSelector: tenv.HomeChainSel,
FeedChainSelector: tenv.FeedChainSel,
DONChainSelector: map[uint64]CCIPOCRParams{
OCRConfigPerRemoteChainSelector: map[uint64]CCIPOCRParams{
dest: DefaultOCRParams(
tenv.FeedChainSel,
tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken, state.Chains[dest].Weth9),
Expand Down Expand Up @@ -301,7 +301,7 @@ func Test_RevokeCandidate(t *testing.T) {
SetCandidateConfigBase: SetCandidateConfigBase{
HomeChainSelector: tenv.HomeChainSel,
FeedChainSelector: tenv.FeedChainSel,
DONChainSelector: map[uint64]CCIPOCRParams{
OCRConfigPerRemoteChainSelector: map[uint64]CCIPOCRParams{
dest: DefaultOCRParams(
tenv.FeedChainSel,
tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken, state.Chains[dest].Weth9),
Expand All @@ -319,7 +319,7 @@ func Test_RevokeCandidate(t *testing.T) {
SetCandidateConfigBase: SetCandidateConfigBase{
HomeChainSelector: tenv.HomeChainSel,
FeedChainSelector: tenv.FeedChainSel,
DONChainSelector: map[uint64]CCIPOCRParams{
OCRConfigPerRemoteChainSelector: map[uint64]CCIPOCRParams{
dest: DefaultOCRParams(
tenv.FeedChainSel,
tokenConfig.GetTokenInfo(logger.TestLogger(t), state.Chains[dest].LinkToken, state.Chains[dest].Weth9),
Expand Down Expand Up @@ -360,19 +360,19 @@ func Test_RevokeCandidate(t *testing.T) {
{
Changeset: commonchangeset.WrapChangeSet(RevokeCandidateChangeset),
Config: RevokeCandidateChangesetConfig{
HomeChainSelector: tenv.HomeChainSel,
DONChainSelector: dest,
PluginType: types.PluginTypeCCIPCommit,
MCMS: mcmsConfig,
HomeChainSelector: tenv.HomeChainSel,
RemoteChainSelector: dest,
PluginType: types.PluginTypeCCIPCommit,
MCMS: mcmsConfig,
},
},
{
Changeset: commonchangeset.WrapChangeSet(RevokeCandidateChangeset),
Config: RevokeCandidateChangesetConfig{
HomeChainSelector: tenv.HomeChainSel,
DONChainSelector: dest,
PluginType: types.PluginTypeCCIPExec,
MCMS: mcmsConfig,
HomeChainSelector: tenv.HomeChainSel,
RemoteChainSelector: dest,
PluginType: types.PluginTypeCCIPExec,
MCMS: mcmsConfig,
},
},
})
Expand Down Expand Up @@ -473,10 +473,10 @@ func Test_UpdateChainConfigs(t *testing.T) {
{
Changeset: commonchangeset.WrapChangeSet(UpdateChainConfig),
Config: UpdateChainConfigConfig{
HomeChainSelector: tenv.HomeChainSel,
ChainRemoves: []uint64{otherChain},
ChainAdds: make(map[uint64]ChainConfig),
MCMS: mcmsConfig,
HomeChainSelector: tenv.HomeChainSel,
RemoteChainRemoves: []uint64{otherChain},
RemoteChainAdds: make(map[uint64]ChainConfig),
MCMS: mcmsConfig,
},
},
})
Expand All @@ -497,11 +497,11 @@ func Test_UpdateChainConfigs(t *testing.T) {
{
Changeset: commonchangeset.WrapChangeSet(UpdateChainConfig),
Config: UpdateChainConfigConfig{
HomeChainSelector: tenv.HomeChainSel,
ChainRemoves: []uint64{},
ChainAdds: map[uint64]ChainConfig{
HomeChainSelector: tenv.HomeChainSel,
RemoteChainRemoves: []uint64{},
RemoteChainAdds: map[uint64]ChainConfig{
otherChain: {
EncodableChainConifg: chainconfig.ChainConfig{
EncodableChainConfig: chainconfig.ChainConfig{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(internal.GasPriceDeviationPPB)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(internal.DAGasPriceDeviationPPB)},
OptimisticConfirmations: internal.OptimisticConfirmations,
Expand Down
24 changes: 12 additions & 12 deletions deployment/ccip/changeset/test_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test
chainConfigs[chain] = ChainConfig{
Readers: nodeInfo.NonBootstraps().PeerIDs(),
FChain: uint8(len(nodeInfo.NonBootstraps().PeerIDs()) / 3),
EncodableChainConifg: chainconfig.ChainConfig{
EncodableChainConfig: chainconfig.ChainConfig{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(internal.GasPriceDeviationPPB)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(internal.DAGasPriceDeviationPPB)},
OptimisticConfirmations: internal.OptimisticConfirmations,
Expand All @@ -435,18 +435,18 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test
Changeset: commonchangeset.WrapChangeSet(UpdateChainConfig),
Config: UpdateChainConfigConfig{
HomeChainSelector: e.HomeChainSel,
ChainAdds: chainConfigs,
RemoteChainAdds: chainConfigs,
},
},
{
// Add the DONs and candidate commit OCR instances for the chain.
Changeset: commonchangeset.WrapChangeSet(AddDonAndSetCandidateChangeset),
Config: AddDonAndSetCandidateChangesetConfig{
SetCandidateConfigBase{
HomeChainSelector: e.HomeChainSel,
FeedChainSelector: e.FeedChainSel,
DONChainSelector: ocrConfigs,
PluginType: types.PluginTypeCCIPCommit,
HomeChainSelector: e.HomeChainSel,
FeedChainSelector: e.FeedChainSel,
OCRConfigPerRemoteChainSelector: ocrConfigs,
PluginType: types.PluginTypeCCIPCommit,
},
},
},
Expand All @@ -455,19 +455,19 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test
Changeset: commonchangeset.WrapChangeSet(SetCandidateChangeset),
Config: SetCandidateChangesetConfig{
SetCandidateConfigBase{
HomeChainSelector: e.HomeChainSel,
FeedChainSelector: e.FeedChainSel,
DONChainSelector: ocrConfigs,
PluginType: types.PluginTypeCCIPExec,
HomeChainSelector: e.HomeChainSel,
FeedChainSelector: e.FeedChainSel,
OCRConfigPerRemoteChainSelector: ocrConfigs,
PluginType: types.PluginTypeCCIPExec,
},
},
},
{
// Promote everything
Changeset: commonchangeset.WrapChangeSet(PromoteAllCandidatesChangeset),
Config: PromoteAllCandidatesChangesetConfig{
HomeChainSelector: e.HomeChainSel,
DONChainSelectors: allChains,
HomeChainSelector: e.HomeChainSel,
RemoteChainSelectors: allChains,
},
},
{
Expand Down

0 comments on commit 9d870e1

Please sign in to comment.