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 Vault Swaps Elections #5355

Open
wants to merge 25 commits into
base: feat/solana-program-swaps-close-accounts
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9d83bde
wip
ramizhasan111 Oct 8, 2024
b0c5f6c
feat: solana open/close contract swap accounts
ramizhasan111 Oct 11, 2024
b0e82d0
feat: initiate contract swap
ramizhasan111 Oct 11, 2024
e323c72
feat: root origin for contract_swap_request
ramizhasan111 Oct 14, 2024
c505b3c
chore: address comment
ramizhasan111 Oct 14, 2024
0e34208
feat: solana vault swaps elections
ramizhasan111 Oct 24, 2024
4e458fb
feat: account closing tracking in elections
ramizhasan111 Oct 25, 2024
695af88
chore: clippy
ramizhasan111 Oct 25, 2024
a4bfda6
chore: minor
ramizhasan111 Oct 25, 2024
df598e8
chore: remove previous impl
ramizhasan111 Oct 25, 2024
108d839
fix: consensus
ramizhasan111 Oct 28, 2024
3c9e11f
chore: minor
ramizhasan111 Oct 28, 2024
ca07a5e
chore: minor rename
ramizhasan111 Oct 28, 2024
8f91452
Feat: engine logic to witness solana program swaps (#5313)
albert-llimos Oct 29, 2024
c842f9a
feat: return swap account along with swap details
ramizhasan111 Oct 29, 2024
222a79b
refactor: use election properties
ramizhasan111 Oct 29, 2024
9c70be0
feat: engine
ramizhasan111 Oct 30, 2024
bdea2f1
feat: vault swap details
ramizhasan111 Oct 30, 2024
6015e36
Merge branch 'feat/solana-program-swaps-close-accounts' into feat/sol…
ramizhasan111 Oct 30, 2024
e75d610
chore: merge from base branch
albert-llimos Oct 31, 2024
be95b64
chore: fix issues and renamings
albert-llimos Oct 31, 2024
634a962
chore: get block number from runtime
ramizhasan111 Oct 31, 2024
eb7146c
chore: vault_swap_request remove origin
ramizhasan111 Oct 31, 2024
bf40c42
fix: add is_vote_desired()
ramizhasan111 Oct 31, 2024
e5dcf4b
fix: clippy, tests, benchmarks
ramizhasan111 Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ async-channel = "1.7.1"
async-trait = "0.1.49"
bincode = "1.3.3"
bitcoin = { version = "0.30.0", features = ["serde"] }
borsh = { version = "1.2.1", default_features = false, features = [
"derive",
"unstable__schema",
"hashbrown",
] }
chrono = { version = "0.4.21", default_features = false, features = ["clock"] }
clap = { version = "3.2.16", features = ["derive", "env"] }
config = "0.13.1"
Expand Down
2 changes: 1 addition & 1 deletion engine/src/elections/voter_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ macro_rules! generate_voter_api_tuple_impls {
}
}

generate_voter_api_tuple_impls!(tuple_5_impls: ((A, A0), (B, B0), (C, C0), (D, D0), (EE, E0)));
generate_voter_api_tuple_impls!(tuple_6_impls: ((A, A0), (B, B0), (C, C0), (D, D0), (EE, E0), (FF,F0)));
27 changes: 25 additions & 2 deletions engine/src/witness/sol.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod egress_witnessing;
mod fee_tracking;
mod nonce_witnessing;
mod program_swaps_witnessing;
mod sol_deposits;

use crate::{
Expand All @@ -20,7 +21,8 @@ use pallet_cf_elections::{electoral_system::ElectoralSystem, vote_storage::VoteS
use state_chain_runtime::{
chainflip::solana_elections::{
SolanaBlockHeightTracking, SolanaEgressWitnessing, SolanaElectoralSystem,
SolanaFeeTracking, SolanaIngressTracking, SolanaNonceTracking, TransactionSuccessDetails,
SolanaFeeTracking, SolanaIngressTracking, SolanaNonceTracking, SolanaVaultSwapTracking,
TransactionSuccessDetails,
},
SolanaInstance,
};
Expand Down Expand Up @@ -140,6 +142,26 @@ impl VoterApi<SolanaEgressWitnessing> for SolanaEgressWitnessingVoter {
}
}

#[allow(dead_code)]
#[derive(Clone)]
struct SolanaVaultSwapsVoter {
client: SolRetryRpcClient,
}

#[async_trait::async_trait]
impl VoterApi<SolanaVaultSwapTracking> for SolanaVaultSwapsVoter {
async fn vote(
&self,
_settings: <SolanaVaultSwapTracking as ElectoralSystem>::ElectoralSettings,
_properties: <SolanaVaultSwapTracking as ElectoralSystem>::ElectionProperties,
) -> Result<
<<SolanaVaultSwapTracking as ElectoralSystem>::Vote as VoteStorage>::Vote,
anyhow::Error,
> {
todo!()
kylezs marked this conversation as resolved.
Show resolved Hide resolved
}
}

pub async fn start<StateChainClient>(
scope: &Scope<'_, anyhow::Error>,
client: SolRetryRpcClient,
Expand All @@ -165,7 +187,8 @@ where
SolanaFeeTrackingVoter { client: client.clone() },
SolanaIngressTrackingVoter { client: client.clone() },
SolanaNonceTrackingVoter { client: client.clone() },
SolanaEgressWitnessingVoter { client },
SolanaEgressWitnessingVoter { client: client.clone() },
SolanaVaultSwapsVoter { client },
)),
)
.continuously_vote()
Expand Down
Loading