Skip to content

feat: add solana #1

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

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open

feat: add solana #1

wants to merge 59 commits into from

Conversation

frenzox
Copy link
Collaborator

@frenzox frenzox commented Apr 29, 2025

No description provided.

@frenzox frenzox self-assigned this Apr 29, 2025
@frenzox frenzox added the enhancement New feature or request label Apr 29, 2025
@frenzox frenzox moved this to In Progress in solana-axelar Apr 29, 2025
@frenzox frenzox force-pushed the feat/solana branch 8 times, most recently from 9cacb83 to 2db0eec Compare May 2, 2025 14:37
@frenzox frenzox force-pushed the feat/solana branch 6 times, most recently from 93ae4ff to f4adef4 Compare May 13, 2025 16:00
frenzox added 11 commits May 14, 2025 14:46
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
These keys will be used in other modules as well.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Since we're here, fix the visibility of the functions.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Not sure how this is supposed to be populated yet. I believe this is
filled by Axelar since we need a chainId.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
@frenzox frenzox requested review from eloylp and ICavlek May 15, 2025 10:34
"rpc": "https://api.devnet.solana.com",
"chainType": "svm",
"decimals": 9,
"finality": TBD,
Copy link
Collaborator Author

@frenzox frenzox May 15, 2025

Choose a reason for hiding this comment

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

Do you guys have any idea what are we supposed to put here? I see for evm it's just "finalized", for stellar it has a "1" 🤷‍♂️

Copy link

Choose a reason for hiding this comment

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

This value is used to determine when a hard finalized block can be retrieved to verify and relay a message. In EVMs we use the finality tag as part of their standard JSON-RPC methods if its supported by the chain. For solana the value should be minimum number of blocks until a transaction can be considered fully finalized (hard finality)

Choose a reason for hiding this comment

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

@frenzox I believe this value should be "31" to be consistent with what would be considered a "finalized" commitment level on Solana, as there is no concept of a "finalized" tag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

Comment on lines 169 to 171
| **Devnet-amplifier** | TBD | TBD |
| **Testnet** | TBD | TBD |
| **Mainnet** | TBD | TBD |
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Other chains seem to have some predefined numbers for these parameters. Do we have as well? Where does it come from?

Choose a reason for hiding this comment

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

The minimumRotationDelay is the minimum frequency at which we expect the signer set is updated on Axelar itself (for example on mainnet it would be at most once per day or 86,400 seconds). The previousSignerRetention refers to how many epochs a signer set is valid for signature verification. We want the proof to be valid for up to 2 weeks, so we set previous SingerRetention to 15.

You can use the values from Stellar: https://github.com/axelarnetwork/axelar-contract-deployments/blob/c572991f28224e81f44ee64e50034778ee352f87/releases/stellar/2025-01-GMP-v1.0.0.md?plain=1#L103

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Awesome, thanks for the explanation @AttissNgo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

@@ -0,0 +1 @@
../axelar-chains-config/info/devnet-amplifier.json
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I don't need these simlinks anymore.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

2. Clone the solana-axelar repository.

3. Build the Solana programs:
Copy link

Choose a reason for hiding this comment

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

Do we have a checksum value to ensure correct version is the one built and deployed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! I should update the instructions to use the solana-verify tool. Does that align with what you have in mind?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the instruction in order to add verifiable build. This will also ensure the on-chain program corresponds to the git commit hash and flag it as verified in the explorer.

#### Devnet-amplifier:

```json
"solana-devnet": {
Copy link

Choose a reason for hiding this comment

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

since we organize the configs into separate files the ending "devnet", "stagenet" is not needed, and we can just use "solana" as the identifiers

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b499966

1. Deploy Gateway program:

```sh
solana program-v4 deploy \
Copy link

Choose a reason for hiding this comment

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

In order to avoid to much copying of values in terminal when preparing to run commands we recommend that we set an ENV values all the parameters that are needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

"rpc": "https://api.devnet.solana.com",
"chainType": "svm",
"decimals": 9,
"finality": TBD,

Choose a reason for hiding this comment

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

@frenzox I believe this value should be "31" to be consistent with what would be considered a "finalized" commitment level on Solana, as there is no concept of a "finalized" tag

"chainType": "svm",
"decimals": 9,
"finality": TBD,
"approxFinalityWaitTime": 13,

Choose a reason for hiding this comment

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

Suggested change
"approxFinalityWaitTime": 13,
"approxFinalityWaitTime": 1,

This value is in minutes (not seconds)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

Comment on lines 92 to 93
"finality": TBD,
"approxFinalityWaitTime": 13,

Choose a reason for hiding this comment

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

See above for "finality" and "approxFinalityWaitTime"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

Comment on lines 112 to 113
"finality": TBD,
"approxFinalityWaitTime": 13,

Choose a reason for hiding this comment

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

See above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

Comment on lines 169 to 171
| **Devnet-amplifier** | TBD | TBD |
| **Testnet** | TBD | TBD |
| **Mainnet** | TBD | TBD |

Choose a reason for hiding this comment

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

The minimumRotationDelay is the minimum frequency at which we expect the signer set is updated on Axelar itself (for example on mainnet it would be at most once per day or 86,400 seconds). The previousSignerRetention refers to how many epochs a signer set is valid for signature verification. We want the proof to be valid for up to 2 weeks, so we set previous SingerRetention to 15.

You can use the values from Stellar: https://github.com/axelarnetwork/axelar-contract-deployments/blob/c572991f28224e81f44ee64e50034778ee352f87/releases/stellar/2025-01-GMP-v1.0.0.md?plain=1#L103


2. Route GMP call via Amplifier:

- <https://docs.axelar.dev/dev/amplifier/chain-integration/relay-messages>

Choose a reason for hiding this comment

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

TX_EVENT, which represents the index of the ContractCall event, is needed for manual relaying. How does this work in Solana since the tx emits logs rather than events? Could you provide a brief instruction of how to get this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The event id will be the line number in the tx logs where the event data is located. I'll add a command to retrieve the gateway events and their respective ids from a transaction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added new comment to get the events in 9d76afd and updated instructions in b499966


```sh
solana/solana-axelar-cli send gateway submit-proof \
--multisig-session-id <MULTISIG_SESSION_ID>

Choose a reason for hiding this comment

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

Please add step to confirm that message is received on Solana

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

```sh
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
```

Choose a reason for hiding this comment

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

Let's also specify the Solana CLI version used for deployment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated on b499966

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done in b499966


```sh
# Set default cluster
solana config set --url testnet # Use appropriate network: testnet, devnet, mainnet-beta, or localhost

Choose a reason for hiding this comment

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

This will be different for mainnet, let's add environment-specific instructions here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done in b499966

#### Devnet-amplifier:

```json
"solana-devnet": {

Choose a reason for hiding this comment

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

No need to add devnet in the config name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in b499966

"solana-devnet": {
"name": "Solana Devnet",
"axelarId": "solana-devnet",
"rpc": "https://api.devnet.solana.com",

Choose a reason for hiding this comment

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

We usually connect test networks on our devnet, lets discuss if a devnet connection is preferred here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just to make sure I understand, you mean solana testnet should be used for both axelar's devnet-amplifier and testnet?

Choose a reason for hiding this comment

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

@frenzox correct, unless there is some need to use the Solana devnet instead. What was the reasoning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AFAIK all our devnet-amplifier tests so far were performed using solana devnet, that's why I assumed it was the case here. I'll update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@blockchainguyy @AttissNgo Here are the solana docs explaining the difference between the environments. Could you take a look and tell me what you think? The solana-devnet is an official public network used for testing smart contracts, it's not a local network normally seen in EVM world.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After reading it, it seems to me that we should actually use only Solana devnet for both Axelar's devnet-amplifier and testnet and not uset Solana testnet at all. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I adjusted to to use only solana mainnet-beta for axelar mainnet and solana devnet for the other axeler environments. Please let me know if you think it should be done otherwise. I did like so since according to the docs:

Testnet is where the Solana core contributors stress test recent release features on a live cluster, particularly focused on network performance, stability and validator behavior.

Testnet may be subject to ledger resets.
Testnet typically runs a newer software release branch than both Devnet and Mainnet Beta

and

Devnet serves as a playground for anyone who wants to take Solana for a test drive, as a user, token holder, app developer, or validator.

Application developers should target Devnet.
Potential validators should first target Devnet.

#### Testnet:

```json
"solana-testnet": {

Choose a reason for hiding this comment

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

same here.

This is, atm, merely a copy of the Steller counterpart with updated
chain name.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

## Deployment

- Create an `.env` config. `CHAIN` should be set to `Solana`.

Choose a reason for hiding this comment

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

Suggested change
- Create an `.env` config. `CHAIN` should be set to `Solana`.
- Create an `.env` config. `CHAIN` should be set to `solana`.

Chain names stored in config are lowercase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in 216fc06

"sourceGatewayAddress": "[external gateway address]",
"votingThreshold": "[voting threshold]",
"blockExpiry": 10,
"confirmationHeight": 1,

Choose a reason for hiding this comment

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

Suggested change
"confirmationHeight": 1,
"confirmationHeight": 31,

to reflect "finalized" commitment level on Solana

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in 216fc06

Comment on lines 71 to 72
"msgIdFormat": "hex_tx_hash_and_event_index",
"addressFormat": "stellar"

Choose a reason for hiding this comment

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

Suggested change
"msgIdFormat": "hex_tx_hash_and_event_index",
"addressFormat": "stellar"
"msgIdFormat": "base58_tx_signature_and_log_index",
"addressFormat": "solana"

"signingThreshold": "[signing threshold]",
"serviceName": "[service name]",
"verifierSetDiffThreshold": 0,
"encoder": "stellar_xdr",

Choose a reason for hiding this comment

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

Suggested change
"encoder": "stellar_xdr",
"encoder": "borsh",

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated in 216fc06

frenzox added 6 commits May 21, 2025 15:11
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Address some review comments that pointed out there's no direct map
between solana clusters and axelar env. Solana devnet should likely be
used for everything other than mainnet. Solana mainnet-beta should be
used with axelar mainnet. This will be emphasized in the docs as well.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
On solana, transactions are not used to query the ledger, instead we use
get_account RPC method to fetch account information.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Signed-off-by: Guilherme Felipe da Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Incorporate deployment scripts to Axelar deployments repo
4 participants