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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ded3f4c
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 7, 2024
b41bebe
just start
AnieeG Dec 9, 2024
91bbfe5
placeholders
AnieeG Dec 10, 2024
9a29a00
state
AnieeG Dec 10, 2024
a4bebba
change
AnieeG Dec 10, 2024
86d3947
updates
AnieeG Dec 11, 2024
4a143bf
updates
AnieeG Dec 11, 2024
7aaa0ef
all updates
AnieeG Dec 11, 2024
c4ab875
change
AnieeG Dec 11, 2024
774c933
include views
AnieeG Dec 11, 2024
aabba80
comments
AnieeG Dec 12, 2024
24dd0c9
progress so far
AnieeG Dec 13, 2024
74063c9
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 16, 2024
9b85a7b
add test
AnieeG Dec 17, 2024
cb923b0
more updates
AnieeG Dec 17, 2024
6bb2a6d
updates
AnieeG Dec 17, 2024
8d2ea2a
changes
AnieeG Dec 17, 2024
669fba6
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 17, 2024
5861532
updates
AnieeG Dec 17, 2024
572fe53
formatting
AnieeG Dec 17, 2024
37ac6e9
fix crib
AnieeG Dec 17, 2024
edd1ef1
fix more tests
AnieeG Dec 17, 2024
ea81972
lint fix
AnieeG Dec 18, 2024
599bb5c
comments
AnieeG Dec 18, 2024
4669024
fix format
AnieeG Dec 18, 2024
c119985
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
AnieeG Dec 18, 2024
b76b6fc
multichain
AnieeG Dec 18, 2024
88301f3
fix lint
AnieeG Dec 18, 2024
4032b96
merge with develop
AnieeG Dec 18, 2024
347a775
fix lint
AnieeG Dec 18, 2024
207a6bc
change func name
AnieeG Dec 18, 2024
d64279b
review comments
AnieeG Dec 18, 2024
08d138c
lint fix
AnieeG Dec 18, 2024
514aefc
removed legacyjobclient
AnieeG Dec 18, 2024
cd17fe1
review comments
AnieeG Dec 19, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package integrationtesthelpers

import (
"bytes"
"crypto/sha256"
"fmt"
"text/template"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/google/uuid"
"github.com/lib/pq"

"github.com/smartcontractkit/chainlink-common/pkg/types"
Expand All @@ -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

}

// Type returns the type of the job
Expand All @@ -39,9 +42,14 @@ func (o *OCR2TaskJobSpec) String() (string, error) {
if o.OCR2OracleSpec.FeedID != nil {
feedID = o.OCR2OracleSpec.FeedID.Hex()
}
externalID, err := ExternalJobID(o.Name)
if err != nil {
return "", err
}
specWrap := struct {
Name string
JobType string
ExternalJobID string
MaxTaskDuration string
ForwardingAllowed bool
ContractID string
Expand All @@ -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

ForwardingAllowed: o.ForwardingAllowed,
MaxTaskDuration: o.MaxTaskDuration,
ContractID: o.OCR2OracleSpec.ContractID,
Expand All @@ -82,6 +91,7 @@ func (o *OCR2TaskJobSpec) String() (string, error) {
ocr2TemplateString := `
type = "{{ .JobType }}"
name = "{{.Name}}"
externalJobID = "{{.ExternalJobID}}"
forwardingAllowed = {{.ForwardingAllowed}}
{{if .MaxTaskDuration}}
maxTaskDuration = "{{ .MaxTaskDuration }}" {{end}}
Expand Down Expand Up @@ -332,3 +342,18 @@ func (c *CCIPIntegrationTestHarness) NewCCIPJobSpecParams(tokenPricesUSDPipeline
USDCAttestationAPI: usdcAttestationAPI,
}
}

func ExternalJobID(jobName string) (string, error) {
in := []byte(jobName)
sha256Hash := sha256.New()
sha256Hash.Write(in)
in = sha256Hash.Sum(nil)[:16]
// tag as valid UUID v4 https://github.com/google/uuid/blob/0f11ee6918f41a04c201eceeadf612a377bc7fbc/version4.go#L53-L54
in[6] = (in[6] & 0x0f) | 0x40 // Version 4
in[8] = (in[8] & 0x3f) | 0x80 // Variant is 10
id, err := uuid.FromBytes(in)
if err != nil {
return "", err
}
return id.String(), nil
}
26 changes: 5 additions & 21 deletions deployment/ccip/changeset/cs_deploy_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ccip_home"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/maybe_revert_message_receiver"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/nonce_manager"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp"
Expand Down Expand Up @@ -178,32 +177,17 @@ func deployChainContracts(
}
rmnProxyContract := chainState.RMNProxy
if chainState.RMNProxy == nil {
e.Logger.Errorw("RMNProxy not found", "chain", chain.String())
return fmt.Errorf("rmn proxy not found for chain %s, deploy the prerequisites first", chain.String())
}
if chainState.Receiver == nil {
_, err := deployment.DeployContract(e.Logger, chain, ab,
func(chain deployment.Chain) deployment.ContractDeploy[*maybe_revert_message_receiver.MaybeRevertMessageReceiver] {
receiverAddr, tx, receiver, err2 := maybe_revert_message_receiver.DeployMaybeRevertMessageReceiver(
chain.DeployerKey,
chain.Client,
false,
)
return deployment.ContractDeploy[*maybe_revert_message_receiver.MaybeRevertMessageReceiver]{
receiverAddr, receiver, tx, deployment.NewTypeAndVersion(CCIPReceiver, deployment.Version1_0_0), err2,
}
})
if err != nil {
e.Logger.Errorw("Failed to deploy receiver", "err", err)
return err
}
} else {
e.Logger.Infow("receiver already deployed", "addr", chainState.Receiver.Address, "chain", chain.String())
}
var rmnLegacyAddr common.Address
if chainState.MockRMN != nil {
rmnLegacyAddr = chainState.MockRMN.Address()
}
// TODO add legacy RMN here when 1.5 contracts are available
// If RMN is deployed, set rmnLegacyAddr to the RMN address
AnieeG marked this conversation as resolved.
Show resolved Hide resolved
if chainState.RMN != nil {
rmnLegacyAddr = chainState.RMN.Address()
}
if rmnLegacyAddr == (common.Address{}) {
e.Logger.Warnf("No legacy RMN contract found for chain %s, will not setRMN in RMNRemote", chain.String())
AnieeG marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down
8 changes: 7 additions & 1 deletion deployment/ccip/changeset/cs_deploy_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
for _, chain := range e.AllChainSelectors() {
cfg[chain] = proposalutils.SingleGroupTimelockConfig(t)
}
var prereqCfg []DeployPrerequisiteConfigPerChain

Check failure on line 36 in deployment/ccip/changeset/cs_deploy_chain_test.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (deployment)

Consider pre-allocating `prereqCfg` (prealloc)
for _, chain := range e.AllChainSelectors() {
prereqCfg = append(prereqCfg, DeployPrerequisiteConfigPerChain{
ChainSelector: chain,
})
}
e, err = commonchangeset.ApplyChangesets(t, e, nil, []commonchangeset.ChangesetApplication{
{
Changeset: commonchangeset.WrapChangeSet(DeployHomeChain),
Expand All @@ -57,7 +63,7 @@
{
Changeset: commonchangeset.WrapChangeSet(DeployPrerequisites),
Config: DeployPrerequisiteConfig{
ChainSelectors: selectors,
Configs: prereqCfg,
},
},
{
Expand Down
Loading
Loading