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

Feat: Solana CFE and initialization #4933

Merged
merged 92 commits into from
Jun 26, 2024
Merged

Conversation

albert-llimos
Copy link
Contributor

@albert-llimos albert-llimos commented Jun 3, 2024

Pull Request

Closes: PRO-1403, PRO-1349, PRO-1208, PRO-1267, PRO-1327, PRO-1019, PRO-1420

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

This PR includes:

  • Solana chain initialization
  • Implementation of the Solana RPC client.
  • Witnessing of Sol and SolUsdc
  • Chain tracking
  • Witnessing of nonce accounts.
  • Key generation.
  • Threshold signing.
  • Broadcast transaction logic
  • Witnessing of broadcast transactions.
  • Tests for a good chunk of the logic implemented.
  • Updated Solana migration

Notes:

  • The durable nonces logic (fetching from env. and submitting extrinsic) is not yet implemented in the SC so I left it as TODO, but the witnessing logic is there. I will add them once feat: Solana Durable Nonce Accounts logic #4996 is completed.
  • For now we witness the nonces periodically to make it simpler and to ensure that the SC is always in sync with Solana. It is an option to take a different approach but I think for now that's good.
  • There is some logic around balance witnessing that will need to slightly change once the new Solana pallet is ready. The current workaround in the code allow us to get it working in the bouncer and will then be updated once that pallet is done. Alastair is on board with this.

@albert-llimos albert-llimos marked this pull request as ready for review June 3, 2024 14:05
@albert-llimos albert-llimos requested review from a team and martin-chainflip as code owners June 3, 2024 14:05
@albert-llimos albert-llimos requested review from ahasna and removed request for a team June 3, 2024 14:05
@kylezs kylezs marked this pull request as draft June 3, 2024 14:22
@albert-llimos albert-llimos changed the title Feat/solana cfe rpc Feat: Solana CFE and initialization Jun 3, 2024
@AlastairHolmes
Copy link
Contributor

Just rebased all the commits, you can easily see there is no difference between fe76034 (original) and 719e2b6 (force-pushed), other than that I removed a single wrongly placed comment.

@@ -0,0 +1,195 @@
#![allow(deprecated)]
Copy link
Contributor

@AlastairHolmes AlastairHolmes Jun 17, 2024

Choose a reason for hiding this comment

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

@albert-llimos I'm assuming this is copied code, right? Could you comment that on the files that are copied and put them together, which seems like a good idea too.

@AlastairHolmes
Copy link
Contributor

image

Reminder to myself and reviewers.

@albert-llimos albert-llimos marked this pull request as ready for review June 25, 2024 08:03
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 55.07951% with 1017 lines in your changes missing coverage. Please review.

Project coverage is 71%. Comparing base (0eab425) to head (1ad5923).

Files Patch % Lines
engine/src/witness/sol/sol_deposits.rs 66% 143 Missing and 11 partials ⚠️
engine/src/sol/retry_rpc.rs 59% 99 Missing and 39 partials ⚠️
engine/src/witness/sol.rs 35% 133 Missing and 2 partials ⚠️
engine/src/sol/commitment_config.rs 7% 77 Missing ⚠️
engine/src/witness/sol/nonce_witnessing.rs 56% 61 Missing and 3 partials ⚠️
...chain/runtime/src/migrations/solana_integration.rs 0% 49 Missing ⚠️
engine/src/state_chain_observer/sc_observer.rs 27% 46 Missing and 1 partial ⚠️
engine/src/sol/rpc.rs 85% 22 Missing and 19 partials ⚠️
engine/src/sol/option_serializer.rs 29% 32 Missing ⚠️
engine/src/witness/sol/source.rs 0% 31 Missing ⚠️
... and 26 more
Additional details and impacted files
@@               Coverage Diff                @@
##           wip/solana-api   #4933     +/-   ##
================================================
- Coverage              72%     71%     -0%     
================================================
  Files                 433     445     +12     
  Lines               76092   78190   +2098     
  Branches            76092   78190   +2098     
================================================
+ Hits                54480   55662   +1182     
- Misses              18757   19592    +835     
- Partials             2855    2936     +81     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AlastairHolmes
Copy link
Contributor

@albert-llimos can you put this back into draft, unless you intend me to look at it again?

@albert-llimos
Copy link
Contributor Author

@albert-llimos can you put this back into draft, unless you intend me to look at it again?

The plan is that Dan/Ramiz are reviewing it and after that we will probably merge it to the base Solana PR. So having it marked as in review is accurate. If you are getting spammed just remove yourself from reviewers or remove the notifications 😅

Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

I'm happy with the SC side of things, just a couple of minor things.

Comment on lines +52 to +55
// encodes to "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d"
sol_genesis_hash: Some(SolHash(hex_literal::hex![
"45296998a6f8e2a784db5d9f95e18fc23f70441a1039446801089879b08c7ef0"
])),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use a base58 constant here rather than hex + comment. (See PRO-1402 - @syan095 maybe you can incorporate this into your PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be merged now so it will automatically be rebased 👍

pub type SolanaGenesisHash<T> = StorageValue<_, SolHash, OptionQuery>;

#[pallet::storage]
#[pallet::getter(fn supported_sol_assets)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: for consistency

Suggested change
#[pallet::getter(fn supported_sol_assets)]
#[pallet::getter(fn sol_supported_assets)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for other chains (eth, arb) they are actually called supported_*_assets so actually for consistency I did it that way, otherwise Solana will be the only one named like that.

@albert-llimos albert-llimos merged commit 86a3b78 into wip/solana-api Jun 26, 2024
46 of 47 checks passed
@albert-llimos albert-llimos deleted the feat/solana-cfe-rpc branch June 26, 2024 14:07
syan095 added a commit that referenced this pull request Jun 27, 2024
…a-consts

* origin/wip/solana-api:
  Feat: Solana CFE and initialization (#4933)
  chore: make ci run against wip/ branches.
  feat: Solana Allbatch Support (#4975)

# Conflicts:
#	Cargo.lock
#	state-chain/chains/src/sol/consts.rs
#	state-chain/chains/src/sol/instruction_builder.rs
#	state-chain/chains/src/sol/sol_tx_core.rs
#	state-chain/chains/src/sol/sol_tx_core/address_derivation.rs
#	state-chain/chains/src/sol/sol_tx_core/compute_budget.rs
#	state-chain/chains/src/sol/sol_tx_core/token_instructions.rs
@AlastairHolmes
Copy link
Contributor

@albert-llimos can you put this back into draft, unless you intend me to look at it again?

The plan is that Dan/Ramiz are reviewing it and after that we will probably merge it to the base Solana PR. So having it marked as in review is accurate. If you are getting spammed just remove yourself from reviewers or remove the notifications 😅

Ok, so you decided to merge this instead of merging the base into main first?

@albert-llimos
Copy link
Contributor Author

@albert-llimos can you put this back into draft, unless you intend me to look at it again?

The plan is that Dan/Ramiz are reviewing it and after that we will probably merge it to the base Solana PR. So having it marked as in review is accurate. If you are getting spammed just remove yourself from reviewers or remove the notifications 😅

Ok, so you decided to merge this instead of merging the base into main first?

After a discussion with Dan we decided to do that because we don't want to merge the Solana code to main until it's more functional, so we'll keep merging on top of that base PR.

github-merge-queue bot pushed a commit that referenced this pull request Aug 6, 2024
* wip

* feat: no-std compatible building blocks for solana tx

* feat: solana tx building blocks and test simple tx

* chore: remove new_unique function

* feat: program instructions, test

* chore: update tests (#4417)

* chore: fix comment indentation

* Feat/solana program calls (#4625)

* feat: add more program calls

* chore: add nonceAuthorize

* chore: add sketch token instructions

* chore: add shell for ccm calls

* chore: add ccm_transfer test

* chore: remove token_instructions

* chore: remove import token_instructions

* chore: remove another import

* chore: add Compute Budget calls

* chore: add create_associated_token_account_idempotent_instruction

* chore: add TODO for deriving ATA

* chore: update TODO

* chore: add upgrade manager

* chore: update tests with new addresses

* chore: add upgrade authority to rotation

* chore: update comment

* Update state-chain/chains/src/sol/program_instructions.rs

Co-authored-by: kylezs <kyle@chainflip.io>

---------

Co-authored-by: kylezs <kyle@chainflip.io>

* feat: instantiate solana

* chore: add test and cleanup for clippy

* chore: add transaction length checks

* fix: tests

* fix: test, legacy_encoding

* chore: move sol migration

* chore: removing quotes that mess up cargo test

* chore: include verify sig in test env, cleanup

* chore: move sol types into a separate module

* chore: updates according to latest vault program changes

* chore: add missing renamings

* chore: nit

* fix: addressed comments

* chore: move sol cfe events

* chore: todo comments

* Feat/solana chaintracking (#4802)

* feat: update solana chain tracking

* chore: clippy

* chore: lint

* Chore/debug ci (#4805)

* chore: fix pallet

* chore: restore ci

* chore: missing Solana instance

* chore: fix typo

* fix: minor

* Initial implementation of the Solana Instruction Builder.
Added API call for BatchFetch
BatchFetch uses the Instruction builder to build a Solana transaction

* Added test for BatchFetches with multiple fetchs

* Addressed some PR comments

* Added the Transfer Api call
Added Rotate Agg key Api Call
General tidy up

* chore: refactor consts and sol_test_values

* Unified test values used in Instruction Builder tests

* chore: set correct witness_period

* Reshuffled file structure

* Minor improvements on comments/documentations

* Addressed PR comments

* Addressed PR comments.
Replaced the DepositChannelState with only the AccountBump

* Corrected how the nonce account and durable nonce is used when constructing
solana transactions

* feat: Solana address derivation with ATA logic (#4851)

* chore: add derive ata and bump tests

* chore: clippy and fmt

* chore: move code to sol_tx_core

* Formally integrated Address derivation module into the Sol::sol_tx_core

Provide derivation for:
* derived account
* derived Associated Token Account (ATA)
* derived Deposit Channel, depending on the Asset type

Pre-emptively added partial token support for address derivation
Pre-emptively adde BatchAll impl for Solana API

Address derivation in Runtime::AddressDerivation uses the same logic
provided in sol_tx_core.

* Made derive_address private since it's used internally by the
address_derivation module

* Use Solana Fetch param instead of DepositChannel to be consistent for
fetching calls.

* Implemented CCM transfer API call for Solana (#4870)

* Implemented CCM transfer API call for Solana
the cf_parameter is now passed into the API call so it can be decoded
by the Soalana CCM

Added encoding test for CcmExtraAccounts - required to be included in the
ccm call.

* Addressed some PR comments

* cf_parameter -> cf_parameters

* feat: Solana USDC token support  (#4890)

* Initial support for SolUsdc token for Solana

Added Token support for the Fetch Transaction.

Updated/added tests to fetch for a mixture of Native and Token asset.

* Token support for the Transfer Tx.

* Optimized parameter lookup for Transfer transaction building.
Parameter lookup will happen once for a batch of Transfer transactions,
and only lookup parameter needed for the asset/assets given.

* Corrected transfer's test address

---------

Co-authored-by: Roy Yang <roy@chainflip.io>

* fix: SolUsdc in fee_estimation_basis, use sp_std

* refactor: Solana's derived ATA struct (#4970)

* feat: declarative Solana program macro (#4895)

Co-authored-by: albert <allimos3@gmail.com>

* feat: Solana Allbatch Support (#4975)

* Allbatch now returns a Vec<ApiCall> instead of a single one.

Added support for Solana AllBatch call, which returns 1 tx for all fetches,
and 1 tx for each Transfer.

No test was added, but a new linear issue was created to capture work needed
to test this PRO-1449

* Changed the signature of AllBatch, so each api call created also return
the egress_ids that is included.

BatchBroadcastRequested only include the egress ID associated with the
broadcast ID

---------

Co-authored-by: albert <allimos3@gmail.com>

* chore: make ci run against wip/ branches.

* Feat: Solana CFE and initialization (#4933)

* feat: start solana cfe work

* chore: checkpoint

* chore: checkpoint

* chore: add get_multiple_accounts_with_config

* chore: add retry rpc

* chore: add source and chain tracking

* chore: update hardcoded sol hash

* chore: engine settings

* chore: run on ci

* chore: update settings

* chore: update hash

* chore: small cleanup

* chore: cleanup clippy

* chore: small improvements and using SecretUrl for Solana

* chore: get rid of rpc batching

* chore: fix get_block and Settings.toml

* chore: use WsHttpEndpoints

* chore: lint

* chore: add bs58 encode

* chore: push missing file

* chore: add solhash to env

* chore: add sol_deposits

* chore: get working sol_deposits

* chore: change Pubkey for SolAddress and add deposit logic

* chore: add get_signature_status, get_transaction and start egress witnessing logic

* chore: add get_signature_status test and fix naming

* chore: add get_durable_nonces

* chore: restore ci

* chore: add fetch account derivation

* chore: refactor to derive addresses on the CFE

* chore: add test for real fetch accounts

* chore: change usdc_token to Option and add success_witnesses test

* chore: add send transaction ad monitor nonces

* feat: update chaintracking and cu priority fee when zero

* cargo fmt

* chore: add engine keygen and signature. Add bouncer init

* chore: add cached balances and fix deposit logic

* chore: small impl

* chore: add retry mock

* chore: small fixes

* chore: fixes

* chore: add usdc

* chore: debug

* chore: refactor

* chore: no usdc

* chore: fix expect

* chore: add tests and signatures cache

* chore: add solusdc environment and other fixes

* chore: refactor sol_deposits and fix clippy

* chore: add broadcasting

* chore: improvements and add broadcast tx test

* chore: refactor consts

* chore: refactor to mix native and assets

* chore: small cleanup

* chore: commit bouncer workarounds

* chore: run only swapping

* chore: not run in ci

* chore: fix encode_decode

* chore: add verify_threshold_signature

* chore: update to ed25519-dalek

* chore: rename cryptoScheme and Signing

* chore: lint

* Revert "chore: add verify_threshold_signature"

This reverts commit 0da0e91.

* test: ed25519 verification (#4943)

* chore: remove unused dependency and fix clippy

* chore: readd verify threshold signature

* chore: downgrade ed25519-dalek

* ts prettier formatting

* Remove unused TS code

* Revert Bouncer Workarounds


squash

* Switch to bs58 everywhere

libp2p/rust-libp2p#121

* Resolve base64 deprecation warnings

* Cleanup comments

* Remove unneeded clippy allow

* Upgrade to ed25519-dalek

* Fix rebase: Use DerivedAta

squash

squash

squash

wip

* chore: simplify headers

chore: fix issues

squash

* Minor cleanup

* Remove unused rand 0.7 dependency

* Replace Keypair with SigningKey

* Move SigningKey into sol.rs and enable outside of cfg(test)

* Rename SigningKey

Squash

* Remove extra_types_for_testing and organise code to match solana-sdk

* Enable sol in tests and fix tests

* chore: remove cached egresses and cleanup

* chore: make SolanaGenesisHash an OptionQuery

* chore: update comment

* fix: make cf_chains::solana more runtime friendly

* chore: make ci run against wip/ branches.

---------

Co-authored-by: Alastair Holmes <holmes.alastair@outlook.com>
Co-authored-by: Maxim Shishmarev <msgmaxim@gmail.com>
Co-authored-by: Daniel <daniel@chainflip.io>

* chore: build solana consts in compile time (#5002)

* Refactored Solana const to build addresses in compile time

* Corrected bs58 dependency version

* chore: add bs58 const array fn to utils (#5006)

* chore: no explicit trait reference in SolanaEnvironment trait

* feat: Solana transaction builder implementation (#5019)

* Added Solana's Transaction Builder trait implementation.

* chore: update comments

---------

Co-authored-by: albert <allimos3@gmail.com>

* feat: Solana Durable Nonce Accounts logic (#4996)

* feat: nonce_accounts

* feat: migration and genesis injection for nonce accounts

* feat: tests

* chore: update nonce values

* chore: lint

* chore: use new nonce in tests

* chore: remove comment after updates

* chore: log::error

---------

Co-authored-by: albert <allimos3@gmail.com>

* Feat/nonce witnessing cfe (#5021)

feat: link cfe nonce witnessing to the sc

* fix: build

* fix: imports

* fix: incompatible args test

* feat: solana API environment (#5016)

* feat: generic sol token apicalls

* feat: generic token arms

* chore: use btreemap

* refactor: remove AssetWithDerivedAddress and decompose_fetch_params

* chore: move the token_environments one level higher

* chore: move token_vault_pda_account out of token environment

* Combined Solana Environment variables into a single struct and added
to the Environment pallet storage.
Added Genesis config to set the values for the Solana Environment variables.

* Renamed storage variables so that they are consistent with namings in
solana API

* Updated Solana migration's addresses to bs-58

* chore: update testnet addresses. Update dummy addresses to use bs58

* Removed redundant variables

* Hooked up ComputePrice to the Solana Environment

* chore: fix clippy

* chore: fix clippy

---------

Co-authored-by: Ramiz Siddiqui <ramiz@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: albert <allimos3@gmail.com>

* Chore/bump env pallet version number (#5023)

fix: bump env version number

* Feat/solana broadcast barriers (#5022)

feat: solana broadcast barriers

* fix: clippy

* Fix/limit sol batches (#5027)

* fix: limit sol transfers

* feat: fetches limit

* chore: address comments

* feat: reserved nonce for rotation

* fix: number of fetches remaining check

* Feat/solana bouncer testing (#5029)

* feat: generic sol token apicalls

* feat: generic token arms

* chore: use btreemap

* feat: bouncer development and SC SolAddress encoding

* chore: remove unused dependency

* chore: update Cargo.lock

* chore: remove unused export

* refactor: remove AssetWithDerivedAddress and decompose_fetch_params

* chore: move the token_environments one level higher

* chore: move token_vault_pda_account out of token environment

* Combined Solana Environment variables into a single struct and added
to the Environment pallet storage.
Added Genesis config to set the values for the Solana Environment variables.

* Renamed storage variables so that they are consistent with namings in
solana API

* Updated Solana migration's addresses to bs-58

* chore: update testnet addresses. Update dummy addresses to use bs58

* Removed redundant variables

* Hooked up ComputePrice to the Solana Environment

* chore: fix clippy

* chore: fix clippy

* chore: bugfixes

* chore: add comments

* chore: more clarifications

* chore: add batch fetch limit

* chore: working with limits

* chore: add nonces workaround

* chore: add check fetch for Solana

* chore: add ObserveSolanaCcm

* fix: limit sol transfers

* feat: fetches limit

* chore: revert nonce workarounds

* chore: small comment

* chore: cleanup

* chore: add 8th nonce

* chore: small cleanup

* chore: add fetch check for EVM chains

* chore: address comments

* feat: reserved nonce for rotation

* chore: format cleanup

* chore: bouncer lint

* chore: fix lint

* chore: fix clippy

---------

Co-authored-by: Ramiz Siddiqui <ramiz@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: Roy Yang <roy@chainflip.io>

* chore: fix pnpm-lock

* feat: Solana add compute limits (#5018)

* feat: generic sol token apicalls

* feat: generic token arms

* chore: use btreemap

* refactor: remove AssetWithDerivedAddress and decompose_fetch_params

* chore: move the token_environments one level higher

* chore: move token_vault_pda_account out of token environment

* Combined Solana Environment variables into a single struct and added
to the Environment pallet storage.
Added Genesis config to set the values for the Solana Environment variables.

* Renamed storage variables so that they are consistent with namings in
solana API

* Updated Solana migration's addresses to bs-58

* chore: update testnet addresses. Update dummy addresses to use bs58

* chore: add compute limits

* chore: fix merge

* chore: add gas limit estimations

* chore: update tests

* chore: add compute_limit_with_buffer

---------

Co-authored-by: Ramiz Siddiqui <ramiz@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: Roy Yang <roy@chainflip.io>

* chore: solana bouncer ccm (#5035)

* feat: generic sol token apicalls

* feat: generic token arms

* chore: use btreemap

* feat: bouncer development and SC SolAddress encoding

* chore: remove unused dependency

* chore: update Cargo.lock

* chore: remove unused export

* refactor: remove AssetWithDerivedAddress and decompose_fetch_params

* chore: move the token_environments one level higher

* chore: move token_vault_pda_account out of token environment

* Combined Solana Environment variables into a single struct and added
to the Environment pallet storage.
Added Genesis config to set the values for the Solana Environment variables.

* Renamed storage variables so that they are consistent with namings in
solana API

* Updated Solana migration's addresses to bs-58

* chore: update testnet addresses. Update dummy addresses to use bs58

* Removed redundant variables

* Hooked up ComputePrice to the Solana Environment

* chore: fix clippy

* chore: fix clippy

* chore: bugfixes

* chore: add comments

* chore: more clarifications

* chore: add batch fetch limit

* chore: working with limits

* chore: add nonces workaround

* chore: add check fetch for Solana

* chore: add ObserveSolanaCcm

* fix: limit sol transfers

* feat: fetches limit

* chore: revert nonce workarounds

* chore: small comment

* chore: cleanup

* chore: add 8th nonce

* chore: small cleanup

* chore: add fetch check for EVM chains

* chore: address comments

* feat: reserved nonce for rotation

* chore: format cleanup

* chore: bouncer lint

* chore: fix lint

* chore: fix clippy

* chore: solana ccm test

* chore: working manual encoding

* chore: refactor CCM tests

* chore: fix bug, it was not running ccm tests

* chore: update CCM logic and bugfix

* chore: add Solana CCM event observe

* chore: more updates for ccm

* chore: fix eslint and prettier

* chore: fix source address check

* chore: working except sourceAddress

* chore: working with fix on the source address encoding

* chore: comments

* chore: update gas_limit test

* chore: remove comment

* chore: fix comments

* chore: clean up imports

* chore: update tests

* feat: refactor logic into

---------

Co-authored-by: Ramiz Siddiqui <ramiz@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: Roy Yang <roy@chainflip.io>

* test: Solana API Integration tests (#5040)

* Added integration tests for Solana API.

* minor improvements

* Added another event assert for the integration test

* chore: run gas_limit test by default

* test: update integration tests

* chore: fix bug in merge that caused tests to fail

* Feat/solana ccm gas limit (#5048)

* feat: generic sol token apicalls

* feat: generic token arms

* chore: use btreemap

* feat: bouncer development and SC SolAddress encoding

* chore: remove unused dependency

* chore: update Cargo.lock

* chore: remove unused export

* refactor: remove AssetWithDerivedAddress and decompose_fetch_params

* chore: move the token_environments one level higher

* chore: move token_vault_pda_account out of token environment

* Combined Solana Environment variables into a single struct and added
to the Environment pallet storage.
Added Genesis config to set the values for the Solana Environment variables.

* Renamed storage variables so that they are consistent with namings in
solana API

* Updated Solana migration's addresses to bs-58

* chore: update testnet addresses. Update dummy addresses to use bs58

* Removed redundant variables

* Hooked up ComputePrice to the Solana Environment

* chore: fix clippy

* chore: fix clippy

* chore: bugfixes

* chore: add comments

* chore: more clarifications

* chore: add batch fetch limit

* chore: working with limits

* chore: add nonces workaround

* chore: add check fetch for Solana

* chore: add ObserveSolanaCcm

* fix: limit sol transfers

* feat: fetches limit

* chore: revert nonce workarounds

* chore: small comment

* chore: cleanup

* chore: add 8th nonce

* chore: small cleanup

* chore: add fetch check for EVM chains

* chore: address comments

* feat: reserved nonce for rotation

* chore: format cleanup

* chore: bouncer lint

* chore: fix lint

* chore: fix clippy

* chore: solana ccm test

* chore: working manual encoding

* chore: refactor CCM tests

* chore: fix bug, it was not running ccm tests

* chore: update CCM logic and bugfix

* chore: add Solana CCM event observe

* chore: more updates for ccm

* chore: fix eslint and prettier

* chore: fix source address check

* chore: working except sourceAddress

* chore: working with fix on the source address encoding

* chore: comments

* chore: update gas_limit test

* chore: remove comment

* chore: fix comments

* chore: clean up imports

* chore: working with gas_limit test patched

* chore: update tests

* test: rewrite gas limit tests

* chore: small improvements

* chore: working except budget < consumption

* chore: update instruction builder

* chore: update gas calculations

* chore: add compute_price calculations

* chore: add gaslimit test

* chore: commit issue!

* chore: fix compute price bug

* chore: push fixes

* chore: fix compile

* chore: refactor EVM event fixing bouncer lint

* chore: fix rounding

* chore: fix test

* chore: cleanup and add compute limit tweaks

* chore: fix lint

* chore: update tests

* chore: move constants to foreign-chain/consts

* feat: refactor logic into

* chore: increase observeFetch timeout

* chore: restore ci and run.sh

* chore: fix merge going wrong

* chore: fix comment

---------

Co-authored-by: Ramiz Siddiqui <ramiz@chainflip.io>
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: Roy Yang <roy@chainflip.io>

* fix: revert storage version

* chore: rename DerivedAta to PdaAndBump (#5074)

* chore: update Solana programs to 0.6 and update initialization (#5078)

* chore: update to 0.6 and update initialization

* chore: add u16 to macro

* test: fix unit tests

* chore: add back function removed accidentally

* chore: update nonces and add solexplorer

* chore: enforce Solana installed and update to 1.18.17

* cherry-pick: package fixes 🍒 (#5084)

chore: bump `main` to `1.6.0` 👆 (#5081)

* chore: bump `main` to `1.6.0` 👆

* chore: use `.dylib` built on GHA M2 runner 🥽

* fix: get `1.4.6` dylib 🐛

* fix: use correct path 🙈

* fix: use `curl` and dump `wget` 🤬

* chore: run upgrade test 👹

* Revert "chore: run upgrade test 👹"

This reverts commit dc15f0d.

* chore: Solana increase number of nonces (#5082)

chore: add two extra nonces

* chore: add back solana installed check and lint

* chore: split up transactions

* chore: fix bug remaining accounts bouncer

* Chore/debug solana update programs 0.6 (#5088)

* chore: try revet nonces

* chore: run on ci

* chore: revert ci

---------

Co-authored-by: Assem Hasna <asem.hasna@gmail.com>

* chore: run upgrade test

* feat: solana add two more nonces (#5089)

chore: add two solana nonces

* chore: add logs

* chore: set minimum to 10 bytes

* chore: remove logging

* chore: update test

* Feat: solana engine broadcast retries (#5093)

* chore. add get_signature_statuses to retry

* chore: run on ci

* chore: lint

* chore: mimic rust client

* chore: address some comments

* Update engine/src/sol/retry_rpc.rs

Co-authored-by: kylezs <kyle@chainflip.io>

* chore: lint

* chore: clippy

* chore: use make_periodic_tick

---------

Co-authored-by: kylezs <kyle@chainflip.io>

* feat: put solana chain state

* chore: add Solana missing rpc return values (#5100)

* chore: add missing rpc return values

* chore: refactor into open_channels function

* fix: migrations

* chore: update to solana+fok client

* chore: update client for type missmatch

* chore: Solana engine not require tx history (#5095)

chore: not require tx history

* Chore/bouncer add cf parameters check (#5107)

* chore: add cfParameters check

* chore: run ci

* chore: revert ci

* feat: CCM validity checker (#5055)

* Added initial implementation for CCM message checker.

* Adjusted the places the checks are done.
Removed DispatchError as a way of returning error, as the str is lost
 during encoding.
Added more integration tests

* Adjusted how the message length is checked

* Moved CCM checked to the root of Chains.
Renamed so it is not specific to Solana chain

* Fixed build error

* chore: update byte limits and bouncer tests

* chore: update tests

* Minor improvement

* chore: fix bouncer bug

* chore: update bytes limits and use same encoding as solana SDK

* chore: fix test and actually push encoding change

* chore: split message and cfParameters

* chore: dont run upgrade

* Minor changes

* Split the CCM check into 2 parts. Only check for length on initial entry-point
cf_parameter account checks are done at the point when transactions are built.

* Chore/fix compile (#5109)

* chore: fix compilation and tests

* chore: fix

* chore: restore ci

* chore: set upgrade test back to true

* CCM checker returns the decoded cf_param to avoid duplicate decoding.

---------

Co-authored-by: albert <allimos3@gmail.com>
Co-authored-by: Albert Llimos <53186777+albert-llimos@users.noreply.github.com>

* feat: solana transaction length check (#5086)

* Added initial implementation for CCM message checker.

* Adjusted the places the checks are done.
Removed DispatchError as a way of returning error, as the str is lost
 during encoding.
Added more integration tests

* Adjusted how the message length is checked

* Moved CCM checked to the root of Chains.
Renamed so it is not specific to Solana chain

* Fixed build error

* Initial implementation of Solana transaction length check.

* chore: update byte limits and bouncer tests

* chore: update tests

* Added tests and integration tests for when solana transactions are too long

* Minor improvement

* Simplified how the Durable nonces are recovered

* chore: fix bouncer bug

* chore: update bytes limits and use same encoding as solana SDK

* chore: fix test and actually push encoding change

* chore: split message and cfParameters

* chore: dont run upgrade

* Minor changes

* Split the CCM check into 2 parts. Only check for length on initial entry-point
cf_parameter account checks are done at the point when transactions are built.

* Reverted the change to Instruction builder so only nonce account is passed in

* Chore/fix compile (#5109)

* chore: fix compilation and tests

* chore: fix

* chore: restore ci

* chore: set upgrade test back to true

* CCM checker returns the decoded cf_param to avoid duplicate decoding.

* Reversed the last commit as this change was incorrect.

* Renamed solana's Instruction builder to Transaction builder

* Repalced some todo!()s

---------

Co-authored-by: albert <allimos3@gmail.com>
Co-authored-by: Albert Llimos <53186777+albert-llimos@users.noreply.github.com>

* Feat: Solana support SetGovKeyWithAggKey (#5113)

* Added initial implementation for CCM message checker.

* Adjusted the places the checks are done.
Removed DispatchError as a way of returning error, as the str is lost
 during encoding.
Added more integration tests

* Adjusted how the message length is checked

* Moved CCM checked to the root of Chains.
Renamed so it is not specific to Solana chain

* Fixed build error

* Initial implementation of Solana transaction length check.

* chore: update byte limits and bouncer tests

* chore: update tests

* Added tests and integration tests for when solana transactions are too long

* Minor improvement

* Simplified how the Durable nonces are recovered

* chore: fix bouncer bug

* chore: update bytes limits and use same encoding as solana SDK

* chore: fix test and actually push encoding change

* chore: split message and cfParameters

* chore: dont run upgrade

* Minor changes

* Split the CCM check into 2 parts. Only check for length on initial entry-point
cf_parameter account checks are done at the point when transactions are built.

* Reverted the change to Instruction builder so only nonce account is passed in

* Chore/fix compile (#5109)

* chore: fix compilation and tests

* chore: fix

* chore: restore ci

* chore: set upgrade test back to true

* CCM checker returns the decoded cf_param to avoid duplicate decoding.

* Reversed the last commit as this change was incorrect.

* Renamed solana's Instruction builder to Transaction builder

* Repalced some todo!()s

* chore: add setGovKeyWithAggKey

* chore: update compute units

* chore: add test

* chore: cleanup todos

---------

Co-authored-by: Roy Yang <roy@chainflip.io>

* Chore: Solana upgrade test (#5121)

* chore: add send_sol to run

* chore: run test

* chore: add commands to yml instead

* chore: add solana debug prints

* chore: add solana vault setup

* chore: echo solana node state

* chore: run

* chore: try run solana

* chore: add solana image pull

* chore: docker compose

* chore: not use check_endpoint

* chore: set 1 node

* chore: fix wrong path

* chore: add which solana print

* chore: install node dependencies

* fix: starting solana in upgrade-test 🐛 (#5116)

* fix(ci): start Solana only once 🐛

* fix(ci): use latest solana programs version for localnets started from an older commit 🐛

* fix: update path to include solana bins

* fix: stay consistent

* chore: patch solana program init

* chore: add git reset

* chore: add setup_concurrent

* chore: set timeout

* chore: setup_swaps only

* chore: setup only Sol swaps

---------

Co-authored-by: albert <allimos3@gmail.com>

* chore: remove unneeded install

* chore: set back ci-development

---------

Co-authored-by: Assem Hasna <asem.hasna@gmail.com>

* chore: unset upgrade test and wip run

---------

Co-authored-by: Ramiz Siddiqui <ramiz@chainflip.io>
Co-authored-by: Albert Llimos <53186777+albert-llimos@users.noreply.github.com>
Co-authored-by: kylezs <kyle@chainflip.io>
Co-authored-by: albert <allimos3@gmail.com>
Co-authored-by: dandanlen <3168260+dandanlen@users.noreply.github.com>
Co-authored-by: Daniel <daniel@chainflip.io>
Co-authored-by: Alastair Holmes <holmes.alastair@outlook.com>
Co-authored-by: Maxim Shishmarev <msgmaxim@gmail.com>
Co-authored-by: Assem Hasna <asem.hasna@gmail.com>
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