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

Chain writer config for Solana plugin oracle creator logic #15848

Open
wants to merge 22 commits into
base: solana-offchain-plugin
Choose a base branch
from

Conversation

huangzhen1997
Copy link
Contributor

@huangzhen1997 huangzhen1997 commented Jan 6, 2025

Jira ticket https://smartcontract-it.atlassian.net/browse/NONEVM-934

This PR remove EVM specific dependency, and add Solana support for chain writer config in plugin logic. At the moment, the Solana program address required for the plugin are not yet available. They will be configured later in a different PR, and an empty place holder will be used now for unblocking E2E test. https://chainlink-core.slack.com/archives/C0779R3AH8R/p1736289787018579?thread_ts=1736269231.525509&cid=C0779R3AH8R

Copy link
Contributor

github-actions bot commented Jan 7, 2025

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

switch chainFamily {
case relay.NetworkSolana:
var solConfig chainwriter.ChainWriterConfig
if solConfig, err = getSolanaChainWriterConfig(transmitter[0]); err == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at how this transmitter map is initialized, the addresses are still EVM-specific. I assume CCIP team will update it, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point, that too needs to be changed to support solana keystore too.
I think we need to do it.
It seems similar to the previous PR @archseer sent to support solana keystore.

We need a switch statement there per chain family, and for solana, do this:
solKeys, err := d.keystore.Solana().GetAll()

Plz check with @archseer. 1 thing I see missing is the solana chain-id here.

Copy link
Contributor Author

@huangzhen1997 huangzhen1997 Jan 9, 2025

Choose a reason for hiding this comment

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

@archseer Shall we Implement EnabledAddressesForChain for Solana keystore as well ?

@@ -483,6 +482,30 @@ func isUSDCEnabled(ofc offChainConfig) bool {
return ofc.exec().IsUSDCEnabled()
}

// TODO once on-chain account lookup address are available, the config will be updated
func getSolanaChainWriterConfig(fromAddress string) (chainwriter.ChainWriterConfig, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this solana specific function to a new package ccip.configs.solana, similar to how the evm configs are structured in the ccip/configs/evm/chain_writer.go file

InputModifications: nil,
ChainSpecificName: "commit"},
},
// TODO this IDL definition configured statically somewhere or passed in as parameter
Copy link
Contributor

Choose a reason for hiding this comment

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

switch chainFamily {
case relay.NetworkSolana:
var solConfig chainwriter.ChainWriterConfig
if solConfig, err = getSolanaChainWriterConfig(transmitter[0]); 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.

Good point, that too needs to be changed to support solana keystore too.
I think we need to do it.
It seems similar to the previous PR @archseer sent to support solana keystore.

We need a switch statement there per chain family, and for solana, do this:
solKeys, err := d.keystore.Solana().GetAll()

Plz check with @archseer. 1 thing I see missing is the solana chain-id here.

@huangzhen1997 huangzhen1997 changed the base branch from develop to solana-offchain-plugin January 9, 2025 19:50
return chainwriter.ChainWriterConfig{}, fmt.Errorf("unexpected error: invalid CCIP Router IDL, error: %w", err)
}

solConfig := chainwriter.ChainWriterConfig{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the rest of the address like routerProgram and commonAddressesLookupTable etc. become available, will they be hard coded here, or provided by tooling team ?

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 should be provided by some sort of tooling since addresses will be different for testnets than mainnet

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not possible to directly refer to this file in the chainlink-ccip repo?
I worry if we create a copy here, it won't keep updated if things change on the source of truth.

Copy link
Contributor Author

@huangzhen1997 huangzhen1997 Jan 10, 2025

Choose a reason for hiding this comment

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

I tried to, but for some reason the generated IDL json doesn't exist in the module github.com/smartcontractkit/chainlink-ccip. It's excluded from compilation. https://chainlink-core.slack.com/archives/C0779R3AH8R/p1736537328721779?thread_ts=1736526205.277789&cid=C0779R3AH8R

return
}()
case relay.NetworkSolana:
// Implement EnabledAddressesForChain for Solana as well ?
Copy link
Contributor

Choose a reason for hiding this comment

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

This interface has been EVM-only, so I'd keep the comment and maybe tackle this in the future

}
return
}()
case relay.NetworkSolana:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add NetworkAptos, NetworkCosmos and NetworkStarknet definitions? They'll all look identical to the Solana case and it'll save us time in the future

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