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 deploy home changeset #15143

Merged
merged 20 commits into from
Nov 9, 2024
Merged

Conversation

AnieeG
Copy link
Contributor

@AnieeG AnieeG commented Nov 6, 2024

DeployHomeChain Changeset

  • Deploys CR, CCIPHome, RMNHome
  • Adds CCIP capability to CR pointing to CCIPHome
  • Adds node operators
  • Adds initial set of nodes to CR, who all have the CCIP capability

@AnieeG AnieeG requested review from a team as code owners November 6, 2024 22:30
Copy link
Contributor

github-actions bot commented Nov 6, 2024

Flaky Test Detector for deployment/go.mod project has failed ❌

Ran new or updated tests between develop and 1e3b351 (CCIP-4158-deployhome-changeset).

View Flaky Detector Details | Compare Changes

Failed Tests

Ran 3 tests in total for all affected test packages. Below are the tests identified as flaky, with a pass ratio lower than the 100% threshold:

TestPackage                                                      TestName          PassRatio  RunCount   Skipped
---------                                                        ---------         ---------  ---------  ---------
github.com/smartcontractkit/chainlink/deployment/ccip/changeset  TestDeployCapReg  0%         1          false

Copy link
Contributor

github-actions bot commented Nov 6, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@AnieeG AnieeG changed the title Cci- 4158 deploy home changeset CCIP- 4158 deploy home changeset Nov 6, 2024
deployment/ccip/test_params.go Show resolved Hide resolved
deployment/ccip/changeset/cap_reg.go Outdated Show resolved Hide resolved
deployment/ccip/deploy.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cap_reg.go Outdated Show resolved Hide resolved
@AnieeG AnieeG requested review from a team as code owners November 7, 2024 21:35
@AnieeG AnieeG requested a review from reductionista November 7, 2024 21:35
@AnieeG AnieeG requested a review from a team as a code owner November 7, 2024 21:52
if c.RMNStaticConfig.OffchainConfig == nil {
return fmt.Errorf("offchain config for RMNHomeStaticConfig must be set")
}
if c.NodeOperators == nil || len(c.NodeOperators) == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit, but len(slice) == 0 already covers nil slices, so c.NodeOperators == nil is redundant, right?

https://go.dev/play/p/kkDCe54H5Xv

if nop.Name == "" {
return fmt.Errorf("node operator name must be set")
}
if c.NodeP2PIDsPerNodeOpAdmin[nop.Name] == nil || len(c.NodeP2PIDsPerNodeOpAdmin[nop.Name]) == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

ab deployment.AddressBook,
chain deployment.Chain,
) (*ContractDeploy[*capabilities_registry.CapabilitiesRegistry], error) {
capRegAddress, err := deployment.SearchAddressBook(ab, chain.Selector, CapabilitiesRegistry)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, not sure about that. So if error is nil we assume we found it, but if error is present we assume it's not there and needs deployment? What if the error is not related to a lack of capabilities registry but some other transient issue that would trigger unnecessary deployment?

I would consider a more explicit interface here, for instance, something like this

// bool added to returned types
func SearchAddressBook(ab AddressBook, chain uint64, typ ContractType) (string, bool, error) {}

capRegAddress, ok, err := deployment.SearchAddressBook(ab, chain.Selector, CapabilitiesRegistry)
if err != nil {
    return nil, err
}
if !ok {
   deployContract
} else {
   returnAlreadyDeployed 
}

or returning a pointer to distinguish between the error and contract not being deployed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, do we have any tests to cover these cases?

Copy link
Contributor Author

@AnieeG AnieeG Nov 8, 2024

Choose a reason for hiding this comment

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

There can be two scenarios -

  1. If Cap reg is present and not deployed again through DeployHomeChain- is covered by in-memory test. Here we deploy CapReg first and then call DeployHomeChain.
  2. If Cap reg is not present and deployed through DeployHomeChain - will be covered by docker tests( I will create a ticket to cover this in next pr) - In this case we will be restarting docker nodes once home chain is deployed with newly deployed cap reg address.

Copy link
Contributor

github-actions bot commented Nov 8, 2024

Flaky Test Detector for deployment/go.mod project has failed ❌

Ran new or updated tests between develop and e933453 (CCIP-4158-deployhome-changeset).

View Flaky Detector Details | Compare Changes

Failed Tests

Ran 6 tests in total for all affected test packages. Below are the tests identified as flaky, with a pass ratio lower than the 100% threshold:

TestPackage                                                      TestName             PassRatio  RunCount   Skipped
---------                                                        ---------            ---------  ---------  ---------
github.com/smartcontractkit/chainlink/deployment/ccip/changeset  TestDeployHomeChain  0%         1          false

if err != nil {
return deployment.ChangesetOutput{}, errors.Wrapf(deployment.ErrInvalidConfig, "%v", err)
}
ab := deployment.NewMemoryAddressBook()
Copy link
Contributor

Choose a reason for hiding this comment

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

the is an addressbook in the env now. should be able to use it

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 intentional. wanted to - keep env's Existing address unchanged, and then once the changeset is executed merge the address book with newly generated addresses.
In this way we can know from each changeset which addresses got deployed.
Based on discussion with @connorwstein the format of every changeset should be -

func DoThingChangeset(e deployment.Environment, config interface {}) deployment.ChangesetOutput {
	// create new address book each time so that changeset output can denote 
	// which addresses are newly deployed
	newAddresses := deployment.NewAddressBook()
	// deployX should mutate newAddresses adding them.
	// it can use e.ExistingAddresses to load existing state
	// and do checks
	deployX(newAddresses, e)
	return Output{addresses: newAddresses}
} 

RMNStaticConfig rmn_home.RMNHomeStaticConfig
RMNDynamicConfig rmn_home.RMNHomeDynamicConfig
NodeOperators []capabilities_registry.CapabilitiesRegistryNodeOperator
NodeP2PIDsPerNodeOpAdmin map[string][][32]byte
Copy link
Contributor

Choose a reason for hiding this comment

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

nit/ i've been using p2pkey.PeerID when i want peer ids and converting to [32]byte for the contract when needed specifically for the contract.

have utils we can share/promote if you want to do the same

@AnieeG AnieeG added this pull request to the merge queue Nov 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2024
@AnieeG AnieeG added this pull request to the merge queue Nov 8, 2024
Merged via the queue into develop with commit 1e84f96 Nov 9, 2024
161 checks passed
@AnieeG AnieeG deleted the CCIP-4158-deployhome-changeset branch November 9, 2024 00:23
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.

4 participants