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-4573 Changesets ccip 1.5 #15588

Merged
merged 35 commits into from
Dec 19, 2024
Merged

CCIP-4573 Changesets ccip 1.5 #15588

merged 35 commits into from
Dec 19, 2024

Conversation

AnieeG
Copy link
Contributor

@AnieeG AnieeG commented Dec 10, 2024

Requires

Supports

@AnieeG AnieeG requested review from a team as code owners December 10, 2024 03:06
@AnieeG AnieeG marked this pull request as draft December 10, 2024 03:06
Copy link
Contributor

github-actions bot commented Dec 10, 2024

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , Flakeguard Root Project / Get Tests To Run , test-scripts , Flakeguard Deployment Project / Get Tests To Run , GolangCI Lint (integration-tests) , GolangCI Lint (deployment) , Core Tests (go_core_tests) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_fuzz) , Core Tests (go_core_race_tests) , Flakeguard Root Project / Run Tests , Flakeguard Root Project / Report , Flakeguard Deployment Project / Run Tests (github.com/smartcontractkit/chainlink/deployment/ccip/changeset, ubuntu-latest) , Flakeguard Deployment Project / Run Tests (github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5, ubuntu-latest) , Flakeguard Deployment Project / Run Tests (github.com/smartcontractkit/chainlink/deployment/common/changeset/internal, ubuntu-lat... , lint , SonarQube Scan , Flakey Test Detection , Flakeguard Deployment Project / Report

1. Consider pre-allocating slices:

  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7975297Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7978502Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7980983Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7983230Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7985550Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7987571Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7989660Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7992438Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7994861Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7996963Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.7998967Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8001061Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8003303Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8005714Z
Source of Error:
var prereqCfg []DeployPrerequisiteConfigPerChain
var prereqCfgs []DeployPrerequisiteConfigPerChain
var schedule []int
var oracles []confighelper.OracleIdentityExtra
var signersAddresses []common.Address
var transmittersAddresses []common.Address
var jobSpecs []JobSpecInput
var addLanesCfg []DeployLaneConfig
var commitOCR2Configs []CommitOCR2ConfigParams
var execOCR2Configs []ExecuteOCR2ConfigParams

Why: The linter suggests pre-allocating slices to improve performance by reducing the number of allocations.

Suggested fix: Pre-allocate the slices with an appropriate capacity using make if the size is known or can be estimated.

2. Variable naming issues:

  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8005714Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8008096Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8010082Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8012315Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8016827Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8019393Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8020360Z
Source of Error:
func WithChainIds(chainIDs []uint64) TestOps {
package v1_5
PriceGetterConfigJson string
destEVMChainIdStr, err := chain_selectors.GetChainIDFromSelector(dest)
destEVMChainId, err := strconv.ParseUint(destEVMChainIdStr, 10, 64)

Why: The linter suggests using consistent and idiomatic naming conventions, such as using ID instead of Id and avoiding underscores in package names.

Suggested fix: Rename variables and package names to follow Go naming conventions, e.g., WithChainIDs, PriceGetterConfigJSON, destEVMChainIDStr, etc.

3. Performance improvements:

  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8021857Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8024025Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8026652Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8029738Z
Source of Error:
return fmt.Sprintf("%d", c.Selector)
name = fmt.Sprintf("%d", chainSelector)
return fmt.Errorf("TokenPricesUSDPipeline or PriceGetterConfigJson is required")
return fmt.Errorf("USDCAttestationAPI is required")

Why: The linter suggests using more efficient functions like strconv.FormatUint and errors.New for better performance.

Suggested fix: Replace fmt.Sprintf with strconv.FormatUint and fmt.Errorf with errors.New.

4. Avoid using require in HTTP handlers:

  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8032275Z
  • [Golang Lint (deployment)] 2024-12-19T16:43:09.8034322Z
Source of Error:
require.NoError(t, err)

Why: The linter suggests avoiding the use of require in HTTP handlers as it is intended for use in tests.

Suggested fix: Replace require.NoError with proper error handling logic suitable for HTTP handlers.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

Chains map[uint64]CCIPChainState
}

// CCIPChainState holds a Go binding for all the currently deployed CCIP contracts
Copy link
Contributor

@connorwstein connorwstein Dec 10, 2024

Choose a reason for hiding this comment

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

I think it'll be simpler if we have a single monster CCIPChainState, but embed the legacy one like

type CCIPChainState1_5 struct {
	// Only 15 contracts which will be fully deprecated
	EVM2EVMOnRamp   map[uint64]*evm_2_evm_onramp.EVM2EVMOnRamp
	...
}

// Existing thing
type CCIPChainState struct {
	commoncs.MCMSWithTimelockState
	commoncs.LinkTokenState
	commoncs.StaticLinkTokenState
	CCIPChainState1_5
	OnRamp            onramp.OnRamp
	...
}

Since ultimately they'll be in the same address book. Then we can still just LoadCCIPChainState in a changeset, and take actions on the old contracts and the new ones if needed for migration

@AnieeG AnieeG changed the title Changesets ccip 1.5 CCIP-4573 Changesets ccip 1.5 Dec 11, 2024
deployment/ccip/changeset/cs_deploy_chain.go Show resolved Hide resolved
deployment/ccip/changeset/cs_deploy_chain.go Show resolved Hide resolved
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_contract"
)

// CCIPChainStateLegacy holds 1.5 state for CCIP chains
Copy link
Contributor

Choose a reason for hiding this comment

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

lets clarify it holds it for a single chain


// CCIPChainStateLegacy holds 1.5 state for CCIP chains
type CCIPChainStateLegacy struct {
EVM2EVMOnRamp map[uint64]*evm_2_evm_onramp.EVM2EVMOnRamp
Copy link
Contributor

Choose a reason for hiding this comment

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

need to document what the keys are here

var _ deployment.ChangeSet[DeployChainContractsConfig] = DeployChainContracts

type DeployChainContractsConfig struct {
configs []DeployChainContractsConfigPerChain
Copy link
Contributor

Choose a reason for hiding this comment

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

will be unusable if private

return nil
}

func deployChainContractsForChains(env deployment.Environment, ab deployment.AddressBook, cfg DeployChainContractsConfig) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

could probably just inline this

// │ Deploy RMN │
// ================================================================
var rmnAddr common.Address
if cfg.RMNConfig == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

might be simpler to just add the price reg + real RMN to prereqs?

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 6bb2a6d (changesets-ccip-1_5).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestE2ELegacy 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset/v1_5 false 5m7.7s @smartcontractkit/ccip, @smartcontractkit/core

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@AnieeG AnieeG marked this pull request as ready for review December 17, 2024 22:51
Comment on lines 84 to 86
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
receipt, err := bind.WaitMined(ctx, backend, tx)
Copy link
Contributor

Choose a reason for hiding this comment

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

The linter normally complains about defers from for loops since they can be error prone. An alternative form is to wrap it up in a func:

Suggested change
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
receipt, err := bind.WaitMined(ctx, backend, tx)
receipt, err := func() (receipt, error) {
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
return bind.WaitMined(ctx, backend, tx)
}

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 4669024 (changesets-ccip-1_5).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestInitialAddChainAppliedTwice 33.33% false false false 3 1 2 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset false 5m34.273333333s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and b76b6fc (changesets-ccip-1_5).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestInitialAddChainAppliedTwice 66.67% false false false 3 2 1 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset false 3m50.83s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

@@ -62,6 +70,7 @@ func (o *OCR2TaskJobSpec) String() (string, error) {
}{
Name: o.Name,
JobType: o.JobType,
ExternalJobID: externalID,
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 required for JD to propose the job, without ExternalJobID it's throwing error

@@ -28,6 +30,7 @@ type OCR2TaskJobSpec struct {
ForwardingAllowed bool `toml:"forwardingAllowed"`
OCR2OracleSpec job.OCR2OracleSpec
ObservationSource string `toml:"observationSource"` // List of commands for the Chainlink node
ExternalJobID string `toml:"externalJobID"`
Copy link
Contributor

Choose a reason for hiding this comment

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

is this exclusively for tests / JD? So no need to port it to the fork and it won't break the fork if it does get ported?

Copy link
Contributor Author

@AnieeG AnieeG Dec 18, 2024

Choose a reason for hiding this comment

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

it won't break it. Exclusively for JD. without externaljobId it's throwing error that it's missing, which does not happen through node api job creation

for _, commitStore := range c.CommitStore {
commitStoreView, err := v1_5.GenerateCommitStoreView(commitStore)
if err != nil {
return chainView, errors.Wrapf(err, "failed to generate commit store view for commit store %s", commitStore.Address().String())
Copy link
Contributor

Choose a reason for hiding this comment

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

can include the source like the offramp

@@ -312,7 +364,11 @@ func (s CCIPOnChainState) View(chains []uint64) (map[string]view.ChainView, erro
if err != nil {
return m, err
}
m[chainInfo.ChainName] = chainView
name := chainInfo.ChainName
if chainInfo.ChainName == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

should never happen right?

Copy link
Contributor Author

@AnieeG AnieeG Dec 18, 2024

Choose a reason for hiding this comment

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

happens for memory env, all the 900.... ids have blank name

destStartBlock, err := destChain.Client.HeaderByNumber(context.Background(), nil)
require.NoError(t, err)
WaitForCommit(t, srcChain, destChain, state.Chains[dest].CommitStore[src], sentEvent.Message.SequenceNumber)
WaitForExecute(t, srcChain, destChain, state.Chains[dest].EVM2EVMOffRamp[src], []uint64{sentEvent.Message.SequenceNumber}, destStartBlock.Number.Uint64())
Copy link
Contributor

Choose a reason for hiding this comment

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

wow cool!

*memory.JobClient
}

// ProposeJob is an overridden implementation of the jobclient.ProposeJob method which allows offchainreporting2 job type
Copy link
Contributor

Choose a reason for hiding this comment

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

wait the JD doesn't support this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}}, nil
}

type MemoryEnvironment struct {
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 the overriding will be confusing for the migration test involving 1.5 and 1.6 - can we not have a constructor/flag/config in memory.NewEnvironment which ensures there's a 1337 chain available?

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
26 New Major Issues (required ≤ 5)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

@AnieeG AnieeG enabled auto-merge December 19, 2024 18:37
@AnieeG AnieeG added this pull request to the merge queue Dec 19, 2024
Merged via the queue into develop with commit cc49b25 Dec 19, 2024
189 of 191 checks passed
@AnieeG AnieeG deleted the changesets-ccip-1_5 branch December 19, 2024 18:58
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