-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Solana todos #16391
Conversation
yashnevatia
commented
Feb 13, 2025
•
edited
Loading
edited
- 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
This reverts commit aaab52e.
@@ -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 { |
There was a problem hiding this comment.
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
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() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have a method on state to return this something like - https://github.com/smartcontractkit/chainlink/blob/develop/deployment/ccip/changeset/state.go#L166C25-L166C41
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this right condition?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why skipping the errcheck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done here
chainState := state.SolChains[cfg.ChainSelector] | ||
chain := e.SolChains[cfg.ChainSelector] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done here
We should also address https://github.com/smartcontractkit/chainlink/pull/16324/files#r1952898111 |
|
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌2 Results
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌2 Results
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌1 Results
ArtifactsFor 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 |
There was a problem hiding this comment.
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
|
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌2 Results
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |