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

CCIP Load Test connected to crib #15404

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 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
95 changes: 0 additions & 95 deletions ccip/config/evm/fallback.toml

This file was deleted.

13 changes: 8 additions & 5 deletions deployment/ccip/changeset/cs_ccip_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ func (s SetCandidateConfigBase) Validate(e deployment.Environment, state CCIPOnC
if !exists {
return fmt.Errorf("home chain %d does not exist", s.HomeChainSelector)
}
if err := commoncs.ValidateOwnership(e.GetContext(), s.MCMS != nil, e.Chains[s.HomeChainSelector].DeployerKey.From, homeChainState.Timelock.Address(), homeChainState.CapabilityRegistry); err != nil {
return err
if s.MCMS != nil {
if err := commoncs.ValidateOwnership(e.GetContext(), s.MCMS != nil, e.Chains[s.HomeChainSelector].DeployerKey.From, homeChainState.Timelock.Address(), homeChainState.CapabilityRegistry); err != nil {
return err
}
}

for chainSelector, params := range s.OCRConfigPerRemoteChainSelector {
Expand Down Expand Up @@ -1024,8 +1026,10 @@ func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error {
if !exists {
return fmt.Errorf("home chain %d does not exist", c.HomeChainSelector)
}
if err := commoncs.ValidateOwnership(e.GetContext(), c.MCMS != nil, e.Chains[c.HomeChainSelector].DeployerKey.From, homeChainState.Timelock.Address(), homeChainState.CCIPHome); err != nil {
return err
if c.MCMS != nil {
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.RemoteChainRemoves {
if err := deployment.IsValidChainSelector(remove); err != nil {
Expand Down Expand Up @@ -1103,7 +1107,6 @@ func UpdateChainConfig(e deployment.Environment, cfg UpdateChainConfigConfig) (d
if err != nil {
return deployment.ChangesetOutput{}, err
}
e.Logger.Infof("Updated chain config on chain %d removes %v, adds %v", cfg.HomeChainSelector, cfg.RemoteChainRemoves, cfg.RemoteChainAdds)
return deployment.ChangesetOutput{}, nil
}

Expand Down
1 change: 0 additions & 1 deletion deployment/ccip/changeset/cs_prerequisites.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ func deployPrerequisiteContracts(e deployment.Environment, ab deployment.Address
e.Logger.Errorw("Failed to confirm assign registry module on token admin registry", "chain", chain.String(), "err", err)
return fmt.Errorf("failed to confirm assign registry module on token admin registry: %w", err)
}
e.Logger.Infow("assigned registry module on token admin registry")
}
if weth9Contract == nil {
weth, err := deployment.DeployContract(lggr, chain, ab,
Expand Down
1 change: 1 addition & 0 deletions deployment/ccip/changeset/cs_update_rmn_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (c SetRMNRemoteOnRMNProxyConfig) Validate(state CCIPOnChainState) error {
}

func SetRMNRemoteOnRMNProxy(e deployment.Environment, cfg SetRMNRemoteOnRMNProxyConfig) (deployment.ChangesetOutput, error) {
e.Logger.Infow("Setting RMNRemote on RMNProxy", "chainSelectors", cfg.ChainSelectors)
state, err := LoadOnchainState(e)
if err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("failed to load onchain state: %w", err)
Expand Down
2 changes: 2 additions & 0 deletions deployment/ccip/changeset/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type
return state, err
}
state.OffRamp = offRamp
case deployment.NewTypeAndVersion(ARMProxy, deployment.Version1_6_0_dev).String():
fallthrough
case deployment.NewTypeAndVersion(ARMProxy, deployment.Version1_0_0).String():
armProxy, err := rmn_proxy_contract.NewRMNProxy(common.HexToAddress(address), chain.Client)
if err != nil {
Expand Down
137 changes: 112 additions & 25 deletions deployment/environment/crib/ccip_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"context"
"errors"
"fmt"
"github.com/smartcontractkit/chainlink-ccip/chainconfig"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"
"math/big"

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

"github.com/smartcontractkit/ccip-owner-contracts/pkg/config"

"github.com/smartcontractkit/chainlink-ccip/chainconfig"
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset"
Expand Down Expand Up @@ -71,7 +72,7 @@ func DeployHomeChainContracts(ctx context.Context, lggr logger.Logger, envConfig

// DeployCCIPAndAddLanes is the actual ccip setup once the nodes are initialized.
func DeployCCIPAndAddLanes(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)
e, don, err := devenv.NewEnvironment(func() context.Context { return ctx }, lggr, envConfig)
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to initiate new environment: %w", err)
}
Expand All @@ -94,7 +95,6 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
ChainSelector: chain,
})
}

// set up chains
chainConfigs := make(map[uint64]changeset.ChainConfig)
nodeInfo, err := deployment.NodeInfo(e.NodeIDs, e.Offchain)
Expand Down Expand Up @@ -143,6 +143,12 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
HomeChainSelector: homeChainSel,
},
},
{
Changeset: commonchangeset.WrapChangeSet(changeset.SetRMNRemoteOnRMNProxy),
Config: changeset.SetRMNRemoteOnRMNProxyConfig{
ChainSelectors: chainSelectors,
},
},
{
Changeset: commonchangeset.WrapChangeSet(changeset.CCIPCapabilityJobspec),
Config: struct{}{},
Expand All @@ -152,20 +158,93 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to load onchain state: %w", err)
}

// find out which rmn proxy we're pointing to
for _, chain := range chainSelectors {
r, err := state.Chains[chain].RMNProxy.GetARM(nil)
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to get rmn proxy: %w", err)
}
lggr.Infow("pointed to arm for ", "chain", chain, "rmnProxy", r.String())
}

var ocrConfigPerSelector = make(map[uint64]changeset.CCIPOCRParams)
for selector := range e.Chains {
//tokenConfig := changeset.NewTestTokenConfig(state.Chains[feedChainSel].USDFeeds)
ocrConfigPerSelector[selector] = changeset.DefaultOCRParams(
selector,
//tokenConfig.GetTokenInfo(lggr, state.Chains[selector].LinkToken, state.Chains[selector].Weth9),
nil,
nil,
)
}

*e, err = commonchangeset.ApplyChangesets(nil, *e, nil, []commonchangeset.ChangesetApplication{
{
// Add the DONs and candidate commit OCR instances for the chain.
Changeset: commonchangeset.WrapChangeSet(changeset.AddDonAndSetCandidateChangeset),
Config: changeset.AddDonAndSetCandidateChangesetConfig{
changeset.SetCandidateConfigBase{
HomeChainSelector: homeChainSel,
FeedChainSelector: feedChainSel,
OCRConfigPerRemoteChainSelector: ocrConfigPerSelector,
PluginType: types.PluginTypeCCIPCommit,
},
},
},
{
// Add the exec OCR instances for the new chains.
Changeset: commonchangeset.WrapChangeSet(changeset.SetCandidateChangeset),
Config: changeset.SetCandidateChangesetConfig{
changeset.SetCandidateConfigBase{
HomeChainSelector: homeChainSel,
FeedChainSelector: feedChainSel,
OCRConfigPerRemoteChainSelector: ocrConfigPerSelector,
PluginType: types.PluginTypeCCIPExec,
},
},
},
{
// Promote everything
Changeset: commonchangeset.WrapChangeSet(changeset.PromoteAllCandidatesChangeset),
Config: changeset.PromoteCandidatesChangesetConfig{
HomeChainSelector: homeChainSel,
RemoteChainSelectors: chainSelectors,
PluginType: types.PluginTypeCCIPCommit,
},
},
{
// Promote everything
Changeset: commonchangeset.WrapChangeSet(changeset.PromoteAllCandidatesChangeset),
Config: changeset.PromoteCandidatesChangesetConfig{
HomeChainSelector: homeChainSel,
RemoteChainSelectors: chainSelectors,
PluginType: types.PluginTypeCCIPExec,
},
},
{
// Enable the OCR config on the remote chains.
Changeset: commonchangeset.WrapChangeSet(changeset.SetOCR3OffRamp),
Config: changeset.SetOCR3OffRampConfig{
HomeChainSel: homeChainSel,
RemoteChainSels: chainSelectors,
},
},
})

// Add all lanes
for from := range e.Chains {
for to := range e.Chains {
if from != to {
stateChain1 := state.Chains[from]
for src := range e.Chains {
for dst := range e.Chains {
if src != dst {
stateChain1 := state.Chains[src]
newEnv, err := commonchangeset.ApplyChangesets(nil, *e, nil, []commonchangeset.ChangesetApplication{
{
Changeset: commonchangeset.WrapChangeSet(changeset.UpdateOnRampsDests),
Config: changeset.UpdateOnRampDestsConfig{
UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{
from: {
to: {
src: {
dst: {
IsEnabled: true,
TestRouter: false,
AllowListEnabled: false,
},
},
Expand All @@ -176,13 +255,13 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
Changeset: commonchangeset.WrapChangeSet(changeset.UpdateFeeQuoterPricesCS),
Config: changeset.UpdateFeeQuoterPricesConfig{
PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{
from: {
src: {
TokenPrices: map[common.Address]*big.Int{
stateChain1.LinkToken.Address(): changeset.DefaultLinkPrice,
stateChain1.Weth9.Address(): changeset.DefaultWethPrice,
},
GasPrices: map[uint64]*big.Int{
to: changeset.DefaultGasPrice,
dst: changeset.DefaultGasPrice,
},
},
},
Expand All @@ -192,8 +271,8 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
Changeset: commonchangeset.WrapChangeSet(changeset.UpdateFeeQuoterDests),
Config: changeset.UpdateFeeQuoterDestsConfig{
UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{
from: {
to: changeset.DefaultFeeQuoterDestChainConfig(),
src: {
dst: changeset.DefaultFeeQuoterDestChainConfig(),
},
},
},
Expand All @@ -202,10 +281,9 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
Changeset: commonchangeset.WrapChangeSet(changeset.UpdateOffRampSources),
Config: changeset.UpdateOffRampSourcesConfig{
UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{
to: {
from: {
IsEnabled: true,
TestRouter: true,
dst: {
src: {
IsEnabled: true,
},
},
},
Expand All @@ -214,18 +292,21 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
{
Changeset: commonchangeset.WrapChangeSet(changeset.UpdateRouterRamps),
Config: changeset.UpdateRouterRampsConfig{
TestRouter: true,
UpdatesByChain: map[uint64]changeset.RouterUpdates{
// onRamp update on source chain
from: {
src: {
OffRampUpdates: map[uint64]bool{
dst: true,
},
OnRampUpdates: map[uint64]bool{
to: true,
dst: true,
},
},
// off
from: {
dst: {
OffRampUpdates: map[uint64]bool{
to: true,
src: true,
},
OnRampUpdates: map[uint64]bool{
src: true,
},
},
},
Expand All @@ -240,10 +321,16 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de
}
}

// distribute funds to transmitters
// we need to use the nodeinfo from the envConfig here, because multiAddr is not
// populated in the environment variable
distributeFunds(lggr, don.PluginNodes(), *e)

addresses, err := e.ExistingAddresses.Addresses()
if err != nil {
return DeployCCIPOutput{}, fmt.Errorf("failed to get convert address book to address book map: %w", err)
}

return DeployCCIPOutput{
AddressBook: *deployment.NewMemoryAddressBookFromMap(addresses),
NodeIDs: e.NodeIDs,
Expand Down
Loading
Loading