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-4158 prereq Changeset #15250

Merged
merged 19 commits into from
Nov 15, 2024
Merged

Ccip-4158 prereq Changeset #15250

merged 19 commits into from
Nov 15, 2024

Conversation

AnieeG
Copy link
Contributor

@AnieeG AnieeG commented Nov 14, 2024

Creates a changeset for all pre-existing contracts.

  • The changeset based on input provided either deploys pre-existing contracts( applicable for staging and test environments) Or
  • Initialize the addressbook with all contract addresses. ( applicable for mainnet and prod testnet)
  • Tokens and Feeds are yet to be included in the set of pre-existing contracts.

Updates smoke workflow to run tests in parallel so that workflow duration is reduced.

@AnieeG AnieeG requested review from a team as code owners November 14, 2024 20:21
Copy link
Contributor

github-actions bot commented Nov 14, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@AnieeG AnieeG requested review from a team as code owners November 14, 2024 21:50
@AnieeG AnieeG requested a review from jmank88 November 14, 2024 21:50
@AnieeG AnieeG requested a review from a team as a code owner November 14, 2024 23:21
// This is only required for staging and test environments where the contracts are not already deployed.
// We are not deploying router and RMNProxy here as RMNProxy has dependency on RMNRemote which is a new contract and
// router depends on RMNProxy.
func DeployPrerequisiteContracts(e deployment.Environment, ab deployment.AddressBook, selectors []uint64) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change 'prerequisite' to something more descriptive?
From the code it looks like we're deploying contracts related to token registry. Then in the comment we can indicate that this is not necessary for live environments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be more than registry. This is aiming to deploy basically all the 1.5 contracts which will exist pre 1.6

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe DeployLegacyContracts or DeployRDDContracts, and include Connor's comment that legacy contracts are the ones deployed by RDD which include the 1.5 release and earlier.

deployment/ccip/changeset/add_chain_test.go Show resolved Hide resolved
)

var (
_ deployment.ChangeSet[PrerequisiteConfig] = InitializePrerequisites
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting here is strange?

return deployment.ChangesetOutput{}, fmt.Errorf("failed to deploy prerequisite contracts: %w", err)
}
return deployment.ChangesetOutput{
Proposals: []timelock.MCMSWithTimelockProposal{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for initializing, should this return an 'accept_ownership' proposal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, We need to test the whole set up before transferring ownership. The transfer ownership should have its own changeset

for _, ec := range cfg.ExistingContracts {
err = ab.Save(sel, ec.Address.String(), ec.TypeAndVersion)
if err != nil {
env.Logger.Errorw("Failed to deploy prerequisite contracts", "err", err, "addressBook", ab)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env.Logger.Errorw("Failed to deploy prerequisite contracts", "err", err, "addressBook", ab)
env.Logger.Errorw("Failed to save prerequisite contracts", "err", err, "addressBook", ab)

return err
}
e.Logger.Infow("Deployed nonce manager", "addr", nonceManager.Address)
nmContract = nonceManager.Contract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of creating a new variable, let's just update chainState.NonceManager to maintain chainState as single source of truth

Same with the other contracts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not new var? seems clean. Also if you are deploying new noncemanager chain state won't be updated right away. only the addressbook is updated after deployment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For someone updating this file in the future I can see friction for them trying to know which contracts to use chainState.<Contract> or the contract variable.

Alternatively, initialize all these contract variables at the top of the file and initialize them to chainstate, and only use those new variables in the function

e.Logger.Infow("assigned registry module on token admin registry")
}
if weth9Contract == nil {
weth9, err := deployContract(lggr, chain, ab,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also mint some tokens?

type PrerequisiteConfig struct {
ChainSelectors []uint64
Deploy bool
// if Deploy is false, ExistingContracts must be set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think cleaner to have a separate changeset like SaveExistingContracts which takes in an arbitrary number of []Contract{selector, address, typeAndVersion} and just saves them to an address book and returns it. That would be more generally reusable and avoid the conditional

@@ -125,6 +125,136 @@ func deployContract[C Contracts](
return &contractDeploy, nil
}

// DeployPrerequisiteContracts deploys the contracts that can be ported from previous CCIP version to the new one.
// This is only required for staging and test environments where the contracts are not already deployed.
// We are not deploying router and RMNProxy here as RMNProxy has dependency on RMNRemote which is a new contract and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait I thought we were going to deploy router + RMNProxy pointing at MockRMN to simulate v1? Then separate RMNProxy for V2 until we adjust RMNRemote

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I got confused here. Changing

}
lggr := e.Logger
for _, sel := range selectors {
chain := e.Chains[sel]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely should be a function DeployPrerequisiteChainContracts

@AnieeG AnieeG added this pull request to the merge queue Nov 15, 2024
}, nil
}

type DeployPrerequisiteConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing some comments on exported functions/types

}

// DeployPrerequisiteContracts deploys the contracts that can be ported from previous CCIP version to the new one.
// This is only required for staging and test environments where the contracts are not already deployed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be required for new chains as well? Or are the old contracts all replaced after the initial migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mainly designed thinking migration as an immediate goal. Are you referring to adding a completely newchain in 1.5 which is not existing in 1.6? I think in that case as we will have to call this function.

Merged via the queue into develop with commit 20b5655 Nov 15, 2024
162 checks passed
@AnieeG AnieeG deleted the ccip-4158-prereq branch November 15, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants