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

Solana todos #16391

Merged
merged 40 commits into from
Feb 18, 2025
Merged

Solana todos #16391

merged 40 commits into from
Feb 18, 2025

Conversation

yashnevatia
Copy link
Contributor

@yashnevatia yashnevatia commented Feb 13, 2025

  • Using a common ValidateRamp func instead of ValidateOffRamp
  • Adding check for isOCR3ConfigSet for solana
  • Adding changeset to set fee aggregator for solana
  • Adding support for Solana -> EVM
    • Changeset modification
    • test_helpers modification
  • Removing some TODOs that are already complete
  • Adding AddTokenPool test for WSOL
  • Adding validation for token before minting

tt-cll
tt-cll previously approved these changes Feb 14, 2025
@@ -812,7 +812,7 @@ func LoadChainState(ctx context.Context, chain deployment.Chain, addresses map[s
return state, nil
}

func (s CCIPOnChainState) ValidateOffRamp(chainSelector uint64) error {
func (s CCIPOnChainState) ValidateRamp(chainSelector uint64, rampType deployment.ContractType) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : not for this PR but it will probably help if we extend it to all contracts like you did for Ramps. It can take a slice of deployment.ContractType which will ensure all the types passed in param are non-empty in state

Comment on lines 1079 to 1088
sourceChainFamily, _ := chain_selectors.GetSelectorFamily(source)

onRampBytes := []byte{}
if sourceChainFamily == chain_selectors.FamilyEVM {
onRampBytes = state.Chains[source].OnRamp.Address().Bytes()
} else if sourceChainFamily == chain_selectors.FamilySolana {
// for solana the router contract has the onramp logic
onRampBytes = state.SolChains[source].Router.Bytes()
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done here

}
var destChainStateAccount solRouter.DestChain
err = chain.GetAccountDataBorshInto(context.Background(), routerDestChainPDA, &destChainStateAccount)
if err == nil {
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 right condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, if the err is nil, that means the remote chain has already been configured and the routerDestChainPDA has already been initialised.
If the err is not nil (err="account not found"), that means the remote chain has not already been initialised and we can proceed with doing the same.

return fmt.Errorf("support for solana chain as remote chain is not implemented yet %d", remoteChainSel)
onRampAddress := s.SolChains[remoteChainSel].Router.String()
addressBytes := []byte(onRampAddress)
copy(onRampBytes[:], addressBytes)
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated to this PR - considering this is specifically for solana do you still need the switch case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes because the remoteChainSelector can be solana or evm.
we are considering solana as a family where other solana chains might be added in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

I actually had to modify this for it to work with the node: e7de104

I think this field should use the first byte to denote the length of the data, that way the padding can be trimmed in a chain agnostic way

Copy link
Contributor Author

@yashnevatia yashnevatia Feb 18, 2025

Choose a reason for hiding this comment

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

did the padding here

deployment.SPLTokens: state.SolChains[solChain].WSOL,
}

for tokenProgramName, tokenAddress := range tokenMap {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : how about you update the CS input to receive multiple token programs and token addresses. IRL you might also need to do it for multiple tokens

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 am refraining from doing that for token pool changesets as we should not be deploying more than a couple.
will leave as is for now if thats ok, and will add a couple of loops if we end up deploying for third parties.

}

func (cfg SetFeeAggregatorConfig) Validate(e deployment.Environment) error {
state, _ := cs.LoadOnchainState(e)
Copy link
Contributor

Choose a reason for hiding this comment

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

why skipping the errcheck

Copy link
Contributor Author

@yashnevatia yashnevatia Feb 17, 2025

Choose a reason for hiding this comment

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

done here

Comment on lines 440 to 441
chainState := state.SolChains[cfg.ChainSelector]
chain := e.SolChains[cfg.ChainSelector]
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 check the existence of these chains in state

Copy link
Contributor Author

@yashnevatia yashnevatia Feb 17, 2025

Choose a reason for hiding this comment

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

done here

IsEnabled: true,
TestRouter: isTestRouter,
AllowListEnabled: false,
if fromFamily == chainsel.FamilyEVM {
Copy link
Contributor

Choose a reason for hiding this comment

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

will it be clean to have sep methods for diff EVM<> Solana combination?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have made it cleaner by wrapping src/dest changesets in separate functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done here

@tt-cll
Copy link
Contributor

tt-cll commented Feb 15, 2025

@yashnevatia
Copy link
Contributor Author

We should also address https://github.com/smartcontractkit/chainlink/pull/16324/files#r1952898111

setTokenPoolCounterPart this is a test function which will not be hit if the chains are not supported as we try to deploy token pools to these chains before calling this function.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 94a7d69 (solana-todos).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

2 Results
Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestDeployerGroup 0% true true false 2 0 2 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestJobSpecChangesetIdempotent 66.6667% true true false 3 2 1 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 8.93s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @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 a352b09 (solana-todos).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

2 Results
Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestSetPoolChangeset_Execution 66.6667% true true false 3 2 1 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 5.915s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestTransferAdminRoleChangeset_Execution 0% true true false 2 0 2 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @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 a9e966d (solana-todos).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

1 Results
Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestDeployHomeChainIdempotent 66.6667% true true false 3 2 1 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 9.57s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

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

solSelectors := e.Env.AllChainSelectorsSolana()
solChain := solSelectors[0]
testhelpers.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, chain1, solChain, true)
// AddLaneWithDefaultPricesAndFeeQuoterConfig involves calling AddRemoteChainToSolana
Copy link
Contributor

@tt-cll tt-cll Feb 17, 2025

Choose a reason for hiding this comment

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

Maybe we should make AddRemoteChainToSolana idempotent. Doesn't have to be in this PR

tt-cll
tt-cll previously approved these changes Feb 17, 2025
Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 9eee32a (solana-todos).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

2 Results
Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestRemoveDons 66.6667% true true false 3 2 1 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 10.155s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestSetPoolChangeset_Execution 0% true true false 2 0 2 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip-tooling, @smartcontractkit/ccip-offchain, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

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

@tt-cll tt-cll added this pull request to the merge queue Feb 18, 2025
Merged via the queue into develop with commit 537ef14 Feb 18, 2025
181 of 183 checks passed
@tt-cll tt-cll deleted the solana-todos branch February 18, 2025 15:38
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