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

add support for solana on home chain #15826

Draft
wants to merge 100 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
b606a3e
adding first solana todo
yashnevatia Dec 17, 2024
24ffec9
adding todos
yashnevatia Dec 17, 2024
7376e7d
job spec todo
yashnevatia Dec 17, 2024
b7429a9
test TODOs
yashnevatia Dec 17, 2024
42ed1da
Adding stuff
yashnevatia Dec 18, 2024
bc536f0
Adding chainlink-ccip solana pkg
yashnevatia Dec 18, 2024
79c2961
solana draft
yashnevatia Dec 23, 2024
8a31399
solana link token skeleton
tt-cll Dec 23, 2024
e681a59
merging
yashnevatia Dec 23, 2024
486c512
stuff
yashnevatia Dec 23, 2024
c1d11f7
fixing test
yashnevatia Dec 23, 2024
56e7574
bump go mod; add ccip router
tt-cll Dec 24, 2024
9bd60a8
solana prereq skeleton
tt-cll Dec 26, 2024
80561c9
move deploy code
tt-cll Dec 26, 2024
cdbe726
go mod tidy
yashnevatia Dec 27, 2024
aa4d2e5
merging
yashnevatia Dec 27, 2024
c98c36f
Adding solana link token changeset
yashnevatia Dec 27, 2024
9989bcf
adding test for DeployChainContractsSolana
yashnevatia Dec 27, 2024
b1a192f
adding add chain selector
yashnevatia Jan 2, 2025
8dcd962
removing test file
yashnevatia Jan 2, 2025
ec01e3e
add support for solana on home chain
tt-cll Jan 2, 2025
b95e1c7
lint
tt-cll Jan 2, 2025
4bf2187
lint
tt-cll Jan 2, 2025
b4dc5a6
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
yashnevatia Jan 3, 2025
0a4e0cc
adding SetOCR3ConfigSolana
yashnevatia Jan 3, 2025
aaab52e
Adding solchains in NewEnv
yashnevatia Jan 3, 2025
f19598e
Revert "Adding solchains in NewEnv"
yashnevatia Jan 3, 2025
e4f1f05
adding sol chains to newenv
yashnevatia Jan 3, 2025
18d77d1
newEnv needs to send nil
yashnevatia Jan 3, 2025
54d79e7
comments
tt-cll Jan 3, 2025
0713ee5
lint
tt-cll Jan 3, 2025
4a392f6
Merge remote-tracking branch 'origin/yn-solana' into tt/homeChain
tt-cll Jan 3, 2025
807472b
check sol state
tt-cll Jan 3, 2025
8150d8d
adding test env setup
yashnevatia Jan 6, 2025
7a2afca
adding link token deployment and test
yashnevatia Jan 6, 2025
7da3b14
adding nil for crib sol chains
yashnevatia Jan 6, 2025
3b1e77a
Merge branch 'solana-updates' of github.com:smartcontractkit/chainlin…
yashnevatia Jan 6, 2025
534dc6e
wip tests
tt-cll Jan 6, 2025
954fef1
update home chain config working
tt-cll Jan 6, 2025
fa333c3
deployment: memory: Generate more transmitter key types, expose in JD
archseer Jan 7, 2025
c6feb63
deployment: memory: Configure nodes with solana config too
archseer Jan 7, 2025
3bb7f08
return SolChain struct rather than strings
archseer Jan 7, 2025
98a7d6d
integrate ctf to spin up inmemory chain
jlaveracll Dec 30, 2024
5dc5873
Generate keypair on the fly for memory, wire up new code in memory/node
archseer Jan 7, 2025
1c41814
using switch case
yashnevatia Jan 7, 2025
01f39eb
Adding decimal const
yashnevatia Jan 7, 2025
3a4ae18
adding chain selectors commit
yashnevatia Jan 7, 2025
b76324d
go mod tidy
yashnevatia Jan 7, 2025
b8a9542
Merge branch 'solana-updates' of github.com:smartcontractkit/chainlin…
yashnevatia Jan 7, 2025
b36af9d
adding initial code for solana chain contracts deploy
yashnevatia Jan 7, 2025
9d87560
linting
yashnevatia Jan 7, 2025
31cde63
merging
yashnevatia Jan 7, 2025
818f7fb
adding solana state
yashnevatia Jan 7, 2025
98e3890
adding initial code for solana chain contracts deploy
yashnevatia Jan 7, 2025
7c7c36e
wip
yashnevatia Jan 7, 2025
78664bc
wip
yashnevatia Jan 7, 2025
2f98015
chain sel update
yashnevatia Jan 7, 2025
cd73657
update core/scripts go files
yashnevatia Jan 7, 2025
a4ec585
again
yashnevatia Jan 7, 2025
0a2336b
Merge remote-tracking branch 'origin/develop' into solana-updates
tt-cll Jan 7, 2025
c0f35b9
add changeset
tt-cll Jan 7, 2025
334079b
Use autopatchelf on solana binaries to make them usable on NixOS
archseer Jan 8, 2025
84dcdda
Use the memory environment on deploy tests too
archseer Jan 8, 2025
95d24a5
integration-tests: go mod tidy
archseer Jan 8, 2025
75bf435
Use randomized port for solana validator
archseer Jan 8, 2025
720dccb
go imports
yashnevatia Jan 8, 2025
859dd64
Merge branch 'solana-updates' of github.com:smartcontractkit/chainlin…
yashnevatia Jan 8, 2025
c08d092
go mod
yashnevatia Jan 8, 2025
d0882cd
go mod
yashnevatia Jan 8, 2025
1e55e6f
go mod tidy
yashnevatia Jan 8, 2025
8b0f261
lint
yashnevatia Jan 8, 2025
66ff0d3
Merge branch 'solana-link-deploy' of github.com:smartcontractkit/chai…
yashnevatia Jan 8, 2025
a3974dc
todo
yashnevatia Jan 8, 2025
4de2362
Merge branch 'solana-state-updates' of github.com:smartcontractkit/ch…
yashnevatia Jan 8, 2025
90b421e
deploy stuff
yashnevatia Jan 8, 2025
87c289a
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
yashnevatia Jan 8, 2025
715f213
Merge remote-tracking branch 'origin/deployment-memory-solana' into t…
tt-cll Jan 8, 2025
016e8fa
passing changesets
tt-cll Jan 8, 2025
a4b2bc6
Adding solana router deploy
yashnevatia Jan 8, 2025
074dacf
Adding
yashnevatia Jan 8, 2025
1d13322
moving over from deployment-memory-solana
yashnevatia Jan 8, 2025
650a18a
merging
yashnevatia Jan 8, 2025
62d0e00
Merge branch 'solana-link-deploy' of github.com:smartcontractkit/chai…
yashnevatia Jan 8, 2025
7e3b169
updates
yashnevatia Jan 8, 2025
754f858
Merge branch 'solana-state-updates' of github.com:smartcontractkit/ch…
yashnevatia Jan 8, 2025
040ca48
adding stuff for tests
yashnevatia Jan 8, 2025
abb5a01
linting
yashnevatia Jan 8, 2025
e846d6f
Merge branch 'develop' into solana-link-deploy
yashnevatia Jan 9, 2025
58480cf
merging
yashnevatia Jan 9, 2025
f4c69fd
Merge branch 'solana-link-deploy' of github.com:smartcontractkit/chai…
yashnevatia Jan 9, 2025
b4a7781
linting
yashnevatia Jan 9, 2025
b325e8b
Merge branch 'solana-link-deploy' of github.com:smartcontractkit/chai…
yashnevatia Jan 9, 2025
31e8133
changing to ctf
yashnevatia Jan 9, 2025
7fcf845
bug
yashnevatia Jan 9, 2025
723cc1a
Merge branch 'develop' of github.com:smartcontractkit/chainlink into …
yashnevatia Jan 9, 2025
d8f5646
merging
yashnevatia Jan 9, 2025
225455d
Merge branch 'solana-router-deploy' of github.com:smartcontractkit/ch…
yashnevatia Jan 9, 2025
cec7880
Merge remote-tracking branch 'origin/solana-memory-node' into tt/home…
tt-cll Jan 9, 2025
b3acadc
attempt cleanup
tt-cll Jan 9, 2025
89eaad6
Merge remote-tracking branch 'origin/solana-memory-node' into tt/home…
tt-cll Jan 9, 2025
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
38 changes: 24 additions & 14 deletions deployment/ccip/changeset/cs_ccip_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,8 @@ func (p PromoteCandidatesChangesetConfig) Validate(e deployment.Environment) ([]
if err := deployment.IsValidChainSelector(chainSelector); err != nil {
return nil, fmt.Errorf("don chain selector invalid: %w", err)
}
chainState, exists := state.Chains[chainSelector]
if !exists {
return nil, fmt.Errorf("chain %d does not exist", chainSelector)
}
if chainState.OffRamp == nil {
// should not be possible, but a defensive check.
return nil, fmt.Errorf("OffRamp contract does not exist")
if err := state.ValidateState(chainSelector); err != nil {
return nil, err
}

donID, err := internal.DonIDForChain(
Expand Down Expand Up @@ -310,9 +305,8 @@ func (s SetCandidateConfigBase) Validate(e deployment.Environment, state CCIPOnC
if err := deployment.IsValidChainSelector(chainSelector); err != nil {
return fmt.Errorf("don chain selector invalid: %w", err)
}
if state.Chains[chainSelector].OffRamp == nil {
// should not be possible, but a defensive check.
return fmt.Errorf("OffRamp contract does not exist on don chain selector %d", chainSelector)
if err := state.ValidateState(chainSelector); err != nil {
return err
}
if s.PluginType != types.PluginTypeCCIPCommit &&
s.PluginType != types.PluginTypeCCIPExec {
Expand Down Expand Up @@ -422,10 +416,18 @@ func AddDonAndSetCandidateChangeset(
}
var donOps []mcms.Operation
for chainSelector, params := range cfg.OCRConfigPerRemoteChainSelector {
var offRampAddress []byte
if deployment.IsSolanaChainFamily(chainSelector) {
// TODO: SOLANA_CCIP put the ccip_router address here
// offRampAddress = state.SolChains[chainSelector].CcipRouter.Address().Bytes()
offRampAddress = []byte{}
} else {
offRampAddress = state.Chains[chainSelector].OffRamp.Address().Bytes()
}
newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome(
e.OCRSecrets,
state.Chains[chainSelector].OffRamp,
e.Chains[chainSelector],
offRampAddress,
chainSelector,
nodes.NonBootstraps(),
state.Chains[cfg.HomeChainSelector].RMNHome.Address(),
params.OCRParameters,
Expand Down Expand Up @@ -597,10 +599,18 @@ func SetCandidateChangeset(
}
var setCandidateOps []mcms.Operation
for chainSelector, params := range cfg.OCRConfigPerRemoteChainSelector {
var offRampAddress []byte
if deployment.IsSolanaChainFamily(chainSelector) {
// TODO: put the ccip_router address here
// offRampAddress = state.SolChains[chainSelector].CcipRouter.Address().Bytes()
offRampAddress = []byte{}
} else {
offRampAddress = state.Chains[chainSelector].OffRamp.Address().Bytes()
}
newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome(
e.OCRSecrets,
state.Chains[chainSelector].OffRamp,
e.Chains[chainSelector],
offRampAddress,
chainSelector,
nodes.NonBootstraps(),
state.Chains[cfg.HomeChainSelector].RMNHome.Address(),
params.OCRParameters,
Expand Down
12 changes: 6 additions & 6 deletions deployment/ccip/changeset/internal/deploy_home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ func BuildSetOCR3ConfigArgs(

func BuildOCR3ConfigForCCIPHome(
ocrSecrets deployment.OCRSecrets,
offRamp *offramp.OffRamp,
dest deployment.Chain,
offRampAddress []byte,
destSelector uint64,
nodes deployment.Nodes,
rmnHomeAddress common.Address,
ocrParams types2.OCRParameters,
Expand All @@ -212,9 +212,9 @@ func BuildOCR3ConfigForCCIPHome(
var oracles []confighelper.OracleIdentityExtra
for _, node := range nodes {
schedule = append(schedule, 1)
cfg, exists := node.OCRConfigForChainSelector(dest.Selector)
cfg, exists := node.OCRConfigForChainSelector(destSelector)
if !exists {
return nil, fmt.Errorf("no OCR config for chain %d", dest.Selector)
return nil, fmt.Errorf("no OCR config for chain %d", destSelector)
}
oracles = append(oracles, confighelper.OracleIdentityExtra{
OracleIdentity: confighelper.OracleIdentity{
Expand Down Expand Up @@ -314,10 +314,10 @@ func BuildOCR3ConfigForCCIPHome(

ocr3Configs[pluginType] = ccip_home.CCIPHomeOCR3Config{
PluginType: uint8(pluginType),
ChainSelector: dest.Selector,
ChainSelector: destSelector,
FRoleDON: configF,
OffchainConfigVersion: offchainConfigVersion,
OfframpAddress: offRamp.Address().Bytes(),
OfframpAddress: offRampAddress,
Nodes: ocrNodes,
OffchainConfig: offchainConfig,
RmnHomeAddress: rmnHomeAddress.Bytes(),
Expand Down
25 changes: 25 additions & 0 deletions deployment/ccip/changeset/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ func (s CCIPOnChainState) SupportedChains() map[uint64]struct{} {
for chain := range s.Chains {
chains[chain] = struct{}{}
}
for chain := range s.SolChains {
chains[chain] = struct{}{}
}
return chains
}

Expand Down Expand Up @@ -663,3 +666,25 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type
}
return state, nil
}

// ValidateState validates the state of the CCIP deployment
func (s CCIPOnChainState) ValidateState(chainSelector uint64) error {
if deployment.IsSolanaChainFamily(chainSelector) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe just inline this and use switch/case? We'll be adding more conditionals here as chains are added

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 good idea

_, exists := s.SolChains[chainSelector]
if !exists {
return fmt.Errorf("chain %d does not exist", chainSelector)
}
// TODO: SOLANA_CCIP
// check for ccip router existing
} else {
chainState, exists := s.Chains[chainSelector]
if !exists {
return fmt.Errorf("chain %d does not exist", chainSelector)
}
if chainState.OffRamp == nil {
// should not be possible, but a defensive check.
return errors.New("OffRamp contract does not exist")
}
}
return nil
}
8 changes: 8 additions & 0 deletions deployment/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,11 @@ func ChainInfo(cs uint64) (chain_selectors.ChainDetails, error) {
}
return info, nil
}

func IsSolanaChainFamily(cs uint64) bool {
family, err := chain_selectors.GetSelectorFamily(cs)
if err != nil {
return false
}
return family == chain_selectors.FamilySolana
}
Loading