From ef5d6aaf63026289ae812a44319fc7d742b20347 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Thu, 29 Aug 2024 18:54:32 +0200 Subject: [PATCH] lib: move Rayon wrappers to lib crate (#380) The Rayon wrapper methods are not specific to the cf-solana crate. Move them to lib so that any code in the future can easily use them if necessary. --- Cargo.lock | 2 +- common/cf-solana/Cargo.toml | 2 +- common/cf-solana/src/blake3.rs | 46 ++ common/cf-solana/src/lib.rs | 2 +- common/cf-solana/src/proof.rs | 16 +- common/cf-solana/src/utils.rs | 92 ---- common/lib/Cargo.toml | 1 + common/lib/src/lib.rs | 1 + common/lib/src/par.rs | 71 ++++ solana/trie-geyser/Cargo.lock | 740 ++++++++++++++++++++++++++++++++- 10 files changed, 853 insertions(+), 120 deletions(-) create mode 100644 common/cf-solana/src/blake3.rs delete mode 100644 common/cf-solana/src/utils.rs create mode 100644 common/lib/src/par.rs diff --git a/Cargo.lock b/Cargo.lock index 474d8720..d4f02c6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1208,7 +1208,6 @@ dependencies = [ "proto-utils", "rand 0.8.5", "rand_chacha 0.3.1", - "rayon", "serde", "solana-accounts-db", "solana-program 1.17.31", @@ -3365,6 +3364,7 @@ dependencies = [ "bytemuck", "derive_more", "rand 0.8.5", + "rayon", "serde", "serde_json", "sha2 0.10.8", diff --git a/common/cf-solana/Cargo.toml b/common/cf-solana/Cargo.toml index f2aed928..169b06f0 100644 --- a/common/cf-solana/Cargo.toml +++ b/common/cf-solana/Cargo.toml @@ -18,7 +18,6 @@ ibc-core-host.workspace = true ibc-primitives.workspace = true ibc-proto.workspace = true prost = { workspace = true, features = ["prost-derive"] } -rayon = { workspace = true, optional = true } serde = { workspace = true, optional = true } solana-program = { workspace = true, optional = true } @@ -44,6 +43,7 @@ solana-program-2 = { package = "solana-program", git = "https://github.com/Compo lib = { workspace = true, features = ["test_utils"] } [features] +rayon = ["lib/rayon"] solana-program = [ "dep:solana-program", "lib/solana-program", diff --git a/common/cf-solana/src/blake3.rs b/common/cf-solana/src/blake3.rs new file mode 100644 index 00000000..fc4013ab --- /dev/null +++ b/common/cf-solana/src/blake3.rs @@ -0,0 +1,46 @@ +pub use ::blake3::Hasher; + +use crate::types::Hash; + +/// Calculates Blake3 hash of given byte slice. +/// +/// When `solana-program` or `solana-program-2` feature is enabled and +/// building a solana program, this is using Solana’s `sol_blake3` syscall. +/// Otherwise, the calculation is done by `blake3` crate. +#[allow(dead_code)] +pub fn hash(bytes: &[u8]) -> Hash { + if cfg!(target_os = "solana-program") && + (cfg!(feature = "solana-program") || + cfg!(feature = "solana-program-2")) + { + hashv(&[bytes]) + } else { + Hash(::blake3::hash(bytes).into()) + } +} + +/// Calculates Blake3 hash of concatenation of given byte slices. +/// +/// When `solana` or `solana2` feature is enabled and building a Solana +/// program, this is using Solana’s `sol_blake3` syscall. Otherwise, the +/// calculation is done by `blake3` crate. +#[allow(dead_code)] +pub fn hashv(slices: &[&[u8]]) -> Hash { + #[cfg(all(target_os = "solana-program", feature = "solana-program-2"))] + return Hash(solana_program_2::blake3::hashv(slices).0); + #[cfg(all( + target_os = "solana-program", + feature = "solana-program", + not(feature = "solana-program-2") + ))] + return Hash(solana_program::blake3::hashv(slices).0); + + #[allow(dead_code)] + { + let mut hasher = Hasher::default(); + for bytes in slices { + hasher.update(bytes); + } + hasher.finalize().into() + } +} diff --git a/common/cf-solana/src/lib.rs b/common/cf-solana/src/lib.rs index 86577151..51e13072 100644 --- a/common/cf-solana/src/lib.rs +++ b/common/cf-solana/src/lib.rs @@ -4,6 +4,7 @@ extern crate alloc; #[cfg(any(feature = "std", test))] extern crate std; +mod blake3; mod client; mod consensus; mod header; @@ -14,7 +15,6 @@ pub mod proto; #[cfg(feature = "serde")] mod serde_impl; pub mod types; -mod utils; pub use client::impls::{CommonContext, Neighbourhood}; pub use client::ClientState; diff --git a/common/cf-solana/src/proof.rs b/common/cf-solana/src/proof.rs index fb847331..10fa9862 100644 --- a/common/cf-solana/src/proof.rs +++ b/common/cf-solana/src/proof.rs @@ -4,14 +4,12 @@ pub use cf_guest::proof::{ generate_for_trie, verify_for_trie, GenerateError, IbcProof, VerifyError, }; use lib::hash::CryptoHash; -#[cfg(all(feature = "rayon", not(miri)))] -use rayon::prelude::*; +use lib::par::prelude::*; #[cfg(test)] mod tests; use crate::types::{Hash, PubKey}; -use crate::utils::{blake3, chunks, sort_unstable_by}; /// The fanout of a accounts delta Merkle tree. /// @@ -78,7 +76,7 @@ impl MerkleProof { accounts: &mut [(PubKey, Hash)], pubkey: &PubKey, ) -> Option<(Hash, MerkleProof)> { - sort_unstable_by(accounts, |a, b| a.0.cmp(&b.0)); + lib::par::sort_unstable_by(accounts, |a, b| a.0.cmp(&b.0)); let pos = accounts.binary_search_by_key(&pubkey, |item| &item.0).ok()?; @@ -285,7 +283,9 @@ impl AccountHashData { pub fn key(&self) -> &PubKey { self.get::<32>(self.0.len() - 32).into() } /// Returns hash of the account. - pub fn calculate_hash(&self) -> Hash { blake3::hash(self.0.as_slice()) } + pub fn calculate_hash(&self) -> Hash { + crate::blake3::hash(self.0.as_slice()) + } /// Returns `N`-byte long fragment of the account’s hash data starting at /// index `start`. @@ -492,7 +492,7 @@ pub fn hash_account( return Hash::default(); } - let mut hasher = blake3::Hasher::default(); + let mut hasher = crate::blake3::Hasher::default(); // allocate a buffer on the stack that's big enough // to hold a token account or a stake account @@ -530,7 +530,7 @@ pub fn hash_account( /// we reimplement it because that method takes ownership of hashes which is /// something we need to keep. fn compute_merkle_root(accounts: &mut [(PubKey, Hash)]) -> Hash { - let mut hashes: Vec = chunks(accounts, MERKLE_FANOUT) + let mut hashes: Vec = lib::par::chunks(accounts, MERKLE_FANOUT) .map(|chunk| { let mut hasher = CryptoHash::builder(); for item in chunk { @@ -593,7 +593,7 @@ fn generate_merkle_proof( } fn compute_hashes_at_next_level(hashes: &[Hash]) -> Vec { - chunks(hashes, MERKLE_FANOUT) + lib::par::chunks(hashes, MERKLE_FANOUT) .map(|chunk| { let mut hasher = CryptoHash::builder(); for hash in chunk { diff --git a/common/cf-solana/src/utils.rs b/common/cf-solana/src/utils.rs deleted file mode 100644 index 4f881a47..00000000 --- a/common/cf-solana/src/utils.rs +++ /dev/null @@ -1,92 +0,0 @@ -#[cfg(all(feature = "rayon", not(miri)))] -use rayon::prelude::*; - -use crate::types::Hash; - - -/// Splits array into `count`-element chunks. -/// -/// Normally this uses Rayon’s `par_chunks` but that fails Miri tests. To -/// address that, this function uses plain `[T]::chunks` when building for Miri. -#[cfg(all(feature = "rayon", not(miri)))] -pub(super) fn chunks( - arr: &[T], - count: usize, -) -> rayon::slice::Chunks<'_, T> { - arr.par_chunks(count) -} - -#[cfg(any(not(feature = "rayon"), miri))] -pub(super) fn chunks( - arr: &[T], - count: usize, -) -> impl Iterator { - arr.chunks(count) -} - -/// Sorts elements of a slice using given comparator. -/// -/// If Rayon is enabled and not building for Miri, uses Rayon’s parallel -/// sorting algorithm. -pub(super) fn sort_unstable_by( - arr: &mut [T], - cmp: impl (Fn(&T, &T) -> core::cmp::Ordering) + Sync, -) { - #[cfg(all(feature = "rayon", not(miri)))] - arr.par_sort_unstable_by(cmp); - #[cfg(any(not(feature = "rayon"), miri))] - arr.sort_unstable_by(cmp); -} - - -pub(super) mod blake3 { - pub use ::blake3::Hasher; - - use super::Hash; - - /// Calculates Blake3 hash of given byte slice. - /// - /// When `solana-program` or `solana-program-2` feature is enabled and - /// building a solana program, this is using Solana’s `sol_blake3` syscall. - /// Otherwise, the calculation is done by `blake3` crate. - #[allow(dead_code)] - pub fn hash(bytes: &[u8]) -> Hash { - if cfg!(target_os = "solana-program") && - (cfg!(feature = "solana-program") || - cfg!(feature = "solana-program-2")) - { - hashv(&[bytes]) - } else { - Hash(::blake3::hash(bytes).into()) - } - } - - /// Calculates Blake3 hash of concatenation of given byte slices. - /// - /// When `solana` or `solana2` feature is enabled and building a Solana - /// program, this is using Solana’s `sol_blake3` syscall. Otherwise, the - /// calculation is done by `blake3` crate. - #[allow(dead_code)] - pub fn hashv(slices: &[&[u8]]) -> Hash { - #[cfg(all( - target_os = "solana-program", - feature = "solana-program-2" - ))] - return Hash(solana_program_2::blake3::hashv(slices).0); - #[cfg(all( - target_os = "solana-program", - feature = "solana-program", - not(feature = "solana-program-2") - ))] - return Hash(solana_program::blake3::hashv(slices).0); - - #[allow(dead_code)] - { - let mut hasher = Hasher::default(); - for bytes in slices { - hasher.update(bytes); - } - hasher.finalize().into() - } - } -} diff --git a/common/lib/Cargo.toml b/common/lib/Cargo.toml index 6221a49d..ff1cb538 100644 --- a/common/lib/Cargo.toml +++ b/common/lib/Cargo.toml @@ -10,6 +10,7 @@ borsh = { workspace = true, optional = true } bs58 = { workspace = true, optional = true } bytemuck = { workspace = true, features = ["derive"] } derive_more.workspace = true +rayon = { workspace = true, optional = true } serde = { workspace = true, optional = true } sha2.workspace = true solana-program = { workspace = true, optional = true } diff --git a/common/lib/src/lib.rs b/common/lib/src/lib.rs index 1bab514f..a83fecec 100644 --- a/common/lib/src/lib.rs +++ b/common/lib/src/lib.rs @@ -5,6 +5,7 @@ extern crate alloc; extern crate std; pub mod hash; +pub mod par; #[cfg(any(feature = "test_utils", test))] pub mod test_utils; pub mod u3; diff --git a/common/lib/src/par.rs b/common/lib/src/par.rs new file mode 100644 index 00000000..e13a77bb --- /dev/null +++ b/common/lib/src/par.rs @@ -0,0 +1,71 @@ +#[cfg(all(feature = "rayon", not(miri)))] +use rayon::prelude::*; + +pub mod prelude { + #[cfg(all(feature = "rayon", not(miri)))] + pub use rayon::iter::ParallelIterator; +} + +#[cfg(all(feature = "rayon", not(miri)))] +pub type Chunks<'a, T> = rayon::slice::Chunks<'a, T>; +#[cfg(any(not(feature = "rayon"), miri))] +pub type Chunks<'a, T> = core::slice::Chunks<'a, T>; + +/// Splits array into `count`-element chunks. +/// +/// It uses conditional compilation and either uses Rayon’s `par_chunks` method +/// (to allow parallelisation of the chunk processing) or standard `[T]::chunks` +/// method. Specifically, if `rayon` feature is enabled and not building Miri +/// tests, Rayon is used. +/// +/// Note that depending on compilation features and target the function is +/// defined as returning `rayon::slice::Chunks` or `core::slice::Chunks`. types. +/// +/// # Example +/// +/// ``` +/// use lib::par::prelude::*; +/// +/// let chunks = lib::par::chunks(&[0, 1, 2, 3, 4], 3) +/// .map(|chunk| chunk.to_vec()) +/// .collect::>>(); +/// assert_eq!(&[vec![0, 1, 2], vec![3, 4]], chunks.as_slice()); +/// ``` +pub fn chunks(arr: &[T], count: usize) -> Chunks<'_, T> { + #[cfg(all(feature = "rayon", not(miri)))] + return arr.par_chunks(count); + #[cfg(any(not(feature = "rayon"), miri))] + return arr.chunks(count); +} + +#[test] +fn test_chunks() { + let got = chunks(&[1u32, 2, 3, 4, 5], 3) + .map(|chunk| (chunk.len(), chunk.iter().sum::())) + .collect::>(); + assert_eq!(&[(3, 6), (2, 9)], got.as_slice()); +} + + +/// Sorts elements of a slice using given comparator. +/// +/// It uses conditional compilation and either uses Rayon’s +/// `par_sort_unstable_by` or standard `sort_unstable_by` method. Specifically, +/// if `rayon` feature is enabled and not building Miri tests, Rayon is used. +/// +/// # Example +/// +/// ``` +/// let mut arr = [5, 4, 3, 1, 2, 3]; +/// lib::par::sort_unstable_by(&mut arr[..], |a, b| a.cmp(b)); +/// assert_eq!(&[1, 2, 3, 3, 4, 5], &arr[..]); +/// ``` +pub fn sort_unstable_by( + arr: &mut [T], + cmp: impl (Fn(&T, &T) -> core::cmp::Ordering) + Sync, +) { + #[cfg(all(feature = "rayon", not(miri)))] + arr.par_sort_unstable_by(cmp); + #[cfg(any(not(feature = "rayon"), miri))] + arr.sort_unstable_by(cmp); +} diff --git a/solana/trie-geyser/Cargo.lock b/solana/trie-geyser/Cargo.lock index 1644a6a9..9a487b64 100644 --- a/solana/trie-geyser/Cargo.lock +++ b/solana/trie-geyser/Cargo.lock @@ -415,6 +415,12 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + [[package]] name = "assert_matches" version = "1.5.0" @@ -491,6 +497,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bincode" version = "1.3.3" @@ -524,6 +536,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "blake3" version = "1.5.1" @@ -763,6 +784,9 @@ name = "bytes" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +dependencies = [ + "serde", +] [[package]] name = "bzip2" @@ -795,6 +819,29 @@ dependencies = [ "libc", ] +[[package]] +name = "cf-guest" +version = "0.0.0" +dependencies = [ + "borsh 0.10.3", + "bytemuck", + "derive_more", + "guestchain", + "ibc-client-tendermint-types", + "ibc-core-client-context", + "ibc-core-commitment-types", + "ibc-core-host", + "ibc-primitives", + "ibc-proto", + "lib", + "prost", + "prost-build", + "proto-utils", + "sealable-trie", + "stdx", + "trie-ids", +] + [[package]] name = "cf-solana" version = "0.0.0" @@ -804,12 +851,22 @@ dependencies = [ "blake3", "bs58 0.5.1", "bytemuck", + "cf-guest", "derive_more", + "ibc-client-tendermint-types", + "ibc-core-client-context", + "ibc-core-commitment-types", + "ibc-core-host", + "ibc-primitives", + "ibc-proto", "lib", - "rayon", + "prost", + "prost-build", + "proto-utils", "serde", "solana-program", "stdx", + "trie-ids", ] [[package]] @@ -854,7 +911,7 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" dependencies = [ - "ascii", + "ascii 0.9.3", "byteorder", "either", "memchr", @@ -881,6 +938,32 @@ dependencies = [ "web-sys", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const_format" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "constant_time_eq" version = "0.3.0" @@ -1009,6 +1092,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + [[package]] name = "darling" version = "0.20.10" @@ -1058,6 +1154,25 @@ dependencies = [ "rayon", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "derivation-path" version = "0.2.0" @@ -1108,6 +1223,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "eager" version = "0.1.0" @@ -1120,7 +1246,30 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature 2.2.0", +] + +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -1130,7 +1279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", - "ed25519", + "ed25519 1.5.3", "rand 0.7.3", "serde", "sha2 0.9.9", @@ -1237,6 +1386,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flate2" version = "1.0.30" @@ -1247,6 +1402,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flex-error" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" +dependencies = [ + "paste", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1262,6 +1426,20 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.30" @@ -1269,6 +1447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -1303,6 +1482,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -1374,6 +1554,27 @@ dependencies = [ "scroll", ] +[[package]] +name = "guestchain" +version = "0.0.0" +dependencies = [ + "borsh 0.10.3", + "bytemuck", + "derive_more", + "ibc-core-client-context", + "ibc-core-commitment-types", + "ibc-core-host", + "ibc-primitives", + "ibc-proto", + "lib", + "prost", + "proto-utils", + "sealable-trie", + "stdx", + "strum 0.25.0", + "trie-ids", +] + [[package]] name = "h2" version = "0.3.26" @@ -1456,6 +1657,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "hex" version = "0.4.3" @@ -1592,6 +1799,208 @@ dependencies = [ "cc", ] +[[package]] +name = "ibc-client-tendermint-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto", + "prost", + "tendermint", + "tendermint-light-client-verifier", + "tendermint-proto", +] + +[[package]] +name = "ibc-core-channel-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto", + "sha2 0.10.8", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-client-context" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-client-tendermint-types", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-handler-types", + "ibc-core-host-types", + "ibc-primitives", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-client-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-commitment-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-commitment-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-primitives", + "ibc-proto", + "ics23", + "subtle-encoding", +] + +[[package]] +name = "ibc-core-connection-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-handler-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-channel-types", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-host-types", + "ibc-core-router-types", + "ibc-primitives", + "ibc-proto", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-host" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-channel-types", + "ibc-core-client-context", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-handler-types", + "ibc-core-host-types", + "ibc-primitives", + "subtle-encoding", +] + +[[package]] +name = "ibc-core-host-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-primitives", +] + +[[package]] +name = "ibc-core-router-types" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-primitives" +version = "0.50.0" +source = "git+https://github.com/mina86/ibc-rs?rev=f07276383091f75b7ee8bff6fd434f8214ac5054#f07276383091f75b7ee8bff6fd434f8214ac5054" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-proto", + "prost", + "tendermint", + "time", +] + +[[package]] +name = "ibc-proto" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4ee32b22d3b06f31529b956f4928e5c9a068d71e46cf6abfa19c31ca550553" +dependencies = [ + "base64 0.21.7", + "bytes", + "flex-error", + "ics23", + "prost", + "subtle-encoding", + "tendermint-proto", +] + +[[package]] +name = "ics23" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18798160736c1e368938ba6967dbcb3c7afb3256b442a5506ba5222eebb68a5a" +dependencies = [ + "anyhow", + "blake2", + "blake3", + "bytes", + "hex 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "prost", + "ripemd", + "sha2 0.10.8", + "sha3 0.10.8", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1699,9 +2108,11 @@ name = "lib" version = "0.0.0" dependencies = [ "base64 0.21.7", + "borsh 0.10.3", "bs58 0.5.1", "bytemuck", "derive_more", + "rayon", "serde", "sha2 0.10.8", "stdx", @@ -1839,6 +2250,13 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memory" +version = "0.0.0" +dependencies = [ + "derive_more", +] + [[package]] name = "merlin" version = "3.0.0" @@ -1898,6 +2316,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + [[package]] name = "num" version = "0.2.1" @@ -1943,6 +2367,23 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num-derive" version = "0.4.2" @@ -2109,6 +2550,16 @@ dependencies = [ "num", ] +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2121,6 +2572,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.30" @@ -2145,6 +2606,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2214,6 +2681,68 @@ dependencies = [ "yansi", ] +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +dependencies = [ + "bytes", + "heck 0.4.1", + "itertools", + "log", + "multimap", + "once_cell", + "petgraph", + "prost", + "prost-types", + "regex", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.71", +] + +[[package]] +name = "prost-types" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +dependencies = [ + "prost", +] + +[[package]] +name = "proto-utils" +version = "0.0.0" +dependencies = [ + "const_format", + "derive_more", + "ibc-core-client-context", + "ibc-proto", + "prost", +] + [[package]] name = "qstring" version = "0.7.2" @@ -2448,6 +2977,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2561,6 +3099,22 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sealable-trie" +version = "0.0.0" +dependencies = [ + "ascii 1.1.0", + "base64 0.21.7", + "borsh 0.10.3", + "bytemuck", + "derive_more", + "lib", + "memory", + "sha2 0.10.8", + "stdx", + "strum 0.25.0", +] + [[package]] name = "semver" version = "1.0.23" @@ -2616,6 +3170,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2702,6 +3267,12 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" + [[package]] name = "siphasher" version = "0.3.11" @@ -2792,7 +3363,7 @@ dependencies = [ "lz4", "memmap2", "modular-bitfield", - "num-derive", + "num-derive 0.4.2", "num-traits", "num_cpus", "num_enum", @@ -3005,7 +3576,7 @@ dependencies = [ "log", "memoffset", "num-bigint 0.4.6", - "num-derive", + "num-derive 0.4.2", "num-traits", "parking_lot", "rand 0.8.5", @@ -3038,7 +3609,7 @@ dependencies = [ "itertools", "libc", "log", - "num-derive", + "num-derive 0.4.2", "num-traits", "percentage", "rand 0.8.5", @@ -3089,7 +3660,7 @@ dependencies = [ "libsecp256k1", "log", "memmap2", - "num-derive", + "num-derive 0.4.2", "num-traits", "num_enum", "pbkdf2 0.11.0", @@ -3213,7 +3784,7 @@ source = "git+https://github.com/ComposableFi/mantis-solana.git?branch=mantis/de dependencies = [ "bincode", "log", - "num-derive", + "num-derive 0.4.2", "num-traits", "rustc_version", "serde", @@ -3256,7 +3827,7 @@ dependencies = [ "itertools", "lazy_static", "merlin", - "num-derive", + "num-derive 0.4.2", "num-traits", "rand 0.7.3", "serde", @@ -3294,6 +3865,16 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "spl-associated-token-account" version = "4.0.0" @@ -3302,7 +3883,7 @@ checksum = "68034596cf4804880d265f834af1ff2f821ad5293e41fa0f8f59086c181fc38e" dependencies = [ "assert_matches", "borsh 1.5.1", - "num-derive", + "num-derive 0.4.2", "num-traits", "solana-program", "spl-token", @@ -3374,7 +3955,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7b28bed65356558133751cc32b48a7a5ddfc59ac4e941314630bbed1ac10532" dependencies = [ - "num-derive", + "num-derive 0.4.2", "num-traits", "solana-program", "spl-program-error-derive", @@ -3415,7 +3996,7 @@ checksum = "70a0f06ac7f23dc0984931b1fe309468f14ea58e32660439c1cef19456f5d0e3" dependencies = [ "arrayref", "bytemuck", - "num-derive", + "num-derive 0.4.2", "num-traits", "num_enum", "solana-program", @@ -3430,7 +4011,7 @@ checksum = "d9c10f3483e48679619c76598d4e4aebb955bc49b0a5cc63323afbf44135c9bf" dependencies = [ "arrayref", "bytemuck", - "num-derive", + "num-derive 0.4.2", "num-traits", "num_enum", "solana-program", @@ -3568,6 +4149,21 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "subtle-encoding" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" +dependencies = [ + "zeroize", +] + +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + [[package]] name = "syn" version = "1.0.109" @@ -3652,6 +4248,66 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "tendermint" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15ab8f0a25d0d2ad49ac615da054d6a76aa6603ff95f7d18bafdd34450a1a04b" +dependencies = [ + "bytes", + "digest 0.10.7", + "ed25519 2.2.3", + "ed25519-consensus", + "flex-error", + "futures", + "num-traits", + "once_cell", + "prost", + "prost-types", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "signature 2.2.0", + "subtle", + "subtle-encoding", + "tendermint-proto", + "time", + "zeroize", +] + +[[package]] +name = "tendermint-light-client-verifier" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b8090d0eef9ad57b1b913b5e358e26145c86017e87338136509b94383a4af25" +dependencies = [ + "derive_more", + "flex-error", + "serde", + "tendermint", + "time", +] + +[[package]] +name = "tendermint-proto" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b797dd3d2beaaee91d2f065e7bdf239dc8d80bba4a183a288bc1279dd5a69a1e" +dependencies = [ + "bytes", + "flex-error", + "num-derive 0.3.3", + "num-traits", + "prost", + "prost-types", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -3681,6 +4337,35 @@ dependencies = [ "syn 2.0.71", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tiny-bip39" version = "0.8.2" @@ -3804,6 +4489,21 @@ dependencies = [ "once_cell", ] +[[package]] +name = "trie-ids" +version = "0.0.0" +dependencies = [ + "ascii 1.1.0", + "base64 0.21.7", + "bytemuck", + "derive_more", + "ibc-core-channel-types", + "ibc-core-client-types", + "ibc-core-connection-types", + "ibc-core-host-types", + "strum 0.25.0", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -3843,6 +4543,12 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +[[package]] +name = "unicode-xid" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" + [[package]] name = "universal-hash" version = "0.4.1" @@ -4211,7 +4917,7 @@ dependencies = [ "cf-solana", "crossbeam-channel", "derive_more", - "hex", + "hex 0.4.3 (git+https://github.com/mina86/rust-hex.git?branch=main)", "log", "rand 0.8.5", "rand_chacha 0.3.1", @@ -4263,9 +4969,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.3.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ]