Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the ability to replace the chainlink don, without replacing geth entirely #16471

Merged
merged 3 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions deployment/environment/crib/ccip_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de

// ----- Part 2 -----
lggr.Infow("setting up ocr...")
*e, err = setupOCR(e, homeChainSel, feedChainSel)
*e, err = mustOCR(e, homeChainSel, feedChainSel, true)
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to apply changesets for setting up OCR: %w", err)
}
Expand Down Expand Up @@ -204,17 +204,16 @@ func ConnectCCIPLanes(ctx context.Context, lggr logger.Logger, envConfig devenv.
}, nil
}

// ConfigureCCIPOCR is a group of changesets used from CRIB to configure OCR on a new setup
// This sets up OCR on all chains in the envConfig by configuring the CCIP home chain
// ConfigureCCIPOCR is a group of changesets used from CRIB to redeploy the chainlink don on an existing setup
func ConfigureCCIPOCR(ctx context.Context, lggr logger.Logger, envConfig devenv.EnvironmentConfig, homeChainSel, feedChainSel uint64, ab deployment.AddressBook) (DeployCCIPOutput, error) {
e, _, err := devenv.NewEnvironment(func() context.Context { return ctx }, lggr, envConfig)
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to initiate new environment: %w", err)
}
e.ExistingAddresses = ab

lggr.Infow("setting up ocr...")
*e, err = setupOCR(e, homeChainSel, feedChainSel)
lggr.Infow("resetting ocr...")
*e, err = mustOCR(e, homeChainSel, feedChainSel, false)
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to apply changesets for setting up OCR: %w", err)
}
Expand Down Expand Up @@ -503,16 +502,18 @@ func setupLanes(e *deployment.Environment, state changeset.CCIPOnChainState) (de
)
}

func setupOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64) (deployment.Environment, error) {
func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64, newDons bool) (deployment.Environment, error) {
chainSelectors := e.AllChainSelectors()
var ocrConfigPerSelector = make(map[uint64]changeset.CCIPOCRParams)
for selector := range e.Chains {
ocrConfigPerSelector[selector] = changeset.DeriveCCIPOCRParams(changeset.WithDefaultCommitOffChainConfig(feedChainSel, nil),
changeset.WithDefaultExecuteOffChainConfig(nil),
)
}
return commonchangeset.Apply(nil, *e, nil,
commonchangeset.Configure(

var commitChangeset commonchangeset.ConfiguredChangeSet
if newDons {
commitChangeset = commonchangeset.Configure(
// Add the DONs and candidate commit OCR instances for the chain
deployment.CreateLegacyChangeSet(changeset.AddDonAndSetCandidateChangeset),
changeset.AddDonAndSetCandidateChangesetConfig{
Expand All @@ -525,7 +526,28 @@ func setupOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint6
PluginType: types.PluginTypeCCIPCommit,
},
},
),
)
} else {
commitChangeset = commonchangeset.Configure(
// Update commit OCR instances for existing chains
deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset),
changeset.SetCandidateChangesetConfig{
SetCandidateConfigBase: changeset.SetCandidateConfigBase{
HomeChainSelector: homeChainSel,
FeedChainSelector: feedChainSel,
},
PluginInfo: []changeset.SetCandidatePluginInfo{
{
OCRConfigPerRemoteChainSelector: ocrConfigPerSelector,
PluginType: types.PluginTypeCCIPCommit,
},
},
},
)
}

return commonchangeset.Apply(nil, *e, nil,
commitChangeset,
commonchangeset.Configure(
// Add the exec OCR instances for the new chains
deployment.CreateLegacyChangeSet(changeset.SetCandidateChangeset),
Expand Down
7 changes: 3 additions & 4 deletions integration-tests/testconfig/ccip/ccip.toml
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,12 @@ ephemeral_addresses_number = 0

[Load.CCIP.Load]
# MessageTypeWeights corresponds with [data only, token only, message with token]
#MessageTypeWeights = [100,0,0]
MessageTypeWeights = [100,0,0]
# each destination chain will receive 1 incoming request per RequestFrequency for the duration of LoadDuration
RequestFrequency = "5s"
LoadDuration = "1h"
LoadDuration = "10m"
# destination chain selectors to send messages to
NumDestinationChains = 30
NumDestinationChains = 8
# Directory where we receive environment configuration from crib
CribEnvDirectory = "../../../../crib/deployments/ccip-v2/.tmp"
TimeoutDuration = "1h"
TimeoutDuration = "20m"
Loading