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

AddChain inbound CCIP integration test #14377

Merged

Conversation

connorwstein
Copy link
Contributor

@connorwstein connorwstein commented Sep 9, 2024

CCIP-3062

  • Integrates the MCMS library for adding inbound lanes to a new chain. The test generates a proposal to enable a 4th chain while there are 3 pre-existing chains, signs and executes it, then sends traffic via the test router for the new lanes. Serves an example of how to use the MCMS library for future workflows.
  • Renaming PR -> FeeQuoter
  • Rename to OnRamp/OffRamp
  • Add test router deployment and dummy MCMS key
  • Extracting some test utilities

Follow ups:

@connorwstein connorwstein marked this pull request as ready for review September 12, 2024 16:37
@connorwstein connorwstein requested review from a team as code owners September 12, 2024 16:37
@connorwstein connorwstein changed the title AddChain/AddLane CCIP integration tests AddChain inbound CCIP integration test Sep 12, 2024
Copy link
Contributor

@AnieeG AnieeG left a comment

Choose a reason for hiding this comment

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

There are FeeQuoter and PriceRegistry references used alternatively, can we make it uniform?

integration-tests/deployment/ccip/add_chain.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/add_chain.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/deploy.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/deploy.go Outdated Show resolved Hide resolved
}
js, err := ccipdeployment.NewCCIPJobSpecs(env.NodeIDs, env.Offchain)
if err != nil {
return deployment.ChangesetOutput{}, err
}
proposal, err := ccipdeployment.GenerateAcceptOwnershipProposal(env, env.AllChainSelectors(), ab)
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 can be its own changeset, probably too much to deploy all the contracts and accept ownership in the same one

if _, err := deployment.ConfirmIfNoError(h, tx, err); err != nil {
return ccip_config.CCIPConfigTypesChainConfigInfo{}, err
}
lggr.Infow("Applied chain config updates", "chainConfig", chainConfig)
return chainConfig, nil
}

func AddDON(
// AddDONToCR adds a DON with the given nodes to the capabilities registry.
func BuildAddDONArgs(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need helpers for constructing the args in the case where we want to use SimTransactOpts to build proposal data

return encodedConfigs, nil
}

func LatestCCIPDON(registry *capabilities_registry.CapabilitiesRegistry) (*capabilities_registry.CapabilitiesRegistryDONInfo, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Parsing events is more annoying when the don is added as part of proposal, so using this to get the donID in the case where you know precisely one don was added.

return ab, err
}
groupQuorums, groupParents, signerAddresses, signerGroups := c.ExtractSetConfigInputs()
mcmsTx, err := mcm.Contract.SetConfig(chain.DeployerKey,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a 1of1 with the test key for now. Need to parameterize in a follow up.

var (
// TODO: sort out why the mismatch here
//CCIPCapabilityId [32]byte = utils.MustHash(hexutil.Encode(MustABIEncode(`[{"type": "string"}, {"type": "string"}]`, CapabilityLabelledName, CapabilityVersion)))
CCIPCapabilityId = MustHashFromBytes(hexutil.MustDecode("0xe0da3c2b9005178f4731c9f40164f1933ad00bac9d6c13ad4ca1a8a763416380"))
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 just avoids RPC calls all the time to get the capability ID. We expect it to be fixed per version

) (ccip_config.CCIPConfigTypesChainConfigInfo, error) {
// Need to sort, otherwise _checkIsValidUniqueSubset onChain will fail
sortP2PIDS(p2pIDs)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorting these once in the helper

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorting no longer needed, can remove it entirely

integration-tests/deployment/environment.go Show resolved Hide resolved
[]mcms.Signature{},
false,
metaDataPerChain,
"blah", // TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

part of CCIP-3411 too

integration-tests/deployment/ccip/deploy.go Outdated Show resolved Hide resolved
AnieeG
AnieeG previously approved these changes Sep 12, 2024
// NOTE: Assume same peerID/multiAddr for all chains.
// Might make sense to change proto as peerID/multiAddr is 1-1 with nodeID?
peerID = MustPeerIDFromString(chainConfig.Ocr2Config.P2PKeyBundle.PeerId)
multiAddr = chainConfig.Ocr2Config.Multiaddr
Copy link
Contributor

Choose a reason for hiding this comment

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

The multiaddr is only populated for bootstrap

Copy link
Contributor

@asoliman92 asoliman92 Sep 13, 2024

Choose a reason for hiding this comment

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

Out of curiosity, will it cause issues if it was set for non bootstrap nodes?

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 think leaving it blank for non-bootstraps is ok for now. @asoliman92 no don't think it will

metaDataPerChain := make(map[mcms.ChainIdentifier]timelock.MCMSWithTimelockChainMetadata)
for _, source := range sources {
chain, _ := chainsel.ChainBySelector(source)
enableOnRampDest, err := state.Chains[source].OnRamp.ApplyDestChainConfigUpdates(SimTransactOpts(), []onramp.OnRampDestChainConfigArgs{
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this actually "send" the tx to the simchain? Proposals just need calldata right? I'm wondering what'll happen here for the non-sim chains which have "automine" or similar on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it doesn't - uses the NoSend flag in transact opts, just a scalable way to get the calldata for proposals

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh that's clever, alright did not notice that

},
})
return timelock.NewMCMSWithTimelockProposal(
"1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments on string/bool/int literal fields would be useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah lets punt to CCIP-3411


// Transfer onramp/fq ownership to timelock.
// Enable the new dest on the test router.
for _, source := range initialDeploy {
Copy link
Contributor

Choose a reason for hiding this comment

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

Semantically distinct code blocks below (already designated by comments) can probably be moved to functions to make this test read/understand better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree - was thinking we wait for another proposal to see if there are nice re-usable utilities we can extract

Comment on lines +14 to +15
// TODO: The offchain code doesn't yet support partial lane
// enablement, need to address then re-enable this test.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is needed still for offchain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nothing now if the IsEnabled flag work is done, then we can complete this test

integration-tests/deployment/ccip/deploy_home_chain.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/deploy_home_chain.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/deploy_home_chain.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/deploy_home_chain.go Outdated Show resolved Hide resolved
integration-tests/deployment/ccip/deploy_home_chain.go Outdated Show resolved Hide resolved
) (ccip_config.CCIPConfigTypesChainConfigInfo, error) {
// Need to sort, otherwise _checkIsValidUniqueSubset onChain will fail
sortP2PIDS(p2pIDs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorting no longer needed, can remove it entirely

@cl-sonarqube-production
Copy link

@connorwstein connorwstein added this pull request to the merge queue Sep 13, 2024
Merged via the queue into develop with commit 5ec7cbb Sep 13, 2024
152 of 153 checks passed
@connorwstein connorwstein deleted the CCIP-3062-integration-tests-for-major-workflows-part2 branch September 13, 2024 16:19
akuzni2 pushed a commit that referenced this pull request Sep 13, 2024
* Port

* Use mcms lib

* Proposal signing working

* Almost working. Just need ramps to make timelock owner first

* Accept ownership proposal working

* Fee quoter accept ownership

* Fix existing tests

* Enable to new chain traffic working

* Mod tidy

* Fix build

* lint

* More lint

* Use Address() for MCM/Timelock

* Rename

* Self review cleanup

* Clean up job management and bootstrap handling

* Comments
DavidOrchard pushed a commit that referenced this pull request Sep 13, 2024
* Port

* Use mcms lib

* Proposal signing working

* Almost working. Just need ramps to make timelock owner first

* Accept ownership proposal working

* Fee quoter accept ownership

* Fix existing tests

* Enable to new chain traffic working

* Mod tidy

* Fix build

* lint

* More lint

* Use Address() for MCM/Timelock

* Rename

* Self review cleanup

* Clean up job management and bootstrap handling

* Comments
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.

5 participants