From 9b26fe9c5b2eb0d0a137013904c3991fa706daee Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 9 Jan 2024 14:40:52 +0000 Subject: [PATCH 01/67] chore: move to workspace structure --- Cargo.toml | 12 +++---- bin/client/Cargo.toml | 32 +++++++++++++++++++ {src => bin/client/src}/client/error.rs | 0 {src => bin/client/src}/client/message.rs | 0 {src => bin/client/src}/client/mod.rs | 0 .../src}/client/protocol/experimental.rs | 0 .../src}/client/protocol/merkle_util.rs | 0 .../client/src}/client/protocol/mod.rs | 20 ++---------- {src => bin/client/src}/client/rpc.rs | 0 {src => bin/client/src}/client/store.rs | 0 {src => bin/client/src}/config.rs | 0 {src => bin/client/src}/controller.rs | 0 {src => bin/client/src}/main.rs | 0 13 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 bin/client/Cargo.toml rename {src => bin/client/src}/client/error.rs (100%) rename {src => bin/client/src}/client/message.rs (100%) rename {src => bin/client/src}/client/mod.rs (100%) rename {src => bin/client/src}/client/protocol/experimental.rs (100%) rename {src => bin/client/src}/client/protocol/merkle_util.rs (100%) rename {src => bin/client/src}/client/protocol/mod.rs (96%) rename {src => bin/client/src}/client/rpc.rs (100%) rename {src => bin/client/src}/client/store.rs (100%) rename {src => bin/client/src}/config.rs (100%) rename {src => bin/client/src}/controller.rs (100%) rename {src => bin/client/src}/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index dbf23f9..a3da415 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,12 @@ -[package] +[workspace.package] edition = "2021" -name = "near-light-client" +license = "MIT" version = "0.2.0" -[dependencies] +[workspace] +members = [ "bin/*" ] + +[workspace.dependencies] anyhow = "1.0" async-trait = "0.1" config = "0.13" @@ -33,6 +36,3 @@ near-crypto = "0.17" near-jsonrpc-client = "0.6" near-primitives = "0.17" near-primitives-core = "0.17" - -[dev-dependencies] -rand = "*" diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml new file mode 100644 index 0000000..c3df4db --- /dev/null +++ b/bin/client/Cargo.toml @@ -0,0 +1,32 @@ +[package] +edition.workspace = true +license.workspace = true +name = "near-light-client" +version.workspace = true + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +axum.workspace = true +coerce.workspace = true +config.workspace = true +either.workspace = true +futures.workspace = true +hex.workspace = true +itertools.workspace = true +log.workspace = true +near-crypto.workspace = true +near-jsonrpc-client.workspace = true +near-primitives-core.workspace = true +near-primitives.workspace = true +pretty_env_logger.workspace = true +protobuf.workspace = true +reqwest.workspace = true +serde.workspace = true +serde_json.workspace = true +sled.workspace = true +thiserror.workspace = true +tokio.workspace = true + +[dev-dependencies] +rand = "*" diff --git a/src/client/error.rs b/bin/client/src/client/error.rs similarity index 100% rename from src/client/error.rs rename to bin/client/src/client/error.rs diff --git a/src/client/message.rs b/bin/client/src/client/message.rs similarity index 100% rename from src/client/message.rs rename to bin/client/src/client/message.rs diff --git a/src/client/mod.rs b/bin/client/src/client/mod.rs similarity index 100% rename from src/client/mod.rs rename to bin/client/src/client/mod.rs diff --git a/src/client/protocol/experimental.rs b/bin/client/src/client/protocol/experimental.rs similarity index 100% rename from src/client/protocol/experimental.rs rename to bin/client/src/client/protocol/experimental.rs diff --git a/src/client/protocol/merkle_util.rs b/bin/client/src/client/protocol/merkle_util.rs similarity index 100% rename from src/client/protocol/merkle_util.rs rename to bin/client/src/client/protocol/merkle_util.rs diff --git a/src/client/protocol/mod.rs b/bin/client/src/client/protocol/mod.rs similarity index 96% rename from src/client/protocol/mod.rs rename to bin/client/src/client/protocol/mod.rs index 9e00d9f..0fdd5d3 100644 --- a/src/client/protocol/mod.rs +++ b/bin/client/src/client/protocol/mod.rs @@ -129,23 +129,6 @@ impl Protocol { verify_hash(*block_merkle_root, block_proof, *block_hash) } - fn next_block_hash( - current_block_hash: &CryptoHash, - block_view: &LightClientBlockView, - ) -> CryptoHash { - // TODO: remove the check once tests pass - let old = CryptoHash::hash_bytes(&{ - let mut temp_vec = Vec::new(); - temp_vec.extend_from_slice(&(block_view.next_block_inner_hash.0)); - temp_vec.extend_from_slice(&(current_block_hash.0)); - temp_vec - }); - let new = combine_hash(&block_view.next_block_inner_hash, current_block_hash); - assert_eq!(old, new); - log::debug!("Current block hash: {}", current_block_hash); - new - } - fn reconstruct_approval_message(block_view: &LightClientBlockView) -> Option> { let new_head = Header { prev_block_hash: block_view.prev_block_hash, @@ -153,7 +136,8 @@ impl Protocol { inner_lite: block_view.inner_lite.clone(), }; - let next_block_hash = Self::next_block_hash(&new_head.hash(), block_view); + let next_block_hash = combine_hash(&block_view.next_block_inner_hash, &new_head.hash()); + let endorsement = ApprovalInner::Endorsement(next_block_hash); let approval_message = { diff --git a/src/client/rpc.rs b/bin/client/src/client/rpc.rs similarity index 100% rename from src/client/rpc.rs rename to bin/client/src/client/rpc.rs diff --git a/src/client/store.rs b/bin/client/src/client/store.rs similarity index 100% rename from src/client/store.rs rename to bin/client/src/client/store.rs diff --git a/src/config.rs b/bin/client/src/config.rs similarity index 100% rename from src/config.rs rename to bin/client/src/config.rs diff --git a/src/controller.rs b/bin/client/src/controller.rs similarity index 100% rename from src/controller.rs rename to bin/client/src/controller.rs diff --git a/src/main.rs b/bin/client/src/main.rs similarity index 100% rename from src/main.rs rename to bin/client/src/main.rs From 383ee74650d42227a2893891e4a6edc39c59d986 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 9 Jan 2024 14:43:49 +0000 Subject: [PATCH 02/67] refactor!: move proof to protocol --- bin/client/src/client/mod.rs | 37 +------------------------- bin/client/src/client/protocol/mod.rs | 38 ++++++++++++++++++++++++++- bin/client/src/controller.rs | 2 +- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 2bd45b9..7532f37 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -2,6 +2,7 @@ use self::{message::BatchGetProof, store::Store}; use crate::prelude::*; use crate::{ client::{ + protocol::Proof, protocol::Protocol, store::{head_key, Collection, Entity}, }, @@ -19,42 +20,6 @@ pub mod protocol; pub mod rpc; mod store; -#[derive(Debug, Serialize, Deserialize)] -#[serde(untagged)] -pub enum Proof { - Basic { - head_block_root: CryptoHash, - proof: Box, - }, - Experimental(protocol::experimental::Proof), -} - -impl From<(CryptoHash, BasicProof)> for Proof { - fn from((head_block_root, proof): (CryptoHash, BasicProof)) -> Self { - Self::Basic { - head_block_root, - proof: Box::new(proof), - } - } -} - -impl From for Proof { - fn from(proof: protocol::experimental::Proof) -> Self { - Self::Experimental(proof) - } -} - -impl Proof { - pub fn block_merkle_root(&self) -> &CryptoHash { - match self { - Self::Basic { - head_block_root, .. - } => head_block_root, - Self::Experimental(proof) => &proof.head_block_root, - } - } -} - pub struct LightClient { config: Config, client: rpc::NearRpcClient, diff --git a/bin/client/src/client/protocol/mod.rs b/bin/client/src/client/protocol/mod.rs index 0fdd5d3..0b9d9b3 100644 --- a/bin/client/src/client/protocol/mod.rs +++ b/bin/client/src/client/protocol/mod.rs @@ -1,4 +1,4 @@ -use super::{error::Error, Proof}; +use super::error::Error; use crate::prelude::*; use merkle_util::*; use near_crypto::{PublicKey, Signature}; @@ -19,6 +19,42 @@ pub struct Synced { pub next_bps: Option<(EpochId, Vec)>, } +#[derive(Debug, Serialize, Deserialize)] +#[serde(untagged)] +pub enum Proof { + Basic { + head_block_root: CryptoHash, + proof: Box, + }, + Experimental(experimental::Proof), +} + +impl From<(CryptoHash, BasicProof)> for Proof { + fn from((head_block_root, proof): (CryptoHash, BasicProof)) -> Self { + Self::Basic { + head_block_root, + proof: Box::new(proof), + } + } +} + +impl From for Proof { + fn from(proof: experimental::Proof) -> Self { + Self::Experimental(proof) + } +} + +impl Proof { + pub fn block_merkle_root(&self) -> &CryptoHash { + match self { + Self::Basic { + head_block_root, .. + } => head_block_root, + Self::Experimental(proof) => &proof.head_block_root, + } + } +} + pub struct Protocol; impl Protocol { diff --git a/bin/client/src/controller.rs b/bin/client/src/controller.rs index 49f219f..23f2840 100644 --- a/bin/client/src/controller.rs +++ b/bin/client/src/controller.rs @@ -81,7 +81,7 @@ mod proof { use super::*; use crate::client::{ message::{BatchGetProof, GetProof, VerifyProof}, - Proof, + protocol::Proof, }; use axum::Json; From 2397a46d1c3c7bcf244a3a5d4e2204d7fe625fc0 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 9 Jan 2024 15:09:11 +0000 Subject: [PATCH 03/67] feat: expose protocol as a standalone crate --- Cargo.lock | 21 +++++ Cargo.toml | 12 +-- bin/client/Cargo.toml | 1 + bin/client/src/client/message.rs | 12 +-- bin/client/src/client/mod.rs | 9 +-- bin/client/src/controller.rs | 8 +- bin/client/src/main.rs | 13 +--- crates/protocol/Cargo.toml | 32 ++++++++ .../client => crates/protocol/src}/error.rs | 0 .../protocol/src}/experimental.rs | 76 +++---------------- .../mod.rs => crates/protocol/src/lib.rs | 6 +- .../protocol/src}/merkle_util.rs | 0 crates/protocol/src/prelude.rs | 12 +++ 13 files changed, 93 insertions(+), 109 deletions(-) create mode 100644 crates/protocol/Cargo.toml rename {bin/client/src/client => crates/protocol/src}/error.rs (100%) rename {bin/client/src/client/protocol => crates/protocol/src}/experimental.rs (84%) rename bin/client/src/client/protocol/mod.rs => crates/protocol/src/lib.rs (99%) rename {bin/client/src/client/protocol => crates/protocol/src}/merkle_util.rs (100%) create mode 100644 crates/protocol/src/prelude.rs diff --git a/Cargo.lock b/Cargo.lock index ce4a387..9e94481 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1982,6 +1982,7 @@ dependencies = [ "log", "near-crypto", "near-jsonrpc-client", + "near-light-client-protocol", "near-primitives", "near-primitives-core", "pretty_env_logger", @@ -1995,6 +1996,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "near-light-client-protocol" +version = "0.2.0" +dependencies = [ + "anyhow", + "either", + "hex", + "itertools 0.12.0", + "log", + "near-crypto", + "near-jsonrpc-primitives", + "near-primitives", + "near-primitives-core", + "pretty_env_logger", + "rand 0.7.3", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "near-o11y" version = "0.17.0" diff --git a/Cargo.toml b/Cargo.toml index a3da415..b5a461a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ license = "MIT" version = "0.2.0" [workspace] -members = [ "bin/*" ] +members = [ "bin/*", "crates/*" ] +resolver = "2" [workspace.dependencies] anyhow = "1.0" @@ -32,7 +33,8 @@ serde_json = "1.0" # TODO: upgrade # Near specific -near-crypto = "0.17" -near-jsonrpc-client = "0.6" -near-primitives = "0.17" -near-primitives-core = "0.17" +near-crypto = "0.17" +near-jsonrpc-client = "0.6" +near-jsonrpc-primitives = "0.17" +near-primitives = "0.17" +near-primitives-core = "0.17" diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml index c3df4db..b9fec5c 100644 --- a/bin/client/Cargo.toml +++ b/bin/client/Cargo.toml @@ -27,6 +27,7 @@ serde_json.workspace = true sled.workspace = true thiserror.workspace = true tokio.workspace = true +protocol = { path = "../../crates/protocol", package = "near-light-client-protocol" } [dev-dependencies] rand = "*" diff --git a/bin/client/src/client/message.rs b/bin/client/src/client/message.rs index d32a46c..7c44749 100644 --- a/bin/client/src/client/message.rs +++ b/bin/client/src/client/message.rs @@ -1,7 +1,7 @@ -use super::{protocol::experimental::Proof as ExperimentalProof, Header, Proof}; use crate::prelude::*; use coerce::actor::message::Message; use near_primitives::types::TransactionOrReceiptId; +use protocol::{experimental::Proof as ExperimentalProof, Proof}; pub struct Shutdown; @@ -44,13 +44,3 @@ pub struct VerifyProof { impl Message for VerifyProof { type Result = Result; } - -// TODO: batch messages -// -// -#[cfg(test)] -mod tests { - - #[test] - fn test_name() {} -} diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 7532f37..205ad1e 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -1,22 +1,17 @@ use self::{message::BatchGetProof, store::Store}; use crate::prelude::*; use crate::{ - client::{ - protocol::Proof, - protocol::Protocol, - store::{head_key, Collection, Entity}, - }, + client::store::{head_key, Collection, Entity}, config::Config, }; use coerce::actor::{context::ActorContext, message::Handler, Actor}; use message::{Archive, GetProof, Head, Shutdown, VerifyProof}; use near_primitives::views::validator_stake_view::ValidatorStakeView; +use protocol::{Proof, Protocol}; use std::{str::FromStr, sync::Arc}; use tokio::time; -pub mod error; pub mod message; -pub mod protocol; pub mod rpc; mod store; diff --git a/bin/client/src/controller.rs b/bin/client/src/controller.rs index 23f2840..c5f6501 100644 --- a/bin/client/src/controller.rs +++ b/bin/client/src/controller.rs @@ -79,11 +79,9 @@ mod header { mod proof { use super::*; - use crate::client::{ - message::{BatchGetProof, GetProof, VerifyProof}, - protocol::Proof, - }; + use crate::client::message::{BatchGetProof, GetProof, VerifyProof}; use axum::Json; + use protocol::Proof; pub(super) async fn post_get_proof( State(client): State>, @@ -113,7 +111,7 @@ mod proof { #[derive(Debug, Serialize)] pub struct BatchProofWithErrors { - proofs: crate::client::protocol::experimental::Proof, + proofs: protocol::experimental::Proof, errors: Vec, } diff --git a/bin/client/src/main.rs b/bin/client/src/main.rs index 24b49e3..b38a1d6 100644 --- a/bin/client/src/main.rs +++ b/bin/client/src/main.rs @@ -31,17 +31,6 @@ async fn main() -> anyhow::Result<()> { } pub mod prelude { - pub use anyhow::anyhow; - pub use anyhow::Result; pub use async_trait::async_trait; - pub use itertools::Itertools; - pub use log::{debug, error, info, trace, warn}; - pub use near_primitives::borsh::{self, BorshDeserialize, BorshSerialize}; - pub use near_primitives_core::hash::CryptoHash; - pub use serde::{Deserialize, Serialize}; - - pub type Header = near_primitives::views::LightClientBlockLiteView; - pub type BasicProof = - near_jsonrpc_client::methods::light_client_proof::RpcLightClientExecutionProofResponse; - pub type ExperimentalProof = super::client::protocol::experimental::Proof; + pub use protocol::prelude::*; } diff --git a/crates/protocol/Cargo.toml b/crates/protocol/Cargo.toml new file mode 100644 index 0000000..ea53a1b --- /dev/null +++ b/crates/protocol/Cargo.toml @@ -0,0 +1,32 @@ +[package] +edition.workspace = true +license.workspace = true +name = "near-light-client-protocol" +version.workspace = true + +[dependencies] +anyhow.workspace = true +either.workspace = true +log.workspace = true +near-crypto.workspace = true +near-jsonrpc-primitives.workspace = true +near-primitives-core.workspace = true +near-primitives.workspace = true +serde.workspace = true +thiserror.workspace = true +itertools.workspace = true + +# async-trait.workspace = true +# axum.workspace = true +# coerce.workspace = true +# config.workspace = true +# near-jsonrpc-client.workspace = true +# protobuf.workspace = true +# reqwest.workspace = true +# sled.workspace = true + +[dev-dependencies] +hex.workspace = true +pretty_env_logger.workspace = true +rand = "*" +serde_json.workspace = true diff --git a/bin/client/src/client/error.rs b/crates/protocol/src/error.rs similarity index 100% rename from bin/client/src/client/error.rs rename to crates/protocol/src/error.rs diff --git a/bin/client/src/client/protocol/experimental.rs b/crates/protocol/src/experimental.rs similarity index 84% rename from bin/client/src/client/protocol/experimental.rs rename to crates/protocol/src/experimental.rs index 5209404..1ab0df1 100644 --- a/bin/client/src/client/protocol/experimental.rs +++ b/crates/protocol/src/experimental.rs @@ -1,6 +1,6 @@ -use crate::client::protocol::Protocol; -use crate::prelude::*; +use crate::{prelude::*, Protocol}; use either::Either; +use itertools::Itertools; use near_primitives::{ block_header::BlockHeaderInnerLite, merkle::{combine_hash, MerklePathItem}, @@ -327,23 +327,17 @@ pub fn verify_proof(proof: Proof) -> bool { #[cfg(test)] pub(crate) mod tests { use super::*; - use crate::client::{ - protocol::merkle_util::{compute_root_from_path, compute_root_from_path_and_item}, - rpc::{NearRpcClient, Network}, - }; - use futures::FutureExt; - use near_primitives::types::TransactionOrReceiptId; + use crate::merkle_util::{compute_root_from_path, compute_root_from_path_and_item}; use near_primitives_core::types::AccountId; - use std::{path::Path, str::FromStr}; + use std::str::FromStr; pub const BLOCK_MERKLE_ROOT: &str = "WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L"; pub const LIGHT_CLIENT_HEAD: &str = "4bM5eXMDGxpFZXbWNT6TqX1HdZsWoHZ11KerCHJ8RKmU"; - pub fn get_constants() -> (CryptoHash, CryptoHash, NearRpcClient) { - let client = NearRpcClient::new(Network::Testnet); + pub fn get_constants() -> (CryptoHash, CryptoHash) { let block_root = CryptoHash::from_str(BLOCK_MERKLE_ROOT).unwrap(); let light_client_head = CryptoHash::from_str(LIGHT_CLIENT_HEAD).unwrap(); - (light_client_head, block_root, client) + (light_client_head, block_root) } fn read_proof Deserialize<'a>>(path: &str) -> T { @@ -509,67 +503,15 @@ pub(crate) mod tests { // This test populates a reasonably large batch of proofs for verifying the // slimmer onchain light client - #[tokio::test] - async fn batch_proofs() { + #[test] + fn batch_proofs() { let _ = pretty_env_logger::try_init(); let (head, common_root, client) = get_constants(); let receiver_id = AccountId::from_str("da.topgunbakugo.testnet").unwrap(); let path = "fixtures/batch.json"; - let p = if Path::new(path).exists() { - read_proof(path) - } else { - // Get a bunch of receipts to test - let receipts = vec![ - "2QUBErafE2zU3dV9HBYCUyqpcP74erBm7k1j7tXduRa2", - "BixAd4vjnYKzxNtSLGD5w7jk7vD3ZedesHizutwWvDDK", - "6W5LXCxFwg21XMxVLqZMzq24g531kFu2hxBr2N5yN67f", - "Dwwv7KeNP8H9Pr6suUkAqDwex8mp1vK3KykE7asjaYHk", - "D75Ej8NJ8kYE62CnaVX3p8SCHiNLBQCA7pLpudeRbnM6", - "ERDrqb65Sa8mKr4XrXCw1uBae3a8mrByLPcEN92zewfG", - "FuNDcy6u3sS5B8j1szxZGTh6BCjsDTWfUbfFWsFwUyPA", - "2EVVdVsw1nM3hRFV4LTkBYYRWPCR77TVmYxZwipLHmYn", - "9Exwa5z51bTGWPzMMkRcVdGZ6a8rpu4CuWfAvrMuqXHn", - "J65AycXr48nCqrRc8eErLp5AiQb6xUAWF1sgG2fRbn9t", - "5axBiFL3GkvizK4KobsJjzychu7UckoKACnX23RefhoS", - "GEG9nhhwbgMHw61fTrFYvtpeRidAB6NKmNFJmkMc8AuE", - "BFdir5jFtyWQWoLPbxWEGtRedbjgt4nSPcDrdNfWLXcd", - "48tF8CXXLLaUgEbvayqhvX1UZLzLrqSjVJBq5bWXFX7T", - "3L2vmfXBZzMGoXx8bLDaSRxtp2dV65SZr3rYKM46wqe1", - "4g3zeZEt4UrXqFh8Vxcdz8UCGaBBdT7K7MELrnNbu3PH", - "2r652tQLr8kpGtY6KQNLhVC4j6S5jwC1Q6VcuLxQM1UQ", - "DNAQsgrEqJ6kYhqaXbhCNP5W4K891jLUhBtY3nsU17dv", - "EJCfAgRT3x8hPmTvLJgqexuwRqhgujUKbby4b81ypXX4", - "3FFWvbPQXkpQNvGwJ6NkkJtya6XXo8x88Wmhoyv6ABQU", - "BVgDgRBcJJoXeFYarSTrsH9NYe6kgfC14Des88hSJp1j", - "EcnvcNZDgwyiBP7NpV2afkDDvPCmw5rwKT2MLiG1jUFD", - "Hbjut1evHnfm1Ee9eeGJe5ydorVE3W66RacprLuciFpY", - "AKknXHv6Y7iyD44yyTjdTLmgC8AM9CmUHtLXvgEh4qdS", - ] - .into_iter() - .map(CryptoHash::from_str) - .map(Result::unwrap) - .map(|receipt_id| { - client - .fetch_light_client_proof( - crate::client::message::GetProof(TransactionOrReceiptId::Receipt { - receipt_id, - receiver_id: receiver_id.clone(), - }), - head, - ) - .map(Result::unwrap) - }) - .collect_vec(); - - let proofs: Vec<_> = futures::future::join_all(receipts).await; - - let p = Proof::new(common_root, proofs); - write_proof(path, &p); - p - }; - + let p = read_proof(path); assert!(verify_proof(p)); } } diff --git a/bin/client/src/client/protocol/mod.rs b/crates/protocol/src/lib.rs similarity index 99% rename from bin/client/src/client/protocol/mod.rs rename to crates/protocol/src/lib.rs index 0b9d9b3..3594ab2 100644 --- a/bin/client/src/client/protocol/mod.rs +++ b/crates/protocol/src/lib.rs @@ -1,5 +1,5 @@ -use super::error::Error; use crate::prelude::*; +use error::Error; use merkle_util::*; use near_crypto::{PublicKey, Signature}; use near_primitives::{ @@ -9,7 +9,9 @@ use near_primitives::{ views::{validator_stake_view::ValidatorStakeView, LightClientBlockView}, }; +pub mod error; pub mod merkle_util; +pub mod prelude; // Lightweight batch protocol with lookups for proofs pub mod experimental; @@ -303,7 +305,7 @@ impl Protocol { } #[derive(Debug, Clone, PartialEq, Eq)] -pub(crate) struct StakeInfo { +pub struct StakeInfo { total: u128, approved: u128, } diff --git a/bin/client/src/client/protocol/merkle_util.rs b/crates/protocol/src/merkle_util.rs similarity index 100% rename from bin/client/src/client/protocol/merkle_util.rs rename to crates/protocol/src/merkle_util.rs diff --git a/crates/protocol/src/prelude.rs b/crates/protocol/src/prelude.rs new file mode 100644 index 0000000..3db7fb5 --- /dev/null +++ b/crates/protocol/src/prelude.rs @@ -0,0 +1,12 @@ +pub use anyhow::anyhow; +pub use anyhow::Result; +pub use log::{debug, error, info, trace, warn}; +pub use near_primitives::borsh::{self, BorshDeserialize, BorshSerialize}; +pub use near_primitives_core::hash::CryptoHash; +pub use serde::{Deserialize, Serialize}; +pub use itertools::Itertools; + +pub type Header = near_primitives::views::LightClientBlockLiteView; +pub type BasicProof = + near_jsonrpc_primitives::types::light_client::RpcLightClientExecutionProofResponse; +pub type ExperimentalProof = crate::experimental::Proof; From ce95072fa24c9a8e6b9be483421bced8ce8add32 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 9 Jan 2024 15:14:37 +0000 Subject: [PATCH 04/67] wip: port over circuits --- .gitignore | 3 +- circuits/plonky2x/Cargo.lock | 4581 ++++++++++++++++++++++++++++ circuits/plonky2x/Cargo.toml | 17 + circuits/plonky2x/src/builder.rs | 367 +++ circuits/plonky2x/src/codec.rs | 105 + circuits/plonky2x/src/lib.rs | 39 + circuits/plonky2x/src/variables.rs | 232 ++ 7 files changed, 5343 insertions(+), 1 deletion(-) create mode 100644 circuits/plonky2x/Cargo.lock create mode 100644 circuits/plonky2x/Cargo.toml create mode 100644 circuits/plonky2x/src/builder.rs create mode 100644 circuits/plonky2x/src/codec.rs create mode 100644 circuits/plonky2x/src/lib.rs create mode 100644 circuits/plonky2x/src/variables.rs diff --git a/.gitignore b/.gitignore index 4ea0f70..6728bca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -/target +**/target +/vendor .direnv diff --git a/circuits/plonky2x/Cargo.lock b/circuits/plonky2x/Cargo.lock new file mode 100644 index 0000000..2663cd2 --- /dev/null +++ b/circuits/plonky2x/Cargo.lock @@ -0,0 +1,4581 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "const-random", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" + +[[package]] +name = "array-macro" +version = "2.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "220a2c618ab466efe41d0eace94dfeff1c35e3aa47891bdb95e1c0fefffd3c99" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "async-trait" +version = "0.1.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +dependencies = [ + "cfg_aliases", +] + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "sha2", + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +dependencies = [ + "serde", +] + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets 0.48.5", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest", + "hmac", + "k256", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.5", + "bech32", + "bs58", + "digest", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2", + "sha3", + "thiserror", +] + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "const-hex" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-random" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curta" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/curta.git#59e489d21622a92b25a2e4a5b710ce322f309b87" +dependencies = [ + "anyhow", + "bincode", + "curve25519-dalek", + "env_logger 0.9.3", + "hex", + "itertools 0.10.5", + "log", + "num", + "plonky2", + "plonky2_maybe_rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand", + "serde", + "subtle-encoding", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.48", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +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", + "serde", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "ena" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +dependencies = [ + "log", +] + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" +dependencies = [ + "base64 0.21.5", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", +] + +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid 0.8.2", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types 0.12.2", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5344eea9b20effb5efeaad29418215c4d27017639fd1f908260f59cbbd226e" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c405f24ea3a517899ba7985385c43dc4a7eb1209af3b1e0a1a32d7dcc7f8d09" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" +dependencies = [ + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.48", + "toml", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.48", +] + +[[package]] +name = "ethers-core" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" +dependencies = [ + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array", + "k256", + "num_enum", + "once_cell", + "open-fastrlp", + "rand", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.48", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "ethers-etherscan" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" +dependencies = [ + "chrono", + "ethers-core", + "reqwest", + "semver", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681ece6eb1d10f7cf4f873059a77c04ff1de4f35c63dd7bccde8f438374fcb93" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.5", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-signers" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cb1b714e227bbd2d8c53528adb580b203009728b17d0d0e4119353aa9bc5532" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand", + "sha2", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-solc" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a64f710586d147864cff66540a6d64518b9ff37d73ef827fee430538265b595f" +dependencies = [ + "cfg-if", + "const-hex", + "dirs", + "dunce", + "ethers-core", + "glob", + "home", + "md-5", + "num_cpus", + "once_cell", + "path-slash", + "rayon", + "regex", + "semver", + "serde", + "serde_json", + "solang-parser", + "svm-rs", + "thiserror", + "tiny-keccak", + "tokio", + "tracing", + "walkdir", + "yansi", +] + +[[package]] +name = "eyre" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "bitvec", + "byteorder", + "ff_derive", + "rand_core", + "subtle", +] + +[[package]] +name = "ff_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" +dependencies = [ + "addchain", + "cfg-if", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[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.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[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-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "rayon", + "serde", +] + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is-terminal" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +dependencies = [ + "hermit-abi 0.3.3", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.5", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "k256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851" +dependencies = [ + "primitive-types 0.10.1", + "tiny-keccak", +] + +[[package]] +name = "lalrpop" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" +dependencies = [ + "ascii-canvas", + "bit-set", + "diff", + "ena", + "is-terminal", + "itertools 0.10.5", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.7.5", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "near-light-client-circuits" +version = "0.1.0" +dependencies = [ + "borsh", + "plonky2", + "plonky2x", + "serde", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint 0.4.4", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "rand", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint 0.4.4", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.3", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 3.0.0", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "openssl" +version = "0.10.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parity-scale-codec" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +dependencies = [ + "proc-macro-crate 2.0.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.1.0", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +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.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "platforms" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" + +[[package]] +name = "plonky2" +version = "0.1.4" +source = "git+https://github.com/mir-protocol/plonky2.git#3e61f06a1d2012785c65f1708620cf399857ac8d" +dependencies = [ + "ahash", + "anyhow", + "getrandom", + "hashbrown 0.14.3", + "itertools 0.11.0", + "keccak-hash", + "log", + "num", + "plonky2_field", + "plonky2_maybe_rayon 0.1.1 (git+https://github.com/mir-protocol/plonky2.git)", + "plonky2_util", + "rand", + "rand_chacha", + "serde", + "serde_json", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_field" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#3e61f06a1d2012785c65f1708620cf399857ac8d" +dependencies = [ + "anyhow", + "itertools 0.11.0", + "num", + "plonky2_util", + "rand", + "serde", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_maybe_rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194db0cbdd974e92d897cd92b74adb3968dc1b967315eb280357c49a7637994e" +dependencies = [ + "rayon", +] + +[[package]] +name = "plonky2_maybe_rayon" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#3e61f06a1d2012785c65f1708620cf399857ac8d" +dependencies = [ + "rayon", +] + +[[package]] +name = "plonky2_util" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#3e61f06a1d2012785c65f1708620cf399857ac8d" + +[[package]] +name = "plonky2x" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/succinctx.git#abd43565ef519da40d73240557cec95d962aa257" +dependencies = [ + "anyhow", + "array-macro", + "async-trait", + "backtrace", + "base64 0.13.1", + "bincode", + "clap", + "curta", + "curve25519-dalek", + "digest", + "dotenv", + "ed25519-dalek", + "env_logger 0.10.1", + "ethers", + "ff", + "futures", + "hex", + "itertools 0.10.5", + "lazy_static", + "log", + "num", + "num-bigint 0.4.4", + "plonky2", + "plonky2x-derive", + "rand", + "reqwest", + "serde", + "serde_json", + "serde_plain", + "serde_with", + "sha2", + "sha256", + "tokio", + "tracing", + "uuid 1.6.1", +] + +[[package]] +name = "plonky2x-derive" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/succinctx.git#abd43565ef519da40d73240557cec95d962aa257" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +dependencies = [ + "proc-macro2", + "syn 2.0.48", +] + +[[package]] +name = "primitive-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +dependencies = [ + "fixed-hash 0.7.0", + "uint", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + +[[package]] +name = "proc-macro-crate" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" +dependencies = [ + "toml_edit 0.21.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bitflags 2.4.1", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.2", + "unarray", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "reqwest" +version = "0.11.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +dependencies = [ + "base64 0.21.5", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + +[[package]] +name = "ring" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.21.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +dependencies = [ + "log", + "ring 0.17.7", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.5", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring 0.17.7", + "untrusted 0.9.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-info" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring 0.17.7", + "untrusted 0.9.0", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +dependencies = [ + "serde", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.195" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.195" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "serde_json" +version = "1.0.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +dependencies = [ + "base64 0.21.5", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.1.0", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha256" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18278f6a914fa3070aa316493f7d2ddfb9ac86ebc06fa3b83bffda487e9065b0" +dependencies = [ + "async-trait", + "bytes", + "hex", + "sha2", + "tokio", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint 0.4.4", + "num-traits", + "thiserror", + "time", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "solang-parser" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" +dependencies = [ + "itertools 0.11.0", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +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 = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.48", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "subtle-encoding" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" +dependencies = [ + "zeroize", +] + +[[package]] +name = "svm-rs" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20689c7d03b6461b502d0b95d6c24874c7d24dea2688af80486a130a06af3b07" +dependencies = [ + "dirs", + "fs2", + "hex", + "once_cell", + "reqwest", + "semver", + "serde", + "serde_json", + "sha2", + "thiserror", + "url", + "zip", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "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.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +dependencies = [ + "futures-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.21.0", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "rustls", + "sha1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-bidi" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "unroll" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad948c1cb799b1a70f836077721a92a35ac177d4daddf4c20a633786d4cf618" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "uuid" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +dependencies = [ + "serde", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml new file mode 100644 index 0000000..d7a23cd --- /dev/null +++ b/circuits/plonky2x/Cargo.toml @@ -0,0 +1,17 @@ +[package] +edition = "2021" +name = "near-light-client-circuits" +version = "0.1.0" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +borsh = "1.3" +serde = { version = "1.0", features = ["derive"] } + +# Circuits +plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } +plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } + +[workspace] +members = [] diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs new file mode 100644 index 0000000..67c13e7 --- /dev/null +++ b/circuits/plonky2x/src/builder.rs @@ -0,0 +1,367 @@ +use crate::variables::{ + Block, BlockHeight, BuildEndorsement, CryptoHash, EpochBlockProducers, Header, HeaderInner, + InnerLiteHash, MerklePath, Proof, PublicKey, Signature, StakeInfo, ValidatorStake, + MAX_EPOCH_VALIDATORS, +}; +use plonky2x::frontend::merkle::tendermint::TendermintMerkleTree; +use plonky2x::prelude::*; + +pub trait Verify, const D: usize> { + fn ensure_not_already_verified( + &mut self, + head: &Header, + block_height: &BlockHeight, + ) -> BoolVariable; + + fn ensure_epoch_is_current_or_next( + &mut self, + head: &Header, + epoch_id: &CryptoHash, + ) -> BoolVariable; + + fn ensure_if_next_epoch_contains_next_bps( + &mut self, + head: &Header, + epoch_id: &CryptoHash, + next_bps: &EpochBlockProducers, + ) -> BoolVariable; + + fn validate_signatures( + &mut self, + is_active: ArrayVariable, + signatures: ArrayVariable, + epoch_bps: ArrayVariable, + approval_message_hash: Bytes32Variable, + ) -> StakeInfo; + + fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfo) -> BoolVariable; + + fn ensure_next_bps_is_valid( + &mut self, + expected_hash: &CryptoHash, + next_bps_hash: Option<&CryptoHash>, + ) -> BoolVariable; + + fn ensure_block_hash_matches_outcome( + &mut self, + head: &Header, + outcome_proof_block_hash: &CryptoHash, + ) -> BoolVariable; + + fn ensure_block_hash_matches_outcome_hashed( + &mut self, + head: &CryptoHash, + outcome_proof_block_hash: &CryptoHash, + ) -> BoolVariable; + + fn verify_outcome( + &mut self, + expected: &CryptoHash, + outcome_proof: &MerklePath, + outcome_hash: &CryptoHash, + outcome_root_proof: &MerklePath, + ) -> BoolVariable; + + fn verify_block( + &mut self, + expected: &CryptoHash, + block_proof: &MerklePath, + block_hash: &CryptoHash, + ) -> BoolVariable; + + fn header_hash( + &mut self, + inner_lite_hash: &HeaderInner, + inner_rest_hash: &CryptoHash, + prev_block_hash: &CryptoHash, + ) -> CryptoHash; + + fn inner_lite_hash(&mut self, inner_lite: &HeaderInner) -> CryptoHash; + + fn assertx(&mut self, condition: BoolVariable); +} + +impl, const D: usize> Verify for CircuitBuilder { + fn ensure_not_already_verified( + &mut self, + head: &Header, + block_height: &BlockHeight, + ) -> BoolVariable { + self.gt(*block_height, head.inner_lite.height) + } + + fn ensure_epoch_is_current_or_next( + &mut self, + head: &Header, + epoch_id: &CryptoHash, + ) -> BoolVariable { + let epoch = self.is_equal(head.inner_lite.epoch_id, *epoch_id); + let next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); + + self.or(epoch, next_epoch) + } + + fn ensure_if_next_epoch_contains_next_bps( + &mut self, + head: &Header, + epoch_id: &CryptoHash, + next_bps: &EpochBlockProducers, + ) -> BoolVariable { + let is_next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); + let is_not_empty = self.constant(next_bps.bps.len() > 0); + let ok_anyway = self.constant(true); + self.select(is_next_epoch, is_not_empty, ok_anyway) + } + + // TODO: does not build active participants + fn validate_signatures( + &mut self, + is_active: ArrayVariable, + signatures: ArrayVariable, + epoch_bps: ArrayVariable, + approval_message_hash: Bytes32Variable, + ) -> StakeInfo { + let messages = [approval_message_hash.0; MAX_EPOCH_VALIDATORS]; + let pubkeys: Vec = epoch_bps + .data + .iter() + .map(|vs| vs.public_key.clone()) + .collect(); + + const MSG_LEN: usize = 32; + + // Here we ensure that all active participants have signed + self.curta_eddsa_verify_sigs_conditional::( + is_active.clone(), + None, + ArrayVariable::new(messages.to_vec()), + signatures, + ArrayVariable::new(pubkeys), + ); + + let mut total_stake = self.constant(0); + let mut approved_stake = self.constant(0); + + // Collect all approvals + for (i, bps) in epoch_bps.data.iter().enumerate() { + if is_active.data.get(i).is_some() { + approved_stake = self.add(approved_stake, bps.stake); + } + total_stake = self.add(total_stake, bps.stake); + } + + StakeInfo { + total_stake, + approved_stake, + } + } + + fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfo) -> BoolVariable { + let denominator = self.constant(3); + let numerator = self.constant(2); + + let approved = self.mul(stake.approved_stake, numerator); + let threshold = self.mul(stake.total_stake, denominator); + + self.gte(approved, threshold) + } + + fn ensure_next_bps_is_valid( + &mut self, + expected_hash: &CryptoHash, + next_bps_hash: Option<&CryptoHash>, + ) -> BoolVariable { + if let Some(next_bps) = next_bps_hash { + self.is_equal(*next_bps, *expected_hash) + } else { + self._true() + } + } + + fn ensure_block_hash_matches_outcome( + &mut self, + head: &Header, + outcome_proof_block_hash: &CryptoHash, + ) -> BoolVariable { + let hash = self.header_hash( + &head.inner_lite, + &head.inner_rest_hash, + &head.prev_block_hash, + ); + self.is_equal(hash, *outcome_proof_block_hash) + } + + fn ensure_block_hash_matches_outcome_hashed( + &mut self, + head_hash: &CryptoHash, + outcome_proof_block_hash: &CryptoHash, + ) -> BoolVariable { + self.is_equal(*head_hash, *outcome_proof_block_hash) + } + + fn verify_outcome( + &mut self, + expected: &CryptoHash, + outcome_proof: &MerklePath, + outcome_hash: &CryptoHash, + outcome_root_proof: &MerklePath, + ) -> BoolVariable { + let outcome_root = self.get_root_from_merkle_proof_hashed_leaf( + &outcome_proof.path, + &outcome_proof.indices, + *outcome_hash, + ); + let leaf = self.sha256(&outcome_root.0 .0); + + let outcome_root = self.get_root_from_merkle_proof_hashed_leaf( + &outcome_root_proof.path, + &outcome_root_proof.indices, + leaf, + ); + self.is_equal(outcome_root, *expected) + } + + fn verify_block( + &mut self, + expected: &CryptoHash, + block_proof: &MerklePath, + block_hash: &CryptoHash, + ) -> BoolVariable { + let block_root = self.get_root_from_merkle_proof_hashed_leaf( + &block_proof.path, + &block_proof.indices, + *block_hash, + ); + self.is_equal(block_root, *expected) + } + + fn assertx(&mut self, condition: BoolVariable) { + let t = self._true(); + self.assert_is_equal(condition, t); + } + + fn header_hash( + &mut self, + inner_lite: &HeaderInner, + inner_rest_hash: &CryptoHash, + prev_block_hash: &CryptoHash, + ) -> CryptoHash { + let inner_lite_hash = self.inner_lite_hash(&inner_lite); + + let inner = self.sha256_pair(inner_lite_hash, *inner_rest_hash); + let hash = self.sha256_pair(inner, *prev_block_hash); + hash + } + + fn inner_lite_hash(&mut self, inner_lite: &HeaderInner) -> CryptoHash { + let mut input_stream = VariableStream::new(); + input_stream.write(&inner_lite.height); + input_stream.write(&inner_lite.epoch_id); + input_stream.write(&inner_lite.next_epoch_id); + input_stream.write(&inner_lite.prev_state_root); + input_stream.write(&inner_lite.outcome_root); + input_stream.write(&inner_lite.timestamp); + input_stream.write(&inner_lite.timestamp_nanosec); + input_stream.write(&inner_lite.next_bp_hash); + input_stream.write(&inner_lite.block_merkle_root); + + let output_stream = self.hint(input_stream, InnerLiteHash::<40>); + let hash = output_stream.read::(self); + hash + } +} + +pub trait SyncCircuit, const D: usize> { + fn sync(&mut self, head: Header, epoch_bps: EpochBlockProducers, next_block: Block); + + fn reconstruct_approval_message(&mut self, next_block: &Block) -> CryptoHash; +} + +impl, const D: usize> SyncCircuit for CircuitBuilder { + fn sync(&mut self, head: Header, epoch_bps: EpochBlockProducers, next_block: Block) { + let mut c = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); + self.assertx(c); + + c = self.ensure_epoch_is_current_or_next(&head, &next_block.inner_lite.epoch_id); + self.assertx(c); + + c = self.ensure_if_next_epoch_contains_next_bps( + &head, + &next_block.inner_lite.epoch_id, + &next_block.next_bps, + ); + self.assertx(c); + + let approval = self.reconstruct_approval_message(&next_block); + + let stake = self.validate_signatures( + epoch_bps.active, + next_block.approvals_after_next, + epoch_bps.bps, + approval, + ); + + c = self.ensure_stake_is_sufficient(&stake); + self.assertx(c); + + // TODO: decide what to write here + // self.evm_write(new_head); + // self.evm_write(next_block.inner_lite.block_merkle_root); + } + + fn reconstruct_approval_message(&mut self, next_block: &Block) -> CryptoHash { + let next_header_hash = self.header_hash( + &next_block.inner_lite, + &next_block.inner_rest_hash, + &next_block.prev_block_hash, + ); + + let next_block_hash = self.sha256_pair(next_block.next_block_inner_hash, next_header_hash); + + let mut input_stream = VariableStream::new(); + input_stream.write(&next_block_hash); + input_stream.write(&next_block.inner_lite.height); + let output_stream = self.hint(input_stream, BuildEndorsement::<40>); // TODO: real sizes + let approval_message = output_stream.read::(self); + + approval_message + } +} + +pub trait VerifyCircuit, const D: usize> { + fn verify(&mut self, proof: Proof); +} + +impl, const D: usize> VerifyCircuit for CircuitBuilder { + fn verify(&mut self, proof: Proof) { + let block_hash = self.header_hash( + &proof.block_header.inner_lite, + &proof.block_header.inner_rest_hash, + &proof.block_header.prev_block_hash, + ); + + let mut c = self.is_equal(block_hash, proof.outcome_proof_block_hash); + self.assertx(c); + + c = self.verify_outcome( + &proof.block_header.inner_lite.outcome_root, + &proof.outcome_proof, + &proof.outcome_hash, + &proof.outcome_root_proof, + ); + self.assertx(c); + + c = self.verify_block(&proof.head_block_root, &proof.block_proof, &block_hash); + self.assertx(c); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_name() { + + } +} diff --git a/circuits/plonky2x/src/codec.rs b/circuits/plonky2x/src/codec.rs new file mode 100644 index 0000000..46472f1 --- /dev/null +++ b/circuits/plonky2x/src/codec.rs @@ -0,0 +1,105 @@ +use borsh::BorshSerialize; +use plonky2x::{ + frontend::{hint::simple::hint::Hint, uint::Uint}, + prelude::{ + ByteVariable, CircuitBuilder, CircuitVariable, PlonkParameters, U32Variable, U64Variable, + ValueStream, + }, +}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +struct BorshCodec; + +impl, const D: usize> Hint for BorshCodec { + fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { + todo!() + } +} + +// THis isnt quite right, we should probably implement borsh for generic types here but its +// annoying +pub trait Borsh: Sized { + fn encodeb, const D: usize>( + &self, + builder: &mut CircuitBuilder, + ) -> Vec; + fn decodeb, const D: usize>( + builder: &mut CircuitBuilder, + bytes: &[ByteVariable], + ) -> Self; +} + +// impl Borsh for U64Variable { +// fn encodeb, const D: usize>( +// &self, +// builder: &mut CircuitBuilder, +// ) -> Vec { +// let x = self.variables()[0]; +// builder.beacon_get_block_header(block_root) + // >::to_little_endian(&self, &mut vec![]); + // U64Target::from(self).encode(builder); + // self.limbs + // .iter() + // .rev() + // .flat_map(|x| x.encode(builder)) + // .collect::>() + //} + + // fn decodeb, const D: usize>( + // builder: &mut CircuitBuilder, + // bytes: &[ByteVariable], + // ) -> Self { + // assert_eq!(bytes.len(), 2 * 4); + // let mut limbs = [U32Variable::init_unsafe(builder); 2]; + // limbs[0].to_little_endian(&mut bytes[0..4]); + // U32Variable::from_variables(builder, variables) + // for i in 0..2 { + // limbs[i] = U32Variable::decodeb(builder, &bytes[i * 4..(i + 1) * 4]); + // } + // limbs.reverse(); + // Self { limbs } + // } +//} + +// fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { +// let mut bytes = vec![]; +// self.0.to_little_endian(&mut bytes); +// writer.write_all(&bytes) +// } +// +// fn deserialize(reader: &mut R) -> borsh::io::Result { +// let mut bytes = vec![]; +// reader.read_to_end(&mut bytes)?; +// Ok(Borshable(::from_little_endian(&bytes))) +// } +// +macro_rules! borsh_integer { + ($a:ident, $b:ty, $c:expr) => { + impl Borsh for $a { + fn encodeb, const D: usize>( + &self, + builder: &mut CircuitBuilder, + ) -> Vec { + self.limbs + .iter() + .rev() + .flat_map(|x| x.encode(builder)) + .collect::>() + } + + fn decodeb, const D: usize>( + builder: &mut CircuitBuilder, + bytes: &[ByteVariable], + ) -> Self { + assert_eq!(bytes.len(), $c * 4); + let mut limbs = [U32Variable::init_unsafe(builder); $c]; + for i in 0..$c { + limbs[i] = U32Variable::decodeb(builder, &bytes[i * 4..(i + 1) * 4]); + } + limbs.reverse(); + Self { limbs } + } + } + }; +} diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs new file mode 100644 index 0000000..a11dd1f --- /dev/null +++ b/circuits/plonky2x/src/lib.rs @@ -0,0 +1,39 @@ +use plonky2x::prelude::*; +use variables::{Block, EpochBlockProducers, Header, Proof}; + +mod builder; +mod codec; +mod variables; + +// TODO: +// hint/generator for any queries for things that are offchain/expensive to do in a circuit +// +// +#[derive(Debug)] +pub struct Circuit; + +// TODO: decide if to make validator set and other generics at trait level +// or stay in types +pub trait SyncCircuit, const D: usize> { + fn sync(&mut self, head: Header, epoch_bps: EpochBlockProducers, next_block: Block) -> Header; +} + +pub trait VerifyCircuit, const D: usize> { + fn verify(&mut self, proof: Proof) -> bool; +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_sync() { + // Read from aurora??? maybe + } + + #[test] + fn test_prove() {} + + #[test] + fn test_verify() {} +} diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs new file mode 100644 index 0000000..a45104a --- /dev/null +++ b/circuits/plonky2x/src/variables.rs @@ -0,0 +1,232 @@ +use crate::codec::{self, Borsh}; +use borsh::BorshSerialize; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; +use plonky2x::frontend::hint::simple::hint::Hint; +use plonky2x::frontend::{curta::ec::point::CompressedEdwardsYVariable, uint::Uint}; +use plonky2x::prelude::*; +use plonky2x::utils::hash::sha256; +use serde::{Deserialize, Serialize}; + +// TODO: if we use borsh here be careful of order +// TODO: ideally just use into conversions and expose protocol via types crate +// TODO: borsh? would need encoding for messages, make a hint +// TODO: optional variable +// TODO: sparse arrays for BPS, check tendermint, or we make own pub type entirely +// TODO: ecdsa sigs & keys +// TODO: get constrained numbers +// +// EVM write synced +// EVM write proof + +pub const MAX_ACCOUNT_ID_LEN: usize = 32; // TODO: get real number here +pub const MAX_EPOCH_VALIDATORS: usize = 128; // TODO: real number + +pub type CryptoHash = Bytes32Variable; +pub type BlockHeight = U64Variable; +pub type Balance = U64Variable; +pub type AccountId = BytesVariable; // TODO: likely an issue, implement the var here, or just use a u64, + // TODO: get depths of all proofs + +// TODO: maybe find a nicer way to do this +#[derive(CircuitVariable, Clone, Debug)] +pub struct EpochBlockProducers { + pub active: ArrayVariable, + pub bps: ArrayVariable, +} + +#[derive(CircuitVariable, Clone, Debug)] +pub struct MerklePath { + pub path: ArrayVariable, + pub indices: ArrayVariable, +} + +#[derive(CircuitVariable, Clone, Debug)] +pub struct Header { + pub prev_block_hash: CryptoHash, + pub inner_rest_hash: Bytes32Variable, + pub inner_lite: HeaderInner, + pub hash: CryptoHash, +} + +#[derive(CircuitVariable, Clone, Debug)] +pub struct HeaderInner { + pub height: U64Variable, + pub epoch_id: CryptoHash, + pub next_epoch_id: CryptoHash, + pub prev_state_root: CryptoHash, + pub outcome_root: CryptoHash, + /// Legacy json number. Should not be used. TODO: delete + pub timestamp: U64Variable, + pub timestamp_nanosec: U64Variable, + pub next_bp_hash: CryptoHash, + pub block_merkle_root: CryptoHash, +} + +// TODO: test this individually as i think they arent borsh encoded +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct InnerLiteHash; +impl, const D: usize, const N: usize> Hint for InnerLiteHash { + fn hint(&self, input_stream: &mut ValueStream, _output_stream: &mut ValueStream) { + let mut bytes: Vec = vec![]; + let height = input_stream.read_value::(); + let epoch_id = input_stream.read_value::(); + let next_epoch_id = input_stream.read_value::(); + let prev_state_root = input_stream.read_value::(); + let outcome_root = input_stream.read_value::(); + let timestamp = input_stream.read_value::(); + let timestamp_nanosec = input_stream.read_value::(); + let next_bp_hash = input_stream.read_value::(); + let block_merkle_root = input_stream.read_value::(); + + bytes.extend_from_slice(&height.to_le_bytes()); + bytes.extend_from_slice(&epoch_id.0); + bytes.extend_from_slice(&next_epoch_id.0); + bytes.extend_from_slice(&prev_state_root.0); + bytes.extend_from_slice(&outcome_root.0); + bytes.extend_from_slice(×tamp.to_le_bytes()); + bytes.extend_from_slice(×tamp_nanosec.to_le_bytes()); + bytes.extend_from_slice(&next_bp_hash.0); + bytes.extend_from_slice(&block_merkle_root.0); + } +} + +#[derive(CircuitVariable, Clone, Debug)] +pub struct Block { + pub prev_block_hash: CryptoHash, + pub next_block_inner_hash: CryptoHash, + pub inner_lite: HeaderInner, + pub inner_rest_hash: CryptoHash, + // TODO: sparse arrays for this and approvals + pub next_bps: EpochBlockProducers, + pub approvals_after_next: ArrayVariable, +} + +#[derive(CircuitVariable, Clone, Debug)] +pub struct ValidatorStake { + /// Account that stakes money. + pub account_id: AccountId, + /// Public key of the proposed validator. + pub public_key: PublicKey, + /// Stake / weight of the validator. + pub stake: Balance, +} + +// TODO: k256 ECDSA and manual enum impl for signatures and public keys +// #[derive( Clone, Debug)] +// enum PublicKey { +// Ed25519(CompressedEdwardsYVariable), +// } +pub type PublicKey = CompressedEdwardsYVariable; +pub type Signature = EDDSASignatureVariable; + +#[derive(CircuitVariable, Clone, Debug)] +pub struct Proof { + pub head_block_root: CryptoHash, + // TODO: make variable pub outcome_proof: ExecutionOutcomeWithId, + pub outcome_hash: CryptoHash, + pub outcome_proof_block_hash: CryptoHash, + pub outcome_proof: MerklePath<32>, // TODO: get real number here + pub outcome_root_proof: MerklePath<32>, // TODO: get real number here + pub block_header: Header, + pub block_proof: MerklePath<256>, // TODO: get real number here +} + +// TODO: likely these don't need to be constrained in the circuit so wont need to +// implement circuit variable for these, we blind these in the batch proofs anyway +// pub struct ExecutionOutcomeWithId { +// pub proof: MerklePath<32>, +// pub block_hash: CryptoHash, +// pub id: CryptoHash, +// pub outcome: ExecutionOutcome, +// } +// +// pub pub struct ExecutionOutcome { +// pub logs: Vec, +// pub receipt_ids: Vec, +// pub gas_burnt: U64Variable, +// pub tokens_burnt: Balance, +// pub executor_id: AccountId, +// pub status: ExecutionStatusView, +// pub metadata: ExecutionMetadataView, +// } + +#[derive(CircuitVariable, Clone, Debug)] +pub struct StakeInfo { + pub approved_stake: Balance, + pub total_stake: Balance, +} + +// #[derive(Clone, Debug, Serialize, Deserialize)] +// pub struct HeaderHash; +// +// impl, const D: usize, const N: usize> Hint for HeaderHash { +// fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { +// let inner_lite_hash = input_stream.read_value::(); +// let inner_rest_hash = input_stream.read_value::(); +// let prev_block_hash = input_stream.read_value::(); +// +// let next_block_hash = sh; +// output_stream.write_value::(next_block_hash); +// } +// } + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct BuildEndorsement; + +impl, const D: usize, const N: usize> Hint for BuildEndorsement { + fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { + let mut bytes = vec![]; + let next_block_hash = input_stream.read_value::(); + let next_block_height = input_stream.read_value::(); + + bytes.push(0u8); + bytes.extend_from_slice(&next_block_hash.as_bytes()); + bytes.extend_from_slice(&next_block_height.to_le_bytes()); + + assert_eq!(bytes.len(), N, "expected {} bytes, got {}", N, bytes.len()); + output_stream.write_value::>(bytes.try_into().unwrap()); + } +} +// impl BuildEndorsement { +// pub fn build( +// &self, +// builder: &mut CircuitBuilder, +// next_block_hash: CryptoHash, +// next_block_height: U64Variable, +// ) -> BytesVariable { +// let mut input_stream = VariableStream::new(); +// input_stream.write(&next_block_hash); +// input_stream.write(&next_block_height); +// +// let mut output_stream = VariableStream::new(); +// let hint = BuildEndorsement::; +// let output_stream = hint.hint(&mut input_stream, &mut output_stream); +// let next_header = output_stream.read::(self); +// Self +// } +// } + +#[cfg(test)] +mod tests { + use super::*; + use plonky2x::frontend::vars::EvmVariable; + + #[test] + fn test_encodepacked() { + let mut builder = DefaultBuilder::new(); + let mut pw = PartialWitness::new(); + let x1 = 10; + let x = builder.init::(); + + x.set(&mut pw, x1); + + assert_eq!(x.get(&pw), x1); + + println!("x1: {:?}", x1.to_le_bytes()); + println!("x: {:?}", x.encode(&mut builder)); + + let circuit = builder.build(); + let proof = circuit.data.prove(pw).unwrap(); + circuit.data.verify(proof).unwrap(); + } +} From 53d437a06c72c347f1d84faac4ff723c33ed8503 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 9 Jan 2024 15:23:25 +0000 Subject: [PATCH 05/67] build: upgrade near primitives and borsh --- Cargo.lock | 7667 ++++++++++++++++++++++++-------- Cargo.toml | 13 +- bin/client/Cargo.toml | 3 +- bin/client/src/client/store.rs | 33 +- circuits/plonky2x/Cargo.toml | 9 +- crates/protocol/Cargo.toml | 3 +- crates/protocol/src/lib.rs | 7 +- crates/protocol/src/prelude.rs | 2 +- rust-toolchain.toml | 4 +- 9 files changed, 5734 insertions(+), 2007 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e94481..7b1529c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "actix" version = "0.13.1" @@ -34,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -55,7 +65,27 @@ checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", +] + +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", ] [[package]] @@ -64,13 +94,24 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if 1.0.0", + "cipher 0.4.4", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", ] @@ -81,7 +122,8 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", + "const-random", "once_cell", "version_check", "zerocopy", @@ -204,6 +246,45 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "array-macro" +version = "2.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "220a2c618ab466efe41d0eace94dfeff1c35e3aa47891bdb95e1c0fefffd3c99" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + [[package]] name = "async-compression" version = "0.4.5" @@ -237,7 +318,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -248,7 +329,18 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version 0.4.0", ] [[package]] @@ -262,6 +354,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -372,6 +476,27 @@ dependencies = [ "tracing", ] +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -380,9 +505,45 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" @@ -396,6 +557,18 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake2" version = "0.9.2" @@ -408,12 +581,18 @@ dependencies = [ ] [[package]] -name = "block-buffer" -version = "0.9.0" +name = "blake3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" dependencies = [ - "generic-array", + "arrayref", + "arrayvec 0.5.2", + "cc", + "cfg-if 0.1.10", + "constant_time_eq", + "crypto-mac", + "digest 0.9.0", ] [[package]] @@ -422,37 +601,61 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] name = "borsh" -version = "0.10.3" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" dependencies = [ - "borsh-derive", - "hashbrown 0.13.2", + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + +[[package]] +name = "borsh" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +dependencies = [ + "borsh-derive 1.3.0", + "cfg_aliases", ] [[package]] name = "borsh-derive" -version = "0.10.3" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", - "proc-macro-crate", + "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", ] +[[package]] +name = "borsh-derive" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +dependencies = [ + "once_cell", + "proc-macro-crate 2.0.0", + "proc-macro2", + "quote", + "syn 2.0.48", + "syn_derive", +] + [[package]] name = "borsh-derive-internal" -version = "0.10.3" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ "proc-macro2", "quote", @@ -461,9 +664,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.10.3" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ "proc-macro2", "quote", @@ -497,12 +700,50 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "sha2", + "tinyvec", +] + [[package]] name = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -514,6 +755,9 @@ name = "bytes" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +dependencies = [ + "serde", +] [[package]] name = "bytesize" @@ -524,31 +768,97 @@ dependencies = [ "serde", ] +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "c2-chacha" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d27dae93fe7b1e0424dc57179ac396908c26b035a87234809f5c4dfd1b47dc80" dependencies = [ - "cipher", + "cipher 0.2.5", "ppv-lite86", ] +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.21", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ + "jobserver", "libc", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" version = "0.4.31" @@ -570,14 +880,24 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array", + "generic-array 0.14.7", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", ] [[package]] name = "clap" -version = "4.4.12" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" dependencies = [ "clap_builder", "clap_derive", @@ -585,9 +905,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" dependencies = [ "anstream", "anstyle", @@ -604,7 +924,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -613,6 +933,15 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "coerce" version = "0.8.10" @@ -638,17 +967,69 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "tokio", "tokio-stream", "tokio-util 0.7.10", "tracing", "utoipa", "utoipa-swagger-ui", - "uuid", + "uuid 1.6.1", "valuable", ] +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58 0.5.0", + "coins-core", + "digest 0.10.7", + "hmac", + "k256", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand 0.8.5", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.6", + "bech32", + "bs58 0.5.0", + "digest 0.10.7", + "generic-array 0.14.7", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2", + "sha3", + "thiserror", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -670,19 +1051,64 @@ dependencies = [ "rust-ini", "serde", "serde_json", - "toml", + "toml 0.5.11", "yaml-rust", ] [[package]] -name = "convert_case" -version = "0.4.0" +name = "const-hex" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "hex", + "proptest", + "serde", +] [[package]] -name = "core-foundation" -version = "0.9.4" +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-random" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.12", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ @@ -696,13 +1122,131 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b5bb9245ec7dcc04d03110e538d31f0969d301c9d673145f4b4d5c3478539a3" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb18d10e5ddac43ba4ca8fd4e310938569c3e484cc01b6372b27dc5bb4dfd28" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.3", + "log", + "regalloc2", + "smallvec", + "target-lexicon 0.12.13", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3ce6d22982c1b9b6b012654258bab1a13947bb12703518bef06b1a4867c3d6" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47220fd4f9a0ce23541652b6f16f83868d282602c600d14934b2a4c166b4bd80" + +[[package]] +name = "cranelift-control" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5a4c42672aea9b6e820046b52e47a1c05d3394a6cdf4cb3c3c4b702f954bd2" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b4e9a3296fc827f9d35135dc2c0c8dd8d8359eb1ef904bae2d55d5bcb0c9f94" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ec537d0f0b8e084517f3e7bfa1d89af343d7c7df455573fca9f272d4e01267" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon 0.12.13", +] + +[[package]] +name = "cranelift-isle" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45bab6d69919d210a50331d35cc6ce111567bc040aebac63a8ae130d0400a075" + +[[package]] +name = "cranelift-native" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "f32e81605f352cf37af5463f11cd7deec7b6572741931a8d372f7fdd4a744f5d" dependencies = [ + "cranelift-codegen", "libc", + "target-lexicon 0.12.13", +] + +[[package]] +name = "cranelift-wasm" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0edaa4cbec1bc787395c074233df2652dd62f3e29d3ee60329514a0a51e6b045" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.10.5", + "log", + "smallvec", + "wasmparser 0.115.0", + "wasmtime-types", ] [[package]] @@ -711,52 +1255,77 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] name = "crossbeam-channel" -version = "0.5.10" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", + "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", ] [[package]] -name = "crossbeam-utils" -version = "0.8.18" +name = "crossbeam-queue" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", + "crossbeam-utils", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array", + "generic-array 0.14.7", "typenum", ] @@ -766,23 +1335,68 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array", + "generic-array 0.14.7", "subtle", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher 0.4.4", +] + +[[package]] +name = "curta" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/curta.git#59e489d21622a92b25a2e4a5b710ce322f309b87" +dependencies = [ + "anyhow", + "bincode", + "curve25519-dalek", + "env_logger 0.9.3", + "hex", + "itertools 0.10.5", + "log", + "num", + "plonky2", + "plonky2_maybe_rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "serde", + "subtle-encoding", +] + [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if 1.0.0", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rand_core 0.6.4", + "rustc_version 0.4.0", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "darling" version = "0.20.3" @@ -804,7 +1418,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -815,7 +1429,32 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.46", + "syn 2.0.48", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid 1.6.1", +] + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -836,7 +1475,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] @@ -848,17 +1487,32 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn 1.0.109", ] +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -867,7 +1521,8 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -878,3185 +1533,6182 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ - "dirs-sys", + "dirs-sys 0.3.7", ] [[package]] -name = "dirs-sys" -version = "0.3.7" +name = "dirs" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "libc", - "redox_users", - "winapi", + "dirs-sys 0.4.1", ] [[package]] -name = "dlv-list" -version = "0.3.0" +name = "dirs-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] [[package]] -name = "easy-ext" -version = "0.2.9" +name = "dirs-sys" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53aff6fdc1b181225acdcb5b14c47106726fd8e486707315b1b138baed68ee31" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] [[package]] -name = "ed25519" -version = "1.5.3" +name = "dirs-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ - "signature", + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", ] [[package]] -name = "ed25519-dalek" -version = "1.0.1" +name = "dirs-sys-next" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ - "curve25519-dalek", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", + "libc", + "redox_users", + "winapi", ] [[package]] -name = "either" -version = "1.9.0" +name = "dissimilar" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -dependencies = [ - "serde", -] +checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" [[package]] -name = "encoding_rs" -version = "0.8.33" +name = "dlv-list" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" [[package]] -name = "endian-type" -version = "0.1.2" +name = "dotenv" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] -name = "enum-map" -version = "2.7.3" +name = "dunce" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" -dependencies = [ - "enum-map-derive", -] +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] -name = "enum-map-derive" -version = "0.17.0" +name = "dynasm" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" +checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" dependencies = [ + "bitflags 1.3.2", + "byteorder", + "lazy_static", + "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.46", + "syn 1.0.109", ] [[package]] -name = "env_logger" -version = "0.10.1" +name = "dynasm" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "33dc03612f42465a8ed7f5e354bc2b79ba54cedefa81d5bd3a064f1835adaba8" dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", + "bitflags 1.3.2", + "byteorder", + "lazy_static", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "equivalent" -version = "1.0.1" +name = "dynasmrt" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" +dependencies = [ + "byteorder", + "dynasm 1.2.3", + "memmap2", +] [[package]] -name = "errno" -version = "0.3.8" +name = "dynasmrt" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "f7dccc31a678058996aef614f6bd418ced384da70f284e83e2b7bf29b27b6a28" dependencies = [ - "libc", - "windows-sys 0.52.0", + "byteorder", + "dynasm 2.0.0", + "fnv", + "memmap2", ] [[package]] -name = "fastrand" -version = "2.0.1" +name = "easy-ext" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "53aff6fdc1b181225acdcb5b14c47106726fd8e486707315b1b138baed68ee31" [[package]] -name = "fixed-hash" -version = "0.7.0" +name = "ecdsa" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "static_assertions", + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", ] [[package]] -name = "fixedbitset" -version = "0.4.2" +name = "ed25519" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] [[package]] -name = "flate2" -version = "1.0.28" +name = "ed25519-dalek" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ - "crc32fast", - "miniz_oxide", + "curve25519-dalek", + "ed25519", + "rand_core 0.6.4", + "serde", + "sha2", + "subtle", + "zeroize", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "either" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +dependencies = [ + "serde", +] [[package]] -name = "foreign-types" -version = "0.3.2" +name = "elliptic-curve" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ - "foreign-types-shared", + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array 0.14.7", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "ena" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +dependencies = [ + "log", +] [[package]] -name = "form_urlencoded" -version = "1.2.1" +name = "encoding_rs" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "percent-encoding", + "cfg-if 1.0.0", ] [[package]] -name = "fs2" -version = "0.4.3" +name = "endian-type" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enr" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "libc", - "winapi", + "base64 0.21.6", + "bytes", + "hex", + "k256", + "log", + "rand 0.8.5", + "rlp", + "serde", + "sha3", + "zeroize", ] [[package]] -name = "futures" -version = "0.3.30" +name = "enum-map" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "enum-map-derive", ] [[package]] -name = "futures-channel" -version = "0.3.30" +name = "enum-map-derive" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ - "futures-core", - "futures-sink", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "futures-core" -version = "0.3.30" +name = "enumset" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" +dependencies = [ + "enumset_derive", +] [[package]] -name = "futures-executor" -version = "0.3.30" +name = "enumset_derive" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "darling", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "futures-io" -version = "0.3.30" +name = "env_logger" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] [[package]] -name = "futures-macro" -version = "0.3.30" +name = "env_logger" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", ] [[package]] -name = "futures-sink" -version = "0.3.30" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "futures-task" -version = "0.3.30" +name = "errno" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] [[package]] -name = "futures-util" -version = "0.3.30" +name = "errno" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "libc", + "windows-sys 0.52.0", ] [[package]] -name = "fxhash" -version = "0.2.1" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "byteorder", + "cc", + "libc", ] [[package]] -name = "generic-array" -version = "0.14.7" +name = "eth-keystore" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "typenum", - "version_check", + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand 0.8.5", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid 0.8.2", ] [[package]] -name = "getrandom" -version = "0.1.16" +name = "ethabi" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", ] [[package]] -name = "getrandom" -version = "0.2.11" +name = "ethbloom" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "crunchy", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", ] [[package]] -name = "h2" -version = "0.3.22" +name = "ethereum-types" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.11", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util 0.7.10", - "tracing", + "ethbloom", + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types 0.12.2", + "scale-info", + "uint", ] [[package]] -name = "h2" -version = "0.4.0" +name = "ethers" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a" +checksum = "1a5344eea9b20effb5efeaad29418215c4d27017639fd1f908260f59cbbd226e" dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 1.0.0", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util 0.7.10", - "tracing", + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "ethers-addressbook" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "8c405f24ea3a517899ba7985385c43dc4a7eb1209af3b1e0a1a32d7dcc7f8d09" dependencies = [ - "ahash 0.7.7", + "ethers-core", + "once_cell", + "serde", + "serde_json", ] [[package]] -name = "hashbrown" -version = "0.13.2" +name = "ethers-contract" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" dependencies = [ - "ahash 0.8.7", + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", ] [[package]] -name = "hashbrown" -version = "0.14.3" +name = "ethers-contract-abigen" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" dependencies = [ - "ahash 0.8.7", - "allocator-api2", + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.48", + "toml 0.8.8", + "walkdir", ] [[package]] -name = "hashring" -version = "0.3.3" +name = "ethers-contract-derive" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa283406d74fcfeb4778f4e300beaae30db96793371da168d003cbc833e149e0" +checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" dependencies = [ - "siphasher", + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.48", ] [[package]] -name = "heck" -version = "0.3.3" +name = "ethers-core" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" dependencies = [ - "unicode-segmentation", + "arrayvec 0.7.4", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array 0.14.7", + "k256", + "num_enum", + "once_cell", + "open-fastrlp", + "rand 0.8.5", + "rlp", + "serde", + "serde_json", + "strum 0.25.0", + "syn 2.0.48", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", ] [[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" +name = "ethers-etherscan" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" dependencies = [ - "libc", + "chrono", + "ethers-core", + "reqwest", + "semver 1.0.21", + "serde", + "serde_json", + "thiserror", + "tracing", ] [[package]] -name = "hermit-abi" -version = "0.3.3" +name = "ethers-middleware" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "681ece6eb1d10f7cf4f873059a77c04ff1de4f35c63dd7bccde8f438374fcb93" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] [[package]] -name = "hex" -version = "0.4.3" +name = "ethers-providers" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.6", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.11", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest", "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", ] [[package]] -name = "hmac" -version = "0.12.1" +name = "ethers-signers" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "0cb1b714e227bbd2d8c53528adb580b203009728b17d0d0e4119353aa9bc5532" dependencies = [ - "digest 0.10.7", + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand 0.8.5", + "sha2", + "thiserror", + "tracing", ] [[package]] -name = "home" -version = "0.5.9" +name = "ethers-solc" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "a64f710586d147864cff66540a6d64518b9ff37d73ef827fee430538265b595f" dependencies = [ - "windows-sys 0.52.0", + "cfg-if 1.0.0", + "const-hex", + "dirs 5.0.1", + "dunce", + "ethers-core", + "glob", + "home", + "md-5", + "num_cpus", + "once_cell", + "path-slash", + "rayon", + "regex", + "semver 1.0.21", + "serde", + "serde_json", + "solang-parser", + "svm-rs", + "thiserror", + "tiny-keccak", + "tokio", + "tracing", + "walkdir", + "yansi", ] [[package]] -name = "http" -version = "0.2.11" +name = "eyre" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" dependencies = [ - "bytes", - "fnv", - "itoa", + "indenter", + "once_cell", ] [[package]] -name = "http" -version = "1.0.0" +name = "fallible-iterator" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" -dependencies = [ - "bytes", - "fnv", - "itoa", -] +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] -name = "http-body" -version = "0.4.6" +name = "fastrand" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.11", - "pin-project-lite", -] +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] -name = "http-body" -version = "1.0.0" +name = "ff" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ - "bytes", - "http 1.0.0", + "bitvec", + "byteorder", + "ff_derive", + "rand_core 0.6.4", + "subtle", ] [[package]] -name = "http-body-util" -version = "0.1.0" +name = "ff_derive" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" dependencies = [ - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "pin-project-lite", + "addchain", + "cfg-if 1.0.0", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "httparse" -version = "1.8.0" +name = "fiat-crypto" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" [[package]] -name = "httpdate" -version = "1.0.3" +name = "finite-wasm" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "6d81b511929c2669eaf64e36471cf27c2508133e62ade9d49e608e8d675e7854" +dependencies = [ + "bitvec", + "dissimilar", + "num-traits", + "prefix-sum-vec", + "thiserror", + "wasm-encoder 0.27.0", + "wasmparser 0.105.0", + "wasmprinter", +] [[package]] -name = "humantime" -version = "2.1.0" +name = "fixed-hash" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "static_assertions", +] [[package]] -name = "hyper" -version = "0.14.28" +name = "fixed-hash" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.22", - "http 0.2.11", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.5", - "tokio", - "tower-service", - "tracing", - "want", + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", ] [[package]] -name = "hyper" -version = "1.1.0" +name = "fixedbitset" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2 0.4.0", - "http 1.0.0", - "http-body 1.0.0", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "tokio", -] +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] -name = "hyper-timeout" -version = "0.4.1" +name = "flate2" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ - "hyper 0.14.28", - "pin-project-lite", - "tokio", - "tokio-io-timeout", + "crc32fast", + "miniz_oxide", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.28", - "native-tls", - "tokio", - "tokio-native-tls", -] +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "hyper-util" -version = "0.1.2" +name = "foreign-types" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "hyper 1.1.0", - "pin-project-lite", - "socket2 0.5.5", - "tokio", - "tracing", + "foreign-types-shared", ] [[package]] -name = "iana-time-zone" -version = "0.1.59" +name = "foreign-types-shared" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", + "percent-encoding", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "fs2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ - "cc", + "libc", + "winapi", ] [[package]] -name = "ident_case" -version = "1.0.1" +name = "funty" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] -name = "idna" -version = "0.5.0" +name = "futures" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] -name = "indexmap" -version = "1.9.3" +name = "futures-channel" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", + "futures-core", + "futures-sink", ] [[package]] -name = "indexmap" -version = "2.1.0" +name = "futures-core" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", - "serde", -] +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] -name = "instant" -version = "0.1.12" +name = "futures-executor" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ - "cfg-if", + "futures-core", + "futures-task", + "futures-util", ] [[package]] -name = "ipnet" -version = "2.9.0" +name = "futures-io" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] -name = "is-terminal" -version = "0.4.10" +name = "futures-locks" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" dependencies = [ - "hermit-abi 0.3.3", - "rustix", - "windows-sys 0.52.0", + "futures-channel", + "futures-task", ] [[package]] -name = "itertools" -version = "0.10.5" +name = "futures-macro" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "either", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "itertools" -version = "0.12.0" +name = "futures-sink" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" -dependencies = [ - "either", -] +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] -name = "itoa" -version = "1.0.10" +name = "futures-task" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] -name = "js-sys" -version = "0.3.66" +name = "futures-timer" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" dependencies = [ - "wasm-bindgen", + "gloo-timers", + "send_wrapper 0.4.0", ] [[package]] -name = "json5" -version = "0.4.1" +name = "futures-util" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ - "pest", - "pest_derive", - "serde", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] -name = "json_comments" -version = "0.2.2" +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dbbfed4e59ba9750e15ba154fdfd9329cee16ff3df539c2666b70f58cc32105" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] [[package]] -name = "jwt" -version = "0.16.0" +name = "fxprof-processed-profile" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6204285f77fe7d9784db3fdc449ecce1a0114927a51d5a41c4c7a292011c015f" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "base64 0.13.1", - "crypto-common", - "digest 0.10.7", - "hmac", + "bitflags 2.4.1", + "debugid", + "fxhash", "serde", "serde_json", - "sha2 0.10.8", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "generic-array" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] [[package]] -name = "libc" -version = "0.2.151" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] [[package]] -name = "libredox" -version = "0.0.1" +name = "getrandom" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "bitflags 2.4.1", + "cfg-if 1.0.0", "libc", - "redox_syscall 0.4.1", + "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "linux-raw-sys" -version = "0.4.12" +name = "getrandom" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] [[package]] -name = "lock_api" -version = "0.4.11" +name = "gimli" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ - "autocfg", - "scopeguard", + "fallible-iterator", + "indexmap 2.1.0", + "stable_deref_trait", ] [[package]] -name = "log" -version = "0.4.20" +name = "glob" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] -name = "mach2" -version = "0.4.2" +name = "gloo-timers" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ - "libc", + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "matchers" -version = "0.1.0" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "regex-automata 0.1.10", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] -name = "matchit" -version = "0.7.3" +name = "h2" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "metrics" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ - "ahash 0.8.7", - "metrics-macros", - "portable-atomic", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.11", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util 0.7.10", + "tracing", ] [[package]] -name = "metrics-exporter-prometheus" -version = "0.12.2" +name = "h2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" +checksum = "991910e35c615d8cab86b5ab04be67e6ad24d2bf5f4f11fdbbed26da999bbeab" dependencies = [ - "base64 0.21.5", - "hyper 0.14.28", - "indexmap 1.9.3", - "ipnet", - "metrics", - "metrics-util", - "quanta", - "thiserror", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.0.0", + "indexmap 2.1.0", + "slab", "tokio", + "tokio-util 0.7.10", "tracing", ] [[package]] -name = "metrics-macros" -version = "0.7.1" +name = "hashbrown" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", + "ahash 0.7.7", ] [[package]] -name = "metrics-util" -version = "0.15.0" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111cb375987443c3de8d503580b536f77dc8416d32db62d9456db5d93bd7ac47" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "aho-corasick 0.7.20", - "crossbeam-epoch", - "crossbeam-utils", - "hashbrown 0.13.2", - "indexmap 1.9.3", - "metrics", - "num_cpus", - "ordered-float", - "quanta", - "radix_trie", - "sketches-ddsketch", + "ahash 0.7.7", ] [[package]] -name = "mime" -version = "0.3.17" +name = "hashbrown" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.7", +] [[package]] -name = "mime_guess" -version = "2.0.4" +name = "hashbrown" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "mime", - "unicase", + "ahash 0.8.7", + "allocator-api2", + "rayon", + "serde", ] [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "hashers" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] [[package]] -name = "miniz_oxide" -version = "0.7.1" +name = "hashring" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "aa283406d74fcfeb4778f4e300beaae30db96793371da168d003cbc833e149e0" dependencies = [ - "adler", + "siphasher", ] [[package]] -name = "mio" -version = "0.8.10" +name = "heck" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "unicode-segmentation", ] [[package]] -name = "multimap" -version = "0.8.3" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "native-tls" -version = "0.2.11" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "lazy_static", "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", ] [[package]] -name = "near-account-id" -version = "0.17.0" +name = "hermit-abi" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0cb40869cab7f5232f934f45db35bffe0f2d2a7cb0cd0346202fbe4ebf2dd7" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" dependencies = [ - "borsh", "serde", ] [[package]] -name = "near-chain-configs" -version = "0.17.0" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f9a1c805846237d56f99b328ba6ab77e5d43ef59aaaf8d2a41d42fdc708a7b" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "anyhow", - "chrono", - "derive_more", - "near-config-utils", - "near-crypto", - "near-o11y", - "near-primitives", - "num-rational", - "once_cell", - "serde", - "serde_json", - "sha2 0.10.8", - "smart-default", - "tracing", + "digest 0.10.7", ] [[package]] -name = "near-config-utils" -version = "0.17.0" +name = "home" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5523e7dce493c45bc3241eb3100d943ec471852f9b1f84b46a34789eadf17031" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "anyhow", - "json_comments", - "thiserror", - "tracing", + "windows-sys 0.52.0", ] [[package]] -name = "near-crypto" -version = "0.17.0" +name = "http" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6b382b626e7e0cd372d027c6672ac97b4b6ee6114288c9e58d8180b935d315" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ - "blake2", - "borsh", - "bs58", - "c2-chacha", - "curve25519-dalek", - "derive_more", - "ed25519-dalek", - "hex", - "near-account-id", - "near-config-utils", - "near-stdx", - "once_cell", - "primitive-types", - "rand 0.7.3", - "secp256k1", - "serde", - "serde_json", - "subtle", - "thiserror", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "near-fmt" -version = "0.17.0" +name = "http" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44c842c6cfcd9b8c387cccd4cd0619a5f21920cde5d5c292af3cc5d40510672" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" dependencies = [ - "near-primitives-core", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "near-jsonrpc-client" -version = "0.6.0" +name = "http-body" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "118f44c02ad211db805c1370ad3ff26576af6ff554093c9fece1b835d29d233a" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "borsh", - "lazy_static", - "log", - "near-chain-configs", - "near-crypto", - "near-jsonrpc-primitives", - "near-primitives", - "reqwest", - "serde", - "serde_json", - "thiserror", + "bytes", + "http 0.2.11", + "pin-project-lite", ] [[package]] -name = "near-jsonrpc-primitives" -version = "0.17.0" +name = "http-body" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b2934b5ab243e25e951c984525ba0aff0e719ed915c988c5195405aa0f6987" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ - "arbitrary", - "near-chain-configs", - "near-crypto", - "near-primitives", - "near-rpc-error-macro", - "serde", - "serde_json", - "thiserror", + "bytes", + "http 1.0.0", ] [[package]] -name = "near-light-client" -version = "0.2.0" +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.1", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.11", + "hyper 0.14.28", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper 0.14.28", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.28", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "hyper-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite", + "socket2", + "tokio", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.3", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is-terminal" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +dependencies = [ + "hermit-abi 0.3.3", + "rustix 0.38.28", + "windows-sys 0.52.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + +[[package]] +name = "json_comments" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dbbfed4e59ba9750e15ba154fdfd9329cee16ff3df539c2666b70f58cc32105" + +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.6", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "jwt" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6204285f77fe7d9784db3fdc449ecce1a0114927a51d5a41c4c7a292011c015f" +dependencies = [ + "base64 0.13.1", + "crypto-common", + "digest 0.10.7", + "hmac", + "serde", + "serde_json", + "sha2", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if 1.0.0", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851" +dependencies = [ + "primitive-types 0.10.1", + "tiny-keccak", +] + +[[package]] +name = "lalrpop" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" +dependencies = [ + "ascii-canvas", + "bit-set", + "diff", + "ena", + "is-terminal", + "itertools 0.10.5", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.7.5", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "loupe" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6a72dfa44fe15b5e76b94307eeb2ff995a8c5b283b55008940c02e0c5b634d" +dependencies = [ + "loupe-derive", + "rustversion", +] + +[[package]] +name = "loupe-derive" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if 1.0.0", + "digest 0.10.7", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.28", +] + +[[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metrics" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +dependencies = [ + "ahash 0.8.7", + "metrics-macros", + "portable-atomic", +] + +[[package]] +name = "metrics-exporter-prometheus" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" +dependencies = [ + "base64 0.21.6", + "hyper 0.14.28", + "indexmap 1.9.3", + "ipnet", + "metrics", + "metrics-util", + "quanta", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "metrics-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "metrics-util" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111cb375987443c3de8d503580b536f77dc8416d32db62d9456db5d93bd7ac47" +dependencies = [ + "aho-corasick 0.7.20", + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "metrics", + "num_cpus", + "ordered-float", + "quanta", + "radix_trie", + "sketches-ddsketch", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + +[[package]] +name = "more-asserts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "near-account-id" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35cbb989542587b47205e608324ddd391f0cee1c22b4b64ae49f458334b95907" +dependencies = [ + "borsh 1.3.0", + "serde", +] + +[[package]] +name = "near-chain-configs" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76b655beb5257d45071f6ba053cf73f851cc9855f2cf896a798112c651568f5d" +dependencies = [ + "anyhow", + "bytesize", + "chrono", + "derive_more", + "near-config-utils", + "near-crypto", + "near-parameters", + "near-primitives", + "num-rational 0.3.2", + "once_cell", + "serde", + "serde_json", + "sha2", + "smart-default", + "tracing", +] + +[[package]] +name = "near-config-utils" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b9c343b5e619b8b3a26c3c193fe9f62456c1d9972afd9fbcf9514a6d9aa6d4d" +dependencies = [ + "anyhow", + "json_comments", + "thiserror", + "tracing", +] + +[[package]] +name = "near-crypto" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bffdcef917385f1ef12c0ec21b3144d2c8788dbea1015d8fed838689dc093e5" +dependencies = [ + "blake2", + "borsh 1.3.0", + "bs58 0.4.0", + "c2-chacha", + "curve25519-dalek", + "derive_more", + "ed25519-dalek", + "hex", + "near-account-id", + "near-config-utils", + "near-stdx", + "once_cell", + "primitive-types 0.10.1", + "rand 0.7.3", + "secp256k1", + "serde", + "serde_json", + "subtle", + "thiserror", +] + +[[package]] +name = "near-fmt" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "657c2b640b2e4283f64d32abb46062ac5d2e6e7a066af689ed613da3f5b3ed27" +dependencies = [ + "near-primitives-core", +] + +[[package]] +name = "near-jsonrpc-client" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120ff206766c6bff62e919e3dcaf5c3a184a52ea072ad0947bb123768b65ece7" +dependencies = [ + "borsh 1.3.0", + "lazy_static", + "log", + "near-chain-configs", + "near-crypto", + "near-jsonrpc-primitives", + "near-primitives", + "reqwest", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "near-jsonrpc-primitives" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c247803e0ee0c66e879a717c36b16d4b10c6cfd888538929b7be862f89483330" +dependencies = [ + "arbitrary", + "near-chain-configs", + "near-crypto", + "near-primitives", + "near-rpc-error-macro", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "near-light-client" +version = "0.2.0" +dependencies = [ + "anyhow", + "async-trait", + "axum 0.7.3", + "borsh 1.3.0", + "coerce", + "config", + "either", + "futures", + "hex", + "itertools 0.12.0", + "log", + "near-crypto", + "near-jsonrpc-client", + "near-light-client-protocol", + "near-primitives", + "near-primitives-core", + "pretty_env_logger", + "protobuf 3.2.0", + "rand 0.8.5", + "reqwest", + "serde", + "serde_json", + "sled", + "thiserror", + "tokio", +] + +[[package]] +name = "near-light-client-circuits" +version = "0.1.0" +dependencies = [ + "borsh 1.3.0", + "ethers", + "plonky2", + "plonky2x", + "serde", +] + +[[package]] +name = "near-light-client-protocol" +version = "0.2.0" +dependencies = [ + "anyhow", + "borsh 1.3.0", + "either", + "hex", + "itertools 0.12.0", + "log", + "near-crypto", + "near-jsonrpc-primitives", + "near-primitives", + "near-primitives-core", + "pretty_env_logger", + "rand 0.8.5", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "near-o11y" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dd1e98a5d3ecd782dc59abe6341c30b4072e32b5b353a0073fe238fbb641a2a" +dependencies = [ + "actix", + "base64 0.21.6", + "clap", + "near-crypto", + "near-fmt", + "near-primitives-core", + "once_cell", + "opentelemetry", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions", + "prometheus", + "serde", + "serde_json", + "strum 0.24.1", + "thiserror", + "tokio", + "tracing", + "tracing-appender", + "tracing-opentelemetry", + "tracing-subscriber", +] + +[[package]] +name = "near-parameters" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df64b6d50fc466b960b08ae6f3f9100581e72252bf13f37c19e6e67a12bca6e9" +dependencies = [ + "assert_matches", + "borsh 1.3.0", + "enum-map", + "near-account-id", + "near-primitives-core", + "num-rational 0.3.2", + "serde", + "serde_repr", + "serde_yaml", + "strum 0.24.1", + "thiserror", +] + +[[package]] +name = "near-primitives" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44419e132fe6c2cda430dcb5935d9f2eba9505a69a6c641ffc76a37802c2f98d" +dependencies = [ + "arbitrary", + "base64 0.21.6", + "borsh 1.3.0", + "bytesize", + "cfg-if 1.0.0", + "chrono", + "derive_more", + "easy-ext", + "enum-map", + "hex", + "near-crypto", + "near-fmt", + "near-o11y", + "near-parameters", + "near-primitives-core", + "near-rpc-error-macro", + "near-stdx", + "near-vm-runner", + "num-rational 0.3.2", + "once_cell", + "primitive-types 0.10.1", + "rand 0.8.5", + "rand_chacha 0.3.1", + "reed-solomon-erasure", + "serde", + "serde_json", + "serde_with", + "serde_yaml", + "sha3", + "smart-default", + "strum 0.24.1", + "thiserror", + "time", + "tracing", +] + +[[package]] +name = "near-primitives-core" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99513c0a2b28e2bdf6998b8cc5a84eacfd54f0d2694bb40e19ac34a14c19d73c" +dependencies = [ + "arbitrary", + "base64 0.21.6", + "borsh 1.3.0", + "bs58 0.4.0", + "derive_more", + "enum-map", + "near-account-id", + "num-rational 0.3.2", + "serde", + "serde_repr", + "serde_with", + "sha2", + "strum 0.24.1", + "thiserror", +] + +[[package]] +name = "near-rpc-error-core" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31d5c61a12a22b5b7f841d5a3ecd4872be9ec515ef7ad05e89ed0f9de893622" +dependencies = [ + "quote", + "serde", + "syn 2.0.48", +] + +[[package]] +name = "near-rpc-error-macro" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cace511b9001dec586708b569383c237d7431de5a1b3a4e87292be463f1f53d" +dependencies = [ + "fs2", + "near-rpc-error-core", + "serde", + "syn 2.0.48", +] + +[[package]] +name = "near-stdx" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae2d331bd3597b4ed6b2e00b37b04231f37d1f8ba9a3fa1e8968a2345f68932" + +[[package]] +name = "near-vm-compiler" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81324e709188a02f2158fec445acfd0b366dae3a233cccdba00bb78276fe9b5a" +dependencies = [ + "enumset", + "finite-wasm", + "near-vm-types", + "near-vm-vm", + "rkyv", + "smallvec", + "target-lexicon 0.12.13", + "thiserror", + "tracing", + "wasmparser 0.99.0", +] + +[[package]] +name = "near-vm-compiler-singlepass" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67d400fde9b5dbd965d83d9986df7e631f4d86cdbd55dc5d4e5a32267f5554d0" +dependencies = [ + "dynasm 2.0.0", + "dynasmrt 2.0.0", + "enumset", + "finite-wasm", + "lazy_static", + "memoffset 0.8.0", + "more-asserts", + "near-vm-compiler", + "near-vm-types", + "near-vm-vm", + "rayon", + "smallvec", + "strum 0.24.1", + "tracing", +] + +[[package]] +name = "near-vm-engine" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d48e0def5a51ff916a79eba9e37d24d1f6b8af0635c5c50026d34f4f3808704d" +dependencies = [ + "backtrace", + "cfg-if 1.0.0", + "crossbeam-queue", + "enumset", + "finite-wasm", + "lazy_static", + "memmap2", + "more-asserts", + "near-vm-compiler", + "near-vm-types", + "near-vm-vm", + "region", + "rkyv", + "rustc-demangle", + "rustix 0.37.27", + "target-lexicon 0.12.13", + "thiserror", + "tracing", +] + +[[package]] +name = "near-vm-runner" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ff5288c4ace5124e9e2a88bade90363ff4e348f4e1074b909e9f699a156793" +dependencies = [ + "anyhow", + "base64 0.21.6", + "borsh 1.3.0", + "ed25519-dalek", + "enum-map", + "finite-wasm", + "loupe", + "memoffset 0.8.0", + "near-crypto", + "near-parameters", + "near-primitives-core", + "near-stdx", + "near-vm-compiler", + "near-vm-compiler-singlepass", + "near-vm-engine", + "near-vm-types", + "near-vm-vm", + "num-rational 0.3.2", + "once_cell", + "parity-wasm 0.41.0", + "parity-wasm 0.42.2", + "prefix-sum-vec", + "pwasm-utils", + "ripemd", + "serde", + "serde_repr", + "serde_with", + "sha2", + "sha3", + "strum 0.24.1", + "thiserror", + "tracing", + "wasm-encoder 0.27.0", + "wasmer-compiler-near", + "wasmer-compiler-singlepass-near", + "wasmer-engine-near", + "wasmer-engine-universal-near", + "wasmer-runtime-core-near", + "wasmer-runtime-near", + "wasmer-types-near", + "wasmer-vm-near", + "wasmparser 0.78.2", + "wasmtime", + "zeropool-bn", +] + +[[package]] +name = "near-vm-types" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb41769aba6d16957b9766350fad7132965259bb0f612ae2f87cfabbafbec7d" +dependencies = [ + "indexmap 1.9.3", + "num-traits", + "rkyv", + "thiserror", +] + +[[package]] +name = "near-vm-vm" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6e1ab70baaf0e9348b1fdf93e3123a1ae7213b8247d57ff336eed951476015" +dependencies = [ + "backtrace", + "cc", + "cfg-if 1.0.0", + "finite-wasm", + "indexmap 1.9.3", + "libc", + "memoffset 0.8.0", + "more-asserts", + "near-vm-types", + "region", + "rkyv", + "thiserror", + "tracing", + "wasmparser 0.99.0", + "winapi", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "nix" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint 0.4.4", + "num-complex", + "num-integer", + "num-iter", + "num-rational 0.4.1", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint 0.4.4", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.3", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 3.0.0", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "crc32fast", + "hashbrown 0.14.3", + "indexmap 2.1.0", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec 0.7.4", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "openssl" +version = "0.10.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +dependencies = [ + "bitflags 2.4.1", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "opentelemetry" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a" +dependencies = [ + "async-trait", + "futures", + "futures-util", + "http 0.2.11", + "opentelemetry", + "prost", + "thiserror", + "tokio", + "tonic", + "tonic-build", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985cc35d832d412224b2cffe2f9194b1b89b6aa5d0bef76d080dce09d90e62bd" +dependencies = [ + "opentelemetry", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "3.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "page_size" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +dependencies = [ + "arrayvec 0.7.4", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +dependencies = [ + "proc-macro-crate 2.0.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parity-wasm" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" + +[[package]] +name = "parity-wasm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" + +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.3", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api 0.4.11", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api 0.4.11", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", + "hmac", + "password-hash", + "sha2", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "pest_meta" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.1.0", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version 0.4.0", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +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.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "platforms" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" + +[[package]] +name = "plonky2" +version = "0.1.4" +source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +dependencies = [ + "ahash 0.8.7", + "anyhow", + "getrandom 0.2.12", + "hashbrown 0.14.3", + "itertools 0.11.0", + "keccak-hash", + "log", + "num", + "plonky2_field", + "plonky2_maybe_rayon 0.1.1 (git+https://github.com/mir-protocol/plonky2.git)", + "plonky2_util", + "rand 0.8.5", + "rand_chacha 0.3.1", + "serde", + "serde_json", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_field" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +dependencies = [ + "anyhow", + "itertools 0.11.0", + "num", + "plonky2_util", + "rand 0.8.5", + "serde", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_maybe_rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194db0cbdd974e92d897cd92b74adb3968dc1b967315eb280357c49a7637994e" +dependencies = [ + "rayon", +] + +[[package]] +name = "plonky2_maybe_rayon" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +dependencies = [ + "rayon", +] + +[[package]] +name = "plonky2_util" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" + +[[package]] +name = "plonky2x" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/succinctx.git#9d59459e62a43103c310d77b1155df0fe61a174f" +dependencies = [ + "anyhow", + "array-macro", + "async-trait", + "backtrace", + "base64 0.13.1", + "bincode", + "clap", + "curta", + "curve25519-dalek", + "digest 0.10.7", + "dotenv", + "ed25519-dalek", + "env_logger 0.10.1", + "ethers", + "ff", + "futures", + "hex", + "itertools 0.10.5", + "lazy_static", + "log", + "num", + "num-bigint 0.4.4", + "plonky2", + "plonky2x-derive", + "rand 0.8.5", + "reqwest", + "serde", + "serde_json", + "serde_plain", + "serde_with", + "sha2", + "sha256", + "tokio", + "tracing", + "uuid 1.6.1", +] + +[[package]] +name = "plonky2x-derive" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/succinctx.git#9d59459e62a43103c310d77b1155df0fe61a174f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prefix-sum-vec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa06bd51638b6e76ac9ba9b6afb4164fa647bd2916d722f2623fbb6d1ed8bdba" + +[[package]] +name = "pretty_env_logger" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" +dependencies = [ + "env_logger 0.10.1", + "log", +] + +[[package]] +name = "prettyplease" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +dependencies = [ + "proc-macro2", + "syn 2.0.48", +] + +[[package]] +name = "primitive-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +dependencies = [ + "fixed-hash 0.7.0", + "uint", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash 0.8.0", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml 0.5.11", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + +[[package]] +name = "proc-macro-crate" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" +dependencies = [ + "toml_edit 0.21.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prometheus" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +dependencies = [ + "cfg-if 1.0.0", + "fnv", + "lazy_static", + "memchr", + "parking_lot 0.12.1", + "protobuf 2.28.0", + "thiserror", +] + +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bitflags 2.4.1", + "lazy_static", + "num-traits", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rand_xorshift", + "regex-syntax 0.8.2", + "unarray", +] + +[[package]] +name = "prost" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +dependencies = [ + "bytes", + "heck 0.3.3", + "itertools 0.10.5", + "lazy_static", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "regex", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +dependencies = [ + "bytes", + "prost", +] + +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + +[[package]] +name = "protobuf" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-support" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +dependencies = [ + "thiserror", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pwasm-utils" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" +dependencies = [ + "byteorder", + "log", + "parity-wasm 0.41.0", +] + +[[package]] +name = "quanta" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +dependencies = [ + "crossbeam-utils", + "libc", + "mach2", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.12", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "raw-cpuid" +version = "10.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ - "anyhow", - "async-trait", - "axum 0.7.3", - "coerce", - "config", "either", - "futures", - "hex", - "itertools 0.12.0", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +dependencies = [ + "getrandom 0.2.12", + "libredox", + "thiserror", +] + +[[package]] +name = "reed-solomon-erasure" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" +dependencies = [ + "smallvec", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", "log", - "near-crypto", - "near-jsonrpc-client", - "near-light-client-protocol", - "near-primitives", - "near-primitives-core", - "pretty_env_logger", - "protobuf 3.2.0", - "rand 0.8.5", - "reqwest", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick 1.1.2", + "memchr", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick 1.1.2", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "region" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" +dependencies = [ + "bitflags 1.3.2", + "libc", + "mach", + "winapi", +] + +[[package]] +name = "rend" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "reqwest" +version = "0.11.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +dependencies = [ + "async-compression", + "base64 0.21.6", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", "serde", "serde_json", - "sled", - "thiserror", + "serde_urlencoded", + "system-configuration", "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util 0.7.10", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + +[[package]] +name = "ring" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom 0.2.12", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.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 = "rkyv" +version = "0.7.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid 1.6.1", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "near-light-client-protocol" -version = "0.2.0" +name = "ron" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" dependencies = [ - "anyhow", - "either", - "hex", - "itertools 0.12.0", - "log", - "near-crypto", - "near-jsonrpc-primitives", - "near-primitives", - "near-primitives-core", - "pretty_env_logger", - "rand 0.7.3", + "base64 0.13.1", + "bitflags 1.3.2", "serde", - "serde_json", - "thiserror", ] [[package]] -name = "near-o11y" -version = "0.17.0" +name = "rust-embed" +version = "6.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7d35397b02b131c188c72f3885e97daeccab134ec2fc8cc0073a94cf1cfe19" +checksum = "a36224c3276f8c4ebc8c20f158eca7ca4359c8db89991c4925132aaaf6702661" dependencies = [ - "actix", - "atty", - "clap", - "near-crypto", - "near-primitives-core", - "once_cell", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry-semantic-conventions", - "prometheus", - "serde", - "strum", - "thiserror", - "tokio", - "tracing", - "tracing-appender", - "tracing-opentelemetry", - "tracing-subscriber", + "rust-embed-impl", + "rust-embed-utils", + "walkdir", ] [[package]] -name = "near-primitives" -version = "0.17.0" +name = "rust-embed-impl" +version = "6.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f7051aaf199adc4d068620fca6d5f70f906a1540d03a8bb3701271f8881835" +checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" dependencies = [ - "arbitrary", - "borsh", - "bytesize", - "cfg-if", - "chrono", - "derive_more", - "easy-ext", - "enum-map", - "hex", - "near-crypto", - "near-fmt", - "near-primitives-core", - "near-rpc-error-macro", - "near-stdx", - "near-vm-errors", - "num-rational", - "once_cell", - "primitive-types", - "rand 0.8.5", - "reed-solomon-erasure", - "serde", - "serde_json", - "serde_with", - "serde_yaml", - "smart-default", - "strum", - "thiserror", - "time", - "tracing", + "proc-macro2", + "quote", + "rust-embed-utils", + "shellexpand", + "syn 2.0.48", + "walkdir", ] [[package]] -name = "near-primitives-core" -version = "0.17.0" +name = "rust-embed-utils" +version = "7.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775fec19ef51a341abdbf792a9dda5b4cb89f488f681b2fd689b9321d24db47b" +checksum = "9d38ff6bf570dc3bb7100fce9f7b60c33fa71d80e88da3f2580df4ff2bdded74" dependencies = [ - "arbitrary", - "base64 0.21.5", - "borsh", - "bs58", - "derive_more", - "enum-map", - "near-account-id", - "num-rational", - "serde", - "serde_repr", - "serde_with", - "sha2 0.10.8", - "strum", - "thiserror", + "sha2", + "walkdir", ] [[package]] -name = "near-rpc-error-core" -version = "0.17.0" +name = "rust-ini" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c1eda300e2e78f4f945ae58117d49e806899f4a51ee2faa09eda5ebc2e6571" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" dependencies = [ - "quote", - "serde", - "syn 2.0.46", + "cfg-if 1.0.0", + "ordered-multimap", ] [[package]] -name = "near-rpc-error-macro" -version = "0.17.0" +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d2dadd765101c77e664029dd6fbec090e696877d4ae903c620d02ceda4969a" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "fs2", - "near-rpc-error-core", - "serde", - "syn 2.0.46", + "semver 0.9.0", ] [[package]] -name = "near-stdx" -version = "0.17.0" +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.21", +] + +[[package]] +name = "rustix" +version = "0.37.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6540152fba5e96fe5d575b79e8cd244cf2add747bb01362426bdc069bc3a23bc" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno 0.3.8", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] [[package]] -name = "near-vm-errors" -version = "0.17.0" +name = "rustix" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec545d1bede0579e7c15dd2dce9b998dc975c52f2165702ff40bec7ff69728bb" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "borsh", - "near-account-id", - "near-rpc-error-macro", - "serde", - "strum", - "thiserror", + "bitflags 2.4.1", + "errno 0.3.8", + "libc", + "linux-raw-sys 0.4.12", + "windows-sys 0.52.0", ] [[package]] -name = "nibble_vec" -version = "0.1.0" +name = "rustls" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ - "smallvec", + "log", + "ring 0.17.7", + "rustls-webpki", + "sct", ] [[package]] -name = "nom" -version = "7.1.3" +name = "rustls-pemfile" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "memchr", - "minimal-lexical", + "base64 0.21.6", ] [[package]] -name = "nu-ansi-term" -version = "0.46.0" +name = "rustls-webpki" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "overload", - "winapi", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] -name = "num-bigint" -version = "0.3.3" +name = "rustversion" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "cipher 0.4.4", ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "same-file" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "autocfg", - "num-traits", + "winapi-util", ] [[package]] -name = "num-rational" -version = "0.3.2" +name = "scale-info" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", - "serde", + "cfg-if 1.0.0", + "derive_more", + "parity-scale-codec", + "scale-info-derive", ] [[package]] -name = "num-traits" -version = "0.2.17" +name = "scale-info-derive" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ - "autocfg", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "num_cpus" -version = "1.16.0" +name = "schannel" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "hermit-abi 0.3.3", - "libc", + "windows-sys 0.52.0", ] [[package]] -name = "once_cell" -version = "1.19.0" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "opaque-debug" -version = "0.3.0" +name = "scrypt" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2", +] [[package]] -name = "openssl" -version = "0.10.62" +name = "sct" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] -name = "openssl-macros" -version = "0.1.1" +name = "seahash" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", + "base16ct", + "der", + "generic-array 0.14.7", + "pkcs8", + "subtle", + "zeroize", ] [[package]] -name = "openssl-probe" -version = "0.1.5" +name = "secp256k1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +dependencies = [ + "rand 0.8.5", + "secp256k1-sys", +] [[package]] -name = "openssl-sys" -version = "0.9.98" +name = "secp256k1-sys" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" dependencies = [ "cc", - "libc", - "pkg-config", - "vcpkg", ] [[package]] -name = "opentelemetry" -version = "0.17.0" +name = "security-framework" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "js-sys", - "lazy_static", - "percent-encoding", - "pin-project", - "rand 0.8.5", - "thiserror", - "tokio", - "tokio-stream", + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", ] [[package]] -name = "opentelemetry-otlp" -version = "0.10.0" +name = "security-framework-sys" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ - "async-trait", - "futures", - "futures-util", - "http 0.2.11", - "opentelemetry", - "prost", - "thiserror", - "tokio", - "tonic", - "tonic-build", + "core-foundation-sys", + "libc", ] [[package]] -name = "opentelemetry-semantic-conventions" +name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985cc35d832d412224b2cffe2f9194b1b89b6aa5d0bef76d080dce09d90e62bd" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "opentelemetry", + "semver-parser", ] [[package]] -name = "ordered-float" -version = "3.9.2" +name = "semver" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ - "num-traits", + "serde", ] [[package]] -name = "ordered-multimap" -version = "0.4.3" +name = "semver-parser" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" -dependencies = [ - "dlv-list", - "hashbrown 0.12.3", -] +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] -name = "overload" -version = "0.1.1" +name = "send_wrapper" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] -name = "parking_lot" -version = "0.11.2" +name = "send_wrapper" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] -name = "parking_lot" -version = "0.12.1" +name = "serde" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ - "lock_api", - "parking_lot_core 0.9.9", + "serde_derive", ] [[package]] -name = "parking_lot_core" -version = "0.8.6" +name = "serde-bench" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +checksum = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "byteorder", + "serde", ] [[package]] -name = "parking_lot_core" -version = "0.9.9" +name = "serde_bytes" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.4.1", - "smallvec", - "windows-targets 0.48.5", + "serde", ] [[package]] -name = "pathdiff" -version = "0.2.1" +name = "serde_derive" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] [[package]] -name = "percent-encoding" -version = "2.3.1" +name = "serde_json" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +dependencies = [ + "itoa", + "ryu", + "serde", +] [[package]] -name = "pest" -version = "2.7.5" +name = "serde_path_to_error" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" dependencies = [ - "memchr", - "thiserror", - "ucd-trie", + "itoa", + "serde", ] [[package]] -name = "pest_derive" -version = "2.7.5" +name = "serde_plain" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" dependencies = [ - "pest", - "pest_generator", + "serde", ] [[package]] -name = "pest_generator" -version = "2.7.5" +name = "serde_repr" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ - "pest", - "pest_meta", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] -name = "pest_meta" -version = "2.7.5" +name = "serde_spanned" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ - "once_cell", - "pest", - "sha2 0.10.8", + "serde", ] [[package]] -name = "petgraph" -version = "0.6.4" +name = "serde_urlencoded" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ - "fixedbitset", - "indexmap 2.1.0", + "form_urlencoded", + "itoa", + "ryu", + "serde", ] [[package]] -name = "pin-project" -version = "1.1.3" +name = "serde_with" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ - "pin-project-internal", + "base64 0.21.6", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.1.0", + "serde", + "serde_json", + "serde_with_macros", + "time", ] [[package]] -name = "pin-project-internal" -version = "1.1.3" +name = "serde_with_macros" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" dependencies = [ + "darling", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.28" +name = "serde_yaml" +version = "0.9.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +dependencies = [ + "indexmap 2.1.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] [[package]] -name = "portable-atomic" -version = "1.6.0" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] [[package]] -name = "powerfmt" -version = "0.2.0" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "sha256" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "18278f6a914fa3070aa316493f7d2ddfb9ac86ebc06fa3b83bffda487e9065b0" +dependencies = [ + "async-trait", + "bytes", + "hex", + "sha2", + "tokio", +] [[package]] -name = "pretty_env_logger" -version = "0.5.0" +name = "sha3" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "env_logger", - "log", + "digest 0.10.7", + "keccak", ] [[package]] -name = "primitive-types" -version = "0.10.1" +name = "sharded-slab" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ - "fixed-hash", - "uint", + "lazy_static", ] [[package]] -name = "proc-macro-crate" -version = "0.1.5" +name = "shellexpand" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" dependencies = [ - "toml", + "dirs 4.0.0", ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "signal-hook-registry" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", + "libc", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "signature" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "proc-macro2", - "quote", - "version_check", + "digest 0.10.7", + "rand_core 0.6.4", ] [[package]] -name = "proc-macro2" -version = "1.0.74" +name = "simdutf8" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" -dependencies = [ - "unicode-ident", -] +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] -name = "prometheus" -version = "0.13.3" +name = "simple_asn1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ - "cfg-if", - "fnv", - "lazy_static", - "memchr", - "parking_lot 0.12.1", - "protobuf 2.28.0", + "num-bigint 0.4.4", + "num-traits", "thiserror", + "time", ] [[package]] -name = "prost" -version = "0.9.0" +name = "siphasher" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes", - "prost-derive", -] +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] -name = "prost-build" -version = "0.9.0" +name = "sketches-ddsketch" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" -dependencies = [ - "bytes", - "heck 0.3.3", - "itertools 0.10.5", - "lazy_static", - "log", - "multimap", - "petgraph", - "prost", - "prost-types", - "regex", - "tempfile", - "which", -] +checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" [[package]] -name = "prost-derive" -version = "0.9.0" +name = "slab" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 1.0.109", + "autocfg", ] [[package]] -name = "prost-types" -version = "0.9.0" +name = "sled" +version = "0.34.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" dependencies = [ - "bytes", - "prost", + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot 0.11.2", ] [[package]] -name = "protobuf" -version = "2.28.0" +name = "slice-group-by" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] -name = "protobuf" -version = "3.2.0" +name = "smallvec" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" -dependencies = [ - "once_cell", - "protobuf-support", - "thiserror", -] +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] -name = "protobuf-support" -version = "3.2.0" +name = "smart-default" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" dependencies = [ - "thiserror", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "quanta" -version = "0.11.1" +name = "socket2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ - "crossbeam-utils", "libc", - "mach2", - "once_cell", - "raw-cpuid", - "wasi 0.11.0+wasi-snapshot-preview1", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] -name = "quote" -version = "1.0.35" +name = "solang-parser" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" dependencies = [ - "proc-macro2", + "itertools 0.11.0", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror", + "unicode-xid", ] [[package]] -name = "radix_trie" -version = "0.2.1" +name = "spin" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" -dependencies = [ - "endian-type", - "nibble_vec", -] +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "rand" +name = "spin" +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 = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", + "base64ct", + "der", ] [[package]] -name = "rand" -version = "0.8.5" +name = "sptr" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" [[package]] -name = "rand_chacha" -version = "0.2.2" +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "new_debug_unreachable", + "once_cell", + "parking_lot 0.12.1", + "phf_shared 0.10.0", + "precomputed-hash", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "strsim" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", + "strum_macros 0.24.3", ] [[package]] -name = "rand_core" -version = "0.5.1" +name = "strum" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "getrandom 0.1.16", + "strum_macros 0.25.3", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "strum_macros" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "getrandom 0.2.11", + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", ] [[package]] -name = "rand_hc" -version = "0.2.0" +name = "strum_macros" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "rand_core 0.5.1", + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.48", ] [[package]] -name = "raw-cpuid" -version = "10.7.0" +name = "subtle" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "subtle-encoding" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" dependencies = [ - "bitflags 1.3.2", + "zeroize", ] [[package]] -name = "redox_syscall" -version = "0.2.16" +name = "svm-rs" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "20689c7d03b6461b502d0b95d6c24874c7d24dea2688af80486a130a06af3b07" dependencies = [ - "bitflags 1.3.2", + "dirs 5.0.1", + "fs2", + "hex", + "once_cell", + "reqwest", + "semver 1.0.21", + "serde", + "serde_json", + "sha2", + "thiserror", + "url", + "zip", ] [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "syn" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "bitflags 1.3.2", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "redox_users" -version = "0.4.4" +name = "syn" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ - "getrandom 0.2.11", - "libredox", - "thiserror", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "reed-solomon-erasure" -version = "4.0.2" +name = "syn_derive" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" dependencies = [ - "smallvec", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "regex" -version = "1.10.2" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick 1.1.2", - "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", -] +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -name = "regex-automata" -version = "0.1.10" +name = "system-configuration" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "regex-syntax 0.6.29", + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", ] [[package]] -name = "regex-automata" -version = "0.4.3" +name = "system-configuration-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ - "aho-corasick 1.1.2", - "memchr", - "regex-syntax 0.8.2", + "core-foundation-sys", + "libc", ] [[package]] -name = "regex-syntax" -version = "0.6.29" +name = "tap" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "regex-syntax" -version = "0.8.2" +name = "target-lexicon" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] -name = "reqwest" -version = "0.11.23" +name = "target-lexicon" +version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" -dependencies = [ - "async-compression", - "base64 0.21.5", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.3.22", - "http 0.2.11", - "http-body 0.4.6", - "hyper 0.14.28", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", - "tokio", - "tokio-native-tls", - "tokio-util 0.7.10", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] +checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] -name = "ron" -version = "0.7.1" +name = "tempfile" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ - "base64 0.13.1", - "bitflags 1.3.2", - "serde", + "cfg-if 1.0.0", + "fastrand", + "redox_syscall 0.4.1", + "rustix 0.38.28", + "windows-sys 0.52.0", ] [[package]] -name = "rust-embed" -version = "6.8.1" +name = "term" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a36224c3276f8c4ebc8c20f158eca7ca4359c8db89991c4925132aaaf6702661" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", + "dirs-next", + "rustversion", + "winapi", ] [[package]] -name = "rust-embed-impl" -version = "6.8.1" +name = "termcolor" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "shellexpand", - "syn 2.0.46", - "walkdir", + "winapi-util", ] [[package]] -name = "rust-embed-utils" -version = "7.8.1" +name = "thiserror" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d38ff6bf570dc3bb7100fce9f7b60c33fa71d80e88da3f2580df4ff2bdded74" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ - "sha2 0.10.8", - "walkdir", + "thiserror-impl", ] [[package]] -name = "rust-ini" -version = "0.18.0" +name = "thiserror-impl" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ - "cfg-if", - "ordered-multimap", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "rustc_version" -version = "0.4.0" +name = "thread_local" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "semver", + "cfg-if 1.0.0", + "once_cell", ] [[package]] -name = "rustix" -version = "0.38.28" +name = "time" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", ] [[package]] -name = "rustversion" -version = "1.0.14" +name = "time-core" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] -name = "ryu" -version = "1.0.16" +name = "time-macros" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] [[package]] -name = "same-file" -version = "1.0.6" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" dependencies = [ - "winapi-util", + "crunchy", ] [[package]] -name = "schannel" -version = "0.1.23" +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ - "windows-sys 0.52.0", + "tinyvec_macros", ] [[package]] -name = "scopeguard" -version = "1.2.0" +name = "tinyvec_macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "secp256k1" -version = "0.27.0" +name = "tokio" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ - "rand 0.8.5", - "secp256k1-sys", + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", ] [[package]] -name = "secp256k1-sys" -version = "0.8.1" +name = "tokio-io-timeout" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "cc", + "pin-project-lite", + "tokio", ] [[package]] -name = "security-framework" -version = "2.9.2" +name = "tokio-macros" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "security-framework-sys" -version = "2.9.1" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ - "core-foundation-sys", - "libc", + "native-tls", + "tokio", ] [[package]] -name = "semver" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" - -[[package]] -name = "serde" -version = "1.0.194" +name = "tokio-rustls" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "serde_derive", + "rustls", + "tokio", ] [[package]] -name = "serde_derive" -version = "1.0.194" +name = "tokio-stream" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", + "futures-core", + "pin-project-lite", + "tokio", ] [[package]] -name = "serde_json" -version = "1.0.110" +name = "tokio-tungstenite" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fbd975230bada99c8bb618e0c365c2eefa219158d5c6c29610fd09ff1833257" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ - "itoa", - "ryu", - "serde", + "futures-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots", ] [[package]] -name = "serde_path_to_error" -version = "0.1.15" +name = "tokio-util" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" dependencies = [ - "itoa", - "serde", + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", ] [[package]] -name = "serde_repr" -version = "0.1.18" +name = "tokio-util" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "futures-util", + "hashbrown 0.14.3", + "pin-project-lite", + "slab", + "tokio", + "tracing", ] [[package]] -name = "serde_urlencoded" -version = "0.7.1" +name = "toml" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "form_urlencoded", - "itoa", - "ryu", "serde", ] [[package]] -name = "serde_with" -version = "3.4.0" +name = "toml" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ - "base64 0.21.5", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.1.0", "serde", - "serde_json", - "serde_with_macros", - "time", + "serde_spanned", + "toml_datetime", + "toml_edit 0.21.0", ] [[package]] -name = "serde_with_macros" -version = "3.4.0" +name = "toml_datetime" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.46", + "serde", ] [[package]] -name = "serde_yaml" -version = "0.9.30" +name = "toml_edit" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.1.0", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", + "toml_datetime", + "winnow", ] [[package]] -name = "sha2" -version = "0.9.9" +name = "toml_edit" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", + "indexmap 2.1.0", + "toml_datetime", + "winnow", ] [[package]] -name = "sha2" -version = "0.10.8" +name = "toml_edit" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] -name = "sharded-slab" -version = "0.1.7" +name = "tonic" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" dependencies = [ - "lazy_static", + "async-stream", + "async-trait", + "base64 0.13.1", + "bytes", + "futures-core", + "futures-util", + "h2 0.3.22", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", ] [[package]] -name = "shellexpand" -version = "2.1.2" +name = "tonic-build" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757" dependencies = [ - "dirs", + "proc-macro2", + "prost-build", + "quote", + "syn 1.0.109", ] [[package]] -name = "signal-hook-registry" -version = "1.4.1" +name = "tower" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ - "libc", + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand 0.8.5", + "slab", + "tokio", + "tokio-util 0.7.10", + "tower-layer", + "tower-service", + "tracing", ] [[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - -[[package]] -name = "siphasher" -version = "0.3.11" +name = "tower-layer" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] -name = "sketches-ddsketch" -version = "0.2.1" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] -name = "slab" -version = "0.4.9" +name = "tracing" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "autocfg", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", ] [[package]] -name = "sled" -version = "0.34.7" +name = "tracing-appender" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" dependencies = [ - "crc32fast", - "crossbeam-epoch", - "crossbeam-utils", - "fs2", - "fxhash", - "libc", - "log", - "parking_lot 0.11.2", + "crossbeam-channel", + "thiserror", + "time", + "tracing-subscriber", ] [[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "smart-default" -version = "0.6.0" +name = "tracing-attributes" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] -name = "socket2" -version = "0.4.10" +name = "tracing-core" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "libc", - "winapi", + "once_cell", + "valuable", ] [[package]] -name = "socket2" -version = "0.5.5" +name = "tracing-futures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "libc", - "windows-sys 0.48.0", + "pin-project", + "tracing", ] [[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.10.0" +name = "tracing-log" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] [[package]] -name = "strum" -version = "0.24.1" +name = "tracing-log" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "strum_macros", + "log", + "once_cell", + "tracing-core", ] [[package]] -name = "strum_macros" -version = "0.24.3" +name = "tracing-opentelemetry" +version = "0.17.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", + "once_cell", + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log 0.1.4", + "tracing-subscriber", ] [[package]] -name = "subtle" -version = "2.5.0" +name = "tracing-subscriber" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log 0.2.0", +] [[package]] -name = "syn" -version = "1.0.109" +name = "try-lock" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "syn" -version = "2.0.46" +name = "tungstenite" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "byteorder", + "bytes", + "data-encoding", + "http 0.2.11", + "httparse", + "log", + "rand 0.8.5", + "rustls", + "sha1", + "thiserror", + "url", + "utf-8", ] [[package]] -name = "sync_wrapper" -version = "0.1.2" +name = "typenum" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] -name = "system-configuration" -version = "0.5.1" +name = "ucd-trie" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] -name = "system-configuration-sys" -version = "0.5.0" +name = "uint" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" dependencies = [ - "core-foundation-sys", - "libc", + "byteorder", + "crunchy", + "hex", + "static_assertions", ] [[package]] -name = "tempfile" -version = "3.9.0" +name = "unarray" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.4.1", - "rustix", - "windows-sys 0.52.0", -] +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] -name = "termcolor" -version = "1.4.0" +name = "unicase" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ - "winapi-util", + "version_check", ] [[package]] -name = "thiserror" -version = "1.0.56" +name = "unicode-bidi" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] -name = "thiserror-impl" -version = "1.0.56" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", -] +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] -name = "thread_local" -version = "1.1.7" +name = "unicode-normalization" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ - "cfg-if", - "once_cell", + "tinyvec", ] [[package]] -name = "time" -version = "0.3.31" +name = "unicode-segmentation" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" -dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] -name = "time-core" -version = "0.1.2" +name = "unicode-xid" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] -name = "time-macros" -version = "0.2.16" +name = "unroll" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "5ad948c1cb799b1a70f836077721a92a35ac177d4daddf4c20a633786d4cf618" dependencies = [ - "time-core", + "quote", + "syn 1.0.109", ] [[package]] -name = "tinyvec" -version = "1.6.0" +name = "unsafe-libyaml" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] +checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" [[package]] -name = "tinyvec_macros" -version = "0.1.1" +name = "untrusted" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] -name = "tokio" -version = "1.28.2" +name = "untrusted" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" -dependencies = [ - "autocfg", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot 0.12.1", - "pin-project-lite", - "signal-hook-registry", - "socket2 0.4.10", - "tokio-macros", - "windows-sys 0.48.0", -] +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] -name = "tokio-io-timeout" -version = "1.2.0" +name = "url" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ - "pin-project-lite", - "tokio", + "form_urlencoded", + "idna", + "percent-encoding", ] [[package]] -name = "tokio-macros" -version = "2.1.0" +name = "utf-8" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", -] +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "utf8parse" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "utoipa" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82b1bc5417102a73e8464c686eef947bdfb99fcdfc0a4f228e81afa9526470a" dependencies = [ - "native-tls", - "tokio", + "indexmap 2.1.0", + "serde", + "serde_json", + "utoipa-gen", ] [[package]] -name = "tokio-stream" -version = "0.1.14" +name = "utoipa-gen" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "05d96dcd6fc96f3df9b3280ef480770af1b7c5d14bc55192baa9b067976d920c" dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", + "proc-macro-error", + "proc-macro2", + "quote", + "regex", + "syn 2.0.48", ] [[package]] -name = "tokio-util" -version = "0.6.10" +name = "utoipa-swagger-ui" +version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +checksum = "84614caa239fb25b2bb373a52859ffd94605ceb256eeb1d63436325cf81e3653" dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", + "axum 0.6.20", + "mime_guess", + "regex", + "rust-embed", + "serde", + "serde_json", + "utoipa", + "zip", ] [[package]] -name = "tokio-util" -version = "0.7.10" +name = "uuid" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "bytes", - "futures-core", - "futures-io", - "futures-sink", - "futures-util", - "hashbrown 0.14.3", - "pin-project-lite", - "slab", - "tokio", - "tracing", + "getrandom 0.2.12", + "serde", ] [[package]] -name = "toml" -version = "0.5.11" +name = "uuid" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ + "getrandom 0.2.12", "serde", ] [[package]] -name = "tonic" -version = "0.6.2" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" dependencies = [ - "async-stream", - "async-trait", - "base64 0.13.1", - "bytes", - "futures-core", - "futures-util", - "h2 0.3.22", - "http 0.2.11", - "http-body 0.4.6", - "hyper 0.14.28", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "prost-derive", - "tokio", - "tokio-stream", - "tokio-util 0.6.10", - "tower", - "tower-layer", - "tower-service", - "tracing", - "tracing-futures", + "valuable-derive", ] [[package]] -name = "tonic-build" -version = "0.6.2" +name = "valuable-derive" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757" +checksum = "9d44690c645190cfce32f91a1582281654b2338c6073fa250b0949fd25c55b32" dependencies = [ "proc-macro2", - "prost-build", "quote", "syn 1.0.109", ] [[package]] -name = "tower" -version = "0.4.13" +name = "vcpkg" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand 0.8.5", - "slab", - "tokio", - "tokio-util 0.7.10", - "tower-layer", - "tower-service", - "tracing", -] +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] -name = "tower-layer" -version = "0.3.2" +name = "version_check" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "tower-service" -version = "0.3.2" +name = "void" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] -name = "tracing" -version = "0.1.40" +name = "walkdir" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", + "same-file", + "winapi-util", ] [[package]] -name = "tracing-appender" -version = "0.2.3" +name = "want" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "crossbeam-channel", - "thiserror", - "time", - "tracing-subscriber", + "try-lock", ] [[package]] -name = "tracing-attributes" -version = "0.1.27" +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ + "bumpalo", + "log", + "once_cell", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", + "wasm-bindgen-shared", ] [[package]] -name = "tracing-core" -version = "0.1.32" +name = "wasm-bindgen-futures" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ - "once_cell", - "valuable", + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "tracing-futures" -version = "0.2.5" +name = "wasm-bindgen-macro" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ - "pin-project", - "tracing", + "quote", + "wasm-bindgen-macro-support", ] [[package]] -name = "tracing-log" -version = "0.1.4" +name = "wasm-bindgen-macro-support" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ - "log", - "once_cell", - "tracing-core", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] -name = "tracing-log" -version = "0.2.0" +name = "wasm-bindgen-shared" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "wasm-encoder" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77053dc709db790691d3732cfc458adc5acc881dec524965c608effdcd9c581" dependencies = [ - "log", - "once_cell", - "tracing-core", + "leb128", ] [[package]] -name = "tracing-opentelemetry" -version = "0.17.4" +name = "wasm-encoder" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +checksum = "9ca90ba1b5b0a70d3d49473c5579951f3bddc78d47b59256d2f9d4922b150aca" dependencies = [ - "once_cell", - "opentelemetry", - "tracing", - "tracing-core", - "tracing-log 0.1.4", - "tracing-subscriber", + "leb128", ] [[package]] -name = "tracing-subscriber" -version = "0.3.18" +name = "wasmer-compiler-near" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "46fdae7245128f284476e6db9653ef0a15b011975091bcd7f9d7303132409662" dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", + "enumset", + "rkyv", "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log 0.2.0", + "target-lexicon 0.12.13", + "thiserror", + "wasmer-types-near", + "wasmer-vm-near", + "wasmparser 0.78.2", ] [[package]] -name = "try-lock" -version = "0.2.5" +name = "wasmer-compiler-singlepass-near" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +checksum = "ac4af0e438015585eb27b2c6f6869c58c540bfe27408b686b1778470bf301050" +dependencies = [ + "byteorder", + "dynasm 1.2.3", + "dynasmrt 1.2.3", + "lazy_static", + "memoffset 0.6.5", + "more-asserts", + "rayon", + "smallvec", + "wasmer-compiler-near", + "wasmer-types-near", + "wasmer-vm-near", +] [[package]] -name = "typenum" -version = "1.17.0" +name = "wasmer-engine-near" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "4048411cabb2c94c7d8d11d9d0282cc6b15308b61ebc1e122c40e89865ebb5c5" +dependencies = [ + "backtrace", + "enumset", + "lazy_static", + "memmap2", + "more-asserts", + "rustc-demangle", + "target-lexicon 0.12.13", + "thiserror", + "wasmer-compiler-near", + "wasmer-types-near", + "wasmer-vm-near", +] [[package]] -name = "ucd-trie" -version = "0.1.6" +name = "wasmer-engine-universal-near" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "c5f31c3d2850ac7957406d3c9581d9435ea8126a26478709fa7e931b6f562b4d" +dependencies = [ + "cfg-if 1.0.0", + "enumset", + "leb128", + "region", + "rkyv", + "thiserror", + "wasmer-compiler-near", + "wasmer-engine-near", + "wasmer-types-near", + "wasmer-vm-near", + "winapi", +] [[package]] -name = "uint" -version = "0.9.5" +name = "wasmer-runtime-core-near" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +checksum = "5a3fac37da3c625e98708c5dd92d3f642aaf700fd077168d3d0fff277ec6a165" dependencies = [ - "byteorder", - "crunchy", + "bincode", + "blake3", + "borsh 0.9.3", + "cc", + "digest 0.8.1", + "errno 0.2.8", "hex", - "static_assertions", + "indexmap 1.9.3", + "lazy_static", + "libc", + "nix", + "page_size", + "parking_lot 0.10.2", + "rustc_version 0.2.3", + "serde", + "serde-bench", + "serde_bytes", + "serde_derive", + "smallvec", + "target-lexicon 0.10.0", + "wasmparser 0.51.4", + "winapi", ] -[[package]] -name = "unicase" -version = "2.7.0" +[[package]] +name = "wasmer-runtime-near" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +checksum = "158e6fff11e5e1ef805af50637374d5bd43d92017beafa18992cdf7f3f7ae3e4" dependencies = [ - "version_check", + "lazy_static", + "memmap", + "serde", + "serde_derive", + "wasmer-runtime-core-near", + "wasmer-singlepass-backend-near", ] [[package]] -name = "unicode-bidi" -version = "0.3.14" +name = "wasmer-singlepass-backend-near" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "5f6edd0ba6c0bcf9b279186d4dbe81649dda3e5ef38f586865943de4dcd653f8" +dependencies = [ + "bincode", + "borsh 0.9.3", + "byteorder", + "dynasm 1.2.3", + "dynasmrt 1.2.3", + "lazy_static", + "libc", + "nix", + "serde", + "serde_derive", + "smallvec", + "wasmer-runtime-core-near", +] [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "wasmer-types-near" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "1ba154adffb0fbd33f5dabd3788a1744d846b43e6e090d44269c7ee8fa5743e4" +dependencies = [ + "indexmap 1.9.3", + "rkyv", + "thiserror", +] [[package]] -name = "unicode-normalization" -version = "0.1.22" +name = "wasmer-vm-near" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "70a5585596f6e9915d606de944aece51626736fb1191aefb5b2ef108c6f7604a" dependencies = [ - "tinyvec", + "backtrace", + "cc", + "cfg-if 1.0.0", + "indexmap 1.9.3", + "libc", + "memoffset 0.6.5", + "more-asserts", + "region", + "rkyv", + "thiserror", + "wasmer-types-near", + "winapi", ] [[package]] -name = "unicode-segmentation" -version = "1.10.1" +name = "wasmparser" +version = "0.51.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" [[package]] -name = "unsafe-libyaml" -version = "0.2.10" +name = "wasmparser" +version = "0.78.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65" [[package]] -name = "url" -version = "2.5.0" +name = "wasmparser" +version = "0.99.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "9ef3b717afc67f848f412d4f02c127dd3e35a0eecd58c684580414df4fde01d3" dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", + "indexmap 1.9.3", + "url", ] [[package]] -name = "utf8parse" -version = "0.2.1" +name = "wasmparser" +version = "0.105.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "83be9e0b3f9570dc1979a33ae7b89d032c73211564232b99976553e5c155ec32" +dependencies = [ + "indexmap 1.9.3", + "url", +] [[package]] -name = "utoipa" -version = "3.5.0" +name = "wasmparser" +version = "0.115.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82b1bc5417102a73e8464c686eef947bdfb99fcdfc0a4f228e81afa9526470a" +checksum = "e06c0641a4add879ba71ccb3a1e4278fd546f76f1eafb21d8f7b07733b547cd5" dependencies = [ "indexmap 2.1.0", - "serde", - "serde_json", - "utoipa-gen", + "semver 1.0.21", ] [[package]] -name = "utoipa-gen" -version = "3.5.0" +name = "wasmprinter" +version = "0.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d96dcd6fc96f3df9b3280ef480770af1b7c5d14bc55192baa9b067976d920c" +checksum = "50b0e5ed7a74a065637f0d7798ce5f29cadb064980d24b0c82af5200122fa0d8" dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "regex", - "syn 2.0.46", + "anyhow", + "wasmparser 0.105.0", ] [[package]] -name = "utoipa-swagger-ui" -version = "3.1.5" +name = "wasmtime" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84614caa239fb25b2bb373a52859ffd94605ceb256eeb1d63436325cf81e3653" +checksum = "ca54f6090ce46973f33a79f265924b204f248f91aec09229bce53d19d567c1a6" dependencies = [ - "axum 0.6.20", - "mime_guess", - "regex", - "rust-embed", + "anyhow", + "bincode", + "bumpalo", + "cfg-if 1.0.0", + "fxprof-processed-profile", + "indexmap 2.1.0", + "libc", + "log", + "object", + "once_cell", + "paste", + "psm", "serde", + "serde_derive", "serde_json", - "utoipa", - "zip", + "target-lexicon 0.12.13", + "wasm-encoder 0.35.0", + "wasmparser 0.115.0", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.48.0", ] [[package]] -name = "uuid" -version = "1.6.1" +name = "wasmtime-asm-macros" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "54984bc0b5689da87a43d7c181d23092b4d5cfcbb7ae3eb6b917dd55865d95e6" dependencies = [ - "getrandom 0.2.11", - "serde", + "cfg-if 1.0.0", ] [[package]] -name = "valuable" -version = "0.1.0" +name = "wasmtime-cranelift" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "1cf3cee8be02f5006d21b773ffd6802f96a0b7d661ff2ad8a01fb93df458b1aa" dependencies = [ - "valuable-derive", + "anyhow", + "cfg-if 1.0.0", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon 0.12.13", + "thiserror", + "wasmparser 0.115.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "wasmtime-versioned-export-macros", ] [[package]] -name = "valuable-derive" -version = "0.1.0" +name = "wasmtime-cranelift-shared" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d44690c645190cfce32f91a1582281654b2338c6073fa250b0949fd25c55b32" +checksum = "420fd2a69bc162957f4c94f21c7fa08ecf60d916f4e87b56332507c555da381d" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-native", + "gimli", + "object", + "target-lexicon 0.12.13", + "wasmtime-environ", ] [[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.4.0" +name = "wasmtime-environ" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "fb6a445ce2b2810127caee6c1b79b8da4ae57712b05556a674592c18b7500a14" dependencies = [ - "same-file", - "winapi-util", + "anyhow", + "cranelift-entity", + "gimli", + "indexmap 2.1.0", + "log", + "object", + "serde", + "serde_derive", + "target-lexicon 0.12.13", + "thiserror", + "wasmparser 0.115.0", + "wasmtime-types", ] [[package]] -name = "want" -version = "0.3.1" +name = "wasmtime-jit" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +checksum = "1f0f6586c61125fbfc13c3108c3dd565d21f314dd5bac823b9a5b7ab576d21f1" dependencies = [ - "try-lock", + "addr2line", + "anyhow", + "bincode", + "cfg-if 1.0.0", + "cpp_demangle", + "gimli", + "log", + "object", + "rustc-demangle", + "rustix 0.38.28", + "serde", + "serde_derive", + "target-lexicon 0.12.13", + "wasmtime-environ", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.48.0", ] [[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.89" +name = "wasmtime-jit-debug" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "109a9e46afe33580b952b14a4207354355f19bcdf0b47485b397b68409eaf553" dependencies = [ - "cfg-if", - "wasm-bindgen-macro", + "once_cell", + "wasmtime-versioned-export-macros", ] [[package]] -name = "wasm-bindgen-backend" -version = "0.2.89" +name = "wasmtime-jit-icache-coherence" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "f67e6be36375c39cff57ed3b137ab691afbf2d9ba8ee1c01f77888413f218749" dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.46", - "wasm-bindgen-shared", + "cfg-if 1.0.0", + "libc", + "windows-sys 0.48.0", ] [[package]] -name = "wasm-bindgen-futures" -version = "0.4.39" +name = "wasmtime-runtime" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "1d07986b2327b5e7f535ed638fbde25990fc8f85400194fda0d26db71c7b685e" dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", + "anyhow", + "cc", + "cfg-if 1.0.0", + "indexmap 2.1.0", + "libc", + "log", + "mach", + "memfd", + "memoffset 0.9.0", + "paste", + "rand 0.8.5", + "rustix 0.38.28", + "sptr", + "wasm-encoder 0.35.0", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", + "windows-sys 0.48.0", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.89" +name = "wasmtime-types" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "e810a0d2e869abd1cb42bd232990f6bd211672b3d202d2ae7e70ffb97ed70ea3" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "cranelift-entity", + "serde", + "serde_derive", + "thiserror", + "wasmparser 0.115.0", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.89" +name = "wasmtime-versioned-export-macros" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "09b5575a75e711ca6c36bb9ad647c93541cdc8e34218031acba5da3f35919dd3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "syn 2.0.48", ] [[package]] -name = "wasm-bindgen-shared" -version = "0.2.89" +name = "wasmtime-wmemcheck" +version = "14.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "9dafab2db172a53e23940e0fa3078c202f567ee5f13f4b42f66b694fab43c658" [[package]] name = "web-sys" @@ -4068,6 +7720,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" + [[package]] name = "which" version = "4.4.2" @@ -4077,7 +7735,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.28", ] [[package]] @@ -4252,16 +7910,53 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +[[package]] +name = "winnow" +version = "0.5.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "windows-sys 0.48.0", ] +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version 0.4.0", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "yaml-rust" version = "0.4.5" @@ -4271,6 +7966,12 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "zerocopy" version = "0.7.32" @@ -4288,27 +7989,26 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.48", ] [[package]] name = "zeroize" -version = "1.3.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" -dependencies = [ - "zeroize_derive", -] +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" [[package]] -name = "zeroize_derive" -version = "1.4.2" +name = "zeropool-bn" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.46", + "byteorder", + "crunchy", + "lazy_static", + "rand 0.8.5", + "rustc-hex", ] [[package]] @@ -4317,8 +8017,45 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" dependencies = [ + "aes", "byteorder", + "bzip2", + "constant_time_eq", "crc32fast", "crossbeam-utils", "flate2", + "hmac", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index b5a461a..e792002 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ license = "MIT" version = "0.2.0" [workspace] -members = [ "bin/*", "crates/*" ] +members = [ "bin/*", "crates/*", "circuits/*" ] resolver = "2" [workspace.dependencies] @@ -20,6 +20,7 @@ thiserror = "1.0" # Async axum = "*" +borsh = "1.3" coerce = { version = "0.8", features = [ "full" ] } futures = "0.3" reqwest = { version = "0.11", features = [ "gzip", "brotli", "deflate", "json" ] } @@ -33,8 +34,8 @@ serde_json = "1.0" # TODO: upgrade # Near specific -near-crypto = "0.17" -near-jsonrpc-client = "0.6" -near-jsonrpc-primitives = "0.17" -near-primitives = "0.17" -near-primitives-core = "0.17" +near-crypto = "0.19" +near-jsonrpc-client = "0.7" +near-jsonrpc-primitives = "0.19" +near-primitives = "0.19" +near-primitives-core = "0.19" diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml index b9fec5c..678d34c 100644 --- a/bin/client/Cargo.toml +++ b/bin/client/Cargo.toml @@ -8,6 +8,7 @@ version.workspace = true anyhow.workspace = true async-trait.workspace = true axum.workspace = true +borsh.workspace = true coerce.workspace = true config.workspace = true either.workspace = true @@ -21,13 +22,13 @@ near-primitives-core.workspace = true near-primitives.workspace = true pretty_env_logger.workspace = true protobuf.workspace = true +protocol = { path = "../../crates/protocol", package = "near-light-client-protocol" } reqwest.workspace = true serde.workspace = true serde_json.workspace = true sled.workspace = true thiserror.workspace = true tokio.workspace = true -protocol = { path = "../../crates/protocol", package = "near-light-client-protocol" } [dev-dependencies] rand = "*" diff --git a/bin/client/src/client/store.rs b/bin/client/src/client/store.rs index 1bc3397..ef71065 100644 --- a/bin/client/src/client/store.rs +++ b/bin/client/src/client/store.rs @@ -94,22 +94,6 @@ pub trait DatabaseOperations { fn shutdown(&mut self); } -fn encode(x: &T) -> Result> { - x.try_to_vec().map_err(|e| { - let e = anyhow::format_err!("Failed to encode: {:?}", e); - log::error!("{:?}", e); - e - }) -} - -fn decode(x: &[u8]) -> Result { - T::try_from_slice(x).map_err(|e| { - let e = anyhow::format_err!("Failed to decode: {:?}", e); - log::error!("{:?}", e); - e - }) -} - pub fn head_key() -> CryptoHash { CryptoHash::default() } @@ -117,6 +101,7 @@ pub fn head_key() -> CryptoHash { pub mod sled { use super::*; use ::sled::{open, transaction::TransactionError, Batch, Db, Transactional, Tree}; + use borsh::ser::BorshSerialize as BorshSerializeExt; use itertools::Itertools; pub struct Store { @@ -162,7 +147,7 @@ pub mod sled { Collection::UsedRoots => self.used_roots.get(key), }? .ok_or_else(|| anyhow::anyhow!("Key not found")) - .and_then(|value| decode(&value)) + .and_then(|value| T::try_from_slice(&value).map_err(|e| anyhow::anyhow!(e))) } fn shutdown(&mut self) { @@ -228,8 +213,8 @@ pub mod sled { .map(|(k, v)| { log::debug!("Insert {:?}", k); log::trace!("Insert {:?}", v); - encode(k).and_then(|ek| { - encode(v).map(|ev| { + borsh::to_vec(k).and_then(|ek| { + borsh::to_vec(v).map(|ev| { let collection = match v { Entity::BlockProducers(_) => Collection::BlockProducers, Entity::Header(_) => Collection::Headers, @@ -247,15 +232,15 @@ pub mod sled { } fn get(&self, collection: &Collection, k: &CryptoHash) -> Result { - self.raw_get(collection, encode(k)?) + self.raw_get(collection, borsh::to_vec(k)?) } fn head(&self) -> Result
{ let head = self .headers - .get(encode(&head_key())?)? + .get(borsh::to_vec(&head_key())?)? .ok_or_else(|| anyhow::anyhow!("Failed to get head, no head in store"))?; - let h: Entity = decode(&head)?; + let h: Entity = borsh::from_slice(&head)?; h.header() } @@ -264,7 +249,7 @@ pub mod sled { } fn contains(&self, collection: &Collection, k: &CryptoHash) -> Result { - self.raw_contains(collection, encode(k)?) + self.raw_contains(collection, borsh::to_vec(k)?) } } @@ -278,7 +263,7 @@ pub mod sled { .and_then(|ov| u32::try_from_slice(&ov).ok()) .unwrap_or_else(|| 0); log::debug!("Incrementing ref count for {:?}, {}", key, ref_count); - (ref_count + 1).try_to_vec().ok() + borsh::to_vec(&(ref_count + 1)).ok() } #[cfg(test)] mod tests { diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index d7a23cd..4f092ea 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -6,12 +6,13 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -borsh = "1.3" -serde = { version = "1.0", features = ["derive"] } +borsh = "1.3" +ethers = "2.0.11" +serde = { version = "1.0", features = [ "derive" ] } # Circuits plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } -[workspace] -members = [] +# [workspace] +# members = [] diff --git a/crates/protocol/Cargo.toml b/crates/protocol/Cargo.toml index ea53a1b..6daf0ac 100644 --- a/crates/protocol/Cargo.toml +++ b/crates/protocol/Cargo.toml @@ -6,7 +6,9 @@ version.workspace = true [dependencies] anyhow.workspace = true +borsh.workspace = true either.workspace = true +itertools.workspace = true log.workspace = true near-crypto.workspace = true near-jsonrpc-primitives.workspace = true @@ -14,7 +16,6 @@ near-primitives-core.workspace = true near-primitives.workspace = true serde.workspace = true thiserror.workspace = true -itertools.workspace = true # async-trait.workspace = true # axum.workspace = true diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 3594ab2..cb2d936 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -180,7 +180,8 @@ impl Protocol { let approval_message = { let mut temp_vec = Vec::new(); - temp_vec.extend_from_slice(&(endorsement.try_to_vec().ok()?[..])); + BorshSerialize::serialize(&endorsement, &mut temp_vec).ok()?; + //temp_vec.extend_from_slice(&(endorsement.try_to_vec().ok()?[..])); temp_vec.extend_from_slice(&((block_view.inner_lite.height + 2).to_le_bytes()[..])); temp_vec }; @@ -227,7 +228,7 @@ impl Protocol { } pub fn validate_signatures( - signatures: &[Option], + signatures: &[Option>], epoch_bps: &[ValidatorStake], approval_message: &[u8], ) -> StakeInfo { @@ -252,7 +253,7 @@ impl Protocol { fn validate_signature( msg: &[u8], - sig: &Option, + sig: &Option>, pk: &PublicKey, ) -> Result<(), Error> { match sig { diff --git a/crates/protocol/src/prelude.rs b/crates/protocol/src/prelude.rs index 3db7fb5..b11e9d6 100644 --- a/crates/protocol/src/prelude.rs +++ b/crates/protocol/src/prelude.rs @@ -1,7 +1,7 @@ pub use anyhow::anyhow; pub use anyhow::Result; pub use log::{debug, error, info, trace, warn}; -pub use near_primitives::borsh::{self, BorshDeserialize, BorshSerialize}; +pub use near_primitives_core::borsh::{self, BorshDeserialize, BorshSerialize}; pub use near_primitives_core::hash::CryptoHash; pub use serde::{Deserialize, Serialize}; pub use itertools::Itertools; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 037198b..3b35aa6 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,5 +2,5 @@ # This specifies the version of Rust we use to build. # Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`. # The version specified below, should be at least as high as the maximum `rust-version` within the workspace. -channel = "1.75.0" -components = [ "rustfmt", "clippy"] +channel = "nightly" +components = [ "rustfmt", "clippy" ] From e174830e2536189c713a4c2ed78a4e83abee868f Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 9 Jan 2024 16:27:21 +0000 Subject: [PATCH 06/67] wip: testing --- Cargo.lock | 2 + circuits/plonky2x/Cargo.toml | 10 ++- circuits/plonky2x/src/builder.rs | 113 +++++++++++++++++++++++++++- circuits/plonky2x/src/variables.rs | 7 +- crates/protocol/src/experimental.rs | 7 +- crates/protocol/src/lib.rs | 11 ++- 6 files changed, 137 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b1529c..6bb832b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3698,9 +3698,11 @@ version = "0.1.0" dependencies = [ "borsh 1.3.0", "ethers", + "near-light-client-protocol", "plonky2", "plonky2x", "serde", + "serde_json", ] [[package]] diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index 4f092ea..d1f0daa 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -6,13 +6,17 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -borsh = "1.3" -ethers = "2.0.11" -serde = { version = "1.0", features = [ "derive" ] } +borsh.workspace = true +ethers = "2.0.11" +serde.workspace = true # Circuits plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } +[dev-dependencies] +near-light-client-protocol = { path = "../../crates/protocol" } +serde_json.workspace = true + # [workspace] # members = [] diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 67c13e7..9e87988 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -321,7 +321,7 @@ impl, const D: usize> SyncCircuit for CircuitBuilder let mut input_stream = VariableStream::new(); input_stream.write(&next_block_hash); input_stream.write(&next_block.inner_lite.height); - let output_stream = self.hint(input_stream, BuildEndorsement::<40>); // TODO: real sizes + let output_stream = self.hint(input_stream, BuildEndorsement::<41>); let approval_message = output_stream.read::(self); approval_message @@ -360,8 +360,115 @@ impl, const D: usize> VerifyCircuit for CircuitBuild mod tests { use super::*; + fn fixture(file: &str) -> near_light_client_protocol::prelude::Header { + serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) + .unwrap() + } + + fn default_env() { + let mut builder = DefaultBuilder::new(); + // let mut pw = PartialWitness::new(); + let x1 = 10; + let x = builder.init::(); + // + // x.set(&mut pw, x1); + // + // assert_eq!(x.get(&pw), x1); + // + // println!("x1: {:?}", x1.to_le_bytes()); + // println!("x: {:?}", x.encode(&mut builder)); + // + // let circuit = builder.build(); + // let proof = circuit.data.prove(pw).unwrap(); + // circuit.data.verify(proof).unwrap(); + } + + fn header_from_header, const D: usize>( + builder: &mut CircuitBuilder, + pw: &mut PartialWitness, + header: near_light_client_protocol::prelude::Header, + ) -> Header { + let inner = header.inner_lite; + + let height: U64Variable = builder.constant(inner.height); + let epoch_id: CryptoHash = builder.constant(inner.epoch_id.0.into()); + let next_epoch_id: CryptoHash = builder.constant(inner.next_epoch_id.0.into()); + let prev_state_root: CryptoHash = builder.constant(inner.prev_state_root.0.into()); + let outcome_root: CryptoHash = builder.constant(inner.outcome_root.0.into()); + let timestamp: U64Variable = builder.constant(inner.timestamp); + let timestamp_nanosec: U64Variable = builder.constant(inner.timestamp_nanosec); + let next_bp_hash: CryptoHash = builder.constant(inner.next_bp_hash.0.into()); + let block_merkle_root: CryptoHash = builder.constant(inner.block_merkle_root.0.into()); + // height.set(pw, inner.height); + // epoch_id.set(pw, inner.epoch_id.0.into()); + // next_epoch_id.set(pw, inner.next_epoch_id.0.into()); + // prev_state_root.set(pw, inner.prev_state_root.0.into()); + // outcome_root.set(pw, inner.outcome_root.0.into()); + // timestamp.set(pw, inner.timestamp); + // timestamp_nanosec.set(pw, inner.timestamp_nanosec); + // next_bp_hash.set(pw, inner.next_bp_hash.0.into()); + // block_merkle_root.set(pw, inner.block_merkle_root.0.into()); + + let inner_lite = HeaderInner { + height, + epoch_id, + next_epoch_id, + prev_state_root, + outcome_root, + timestamp, + timestamp_nanosec, + next_bp_hash, + block_merkle_root, + }; + let inner_rest_hash: CryptoHash = builder.constant(header.inner_rest_hash.0.into()); + inner_rest_hash.set(pw, header.inner_rest_hash.0.into()); + let prev_block_hash: CryptoHash = builder.constant(header.prev_block_hash.0.into()); + prev_block_hash.set(pw, header.prev_block_hash.0.into()); + Header { + inner_lite, + inner_rest_hash, + prev_block_hash, + } + } + #[test] - fn test_name() { - + fn statically_test_lens() { + //println!("approval: {:?}", ) + } + + #[test] + fn test_hashing_equality() { + let mut builder = DefaultBuilder::new(); + let mut pw = PartialWitness::::new(); + + let header = fixture("1.json"); + let header_hash = header.hash(); + let expected_header_hash: CryptoHash = builder.constant(header_hash.0.into()); + let expected_inner_lite_hash: CryptoHash = builder.constant( + near_light_client_protocol::prelude::CryptoHash::hash_borsh(header.inner_lite.clone()) + .0 + .into(), + ); + + let converted_header = header_from_header(&mut builder, &mut pw, header); + let inner_lite_hash = builder.inner_lite_hash(&converted_header.inner_lite); + builder.assert_is_equal(inner_lite_hash, expected_inner_lite_hash); + let header_hash = builder.header_hash( + &converted_header.inner_lite, + &converted_header.inner_rest_hash, + &converted_header.prev_block_hash, + ); + //builder.assert_is_equal(header_hash, expected_header_hash); + + let circuit = builder.build(); + let pw = PartialWitness::new(); + let proof = circuit.data.prove(pw).unwrap(); + circuit.data.verify(proof).unwrap(); + + // let circuit = builder.build(); + // let input = circuit.input(); + // let (proof, output) = circuit.prove(&input); + // circuit.verify(&proof, &input, &output); + // circuit.test_default_serializers(); } } diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index a45104a..46926a3 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -45,7 +45,6 @@ pub struct Header { pub prev_block_hash: CryptoHash, pub inner_rest_hash: Bytes32Variable, pub inner_lite: HeaderInner, - pub hash: CryptoHash, } #[derive(CircuitVariable, Clone, Debug)] @@ -66,7 +65,7 @@ pub struct HeaderInner { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct InnerLiteHash; impl, const D: usize, const N: usize> Hint for InnerLiteHash { - fn hint(&self, input_stream: &mut ValueStream, _output_stream: &mut ValueStream) { + fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let mut bytes: Vec = vec![]; let height = input_stream.read_value::(); let epoch_id = input_stream.read_value::(); @@ -87,6 +86,10 @@ impl, const D: usize, const N: usize> Hint for Inner bytes.extend_from_slice(×tamp_nanosec.to_le_bytes()); bytes.extend_from_slice(&next_bp_hash.0); bytes.extend_from_slice(&block_merkle_root.0); + + + let hash = sha256(&bytes); + output_stream.write_value::(hash.into()); } } diff --git a/crates/protocol/src/experimental.rs b/crates/protocol/src/experimental.rs index 1ab0df1..656ad58 100644 --- a/crates/protocol/src/experimental.rs +++ b/crates/protocol/src/experimental.rs @@ -342,13 +342,14 @@ pub(crate) mod tests { fn read_proof Deserialize<'a>>(path: &str) -> T { println!("Reading {}", path); + let path = format!("../../{path}"); serde_json::from_reader(std::fs::File::open(path).unwrap()).unwrap() } fn write_proof(path: &str, proof: &Proof) { std::fs::write( path.to_string().replace(".json", ".hex"), - hex::encode(proof.try_to_vec().unwrap()), + hex::encode(borsh::to_vec(&proof).unwrap()), ) .unwrap(); let json = serde_json::to_string_pretty(&proof).unwrap(); @@ -444,7 +445,7 @@ pub(crate) mod tests { println!("{:#?}", proof_size); let batch = vec![proof1, proof2]; let proof = Proof::new(root, batch); - let new_proof_size = proof.try_to_vec().unwrap().len(); + let new_proof_size = borsh::to_vec(&proof).unwrap().len(); assert!(new_proof_size < proof_size / 2); println!("{:#?}", new_proof_size); @@ -506,7 +507,7 @@ pub(crate) mod tests { #[test] fn batch_proofs() { let _ = pretty_env_logger::try_init(); - let (head, common_root, client) = get_constants(); + let (head, common_root) = get_constants(); let receiver_id = AccountId::from_str("da.topgunbakugo.testnet").unwrap(); let path = "fixtures/batch.json"; diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index cb2d936..b409656 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -183,6 +183,7 @@ impl Protocol { BorshSerialize::serialize(&endorsement, &mut temp_vec).ok()?; //temp_vec.extend_from_slice(&(endorsement.try_to_vec().ok()?[..])); temp_vec.extend_from_slice(&((block_view.inner_lite.height + 2).to_le_bytes()[..])); + println!("temp_vec len: {:?}", temp_vec.len()); temp_vec }; @@ -334,11 +335,11 @@ macro_rules! cvec { mod tests { use super::*; use itertools::Itertools; - use near_jsonrpc_client::methods::light_client_proof::RpcLightClientExecutionProofResponse; + use near_jsonrpc_primitives::types::light_client::RpcLightClientExecutionProofResponse; use serde_json::{self}; fn fixture(file: &str) -> LightClientBlockView { - serde_json::from_reader(std::fs::File::open(format!("fixtures/{}", file)).unwrap()).unwrap() + serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()).unwrap() } fn get_next_epoch() -> LightClientBlockView { @@ -589,4 +590,10 @@ mod tests { ); assert!(root_matches); } + + #[test] + fn statically_test_lens() { + println!("approval: {:?}", std::mem::size_of::()); + + } } From 9f14eccc315af56c28d87a858ba866748e7c1093 Mon Sep 17 00:00:00 2001 From: dndll Date: Wed, 10 Jan 2024 12:27:20 +0000 Subject: [PATCH 07/67] wip: testing --- Cargo.lock | 3 + circuits/plonky2x/Cargo.toml | 9 +- circuits/plonky2x/src/builder.rs | 431 ++++++++++++++++++----------- circuits/plonky2x/src/input.rs | 0 circuits/plonky2x/src/lib.rs | 15 +- circuits/plonky2x/src/variables.rs | 288 ++++++++++++++----- crates/protocol/src/lib.rs | 19 +- crates/protocol/src/merkle_util.rs | 1 + crates/protocol/src/prelude.rs | 1 + 9 files changed, 522 insertions(+), 245 deletions(-) create mode 100644 circuits/plonky2x/src/input.rs diff --git a/Cargo.lock b/Cargo.lock index 6bb832b..ccbe7ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3698,9 +3698,12 @@ version = "0.1.0" dependencies = [ "borsh 1.3.0", "ethers", + "hex", "near-light-client-protocol", + "near-primitives", "plonky2", "plonky2x", + "pretty_env_logger", "serde", "serde_json", ] diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index d1f0daa..e78f7f9 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -14,9 +14,14 @@ serde.workspace = true plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } +near-light-client-protocol = { path = "../../crates/protocol" } + [dev-dependencies] -near-light-client-protocol = { path = "../../crates/protocol" } -serde_json.workspace = true +borsh.workspace = true +hex.workspace = true +near-primitives.workspace = true +pretty_env_logger.workspace = true +serde_json.workspace = true # [workspace] # members = [] diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 9e87988..fec4ad3 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,82 +1,83 @@ use crate::variables::{ - Block, BlockHeight, BuildEndorsement, CryptoHash, EpochBlockProducers, Header, HeaderInner, - InnerLiteHash, MerklePath, Proof, PublicKey, Signature, StakeInfo, ValidatorStake, - MAX_EPOCH_VALIDATORS, + BlockHeightVariable, BlockVariable, BuildEndorsement, CryptoHashVariable, HeaderInnerVariable, + HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, PublicKeyVariable, + SignatureVariable, StakeInfoVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, }; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; use plonky2x::frontend::merkle::tendermint::TendermintMerkleTree; use plonky2x::prelude::*; pub trait Verify, const D: usize> { fn ensure_not_already_verified( &mut self, - head: &Header, - block_height: &BlockHeight, + head: &HeaderVariable, + block_height: &BlockHeightVariable, ) -> BoolVariable; fn ensure_epoch_is_current_or_next( &mut self, - head: &Header, - epoch_id: &CryptoHash, + head: &HeaderVariable, + epoch_id: &CryptoHashVariable, ) -> BoolVariable; fn ensure_if_next_epoch_contains_next_bps( &mut self, - head: &Header, - epoch_id: &CryptoHash, - next_bps: &EpochBlockProducers, + head: &HeaderVariable, + epoch_id: &CryptoHashVariable, + next_bps: &ArrayVariable, ) -> BoolVariable; - fn validate_signatures( + fn validate_eddsa_signatures( &mut self, is_active: ArrayVariable, - signatures: ArrayVariable, - epoch_bps: ArrayVariable, + signatures: ArrayVariable, + epoch_bps: ArrayVariable, approval_message_hash: Bytes32Variable, - ) -> StakeInfo; + ) -> StakeInfoVariable; - fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfo) -> BoolVariable; + fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfoVariable) -> BoolVariable; fn ensure_next_bps_is_valid( &mut self, - expected_hash: &CryptoHash, - next_bps_hash: Option<&CryptoHash>, + expected_hash: &CryptoHashVariable, + next_bps_hash: Option<&CryptoHashVariable>, ) -> BoolVariable; fn ensure_block_hash_matches_outcome( &mut self, - head: &Header, - outcome_proof_block_hash: &CryptoHash, + head: &HeaderVariable, + outcome_proof_block_hash: &CryptoHashVariable, ) -> BoolVariable; fn ensure_block_hash_matches_outcome_hashed( &mut self, - head: &CryptoHash, - outcome_proof_block_hash: &CryptoHash, + head: &CryptoHashVariable, + outcome_proof_block_hash: &CryptoHashVariable, ) -> BoolVariable; fn verify_outcome( &mut self, - expected: &CryptoHash, - outcome_proof: &MerklePath, - outcome_hash: &CryptoHash, - outcome_root_proof: &MerklePath, + expected: &CryptoHashVariable, + outcome_proof: &MerklePathVariable, + outcome_hash: &CryptoHashVariable, + outcome_root_proof: &MerklePathVariable, ) -> BoolVariable; fn verify_block( &mut self, - expected: &CryptoHash, - block_proof: &MerklePath, - block_hash: &CryptoHash, + expected: &CryptoHashVariable, + block_proof: &MerklePathVariable, + block_hash: &CryptoHashVariable, ) -> BoolVariable; fn header_hash( &mut self, - inner_lite_hash: &HeaderInner, - inner_rest_hash: &CryptoHash, - prev_block_hash: &CryptoHash, - ) -> CryptoHash; + inner_lite_hash: &HeaderInnerVariable, + inner_rest_hash: &CryptoHashVariable, + prev_block_hash: &CryptoHashVariable, + ) -> CryptoHashVariable; - fn inner_lite_hash(&mut self, inner_lite: &HeaderInner) -> CryptoHash; + fn inner_lite_hash(&mut self, inner_lite: &HeaderInnerVariable) -> CryptoHashVariable; fn assertx(&mut self, condition: BoolVariable); } @@ -84,16 +85,16 @@ pub trait Verify, const D: usize> { impl, const D: usize> Verify for CircuitBuilder { fn ensure_not_already_verified( &mut self, - head: &Header, - block_height: &BlockHeight, + head: &HeaderVariable, + block_height: &BlockHeightVariable, ) -> BoolVariable { self.gt(*block_height, head.inner_lite.height) } fn ensure_epoch_is_current_or_next( &mut self, - head: &Header, - epoch_id: &CryptoHash, + head: &HeaderVariable, + epoch_id: &CryptoHashVariable, ) -> BoolVariable { let epoch = self.is_equal(head.inner_lite.epoch_id, *epoch_id); let next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); @@ -103,26 +104,26 @@ impl, const D: usize> Verify for CircuitBuilder, ) -> BoolVariable { let is_next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); - let is_not_empty = self.constant(next_bps.bps.len() > 0); + let is_not_empty = self.constant(next_bps.len() > 0); let ok_anyway = self.constant(true); self.select(is_next_epoch, is_not_empty, ok_anyway) } // TODO: does not build active participants - fn validate_signatures( + fn validate_eddsa_signatures( &mut self, is_active: ArrayVariable, - signatures: ArrayVariable, - epoch_bps: ArrayVariable, + signatures: ArrayVariable, + epoch_bps: ArrayVariable, approval_message_hash: Bytes32Variable, - ) -> StakeInfo { + ) -> StakeInfoVariable { let messages = [approval_message_hash.0; MAX_EPOCH_VALIDATORS]; - let pubkeys: Vec = epoch_bps + let pubkeys: Vec = epoch_bps .data .iter() .map(|vs| vs.public_key.clone()) @@ -130,6 +131,7 @@ impl, const D: usize> Verify for CircuitBuilder( is_active.clone(), @@ -139,8 +141,8 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder BoolVariable { - let denominator = self.constant(3); - let numerator = self.constant(2); + fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfoVariable) -> BoolVariable { + let numerator = self.constant(2.into()); + let denominator = self.constant(3.into()); - let approved = self.mul(stake.approved_stake, numerator); - let threshold = self.mul(stake.total_stake, denominator); + let threshold = self.mul(stake.total_stake, numerator); + let approved = self.mul(stake.approved_stake, denominator); + self.watch(&approved, "approved"); + self.watch(&threshold, "threshold"); self.gte(approved, threshold) } fn ensure_next_bps_is_valid( &mut self, - expected_hash: &CryptoHash, - next_bps_hash: Option<&CryptoHash>, + expected_hash: &CryptoHashVariable, + next_bps_hash: Option<&CryptoHashVariable>, ) -> BoolVariable { if let Some(next_bps) = next_bps_hash { self.is_equal(*next_bps, *expected_hash) @@ -180,8 +184,8 @@ impl, const D: usize> Verify for CircuitBuilder BoolVariable { let hash = self.header_hash( &head.inner_lite, @@ -193,18 +197,18 @@ impl, const D: usize> Verify for CircuitBuilder BoolVariable { self.is_equal(*head_hash, *outcome_proof_block_hash) } fn verify_outcome( &mut self, - expected: &CryptoHash, - outcome_proof: &MerklePath, - outcome_hash: &CryptoHash, - outcome_root_proof: &MerklePath, + expected: &CryptoHashVariable, + outcome_proof: &MerklePathVariable, + outcome_hash: &CryptoHashVariable, + outcome_root_proof: &MerklePathVariable, ) -> BoolVariable { let outcome_root = self.get_root_from_merkle_proof_hashed_leaf( &outcome_proof.path, @@ -223,9 +227,9 @@ impl, const D: usize> Verify for CircuitBuilder( &mut self, - expected: &CryptoHash, - block_proof: &MerklePath, - block_hash: &CryptoHash, + expected: &CryptoHashVariable, + block_proof: &MerklePathVariable, + block_hash: &CryptoHashVariable, ) -> BoolVariable { let block_root = self.get_root_from_merkle_proof_hashed_leaf( &block_proof.path, @@ -242,18 +246,19 @@ impl, const D: usize> Verify for CircuitBuilder CryptoHash { + inner_lite: &HeaderInnerVariable, + inner_rest_hash: &CryptoHashVariable, + prev_block_hash: &CryptoHashVariable, + ) -> CryptoHashVariable { let inner_lite_hash = self.inner_lite_hash(&inner_lite); - - let inner = self.sha256_pair(inner_lite_hash, *inner_rest_hash); - let hash = self.sha256_pair(inner, *prev_block_hash); + let lite_rest = self.curta_sha256_pair(inner_lite_hash, *inner_rest_hash); + let hash = self.curta_sha256_pair(lite_rest, *prev_block_hash); + self.watch(&hash, "header_hash"); hash } - fn inner_lite_hash(&mut self, inner_lite: &HeaderInner) -> CryptoHash { + // TODO: convert to hash here + fn inner_lite_hash(&mut self, inner_lite: &HeaderInnerVariable) -> CryptoHashVariable { let mut input_stream = VariableStream::new(); input_stream.write(&inner_lite.height); input_stream.write(&inner_lite.epoch_id); @@ -261,24 +266,34 @@ impl, const D: usize> Verify for CircuitBuilder); - let hash = output_stream.read::(self); - hash + let inner_lite_hash = output_stream.read::(self); + self.watch(&inner_lite_hash, "inner_lite_hash"); + inner_lite_hash } } pub trait SyncCircuit, const D: usize> { - fn sync(&mut self, head: Header, epoch_bps: EpochBlockProducers, next_block: Block); + fn sync( + &mut self, + head: HeaderVariable, + epoch_bps: ArrayVariable, + next_block: BlockVariable, + ); - fn reconstruct_approval_message(&mut self, next_block: &Block) -> CryptoHash; + fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> CryptoHashVariable; } impl, const D: usize> SyncCircuit for CircuitBuilder { - fn sync(&mut self, head: Header, epoch_bps: EpochBlockProducers, next_block: Block) { + fn sync( + &mut self, + head: HeaderVariable, + epoch_bps: ArrayVariable, + next_block: BlockVariable, + ) { let mut c = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); self.assertx(c); @@ -294,22 +309,34 @@ impl, const D: usize> SyncCircuit for CircuitBuilder let approval = self.reconstruct_approval_message(&next_block); - let stake = self.validate_signatures( - epoch_bps.active, - next_block.approvals_after_next, - epoch_bps.bps, + let signatures_eddsa = next_block + .approvals_after_next + .signatures + .data + .iter() + .map(|s| s.ed25519.clone()) // FIXME: when ecdsa + .collect::>(); + + let stake = self.validate_eddsa_signatures( + next_block.approvals_after_next.active_bitmask, + ArrayVariable::new(signatures_eddsa), + epoch_bps, approval, ); c = self.ensure_stake_is_sufficient(&stake); self.assertx(c); - + // Self::ensure_next_bps_is_valid( + // &next_block.inner_lite.next_bp_hash, + // next_block.next_bps, + // ) + // // TODO: decide what to write here // self.evm_write(new_head); // self.evm_write(next_block.inner_lite.block_merkle_root); } - fn reconstruct_approval_message(&mut self, next_block: &Block) -> CryptoHash { + fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> CryptoHashVariable { let next_header_hash = self.header_hash( &next_block.inner_lite, &next_block.inner_rest_hash, @@ -329,11 +356,11 @@ impl, const D: usize> SyncCircuit for CircuitBuilder } pub trait VerifyCircuit, const D: usize> { - fn verify(&mut self, proof: Proof); + fn verify(&mut self, proof: ProofVariable); } impl, const D: usize> VerifyCircuit for CircuitBuilder { - fn verify(&mut self, proof: Proof) { + fn verify(&mut self, proof: ProofVariable) { let block_hash = self.header_hash( &proof.block_header.inner_lite, &proof.block_header.inner_rest_hash, @@ -358,12 +385,33 @@ impl, const D: usize> VerifyCircuit for CircuitBuild #[cfg(test)] mod tests { + use near_light_client_protocol::{ + prelude::Header, LightClientBlockView, StakeInfo, ValidatorStake, + }; + use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; + use plonky2x::frontend::eth::storage::vars::EthHeaderVariable; + use super::*; - fn fixture(file: &str) -> near_light_client_protocol::prelude::Header { + fn fixture(file: &str) -> LightClientBlockView { serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) .unwrap() } + fn get_next_epoch() -> LightClientBlockView { + fixture("2.json") + } + + fn get_first_epoch() -> LightClientBlockView { + fixture("1.json") + } + + fn to_header(bv: LightClientBlockView) -> Header { + Header { + prev_block_hash: bv.prev_block_hash, + inner_rest_hash: bv.inner_rest_hash, + inner_lite: bv.inner_lite, + } + } fn default_env() { let mut builder = DefaultBuilder::new(); @@ -383,92 +431,139 @@ mod tests { // circuit.data.verify(proof).unwrap(); } - fn header_from_header, const D: usize>( - builder: &mut CircuitBuilder, - pw: &mut PartialWitness, - header: near_light_client_protocol::prelude::Header, - ) -> Header { - let inner = header.inner_lite; - - let height: U64Variable = builder.constant(inner.height); - let epoch_id: CryptoHash = builder.constant(inner.epoch_id.0.into()); - let next_epoch_id: CryptoHash = builder.constant(inner.next_epoch_id.0.into()); - let prev_state_root: CryptoHash = builder.constant(inner.prev_state_root.0.into()); - let outcome_root: CryptoHash = builder.constant(inner.outcome_root.0.into()); - let timestamp: U64Variable = builder.constant(inner.timestamp); - let timestamp_nanosec: U64Variable = builder.constant(inner.timestamp_nanosec); - let next_bp_hash: CryptoHash = builder.constant(inner.next_bp_hash.0.into()); - let block_merkle_root: CryptoHash = builder.constant(inner.block_merkle_root.0.into()); - // height.set(pw, inner.height); - // epoch_id.set(pw, inner.epoch_id.0.into()); - // next_epoch_id.set(pw, inner.next_epoch_id.0.into()); - // prev_state_root.set(pw, inner.prev_state_root.0.into()); - // outcome_root.set(pw, inner.outcome_root.0.into()); - // timestamp.set(pw, inner.timestamp); - // timestamp_nanosec.set(pw, inner.timestamp_nanosec); - // next_bp_hash.set(pw, inner.next_bp_hash.0.into()); - // block_merkle_root.set(pw, inner.block_merkle_root.0.into()); - - let inner_lite = HeaderInner { - height, - epoch_id, - next_epoch_id, - prev_state_root, - outcome_root, - timestamp, - timestamp_nanosec, - next_bp_hash, - block_merkle_root, - }; - let inner_rest_hash: CryptoHash = builder.constant(header.inner_rest_hash.0.into()); - inner_rest_hash.set(pw, header.inner_rest_hash.0.into()); - let prev_block_hash: CryptoHash = builder.constant(header.prev_block_hash.0.into()); - prev_block_hash.set(pw, header.prev_block_hash.0.into()); - Header { - inner_lite, - inner_rest_hash, - prev_block_hash, - } - } - #[test] - fn statically_test_lens() { - //println!("approval: {:?}", ) + fn test_header_hash() { + pretty_env_logger::try_init().unwrap_or_default(); + + let mut builder = DefaultBuilder::new(); + let header = builder.read::(); + + let result = builder.header_hash( + &header.inner_lite, + &header.inner_rest_hash, + &header.prev_block_hash, + ); + builder.write(result); + + let circuit = builder.build(); + let mut input = circuit.input(); + + let header = to_header(fixture("1.json")); + let expected_hash = header.hash().0; + println!("expected_hash: {:?}", hex!(expected_hash)); + + input.write::(header.into()); + let (_proof, mut output) = circuit.prove(&input); + + let hash = output.read::(); + assert_eq!(hash.0, expected_hash); } #[test] - fn test_hashing_equality() { + fn test_ensures() { + pretty_env_logger::try_init().unwrap_or_default(); + let test_header = get_first_epoch(); + let test_bps = test_header.next_bps.clone().unwrap_or_default(); + println!("test_bps: {:?}", test_bps.len()); + let test_header = to_header(test_header); + let mut builder = DefaultBuilder::new(); - let mut pw = PartialWitness::::new(); - - let header = fixture("1.json"); - let header_hash = header.hash(); - let expected_header_hash: CryptoHash = builder.constant(header_hash.0.into()); - let expected_inner_lite_hash: CryptoHash = builder.constant( - near_light_client_protocol::prelude::CryptoHash::hash_borsh(header.inner_lite.clone()) - .0 - .into(), + let header = builder.read::(); + + let early_block_height = builder.constant::(1); + let later_block_height = builder.constant::(test_header.inner_lite.height + 1); + + let r = builder.ensure_not_already_verified(&header, &early_block_height); + builder.write::(r); + let r = builder.ensure_not_already_verified(&header, &later_block_height); + builder.write::(r); + let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); + builder.write::(r); + let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.next_epoch_id); + builder.write::(r); + + let next_bps = builder + .constant::>( + test_bps + .clone() + .into_iter() + .map(|s| Into::::into(s)) + .map(Into::into) + .collect(), + ); + let r = builder.ensure_if_next_epoch_contains_next_bps( + &header, + &header.inner_lite.next_epoch_id, + &next_bps, ); + builder.write::(r); - let converted_header = header_from_header(&mut builder, &mut pw, header); - let inner_lite_hash = builder.inner_lite_hash(&converted_header.inner_lite); - builder.assert_is_equal(inner_lite_hash, expected_inner_lite_hash); - let header_hash = builder.header_hash( - &converted_header.inner_lite, - &converted_header.inner_rest_hash, - &converted_header.prev_block_hash, - ); - //builder.assert_is_equal(header_hash, expected_header_hash); + let mut stake = StakeInfo { + total: 300, + approved: 200, + }; - let circuit = builder.build(); - let pw = PartialWitness::new(); - let proof = circuit.data.prove(pw).unwrap(); - circuit.data.verify(proof).unwrap(); + let stake_info = builder.constant::(stake.clone().into()); + let stake_is_equal_to_threshold = builder.ensure_stake_is_sufficient(&stake_info); + builder.write::(stake_is_equal_to_threshold); - // let circuit = builder.build(); - // let input = circuit.input(); - // let (proof, output) = circuit.prove(&input); - // circuit.verify(&proof, &input, &output); - // circuit.test_default_serializers(); + stake.approved = 199; + let stake_info = builder.constant::(stake.clone().into()); + let stake_is_less_than_threshold = builder.ensure_stake_is_sufficient(&stake_info); + builder.write::(stake_is_less_than_threshold); + + stake.approved = 201; + let stake_info = builder.constant::(stake.clone().into()); + let stake_is_greater_than_threshold = builder.ensure_stake_is_sufficient(&stake_info); + builder.write::(stake_is_greater_than_threshold); + + stake.approved = 0; + let stake_info = builder.constant::(stake.clone().into()); + let stake_is_zero = builder.ensure_stake_is_sufficient(&stake_info); + builder.write::(stake_is_zero); + + let next_bps_hash = CryptoHash::hash_borsh(test_bps.clone()); + let next_bps_hash = builder.constant::(next_bps_hash.0.into()); + + let next_bps_is_valid = + builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); + builder.write::(next_bps_is_valid); + + let circuit = builder.build(); + let mut input = circuit.input(); + + input.write::(test_header.into()); + + let (proof, mut output) = circuit.prove(&input); + + let height_not_verified = output.read::(); + assert!(!height_not_verified, "height was not verified"); + let height_verified = output.read::(); + assert!(height_verified, "height was verified"); + let epoch_current = output.read::(); + assert!(epoch_current, "epoch was current"); + let epoch_next = output.read::(); + assert!(epoch_next, "epoch was next"); + let next_epoch_has_bps = output.read::(); + assert!(next_epoch_has_bps, "next epoch has bps"); + let stake_is_equal_to_threshold = output.read::(); + assert!( + stake_is_equal_to_threshold, + "stake equal to threshold is ok" + ); + let stake_is_less_than_threshold = output.read::(); + assert!(!stake_is_less_than_threshold, "stake less than threshold"); + let stake_is_greater_than_threshold = output.read::(); + assert!( + stake_is_greater_than_threshold, + "stake greater than threshold" + ); + let stake_is_zero = output.read::(); + assert!(!stake_is_zero, "stake is zero"); + let next_bps_is_valid = output.read::(); + assert!(next_bps_is_valid, "next bps is valid"); } + + #[test] + fn test_reconstruct_approval_msg() {} } diff --git a/circuits/plonky2x/src/input.rs b/circuits/plonky2x/src/input.rs new file mode 100644 index 0000000..e69de29 diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index a11dd1f..78db03d 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,8 +1,9 @@ use plonky2x::prelude::*; -use variables::{Block, EpochBlockProducers, Header, Proof}; +use variables::{BlockVariable, HeaderVariable, ProofVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS}; mod builder; mod codec; +mod input; mod variables; // TODO: @@ -12,14 +13,22 @@ mod variables; #[derive(Debug)] pub struct Circuit; +// TODO: here they use a hint to go and get all the inputs offchain +// + // TODO: decide if to make validator set and other generics at trait level // or stay in types pub trait SyncCircuit, const D: usize> { - fn sync(&mut self, head: Header, epoch_bps: EpochBlockProducers, next_block: Block) -> Header; + fn sync( + &mut self, + head: HeaderVariable, + epoch_bps: ArrayVariable, + next_block: BlockVariable, + ) -> HeaderVariable; } pub trait VerifyCircuit, const D: usize> { - fn verify(&mut self, proof: Proof) -> bool; + fn verify(&mut self, proof: ProofVariable) -> bool; } #[cfg(test)] diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 46926a3..5c7e421 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -1,6 +1,14 @@ -use crate::codec::{self, Borsh}; -use borsh::BorshSerialize; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; +use ethers::types::{H256, U256}; +use near_light_client_protocol::prelude::Header; +use near_light_client_protocol::{ + merkle_util::MerklePath, prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, + LightClientBlockView, Signature, ValidatorStake, +}; +use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::{ + EDDSASignatureVariable, DUMMY_SIGNATURE, +}; use plonky2x::frontend::hint::simple::hint::Hint; use plonky2x::frontend::{curta::ec::point::CompressedEdwardsYVariable, uint::Uint}; use plonky2x::prelude::*; @@ -19,46 +27,81 @@ use serde::{Deserialize, Serialize}; // EVM write proof pub const MAX_ACCOUNT_ID_LEN: usize = 32; // TODO: get real number here -pub const MAX_EPOCH_VALIDATORS: usize = 128; // TODO: real number +pub const MAX_EPOCH_VALIDATORS: usize = 100; // TODO: real number -pub type CryptoHash = Bytes32Variable; -pub type BlockHeight = U64Variable; -pub type Balance = U64Variable; -pub type AccountId = BytesVariable; // TODO: likely an issue, implement the var here, or just use a u64, - // TODO: get depths of all proofs +pub type CryptoHashVariable = Bytes32Variable; +pub type BlockHeightVariable = U64Variable; +pub type BalanceVariable = U128Variable; +pub type AccountIdVariable = BytesVariable<{ AccountId::MAX_LEN }>; -// TODO: maybe find a nicer way to do this #[derive(CircuitVariable, Clone, Debug)] -pub struct EpochBlockProducers { - pub active: ArrayVariable, - pub bps: ArrayVariable, -} - -#[derive(CircuitVariable, Clone, Debug)] -pub struct MerklePath { +pub struct MerklePathVariable { pub path: ArrayVariable, pub indices: ArrayVariable, } +impl From for MerklePathVariableValue { + fn from(value: MerklePath) -> Self { + assert_eq!(value.len(), M, "Merkle path must be of length M"); + let indices: Vec = value + .iter() + .map(|x| match x.direction { + near_light_client_protocol::Direction::Left => false, + near_light_client_protocol::Direction::Right => true, + }) + .collect(); + Self { + path: value.iter().map(|x| x.hash.0.into()).collect::>(), + indices, + } + } +} + #[derive(CircuitVariable, Clone, Debug)] -pub struct Header { - pub prev_block_hash: CryptoHash, - pub inner_rest_hash: Bytes32Variable, - pub inner_lite: HeaderInner, +pub struct HeaderVariable { + pub prev_block_hash: CryptoHashVariable, + pub inner_rest_hash: CryptoHashVariable, + pub inner_lite: HeaderInnerVariable, +} +impl From
for HeaderVariableValue { + fn from(header: Header) -> Self { + Self { + prev_block_hash: header.prev_block_hash.0.into(), + inner_rest_hash: header.inner_rest_hash.0.into(), + inner_lite: header.inner_lite.into(), + } + } } #[derive(CircuitVariable, Clone, Debug)] -pub struct HeaderInner { +pub struct HeaderInnerVariable { pub height: U64Variable, - pub epoch_id: CryptoHash, - pub next_epoch_id: CryptoHash, - pub prev_state_root: CryptoHash, - pub outcome_root: CryptoHash, - /// Legacy json number. Should not be used. TODO: delete + pub epoch_id: CryptoHashVariable, + pub next_epoch_id: CryptoHashVariable, + pub prev_state_root: CryptoHashVariable, + pub outcome_root: CryptoHashVariable, pub timestamp: U64Variable, - pub timestamp_nanosec: U64Variable, - pub next_bp_hash: CryptoHash, - pub block_merkle_root: CryptoHash, + pub next_bp_hash: CryptoHashVariable, + pub block_merkle_root: CryptoHashVariable, +} +impl From for HeaderInnerVariableValue { + fn from(header: BlockHeaderInnerLiteView) -> Self { + Self { + height: header.height.into(), + epoch_id: header.epoch_id.0.into(), + next_epoch_id: header.next_epoch_id.0.into(), + prev_state_root: header.prev_state_root.0.into(), + outcome_root: header.outcome_root.0.into(), + timestamp: if header.timestamp > 0 { + header.timestamp + } else { + header.timestamp_nanosec + } + .into(), + next_bp_hash: header.next_bp_hash.0.into(), + block_merkle_root: header.block_merkle_root.0.into(), + } + } } // TODO: test this individually as i think they arent borsh encoded @@ -68,14 +111,13 @@ impl, const D: usize, const N: usize> Hint for Inner fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let mut bytes: Vec = vec![]; let height = input_stream.read_value::(); - let epoch_id = input_stream.read_value::(); - let next_epoch_id = input_stream.read_value::(); - let prev_state_root = input_stream.read_value::(); - let outcome_root = input_stream.read_value::(); + let epoch_id = input_stream.read_value::(); + let next_epoch_id = input_stream.read_value::(); + let prev_state_root = input_stream.read_value::(); + let outcome_root = input_stream.read_value::(); let timestamp = input_stream.read_value::(); - let timestamp_nanosec = input_stream.read_value::(); - let next_bp_hash = input_stream.read_value::(); - let block_merkle_root = input_stream.read_value::(); + let next_bp_hash = input_stream.read_value::(); + let block_merkle_root = input_stream.read_value::(); bytes.extend_from_slice(&height.to_le_bytes()); bytes.extend_from_slice(&epoch_id.0); @@ -83,35 +125,99 @@ impl, const D: usize, const N: usize> Hint for Inner bytes.extend_from_slice(&prev_state_root.0); bytes.extend_from_slice(&outcome_root.0); bytes.extend_from_slice(×tamp.to_le_bytes()); - bytes.extend_from_slice(×tamp_nanosec.to_le_bytes()); bytes.extend_from_slice(&next_bp_hash.0); bytes.extend_from_slice(&block_merkle_root.0); - let hash = sha256(&bytes); output_stream.write_value::(hash.into()); } } #[derive(CircuitVariable, Clone, Debug)] -pub struct Block { - pub prev_block_hash: CryptoHash, - pub next_block_inner_hash: CryptoHash, - pub inner_lite: HeaderInner, - pub inner_rest_hash: CryptoHash, +pub struct BlockVariable { + pub prev_block_hash: CryptoHashVariable, + pub next_block_inner_hash: CryptoHashVariable, + pub inner_lite: HeaderInnerVariable, + pub inner_rest_hash: CryptoHashVariable, // TODO: sparse arrays for this and approvals - pub next_bps: EpochBlockProducers, - pub approvals_after_next: ArrayVariable, + pub next_bps: ArrayVariable, + pub approvals_after_next: BpsApprovals, +} + +impl From for BlockVariableValue { + fn from(block: LightClientBlockView) -> Self { + Self { + prev_block_hash: block.prev_block_hash.0.into(), + next_block_inner_hash: block.next_block_inner_hash.0.into(), + inner_lite: block.inner_lite.into(), + inner_rest_hash: block.inner_rest_hash.0.into(), + next_bps: if let Some(next_bps) = block.next_bps { + next_bps + .into_iter() + .map(|s| { + let s: ValidatorStake = s.into(); + s + }) + .map(Into::into) + .collect() + } else { + vec![] + } + .into(), + approvals_after_next: block.approvals_after_next.into(), + } + } +} + +#[derive(CircuitVariable, Clone, Debug)] +pub struct BpsApprovals { + pub active_bitmask: ArrayVariable, + pub signatures: ArrayVariable, +} + +impl From>>> for BpsApprovalsValue { + fn from(approvals: Vec>>) -> Self { + let mut active_bitmask = vec![]; + let signatures = approvals + .into_iter() + .map(|sig| { + if sig.is_none() { + active_bitmask.push(false); + } + sig.into() + }) + .collect::>>(); + + Self { + active_bitmask: active_bitmask.into(), + signatures: signatures.into(), + } + } } #[derive(CircuitVariable, Clone, Debug)] -pub struct ValidatorStake { +pub struct ValidatorStakeVariable { /// Account that stakes money. - pub account_id: AccountId, + pub account_id: AccountIdVariable, /// Public key of the proposed validator. - pub public_key: PublicKey, + pub public_key: PublicKeyVariable, /// Stake / weight of the validator. - pub stake: Balance, + pub stake: BalanceVariable, +} + +impl From for ValidatorStakeVariableValue { + fn from(stake: ValidatorStake) -> Self { + let pk = stake.public_key().key_data(); + let y = CompressedEdwardsY::from_slice(&pk).expect("CompressedEdwardsY::from_slice"); + // TODO: fixme + let mut id_bytes = borsh::to_vec(stake.account_id()).unwrap(); + id_bytes.resize(AccountId::MAX_LEN, 0); + Self { + account_id: id_bytes.try_into().unwrap(), + public_key: y.into(), + stake: stake.stake().into(), + } + } } // TODO: k256 ECDSA and manual enum impl for signatures and public keys @@ -119,19 +225,64 @@ pub struct ValidatorStake { // enum PublicKey { // Ed25519(CompressedEdwardsYVariable), // } -pub type PublicKey = CompressedEdwardsYVariable; -pub type Signature = EDDSASignatureVariable; +pub type PublicKeyVariable = CompressedEdwardsYVariable; + +#[derive(CircuitVariable, Clone, Debug)] +pub struct SignatureVariable { + pub ed25519: EDDSASignatureVariable, + //TODO: pub ecdsa: Option +} + +impl From>> for SignatureVariableValue { + fn from(sig: Option>) -> Self { + let sig = sig + .map(|s| match *s { + Signature::ED25519(s) => s.to_bytes(), + Signature::SECP256K1(_) => todo!("Support ECDSA"), + }) + .unwrap_or_else(|| DUMMY_SIGNATURE); + let sig = EDDSASignatureVariableValue { + r: CompressedEdwardsY(sig[0..32].try_into().unwrap()), + s: U256::from_little_endian(&sig[32..64]), + }; + Self { + ed25519: sig.into(), + } + } +} #[derive(CircuitVariable, Clone, Debug)] -pub struct Proof { - pub head_block_root: CryptoHash, +pub struct ProofVariable { + pub head_block_root: CryptoHashVariable, // TODO: make variable pub outcome_proof: ExecutionOutcomeWithId, - pub outcome_hash: CryptoHash, - pub outcome_proof_block_hash: CryptoHash, - pub outcome_proof: MerklePath<32>, // TODO: get real number here - pub outcome_root_proof: MerklePath<32>, // TODO: get real number here - pub block_header: Header, - pub block_proof: MerklePath<256>, // TODO: get real number here + pub outcome_hash: CryptoHashVariable, + pub outcome_proof_block_hash: CryptoHashVariable, + pub outcome_proof: MerklePathVariable<32>, // TODO: get real number here + pub outcome_root_proof: MerklePathVariable<32>, // TODO: get real number here + pub block_header: HeaderVariable, + pub block_proof: MerklePathVariable<256>, // TODO: get real number here +} + +impl From for ProofVariableValue { + fn from(proof: near_light_client_protocol::Proof) -> Self { + match proof { + near_light_client_protocol::Proof::Basic { + head_block_root, + proof, + } => Self { + head_block_root: head_block_root.0.into(), + outcome_hash: CryptoHash::hash_borsh(proof.outcome_proof.to_hashes()) + .0 + .into(), + outcome_proof_block_hash: proof.outcome_proof.block_hash.0.into(), + outcome_proof: proof.outcome_proof.proof.into(), + outcome_root_proof: proof.outcome_root_proof.into(), + block_header: proof.block_header_lite.into(), + block_proof: proof.block_proof.into(), + }, + near_light_client_protocol::Proof::Experimental(_) => todo!("Batch proving"), + } + } } // TODO: likely these don't need to be constrained in the circuit so wont need to @@ -154,9 +305,18 @@ pub struct Proof { // } #[derive(CircuitVariable, Clone, Debug)] -pub struct StakeInfo { - pub approved_stake: Balance, - pub total_stake: Balance, +pub struct StakeInfoVariable { + pub approved_stake: BalanceVariable, + pub total_stake: BalanceVariable, +} + +impl From for StakeInfoVariableValue { + fn from(value: near_light_client_protocol::StakeInfo) -> Self { + Self { + approved_stake: value.approved.into(), + total_stake: value.total.into(), + } + } } // #[derive(Clone, Debug, Serialize, Deserialize)] @@ -179,7 +339,7 @@ pub struct BuildEndorsement; impl, const D: usize, const N: usize> Hint for BuildEndorsement { fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let mut bytes = vec![]; - let next_block_hash = input_stream.read_value::(); + let next_block_hash = input_stream.read_value::(); let next_block_height = input_stream.read_value::(); bytes.push(0u8); diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index b409656..417316c 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -1,12 +1,15 @@ use crate::prelude::*; use error::Error; -use merkle_util::*; -use near_crypto::{PublicKey, Signature}; -use near_primitives::{ +pub use merkle_util::*; +pub use near_crypto::{PublicKey, Signature}; +pub use near_primitives::{ block_header::ApprovalInner, + block_header::BlockHeaderInnerLite, merkle::MerklePathItem, types::{validator_stake::ValidatorStake, BlockHeight, EpochId}, - views::{validator_stake_view::ValidatorStakeView, LightClientBlockView}, + views::{ + validator_stake_view::ValidatorStakeView, BlockHeaderInnerLiteView, LightClientBlockView, + }, }; pub mod error; @@ -308,8 +311,8 @@ impl Protocol { #[derive(Debug, Clone, PartialEq, Eq)] pub struct StakeInfo { - total: u128, - approved: u128, + pub total: u128, + pub approved: u128, } impl From<(u128, u128)> for StakeInfo { @@ -339,7 +342,8 @@ mod tests { use serde_json::{self}; fn fixture(file: &str) -> LightClientBlockView { - serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()).unwrap() + serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) + .unwrap() } fn get_next_epoch() -> LightClientBlockView { @@ -594,6 +598,5 @@ mod tests { #[test] fn statically_test_lens() { println!("approval: {:?}", std::mem::size_of::()); - } } diff --git a/crates/protocol/src/merkle_util.rs b/crates/protocol/src/merkle_util.rs index 3da44a0..0cab8d2 100644 --- a/crates/protocol/src/merkle_util.rs +++ b/crates/protocol/src/merkle_util.rs @@ -1,5 +1,6 @@ use crate::prelude::*; pub use near_primitives::merkle::combine_hash; +pub use near_primitives::merkle::MerklePath; pub use near_primitives::merkle::{Direction, MerklePathItem}; use near_primitives_core::types::MerkleHash; diff --git a/crates/protocol/src/prelude.rs b/crates/protocol/src/prelude.rs index b11e9d6..3f3893e 100644 --- a/crates/protocol/src/prelude.rs +++ b/crates/protocol/src/prelude.rs @@ -5,6 +5,7 @@ pub use near_primitives_core::borsh::{self, BorshDeserialize, BorshSerialize}; pub use near_primitives_core::hash::CryptoHash; pub use serde::{Deserialize, Serialize}; pub use itertools::Itertools; +pub use near_primitives::types::AccountId; pub type Header = near_primitives::views::LightClientBlockLiteView; pub type BasicProof = From 466f3d2491fd4a799157d38c962fcf2775cfd6a9 Mon Sep 17 00:00:00 2001 From: dndll Date: Wed, 10 Jan 2024 16:37:41 +0000 Subject: [PATCH 08/67] wip: out --- circuits/plonky2x/src/builder.rs | 50 +++++++++++++++++++++++++----- circuits/plonky2x/src/lib.rs | 1 + circuits/plonky2x/src/merkle.rs | 44 ++++++++++++++++++++++++++ circuits/plonky2x/src/variables.rs | 4 +-- crates/protocol/src/lib.rs | 10 +++++- crates/protocol/src/merkle_util.rs | 12 +++---- 6 files changed, 104 insertions(+), 17 deletions(-) create mode 100644 circuits/plonky2x/src/merkle.rs diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index fec4ad3..03154af 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,3 +1,4 @@ +use crate::merkle::NearMerkleTree; use crate::variables::{ BlockHeightVariable, BlockVariable, BuildEndorsement, CryptoHashVariable, HeaderInnerVariable, HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, PublicKeyVariable, @@ -210,18 +211,24 @@ impl, const D: usize> Verify for CircuitBuilder, ) -> BoolVariable { - let outcome_root = self.get_root_from_merkle_proof_hashed_leaf( + let outcome_root = self.get_root_from_merkle_proof_hashed_leaf_unindex( &outcome_proof.path, &outcome_proof.indices, *outcome_hash, ); - let leaf = self.sha256(&outcome_root.0 .0); + self.watch(&outcome_root, "outcome_proof_root"); - let outcome_root = self.get_root_from_merkle_proof_hashed_leaf( + let leaf = self.curta_sha256(&outcome_root.0 .0); + self.watch(&leaf, "leaf"); + + self.watch(outcome_root_proof, "outcome_root_proof"); + + let outcome_root = self.get_root_from_merkle_proof_hashed_leaf_unindex( &outcome_root_proof.path, &outcome_root_proof.indices, leaf, ); + self.watch(&outcome_root, "outcome_root"); self.is_equal(outcome_root, *expected) } @@ -231,7 +238,7 @@ impl, const D: usize> Verify for CircuitBuilder, block_hash: &CryptoHashVariable, ) -> BoolVariable { - let block_root = self.get_root_from_merkle_proof_hashed_leaf( + let block_root = self.get_root_from_merkle_proof_hashed_leaf_unindex( &block_proof.path, &block_proof.indices, *block_hash, @@ -385,13 +392,13 @@ impl, const D: usize> VerifyCircuit for CircuitBuild #[cfg(test)] mod tests { + use super::*; + use crate::variables::*; use near_light_client_protocol::{ - prelude::Header, LightClientBlockView, StakeInfo, ValidatorStake, + prelude::{BasicProof, Header}, + LightClientBlockView, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; - use plonky2x::frontend::eth::storage::vars::EthHeaderVariable; - - use super::*; fn fixture(file: &str) -> LightClientBlockView { serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) @@ -529,6 +536,31 @@ mod tests { builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); builder.write::(next_bps_is_valid); + let req = r#"{"outcome_proof":{"proof":[],"block_hash":"5CY72FinjVV2Hd5zRikYYMaKh67pftXJsw8vwRXAUAQF","id":"9UhBumQ3eEmPH5ALc3NwiDCQfDrFakteRD7rHE9CfZ32","outcome":{"logs":[],"receipt_ids":["2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"],"gas_burnt":2434069818500,"tokens_burnt":"243406981850000000000","executor_id":"datayalla.testnet","status":{"SuccessReceiptId":"2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"},"metadata":{"version":1,"gas_profile":null}}},"outcome_root_proof":[{"hash":"9f7YjLvzvSspJMMJ3DDTrFaEyPQ5qFqQDNoWzAbSTjTy","direction":"Right"},{"hash":"67ZxFmzWXbWJSyi7Wp9FTSbbJx2nMr7wSuW3EP1cJm4K","direction":"Left"}],"block_header_lite":{"prev_block_hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","inner_rest_hash":"G25j8jSWRyrXV317cPC3qYA4SyJWXsBfErjhBYQkxw5A","inner_lite":{"height":134481525,"epoch_id":"4tBzDozzGED3QiCRURfViVuyJy5ikaN9dVH7m2MYkTyw","next_epoch_id":"9gYJSiT3TQbKbwui5bdbzBA9PCMSSfiffWhBdMtcasm2","prev_state_root":"EwkRecSP8GRvaxL7ynCEoHhsL1ksU6FsHVLCevcccF5q","outcome_root":"8Eu5qpDUMpW5nbmTrTKmDH2VYqFEHTKPETSTpPoyGoGc","timestamp":1691615068679535000,"timestamp_nanosec":"1691615068679535094","next_bp_hash":"8LCFsP6LeueT4X3PEni9CMvH7maDYpBtfApWZdXmagss","block_merkle_root":"583vb6csYnczHyt5z6Msm4LzzGkceTZHdvXjC8vcWeGK"}},"block_proof":[{"hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","direction":"Left"},{"hash":"HgZaHXpb5zs4rxUQTeW69XBNLBJoo4sz2YEDh7aFnMpC","direction":"Left"},{"hash":"EYNXYsnESQkXo7B27a9xu6YgbDSyynNcByW5Q2SqAaKH","direction":"Right"},{"hash":"AbKbsD7snoSnmzAtwNqXLBT5sm7bZr48GCCLSdksFuzi","direction":"Left"},{"hash":"7KKmS7n3MtCfv7UqciidJ24Abqsk8m85jVQTh94KTjYS","direction":"Left"},{"hash":"5nKA1HCZMJbdCccZ16abZGEng4sMoZhKez74rcCFjnhL","direction":"Left"},{"hash":"BupagAycSLD7v42ksgMKJFiuCzCdZ6ksrGLwukw7Vfe3","direction":"Right"},{"hash":"D6v37P4kcVJh8N9bV417eqJoyMeQbuZ743oNsbKxsU7z","direction":"Right"},{"hash":"8sWxxbe1rdquP5VdYfQbw1UvtcXDRansJYJV5ySzyow4","direction":"Right"},{"hash":"CmKVKWRqEqi4UaeKKYXpPSesYqdQYwHQM3E4xLKEUAj8","direction":"Left"},{"hash":"3TvjFzVyPBvPpph5zL6VCASLCxdNeiKV6foPwUpAGqRv","direction":"Left"},{"hash":"AnzSG9f91ePS6L6ii3eAkocp4iKjp6wjzSwWsDYWLnMX","direction":"Right"},{"hash":"FYVJDL4T6c87An3pdeBvntB68NzpcPtpvLP6ifjxxNkr","direction":"Left"},{"hash":"2YMF6KE8XTz7Axj3uyAoFbZisWej9Xo8mxgVtauWCZaV","direction":"Left"},{"hash":"4BHtLcxqNfWSneBdW76qsd8om8Gjg58Qw5BX8PHz93hf","direction":"Left"},{"hash":"7G3QUT7NQSHyXNQyzm8dsaYrFk5LGhYaG7aVafKAekyG","direction":"Left"},{"hash":"3XaMNnvnX69gGqBJX43Na1bSTJ4VUe7z6h5ZYJsaSZZR","direction":"Left"},{"hash":"FKu7GtfviPioyAGXGZLBVTJeG7KY5BxGwuL447oAZxiL","direction":"Right"},{"hash":"BePd7DPKUQnGtnSds5fMJGBUwHGxSNBpaNLwceJGUcJX","direction":"Left"},{"hash":"2BVKWMd9pXZTEyE9D3KL52hAWAyMrXj1NqutamyurrY1","direction":"Left"},{"hash":"EWavHKhwQiT8ApnXvybvc9bFY6aJYJWqBhcrZpubKXtA","direction":"Left"},{"hash":"83Fsd3sdx5tsJkb6maBE1yViKiqbWCCNfJ4XZRsKnRZD","direction":"Left"},{"hash":"AaT9jQmUvVpgDHdFkLR2XctaUVdTti49enmtbT5hsoyL","direction":"Left"}]}"#; + let p: BasicProof = serde_json::from_str(req).unwrap(); + let outcome_hash = CryptoHash::hash_borsh(p.outcome_proof.to_hashes()); + + let outcome_proof: MerklePathVariableValue<0, _> = p.outcome_proof.proof.into(); + let outcome_proof = builder.constant::>(outcome_proof); + + let outcome_root_proof: MerklePathVariableValue<2, _> = p.outcome_root_proof.into(); + let outcome_root_proof = builder.constant::>(outcome_root_proof); + + let expected_outcome_root = builder + .constant::(p.block_header_lite.inner_lite.outcome_root.0.into()); + // outcome_root: "8891c92e4e1106f9433bdec481a50b4d49ea45591e5f829942bc4bd1b1fad6e0" + // leaf: "4efe13c031019dd7452a42cf735a5edebbe860244ec8539c2cb9ba936dc9ee23" + // outcome_root: "6b913ffe7a3a776d5f9352281c1e3dca4efcb816d014e69ad2d981c7a3073199" + + let outcome_hash = builder.constant::(outcome_hash.0.into()); + let root_matches = builder.verify_outcome( + &expected_outcome_root, + &outcome_proof, + &outcome_hash, + &outcome_root_proof, + ); + builder.write::(root_matches); + let circuit = builder.build(); let mut input = circuit.input(); @@ -562,6 +594,8 @@ mod tests { assert!(!stake_is_zero, "stake is zero"); let next_bps_is_valid = output.read::(); assert!(next_bps_is_valid, "next bps is valid"); + let outcome_root_matches = output.read::(); + assert!(outcome_root_matches); } #[test] diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index 78db03d..736521f 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -5,6 +5,7 @@ mod builder; mod codec; mod input; mod variables; +mod merkle; // TODO: // hint/generator for any queries for things that are offchain/expensive to do in a circuit diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs new file mode 100644 index 0000000..f9fef66 --- /dev/null +++ b/circuits/plonky2x/src/merkle.rs @@ -0,0 +1,44 @@ +use plonky2x::prelude::*; + +pub trait NearMerkleTree { + fn get_root_from_merkle_proof_hashed_leaf_unindex( + &mut self, + proof: &ArrayVariable, + path_indices: &ArrayVariable, + leaf: Bytes32Variable, + ) -> Bytes32Variable; + fn inner_hash(&mut self, left: &Bytes32Variable, right: &Bytes32Variable) -> Bytes32Variable; +} + +impl, const D: usize> NearMerkleTree for CircuitBuilder { + fn get_root_from_merkle_proof_hashed_leaf_unindex( + &mut self, + proof: &ArrayVariable, + path_indices: &ArrayVariable, + leaf: Bytes32Variable, + ) -> Bytes32Variable { + let mut hash_so_far = leaf; + + for i in 0..PROOF_DEPTH { + let aunt = proof[i]; + let path_index = path_indices[i]; + let left_hash_pair = self.inner_hash(&hash_so_far, &aunt); + let right_hash_pair = self.inner_hash(&aunt, &hash_so_far); + + hash_so_far = self.select(path_index, right_hash_pair, left_hash_pair) + } + hash_so_far + } + fn inner_hash(&mut self, left: &Bytes32Variable, right: &Bytes32Variable) -> Bytes32Variable { + let mut encoded_leaf = vec![]; + + // Append the left bytes to the one byte. + encoded_leaf.extend(left.as_bytes().to_vec()); + + // Append the right bytes to the bytes so far. + encoded_leaf.extend(right.as_bytes().to_vec()); + + // Load the output of the hash. + self.curta_sha256(&encoded_leaf) + } +} diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 5c7e421..37fbfc6 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -46,8 +46,8 @@ impl From for MerklePathVariableValue< let indices: Vec = value .iter() .map(|x| match x.direction { - near_light_client_protocol::Direction::Left => false, - near_light_client_protocol::Direction::Right => true, + near_light_client_protocol::Direction::Left => true, + near_light_client_protocol::Direction::Right => false, }) .collect(); Self { diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 417316c..994d5d2 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -155,8 +155,16 @@ impl Protocol { expected_outcome_root: &CryptoHash, ) -> bool { let outcome_root = compute_root_from_path(outcome_proof, *outcome_hash); + #[cfg(test)] + println!("outcome_root: {:?}", hex::encode(&outcome_root)); - let outcome_root = compute_root_from_path_and_item(outcome_root_proof, outcome_root); + let leaf = CryptoHash::hash_borsh(outcome_root); + #[cfg(test)] + println!("leaf: {:?}", hex::encode(&leaf)); + + let outcome_root = compute_root_from_path(outcome_root_proof, leaf); + #[cfg(test)] + println!("outcome_root: {:?}", hex::encode(&outcome_root)); log::debug!("outcome_root: {:?}", outcome_root); &outcome_root == expected_outcome_root diff --git a/crates/protocol/src/merkle_util.rs b/crates/protocol/src/merkle_util.rs index 0cab8d2..3f2ebb1 100644 --- a/crates/protocol/src/merkle_util.rs +++ b/crates/protocol/src/merkle_util.rs @@ -16,18 +16,18 @@ pub fn compute_root_from_path<'a>( path: impl Iterator, item_hash: MerkleHash, ) -> MerkleHash { - let mut res = item_hash; - for item in path { - match item.direction { + let mut hash_so_far = item_hash; + for uncle in path { + match uncle.direction { Direction::Left => { - res = combine_hash(&item.hash, &res); + hash_so_far = combine_hash(&uncle.hash, &hash_so_far); } Direction::Right => { - res = combine_hash(&res, &item.hash); + hash_so_far = combine_hash(&hash_so_far, &uncle.hash); } } } - res + hash_so_far } pub fn compute_root_from_path_and_item<'a, T: BorshSerialize>( From e11f07903740e545149105658f6ee9f323f48919 Mon Sep 17 00:00:00 2001 From: dndll Date: Wed, 10 Jan 2024 17:34:46 +0000 Subject: [PATCH 09/67] wip: block roots --- circuits/plonky2x/src/builder.rs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 03154af..19e09a1 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -392,6 +392,8 @@ impl, const D: usize> VerifyCircuit for CircuitBuild #[cfg(test)] mod tests { + use std::str::FromStr; + use super::*; use crate::variables::*; use near_light_client_protocol::{ @@ -399,8 +401,9 @@ mod tests { LightClientBlockView, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; + use serde::de::DeserializeOwned; - fn fixture(file: &str) -> LightClientBlockView { + fn fixture(file: &str) -> T { serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) .unwrap() } @@ -536,12 +539,14 @@ mod tests { builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); builder.write::(next_bps_is_valid); - let req = r#"{"outcome_proof":{"proof":[],"block_hash":"5CY72FinjVV2Hd5zRikYYMaKh67pftXJsw8vwRXAUAQF","id":"9UhBumQ3eEmPH5ALc3NwiDCQfDrFakteRD7rHE9CfZ32","outcome":{"logs":[],"receipt_ids":["2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"],"gas_burnt":2434069818500,"tokens_burnt":"243406981850000000000","executor_id":"datayalla.testnet","status":{"SuccessReceiptId":"2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"},"metadata":{"version":1,"gas_profile":null}}},"outcome_root_proof":[{"hash":"9f7YjLvzvSspJMMJ3DDTrFaEyPQ5qFqQDNoWzAbSTjTy","direction":"Right"},{"hash":"67ZxFmzWXbWJSyi7Wp9FTSbbJx2nMr7wSuW3EP1cJm4K","direction":"Left"}],"block_header_lite":{"prev_block_hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","inner_rest_hash":"G25j8jSWRyrXV317cPC3qYA4SyJWXsBfErjhBYQkxw5A","inner_lite":{"height":134481525,"epoch_id":"4tBzDozzGED3QiCRURfViVuyJy5ikaN9dVH7m2MYkTyw","next_epoch_id":"9gYJSiT3TQbKbwui5bdbzBA9PCMSSfiffWhBdMtcasm2","prev_state_root":"EwkRecSP8GRvaxL7ynCEoHhsL1ksU6FsHVLCevcccF5q","outcome_root":"8Eu5qpDUMpW5nbmTrTKmDH2VYqFEHTKPETSTpPoyGoGc","timestamp":1691615068679535000,"timestamp_nanosec":"1691615068679535094","next_bp_hash":"8LCFsP6LeueT4X3PEni9CMvH7maDYpBtfApWZdXmagss","block_merkle_root":"583vb6csYnczHyt5z6Msm4LzzGkceTZHdvXjC8vcWeGK"}},"block_proof":[{"hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","direction":"Left"},{"hash":"HgZaHXpb5zs4rxUQTeW69XBNLBJoo4sz2YEDh7aFnMpC","direction":"Left"},{"hash":"EYNXYsnESQkXo7B27a9xu6YgbDSyynNcByW5Q2SqAaKH","direction":"Right"},{"hash":"AbKbsD7snoSnmzAtwNqXLBT5sm7bZr48GCCLSdksFuzi","direction":"Left"},{"hash":"7KKmS7n3MtCfv7UqciidJ24Abqsk8m85jVQTh94KTjYS","direction":"Left"},{"hash":"5nKA1HCZMJbdCccZ16abZGEng4sMoZhKez74rcCFjnhL","direction":"Left"},{"hash":"BupagAycSLD7v42ksgMKJFiuCzCdZ6ksrGLwukw7Vfe3","direction":"Right"},{"hash":"D6v37P4kcVJh8N9bV417eqJoyMeQbuZ743oNsbKxsU7z","direction":"Right"},{"hash":"8sWxxbe1rdquP5VdYfQbw1UvtcXDRansJYJV5ySzyow4","direction":"Right"},{"hash":"CmKVKWRqEqi4UaeKKYXpPSesYqdQYwHQM3E4xLKEUAj8","direction":"Left"},{"hash":"3TvjFzVyPBvPpph5zL6VCASLCxdNeiKV6foPwUpAGqRv","direction":"Left"},{"hash":"AnzSG9f91ePS6L6ii3eAkocp4iKjp6wjzSwWsDYWLnMX","direction":"Right"},{"hash":"FYVJDL4T6c87An3pdeBvntB68NzpcPtpvLP6ifjxxNkr","direction":"Left"},{"hash":"2YMF6KE8XTz7Axj3uyAoFbZisWej9Xo8mxgVtauWCZaV","direction":"Left"},{"hash":"4BHtLcxqNfWSneBdW76qsd8om8Gjg58Qw5BX8PHz93hf","direction":"Left"},{"hash":"7G3QUT7NQSHyXNQyzm8dsaYrFk5LGhYaG7aVafKAekyG","direction":"Left"},{"hash":"3XaMNnvnX69gGqBJX43Na1bSTJ4VUe7z6h5ZYJsaSZZR","direction":"Left"},{"hash":"FKu7GtfviPioyAGXGZLBVTJeG7KY5BxGwuL447oAZxiL","direction":"Right"},{"hash":"BePd7DPKUQnGtnSds5fMJGBUwHGxSNBpaNLwceJGUcJX","direction":"Left"},{"hash":"2BVKWMd9pXZTEyE9D3KL52hAWAyMrXj1NqutamyurrY1","direction":"Left"},{"hash":"EWavHKhwQiT8ApnXvybvc9bFY6aJYJWqBhcrZpubKXtA","direction":"Left"},{"hash":"83Fsd3sdx5tsJkb6maBE1yViKiqbWCCNfJ4XZRsKnRZD","direction":"Left"},{"hash":"AaT9jQmUvVpgDHdFkLR2XctaUVdTti49enmtbT5hsoyL","direction":"Left"}]}"#; - let p: BasicProof = serde_json::from_str(req).unwrap(); + let p: BasicProof = fixture("old.json"); let outcome_hash = CryptoHash::hash_borsh(p.outcome_proof.to_hashes()); + const OUTCOME_PROOF_AMT: usize = 2; - let outcome_proof: MerklePathVariableValue<0, _> = p.outcome_proof.proof.into(); - let outcome_proof = builder.constant::>(outcome_proof); + let outcome_proof: MerklePathVariableValue = + p.outcome_proof.proof.into(); + let outcome_proof = + builder.constant::>(outcome_proof); let outcome_root_proof: MerklePathVariableValue<2, _> = p.outcome_root_proof.into(); let outcome_root_proof = builder.constant::>(outcome_root_proof); @@ -561,6 +566,16 @@ mod tests { ); builder.write::(root_matches); + let expected_root = + CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); + let expected_root = builder.constant::(expected_root.0.into()); + + let block_proof: MerklePathVariableValue<26, _> = p.block_proof.into(); + let block_proof = builder.constant::>(block_proof); + let block_hash = builder.constant::(p.block_header_lite.hash().0.into()); + builder.verify_block(&expected_root, &block_proof, &block_hash); + builder.write::(root_matches); + let circuit = builder.build(); let mut input = circuit.input(); @@ -596,6 +611,8 @@ mod tests { assert!(next_bps_is_valid, "next bps is valid"); let outcome_root_matches = output.read::(); assert!(outcome_root_matches); + let block_root_matches = output.read::(); + assert!(block_root_matches); } #[test] From c2ffa3da7c174ac830359a1abf0fe84ff12b122d Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 11 Jan 2024 10:45:59 +0000 Subject: [PATCH 10/67] wip: test next bps --- circuits/plonky2x/Cargo.toml | 4 ++-- circuits/plonky2x/src/builder.rs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index e78f7f9..e479e32 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -14,12 +14,12 @@ serde.workspace = true plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } -near-light-client-protocol = { path = "../../crates/protocol" } +near-light-client-protocol = { path = "../../crates/protocol" } [dev-dependencies] borsh.workspace = true hex.workspace = true -near-primitives.workspace = true +near-primitives.workspace = true pretty_env_logger.workspace = true serde_json.workspace = true diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 19e09a1..c7726bb 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -333,6 +333,8 @@ impl, const D: usize> SyncCircuit for CircuitBuilder c = self.ensure_stake_is_sufficient(&stake); self.assertx(c); + + //c = self.ensure_next_bps_is_valid(&head.inner_lite.next_bp_hash, next_block.next_bps) // Self::ensure_next_bps_is_valid( // &next_block.inner_lite.next_bp_hash, // next_block.next_bps, @@ -469,6 +471,7 @@ mod tests { assert_eq!(hash.0, expected_hash); } + // TODO: split humungous test into smaller ones #[test] fn test_ensures() { pretty_env_logger::try_init().unwrap_or_default(); @@ -572,10 +575,18 @@ mod tests { let block_proof: MerklePathVariableValue<26, _> = p.block_proof.into(); let block_proof = builder.constant::>(block_proof); - let block_hash = builder.constant::(p.block_header_lite.hash().0.into()); + let block_hash = + builder.constant::(p.block_header_lite.hash().0.into()); builder.verify_block(&expected_root, &block_proof, &block_hash); builder.write::(root_matches); + let next_bps_hash = CryptoHash::hash_borsh(&test_bps); + + let next_bps_hash = builder.constant::(next_bps_hash.0.into()); + let next_bps_hash_matches = + builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); + builder.write::(next_bps_hash_matches); + let circuit = builder.build(); let mut input = circuit.input(); @@ -613,6 +624,8 @@ mod tests { assert!(outcome_root_matches); let block_root_matches = output.read::(); assert!(block_root_matches); + let next_bps_hash_matches = output.read::(); + assert!(next_bps_hash_matches); } #[test] From 9ea6f656c2a96ff7bbbb475de2831382ea884d47 Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 11 Jan 2024 11:26:32 +0000 Subject: [PATCH 11/67] wip: verify inclusion proof tests --- circuits/plonky2x/src/builder.rs | 51 ++++++++++++++++++++++-------- circuits/plonky2x/src/lib.rs | 11 +++++-- circuits/plonky2x/src/variables.rs | 14 +++++--- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index c7726bb..7cf683e 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -365,30 +365,42 @@ impl, const D: usize> SyncCircuit for CircuitBuilder } pub trait VerifyCircuit, const D: usize> { - fn verify(&mut self, proof: ProofVariable); + fn verify( + &mut self, + proof: ProofVariable, + ) -> BoolVariable; } impl, const D: usize> VerifyCircuit for CircuitBuilder { - fn verify(&mut self, proof: ProofVariable) { + fn verify( + &mut self, + proof: ProofVariable, + ) -> BoolVariable { let block_hash = self.header_hash( &proof.block_header.inner_lite, &proof.block_header.inner_rest_hash, &proof.block_header.prev_block_hash, ); - let mut c = self.is_equal(block_hash, proof.outcome_proof_block_hash); - self.assertx(c); + let block_hash_matches = self.is_equal(block_hash, proof.outcome_proof_block_hash); + self.watch(&block_hash_matches, "block_hash_matches"); - c = self.verify_outcome( + let outcome_matches = self.verify_outcome( &proof.block_header.inner_lite.outcome_root, &proof.outcome_proof, &proof.outcome_hash, &proof.outcome_root_proof, ); - self.assertx(c); + self.watch(&outcome_matches, "outcome_matches"); - c = self.verify_block(&proof.head_block_root, &proof.block_proof, &block_hash); - self.assertx(c); + let block_matches = + self.verify_block(&proof.head_block_root, &proof.block_proof, &block_hash); + self.watch(&block_matches, "block_matches"); + + let verified = self.and(block_matches, outcome_matches); + let verified = self.and(verified, block_hash_matches); + self.assertx(verified); + verified } } @@ -400,7 +412,7 @@ mod tests { use crate::variables::*; use near_light_client_protocol::{ prelude::{BasicProof, Header}, - LightClientBlockView, StakeInfo, ValidatorStake, + LightClientBlockView, Proof, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; use serde::de::DeserializeOwned; @@ -542,6 +554,9 @@ mod tests { builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); builder.write::(next_bps_is_valid); + let expected_root = + CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); + let p: BasicProof = fixture("old.json"); let outcome_hash = CryptoHash::hash_borsh(p.outcome_proof.to_hashes()); const OUTCOME_PROOF_AMT: usize = 2; @@ -569,15 +584,13 @@ mod tests { ); builder.write::(root_matches); - let expected_root = - CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); - let expected_root = builder.constant::(expected_root.0.into()); + let expected = builder.constant::(expected_root.0.clone().into()); let block_proof: MerklePathVariableValue<26, _> = p.block_proof.into(); let block_proof = builder.constant::>(block_proof); let block_hash = builder.constant::(p.block_header_lite.hash().0.into()); - builder.verify_block(&expected_root, &block_proof, &block_hash); + builder.verify_block(&expected, &block_proof, &block_hash); builder.write::(root_matches); let next_bps_hash = CryptoHash::hash_borsh(&test_bps); @@ -587,6 +600,16 @@ mod tests { builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); builder.write::(next_bps_hash_matches); + let registered_p = builder.constant::>( + near_light_client_protocol::Proof::Basic { + head_block_root: expected_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); + let proof_verified = builder.verify(registered_p); + builder.write::(proof_verified); + let circuit = builder.build(); let mut input = circuit.input(); @@ -626,6 +649,8 @@ mod tests { assert!(block_root_matches); let next_bps_hash_matches = output.read::(); assert!(next_bps_hash_matches); + let proof_verified = output.read::(); + assert!(proof_verified); } #[test] diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index 736521f..b9e4fe3 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,11 +1,13 @@ use plonky2x::prelude::*; -use variables::{BlockVariable, HeaderVariable, ProofVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS}; +use variables::{ + BlockVariable, HeaderVariable, ProofVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, +}; mod builder; mod codec; mod input; -mod variables; mod merkle; +mod variables; // TODO: // hint/generator for any queries for things that are offchain/expensive to do in a circuit @@ -29,7 +31,10 @@ pub trait SyncCircuit, const D: usize> { } pub trait VerifyCircuit, const D: usize> { - fn verify(&mut self, proof: ProofVariable) -> bool; + fn verify( + &mut self, + proof: ProofVariable, + ) -> bool; } #[cfg(test)] diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 37fbfc6..2cb81d8 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -252,18 +252,22 @@ impl From>> for SignatureVariableValue { } #[derive(CircuitVariable, Clone, Debug)] -pub struct ProofVariable { +pub struct ProofVariable { pub head_block_root: CryptoHashVariable, // TODO: make variable pub outcome_proof: ExecutionOutcomeWithId, pub outcome_hash: CryptoHashVariable, pub outcome_proof_block_hash: CryptoHashVariable, - pub outcome_proof: MerklePathVariable<32>, // TODO: get real number here - pub outcome_root_proof: MerklePathVariable<32>, // TODO: get real number here + pub outcome_proof: MerklePathVariable, // TODO: get real number here + pub outcome_root_proof: MerklePathVariable, // TODO: get real number here pub block_header: HeaderVariable, - pub block_proof: MerklePathVariable<256>, // TODO: get real number here + pub block_proof: MerklePathVariable, // TODO: get real number here } -impl From for ProofVariableValue { +impl + From for ProofVariableValue +where + F: RichField, +{ fn from(proof: near_light_client_protocol::Proof) -> Self { match proof { near_light_client_protocol::Proof::Basic { From c616908180dee708f90cf9556e157ea19f410d3b Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 11 Jan 2024 11:53:54 +0000 Subject: [PATCH 12/67] wip: full sync --- circuits/plonky2x/src/builder.rs | 139 ++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 3 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 7cf683e..7651655 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -314,7 +314,15 @@ impl, const D: usize> SyncCircuit for CircuitBuilder ); self.assertx(c); + let new_head = HeaderVariable { + prev_block_hash: next_block.prev_block_hash, + inner_rest_hash: next_block.inner_rest_hash, + inner_lite: next_block.inner_lite.clone(), + }; + self.watch(&new_head, "new_head"); + let approval = self.reconstruct_approval_message(&next_block); + self.watch(&approval, "approval_msg"); let signatures_eddsa = next_block .approvals_after_next @@ -330,6 +338,7 @@ impl, const D: usize> SyncCircuit for CircuitBuilder epoch_bps, approval, ); + self.watch(&stake, "stake"); c = self.ensure_stake_is_sufficient(&stake); self.assertx(c); @@ -340,8 +349,8 @@ impl, const D: usize> SyncCircuit for CircuitBuilder // next_block.next_bps, // ) // - // TODO: decide what to write here - // self.evm_write(new_head); + // TODO: decide what to write here for evm + self.write(new_head); // self.evm_write(next_block.inner_lite.block_merkle_root); } @@ -412,7 +421,7 @@ mod tests { use crate::variables::*; use near_light_client_protocol::{ prelude::{BasicProof, Header}, - LightClientBlockView, Proof, StakeInfo, ValidatorStake, + EpochId, LightClientBlockView, Proof, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; use serde::de::DeserializeOwned; @@ -429,6 +438,29 @@ mod tests { fixture("1.json") } + fn view_to_lite_view(h: LightClientBlockView) -> Header { + Header { + prev_block_hash: h.prev_block_hash, + inner_rest_hash: h.inner_rest_hash, + inner_lite: h.inner_lite, + } + } + fn test_state() -> (Header, Vec, LightClientBlockView) { + let first = get_first_epoch(); + let next = get_next_epoch(); + + ( + view_to_lite_view(first.clone()), + first + .next_bps + .clone() + .unwrap() + .into_iter() + .map(Into::into) + .collect(), + next, + ) + } fn to_header(bv: LightClientBlockView) -> Header { Header { prev_block_hash: bv.prev_block_hash, @@ -653,6 +685,107 @@ mod tests { assert!(proof_verified); } + // TODO: split humungous test into smaller ones + #[test] + fn test_basic_inclusion_proof() { + pretty_env_logger::try_init().unwrap_or_default(); + let test_header = get_first_epoch(); + let test_header = to_header(test_header); + + let expected_root = + CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); + + let mut builder = DefaultBuilder::new(); + + let registered_p = builder.constant::>( + near_light_client_protocol::Proof::Basic { + head_block_root: expected_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); + let proof_verified = builder.verify(registered_p); + builder.write::(proof_verified); + + let circuit = builder.build(); + let mut input = circuit.input(); + + input.write::(test_header.into()); + + let (_proof, mut output) = circuit.prove(&input); + + assert!(output.read::()) + } + + // TODO: split humungous test into smaller ones + #[test] + fn test_sync_accross_boundaries() { + pretty_env_logger::try_init().unwrap_or_default(); + let (mut head, mut next_bps, next_block) = test_state(); + let mut next_epoch_id = EpochId(head.inner_lite.next_epoch_id); + + let mut builder = DefaultBuilder::new(); + let header_var = builder.read::(); + let bps_var = builder.read::>(); + let next_block_var = builder.read::(); + + builder.sync(header_var, bps_var, next_block_var); + // let mut sync_and_update = |next_block: LightClientBlockView| { + // let next_bps = builder + // .constant::>( + // bps_var + // .clone() + // .into_iter() + // .map(|s| Into::::into(s)) + // .map(Into::into) + // .collect(), + // ); + // let next_block = builder.constant::(next_block.clone().into()); + // // // Assert we matched the epoch id for the new BPS + // // assert_eq!( + // // head.inner_lite.next_epoch_id, + // // sync_next.next_bps.as_ref().unwrap().0 .0 + // // ); + // // + // // head = sync_next.new_head; + // // next_bps = sync_next.next_bps.unwrap().1; + // // + // // // Assert new head is the new block + // // assert_eq!(head.inner_lite, next_block.inner_lite); + // // // Assert new BPS is from the next block producers because we're + // // // in an epoch boundary + // // assert_eq!( + // // &next_bps, + // // &next_block + // // .next_bps + // // .unwrap() + // // .into_iter() + // // .map(Into::into) + // // .collect_vec() + // // ); + // // next_epoch_id.0 = head.inner_lite.next_epoch_id; + // }; + // sync_and_update(next_block_var.clone()); + // + let circuit = builder.build(); + let mut input = circuit.input(); + + input.write::(head.into()); + input.write::>( + next_bps + .clone() + .into_iter() + .map(|s| Into::::into(s)) + .map(Into::into) + .collect(), + ); + input.write::(next_block.clone().into()); + + let (proof, mut output) = circuit.prove(&input); + + let header = output.read::(); + println!("header: {:?}", header); + } #[test] fn test_reconstruct_approval_msg() {} } From 4b987d4d71a4a90a862ec117e431ffbe10ce6b2d Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 11 Jan 2024 17:07:18 +0000 Subject: [PATCH 13/67] wip: splitting tests --- circuits/plonky2x/src/builder.rs | 136 +++++++++++++++++++++++-------- crates/protocol/src/lib.rs | 1 - 2 files changed, 100 insertions(+), 37 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 7651655..468ecb4 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -2,10 +2,9 @@ use crate::merkle::NearMerkleTree; use crate::variables::{ BlockHeightVariable, BlockVariable, BuildEndorsement, CryptoHashVariable, HeaderInnerVariable, HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, PublicKeyVariable, - SignatureVariable, StakeInfoVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, + StakeInfoVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, }; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; -use plonky2x::frontend::merkle::tendermint::TendermintMerkleTree; use plonky2x::prelude::*; pub trait Verify, const D: usize> { @@ -517,11 +516,92 @@ mod tests { // TODO: split humungous test into smaller ones #[test] + #[test] + fn test_ensure_height() { + pretty_env_logger::try_init().unwrap_or_default(); + let test_header = get_first_epoch(); + let test_bps = test_header.next_bps.clone().unwrap_or_default(); + let test_header = to_header(test_header); + + let mut builder = DefaultBuilder::new(); + let header = builder.read::(); + + let early_block_height = builder.constant::(1); + let later_block_height = builder.constant::(test_header.inner_lite.height + 1); + + let r = builder.ensure_not_already_verified(&header, &early_block_height); + builder.write::(r); + + let r = builder.ensure_not_already_verified(&header, &later_block_height); + + let circuit = builder.build(); + let mut input = circuit.input(); + + input.write::(test_header.into()); + + let (proof, mut output) = circuit.prove(&input); + + assert!(!output.read::(), "too early"); + assert!(output.read::(), "height is later"); + } + fn test_ensure_next_bps() { + pretty_env_logger::try_init().unwrap_or_default(); + let test_header = get_first_epoch(); + let test_bps = test_header.next_bps.clone().unwrap_or_default(); + let test_header = to_header(test_header); + + let mut builder = DefaultBuilder::new(); + let header = builder.read::(); + + let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); + builder.write::(r); + let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.next_epoch_id); + builder.write::(r); + + let next_bps = builder + .constant::>( + test_bps + .clone() + .into_iter() + .map(|s| Into::::into(s)) + .map(Into::into) + .collect(), + ); + let r = builder.ensure_if_next_epoch_contains_next_bps( + &header, + &header.inner_lite.next_epoch_id, + &next_bps, + ); + builder.write::(r); + + let next_bps_hash = CryptoHash::hash_borsh(test_bps.clone()); + let next_bps_hash = builder.constant::(next_bps_hash.0.into()); + + let next_bps_is_valid = + builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); + builder.write::(next_bps_is_valid); + + let next_bps_hash = CryptoHash::hash_borsh(&test_bps); + let next_bps_hash = builder.constant::(next_bps_hash.0.into()); + let next_bps_hash_matches = + builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); + builder.write::(next_bps_hash_matches); + + let circuit = builder.build(); + let mut input = circuit.input(); + + input.write::(test_header.into()); + + let (proof, mut output) = circuit.prove(&input); + + assert!(output.read::(), "next epoch has bps"); + assert!(output.read::(), "next bps is valid"); + assert!(output.read::(), "next bps hash matches"); + } fn test_ensures() { pretty_env_logger::try_init().unwrap_or_default(); let test_header = get_first_epoch(); let test_bps = test_header.next_bps.clone().unwrap_or_default(); - println!("test_bps: {:?}", test_bps.len()); let test_header = to_header(test_header); let mut builder = DefaultBuilder::new(); @@ -603,9 +683,6 @@ mod tests { let expected_outcome_root = builder .constant::(p.block_header_lite.inner_lite.outcome_root.0.into()); - // outcome_root: "8891c92e4e1106f9433bdec481a50b4d49ea45591e5f829942bc4bd1b1fad6e0" - // leaf: "4efe13c031019dd7452a42cf735a5edebbe860244ec8539c2cb9ba936dc9ee23" - // outcome_root: "6b913ffe7a3a776d5f9352281c1e3dca4efcb816d014e69ad2d981c7a3073199" let outcome_hash = builder.constant::(outcome_hash.0.into()); let root_matches = builder.verify_outcome( @@ -649,40 +726,27 @@ mod tests { let (proof, mut output) = circuit.prove(&input); - let height_not_verified = output.read::(); - assert!(!height_not_verified, "height was not verified"); - let height_verified = output.read::(); - assert!(height_verified, "height was verified"); - let epoch_current = output.read::(); - assert!(epoch_current, "epoch was current"); - let epoch_next = output.read::(); - assert!(epoch_next, "epoch was next"); - let next_epoch_has_bps = output.read::(); - assert!(next_epoch_has_bps, "next epoch has bps"); - let stake_is_equal_to_threshold = output.read::(); + assert!(!output.read::(), "too early"); + assert!(output.read::(), "height it later"); + assert!(output.read::(), "current epoch"); + assert!(output.read::(), "next epoch"); + + assert!(output.read::(), "next epoch has bps"); + assert!(output.read::(), "stake is equal to threshold"); assert!( - stake_is_equal_to_threshold, - "stake equal to threshold is ok" + !output.read::(), + "stake is less than threshold" ); - let stake_is_less_than_threshold = output.read::(); - assert!(!stake_is_less_than_threshold, "stake less than threshold"); - let stake_is_greater_than_threshold = output.read::(); assert!( - stake_is_greater_than_threshold, - "stake greater than threshold" + output.read::(), + "stake is greater than threshold" ); - let stake_is_zero = output.read::(); - assert!(!stake_is_zero, "stake is zero"); - let next_bps_is_valid = output.read::(); - assert!(next_bps_is_valid, "next bps is valid"); - let outcome_root_matches = output.read::(); - assert!(outcome_root_matches); - let block_root_matches = output.read::(); - assert!(block_root_matches); - let next_bps_hash_matches = output.read::(); - assert!(next_bps_hash_matches); - let proof_verified = output.read::(); - assert!(proof_verified); + assert!(!output.read::(), "stake is zero"); + assert!(output.read::(), "next bps is valid"); + assert!(output.read::(), "outcome root matches"); + assert!(output.read::(), "block root matches"); + assert!(output.read::(), "next bps hash matches"); + assert!(output.read::(), "proof verified"); } // TODO: split humungous test into smaller ones diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 994d5d2..8a04799 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -112,7 +112,6 @@ impl Protocol { synced }) } - pub fn inclusion_proof_verify(proof: Proof) -> Result { match proof { Proof::Experimental(proof) => Ok(experimental::verify_proof(proof)), From 0454f7e437eb0f5ee2fd5946f96269423665b61f Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 12 Jan 2024 09:20:14 +0000 Subject: [PATCH 14/67] test: split up the testss --- circuits/plonky2x/src/builder.rs | 565 +++++++++++++---------------- circuits/plonky2x/src/variables.rs | 13 +- 2 files changed, 271 insertions(+), 307 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 468ecb4..f523942 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -153,8 +153,8 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder, const D: usize> SyncCircuit for CircuitBuilder &next_block.prev_block_hash, ); - let next_block_hash = self.sha256_pair(next_block.next_block_inner_hash, next_header_hash); + let next_block_hash = + self.curta_sha256_pair(next_block.next_block_inner_hash, next_header_hash); let mut input_stream = VariableStream::new(); input_stream.write(&next_block_hash); @@ -423,8 +424,13 @@ mod tests { EpochId, LightClientBlockView, Proof, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; + use plonky2x::backend::circuit::{PublicInput, PublicOutput}; use serde::de::DeserializeOwned; + type B = CircuitBuilder; + type PI = PublicInput; + type PO = PublicOutput; + fn fixture(file: &str) -> T { serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) .unwrap() @@ -468,332 +474,303 @@ mod tests { } } - fn default_env() { - let mut builder = DefaultBuilder::new(); - // let mut pw = PartialWitness::new(); - let x1 = 10; - let x = builder.init::(); - // - // x.set(&mut pw, x1); - // - // assert_eq!(x.get(&pw), x1); - // - // println!("x1: {:?}", x1.to_le_bytes()); - // println!("x: {:?}", x.encode(&mut builder)); - // - // let circuit = builder.build(); - // let proof = circuit.data.prove(pw).unwrap(); - // circuit.data.verify(proof).unwrap(); - } - - #[test] - fn test_header_hash() { + // TODO: define inputs and logic at once + fn builder_suite( + define: F, + writer: WriteInputs, + assertions: Assertions, + ) where + F: FnOnce(&mut B), + WriteInputs: FnOnce(&mut PI), + Assertions: FnOnce(PO), + { pretty_env_logger::try_init().unwrap_or_default(); - let mut builder = DefaultBuilder::new(); - let header = builder.read::(); - - let result = builder.header_hash( - &header.inner_lite, - &header.inner_rest_hash, - &header.prev_block_hash, - ); - builder.write(result); + let mut builder = B::new(); + define(&mut builder); let circuit = builder.build(); - let mut input = circuit.input(); - let header = to_header(fixture("1.json")); - let expected_hash = header.hash().0; - println!("expected_hash: {:?}", hex!(expected_hash)); + let mut inputs = circuit.input(); + writer(&mut inputs); - input.write::(header.into()); - let (_proof, mut output) = circuit.prove(&input); + let (proof, output) = circuit.prove(&inputs); - let hash = output.read::(); - assert_eq!(hash.0, expected_hash); + assertions(output.clone()); + + circuit.verify(&proof, &inputs, &output); } - // TODO: split humungous test into smaller ones - #[test] #[test] - fn test_ensure_height() { - pretty_env_logger::try_init().unwrap_or_default(); - let test_header = get_first_epoch(); - let test_bps = test_header.next_bps.clone().unwrap_or_default(); - let test_header = to_header(test_header); - - let mut builder = DefaultBuilder::new(); - let header = builder.read::(); - - let early_block_height = builder.constant::(1); - let later_block_height = builder.constant::(test_header.inner_lite.height + 1); - - let r = builder.ensure_not_already_verified(&header, &early_block_height); - builder.write::(r); - - let r = builder.ensure_not_already_verified(&header, &later_block_height); - - let circuit = builder.build(); - let mut input = circuit.input(); + fn test_header_hash() { + let header = to_header(fixture("1.json")); + let expected_hash = header.hash().0; - input.write::(test_header.into()); + let define = |builder: &mut B| { + let header = builder.read::(); + let result = builder.header_hash( + &header.inner_lite, + &header.inner_rest_hash, + &header.prev_block_hash, + ); + builder.write(result); + }; - let (proof, mut output) = circuit.prove(&input); + let writer = |input: &mut PI| { + input.write::(header.into()); + }; - assert!(!output.read::(), "too early"); - assert!(output.read::(), "height is later"); + let assertions = |mut output: PO| { + let hash = output.read::(); + assert_eq!(hash.0, expected_hash); + }; + builder_suite(define, writer, assertions); } - fn test_ensure_next_bps() { - pretty_env_logger::try_init().unwrap_or_default(); - let test_header = get_first_epoch(); - let test_bps = test_header.next_bps.clone().unwrap_or_default(); - let test_header = to_header(test_header); - - let mut builder = DefaultBuilder::new(); - let header = builder.read::(); - let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); - builder.write::(r); - let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.next_epoch_id); - builder.write::(r); - - let next_bps = builder - .constant::>( - test_bps - .clone() - .into_iter() - .map(|s| Into::::into(s)) - .map(Into::into) - .collect(), + #[test] + fn test_stake() { + let approved_stakes = [200, 199, 201, 0]; + + let define = |builder: &mut B| { + let mut stake_info = builder.constant::( + StakeInfo { + total: 300, + approved: 0, + } + .into(), ); - let r = builder.ensure_if_next_epoch_contains_next_bps( - &header, - &header.inner_lite.next_epoch_id, - &next_bps, - ); - builder.write::(r); - let next_bps_hash = CryptoHash::hash_borsh(test_bps.clone()); - let next_bps_hash = builder.constant::(next_bps_hash.0.into()); + for _ in 0..approved_stakes.len() { + stake_info.approved = builder.read::(); + let is_sufficient = builder.ensure_stake_is_sufficient(&stake_info); + builder.write::(is_sufficient); + } + }; + let writer = |input: &mut PI| { + for stake in approved_stakes { + input.write::(stake.into()); + } + }; + let assertions = |mut output: PO| { + assert!(output.read::(), "stake is equal to threshold"); + assert!( + !output.read::(), + "stake is less than threshold" + ); + assert!( + output.read::(), + "stake is greater than threshold" + ); + assert!(!output.read::(), "stake is zero"); + }; + builder_suite(define, writer, assertions); + } - let next_bps_is_valid = - builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); - builder.write::(next_bps_is_valid); + #[test] + fn test_ensure_height() { + let test_header = to_header(get_first_epoch()); + let define = |builder: &mut B| { + let header = builder.read::(); - let next_bps_hash = CryptoHash::hash_borsh(&test_bps); - let next_bps_hash = builder.constant::(next_bps_hash.0.into()); - let next_bps_hash_matches = - builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); - builder.write::(next_bps_hash_matches); + let early_block_height = builder.constant::(1); + let one = builder.one(); + let later_block_height = builder.add(header.inner_lite.height, one); - let circuit = builder.build(); - let mut input = circuit.input(); + let r = builder.ensure_not_already_verified(&header, &early_block_height); + builder.write::(r); - input.write::(test_header.into()); + let r = builder.ensure_not_already_verified(&header, &later_block_height); + builder.write::(r); + }; + let writer = |input: &mut PI| { + input.write::(test_header.into()); + }; + let assertions = |mut output: PO| { + assert!(!output.read::(), "too early"); + assert!(output.read::(), "height is later"); + }; + builder_suite(define, writer, assertions); + } - let (proof, mut output) = circuit.prove(&input); + #[test] + fn test_ensure_next_bps() { + let header = get_first_epoch(); + let bps = header.next_bps.clone().unwrap_or_default(); + let bps_hash = CryptoHash::hash_borsh(bps.clone()); + let header = to_header(header); + + let define = |builder: &mut B| { + let header = builder.read::(); + let next_bps = + builder.read::>(); + + let current = + builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); + builder.write::(current); + let next = + builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.next_epoch_id); + builder.write::(next); + + let contains_next_bps = builder.ensure_if_next_epoch_contains_next_bps( + &header, + &header.inner_lite.next_epoch_id, + &next_bps, + ); + builder.write::(contains_next_bps); - assert!(output.read::(), "next epoch has bps"); - assert!(output.read::(), "next bps is valid"); - assert!(output.read::(), "next bps hash matches"); - } - fn test_ensures() { - pretty_env_logger::try_init().unwrap_or_default(); - let test_header = get_first_epoch(); - let test_bps = test_header.next_bps.clone().unwrap_or_default(); - let test_header = to_header(test_header); - - let mut builder = DefaultBuilder::new(); - let header = builder.read::(); - - let early_block_height = builder.constant::(1); - let later_block_height = builder.constant::(test_header.inner_lite.height + 1); - - let r = builder.ensure_not_already_verified(&header, &early_block_height); - builder.write::(r); - let r = builder.ensure_not_already_verified(&header, &later_block_height); - builder.write::(r); - let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); - builder.write::(r); - let r = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.next_epoch_id); - builder.write::(r); - - let next_bps = builder - .constant::>( - test_bps - .clone() + let next_bps_hash = builder.constant::(bps_hash.0.into()); + let is_valid = builder + .ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); + builder.write::(is_valid); + }; + let writer = |input: &mut PI| { + input.write::(header.into()); + input.write::>( + bps.clone() .into_iter() .map(|s| Into::::into(s)) .map(Into::into) .collect(), - ); - let r = builder.ensure_if_next_epoch_contains_next_bps( - &header, - &header.inner_lite.next_epoch_id, - &next_bps, - ); - builder.write::(r); - - let mut stake = StakeInfo { - total: 300, - approved: 200, + ) }; + let assertions = |mut output: PO| { + assert!(output.read::(), "epoch is current"); + assert!(output.read::(), "epoch is next"); + assert!(output.read::(), "next epoch has bps"); + assert!(output.read::(), "next bps is valid"); + }; + builder_suite(define, writer, assertions); + } - let stake_info = builder.constant::(stake.clone().into()); - let stake_is_equal_to_threshold = builder.ensure_stake_is_sufficient(&stake_info); - builder.write::(stake_is_equal_to_threshold); - - stake.approved = 199; - let stake_info = builder.constant::(stake.clone().into()); - let stake_is_less_than_threshold = builder.ensure_stake_is_sufficient(&stake_info); - builder.write::(stake_is_less_than_threshold); - - stake.approved = 201; - let stake_info = builder.constant::(stake.clone().into()); - let stake_is_greater_than_threshold = builder.ensure_stake_is_sufficient(&stake_info); - builder.write::(stake_is_greater_than_threshold); - - stake.approved = 0; - let stake_info = builder.constant::(stake.clone().into()); - let stake_is_zero = builder.ensure_stake_is_sufficient(&stake_info); - builder.write::(stake_is_zero); - - let next_bps_hash = CryptoHash::hash_borsh(test_bps.clone()); - let next_bps_hash = builder.constant::(next_bps_hash.0.into()); - - let next_bps_is_valid = - builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); - builder.write::(next_bps_is_valid); - - let expected_root = + #[test] + fn test_ensure_proofs() { + let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); - let p: BasicProof = fixture("old.json"); let outcome_hash = CryptoHash::hash_borsh(p.outcome_proof.to_hashes()); - const OUTCOME_PROOF_AMT: usize = 2; - - let outcome_proof: MerklePathVariableValue = - p.outcome_proof.proof.into(); - let outcome_proof = - builder.constant::>(outcome_proof); - - let outcome_root_proof: MerklePathVariableValue<2, _> = p.outcome_root_proof.into(); - let outcome_root_proof = builder.constant::>(outcome_root_proof); - - let expected_outcome_root = builder - .constant::(p.block_header_lite.inner_lite.outcome_root.0.into()); - - let outcome_hash = builder.constant::(outcome_hash.0.into()); - let root_matches = builder.verify_outcome( - &expected_outcome_root, - &outcome_proof, - &outcome_hash, - &outcome_root_proof, - ); - builder.write::(root_matches); - - let expected = builder.constant::(expected_root.0.clone().into()); - let block_proof: MerklePathVariableValue<26, _> = p.block_proof.into(); - let block_proof = builder.constant::>(block_proof); - let block_hash = - builder.constant::(p.block_header_lite.hash().0.into()); - builder.verify_block(&expected, &block_proof, &block_hash); - builder.write::(root_matches); - - let next_bps_hash = CryptoHash::hash_borsh(&test_bps); - - let next_bps_hash = builder.constant::(next_bps_hash.0.into()); - let next_bps_hash_matches = - builder.ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); - builder.write::(next_bps_hash_matches); - - let registered_p = builder.constant::>( - near_light_client_protocol::Proof::Basic { - head_block_root: expected_root, - proof: Box::new(fixture("old.json")), - } - .into(), - ); - let proof_verified = builder.verify(registered_p); - builder.write::(proof_verified); - - let circuit = builder.build(); - let mut input = circuit.input(); - - input.write::(test_header.into()); - - let (proof, mut output) = circuit.prove(&input); + const OUTCOME_PROOF_AMT: usize = 2; + const OUTCOME_ROOT_PROOF_AMT: usize = 2; + const BLOCK_PROOF_AMT: usize = 26; + + let define = |builder: &mut B| { + let proof = builder.read::>(); + let expected_outcome_root = builder.read::(); + let expected_block_root = builder.read::(); + + // TODO: to_hashes + let outcome_hash = builder.constant::(outcome_hash.0.into()); + let root_matches = builder.verify_outcome( + &expected_outcome_root, + &proof.outcome_proof, + &outcome_hash, + &proof.outcome_root_proof, + ); + builder.write::(root_matches); - assert!(!output.read::(), "too early"); - assert!(output.read::(), "height it later"); - assert!(output.read::(), "current epoch"); - assert!(output.read::(), "next epoch"); + // TODO: to_hashes + let block_hash = + builder.constant::(p.block_header_lite.hash().0.into()); + let root_matches = + builder.verify_block(&expected_block_root, &proof.block_proof, &block_hash); + builder.write::(root_matches); - assert!(output.read::(), "next epoch has bps"); - assert!(output.read::(), "stake is equal to threshold"); - assert!( - !output.read::(), - "stake is less than threshold" - ); - assert!( - output.read::(), - "stake is greater than threshold" - ); - assert!(!output.read::(), "stake is zero"); - assert!(output.read::(), "next bps is valid"); - assert!(output.read::(), "outcome root matches"); - assert!(output.read::(), "block root matches"); - assert!(output.read::(), "next bps hash matches"); - assert!(output.read::(), "proof verified"); + let proof_verified = builder.verify(proof); + builder.write::(proof_verified); + }; + let writer = |input: &mut PI| { + input + .write::>( + near_light_client_protocol::Proof::Basic { + head_block_root: block_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); + input.write::(p.block_header_lite.inner_lite.outcome_root.0.into()); + input.write::(block_root.0.clone().into()); + }; + let assertions = |mut output: PO| { + assert!(output.read::(), "outcome root matches"); + assert!(output.read::(), "block root matches"); + assert!(output.read::(), "proof verified"); + }; + builder_suite(define, writer, assertions); } - // TODO: split humungous test into smaller ones #[test] - fn test_basic_inclusion_proof() { - pretty_env_logger::try_init().unwrap_or_default(); - let test_header = get_first_epoch(); - let test_header = to_header(test_header); - - let expected_root = + fn test_inclusion_proof_blackbox() { + let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); - let mut builder = DefaultBuilder::new(); - - let registered_p = builder.constant::>( - near_light_client_protocol::Proof::Basic { - head_block_root: expected_root, - proof: Box::new(fixture("old.json")), - } - .into(), - ); - let proof_verified = builder.verify(registered_p); - builder.write::(proof_verified); - - let circuit = builder.build(); - let mut input = circuit.input(); - - input.write::(test_header.into()); - - let (_proof, mut output) = circuit.prove(&input); - - assert!(output.read::()) + const OUTCOME_PROOF_AMT: usize = 2; + const OUTCOME_ROOT_PROOF_AMT: usize = 2; + const BLOCK_PROOF_AMT: usize = 26; + + let define = |builder: &mut B| { + let registered_proof = builder.read::>(); + + let proof_verified = builder.verify(registered_proof); + builder.write::(proof_verified); + }; + let writer = |input: &mut PI| { + input + .write::>( + near_light_client_protocol::Proof::Basic { + head_block_root: block_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); + }; + let assertions = |mut output: PO| { + assert!(output.read::(), "proof verified"); + }; + builder_suite(define, writer, assertions); } - // TODO: split humungous test into smaller ones #[test] - fn test_sync_accross_boundaries() { + fn test_sync_accross_boundaries_blackbox() { pretty_env_logger::try_init().unwrap_or_default(); - let (mut head, mut next_bps, next_block) = test_state(); - let mut next_epoch_id = EpochId(head.inner_lite.next_epoch_id); + let (head, next_bps, next_block) = test_state(); + println!( + "bps len {} sigs len {}", + next_bps.len(), + next_block.approvals_after_next.len() + ); - let mut builder = DefaultBuilder::new(); - let header_var = builder.read::(); - let bps_var = builder.read::>(); - let next_block_var = builder.read::(); + let define = |builder: &mut B| { + let header = builder.read::(); + let bps = builder.read::>(); + let next_block = builder.read::(); + builder.sync(header, bps, next_block); + }; + let writer = |input: &mut PI| { + input.write::(head.into()); + input.write::>( + next_bps + .clone() + .into_iter() + .map(|s| Into::::into(s)) + .map(Into::into) + .collect(), + ); + input.write::(next_block.clone().into()); + }; + let assertions = |mut output: PO| { + let header = output.read::(); + println!("header: {:?}", header); + }; + builder_suite(define, writer, assertions); - builder.sync(header_var, bps_var, next_block_var); // let mut sync_and_update = |next_block: LightClientBlockView| { // let next_bps = builder // .constant::>( @@ -831,24 +808,6 @@ mod tests { // }; // sync_and_update(next_block_var.clone()); // - let circuit = builder.build(); - let mut input = circuit.input(); - - input.write::(head.into()); - input.write::>( - next_bps - .clone() - .into_iter() - .map(|s| Into::::into(s)) - .map(Into::into) - .collect(), - ); - input.write::(next_block.clone().into()); - - let (proof, mut output) = circuit.prove(&input); - - let header = output.read::(); - println!("header: {:?}", header); } #[test] fn test_reconstruct_approval_msg() {} diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 2cb81d8..08d52da 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -177,6 +177,11 @@ pub struct BpsApprovals { impl From>>> for BpsApprovalsValue { fn from(approvals: Vec>>) -> Self { + assert_eq!( + approvals.len(), + MAX_EPOCH_VALIDATORS, + "Approvals must be of length M" + ); let mut active_bitmask = vec![]; let signatures = approvals .into_iter() @@ -310,15 +315,15 @@ where #[derive(CircuitVariable, Clone, Debug)] pub struct StakeInfoVariable { - pub approved_stake: BalanceVariable, - pub total_stake: BalanceVariable, + pub approved: BalanceVariable, + pub total: BalanceVariable, } impl From for StakeInfoVariableValue { fn from(value: near_light_client_protocol::StakeInfo) -> Self { Self { - approved_stake: value.approved.into(), - total_stake: value.total.into(), + approved: value.approved.into(), + total: value.total.into(), } } } From 1e2ed698559cd2ad2f25ff9fcba6ab6bcc21c9e7 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 12 Jan 2024 11:55:22 +0000 Subject: [PATCH 15/67] fix: bitmask length --- circuits/plonky2x/src/variables.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 08d52da..e8b7f46 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -188,11 +188,15 @@ impl From>>> for BpsApprovalsValue { .map(|sig| { if sig.is_none() { active_bitmask.push(false); + } else { + active_bitmask.push(true); } sig.into() }) .collect::>>(); + assert_eq!(active_bitmask.len(), MAX_EPOCH_VALIDATORS); + assert_eq!(signatures.len(), MAX_EPOCH_VALIDATORS); Self { active_bitmask: active_bitmask.into(), signatures: signatures.into(), From 154041d684ea52e39b11864eaf641f50ec5414f0 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 12 Jan 2024 11:55:39 +0000 Subject: [PATCH 16/67] wip: testing --- circuits/plonky2x/src/builder.rs | 80 ++++++++++++++++++++---------- circuits/plonky2x/src/variables.rs | 14 +++--- crates/protocol/src/lib.rs | 4 +- 3 files changed, 62 insertions(+), 36 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index f523942..4e6f6b4 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -32,7 +32,7 @@ pub trait Verify, const D: usize> { is_active: ArrayVariable, signatures: ArrayVariable, epoch_bps: ArrayVariable, - approval_message_hash: Bytes32Variable, + approval_message_hash: BytesVariable<41>, ) -> StakeInfoVariable; fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfoVariable) -> BoolVariable; @@ -110,26 +110,27 @@ impl, const D: usize> Verify for CircuitBuilder BoolVariable { let is_next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); let is_not_empty = self.constant(next_bps.len() > 0); - let ok_anyway = self.constant(true); + let ok_anyway = self._true(); self.select(is_next_epoch, is_not_empty, ok_anyway) } + // TODO: does not build active participants fn validate_eddsa_signatures( &mut self, is_active: ArrayVariable, signatures: ArrayVariable, epoch_bps: ArrayVariable, - approval_message_hash: Bytes32Variable, + approval_message: BytesVariable<41>, ) -> StakeInfoVariable { - let messages = [approval_message_hash.0; MAX_EPOCH_VALIDATORS]; + let messages = [approval_message.0; MAX_EPOCH_VALIDATORS]; let pubkeys: Vec = epoch_bps .data .iter() .map(|vs| vs.public_key.clone()) .collect(); - const MSG_LEN: usize = 32; + const MSG_LEN: usize = 41; // TODO: switch between eddsa/ecdsa when integrated // Here we ensure that all active participants have signed @@ -141,8 +142,8 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder); - let inner_lite_hash = output_stream.read::(self); + let output_bytes = self.hint(input_stream, InnerLiteHash::<208>); + let inner_lite_bytes = output_bytes.read::>(self); + self.watch(&inner_lite_bytes, "inner_lite_bytes"); + + let inner_lite_hash = self.curta_sha256(&inner_lite_bytes.0); self.watch(&inner_lite_hash, "inner_lite_hash"); inner_lite_hash } @@ -290,7 +294,7 @@ pub trait SyncCircuit, const D: usize> { next_block: BlockVariable, ); - fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> CryptoHashVariable; + fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> BytesVariable<41>; } impl, const D: usize> SyncCircuit for CircuitBuilder { @@ -300,13 +304,13 @@ impl, const D: usize> SyncCircuit for CircuitBuilder epoch_bps: ArrayVariable, next_block: BlockVariable, ) { - let mut c = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); - self.assertx(c); + let a = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); + //self.assertx(a); - c = self.ensure_epoch_is_current_or_next(&head, &next_block.inner_lite.epoch_id); - self.assertx(c); + let b = self.ensure_epoch_is_current_or_next(&head, &next_block.inner_lite.epoch_id); + //self.assertx(b); - c = self.ensure_if_next_epoch_contains_next_bps( + let c = self.ensure_if_next_epoch_contains_next_bps( &head, &next_block.inner_lite.epoch_id, &next_block.next_bps, @@ -339,8 +343,8 @@ impl, const D: usize> SyncCircuit for CircuitBuilder ); self.watch(&stake, "stake"); - c = self.ensure_stake_is_sufficient(&stake); - self.assertx(c); + let d = self.ensure_stake_is_sufficient(&stake); + //self.assertx(d); //c = self.ensure_next_bps_is_valid(&head.inner_lite.next_bp_hash, next_block.next_bps) // Self::ensure_next_bps_is_valid( @@ -353,7 +357,8 @@ impl, const D: usize> SyncCircuit for CircuitBuilder // self.evm_write(next_block.inner_lite.block_merkle_root); } - fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> CryptoHashVariable { + // TODO: make const fn here to test len with real approval + fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> BytesVariable<41> { let next_header_hash = self.header_hash( &next_block.inner_lite, &next_block.inner_rest_hash, @@ -367,8 +372,8 @@ impl, const D: usize> SyncCircuit for CircuitBuilder input_stream.write(&next_block_hash); input_stream.write(&next_block.inner_lite.height); let output_stream = self.hint(input_stream, BuildEndorsement::<41>); - let approval_message = output_stream.read::(self); - + let approval_message = output_stream.read::>(self); + self.watch(&approval_message, "approval_message"); approval_message } } @@ -421,7 +426,7 @@ mod tests { use crate::variables::*; use near_light_client_protocol::{ prelude::{BasicProof, Header}, - EpochId, LightClientBlockView, Proof, StakeInfo, ValidatorStake, + EpochId, LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; use plonky2x::backend::circuit::{PublicInput, PublicOutput}; @@ -741,11 +746,6 @@ mod tests { fn test_sync_accross_boundaries_blackbox() { pretty_env_logger::try_init().unwrap_or_default(); let (head, next_bps, next_block) = test_state(); - println!( - "bps len {} sigs len {}", - next_bps.len(), - next_block.approvals_after_next.len() - ); let define = |builder: &mut B| { let header = builder.read::(); @@ -809,6 +809,32 @@ mod tests { // sync_and_update(next_block_var.clone()); // } + #[test] - fn test_reconstruct_approval_msg() {} + fn test_reconstruct_approval_msg() { + pretty_env_logger::try_init().unwrap_or_default(); + let (_, next_bps, next_block) = test_state(); + println!( + "bps len {} sigs len {} next len {}", + next_bps.len(), + next_block.approvals_after_next.len(), + next_block.next_bps.as_ref().unwrap().len() + ); + + let define = |builder: &mut B| { + let next_block = builder.read::(); + let os = builder.reconstruct_approval_message(&next_block); + builder.write::>(os); + }; + let writer = |input: &mut PI| { + input.write::(next_block.clone().into()); + }; + let assertions = |mut output: PO| { + let msghash = output.read::>(); + let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); + assert_eq!(msghash, msghash); + println!("msg: {:?}", msg); + }; + builder_suite(define, writer, assertions); + } } diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index e8b7f46..afada4c 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -128,8 +128,10 @@ impl, const D: usize, const N: usize> Hint for Inner bytes.extend_from_slice(&next_bp_hash.0); bytes.extend_from_slice(&block_merkle_root.0); - let hash = sha256(&bytes); - output_stream.write_value::(hash.into()); + assert_eq!(bytes.len(), N, "expected {} bytes, got {}", N, bytes.len()); + + let bytes: [u8; N] = bytes.try_into().unwrap(); + output_stream.write_value::>(bytes); } } @@ -146,6 +148,7 @@ pub struct BlockVariable { impl From for BlockVariableValue { fn from(block: LightClientBlockView) -> Self { + assert_eq!(block.next_bps.as_ref().unwrap().len(), MAX_EPOCH_VALIDATORS); Self { prev_block_hash: block.prev_block_hash.0.into(), next_block_inner_hash: block.next_block_inner_hash.0.into(), @@ -161,6 +164,7 @@ impl From for BlockVariableValue { .map(Into::into) .collect() } else { + // FIXME: needs to fill to spsace vec![] } .into(), @@ -177,11 +181,6 @@ pub struct BpsApprovals { impl From>>> for BpsApprovalsValue { fn from(approvals: Vec>>) -> Self { - assert_eq!( - approvals.len(), - MAX_EPOCH_VALIDATORS, - "Approvals must be of length M" - ); let mut active_bitmask = vec![]; let signatures = approvals .into_iter() @@ -197,6 +196,7 @@ impl From>>> for BpsApprovalsValue { assert_eq!(active_bitmask.len(), MAX_EPOCH_VALIDATORS); assert_eq!(signatures.len(), MAX_EPOCH_VALIDATORS); + Self { active_bitmask: active_bitmask.into(), signatures: signatures.into(), diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 8a04799..102f535 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -177,7 +177,7 @@ impl Protocol { verify_hash(*block_merkle_root, block_proof, *block_hash) } - fn reconstruct_approval_message(block_view: &LightClientBlockView) -> Option> { + pub fn reconstruct_approval_message(block_view: &LightClientBlockView) -> Option> { let new_head = Header { prev_block_hash: block_view.prev_block_hash, inner_rest_hash: block_view.inner_rest_hash, @@ -262,7 +262,7 @@ impl Protocol { .into() } - fn validate_signature( + pub fn validate_signature( msg: &[u8], sig: &Option>, pk: &PublicKey, From df271783c8c543e16fdff13ebe421294c0fc4af6 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 12 Jan 2024 18:00:39 +0000 Subject: [PATCH 17/67] wip: broken sig verification --- circuits/plonky2x/src/builder.rs | 169 +++++++++++++++++++++++------ circuits/plonky2x/src/variables.rs | 50 +++++---- 2 files changed, 163 insertions(+), 56 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 4e6f6b4..edc9246 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,10 +1,11 @@ use crate::merkle::NearMerkleTree; use crate::variables::{ - BlockHeightVariable, BlockVariable, BuildEndorsement, CryptoHashVariable, HeaderInnerVariable, - HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, PublicKeyVariable, - StakeInfoVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, + BlockHeightVariable, BlockVariable, BpsApprovals, BuildEndorsement, CryptoHashVariable, + HeaderInnerVariable, HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, + PublicKeyVariable, StakeInfoVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, }; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; +use plonky2x::frontend::vars::EvmVariable; use plonky2x::prelude::*; pub trait Verify, const D: usize> { @@ -29,8 +30,7 @@ pub trait Verify, const D: usize> { fn validate_eddsa_signatures( &mut self, - is_active: ArrayVariable, - signatures: ArrayVariable, + approvals_after_next: BpsApprovals, epoch_bps: ArrayVariable, approval_message_hash: BytesVariable<41>, ) -> StakeInfoVariable; @@ -114,31 +114,37 @@ impl, const D: usize> Verify for CircuitBuilder, - signatures: ArrayVariable, + approvals_after_next: BpsApprovals, epoch_bps: ArrayVariable, approval_message: BytesVariable<41>, ) -> StakeInfoVariable { - let messages = [approval_message.0; MAX_EPOCH_VALIDATORS]; + const MSG_LEN: usize = 41; + + let messages = [approval_message; MAX_EPOCH_VALIDATORS]; + let pubkeys: Vec = epoch_bps .data .iter() .map(|vs| vs.public_key.clone()) .collect(); - const MSG_LEN: usize = 41; - // TODO: switch between eddsa/ecdsa when integrated // Here we ensure that all active participants have signed self.curta_eddsa_verify_sigs_conditional::( - is_active.clone(), + approvals_after_next.is_active.clone(), None, ArrayVariable::new(messages.to_vec()), - signatures, + approvals_after_next.signatures, ArrayVariable::new(pubkeys), ); @@ -147,7 +153,7 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> SyncCircuit for CircuitBuilder next_block: BlockVariable, ) { let a = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); - //self.assertx(a); + self.assertx(a); let b = self.ensure_epoch_is_current_or_next(&head, &next_block.inner_lite.epoch_id); - //self.assertx(b); + self.assertx(b); let c = self.ensure_if_next_epoch_contains_next_bps( &head, @@ -327,24 +333,12 @@ impl, const D: usize> SyncCircuit for CircuitBuilder let approval = self.reconstruct_approval_message(&next_block); self.watch(&approval, "approval_msg"); - let signatures_eddsa = next_block - .approvals_after_next - .signatures - .data - .iter() - .map(|s| s.ed25519.clone()) // FIXME: when ecdsa - .collect::>(); - - let stake = self.validate_eddsa_signatures( - next_block.approvals_after_next.active_bitmask, - ArrayVariable::new(signatures_eddsa), - epoch_bps, - approval, - ); + let stake = + self.validate_eddsa_signatures(next_block.approvals_after_next, epoch_bps, approval); self.watch(&stake, "stake"); let d = self.ensure_stake_is_sufficient(&stake); - //self.assertx(d); + self.assertx(d); //c = self.ensure_next_bps_is_valid(&head.inner_lite.next_bp_hash, next_block.next_bps) // Self::ensure_next_bps_is_valid( @@ -425,11 +419,14 @@ mod tests { use super::*; use crate::variables::*; use near_light_client_protocol::{ - prelude::{BasicProof, Header}, + prelude::{BasicProof, Header, Itertools}, EpochId, LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, }; use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; - use plonky2x::backend::circuit::{PublicInput, PublicOutput}; + use plonky2x::{ + backend::circuit::{PublicInput, PublicOutput}, + frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue, + }; use serde::de::DeserializeOwned; type B = CircuitBuilder; @@ -810,9 +807,115 @@ mod tests { // } + #[test] + fn test_one_signature() { + let (_, bps, next_block) = test_state(); + + let msg: [u8; 41] = Protocol::reconstruct_approval_message(&next_block) + .unwrap() + .try_into() + .unwrap(); + let msgs = [msg; SIG_AMT]; + + const SIG_AMT: usize = 50; + type Arr = ArrayVariable; + + let mut nbps: Vec = vec![]; + let mut sigs: Vec> = vec![]; + + // Filter out null bps + bps.into_iter() + .zip(next_block.approvals_after_next.into_iter()) + .filter(|(_, s)| s.is_some()) + .take(SIG_AMT) + .for_each(|(v, s)| { + assert!(s.is_some()); + let v: ValidatorStakeVariableValue = v.into(); + nbps.push(v.public_key); + let s: SignatureVariableValue = s.into(); + sigs.push(s.ed25519.into()); + }); + + println!("msgs: {:?}", msgs); + println!("bps: {:?}", nbps); + println!("sigs: {:?}", sigs); + + let define = |builder: &mut B| { + let pubkeys = builder.read::>(); + let msgs = builder.read::>>(); + let sigs = builder.read::>(); + + builder.curta_eddsa_verify_sigs(msgs, None, sigs, pubkeys); + }; + let writer = |input: &mut PI| { + input.write::>(nbps.into()); + input.write::>>(msgs.into()); + input.write::>(sigs.into()); + + // TODO: isnt this the issue XD + // let sig: SignatureVariableValue = + // next_block.approvals_after_next[0].clone().into(); + // input.write::>(vec![sig.ed25519].into()); + //(next_block.clone().into()); + }; + let assertions = |mut output: PO| { + // let msghash = output.read::>(); + // let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); + // assert_eq!(msghash, msghash); + // println!("msg: {:?}", msg); + }; + builder_suite(define, writer, assertions); + } + + #[test] + fn test_signatures() { + let (_, next_bps, next_block) = test_state(); + + let define = |builder: &mut B| { + let pubkeys = builder.read::>(); + let messages = builder.read::, MAX_EPOCH_VALIDATORS>>(); + let signatures = + builder.read::>(); + //let next_block = builder.read::(); + + builder.curta_eddsa_verify_sigs(messages, None, signatures, pubkeys) + }; + let writer = |input: &mut PI| { + let vs = next_bps + .clone() + .into_iter() + .map(Into::::into) + .map(Into::>::into) + .map(|s| s.public_key) + .collect_vec(); + input.write::>(vs.into()); + + let msg: [u8; 41] = Protocol::reconstruct_approval_message(&next_block) + .unwrap() + .try_into() + .unwrap(); + let msgs = [msg; MAX_EPOCH_VALIDATORS]; + input.write::, MAX_EPOCH_VALIDATORS>>(msgs.into()); + let sigs = next_block + .approvals_after_next + .clone() + .into_iter() + .map(Into::>::into) + .map(|s| s.ed25519) + .collect_vec(); + input.write::>(sigs.into()); + }; + let assertions = |mut output: PO| { + // let msghash = output.read::>(); + // let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); + // assert_eq!(msghash, msghash); + // println!("msg: {:?}", msg); + }; + builder_suite(define, writer, assertions); + } + #[test] fn test_reconstruct_approval_msg() { - pretty_env_logger::try_init().unwrap_or_default(); let (_, next_bps, next_block) = test_state(); println!( "bps len {} sigs len {} next len {}", diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index afada4c..3466668 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -5,22 +5,21 @@ use near_light_client_protocol::{ LightClientBlockView, Signature, ValidatorStake, }; use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::{ EDDSASignatureVariable, DUMMY_SIGNATURE, }; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::{ + EDDSASignatureVariableValue, DUMMY_PUBLIC_KEY, +}; use plonky2x::frontend::hint::simple::hint::Hint; use plonky2x::frontend::{curta::ec::point::CompressedEdwardsYVariable, uint::Uint}; use plonky2x::prelude::*; -use plonky2x::utils::hash::sha256; use serde::{Deserialize, Serialize}; // TODO: if we use borsh here be careful of order -// TODO: ideally just use into conversions and expose protocol via types crate // TODO: borsh? would need encoding for messages, make a hint +// // TODO: optional variable -// TODO: sparse arrays for BPS, check tendermint, or we make own pub type entirely -// TODO: ecdsa sigs & keys // TODO: get constrained numbers // // EVM write synced @@ -175,30 +174,27 @@ impl From for BlockVariableValue { #[derive(CircuitVariable, Clone, Debug)] pub struct BpsApprovals { - pub active_bitmask: ArrayVariable, - pub signatures: ArrayVariable, + pub is_active: ArrayVariable, + pub signatures: ArrayVariable, } impl From>>> for BpsApprovalsValue { fn from(approvals: Vec>>) -> Self { - let mut active_bitmask = vec![]; + let mut is_active = vec![]; let signatures = approvals .into_iter() .map(|sig| { - if sig.is_none() { - active_bitmask.push(false); - } else { - active_bitmask.push(true); - } - sig.into() + is_active.push(sig.is_some()); + let sig: SignatureVariableValue = sig.into(); + sig.ed25519 }) - .collect::>>(); + .collect::>>(); - assert_eq!(active_bitmask.len(), MAX_EPOCH_VALIDATORS); + assert_eq!(is_active.len(), MAX_EPOCH_VALIDATORS); assert_eq!(signatures.len(), MAX_EPOCH_VALIDATORS); Self { - active_bitmask: active_bitmask.into(), + is_active: is_active.into(), signatures: signatures.into(), } } @@ -235,6 +231,7 @@ impl From for ValidatorStakeVariableValue { // Ed25519(CompressedEdwardsYVariable), // } pub type PublicKeyVariable = CompressedEdwardsYVariable; +pub type PublicKeyVariableValue = CompressedEdwardsY; #[derive(CircuitVariable, Clone, Debug)] pub struct SignatureVariable { @@ -244,15 +241,22 @@ pub struct SignatureVariable { impl From>> for SignatureVariableValue { fn from(sig: Option>) -> Self { - let sig = sig + let (r, s) = sig .map(|s| match *s { - Signature::ED25519(s) => s.to_bytes(), - Signature::SECP256K1(_) => todo!("Support ECDSA"), + Signature::ED25519(s) => (*s.r_bytes(), *s.s_bytes()), + Signature::SECP256K1(_) => { + panic!("ECDSA is being phased out and validators don't use it") + } }) - .unwrap_or_else(|| DUMMY_SIGNATURE); + .unwrap_or_else(|| { + ( + DUMMY_SIGNATURE[0..32].try_into().unwrap(), + DUMMY_SIGNATURE[32..64].try_into().unwrap(), + ) + }); let sig = EDDSASignatureVariableValue { - r: CompressedEdwardsY(sig[0..32].try_into().unwrap()), - s: U256::from_little_endian(&sig[32..64]), + r: CompressedEdwardsY(r), + s: U256::from_little_endian(&s), }; Self { ed25519: sig.into(), From 2267615361723d48589794af0d311ec1ed4f00a7 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 15 Jan 2024 11:09:32 +0000 Subject: [PATCH 18/67] chore(wip): add max seats to config --- crates/protocol/src/config.rs | 6 ++++++ crates/protocol/src/lib.rs | 1 + 2 files changed, 7 insertions(+) create mode 100644 crates/protocol/src/config.rs diff --git a/crates/protocol/src/config.rs b/crates/protocol/src/config.rs new file mode 100644 index 0000000..249446f --- /dev/null +++ b/crates/protocol/src/config.rs @@ -0,0 +1,6 @@ +use near_primitives_core::types::NumSeats; + +// https://github.com/near/nearcore/blob/master/nearcore/src/config.rs#L133C1-L134C1 +// TODO: expose this from NP, currently this is a risk that the light client could be exploited +// if the max seats changes without knowing +pub const NUM_BLOCK_PRODUCER_SEATSS: NumSeats = 50; diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 102f535..992894f 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -12,6 +12,7 @@ pub use near_primitives::{ }, }; +pub mod config; pub mod error; pub mod merkle_util; pub mod prelude; From 9dbd13b0391f640cfce3ac0d165d312ab6b10e81 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 15 Jan 2024 12:23:51 +0000 Subject: [PATCH 19/67] wip: constraining variables --- circuits/plonky2x/src/builder.rs | 108 ++++++++++++---------------- circuits/plonky2x/src/lib.rs | 6 +- circuits/plonky2x/src/variables.rs | 111 ++++++++++++----------------- crates/protocol/src/config.rs | 2 +- crates/protocol/src/lib.rs | 7 ++ 5 files changed, 103 insertions(+), 131 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index edc9246..c9aac38 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,11 +1,10 @@ use crate::merkle::NearMerkleTree; use crate::variables::{ - BlockHeightVariable, BlockVariable, BpsApprovals, BuildEndorsement, CryptoHashVariable, + BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, BuildEndorsement, CryptoHashVariable, HeaderInnerVariable, HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, - PublicKeyVariable, StakeInfoVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, + PublicKeyVariable, StakeInfoVariable, ValidatorStakeVariable, }; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; -use plonky2x::frontend::vars::EvmVariable; +use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; use plonky2x::prelude::*; pub trait Verify, const D: usize> { @@ -25,13 +24,13 @@ pub trait Verify, const D: usize> { &mut self, head: &HeaderVariable, epoch_id: &CryptoHashVariable, - next_bps: &ArrayVariable, + next_bps: &BpsArr, ) -> BoolVariable; fn validate_eddsa_signatures( &mut self, approvals_after_next: BpsApprovals, - epoch_bps: ArrayVariable, + epoch_bps: BpsArr, approval_message_hash: BytesVariable<41>, ) -> StakeInfoVariable; @@ -106,7 +105,7 @@ impl, const D: usize> Verify for CircuitBuilder, + next_bps: &BpsArr, ) -> BoolVariable { let is_next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); let is_not_empty = self.constant(next_bps.len() > 0); @@ -125,12 +124,17 @@ impl, const D: usize> Verify for CircuitBuilder, + epoch_bps: BpsArr, approval_message: BytesVariable<41>, ) -> StakeInfoVariable { + assert!(approvals_after_next.is_active.len() == NUM_BLOCK_PRODUCER_SEATS); + assert!(approvals_after_next.signatures.len() == NUM_BLOCK_PRODUCER_SEATS); + + // TODO: configurable const MSG_LEN: usize = 41; - let messages = [approval_message; MAX_EPOCH_VALIDATORS]; + // TODO: helper fn to swallow any inconsistencies with configured epoch_bps + let messages = [approval_message; NUM_BLOCK_PRODUCER_SEATS]; let pubkeys: Vec = epoch_bps .data @@ -138,9 +142,9 @@ impl, const D: usize> Verify for CircuitBuilder( + self.curta_eddsa_verify_sigs_conditional::( approvals_after_next.is_active.clone(), None, ArrayVariable::new(messages.to_vec()), @@ -296,7 +300,7 @@ pub trait SyncCircuit, const D: usize> { fn sync( &mut self, head: HeaderVariable, - epoch_bps: ArrayVariable, + epoch_bps: BpsArr, next_block: BlockVariable, ); @@ -307,7 +311,7 @@ impl, const D: usize> SyncCircuit for CircuitBuilder fn sync( &mut self, head: HeaderVariable, - epoch_bps: ArrayVariable, + epoch_bps: BpsArr, next_block: BlockVariable, ) { let a = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); @@ -414,20 +418,20 @@ impl, const D: usize> VerifyCircuit for CircuitBuild #[cfg(test)] mod tests { - use std::str::FromStr; - use super::*; use crate::variables::*; use near_light_client_protocol::{ prelude::{BasicProof, Header, Itertools}, - EpochId, LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, + LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, }; - use near_primitives::{hash::CryptoHash, types::ValidatorStakeV1}; + use near_primitives::hash::CryptoHash; + use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; use plonky2x::{ backend::circuit::{PublicInput, PublicOutput}, frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue, }; use serde::de::DeserializeOwned; + use std::str::FromStr; type B = CircuitBuilder; type PI = PublicInput; @@ -603,8 +607,7 @@ mod tests { let define = |builder: &mut B| { let header = builder.read::(); - let next_bps = - builder.read::>(); + let next_bps = builder.read::>(); let current = builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); @@ -627,7 +630,7 @@ mod tests { }; let writer = |input: &mut PI| { input.write::(header.into()); - input.write::>( + input.write::>( bps.clone() .into_iter() .map(|s| Into::::into(s)) @@ -746,13 +749,13 @@ mod tests { let define = |builder: &mut B| { let header = builder.read::(); - let bps = builder.read::>(); + let bps = builder.read::>(); let next_block = builder.read::(); builder.sync(header, bps, next_block); }; let writer = |input: &mut PI| { input.write::(head.into()); - input.write::>( + input.write::>( next_bps .clone() .into_iter() @@ -770,7 +773,7 @@ mod tests { // let mut sync_and_update = |next_block: LightClientBlockView| { // let next_bps = builder - // .constant::>( + // .constant::>( // bps_var // .clone() // .into_iter() @@ -810,15 +813,13 @@ mod tests { #[test] fn test_one_signature() { let (_, bps, next_block) = test_state(); + const BPS_AMT: usize = 50; let msg: [u8; 41] = Protocol::reconstruct_approval_message(&next_block) .unwrap() .try_into() .unwrap(); - let msgs = [msg; SIG_AMT]; - - const SIG_AMT: usize = 50; - type Arr = ArrayVariable; + let msgs = [msg; BPS_AMT]; let mut nbps: Vec = vec![]; let mut sigs: Vec> = vec![]; @@ -827,13 +828,13 @@ mod tests { bps.into_iter() .zip(next_block.approvals_after_next.into_iter()) .filter(|(_, s)| s.is_some()) - .take(SIG_AMT) + .take(BPS_AMT) .for_each(|(v, s)| { assert!(s.is_some()); let v: ValidatorStakeVariableValue = v.into(); nbps.push(v.public_key); let s: SignatureVariableValue = s.into(); - sigs.push(s.ed25519.into()); + sigs.push(s.signature.into()); }); println!("msgs: {:?}", msgs); @@ -841,29 +842,18 @@ mod tests { println!("sigs: {:?}", sigs); let define = |builder: &mut B| { - let pubkeys = builder.read::>(); - let msgs = builder.read::>>(); - let sigs = builder.read::>(); + let pubkeys = builder.read::>(); + let msgs = builder.read::, BPS_AMT>>(); + let sigs = builder.read::>(); builder.curta_eddsa_verify_sigs(msgs, None, sigs, pubkeys); }; let writer = |input: &mut PI| { - input.write::>(nbps.into()); - input.write::>>(msgs.into()); - input.write::>(sigs.into()); - - // TODO: isnt this the issue XD - // let sig: SignatureVariableValue = - // next_block.approvals_after_next[0].clone().into(); - // input.write::>(vec![sig.ed25519].into()); - //(next_block.clone().into()); - }; - let assertions = |mut output: PO| { - // let msghash = output.read::>(); - // let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); - // assert_eq!(msghash, msghash); - // println!("msg: {:?}", msg); + input.write::>(nbps.into()); + input.write::, BPS_AMT>>(msgs.into()); + input.write::>(sigs.into()); }; + let assertions = |mut _output: PO| {}; builder_suite(define, writer, assertions); } @@ -872,10 +862,9 @@ mod tests { let (_, next_bps, next_block) = test_state(); let define = |builder: &mut B| { - let pubkeys = builder.read::>(); - let messages = builder.read::, MAX_EPOCH_VALIDATORS>>(); - let signatures = - builder.read::>(); + let pubkeys = builder.read::>(); + let messages = builder.read::>>(); + let signatures = builder.read::>(); //let next_block = builder.read::(); builder.curta_eddsa_verify_sigs(messages, None, signatures, pubkeys) @@ -888,29 +877,24 @@ mod tests { .map(Into::>::into) .map(|s| s.public_key) .collect_vec(); - input.write::>(vs.into()); + input.write::>(vs.into()); let msg: [u8; 41] = Protocol::reconstruct_approval_message(&next_block) .unwrap() .try_into() .unwrap(); - let msgs = [msg; MAX_EPOCH_VALIDATORS]; - input.write::, MAX_EPOCH_VALIDATORS>>(msgs.into()); + let msgs = [msg; NUM_BLOCK_PRODUCER_SEATS]; + input.write::>>(msgs.into()); let sigs = next_block .approvals_after_next .clone() .into_iter() .map(Into::>::into) - .map(|s| s.ed25519) + .map(|s| s.signature) .collect_vec(); - input.write::>(sigs.into()); - }; - let assertions = |mut output: PO| { - // let msghash = output.read::>(); - // let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); - // assert_eq!(msghash, msghash); - // println!("msg: {:?}", msg); + input.write::>(sigs.into()); }; + let assertions = |mut _output: PO| {}; builder_suite(define, writer, assertions); } diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index b9e4fe3..4c3e0d6 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,7 +1,5 @@ use plonky2x::prelude::*; -use variables::{ - BlockVariable, HeaderVariable, ProofVariable, ValidatorStakeVariable, MAX_EPOCH_VALIDATORS, -}; +use variables::{BlockVariable, BpsArr, HeaderVariable, ProofVariable, ValidatorStakeVariable}; mod builder; mod codec; @@ -25,7 +23,7 @@ pub trait SyncCircuit, const D: usize> { fn sync( &mut self, head: HeaderVariable, - epoch_bps: ArrayVariable, + epoch_bps: BpsArr, next_block: BlockVariable, ) -> HeaderVariable; } diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 3466668..a8879b1 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -1,9 +1,11 @@ use ethers::types::{H256, U256}; -use near_light_client_protocol::prelude::Header; +use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; +use near_light_client_protocol::prelude::{Header, Itertools}; use near_light_client_protocol::{ merkle_util::MerklePath, prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, LightClientBlockView, Signature, ValidatorStake, }; +use near_light_client_protocol::{Proof, StakeInfo}; use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::{ EDDSASignatureVariable, DUMMY_SIGNATURE, @@ -25,8 +27,9 @@ use serde::{Deserialize, Serialize}; // EVM write synced // EVM write proof -pub const MAX_ACCOUNT_ID_LEN: usize = 32; // TODO: get real number here -pub const MAX_EPOCH_VALIDATORS: usize = 100; // TODO: real number +// TODO: check if this BPS seats changers for testnet/mainnet +/// Type for omitting the size across the codebase for arrays that are the same size as BPS +pub(crate) type BpsArr = ArrayVariable; pub type CryptoHashVariable = Bytes32Variable; pub type BlockHeightVariable = U64Variable; @@ -45,6 +48,7 @@ impl From for MerklePathVariableValue< let indices: Vec = value .iter() .map(|x| match x.direction { + // TODO: add tests for this near_light_client_protocol::Direction::Left => true, near_light_client_protocol::Direction::Right => false, }) @@ -103,7 +107,8 @@ impl From for HeaderInnerVariableValue; impl, const D: usize, const N: usize> Hint for InnerLiteHash { @@ -140,14 +145,12 @@ pub struct BlockVariable { pub next_block_inner_hash: CryptoHashVariable, pub inner_lite: HeaderInnerVariable, pub inner_rest_hash: CryptoHashVariable, - // TODO: sparse arrays for this and approvals - pub next_bps: ArrayVariable, + pub next_bps: BpsArr, pub approvals_after_next: BpsApprovals, } impl From for BlockVariableValue { fn from(block: LightClientBlockView) -> Self { - assert_eq!(block.next_bps.as_ref().unwrap().len(), MAX_EPOCH_VALIDATORS); Self { prev_block_hash: block.prev_block_hash.0.into(), next_block_inner_hash: block.next_block_inner_hash.0.into(), @@ -174,24 +177,26 @@ impl From for BlockVariableValue { #[derive(CircuitVariable, Clone, Debug)] pub struct BpsApprovals { - pub is_active: ArrayVariable, - pub signatures: ArrayVariable, + pub is_active: BpsArr, + pub signatures: BpsArr, } impl From>>> for BpsApprovalsValue { fn from(approvals: Vec>>) -> Self { let mut is_active = vec![]; - let signatures = approvals + let mut signatures = vec![]; + // TODO: bounding here + approvals .into_iter() - .map(|sig| { - is_active.push(sig.is_some()); - let sig: SignatureVariableValue = sig.into(); - sig.ed25519 - }) - .collect::>>(); + .take(NUM_BLOCK_PRODUCER_SEATS) + .for_each(|s| { + is_active.push(s.is_some()); + let s: SignatureVariableValue = s.into(); + signatures.push(s.signature); + }); - assert_eq!(is_active.len(), MAX_EPOCH_VALIDATORS); - assert_eq!(signatures.len(), MAX_EPOCH_VALIDATORS); + assert_eq!(is_active.len(), NUM_BLOCK_PRODUCER_SEATS); + assert_eq!(signatures.len(), NUM_BLOCK_PRODUCER_SEATS); Self { is_active: is_active.into(), @@ -225,49 +230,41 @@ impl From for ValidatorStakeVariableValue { } } -// TODO: k256 ECDSA and manual enum impl for signatures and public keys -// #[derive( Clone, Debug)] -// enum PublicKey { -// Ed25519(CompressedEdwardsYVariable), -// } pub type PublicKeyVariable = CompressedEdwardsYVariable; pub type PublicKeyVariableValue = CompressedEdwardsY; #[derive(CircuitVariable, Clone, Debug)] pub struct SignatureVariable { - pub ed25519: EDDSASignatureVariable, - //TODO: pub ecdsa: Option + pub signature: EDDSASignatureVariable, } impl From>> for SignatureVariableValue { fn from(sig: Option>) -> Self { - let (r, s) = sig + let dummy_r = CompressedEdwardsY(DUMMY_SIGNATURE[0..32].try_into().unwrap()); + let dummy_s = U256::from_little_endian(&DUMMY_SIGNATURE[32..]); + + let signature = sig .map(|s| match *s { - Signature::ED25519(s) => (*s.r_bytes(), *s.s_bytes()), + Signature::ED25519(s) => EDDSASignatureVariableValue { + r: CompressedEdwardsY(*s.r_bytes()), + s: U256::from_little_endian(s.s_bytes()), + }, Signature::SECP256K1(_) => { panic!("ECDSA is being phased out and validators don't use it") } }) - .unwrap_or_else(|| { - ( - DUMMY_SIGNATURE[0..32].try_into().unwrap(), - DUMMY_SIGNATURE[32..64].try_into().unwrap(), - ) + .unwrap_or_else(|| EDDSASignatureVariableValue { + r: dummy_r, + s: dummy_s, }); - let sig = EDDSASignatureVariableValue { - r: CompressedEdwardsY(r), - s: U256::from_little_endian(&s), - }; - Self { - ed25519: sig.into(), - } + Self { signature } } } #[derive(CircuitVariable, Clone, Debug)] pub struct ProofVariable { pub head_block_root: CryptoHashVariable, - // TODO: make variable pub outcome_proof: ExecutionOutcomeWithId, + // TODO: constrain the outcome hash by borsh encoding pub outcome_hash: CryptoHashVariable, pub outcome_proof_block_hash: CryptoHashVariable, pub outcome_proof: MerklePathVariable, // TODO: get real number here @@ -276,14 +273,14 @@ pub struct ProofVariable pub block_proof: MerklePathVariable, // TODO: get real number here } -impl - From for ProofVariableValue +impl From + for ProofVariableValue where F: RichField, { - fn from(proof: near_light_client_protocol::Proof) -> Self { + fn from(proof: Proof) -> Self { match proof { - near_light_client_protocol::Proof::Basic { + Proof::Basic { head_block_root, proof, } => Self { @@ -297,7 +294,7 @@ where block_header: proof.block_header_lite.into(), block_proof: proof.block_proof.into(), }, - near_light_client_protocol::Proof::Experimental(_) => todo!("Batch proving"), + Proof::Experimental(_) => todo!("Batch proving"), } } } @@ -327,8 +324,8 @@ pub struct StakeInfoVariable { pub total: BalanceVariable, } -impl From for StakeInfoVariableValue { - fn from(value: near_light_client_protocol::StakeInfo) -> Self { +impl From for StakeInfoVariableValue { + fn from(value: StakeInfo) -> Self { Self { approved: value.approved.into(), total: value.total.into(), @@ -350,6 +347,7 @@ impl From for StakeInfoVari // } // } +// TODO: not sure these even need to be hints #[derive(Clone, Debug, Serialize, Deserialize)] pub struct BuildEndorsement; @@ -389,24 +387,9 @@ impl, const D: usize, const N: usize> Hint for Build #[cfg(test)] mod tests { use super::*; - use plonky2x::frontend::vars::EvmVariable; #[test] - fn test_encodepacked() { - let mut builder = DefaultBuilder::new(); - let mut pw = PartialWitness::new(); - let x1 = 10; - let x = builder.init::(); - - x.set(&mut pw, x1); - - assert_eq!(x.get(&pw), x1); - - println!("x1: {:?}", x1.to_le_bytes()); - println!("x: {:?}", x.encode(&mut builder)); - - let circuit = builder.build(); - let proof = circuit.data.prove(pw).unwrap(); - circuit.data.verify(proof).unwrap(); + fn write_tests() { + todo!() } } diff --git a/crates/protocol/src/config.rs b/crates/protocol/src/config.rs index 249446f..1529a35 100644 --- a/crates/protocol/src/config.rs +++ b/crates/protocol/src/config.rs @@ -3,4 +3,4 @@ use near_primitives_core::types::NumSeats; // https://github.com/near/nearcore/blob/master/nearcore/src/config.rs#L133C1-L134C1 // TODO: expose this from NP, currently this is a risk that the light client could be exploited // if the max seats changes without knowing -pub const NUM_BLOCK_PRODUCER_SEATSS: NumSeats = 50; +pub const NUM_BLOCK_PRODUCER_SEATS: usize = 50; diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 992894f..762a786 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -607,4 +607,11 @@ mod tests { fn statically_test_lens() { println!("approval: {:?}", std::mem::size_of::()); } + + // Missed a part of LC spec regarding BPS handover, only the MAX_SEATS need to be taken + // TODO: change epoch_bps to only store MAX_SEATS and then for next + #[test] + fn test_enough_stake_in_next_epoch_not_this() { + todo!(); + } } From 264a673b956fd69d41a224f92549ed76db60d4c4 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 15 Jan 2024 15:57:17 +0000 Subject: [PATCH 20/67] wip: tidy up --- Cargo.lock | 92 ++++++-- Cargo.toml | 3 + circuits/plonky2x/Cargo.toml | 10 +- circuits/plonky2x/src/builder.rs | 362 +++++++++-------------------- circuits/plonky2x/src/codec.rs | 44 ++-- circuits/plonky2x/src/input.rs | 1 + circuits/plonky2x/src/merkle.rs | 7 + circuits/plonky2x/src/variables.rs | 299 ++++++++++++++---------- crates/protocol/src/config.rs | 2 - crates/protocol/src/prelude.rs | 4 +- 10 files changed, 411 insertions(+), 413 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ccbe7ab..a4c0126 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "curta" version = "0.1.0" -source = "git+https://github.com/succinctlabs/curta.git#59e489d21622a92b25a2e4a5b710ce322f309b87" +source = "git+https://github.com/succinctlabs/curta.git#ebbd97c0f4f91bfa792fa5746e1d3f5334316189" dependencies = [ "anyhow", "bincode", @@ -1361,7 +1361,7 @@ dependencies = [ "itertools 0.10.5", "log", "num", - "plonky2", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", "plonky2_maybe_rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "serde", @@ -3683,7 +3683,7 @@ dependencies = [ "near-primitives-core", "pretty_env_logger", "protobuf 3.2.0", - "rand 0.8.5", + "rand 0.7.3", "reqwest", "serde", "serde_json", @@ -3701,8 +3701,9 @@ dependencies = [ "hex", "near-light-client-protocol", "near-primitives", - "plonky2", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git)", "plonky2x", + "pretty_assertions", "pretty_env_logger", "serde", "serde_json", @@ -3723,7 +3724,7 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "thiserror", @@ -4735,7 +4736,30 @@ checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "plonky2" version = "0.1.4" -source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" +dependencies = [ + "ahash 0.8.7", + "anyhow", + "getrandom 0.2.12", + "hashbrown 0.14.3", + "itertools 0.11.0", + "keccak-hash", + "log", + "num", + "plonky2_field 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "plonky2_maybe_rayon 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "rand 0.8.5", + "serde", + "serde_json", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2" +version = "0.1.4" +source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" dependencies = [ "ahash 0.8.7", "anyhow", @@ -4745,9 +4769,9 @@ dependencies = [ "keccak-hash", "log", "num", - "plonky2_field", + "plonky2_field 0.1.1 (git+https://github.com/mir-protocol/plonky2.git)", "plonky2_maybe_rayon 0.1.1 (git+https://github.com/mir-protocol/plonky2.git)", - "plonky2_util", + "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git)", "rand 0.8.5", "rand_chacha 0.3.1", "serde", @@ -4759,12 +4783,27 @@ dependencies = [ [[package]] name = "plonky2_field" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" dependencies = [ "anyhow", "itertools 0.11.0", "num", - "plonky2_util", + "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "rand 0.8.5", + "serde", + "static_assertions", + "unroll", +] + +[[package]] +name = "plonky2_field" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" +dependencies = [ + "anyhow", + "itertools 0.11.0", + "num", + "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git)", "rand 0.8.5", "serde", "static_assertions", @@ -4783,7 +4822,15 @@ dependencies = [ [[package]] name = "plonky2_maybe_rayon" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" +dependencies = [ + "rayon", +] + +[[package]] +name = "plonky2_maybe_rayon" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" dependencies = [ "rayon", ] @@ -4791,12 +4838,17 @@ dependencies = [ [[package]] name = "plonky2_util" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#54a13135884e0da7c1d1787a3511a16d3518f0ba" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" + +[[package]] +name = "plonky2_util" +version = "0.1.1" +source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" [[package]] name = "plonky2x" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#9d59459e62a43103c310d77b1155df0fe61a174f" +source = "git+https://github.com/succinctlabs/succinctx.git#19a16bfd14b3367c6c022ba6477457baca9d84b3" dependencies = [ "anyhow", "array-macro", @@ -4820,7 +4872,7 @@ dependencies = [ "log", "num", "num-bigint 0.4.4", - "plonky2", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", "plonky2x-derive", "rand 0.8.5", "reqwest", @@ -4838,7 +4890,7 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#9d59459e62a43103c310d77b1155df0fe61a174f" +source = "git+https://github.com/succinctlabs/succinctx.git#19a16bfd14b3367c6c022ba6477457baca9d84b3" dependencies = [ "proc-macro2", "quote", @@ -4875,6 +4927,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa06bd51638b6e76ac9ba9b6afb4164fa647bd2916d722f2623fbb6d1ed8bdba" +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + [[package]] name = "pretty_env_logger" version = "0.5.0" diff --git a/Cargo.toml b/Cargo.toml index e792002..521547a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,6 @@ near-jsonrpc-client = "0.7" near-jsonrpc-primitives = "0.19" near-primitives = "0.19" near-primitives-core = "0.19" + +# [patch."https://github.com/succinctlabs/succinctx.git"] +# plonky2x = { path = "./vendor/succinctx/plonky2x/core" } diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index e479e32..c46f82e 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -6,9 +6,10 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -borsh.workspace = true -ethers = "2.0.11" -serde.workspace = true +borsh.workspace = true +ethers = "2.0.11" +pretty_assertions = "1.4.0" +serde.workspace = true # Circuits plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } @@ -22,6 +23,3 @@ hex.workspace = true near-primitives.workspace = true pretty_env_logger.workspace = true serde_json.workspace = true - -# [workspace] -# members = [] diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index c9aac38..21f7713 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,11 +1,12 @@ use crate::merkle::NearMerkleTree; use crate::variables::{ - BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, BuildEndorsement, CryptoHashVariable, - HeaderInnerVariable, HeaderVariable, InnerLiteHash, MerklePathVariable, ProofVariable, - PublicKeyVariable, StakeInfoVariable, ValidatorStakeVariable, + ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, BuildEndorsement, + CryptoHashVariable, HeaderVariable, MerklePathVariable, ProofVariable, StakeInfoVariable, + ValidatorStakeVariable, }; -use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; +use plonky2x::prelude::plonky2::plonk::config::GenericHashOut; use plonky2x::prelude::*; +use pretty_assertions::assert_eq; pub trait Verify, const D: usize> { fn ensure_not_already_verified( @@ -27,11 +28,11 @@ pub trait Verify, const D: usize> { next_bps: &BpsArr, ) -> BoolVariable; - fn validate_eddsa_signatures( + fn validate_signatures( &mut self, - approvals_after_next: BpsApprovals, - epoch_bps: BpsArr, - approval_message_hash: BytesVariable<41>, + approvals: BpsApprovals, + bps: BpsArr, + approval_message: ApprovalMessage, ) -> StakeInfoVariable; fn ensure_stake_is_sufficient(&mut self, stake: &StakeInfoVariable) -> BoolVariable; @@ -69,15 +70,6 @@ pub trait Verify, const D: usize> { block_hash: &CryptoHashVariable, ) -> BoolVariable; - fn header_hash( - &mut self, - inner_lite_hash: &HeaderInnerVariable, - inner_rest_hash: &CryptoHashVariable, - prev_block_hash: &CryptoHashVariable, - ) -> CryptoHashVariable; - - fn inner_lite_hash(&mut self, inner_lite: &HeaderInnerVariable) -> CryptoHashVariable; - fn assertx(&mut self, condition: BoolVariable); } @@ -97,7 +89,6 @@ impl, const D: usize> Verify for CircuitBuilder BoolVariable { let epoch = self.is_equal(head.inner_lite.epoch_id, *epoch_id); let next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); - self.or(epoch, next_epoch) } @@ -113,38 +104,34 @@ impl, const D: usize> Verify for CircuitBuilder( &mut self, - approvals_after_next: BpsApprovals, - epoch_bps: BpsArr, - approval_message: BytesVariable<41>, + approvals_after_next: BpsApprovals, + epoch_bps: BpsArr, + approval_message: ApprovalMessage, ) -> StakeInfoVariable { - assert!(approvals_after_next.is_active.len() == NUM_BLOCK_PRODUCER_SEATS); - assert!(approvals_after_next.signatures.len() == NUM_BLOCK_PRODUCER_SEATS); + assert_eq!(approvals_after_next.is_active.len(), LEN); + assert_eq!(approvals_after_next.signatures.len(), LEN); + assert_eq!(epoch_bps.data.len(), LEN); + + let messages = [approval_message; LEN]; - // TODO: configurable - const MSG_LEN: usize = 41; + let mut pubkeys = vec![]; + let mut total_stake = self.zero(); + let mut approved_stake = self.zero(); - // TODO: helper fn to swallow any inconsistencies with configured epoch_bps - let messages = [approval_message; NUM_BLOCK_PRODUCER_SEATS]; + for i in 0..LEN { + let vs = &epoch_bps.data[i]; - let pubkeys: Vec = epoch_bps - .data - .iter() - .map(|vs| vs.public_key.clone()) - .collect(); + pubkeys.push(vs.public_key.clone()); - // TODO: also helper to swallow any misconfigs - // Here we ensure that all active participants have signed - self.curta_eddsa_verify_sigs_conditional::( + let maybe_add = self.add(approved_stake, vs.stake); + approved_stake = + self.select(approvals_after_next.is_active[i], maybe_add, approved_stake); + total_stake = self.add(total_stake, vs.stake); + } + + self.curta_eddsa_verify_sigs_conditional( approvals_after_next.is_active.clone(), None, ArrayVariable::new(messages.to_vec()), @@ -152,17 +139,6 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder BoolVariable { + // 2/3 stake let numerator = self.constant(2.into()); let denominator = self.constant(3.into()); @@ -198,11 +175,7 @@ impl, const D: usize> Verify for CircuitBuilder BoolVariable { - let hash = self.header_hash( - &head.inner_lite, - &head.inner_rest_hash, - &head.prev_block_hash, - ); + let hash = head.hash(self); self.is_equal(hash, *outcome_proof_block_hash) } @@ -229,9 +202,7 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder CryptoHashVariable { - let inner_lite_hash = self.inner_lite_hash(&inner_lite); - let lite_rest = self.curta_sha256_pair(inner_lite_hash, *inner_rest_hash); - let hash = self.curta_sha256_pair(lite_rest, *prev_block_hash); - self.watch(&hash, "header_hash"); - hash - } - - // TODO: convert to hash here - fn inner_lite_hash(&mut self, inner_lite: &HeaderInnerVariable) -> CryptoHashVariable { - let mut input_stream = VariableStream::new(); - input_stream.write(&inner_lite.height); - input_stream.write(&inner_lite.epoch_id); - input_stream.write(&inner_lite.next_epoch_id); - input_stream.write(&inner_lite.prev_state_root); - input_stream.write(&inner_lite.outcome_root); - input_stream.write(&inner_lite.timestamp); - input_stream.write(&inner_lite.next_bp_hash); - input_stream.write(&inner_lite.block_merkle_root); - - let output_bytes = self.hint(input_stream, InnerLiteHash::<208>); - let inner_lite_bytes = output_bytes.read::>(self); - self.watch(&inner_lite_bytes, "inner_lite_bytes"); - - let inner_lite_hash = self.curta_sha256(&inner_lite_bytes.0); - self.watch(&inner_lite_hash, "inner_lite_hash"); - inner_lite_hash - } } pub trait SyncCircuit, const D: usize> { @@ -304,7 +241,7 @@ pub trait SyncCircuit, const D: usize> { next_block: BlockVariable, ); - fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> BytesVariable<41>; + fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> ApprovalMessage; } impl, const D: usize> SyncCircuit for CircuitBuilder { @@ -314,65 +251,56 @@ impl, const D: usize> SyncCircuit for CircuitBuilder epoch_bps: BpsArr, next_block: BlockVariable, ) { - let a = self.ensure_not_already_verified(&head, &next_block.inner_lite.height); + let a = self.ensure_not_already_verified(&head, &next_block.header.inner_lite.height); self.assertx(a); - let b = self.ensure_epoch_is_current_or_next(&head, &next_block.inner_lite.epoch_id); + let b = self.ensure_epoch_is_current_or_next(&head, &next_block.header.inner_lite.epoch_id); self.assertx(b); let c = self.ensure_if_next_epoch_contains_next_bps( &head, - &next_block.inner_lite.epoch_id, + &next_block.header.inner_lite.epoch_id, &next_block.next_bps, ); self.assertx(c); - let new_head = HeaderVariable { - prev_block_hash: next_block.prev_block_hash, - inner_rest_hash: next_block.inner_rest_hash, - inner_lite: next_block.inner_lite.clone(), - }; - self.watch(&new_head, "new_head"); - let approval = self.reconstruct_approval_message(&next_block); - self.watch(&approval, "approval_msg"); - let stake = - self.validate_eddsa_signatures(next_block.approvals_after_next, epoch_bps, approval); - self.watch(&stake, "stake"); + let stake = self.validate_signatures(next_block.approvals_after_next, epoch_bps, approval); let d = self.ensure_stake_is_sufficient(&stake); self.assertx(d); - //c = self.ensure_next_bps_is_valid(&head.inner_lite.next_bp_hash, next_block.next_bps) - // Self::ensure_next_bps_is_valid( - // &next_block.inner_lite.next_bp_hash, - // next_block.next_bps, - // ) - // + // TODO: hashing bps + // if next_block.next_bps.len() > 0 { + // let c = self.ensure_next_bps_is_valid( + // &head.inner_lite.next_bp_hash, + // Some(&next_block.next_bps), + // ); + // self.assertx(c); + // self.write::>(next_block.next_bps); + //} + self.watch(&next_block.header, "new_head"); + self.write::(next_block.header); // TODO: decide what to write here for evm - self.write(new_head); // self.evm_write(next_block.inner_lite.block_merkle_root); } // TODO: make const fn here to test len with real approval - fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> BytesVariable<41> { - let next_header_hash = self.header_hash( - &next_block.inner_lite, - &next_block.inner_rest_hash, - &next_block.prev_block_hash, - ); - + fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> ApprovalMessage { + let next_header_hash = next_block.header.hash(self); let next_block_hash = self.curta_sha256_pair(next_block.next_block_inner_hash, next_header_hash); let mut input_stream = VariableStream::new(); input_stream.write(&next_block_hash); - input_stream.write(&next_block.inner_lite.height); - let output_stream = self.hint(input_stream, BuildEndorsement::<41>); - let approval_message = output_stream.read::>(self); - self.watch(&approval_message, "approval_message"); - approval_message + input_stream.write(&next_block.header.inner_lite.height); + + let output_stream = self.hint(input_stream, BuildEndorsement); + + let msg = output_stream.read::(self); + self.watch(&msg, "approval_message"); + msg } } @@ -388,11 +316,7 @@ impl, const D: usize> VerifyCircuit for CircuitBuild &mut self, proof: ProofVariable, ) -> BoolVariable { - let block_hash = self.header_hash( - &proof.block_header.inner_lite, - &proof.block_header.inner_rest_hash, - &proof.block_header.prev_block_hash, - ); + let block_hash = proof.block_header.hash(self); let block_hash_matches = self.is_equal(block_hash, proof.outcome_proof_block_hash); self.watch(&block_hash_matches, "block_hash_matches"); @@ -409,8 +333,8 @@ impl, const D: usize> VerifyCircuit for CircuitBuild self.verify_block(&proof.head_block_root, &proof.block_proof, &block_hash); self.watch(&block_matches, "block_matches"); - let verified = self.and(block_matches, outcome_matches); - let verified = self.and(verified, block_hash_matches); + let comp = self.and(block_matches, outcome_matches); + let verified = self.and(comp, block_hash_matches); self.assertx(verified); verified } @@ -425,11 +349,14 @@ mod tests { LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, }; use near_primitives::hash::CryptoHash; - use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; + use plonky2x::frontend::{ + ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable, vars::EvmVariable, + }; use plonky2x::{ backend::circuit::{PublicInput, PublicOutput}, frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue, }; + use pretty_assertions::{assert_eq, assert_ne}; use serde::de::DeserializeOwned; use std::str::FromStr; @@ -441,6 +368,7 @@ mod tests { serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) .unwrap() } + fn get_next_epoch() -> LightClientBlockView { fixture("2.json") } @@ -456,6 +384,7 @@ mod tests { inner_lite: h.inner_lite, } } + fn test_state() -> (Header, Vec, LightClientBlockView) { let first = get_first_epoch(); let next = get_next_epoch(); @@ -480,7 +409,6 @@ mod tests { } } - // TODO: define inputs and logic at once fn builder_suite( define: F, writer: WriteInputs, @@ -514,11 +442,7 @@ mod tests { let define = |builder: &mut B| { let header = builder.read::(); - let result = builder.header_hash( - &header.inner_lite, - &header.inner_rest_hash, - &header.prev_block_hash, - ); + let result = header.hash(builder); builder.write(result); }; @@ -629,14 +553,8 @@ mod tests { builder.write::(is_valid); }; let writer = |input: &mut PI| { - input.write::(header.into()); - input.write::>( - bps.clone() - .into_iter() - .map(|s| Into::::into(s)) - .map(Into::into) - .collect(), - ) + input.write::(header.clone().into()); + input.write::>(bps_to_variable(Some(bps))); }; let assertions = |mut output: PO| { assert!(output.read::(), "epoch is current"); @@ -743,8 +661,7 @@ mod tests { } #[test] - fn test_sync_accross_boundaries_blackbox() { - pretty_env_logger::try_init().unwrap_or_default(); + fn test_sync_across_boundaries_blackbox() { let (head, next_bps, next_block) = test_state(); let define = |builder: &mut B| { @@ -755,14 +672,7 @@ mod tests { }; let writer = |input: &mut PI| { input.write::(head.into()); - input.write::>( - next_bps - .clone() - .into_iter() - .map(|s| Into::::into(s)) - .map(Into::into) - .collect(), - ); + input.write::>(bps_to_variable(Some(next_bps))); input.write::(next_block.clone().into()); }; let assertions = |mut output: PO| { @@ -771,7 +681,7 @@ mod tests { }; builder_suite(define, writer, assertions); - // let mut sync_and_update = |next_block: LightClientBlockView| { + // TODO: let mut sync_and_update = |next_block: LightClientBlockView| { // let next_bps = builder // .constant::>( // bps_var @@ -811,116 +721,74 @@ mod tests { } #[test] - fn test_one_signature() { + fn test_bounded_signatures() { let (_, bps, next_block) = test_state(); - const BPS_AMT: usize = 50; - - let msg: [u8; 41] = Protocol::reconstruct_approval_message(&next_block) - .unwrap() - .try_into() - .unwrap(); - let msgs = [msg; BPS_AMT]; - - let mut nbps: Vec = vec![]; - let mut sigs: Vec> = vec![]; - - // Filter out null bps - bps.into_iter() - .zip(next_block.approvals_after_next.into_iter()) - .filter(|(_, s)| s.is_some()) - .take(BPS_AMT) - .for_each(|(v, s)| { - assert!(s.is_some()); - let v: ValidatorStakeVariableValue = v.into(); - nbps.push(v.public_key); - let s: SignatureVariableValue = s.into(); - sigs.push(s.signature.into()); - }); - - println!("msgs: {:?}", msgs); - println!("bps: {:?}", nbps); - println!("sigs: {:?}", sigs); + const BPS_AMT: usize = 5; let define = |builder: &mut B| { - let pubkeys = builder.read::>(); - let msgs = builder.read::, BPS_AMT>>(); - let sigs = builder.read::>(); + let bps = builder.read::>(); + let next_block = builder.read::(); + + let next_block_approvals = BpsApprovals { + signatures: next_block.approvals_after_next.signatures[0..BPS_AMT] + .to_vec() + .into(), + is_active: next_block.approvals_after_next.is_active[0..BPS_AMT] + .to_vec() + .into(), + }; + + let msg = builder.reconstruct_approval_message(&next_block); - builder.curta_eddsa_verify_sigs(msgs, None, sigs, pubkeys); + builder.validate_signatures(next_block_approvals, bps, msg); }; let writer = |input: &mut PI| { - input.write::>(nbps.into()); - input.write::, BPS_AMT>>(msgs.into()); - input.write::>(sigs.into()); + input.write::>( + bps_to_variable(Some(bps.clone()))[0..BPS_AMT].into(), + ); + input.write::(next_block.into()); }; let assertions = |mut _output: PO| {}; builder_suite(define, writer, assertions); } #[test] - fn test_signatures() { - let (_, next_bps, next_block) = test_state(); - + fn test_reconstruct_approval_msg() { + let (_, _, next_block) = test_state(); let define = |builder: &mut B| { - let pubkeys = builder.read::>(); - let messages = builder.read::>>(); - let signatures = builder.read::>(); - //let next_block = builder.read::(); - - builder.curta_eddsa_verify_sigs(messages, None, signatures, pubkeys) + let next_block = builder.read::(); + let os = builder.reconstruct_approval_message(&next_block); + builder.write::(os); }; let writer = |input: &mut PI| { - let vs = next_bps - .clone() - .into_iter() - .map(Into::::into) - .map(Into::>::into) - .map(|s| s.public_key) - .collect_vec(); - input.write::>(vs.into()); - - let msg: [u8; 41] = Protocol::reconstruct_approval_message(&next_block) - .unwrap() - .try_into() - .unwrap(); - let msgs = [msg; NUM_BLOCK_PRODUCER_SEATS]; - input.write::>>(msgs.into()); - let sigs = next_block - .approvals_after_next - .clone() - .into_iter() - .map(Into::>::into) - .map(|s| s.signature) - .collect_vec(); - input.write::>(sigs.into()); + input.write::(next_block.clone().into()); + }; + let assertions = |mut output: PO| { + let created = output.read::(); + let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); + assert_eq!(msg, created); }; - let assertions = |mut _output: PO| {}; builder_suite(define, writer, assertions); } #[test] - fn test_reconstruct_approval_msg() { - let (_, next_bps, next_block) = test_state(); - println!( - "bps len {} sigs len {} next len {}", - next_bps.len(), - next_block.approvals_after_next.len(), - next_block.next_bps.as_ref().unwrap().len() - ); - + fn test_raw_le_bytes() { + let (_, _, next_block) = test_state(); let define = |builder: &mut B| { let next_block = builder.read::(); - let os = builder.reconstruct_approval_message(&next_block); - builder.write::>(os); + let height_bits = next_block.header.inner_lite.height.to_le_bits(builder); + let bytes = height_bits + .chunks(8) + .map(|chunk| ByteVariable(chunk.try_into().unwrap())) + .collect_vec(); + builder.write::>(BytesVariable(bytes.try_into().unwrap())); }; let writer = |input: &mut PI| { input.write::(next_block.clone().into()); }; let assertions = |mut output: PO| { - let msghash = output.read::>(); - let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); - assert_eq!(msghash, msghash); - println!("msg: {:?}", msg); + let bytes = output.read::>(); + assert_eq!(bytes, next_block.inner_lite.height.to_le_bytes()); }; builder_suite(define, writer, assertions); } diff --git a/circuits/plonky2x/src/codec.rs b/circuits/plonky2x/src/codec.rs index 46472f1..643ee11 100644 --- a/circuits/plonky2x/src/codec.rs +++ b/circuits/plonky2x/src/codec.rs @@ -37,29 +37,29 @@ pub trait Borsh: Sized { // ) -> Vec { // let x = self.variables()[0]; // builder.beacon_get_block_header(block_root) - // >::to_little_endian(&self, &mut vec![]); - // U64Target::from(self).encode(builder); - // self.limbs - // .iter() - // .rev() - // .flat_map(|x| x.encode(builder)) - // .collect::>() - //} +// >::to_little_endian(&self, &mut vec![]); +// U64Target::from(self).encode(builder); +// self.limbs +// .iter() +// .rev() +// .flat_map(|x| x.encode(builder)) +// .collect::>() +//} - // fn decodeb, const D: usize>( - // builder: &mut CircuitBuilder, - // bytes: &[ByteVariable], - // ) -> Self { - // assert_eq!(bytes.len(), 2 * 4); - // let mut limbs = [U32Variable::init_unsafe(builder); 2]; - // limbs[0].to_little_endian(&mut bytes[0..4]); - // U32Variable::from_variables(builder, variables) - // for i in 0..2 { - // limbs[i] = U32Variable::decodeb(builder, &bytes[i * 4..(i + 1) * 4]); - // } - // limbs.reverse(); - // Self { limbs } - // } +// fn decodeb, const D: usize>( +// builder: &mut CircuitBuilder, +// bytes: &[ByteVariable], +// ) -> Self { +// assert_eq!(bytes.len(), 2 * 4); +// let mut limbs = [U32Variable::init_unsafe(builder); 2]; +// limbs[0].to_little_endian(&mut bytes[0..4]); +// U32Variable::from_variables(builder, variables) +// for i in 0..2 { +// limbs[i] = U32Variable::decodeb(builder, &bytes[i * 4..(i + 1) * 4]); +// } +// limbs.reverse(); +// Self { limbs } +// } //} // fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { diff --git a/circuits/plonky2x/src/input.rs b/circuits/plonky2x/src/input.rs index e69de29..8b13789 100644 --- a/circuits/plonky2x/src/input.rs +++ b/circuits/plonky2x/src/input.rs @@ -0,0 +1 @@ + diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs index f9fef66..90f47c1 100644 --- a/circuits/plonky2x/src/merkle.rs +++ b/circuits/plonky2x/src/merkle.rs @@ -42,3 +42,10 @@ impl, const D: usize> NearMerkleTree for CircuitBuilder bool { + match dir { + near_light_client_protocol::Direction::Left => true, + near_light_client_protocol::Direction::Right => false, + } +} diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index a8879b1..47b429f 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -1,4 +1,5 @@ -use ethers::types::{H256, U256}; +use crate::merkle::determine_direction; +use ethers::types::U256; use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; use near_light_client_protocol::prelude::{Header, Itertools}; use near_light_client_protocol::{ @@ -7,56 +8,51 @@ use near_light_client_protocol::{ }; use near_light_client_protocol::{Proof, StakeInfo}; use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::{ - EDDSASignatureVariable, DUMMY_SIGNATURE, -}; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::{ - EDDSASignatureVariableValue, DUMMY_PUBLIC_KEY, -}; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; +use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue; use plonky2x::frontend::hint::simple::hint::Hint; +use plonky2x::frontend::vars::EvmVariable; use plonky2x::frontend::{curta::ec::point::CompressedEdwardsYVariable, uint::Uint}; use plonky2x::prelude::*; +use pretty_assertions::assert_eq; use serde::{Deserialize, Serialize}; +// TODO: remove any unused fields like account id etc? // TODO: if we use borsh here be careful of order -// TODO: borsh? would need encoding for messages, make a hint -// -// TODO: optional variable -// TODO: get constrained numbers -// -// EVM write synced -// EVM write proof -// TODO: check if this BPS seats changers for testnet/mainnet +/// TODO: check if BPS seats changes for testnet/mainnet /// Type for omitting the size across the codebase for arrays that are the same size as BPS pub(crate) type BpsArr = ArrayVariable; pub type CryptoHashVariable = Bytes32Variable; pub type BlockHeightVariable = U64Variable; pub type BalanceVariable = U128Variable; -pub type AccountIdVariable = BytesVariable<{ AccountId::MAX_LEN }>; +pub type AccountIdVariable = BytesVariable<{ AccountId::MAX_LEN }>; // TODO: decide if this is a + // reasonable way +// TODO: add handling of empty path elements #[derive(CircuitVariable, Clone, Debug)] -pub struct MerklePathVariable { - pub path: ArrayVariable, - pub indices: ArrayVariable, +pub struct MerklePathVariable { + pub path: ArrayVariable, + pub indices: ArrayVariable, } +impl From for MerklePathVariableValue { + fn from(path: MerklePath) -> Self { + assert!(path.len() <= A); -impl From for MerklePathVariableValue { - fn from(value: MerklePath) -> Self { - assert_eq!(value.len(), M, "Merkle path must be of length M"); - let indices: Vec = value + let mut indices = path .iter() - .map(|x| match x.direction { - // TODO: add tests for this - near_light_client_protocol::Direction::Left => true, - near_light_client_protocol::Direction::Right => false, - }) - .collect(); - Self { - path: value.iter().map(|x| x.hash.0.into()).collect::>(), - indices, - } + .map(|x| &x.direction) + .map(determine_direction) + .collect_vec(); + // FIXME: Hmm, this seems problematic potentially since it might hash the wrong way + // verify. + indices.resize(A, Default::default()); + + let mut path = path.iter().map(|x| x.hash.0.into()).collect_vec(); + path.resize(A, Default::default()); + + Self { path, indices } } } @@ -75,6 +71,27 @@ impl From
for HeaderVariableValue { } } } +impl From for HeaderVariableValue { + fn from(header: LightClientBlockView) -> Self { + Self { + prev_block_hash: header.prev_block_hash.0.into(), + inner_rest_hash: header.inner_rest_hash.0.into(), + inner_lite: header.inner_lite.into(), + } + } +} +impl HeaderVariable { + pub(crate) fn hash, const D: usize>( + &self, + b: &mut CircuitBuilder, + ) -> CryptoHashVariable { + let inner_lite = self.inner_lite.hash(b); + let lite_rest = b.curta_sha256_pair(inner_lite, self.inner_rest_hash); + let hash = b.curta_sha256_pair(lite_rest, self.prev_block_hash); + b.watch(&hash, "header_hash"); + hash + } +} #[derive(CircuitVariable, Clone, Debug)] pub struct HeaderInnerVariable { @@ -106,12 +123,41 @@ impl From for HeaderInnerVariableValue, const D: usize>( + &self, + b: &mut CircuitBuilder, + ) -> BytesVariable { + // TODO: doubt we can abi encode this + let mut input_stream = VariableStream::new(); + input_stream.write(&self.height); + input_stream.write(&self.epoch_id); + input_stream.write(&self.next_epoch_id); + input_stream.write(&self.prev_state_root); + input_stream.write(&self.outcome_root); + input_stream.write(&self.timestamp); + input_stream.write(&self.next_bp_hash); + input_stream.write(&self.block_merkle_root); + + let output_bytes = b.hint(input_stream, EncodeInner); + let bytes = output_bytes.read::>(b); + b.watch(&bytes, "inner_lite_bytes"); + bytes + } + pub(crate) fn hash, const D: usize>( + &self, + b: &mut CircuitBuilder, + ) -> CryptoHashVariable { + let bytes = self.encode(b); + b.curta_sha256(&bytes.0) + } +} -// TODO: test this individually as i think they arent borsh encoded correctly -// this is incredibly error prone #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct InnerLiteHash; -impl, const D: usize, const N: usize> Hint for InnerLiteHash { +pub struct EncodeInner; +impl, const D: usize> Hint for EncodeInner { fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let mut bytes: Vec = vec![]; let height = input_stream.read_value::(); @@ -132,100 +178,118 @@ impl, const D: usize, const N: usize> Hint for Inner bytes.extend_from_slice(&next_bp_hash.0); bytes.extend_from_slice(&block_merkle_root.0); - assert_eq!(bytes.len(), N, "expected {} bytes, got {}", N, bytes.len()); + assert_eq!( + bytes.len(), + INNER_ENCODED_LEN, + "expected {} bytes, got {}", + INNER_ENCODED_LEN, + bytes.len() + ); - let bytes: [u8; N] = bytes.try_into().unwrap(); - output_stream.write_value::>(bytes); + let bytes: [u8; INNER_ENCODED_LEN] = bytes.try_into().unwrap(); + output_stream.write_value::>(bytes); } } #[derive(CircuitVariable, Clone, Debug)] pub struct BlockVariable { - pub prev_block_hash: CryptoHashVariable, + pub header: HeaderVariable, pub next_block_inner_hash: CryptoHashVariable, - pub inner_lite: HeaderInnerVariable, - pub inner_rest_hash: CryptoHashVariable, pub next_bps: BpsArr, - pub approvals_after_next: BpsApprovals, + pub approvals_after_next: BpsApprovals, } impl From for BlockVariableValue { fn from(block: LightClientBlockView) -> Self { Self { - prev_block_hash: block.prev_block_hash.0.into(), next_block_inner_hash: block.next_block_inner_hash.0.into(), - inner_lite: block.inner_lite.into(), - inner_rest_hash: block.inner_rest_hash.0.into(), - next_bps: if let Some(next_bps) = block.next_bps { - next_bps - .into_iter() - .map(|s| { - let s: ValidatorStake = s.into(); - s - }) - .map(Into::into) - .collect() - } else { - // FIXME: needs to fill to spsace - vec![] - } - .into(), + header: block.clone().into(), + next_bps: bps_to_variable(block.next_bps), approvals_after_next: block.approvals_after_next.into(), } } } +pub(crate) fn bps_to_variable>( + next_bps: Option>, +) -> Vec> { + next_bps + .map(|next_bps| { + next_bps + .into_iter() + .take(NUM_BLOCK_PRODUCER_SEATS) + .map(Into::::into) + .map(Into::>::into) + .collect() + }) + .unwrap_or_else(|| vec![Default::default(); NUM_BLOCK_PRODUCER_SEATS]) +} + #[derive(CircuitVariable, Clone, Debug)] -pub struct BpsApprovals { - pub is_active: BpsArr, - pub signatures: BpsArr, +pub struct BpsApprovals { + pub is_active: BpsArr, + pub signatures: BpsArr, } -impl From>>> for BpsApprovalsValue { +impl From>>> + for BpsApprovalsValue +{ fn from(approvals: Vec>>) -> Self { - let mut is_active = vec![]; - let mut signatures = vec![]; - // TODO: bounding here + let mut is_active = vec![false; AMT]; + let mut signatures = vec![Default::default(); AMT]; + approvals .into_iter() - .take(NUM_BLOCK_PRODUCER_SEATS) - .for_each(|s| { - is_active.push(s.is_some()); + .take(AMT) + .enumerate() + .for_each(|(i, s)| { + is_active[i] = s.is_some(); let s: SignatureVariableValue = s.into(); - signatures.push(s.signature); + signatures[i] = s; }); - assert_eq!(is_active.len(), NUM_BLOCK_PRODUCER_SEATS); - assert_eq!(signatures.len(), NUM_BLOCK_PRODUCER_SEATS); - Self { is_active: is_active.into(), - signatures: signatures.into(), + signatures: signatures + .into_iter() + .map(|x| x.signature) + .collect_vec() + .into(), } } } #[derive(CircuitVariable, Clone, Debug)] pub struct ValidatorStakeVariable { - /// Account that stakes money. pub account_id: AccountIdVariable, - /// Public key of the proposed validator. pub public_key: PublicKeyVariable, - /// Stake / weight of the validator. pub stake: BalanceVariable, } impl From for ValidatorStakeVariableValue { - fn from(stake: ValidatorStake) -> Self { - let pk = stake.public_key().key_data(); - let y = CompressedEdwardsY::from_slice(&pk).expect("CompressedEdwardsY::from_slice"); - // TODO: fixme - let mut id_bytes = borsh::to_vec(stake.account_id()).unwrap(); - id_bytes.resize(AccountId::MAX_LEN, 0); + fn from(vs: ValidatorStake) -> Self { + let public_key = CompressedEdwardsY(vs.public_key().unwrap_as_ed25519().0); + let stake = vs.stake(); + let mut account_id = vs.take_account_id().as_str().as_bytes().to_vec(); + account_id.resize(AccountId::MAX_LEN, 0); + Self { + account_id: account_id.try_into().unwrap(), // SAFETY: already checked this above + public_key: public_key.into(), + stake: stake.into(), + } + } +} + +impl Default for ValidatorStakeVariableValue { + fn default() -> Self { + let bytes: [u8; AccountId::MAX_LEN] = [0u8; AccountId::MAX_LEN]; + let pk = CompressedEdwardsY::default(); + let stake = 0_u128; + Self { - account_id: id_bytes.try_into().unwrap(), - public_key: y.into(), - stake: stake.stake().into(), + account_id: bytes.into(), + public_key: pk.into(), + stake: stake.into(), } } } @@ -240,31 +304,38 @@ pub struct SignatureVariable { impl From>> for SignatureVariableValue { fn from(sig: Option>) -> Self { - let dummy_r = CompressedEdwardsY(DUMMY_SIGNATURE[0..32].try_into().unwrap()); - let dummy_s = U256::from_little_endian(&DUMMY_SIGNATURE[32..]); - - let signature = sig - .map(|s| match *s { - Signature::ED25519(s) => EDDSASignatureVariableValue { + sig.and_then(|s| match *s { + Signature::ED25519(s) => Some(Self { + signature: EDDSASignatureVariableValue { r: CompressedEdwardsY(*s.r_bytes()), s: U256::from_little_endian(s.s_bytes()), }, - Signature::SECP256K1(_) => { - panic!("ECDSA is being phased out and validators don't use it") - } - }) - .unwrap_or_else(|| EDDSASignatureVariableValue { - r: dummy_r, - s: dummy_s, - }); - Self { signature } + }), + // Silently ignores invalid signatures (ECDSA) + // The reasoning being that ECDSA is being phased out and almost all validators + // use EDDSA. + // If we still need this, we should implement ECDSA. + _ => None, + }) + .unwrap_or_default() + } +} + +impl Default for SignatureVariableValue { + fn default() -> Self { + Self { + signature: EDDSASignatureVariableValue { + r: CompressedEdwardsY::default(), + s: Default::default(), + }, + } } } #[derive(CircuitVariable, Clone, Debug)] pub struct ProofVariable { pub head_block_root: CryptoHashVariable, - // TODO: constrain the outcome hash by borsh encoding + // TODO: constrain the outcome hash by borsh encoding in the circuit, not here pub outcome_hash: CryptoHashVariable, pub outcome_proof_block_hash: CryptoHashVariable, pub outcome_proof: MerklePathVariable, // TODO: get real number here @@ -347,11 +418,12 @@ impl From for StakeInfoVariableValue { // } // } +pub type ApprovalMessage = BytesVariable<41>; // TODO: not sure these even need to be hints #[derive(Clone, Debug, Serialize, Deserialize)] -pub struct BuildEndorsement; +pub struct BuildEndorsement; -impl, const D: usize, const N: usize> Hint for BuildEndorsement { +impl, const D: usize> Hint for BuildEndorsement { fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let mut bytes = vec![]; let next_block_hash = input_stream.read_value::(); @@ -359,10 +431,9 @@ impl, const D: usize, const N: usize> Hint for Build bytes.push(0u8); bytes.extend_from_slice(&next_block_hash.as_bytes()); - bytes.extend_from_slice(&next_block_height.to_le_bytes()); + bytes.extend_from_slice(&(next_block_height + 2).to_le_bytes()); - assert_eq!(bytes.len(), N, "expected {} bytes, got {}", N, bytes.len()); - output_stream.write_value::>(bytes.try_into().unwrap()); + output_stream.write_value::(bytes.try_into().unwrap()); } } // impl BuildEndorsement { @@ -383,13 +454,3 @@ impl, const D: usize, const N: usize> Hint for Build // Self // } // } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn write_tests() { - todo!() - } -} diff --git a/crates/protocol/src/config.rs b/crates/protocol/src/config.rs index 1529a35..c536fe4 100644 --- a/crates/protocol/src/config.rs +++ b/crates/protocol/src/config.rs @@ -1,5 +1,3 @@ -use near_primitives_core::types::NumSeats; - // https://github.com/near/nearcore/blob/master/nearcore/src/config.rs#L133C1-L134C1 // TODO: expose this from NP, currently this is a risk that the light client could be exploited // if the max seats changes without knowing diff --git a/crates/protocol/src/prelude.rs b/crates/protocol/src/prelude.rs index 3f3893e..10089e0 100644 --- a/crates/protocol/src/prelude.rs +++ b/crates/protocol/src/prelude.rs @@ -1,11 +1,11 @@ pub use anyhow::anyhow; pub use anyhow::Result; +pub use itertools::Itertools; pub use log::{debug, error, info, trace, warn}; +pub use near_primitives::types::AccountId; pub use near_primitives_core::borsh::{self, BorshDeserialize, BorshSerialize}; pub use near_primitives_core::hash::CryptoHash; pub use serde::{Deserialize, Serialize}; -pub use itertools::Itertools; -pub use near_primitives::types::AccountId; pub type Header = near_primitives::views::LightClientBlockLiteView; pub type BasicProof = From e2cc35c2217f1afd37cad6efe52f320b71152962 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 16 Jan 2024 17:25:53 +0000 Subject: [PATCH 21/67] wip: maybe no hinting for encoding --- circuits/plonky2x/src/builder.rs | 72 +++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 21f7713..ad2c1a0 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -4,6 +4,7 @@ use crate::variables::{ CryptoHashVariable, HeaderVariable, MerklePathVariable, ProofVariable, StakeInfoVariable, ValidatorStakeVariable, }; +use near_light_client_protocol::prelude::Itertools; use plonky2x::prelude::plonky2::plonk::config::GenericHashOut; use plonky2x::prelude::*; use pretty_assertions::assert_eq; @@ -292,15 +293,25 @@ impl, const D: usize> SyncCircuit for CircuitBuilder let next_block_hash = self.curta_sha256_pair(next_block.next_block_inner_hash, next_header_hash); - let mut input_stream = VariableStream::new(); - input_stream.write(&next_block_hash); - input_stream.write(&next_block.header.inner_lite.height); - - let output_stream = self.hint(input_stream, BuildEndorsement); - - let msg = output_stream.read::(self); - self.watch(&msg, "approval_message"); - msg + let should_hint = false; + // TODO: decide if we should constrain this way or just hint in the manual encodes + if should_hint { + let mut input_stream = VariableStream::new(); + input_stream.write(&next_block_hash); + input_stream.write(&next_block.header.inner_lite.height); + let output_stream = self.hint(input_stream, BuildEndorsement); + let msg = output_stream.read::(self); + self.watch(&msg, "approval_message"); + msg + } else { + let mut bytes = vec![ByteVariable::zero(self)]; + bytes.extend_from_slice(&next_block_hash.as_bytes()); + let blocks_to_advance = self.constant::(2u64.into()); + let height = self.add(blocks_to_advance, next_block.header.inner_lite.height); + bytes.extend_from_slice(&to_le_bytes::<_, _, D, 8>(self, &height).0); + let bytes: [ByteVariable; 41] = bytes.try_into().unwrap(); + BytesVariable(bytes) + } } } @@ -340,10 +351,32 @@ impl, const D: usize> VerifyCircuit for CircuitBuild } } +fn to_le_bytes, V: CircuitVariable, const D: usize, const N: usize>( + b: &mut CircuitBuilder, + v: &V, +) -> BytesVariable { + let mut bytes = vec![]; + for target in v.targets() { + let mut bits = b.api.split_le(target, 32); + bits.reverse(); + let to_extend = bits + .chunks(8) + .rev() + .map(|chunk| { + let targets = chunk.iter().map(|b| b.target).collect_vec(); + ByteVariable::from_targets(&targets) + }) + .collect_vec(); + bytes.extend(to_extend); + } + BytesVariable(bytes.try_into().unwrap()) +} + #[cfg(test)] mod tests { use super::*; use crate::variables::*; + use ethers::types::U64; use near_light_client_protocol::{ prelude::{BasicProof, Header, Itertools}, LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, @@ -776,11 +809,21 @@ mod tests { let (_, _, next_block) = test_state(); let define = |builder: &mut B| { let next_block = builder.read::(); - let height_bits = next_block.header.inner_lite.height.to_le_bits(builder); - let bytes = height_bits - .chunks(8) - .map(|chunk| ByteVariable(chunk.try_into().unwrap())) - .collect_vec(); + + let mut bytes = vec![]; + for target in next_block.header.inner_lite.height.targets() { + let mut bits = builder.api.split_le(target, 32); + bits.reverse(); + let to_extend = bits + .chunks(8) + .rev() + .map(|chunk| { + let targets = chunk.iter().map(|b| b.target).collect_vec(); + ByteVariable::from_targets(&targets) + }) + .collect_vec(); + bytes.extend(to_extend); + } builder.write::>(BytesVariable(bytes.try_into().unwrap())); }; let writer = |input: &mut PI| { @@ -788,6 +831,7 @@ mod tests { }; let assertions = |mut output: PO| { let bytes = output.read::>(); + println!("{:?}", bytes); assert_eq!(bytes, next_block.inner_lite.height.to_le_bytes()); }; builder_suite(define, writer, assertions); From a10562d055199e8e53494eb4b7256e78fc2f6610 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 16 Jan 2024 17:35:13 +0000 Subject: [PATCH 22/67] wip: check next bps --- circuits/plonky2x/src/builder.rs | 16 ++++++++-------- circuits/plonky2x/src/variables.rs | 10 ++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index ad2c1a0..376a2be 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -273,14 +273,14 @@ impl, const D: usize> SyncCircuit for CircuitBuilder self.assertx(d); // TODO: hashing bps - // if next_block.next_bps.len() > 0 { - // let c = self.ensure_next_bps_is_valid( - // &head.inner_lite.next_bp_hash, - // Some(&next_block.next_bps), - // ); - // self.assertx(c); - // self.write::>(next_block.next_bps); - //} + if next_block.next_bps.len() > 0 { + let c = self.ensure_next_bps_is_valid( + &next_block.header.inner_lite.next_bp_hash, + Some(&next_block.next_bp_hash), + ); + self.assertx(c); + self.write::>(next_block.next_bps); + } self.watch(&next_block.header, "new_head"); self.write::(next_block.header); // TODO: decide what to write here for evm diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 47b429f..7461737 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -197,15 +197,25 @@ pub struct BlockVariable { pub next_block_inner_hash: CryptoHashVariable, pub next_bps: BpsArr, pub approvals_after_next: BpsApprovals, + pub next_bp_hash: CryptoHashVariable, } impl From for BlockVariableValue { fn from(block: LightClientBlockView) -> Self { + let next_bp_hash = block + .next_bps + .as_ref() + .map(|bps| CryptoHash::hash_borsh(bps)) + .unwrap_or_default() + .0 + .into(); + Self { next_block_inner_hash: block.next_block_inner_hash.0.into(), header: block.clone().into(), next_bps: bps_to_variable(block.next_bps), approvals_after_next: block.approvals_after_next.into(), + next_bp_hash, } } } From dc7b740a40808aa98a9e5e8efa3575ec3a9f70c8 Mon Sep 17 00:00:00 2001 From: dndll Date: Wed, 17 Jan 2024 09:30:47 +0000 Subject: [PATCH 23/67] wip: return a value from syncing as per other lib --- circuits/plonky2x/src/builder.rs | 111 ++++++++++------------------- circuits/plonky2x/src/codec.rs | 105 --------------------------- circuits/plonky2x/src/lib.rs | 28 +++++--- circuits/plonky2x/src/merkle.rs | 2 + circuits/plonky2x/src/variables.rs | 40 ++++++++++- 5 files changed, 97 insertions(+), 189 deletions(-) delete mode 100644 circuits/plonky2x/src/codec.rs diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 376a2be..84573ef 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -2,10 +2,9 @@ use crate::merkle::NearMerkleTree; use crate::variables::{ ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, BuildEndorsement, CryptoHashVariable, HeaderVariable, MerklePathVariable, ProofVariable, StakeInfoVariable, - ValidatorStakeVariable, + SyncedVariable, ValidatorStakeVariable, }; use near_light_client_protocol::prelude::Itertools; -use plonky2x::prelude::plonky2::plonk::config::GenericHashOut; use plonky2x::prelude::*; use pretty_assertions::assert_eq; @@ -132,6 +131,7 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder BoolVariable { let hash = head.hash(self); + self.watch(&hash, "header hash"); self.is_equal(hash, *outcome_proof_block_hash) } @@ -200,17 +201,17 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder, const D: usize> { head: HeaderVariable, epoch_bps: BpsArr, next_block: BlockVariable, - ); + ) -> SyncedVariable; fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> ApprovalMessage; } @@ -251,7 +253,7 @@ impl, const D: usize> SyncCircuit for CircuitBuilder head: HeaderVariable, epoch_bps: BpsArr, next_block: BlockVariable, - ) { + ) -> SyncedVariable { let a = self.ensure_not_already_verified(&head, &next_block.header.inner_lite.height); self.assertx(a); @@ -272,22 +274,30 @@ impl, const D: usize> SyncCircuit for CircuitBuilder let d = self.ensure_stake_is_sufficient(&stake); self.assertx(d); - // TODO: hashing bps - if next_block.next_bps.len() > 0 { - let c = self.ensure_next_bps_is_valid( + let (next_bps_epoch, next_bps) = if next_block.next_bps.len() > 0 { + // TODO: hashing bps in circut + let e = self.ensure_next_bps_is_valid( &next_block.header.inner_lite.next_bp_hash, Some(&next_block.next_bp_hash), ); - self.assertx(c); - self.write::>(next_block.next_bps); - } + self.assertx(e); + ( + next_block.header.inner_lite.next_epoch_id, + next_block.next_bps, + ) + } else { + let eid = self.constant::([0u8; 32].into()); + let bps = self.constant::>(Default::default()); + (eid, bps) + }; self.watch(&next_block.header, "new_head"); - self.write::(next_block.header); - // TODO: decide what to write here for evm - // self.evm_write(next_block.inner_lite.block_merkle_root); + SyncedVariable { + new_head: next_block.header, + next_bps_epoch, + next_bps, + } } - // TODO: make const fn here to test len with real approval fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> ApprovalMessage { let next_header_hash = next_block.header.hash(self); let next_block_hash = @@ -328,9 +338,9 @@ impl, const D: usize> VerifyCircuit for CircuitBuild proof: ProofVariable, ) -> BoolVariable { let block_hash = proof.block_header.hash(self); + self.watch(&block_hash, "proof header hash"); let block_hash_matches = self.is_equal(block_hash, proof.outcome_proof_block_hash); - self.watch(&block_hash_matches, "block_hash_matches"); let outcome_matches = self.verify_outcome( &proof.block_header.inner_lite.outcome_root, @@ -338,19 +348,19 @@ impl, const D: usize> VerifyCircuit for CircuitBuild &proof.outcome_hash, &proof.outcome_root_proof, ); - self.watch(&outcome_matches, "outcome_matches"); let block_matches = self.verify_block(&proof.head_block_root, &proof.block_proof, &block_hash); - self.watch(&block_matches, "block_matches"); let comp = self.and(block_matches, outcome_matches); let verified = self.and(comp, block_hash_matches); + self.watch(&verified, "proof verified"); self.assertx(verified); verified } } +// TODO: test this and reuse for block header inner fn to_le_bytes, V: CircuitVariable, const D: usize, const N: usize>( b: &mut CircuitBuilder, v: &V, @@ -376,20 +386,13 @@ fn to_le_bytes, V: CircuitVariable, const D: usize, const mod tests { use super::*; use crate::variables::*; - use ethers::types::U64; use near_light_client_protocol::{ prelude::{BasicProof, Header, Itertools}, - LightClientBlockView, Proof, Protocol, StakeInfo, ValidatorStake, + LightClientBlockView, Protocol, StakeInfo, ValidatorStake, }; use near_primitives::hash::CryptoHash; - use plonky2x::frontend::{ - ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable, vars::EvmVariable, - }; - use plonky2x::{ - backend::circuit::{PublicInput, PublicOutput}, - frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue, - }; - use pretty_assertions::{assert_eq, assert_ne}; + use plonky2x::backend::circuit::{PublicInput, PublicOutput}; + use pretty_assertions::assert_eq; use serde::de::DeserializeOwned; use std::str::FromStr; @@ -434,6 +437,7 @@ mod tests { next, ) } + fn to_header(bv: LightClientBlockView) -> Header { Header { prev_block_hash: bv.prev_block_hash, @@ -694,14 +698,15 @@ mod tests { } #[test] - fn test_sync_across_boundaries_blackbox() { + fn test_sync_across_epoch_boundaries() { let (head, next_bps, next_block) = test_state(); let define = |builder: &mut B| { - let header = builder.read::(); + let head = builder.read::(); let bps = builder.read::>(); let next_block = builder.read::(); - builder.sync(header, bps, next_block); + let synced = builder.sync(head, bps, next_block); + builder.write::(synced); }; let writer = |input: &mut PI| { input.write::(head.into()); @@ -709,48 +714,10 @@ mod tests { input.write::(next_block.clone().into()); }; let assertions = |mut output: PO| { - let header = output.read::(); + let header = output.read::(); println!("header: {:?}", header); }; builder_suite(define, writer, assertions); - - // TODO: let mut sync_and_update = |next_block: LightClientBlockView| { - // let next_bps = builder - // .constant::>( - // bps_var - // .clone() - // .into_iter() - // .map(|s| Into::::into(s)) - // .map(Into::into) - // .collect(), - // ); - // let next_block = builder.constant::(next_block.clone().into()); - // // // Assert we matched the epoch id for the new BPS - // // assert_eq!( - // // head.inner_lite.next_epoch_id, - // // sync_next.next_bps.as_ref().unwrap().0 .0 - // // ); - // // - // // head = sync_next.new_head; - // // next_bps = sync_next.next_bps.unwrap().1; - // // - // // // Assert new head is the new block - // // assert_eq!(head.inner_lite, next_block.inner_lite); - // // // Assert new BPS is from the next block producers because we're - // // // in an epoch boundary - // // assert_eq!( - // // &next_bps, - // // &next_block - // // .next_bps - // // .unwrap() - // // .into_iter() - // // .map(Into::into) - // // .collect_vec() - // // ); - // // next_epoch_id.0 = head.inner_lite.next_epoch_id; - // }; - // sync_and_update(next_block_var.clone()); - // } #[test] diff --git a/circuits/plonky2x/src/codec.rs b/circuits/plonky2x/src/codec.rs deleted file mode 100644 index 643ee11..0000000 --- a/circuits/plonky2x/src/codec.rs +++ /dev/null @@ -1,105 +0,0 @@ -use borsh::BorshSerialize; -use plonky2x::{ - frontend::{hint::simple::hint::Hint, uint::Uint}, - prelude::{ - ByteVariable, CircuitBuilder, CircuitVariable, PlonkParameters, U32Variable, U64Variable, - ValueStream, - }, -}; -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Serialize, Deserialize)] -struct BorshCodec; - -impl, const D: usize> Hint for BorshCodec { - fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { - todo!() - } -} - -// THis isnt quite right, we should probably implement borsh for generic types here but its -// annoying -pub trait Borsh: Sized { - fn encodeb, const D: usize>( - &self, - builder: &mut CircuitBuilder, - ) -> Vec; - fn decodeb, const D: usize>( - builder: &mut CircuitBuilder, - bytes: &[ByteVariable], - ) -> Self; -} - -// impl Borsh for U64Variable { -// fn encodeb, const D: usize>( -// &self, -// builder: &mut CircuitBuilder, -// ) -> Vec { -// let x = self.variables()[0]; -// builder.beacon_get_block_header(block_root) -// >::to_little_endian(&self, &mut vec![]); -// U64Target::from(self).encode(builder); -// self.limbs -// .iter() -// .rev() -// .flat_map(|x| x.encode(builder)) -// .collect::>() -//} - -// fn decodeb, const D: usize>( -// builder: &mut CircuitBuilder, -// bytes: &[ByteVariable], -// ) -> Self { -// assert_eq!(bytes.len(), 2 * 4); -// let mut limbs = [U32Variable::init_unsafe(builder); 2]; -// limbs[0].to_little_endian(&mut bytes[0..4]); -// U32Variable::from_variables(builder, variables) -// for i in 0..2 { -// limbs[i] = U32Variable::decodeb(builder, &bytes[i * 4..(i + 1) * 4]); -// } -// limbs.reverse(); -// Self { limbs } -// } -//} - -// fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { -// let mut bytes = vec![]; -// self.0.to_little_endian(&mut bytes); -// writer.write_all(&bytes) -// } -// -// fn deserialize(reader: &mut R) -> borsh::io::Result { -// let mut bytes = vec![]; -// reader.read_to_end(&mut bytes)?; -// Ok(Borshable(::from_little_endian(&bytes))) -// } -// -macro_rules! borsh_integer { - ($a:ident, $b:ty, $c:expr) => { - impl Borsh for $a { - fn encodeb, const D: usize>( - &self, - builder: &mut CircuitBuilder, - ) -> Vec { - self.limbs - .iter() - .rev() - .flat_map(|x| x.encode(builder)) - .collect::>() - } - - fn decodeb, const D: usize>( - builder: &mut CircuitBuilder, - bytes: &[ByteVariable], - ) -> Self { - assert_eq!(bytes.len(), $c * 4); - let mut limbs = [U32Variable::init_unsafe(builder); $c]; - for i in 0..$c { - limbs[i] = U32Variable::decodeb(builder, &bytes[i * 4..(i + 1) * 4]); - } - limbs.reverse(); - Self { limbs } - } - } - }; -} diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index 4c3e0d6..dc0e003 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,24 +1,29 @@ use plonky2x::prelude::*; use variables::{BlockVariable, BpsArr, HeaderVariable, ProofVariable, ValidatorStakeVariable}; +/// Building blocks injected into the CircuitBuilder mod builder; -mod codec; -mod input; +/// Unprefixed merkle tree without collision resistance mod merkle; mod variables; -// TODO: -// hint/generator for any queries for things that are offchain/expensive to do in a circuit -// -// +// TODO: epoch sync, store head per epoch +// TODO: read bps from rainbow bridge +// TODO: determine how much we can bootstrap from RB +// TODO: evm reads/writes +// TODO: sync & prove for txs later than sync head +// TODO: async proof requests, based on a receipt/txs id (should be able to use light client rpc lib +// TODO: batch proof requests for a set of receipts/txs, must be bounded +// TODO: proof relay +// TODO: proof relay batches and batching factor +// TODO: batching/experimental proofs +// TODO[Style]: Shared trait for protocol functionality between crate <> circuit +// TODO[Style]: macro to share all the same implementation with semantic type differences between +// TODO: determine fees, allows integrators to charge +// protocol crate #[derive(Debug)] pub struct Circuit; -// TODO: here they use a hint to go and get all the inputs offchain -// - -// TODO: decide if to make validator set and other generics at trait level -// or stay in types pub trait SyncCircuit, const D: usize> { fn sync( &mut self, @@ -29,6 +34,7 @@ pub trait SyncCircuit, const D: usize> { } pub trait VerifyCircuit, const D: usize> { + // TODO: read head to determine if need to sync & prove fn verify( &mut self, proof: ProofVariable, diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs index 90f47c1..f7cb1fd 100644 --- a/circuits/plonky2x/src/merkle.rs +++ b/circuits/plonky2x/src/merkle.rs @@ -1,5 +1,7 @@ use plonky2x::prelude::*; +/// This is an unprefixed merkle tree without collision resistance, this should probably adapt the +/// tendermint tree or introduce this functionality to succintx's simple tree pub trait NearMerkleTree { fn get_root_from_merkle_proof_hashed_leaf_unindex( &mut self, diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 7461737..d49fb5f 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -6,7 +6,7 @@ use near_light_client_protocol::{ merkle_util::MerklePath, prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, LightClientBlockView, Signature, ValidatorStake, }; -use near_light_client_protocol::{Proof, StakeInfo}; +use near_light_client_protocol::{Proof, StakeInfo, Synced}; use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue; @@ -464,3 +464,41 @@ impl, const D: usize> Hint for BuildEndorsement { // Self // } // } + +#[derive(CircuitVariable, Clone, Debug)] +pub struct SyncedVariable { + pub new_head: HeaderVariable, + pub next_bps_epoch: CryptoHashVariable, + pub next_bps: BpsArr, +} + +impl From for SyncedVariableValue +where + F: RichField, +{ + fn from(value: Synced) -> Self { + let default_bps = vec![ValidatorStakeVariableValue::default(); NUM_BLOCK_PRODUCER_SEATS]; + Self { + new_head: value.new_head.into(), + next_bps_epoch: value + .next_bps + .as_ref() + .map(|v| v.0 .0 .0.into()) + .unwrap_or_default(), + next_bps: value + .next_bps + .map(|v| v.1.into_iter().map(Into::into).collect_vec()) + .unwrap_or(default_bps), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn tests() { + todo!() + } +} From 6c8189c35db51fc1282f2fb547f616313ec7afaa Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 22 Jan 2024 09:13:29 +0000 Subject: [PATCH 24/67] feat: sync circuit --- .github/workflows/on_pull_request.yml | 16 +- .gitignore | 1 + Cargo.lock | 434 +++++++---- Cargo.toml | 6 + bin/client/Cargo.toml | 1 + bin/client/src/client/mod.rs | 18 +- bin/client/src/config.rs | 2 +- bin/operator/Cargo.toml | 20 + bin/operator/src/main.rs | 11 + build/.gitkeep | 0 circuits/plonky2x/Cargo.toml | 25 +- circuits/plonky2x/src/builder.rs | 350 ++++----- circuits/plonky2x/src/hint.rs | 150 ++++ circuits/plonky2x/src/input.rs | 1 - circuits/plonky2x/src/lib.rs | 126 ++- circuits/plonky2x/src/merkle.rs | 3 - circuits/plonky2x/src/test_utils.rs | 66 ++ circuits/plonky2x/src/variables.rs | 263 +++++-- crates/protocol/Cargo.toml | 1 + crates/protocol/src/experimental.rs | 36 +- crates/protocol/src/lib.rs | 92 +-- crates/protocol/src/prelude.rs | 1 + crates/rpc/Cargo.toml | 36 + .../client/rpc.rs => crates/rpc/src/lib.rs | 85 +- crates/rpc/src/prelude.rs | 16 + crates/test-utils/Cargo.toml | 31 + crates/test-utils/src/lib.rs | 99 +++ fixtures/86673090.json | 140 ---- fixtures/86673091.json | 140 ---- fixtures/86673092.json | 140 ---- fixtures/current_epoch.json | 721 ----------------- fixtures/e2e_bps.json | 86 +++ fixtures/e2e_header.json | 15 + fixtures/{1.json => main_0.json} | 5 +- fixtures/{2.json => main_1.json} | 5 +- fixtures/main_2.json | 724 ++++++++++++++++++ fixtures/test_0.json | 247 ++++++ fixtures/test_1.json | 248 ++++++ fixtures/test_2.json | 235 ++++++ fixtures/well_known_header.json | 38 - succinct.json | 14 + 41 files changed, 2906 insertions(+), 1742 deletions(-) create mode 100644 bin/operator/Cargo.toml create mode 100644 bin/operator/src/main.rs create mode 100644 build/.gitkeep create mode 100644 circuits/plonky2x/src/hint.rs delete mode 100644 circuits/plonky2x/src/input.rs create mode 100644 circuits/plonky2x/src/test_utils.rs create mode 100644 crates/rpc/Cargo.toml rename bin/client/src/client/rpc.rs => crates/rpc/src/lib.rs (55%) create mode 100644 crates/rpc/src/prelude.rs create mode 100644 crates/test-utils/Cargo.toml create mode 100644 crates/test-utils/src/lib.rs delete mode 100644 fixtures/86673090.json delete mode 100644 fixtures/86673091.json delete mode 100644 fixtures/86673092.json delete mode 100644 fixtures/current_epoch.json create mode 100644 fixtures/e2e_bps.json create mode 100644 fixtures/e2e_header.json rename fixtures/{1.json => main_0.json} (99%) rename fixtures/{2.json => main_1.json} (99%) create mode 100644 fixtures/main_2.json create mode 100644 fixtures/test_0.json create mode 100644 fixtures/test_1.json create mode 100644 fixtures/test_2.json delete mode 100644 fixtures/well_known_header.json create mode 100644 succinct.json diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 0ebddcb..0c9afaa 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -5,6 +5,7 @@ on: branches: - master + # TODO: beefy machine for tests jobs: lint: name: "Lint" @@ -32,5 +33,18 @@ jobs: - name: "Install cargo-nextest" run: cargo install cargo-nextest - name: "Run tests" - run: cargo nextest run --workspace --locked + run: cargo nextest run --workspace --locked --no-default-features + test-beefy-proofs: + name: "Test Beefy Proofs" + runs-on: + group: beefygroup + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 + - name: "Install cargo-nextest" + run: cargo install cargo-nextest + - name: "Run tests" + run: cargo nextest run --workspace --locked --no-default-features diff --git a/.gitignore b/.gitignore index 6728bca..e14e618 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ **/target /vendor +/build/* .direnv diff --git a/Cargo.lock b/Cargo.lock index a4c0126..f8527a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ dependencies = [ "actix-macros", "actix-rt", "actix_derive", - "bitflags 2.4.1", + "bitflags 2.4.2", "bytes", "crossbeam-channel", "futures-core", @@ -185,9 +185,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -287,9 +287,9 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-compression" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" +checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" dependencies = [ "brotli", "flate2", @@ -406,12 +406,12 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09dbe0e490df5da9d69b36dca48a76635288a82f92eca90024883a56202026d" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" dependencies = [ "async-trait", - "axum-core 0.4.2", + "axum-core 0.4.3", "bytes", "futures-util", "http 1.0.0", @@ -457,9 +457,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c8503f93e6d144ee5690907ba22db7ba79ab001a932ab99034f0fe836b3df" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", @@ -505,9 +505,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -553,9 +553,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -616,11 +616,11 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ - "borsh-derive 1.3.0", + "borsh-derive 1.3.1", "cfg_aliases", ] @@ -639,12 +639,12 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", - "proc-macro-crate 2.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.48", @@ -895,9 +895,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.14" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -905,9 +905,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.14" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -944,9 +944,9 @@ dependencies = [ [[package]] name = "coerce" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba30a4bf4bebf9112b9f42124de78b0e5dccad05c86181072663c7d8567aedec" +checksum = "3311405ed7a9b541faddd4e2de71cfa908e5558658d504f7954d2aee684b96a6" dependencies = [ "anyhow", "async-trait", @@ -974,7 +974,7 @@ dependencies = [ "tracing", "utoipa", "utoipa-swagger-ui", - "uuid 1.6.1", + "uuid 1.7.0", "valuable", ] @@ -1016,7 +1016,7 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" dependencies = [ - "base64 0.21.6", + "base64 0.21.7", "bech32", "bs58 0.5.0", "digest 0.10.7", @@ -1432,6 +1432,19 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if 1.0.0", + "hashbrown 0.14.3", + "lock_api 0.4.11", + "once_cell", + "parking_lot_core 0.9.9", +] + [[package]] name = "data-encoding" version = "2.5.0" @@ -1444,7 +1457,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.6.1", + "uuid 1.7.0", ] [[package]] @@ -1769,7 +1782,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.6", + "base64 0.21.7", "bytes", "hex", "k256", @@ -1837,9 +1850,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -1973,9 +1986,9 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c405f24ea3a517899ba7985385c43dc4a7eb1209af3b1e0a1a32d7dcc7f8d09" +checksum = "9bf35eb7d2e2092ad41f584951e08ec7c077b142dba29c4f1b8f52d2efddc49c" dependencies = [ "ethers-core", "once_cell", @@ -2004,9 +2017,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51258120c6b47ea9d9bec0d90f9e8af71c977fbefbef8213c91bfed385fe45eb" +checksum = "bbdfb952aafd385b31d316ed80d7b76215ce09743c172966d840e96924427e0c" dependencies = [ "Inflector", "const-hex", @@ -2028,9 +2041,9 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936e7a0f1197cee2b62dc89f63eff3201dbf87c283ff7e18d86d38f83b845483" +checksum = "7465c814a2ecd0de0442160da13584205d1cdc08f4717a6511cad455bd5d7dc4" dependencies = [ "Inflector", "const-hex", @@ -2044,9 +2057,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" +checksum = "918b1a9ba585ea61022647def2f27c29ba19f6d2a4a4c8f68a9ae97fd5769737" dependencies = [ "arrayvec 0.7.4", "bytes", @@ -2074,9 +2087,9 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abbac2c890bdbe0f1b8e549a53b00e2c4c1de86bb077c1094d1f38cdf9381a56" +checksum = "facabf8551b4d1a3c08cb935e7fca187804b6c2525cc0dafb8e5a6dd453a24de" dependencies = [ "chrono", "ethers-core", @@ -2123,7 +2136,7 @@ checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.6", + "base64 0.21.7", "bytes", "const-hex", "enr", @@ -2173,9 +2186,9 @@ dependencies = [ [[package]] name = "ethers-solc" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64f710586d147864cff66540a6d64518b9ff37d73ef827fee430538265b595f" +checksum = "cc2e46e3ec8ef0c986145901fa9864205dc4dcee701f9846be2d56112d34bdea" dependencies = [ "cfg-if 1.0.0", "const-hex", @@ -2483,7 +2496,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "debugid", "fxhash", "serde", @@ -2576,9 +2589,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -2595,9 +2608,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991910e35c615d8cab86b5ab04be67e6ad24d2bf5f4f11fdbbed26da999bbeab" +checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" dependencies = [ "bytes", "fnv", @@ -2695,9 +2708,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2810,7 +2823,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.22", + "h2 0.3.24", "http 0.2.11", "http-body 0.4.6", "httparse", @@ -2833,7 +2846,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.1", + "h2 0.4.2", "http 1.0.0", "http-body 1.0.0", "httparse", @@ -3029,7 +3042,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.4", "libc", "windows-sys 0.48.0", ] @@ -3046,8 +3059,8 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ - "hermit-abi 0.3.3", - "rustix 0.38.28", + "hermit-abi 0.3.4", + "rustix 0.38.30", "windows-sys 0.52.0", ] @@ -3095,9 +3108,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -3125,7 +3138,7 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.6", + "base64 0.21.7", "pem", "ring 0.16.20", "serde", @@ -3164,9 +3177,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -3242,7 +3255,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "redox_syscall 0.4.1", ] @@ -3261,9 +3274,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -3365,7 +3378,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.28", + "rustix 0.38.30", ] [[package]] @@ -3431,7 +3444,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" dependencies = [ - "base64 0.21.6", + "base64 0.21.7", "hyper 0.14.28", "indexmap 1.9.3", "ipnet", @@ -3551,7 +3564,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35cbb989542587b47205e608324ddd391f0cee1c22b4b64ae49f458334b95907" dependencies = [ - "borsh 1.3.0", + "borsh 1.3.1", "serde", ] @@ -3597,7 +3610,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bffdcef917385f1ef12c0ec21b3144d2c8788dbea1015d8fed838689dc093e5" dependencies = [ "blake2", - "borsh 1.3.0", + "borsh 1.3.1", "bs58 0.4.0", "c2-chacha", "curve25519-dalek", @@ -3632,7 +3645,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "120ff206766c6bff62e919e3dcaf5c3a184a52ea072ad0947bb123768b65ece7" dependencies = [ - "borsh 1.3.0", + "borsh 1.3.1", "lazy_static", "log", "near-chain-configs", @@ -3667,8 +3680,8 @@ version = "0.2.0" dependencies = [ "anyhow", "async-trait", - "axum 0.7.3", - "borsh 1.3.0", + "axum 0.7.4", + "borsh 1.3.1", "coerce", "config", "either", @@ -3679,11 +3692,12 @@ dependencies = [ "near-crypto", "near-jsonrpc-client", "near-light-client-protocol", + "near-light-client-rpc", "near-primitives", "near-primitives-core", "pretty_env_logger", "protobuf 3.2.0", - "rand 0.7.3", + "rand 0.8.5", "reqwest", "serde", "serde_json", @@ -3693,43 +3707,82 @@ dependencies = [ ] [[package]] -name = "near-light-client-circuits" -version = "0.1.0" +name = "near-light-client-protocol" +version = "0.2.0" dependencies = [ - "borsh 1.3.0", - "ethers", + "anyhow", + "borsh 1.3.1", + "either", "hex", - "near-light-client-protocol", + "itertools 0.12.0", + "log", + "near-crypto", + "near-jsonrpc-primitives", "near-primitives", - "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git)", - "plonky2x", - "pretty_assertions", + "near-primitives-core", "pretty_env_logger", + "rand 0.8.5", "serde", "serde_json", + "test-utils", + "thiserror", ] [[package]] -name = "near-light-client-protocol" +name = "near-light-client-rpc" version = "0.2.0" dependencies = [ "anyhow", - "borsh 1.3.0", + "async-trait", + "borsh 1.3.1", "either", + "futures", "hex", "itertools 0.12.0", "log", "near-crypto", + "near-jsonrpc-client", "near-jsonrpc-primitives", "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.7.3", + "rand 0.8.5", "serde", "serde_json", "thiserror", ] +[[package]] +name = "near-light-client-succint-operator" +version = "0.2.0" +dependencies = [ + "cfg-if 0.1.10", + "near-light-clientx", +] + +[[package]] +name = "near-light-clientx" +version = "0.1.0" +dependencies = [ + "async-trait", + "borsh 1.3.1", + "ethers", + "hex", + "log", + "near-light-client-protocol", + "near-light-client-rpc", + "near-primitives", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git)", + "plonky2x", + "pretty_assertions", + "pretty_env_logger", + "serde", + "serde_json", + "serial_test", + "test-utils", + "tokio", +] + [[package]] name = "near-o11y" version = "0.19.0" @@ -3737,7 +3790,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dd1e98a5d3ecd782dc59abe6341c30b4072e32b5b353a0073fe238fbb641a2a" dependencies = [ "actix", - "base64 0.21.6", + "base64 0.21.7", "clap", "near-crypto", "near-fmt", @@ -3765,7 +3818,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df64b6d50fc466b960b08ae6f3f9100581e72252bf13f37c19e6e67a12bca6e9" dependencies = [ "assert_matches", - "borsh 1.3.0", + "borsh 1.3.1", "enum-map", "near-account-id", "near-primitives-core", @@ -3784,8 +3837,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44419e132fe6c2cda430dcb5935d9f2eba9505a69a6c641ffc76a37802c2f98d" dependencies = [ "arbitrary", - "base64 0.21.6", - "borsh 1.3.0", + "base64 0.21.7", + "borsh 1.3.1", "bytesize", "cfg-if 1.0.0", "chrono", @@ -3826,8 +3879,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99513c0a2b28e2bdf6998b8cc5a84eacfd54f0d2694bb40e19ac34a14c19d73c" dependencies = [ "arbitrary", - "base64 0.21.6", - "borsh 1.3.0", + "base64 0.21.7", + "borsh 1.3.1", "bs58 0.4.0", "derive_more", "enum-map", @@ -3943,8 +3996,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21ff5288c4ace5124e9e2a88bade90363ff4e348f4e1074b909e9f699a156793" dependencies = [ "anyhow", - "base64 0.21.6", - "borsh 1.3.0", + "base64 0.21.7", + "borsh 1.3.1", "ed25519-dalek", "enum-map", "finite-wasm", @@ -4180,7 +4233,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.4", "libc", ] @@ -4199,7 +4252,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 3.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.48", @@ -4256,11 +4309,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.62" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if 1.0.0", "foreign-types", "libc", @@ -4288,9 +4341,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.98" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -4723,9 +4776,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" @@ -4759,7 +4812,7 @@ dependencies = [ [[package]] name = "plonky2" version = "0.1.4" -source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" +source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" dependencies = [ "ahash 0.8.7", "anyhow", @@ -4798,7 +4851,7 @@ dependencies = [ [[package]] name = "plonky2_field" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" +source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" dependencies = [ "anyhow", "itertools 0.11.0", @@ -4830,7 +4883,7 @@ dependencies = [ [[package]] name = "plonky2_maybe_rayon" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" +source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" dependencies = [ "rayon", ] @@ -4843,12 +4896,12 @@ source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559da [[package]] name = "plonky2_util" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#30b47998262642be54da5acf03dfca31af4d93f7" +source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" [[package]] name = "plonky2x" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#19a16bfd14b3367c6c022ba6477457baca9d84b3" +source = "git+https://github.com/succinctlabs/succinctx.git#889643f4b1c331ce585b992c02cadbccaa79cfc8" dependencies = [ "anyhow", "array-macro", @@ -4862,7 +4915,7 @@ dependencies = [ "digest 0.10.7", "dotenv", "ed25519-dalek", - "env_logger 0.10.1", + "env_logger 0.10.2", "ethers", "ff", "futures", @@ -4884,13 +4937,13 @@ dependencies = [ "sha256", "tokio", "tracing", - "uuid 1.6.1", + "uuid 1.7.0", ] [[package]] name = "plonky2x-derive" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#19a16bfd14b3367c6c022ba6477457baca9d84b3" +source = "git+https://github.com/succinctlabs/succinctx.git#889643f4b1c331ce585b992c02cadbccaa79cfc8" dependencies = [ "proc-macro2", "quote", @@ -4943,7 +4996,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" dependencies = [ - "env_logger 0.10.1", + "env_logger 0.10.2", "log", ] @@ -5011,9 +5064,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ "toml_edit 0.21.0", ] @@ -5044,9 +5097,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -5072,7 +5125,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "lazy_static", "num-traits", "rand 0.8.5", @@ -5333,9 +5386,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -5343,9 +5396,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -5410,13 +5463,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick 1.1.2", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -5431,9 +5484,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick 1.1.2", "memchr", @@ -5486,12 +5539,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "async-compression", - "base64 0.21.6", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.22", + "h2 0.3.24", "http 0.2.11", "http-body 0.4.6", "hyper 0.14.28", @@ -5587,7 +5640,7 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid 1.6.1", + "uuid 1.7.0", ] [[package]] @@ -5731,14 +5784,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno 0.3.8", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -5760,7 +5813,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.6", + "base64 0.21.7", ] [[package]] @@ -6065,11 +6118,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "f58c3a1b3e418f61c25b2aeb43fc6c95eaa252b8cecdda67f401943e9e08d33f" dependencies = [ - "base64 0.21.6", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -6082,9 +6135,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "d2068b437a31fc68f25dd7edc296b078f04b45145c199d8eed9866e45f1ff274" dependencies = [ "darling", "proc-macro2", @@ -6105,6 +6158,31 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "serial_test" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ad9342b3aaca7cb43c45c097dd008d4907070394bd0751a0aa8817e5a018d" +dependencies = [ + "dashmap", + "futures", + "lazy_static", + "log", + "parking_lot 0.12.1", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "sha1" version = "0.10.6" @@ -6250,9 +6328,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smart-default" @@ -6515,7 +6593,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.4.1", - "rustix 0.38.28", + "rustix 0.38.30", "windows-sys 0.52.0", ] @@ -6532,13 +6610,37 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] +[[package]] +name = "test-utils" +version = "0.2.0" +dependencies = [ + "anyhow", + "borsh 1.3.1", + "derive_more", + "either", + "hex", + "itertools 0.12.0", + "log", + "near-crypto", + "near-jsonrpc-primitives", + "near-light-client-protocol", + "near-primitives", + "near-primitives-core", + "pretty_assertions", + "pretty_env_logger", + "rand 0.8.5", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "thiserror" version = "1.0.56" @@ -6817,7 +6919,7 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2 0.3.22", + "h2 0.3.24", "http 0.2.11", "http-body 0.4.6", "hyper 0.14.28", @@ -7056,9 +7158,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -7191,9 +7293,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom 0.2.12", "serde", @@ -7270,9 +7372,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -7280,9 +7382,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -7295,9 +7397,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -7307,9 +7409,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7317,9 +7419,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -7330,9 +7432,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-encoder" @@ -7688,7 +7790,7 @@ dependencies = [ "log", "object", "rustc-demangle", - "rustix 0.38.28", + "rustix 0.38.30", "serde", "serde_derive", "target-lexicon 0.12.13", @@ -7736,7 +7838,7 @@ dependencies = [ "memoffset 0.9.0", "paste", "rand 0.8.5", - "rustix 0.38.28", + "rustix 0.38.30", "sptr", "wasm-encoder 0.35.0", "wasmtime-asm-macros", @@ -7779,9 +7881,9 @@ checksum = "9dafab2db172a53e23940e0fa3078c202f567ee5f13f4b42f66b694fab43c658" [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -7802,7 +7904,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.28", + "rustix 0.38.30", ] [[package]] @@ -7979,9 +8081,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.33" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 521547a..32d861b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,9 +11,11 @@ resolver = "2" anyhow = "1.0" async-trait = "0.1" config = "0.13" +derive_more = "0.99" either = { version = "1.9", features = [ "serde" ] } itertools = "0.12" log = "0.4" +pretty_assertions = "1.4" pretty_env_logger = "0.5" sled = "0.34" # TODO: maybe heavy thiserror = "1.0" @@ -40,5 +42,9 @@ near-jsonrpc-primitives = "0.19" near-primitives = "0.19" near-primitives-core = "0.19" +near-light-client-protocol = { path = "crates/protocol" } +near-light-client-rpc = { path = "crates/rpc" } +near-light-clientx = { path = "circuits/plonky2x" } +test-utils = { path = "crates/test-utils" } # [patch."https://github.com/succinctlabs/succinctx.git"] # plonky2x = { path = "./vendor/succinctx/plonky2x/core" } diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml index 678d34c..279ffa0 100644 --- a/bin/client/Cargo.toml +++ b/bin/client/Cargo.toml @@ -24,6 +24,7 @@ pretty_env_logger.workspace = true protobuf.workspace = true protocol = { path = "../../crates/protocol", package = "near-light-client-protocol" } reqwest.workspace = true +rpc = { path = "../../crates/rpc", package = "near-light-client-rpc" } serde.workspace = true serde_json.workspace = true sled.workspace = true diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 205ad1e..7b7eafe 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -8,11 +8,11 @@ use coerce::actor::{context::ActorContext, message::Handler, Actor}; use message::{Archive, GetProof, Head, Shutdown, VerifyProof}; use near_primitives::views::validator_stake_view::ValidatorStakeView; use protocol::{Proof, Protocol}; +use rpc::LightClientRpc; use std::{str::FromStr, sync::Arc}; use tokio::time; pub mod message; -pub mod rpc; mod store; pub struct LightClient { @@ -132,7 +132,7 @@ impl LightClient { let starting_head = self .client .fetch_latest_header(&sync_from) - .await + .await? .ok_or_else(|| anyhow::anyhow!("We need a starting header"))?; log::info!("starting head: {:?}", starting_head.inner_lite.height); @@ -202,14 +202,14 @@ impl LightClient { client: rpc::NearRpcClient, ) -> Result { let head = store.head().await?; - log::debug!("Current head: {:#?}", head.inner_lite); + log::debug!("Current head: {:#?}", head); let next_header = client .fetch_latest_header( &CryptoHash::from_str(&format!("{}", head.hash())) .map_err(|e| anyhow!("Failed to parse hash: {:?}", e))?, ) - .await + .await? .ok_or_else(|| anyhow!("Failed to fetch latest header"))?; log::trace!("Got new header: {:#?}", next_header.inner_lite); @@ -252,7 +252,7 @@ impl LightClient { for req in p.0 { let proof = self .client - .fetch_light_client_proof(req, *last_verified_hash); + .fetch_light_client_proof(req.0, *last_verified_hash); futs.push(proof); } let unpin_futs: Vec<_> = futs.into_iter().map(Box::pin).collect(); @@ -306,3 +306,11 @@ impl LightClient { Ok((p, errors)) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn t() {} +} diff --git a/bin/client/src/config.rs b/bin/client/src/config.rs index b8aafe3..cea5eb8 100644 --- a/bin/client/src/config.rs +++ b/bin/client/src/config.rs @@ -1,6 +1,6 @@ -use crate::client::rpc::Network; use crate::prelude::*; use config::{Config as ConfigTrait, ConfigError, Environment, File}; +use rpc::Network; use std::{env, path::PathBuf}; #[derive(Debug, Deserialize, Clone)] diff --git a/bin/operator/Cargo.toml b/bin/operator/Cargo.toml new file mode 100644 index 0000000..2437e53 --- /dev/null +++ b/bin/operator/Cargo.toml @@ -0,0 +1,20 @@ +[package] +edition.workspace = true +license.workspace = true +name = "near-light-client-succint-operator" +version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[[bin]] +name = "sync" +path = "src/main.rs" +required-features = [ "sync" ] + +[dependencies] +cfg-if = "*" +near-light-clientx.workspace = true + +[features] +default = [ "sync" ] +sync = [ ] diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs new file mode 100644 index 0000000..523c880 --- /dev/null +++ b/bin/operator/src/main.rs @@ -0,0 +1,11 @@ +use near_light_clientx::{plonky2x::backend::function::Plonky2xFunction, SyncCircuit}; + +fn main() { + cfg_if::cfg_if! { + if #[cfg(feature = "sync")] { + SyncCircuit::<1>::entrypoint(); + } else { + panic!("No circuit feature enabled"); + } + } +} diff --git a/build/.gitkeep b/build/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index c46f82e..126d07f 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -1,25 +1,34 @@ [package] edition = "2021" -name = "near-light-client-circuits" +name = "near-light-clientx" version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -borsh.workspace = true -ethers = "2.0.11" -pretty_assertions = "1.4.0" -serde.workspace = true - +async-trait.workspace = true +borsh.workspace = true +ethers = "2.0.11" +hex.workspace = true +log.workspace = true +pretty_assertions = "1.4.0" +serde.workspace = true # Circuits plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } -near-light-client-protocol = { path = "../../crates/protocol" } +near-light-client-protocol.workspace = true +near-light-client-rpc.workspace = true [dev-dependencies] borsh.workspace = true -hex.workspace = true near-primitives.workspace = true pretty_env_logger.workspace = true serde_json.workspace = true +serial_test = "3" +test-utils.workspace = true +tokio.workspace = true + +[features] +beefy-tests = [ ] +default = [ "beefy-tests" ] diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 84573ef..185afa4 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -4,11 +4,12 @@ use crate::variables::{ CryptoHashVariable, HeaderVariable, MerklePathVariable, ProofVariable, StakeInfoVariable, SyncedVariable, ValidatorStakeVariable, }; +use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; use near_light_client_protocol::prelude::Itertools; use plonky2x::prelude::*; use pretty_assertions::assert_eq; -pub trait Verify, const D: usize> { +pub trait Ensure, const D: usize> { fn ensure_not_already_verified( &mut self, head: &HeaderVariable, @@ -30,8 +31,8 @@ pub trait Verify, const D: usize> { fn validate_signatures( &mut self, - approvals: BpsApprovals, - bps: BpsArr, + approvals: &BpsApprovals, + bps: &BpsArr, approval_message: ApprovalMessage, ) -> StakeInfoVariable; @@ -73,7 +74,7 @@ pub trait Verify, const D: usize> { fn assertx(&mut self, condition: BoolVariable); } -impl, const D: usize> Verify for CircuitBuilder { +impl, const D: usize> Ensure for CircuitBuilder { fn ensure_not_already_verified( &mut self, head: &HeaderVariable, @@ -87,9 +88,10 @@ impl, const D: usize> Verify for CircuitBuilder BoolVariable { - let epoch = self.is_equal(head.inner_lite.epoch_id, *epoch_id); - let next_epoch = self.is_equal(head.inner_lite.next_epoch_id, *epoch_id); - self.or(epoch, next_epoch) + let epoch_id = *epoch_id; + let this = self.is_equal(epoch_id, head.inner_lite.epoch_id); + let next = self.is_equal(epoch_id, head.inner_lite.next_epoch_id); + self.or(this, next) } fn ensure_if_next_epoch_contains_next_bps( @@ -106,8 +108,8 @@ impl, const D: usize> Verify for CircuitBuilder( &mut self, - approvals_after_next: BpsApprovals, - epoch_bps: BpsArr, + approvals_after_next: &BpsApprovals, + epoch_bps: &BpsArr, approval_message: ApprovalMessage, ) -> StakeInfoVariable { assert_eq!(approvals_after_next.is_active.len(), LEN); @@ -136,7 +138,7 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder BoolVariable { let hash = head.hash(self); - self.watch(&hash, "header hash"); self.is_equal(hash, *outcome_proof_block_hash) } @@ -201,17 +199,14 @@ impl, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder, const D: usize> Verify for CircuitBuilder, const D: usize> { +pub trait Sync, const D: usize> { fn sync( &mut self, - head: HeaderVariable, - epoch_bps: BpsArr, - next_block: BlockVariable, + head: &HeaderVariable, + epoch_bps: &BpsArr, + next_block: &BlockVariable, ) -> SyncedVariable; fn reconstruct_approval_message(&mut self, next_block: &BlockVariable) -> ApprovalMessage; } -impl, const D: usize> SyncCircuit for CircuitBuilder { +impl, const D: usize> Sync for CircuitBuilder { fn sync( &mut self, - head: HeaderVariable, - epoch_bps: BpsArr, - next_block: BlockVariable, + head: &HeaderVariable, + epoch_bps: &BpsArr, + next_block: &BlockVariable, ) -> SyncedVariable { let a = self.ensure_not_already_verified(&head, &next_block.header.inner_lite.height); self.assertx(a); @@ -268,31 +262,32 @@ impl, const D: usize> SyncCircuit for CircuitBuilder self.assertx(c); let approval = self.reconstruct_approval_message(&next_block); - - let stake = self.validate_signatures(next_block.approvals_after_next, epoch_bps, approval); - + let stake = self.validate_signatures(&next_block.approvals_after_next, epoch_bps, approval); let d = self.ensure_stake_is_sufficient(&stake); self.assertx(d); + // TODO: might not need this now, also the logic is wrong because nbps is always >0 let (next_bps_epoch, next_bps) = if next_block.next_bps.len() > 0 { // TODO: hashing bps in circut let e = self.ensure_next_bps_is_valid( &next_block.header.inner_lite.next_bp_hash, - Some(&next_block.next_bp_hash), + Some(&next_block.next_bps_hash), ); self.assertx(e); + assert!(next_block.next_bps.len() == NUM_BLOCK_PRODUCER_SEATS); ( next_block.header.inner_lite.next_epoch_id, - next_block.next_bps, + next_block.next_bps.to_owned(), ) } else { let eid = self.constant::([0u8; 32].into()); - let bps = self.constant::>(Default::default()); + let bps = self.constant::>( + vec![Default::default(); NUM_BLOCK_PRODUCER_SEATS].into(), + ); (eid, bps) }; - self.watch(&next_block.header, "new_head"); SyncedVariable { - new_head: next_block.header, + new_head: next_block.header.to_owned(), next_bps_epoch, next_bps, } @@ -311,7 +306,6 @@ impl, const D: usize> SyncCircuit for CircuitBuilder input_stream.write(&next_block.header.inner_lite.height); let output_stream = self.hint(input_stream, BuildEndorsement); let msg = output_stream.read::(self); - self.watch(&msg, "approval_message"); msg } else { let mut bytes = vec![ByteVariable::zero(self)]; @@ -325,20 +319,19 @@ impl, const D: usize> SyncCircuit for CircuitBuilder } } -pub trait VerifyCircuit, const D: usize> { +pub trait Verify, const D: usize> { fn verify( &mut self, proof: ProofVariable, ) -> BoolVariable; } -impl, const D: usize> VerifyCircuit for CircuitBuilder { +impl, const D: usize> Verify for CircuitBuilder { fn verify( &mut self, proof: ProofVariable, ) -> BoolVariable { let block_hash = proof.block_header.hash(self); - self.watch(&block_hash, "proof header hash"); let block_hash_matches = self.is_equal(block_hash, proof.outcome_proof_block_hash); @@ -354,7 +347,6 @@ impl, const D: usize> VerifyCircuit for CircuitBuild let comp = self.and(block_matches, outcome_matches); let verified = self.and(comp, block_hash_matches); - self.watch(&verified, "proof verified"); self.assertx(verified); verified } @@ -384,97 +376,16 @@ fn to_le_bytes, V: CircuitVariable, const D: usize, const #[cfg(test)] mod tests { + use self::assert_eq; use super::*; + use crate::test_utils::*; use crate::variables::*; - use near_light_client_protocol::{ - prelude::{BasicProof, Header, Itertools}, - LightClientBlockView, Protocol, StakeInfo, ValidatorStake, - }; - use near_primitives::hash::CryptoHash; - use plonky2x::backend::circuit::{PublicInput, PublicOutput}; - use pretty_assertions::assert_eq; - use serde::de::DeserializeOwned; - use std::str::FromStr; - - type B = CircuitBuilder; - type PI = PublicInput; - type PO = PublicOutput; - - fn fixture(file: &str) -> T { - serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) - .unwrap() - } - - fn get_next_epoch() -> LightClientBlockView { - fixture("2.json") - } - - fn get_first_epoch() -> LightClientBlockView { - fixture("1.json") - } - - fn view_to_lite_view(h: LightClientBlockView) -> Header { - Header { - prev_block_hash: h.prev_block_hash, - inner_rest_hash: h.inner_rest_hash, - inner_lite: h.inner_lite, - } - } - - fn test_state() -> (Header, Vec, LightClientBlockView) { - let first = get_first_epoch(); - let next = get_next_epoch(); - - ( - view_to_lite_view(first.clone()), - first - .next_bps - .clone() - .unwrap() - .into_iter() - .map(Into::into) - .collect(), - next, - ) - } - - fn to_header(bv: LightClientBlockView) -> Header { - Header { - prev_block_hash: bv.prev_block_hash, - inner_rest_hash: bv.inner_rest_hash, - inner_lite: bv.inner_lite, - } - } - - fn builder_suite( - define: F, - writer: WriteInputs, - assertions: Assertions, - ) where - F: FnOnce(&mut B), - WriteInputs: FnOnce(&mut PI), - Assertions: FnOnce(PO), - { - pretty_env_logger::try_init().unwrap_or_default(); - - let mut builder = B::new(); - define(&mut builder); - - let circuit = builder.build(); - - let mut inputs = circuit.input(); - writer(&mut inputs); - - let (proof, output) = circuit.prove(&inputs); - - assertions(output.clone()); - - circuit.verify(&proof, &inputs, &output); - } + use near_light_client_protocol::Protocol; + use near_light_client_protocol::StakeInfo; #[test] fn test_header_hash() { - let header = to_header(fixture("1.json")); + let header = to_header(test_first().body); let expected_hash = header.hash().0; let define = |builder: &mut B| { @@ -495,7 +406,7 @@ mod tests { } #[test] - fn test_stake() { + fn test_ensure_stake() { let approved_stakes = [200, 199, 201, 0]; let define = |builder: &mut B| { @@ -535,7 +446,7 @@ mod tests { #[test] fn test_ensure_height() { - let test_header = to_header(get_first_epoch()); + let test_header = to_header(test_next().body); let define = |builder: &mut B| { let header = builder.read::(); @@ -561,10 +472,119 @@ mod tests { #[test] fn test_ensure_next_bps() { - let header = get_first_epoch(); - let bps = header.next_bps.clone().unwrap_or_default(); + let (header, bps, nbps_hash) = testnet_state(); + let bps_hash = CryptoHash::hash_borsh(bps.clone()); + + let define = |builder: &mut B| { + let header = builder.read::(); + let next_bps = builder.read::>(); + + let current = + builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.epoch_id); + builder.write::(current); + let next = + builder.ensure_epoch_is_current_or_next(&header, &header.inner_lite.next_epoch_id); + builder.write::(next); + + let contains_next_bps = builder.ensure_if_next_epoch_contains_next_bps( + &header, + &header.inner_lite.next_epoch_id, + &next_bps, + ); + builder.write::(contains_next_bps); + + let next_bps_hash = builder.constant::(bps_hash.0.into()); + let is_valid = builder + .ensure_next_bps_is_valid(&header.inner_lite.next_bp_hash, Some(&next_bps_hash)); + builder.write::(is_valid); + }; + let writer = |input: &mut PI| { + input.write::(header.clone().into()); + input.write::>(bps_to_variable(Some(bps))); + }; + let assertions = |mut output: PO| { + assert!(output.read::(), "epoch is current"); + assert!(output.read::(), "epoch is next"); + assert!(output.read::(), "next epoch has bps"); + assert!(output.read::(), "next bps is valid"); + }; + builder_suite(define, writer, assertions); + } + + #[test] + fn test_reconstruct_approval_msg() { + let (_, _, next_block) = test_state(); + let define = |builder: &mut B| { + let next_block = builder.read::(); + let os = builder.reconstruct_approval_message(&next_block); + builder.write::(os); + }; + let writer = |input: &mut PI| { + input.write::(next_block.clone().into()); + }; + let assertions = |mut output: PO| { + let created = output.read::(); + let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); + assert_eq!(msg, created); + }; + builder_suite(define, writer, assertions); + } + + #[test] + fn test_raw_le_bytes() { + let (_, _, next_block) = test_state(); + let define = |builder: &mut B| { + let next_block = builder.read::(); + + let mut bytes = vec![]; + for target in next_block.header.inner_lite.height.targets() { + let mut bits = builder.api.split_le(target, 32); + bits.reverse(); + let to_extend = bits + .chunks(8) + .rev() + .map(|chunk| { + let targets = chunk.iter().map(|b| b.target).collect_vec(); + ByteVariable::from_targets(&targets) + }) + .collect_vec(); + bytes.extend(to_extend); + } + builder.write::>(BytesVariable(bytes.try_into().unwrap())); + }; + let writer = |input: &mut PI| { + input.write::(next_block.clone().into()); + }; + let assertions = |mut output: PO| { + let bytes = output.read::>(); + println!("{:?}", bytes); + assert_eq!(bytes, next_block.inner_lite.height.to_le_bytes()); + }; + builder_suite(define, writer, assertions); + } +} + +/// These tests require either: +/// - A LOT of time if running in debug mode +/// - A LOT of RAM if running in release +/// +/// TODO: CI for only beefy tests +#[cfg(feature = "beefy-tests")] +#[cfg(test)] +mod beefy_tests { + use crate::builder::Ensure; + use crate::builder::Sync; + use crate::builder::Verify; + use crate::test_utils::*; + use crate::variables::*; + use near_light_client_protocol::prelude::BasicProof; + use serial_test::serial; + + #[test] + #[serial] + fn beefy_test_next_bps() { + let (header, bps, _) = testnet_state(); let bps_hash = CryptoHash::hash_borsh(bps.clone()); - let header = to_header(header); let define = |builder: &mut B| { let header = builder.read::(); @@ -603,7 +623,8 @@ mod tests { } #[test] - fn test_ensure_proofs() { + #[serial] + fn beefy_test_proof() { let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); let p: BasicProof = fixture("old.json"); @@ -663,7 +684,8 @@ mod tests { } #[test] - fn test_inclusion_proof_blackbox() { + #[serial] + fn beefy_test_proof_blackbox() { let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); @@ -698,14 +720,15 @@ mod tests { } #[test] - fn test_sync_across_epoch_boundaries() { + #[serial] + fn beefy_test_sync_across_epoch_boundaries() { let (head, next_bps, next_block) = test_state(); let define = |builder: &mut B| { let head = builder.read::(); let bps = builder.read::>(); let next_block = builder.read::(); - let synced = builder.sync(head, bps, next_block); + let synced = builder.sync(&head, &bps, &next_block); builder.write::(synced); }; let writer = |input: &mut PI| { @@ -717,11 +740,14 @@ mod tests { let header = output.read::(); println!("header: {:?}", header); }; + // TODO: next two builder_suite(define, writer, assertions); } + // TODO: probably not needed #[test] - fn test_bounded_signatures() { + #[serial] + fn beefy_test_bounded_signatures() { let (_, bps, next_block) = test_state(); const BPS_AMT: usize = 5; @@ -740,7 +766,7 @@ mod tests { let msg = builder.reconstruct_approval_message(&next_block); - builder.validate_signatures(next_block_approvals, bps, msg); + builder.validate_signatures(&next_block_approvals, &bps, msg); }; let writer = |input: &mut PI| { input.write::>( @@ -751,56 +777,4 @@ mod tests { let assertions = |mut _output: PO| {}; builder_suite(define, writer, assertions); } - - #[test] - fn test_reconstruct_approval_msg() { - let (_, _, next_block) = test_state(); - let define = |builder: &mut B| { - let next_block = builder.read::(); - let os = builder.reconstruct_approval_message(&next_block); - builder.write::(os); - }; - let writer = |input: &mut PI| { - input.write::(next_block.clone().into()); - }; - let assertions = |mut output: PO| { - let created = output.read::(); - let msg = Protocol::reconstruct_approval_message(&next_block).unwrap(); - assert_eq!(msg, created); - }; - builder_suite(define, writer, assertions); - } - - #[test] - fn test_raw_le_bytes() { - let (_, _, next_block) = test_state(); - let define = |builder: &mut B| { - let next_block = builder.read::(); - - let mut bytes = vec![]; - for target in next_block.header.inner_lite.height.targets() { - let mut bits = builder.api.split_le(target, 32); - bits.reverse(); - let to_extend = bits - .chunks(8) - .rev() - .map(|chunk| { - let targets = chunk.iter().map(|b| b.target).collect_vec(); - ByteVariable::from_targets(&targets) - }) - .collect_vec(); - bytes.extend(to_extend); - } - builder.write::>(BytesVariable(bytes.try_into().unwrap())); - }; - let writer = |input: &mut PI| { - input.write::(next_block.clone().into()); - }; - let assertions = |mut output: PO| { - let bytes = output.read::>(); - println!("{:?}", bytes); - assert_eq!(bytes, next_block.inner_lite.height.to_le_bytes()); - }; - builder_suite(define, writer, assertions); - } } diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs new file mode 100644 index 0000000..5f609dc --- /dev/null +++ b/circuits/plonky2x/src/hint.rs @@ -0,0 +1,150 @@ +use crate::variables::bps_to_variable; +use crate::variables::BlockVariable; +use crate::variables::BpsArr; +use crate::variables::CryptoHashVariable; +use crate::variables::HeaderVariable; +use crate::variables::ValidatorStakeVariable; +use async_trait::async_trait; +use near_light_client_protocol::prelude::anyhow; +use near_light_client_protocol::prelude::izip; +use near_light_client_protocol::prelude::CryptoHash; +use near_light_client_protocol::prelude::Itertools; +use near_light_client_protocol::LightClientBlockLiteView; +use near_light_client_rpc::{LightClientRpc, NearRpcClient, Network}; +use plonky2x::{frontend::hint::asynchronous::hint::AsyncHint, prelude::*}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct FetchNextHeaderInputs(pub Network); + +#[async_trait] +impl, const D: usize> AsyncHint for FetchNextHeaderInputs { + async fn hint( + &self, + input_stream: &mut ValueStream, + output_stream: &mut ValueStream, + ) { + let client = NearRpcClient::new(self.0.clone()); + + let h = input_stream.read_value::().0; + + let next = client + .fetch_latest_header(&CryptoHash(h)) + .await + .expect("Failed to fetch header") + .expect("Expected a header"); + + output_stream.write_value::(next.into()); + } +} + +impl FetchNextHeaderInputs { + pub fn fetch, const D: usize>( + self, + b: &mut CircuitBuilder, + hash: &CryptoHashVariable, + ) -> Option { + let mut input_stream = VariableStream::new(); + input_stream.write::(hash); + + let output_stream = b.async_hint(input_stream, self); + Some(output_stream.read::(b)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ + test_utils::{builder_suite, test_state, B, PI, PO}, + variables::{BlockVariableValue, HeaderVariableValue}, + }; + use near_light_client_protocol::{ + prelude::Header, BlockHeaderInnerLiteView, LightClientBlockView, + }; + use std::str::FromStr; + + #[test] + fn test_fetch_header() { + let (header, bps, nb) = test_state(); + + let define = |b: &mut B| { + let header = b.read::(); + let hash = header.hash(b); + let next_block = + FetchNextHeaderInputs(near_light_client_rpc::Network::Mainnet).fetch(b, &hash); + b.write::(next_block.unwrap()); + }; + let writer = |input: &mut PI| { + input.write::(header.into()); + }; + let assertions = |mut output: PO| { + let inputs = output.read::(); + let nbh: BlockVariableValue = nb.into(); + pretty_assertions::assert_eq!(format!("{:#?}", inputs), format!("{:#?}", nbh)); + }; + builder_suite(define, writer, assertions); + } + // #[test] + // fn test_fetch_info2() { + // let head = Header { + // prev_block_hash: CryptoHash::from_str("5dbt6rh82Xx6nNG1PuKoQj96g4jnWw6cyb8HNWPPkVJE") + // .unwrap(), + // inner_rest_hash: CryptoHash::from_str("DZT9p28adyuiTSbUV5bsuPRxX9K7R1bag1AeUEMhm4bh") + // .unwrap(), + // inner_lite: BlockHeaderInnerLiteView { + // height: 154654776, + // epoch_id: CryptoHash::from_str("FsJbcG3yvQQC81FVLgAsaHZrMBFbrPM22kgqfGcCdrFb") + // .unwrap(), + // next_epoch_id: CryptoHash::from_str("Fjn8T3phCCSCXSdjtQ4DqHGV86yeS2MQ92qcufCEpwbf") + // .unwrap(), + // prev_state_root: CryptoHash::from_str( + // "F2NNVhJJJdC7oWMbjpaJL3HVNK9RxcCWuTXjrM32ShuP", + // ) + // .unwrap(), + // outcome_root: CryptoHash::from_str("7SYchEDbwawjP2MVfZ2GinP8bBQU1hKFRz34b2ZzG3A8") + // .unwrap(), + // timestamp: 1705334624027402581, + // timestamp_nanosec: 1705334624027402581, + // next_bp_hash: CryptoHash::from_str("AcNatyPz9nmg2e5dMKQAbNLjFfkLgBN7AbR31vcpVJ7z") + // .unwrap(), + // block_merkle_root: CryptoHash::from_str( + // "3huzCnEQhgDDMWyVNR9kNbQFJ7qJGy1J4MBrCJAWndW9", + // ) + // .unwrap(), + // }, + // }; + // + // let define = |b: &mut B| { + // let header = b.read::(); + // let header_hash = header.hash(b); + // let mut outputs = b.async_hint( + // FetchBatchInputs::<2>::write_inputs(&header, &header_hash), + // FetchBatchInputs::<2>(near_light_client_rpc::Network::Testnet), + // ); + // let outputs = FetchBatchInputs::<2>::read_outputs(&mut outputs, b); + // + // b.write::>(outputs.0); + // for i in outputs.1.as_vec() { + // b.write::(i); + // } + // }; + // let writer = |input: &mut PI| { + // input.write::(head.into()); + // }; + // let assertions = |mut output: PO| { + // let bps = output + // .read::>() + // .into_iter() + // .map(|x| x.account_id) + // .collect_vec(); + // assert_eq!(bps.len(), 50); + // + // let inputs = output.read::(); + // println!("inputs: {:?}", inputs); + // let inputs = output.read::(); + // println!("inputs: {:?}", inputs); + // }; + // builder_suite(define, writer, assertions); + // } +} diff --git a/circuits/plonky2x/src/input.rs b/circuits/plonky2x/src/input.rs deleted file mode 100644 index 8b13789..0000000 --- a/circuits/plonky2x/src/input.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index dc0e003..c13306d 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,16 +1,25 @@ -use plonky2x::prelude::*; -use variables::{BlockVariable, BpsArr, HeaderVariable, ProofVariable, ValidatorStakeVariable}; +#![feature(generic_const_exprs)] + +use builder::Sync; +use hint::FetchNextHeaderInputs; +pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; +use variables::{ + BpsArr, CryptoHashVariable, HashBpsInputs, HeaderVariable, ValidatorStakeVariable, +}; +use variables::{BuildEndorsement, EncodeInner, SyncedVariable}; /// Building blocks injected into the CircuitBuilder mod builder; +mod hint; /// Unprefixed merkle tree without collision resistance mod merkle; mod variables; +#[cfg(test)] +mod test_utils; + // TODO: epoch sync, store head per epoch -// TODO: read bps from rainbow bridge // TODO: determine how much we can bootstrap from RB -// TODO: evm reads/writes // TODO: sync & prove for txs later than sync head // TODO: async proof requests, based on a receipt/txs id (should be able to use light client rpc lib // TODO: batch proof requests for a set of receipts/txs, must be bounded @@ -19,35 +28,102 @@ mod variables; // TODO: batching/experimental proofs // TODO[Style]: Shared trait for protocol functionality between crate <> circuit // TODO[Style]: macro to share all the same implementation with semantic type differences between -// TODO: determine fees, allows integrators to charge // protocol crate -#[derive(Debug)] -pub struct Circuit; - -pub trait SyncCircuit, const D: usize> { - fn sync( - &mut self, - head: HeaderVariable, - epoch_bps: BpsArr, - next_block: BlockVariable, - ) -> HeaderVariable; -} +// TODO: determine fees, allows integrators to charge +#[derive(Debug, Clone)] +pub struct SyncCircuit; + +impl Circuit for SyncCircuit { + fn define, const D: usize>(b: &mut CircuitBuilder) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher<>::Field>, + { + let network = near_light_client_rpc::Network::Testnet; + let trusted_head = b.evm_read::(); + + // This is a very interesting cheat to be able to get the BPS for the next epoch + // without the need to store the BPS, we can verify the hash of the BPS in the circuit + let bps = FetchNextHeaderInputs(near_light_client_rpc::Network::Testnet) + .fetch(b, &trusted_head.inner_lite.next_epoch_id) + .unwrap() + .next_bps; + let bps_hash = HashBpsInputs.hash(b, &bps); + b.assert_is_equal(trusted_head.inner_lite.next_bp_hash, bps_hash); + + let head_hash = trusted_head.hash(b); + let next_block = FetchNextHeaderInputs(network).fetch(b, &head_hash).unwrap(); + b.watch(&bps_hash, "calculate_bps_hash"); + + let synced = b.sync(&trusted_head, &bps, &next_block); + b.evm_write::(synced.new_head); + } -pub trait VerifyCircuit, const D: usize> { - // TODO: read head to determine if need to sync & prove - fn verify( - &mut self, - proof: ProofVariable, - ) -> bool; + fn register_generators, const D: usize>(registry: &mut HintRegistry) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher, + { + registry.register_async_hint::(); + registry.register_hint::(); + registry.register_hint::(); + registry.register_hint::(); + } } +#[cfg(feature = "beefy-tests")] #[cfg(test)] -mod tests { +mod beefy_tests { use super::*; + use crate::test_utils::{builder_suite, testnet_state, B, PI, PO}; + use ::test_utils::CryptoHash; + use near_light_client_protocol::{prelude::Itertools, ValidatorStake}; + use near_light_client_rpc::{LightClientRpc, NearRpcClient}; + use near_primitives::types::AccountId; + use serial_test::serial; #[test] - fn test_sync() { - // Read from aurora??? maybe + #[serial] + fn beefy_test_sync_e2e() { + const SYNC_AMT: usize = 1; + let (header, _, _) = testnet_state(); + + let define = |b: &mut B| { + SyncCircuit::::define(b); + }; + let writer = |input: &mut PI| { + input.evm_write::(header.into()); + }; + let assertions = |mut output: PO| { + println!("{:#?}", output.evm_read::()); + }; + builder_suite(define, writer, assertions); + } + + fn account_ids>(bps: Vec) -> Vec { + bps.into_iter() + .map(Into::::into) + .map(|x| x.account_id().clone()) + .collect_vec() + } + + #[tokio::test] + async fn test_epoch_madness() { + use pretty_assertions::assert_eq; + let c = NearRpcClient::new(near_light_client_rpc::Network::Testnet); + let (h, bps, n) = testnet_state(); + println!("{:#?}", h); + + assert_eq!(h.inner_lite.next_bp_hash, CryptoHash::hash_borsh(&bps)); + let bps = account_ids(bps); + + let next_epoch = c.fetch_latest_header(&h.inner_lite.next_epoch_id).await; + let ne_nbps = account_ids(next_epoch.unwrap().unwrap().next_bps.unwrap()); + assert_eq!(ne_nbps, bps); + + let nb_epoch = c.fetch_latest_header(&n.inner_lite.epoch_id).await; + let nb_nbps = account_ids(nb_epoch.unwrap().unwrap().next_bps.unwrap()); + assert_eq!(nb_nbps, bps); } #[test] diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs index f7cb1fd..f6afdea 100644 --- a/circuits/plonky2x/src/merkle.rs +++ b/circuits/plonky2x/src/merkle.rs @@ -34,13 +34,10 @@ impl, const D: usize> NearMerkleTree for CircuitBuilder Bytes32Variable { let mut encoded_leaf = vec![]; - // Append the left bytes to the one byte. encoded_leaf.extend(left.as_bytes().to_vec()); - // Append the right bytes to the bytes so far. encoded_leaf.extend(right.as_bytes().to_vec()); - // Load the output of the hash. self.curta_sha256(&encoded_leaf) } } diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs new file mode 100644 index 0000000..3220b71 --- /dev/null +++ b/circuits/plonky2x/src/test_utils.rs @@ -0,0 +1,66 @@ +pub use near_primitives::hash::CryptoHash; +pub use plonky2x::backend::circuit::{PublicInput, PublicOutput}; +pub use plonky2x::prelude::*; +pub use std::str::FromStr; +pub use test_utils::*; + +pub type B = CircuitBuilder; +pub type PI = PublicInput; +pub type PO = PublicOutput; + +pub fn builder_suite( + define: F, + writer: WriteInputs, + assertions: Assertions, +) where + F: FnOnce(&mut B), + WriteInputs: FnOnce(&mut PI), + Assertions: FnOnce(PO), +{ + pretty_env_logger::try_init().unwrap_or_default(); + + let mut builder = B::new(); + define(&mut builder); + + let circuit = builder.build(); + + let mut inputs = circuit.input(); + writer(&mut inputs); + + if let PublicInput::Bytes(bytes) = &mut inputs { + std::fs::write("input.bin", hex!(bytes)).unwrap(); + } else { + panic!("input is not bytes"); + } + + let (proof, output) = circuit.prove(&inputs); + + assertions(output.clone()); + + circuit.verify(&proof, &inputs, &output); +} + +pub fn mock_builder_suite( + define: F, + writer: WriteInputs, + assertions: Assertions, +) where + F: FnOnce(&mut B), + WriteInputs: FnOnce(&mut PI), + Assertions: FnOnce(PO), +{ + pretty_env_logger::try_init().unwrap_or_default(); + + let mut builder = B::new(); + define(&mut builder); + + let circuit = builder.mock_build(); + + let mut inputs = circuit.input(); + writer(&mut inputs); + + let (witness, output) = circuit.mock_prove(&inputs); + println!("Mock proof {:#?}", witness.full_witness()); + + assertions(output.clone()); +} diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index d49fb5f..9408a7a 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -6,13 +6,15 @@ use near_light_client_protocol::{ merkle_util::MerklePath, prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, LightClientBlockView, Signature, ValidatorStake, }; -use near_light_client_protocol::{Proof, StakeInfo, Synced}; +use near_light_client_protocol::{ + ED25519PublicKey, Proof, PublicKey, StakeInfo, Synced, ValidatorStakeView, ValidatorStakeViewV1, +}; use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; +use plonky2x::frontend::curta::ec::point::CompressedEdwardsYVariable; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue; use plonky2x::frontend::hint::simple::hint::Hint; use plonky2x::frontend::vars::EvmVariable; -use plonky2x::frontend::{curta::ec::point::CompressedEdwardsYVariable, uint::Uint}; use plonky2x::prelude::*; use pretty_assertions::assert_eq; use serde::{Deserialize, Serialize}; @@ -47,6 +49,8 @@ impl From for MerklePathVariableValue< .collect_vec(); // FIXME: Hmm, this seems problematic potentially since it might hash the wrong way // verify. + // + // TODO: grow these but exclude them in tree indices.resize(A, Default::default()); let mut path = path.iter().map(|x| x.hash.0.into()).collect_vec(); @@ -88,10 +92,64 @@ impl HeaderVariable { let inner_lite = self.inner_lite.hash(b); let lite_rest = b.curta_sha256_pair(inner_lite, self.inner_rest_hash); let hash = b.curta_sha256_pair(lite_rest, self.prev_block_hash); - b.watch(&hash, "header_hash"); hash } } +impl EvmVariable for HeaderVariable { + fn encode, const D: usize>( + &self, + builder: &mut CircuitBuilder, + ) -> Vec { + let mut bytes = vec![]; + bytes.extend_from_slice(&self.prev_block_hash.encode(builder)); + bytes.extend_from_slice(&self.inner_rest_hash.encode(builder)); + bytes.extend_from_slice(&self.inner_lite.encode(builder)); + assert!(bytes.len() == 64 + INNER_ENCODED_LEN); + log::debug!("encoded header {:?}", bytes.len()); + bytes + } + + fn decode, const D: usize>( + builder: &mut CircuitBuilder, + bytes: &[ByteVariable], + ) -> Self { + assert!(bytes.len() == 64 + INNER_ENCODED_LEN); + let prev_block_hash = CryptoHashVariable::decode(builder, &bytes[0..32]); + let inner_rest_hash = CryptoHashVariable::decode(builder, &bytes[32..64]); + let inner_lite = HeaderInnerVariable::decode(builder, &bytes[64..64 + INNER_ENCODED_LEN]); + Self { + prev_block_hash, + inner_rest_hash, + inner_lite, + } + } + + fn encode_value(value: Self::ValueType) -> Vec { + let mut bytes = vec![]; + bytes.extend_from_slice(&CryptoHashVariable::encode_value::( + value.prev_block_hash, + )); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::( + value.inner_rest_hash, + )); + bytes.extend_from_slice(&HeaderInnerVariable::encode_value::(value.inner_lite)); + assert!(bytes.len() == 64 + INNER_ENCODED_LEN); + log::debug!("encoded header value {:?}", bytes.len()); + bytes + } + + fn decode_value(bytes: &[u8]) -> Self::ValueType { + assert!(bytes.len() == 64 + INNER_ENCODED_LEN); + let prev_block_hash = CryptoHashVariable::decode_value::(&bytes[0..32]); + let inner_rest_hash = CryptoHashVariable::decode_value::(&bytes[32..64]); + let inner_lite = HeaderInnerVariable::decode_value::(&bytes[64..]); + Self::ValueType { + prev_block_hash, + inner_rest_hash, + inner_lite, + } + } +} #[derive(CircuitVariable, Clone, Debug)] pub struct HeaderInnerVariable { @@ -124,9 +182,8 @@ impl From for HeaderInnerVariableValue, const D: usize>( + pub(crate) fn encode_borsh, const D: usize>( &self, b: &mut CircuitBuilder, ) -> BytesVariable { @@ -142,18 +199,104 @@ impl HeaderInnerVariable { input_stream.write(&self.block_merkle_root); let output_bytes = b.hint(input_stream, EncodeInner); - let bytes = output_bytes.read::>(b); - b.watch(&bytes, "inner_lite_bytes"); + let bytes = output_bytes.read::>(b); bytes } pub(crate) fn hash, const D: usize>( &self, b: &mut CircuitBuilder, ) -> CryptoHashVariable { - let bytes = self.encode(b); + let bytes = self.encode_borsh(b); b.curta_sha256(&bytes.0) } } +impl EvmVariable for HeaderInnerVariable { + fn encode, const D: usize>( + &self, + builder: &mut CircuitBuilder, + ) -> Vec { + let mut bytes = vec![]; + bytes.extend_from_slice(&self.height.encode(builder)); + bytes.extend_from_slice(&self.epoch_id.encode(builder)); + bytes.extend_from_slice(&self.next_epoch_id.encode(builder)); + bytes.extend_from_slice(&self.prev_state_root.encode(builder)); + bytes.extend_from_slice(&self.outcome_root.encode(builder)); + bytes.extend_from_slice(&self.timestamp.encode(builder)); + bytes.extend_from_slice(&self.next_bp_hash.encode(builder)); + bytes.extend_from_slice(&self.block_merkle_root.encode(builder)); + log::debug!("encoded inner: {:?}", bytes.len()); + assert_eq!(bytes.len(), INNER_ENCODED_LEN); + bytes + } + + fn decode, const D: usize>( + builder: &mut CircuitBuilder, + bytes: &[ByteVariable], + ) -> Self { + assert_eq!(bytes.len(), INNER_ENCODED_LEN); + let height = U64Variable::decode(builder, &bytes[0..8]); + let epoch_id = CryptoHashVariable::decode(builder, &bytes[8..40]); + let next_epoch_id = CryptoHashVariable::decode(builder, &bytes[40..72]); + let prev_state_root = CryptoHashVariable::decode(builder, &bytes[72..104]); + let outcome_root = CryptoHashVariable::decode(builder, &bytes[104..136]); + let timestamp = U64Variable::decode(builder, &bytes[136..144]); + let next_bp_hash = CryptoHashVariable::decode(builder, &bytes[144..176]); + let block_merkle_root = CryptoHashVariable::decode(builder, &bytes[176..INNER_ENCODED_LEN]); + Self { + height, + epoch_id, + next_epoch_id, + prev_state_root, + outcome_root, + timestamp, + next_bp_hash, + block_merkle_root, + } + } + + fn encode_value(value: Self::ValueType) -> Vec { + let mut bytes = vec![]; + bytes.extend_from_slice(&U64Variable::encode_value::(value.height)); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::(value.epoch_id)); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::(value.next_epoch_id)); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::( + value.prev_state_root, + )); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::(value.outcome_root)); + bytes.extend_from_slice(&U64Variable::encode_value::(value.timestamp)); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::(value.next_bp_hash)); + bytes.extend_from_slice(&CryptoHashVariable::encode_value::( + value.block_merkle_root, + )); + log::debug!("encoded inner value: {:?}", bytes.len()); + assert_eq!(bytes.len(), INNER_ENCODED_LEN); + bytes + } + + fn decode_value(bytes: &[u8]) -> Self::ValueType { + assert_eq!(bytes.len(), INNER_ENCODED_LEN); + let height = U64Variable::decode_value::(&bytes[0..8]); + let epoch_id = CryptoHashVariable::decode_value::(&bytes[8..40]); + let next_epoch_id = CryptoHashVariable::decode_value::(&bytes[40..72]); + let prev_state_root = CryptoHashVariable::decode_value::(&bytes[72..104]); + let outcome_root = CryptoHashVariable::decode_value::(&bytes[104..136]); + let timestamp = U64Variable::decode_value::(&bytes[136..144]); + let next_bp_hash = CryptoHashVariable::decode_value::(&bytes[144..176]); + let block_merkle_root = + CryptoHashVariable::decode_value::(&bytes[176..INNER_ENCODED_LEN]); + + Self::ValueType { + height, + epoch_id, + next_epoch_id, + prev_state_root, + outcome_root, + timestamp, + next_bp_hash, + block_merkle_root, + } + } +} #[derive(Debug, Clone, Serialize, Deserialize)] pub struct EncodeInner; @@ -197,12 +340,12 @@ pub struct BlockVariable { pub next_block_inner_hash: CryptoHashVariable, pub next_bps: BpsArr, pub approvals_after_next: BpsApprovals, - pub next_bp_hash: CryptoHashVariable, + pub next_bps_hash: CryptoHashVariable, } impl From for BlockVariableValue { fn from(block: LightClientBlockView) -> Self { - let next_bp_hash = block + let next_bps_hash = block .next_bps .as_ref() .map(|bps| CryptoHash::hash_borsh(bps)) @@ -215,7 +358,7 @@ impl From for BlockVariableValue { header: block.clone().into(), next_bps: bps_to_variable(block.next_bps), approvals_after_next: block.approvals_after_next.into(), - next_bp_hash, + next_bps_hash, } } } @@ -225,12 +368,14 @@ pub(crate) fn bps_to_variable>( ) -> Vec> { next_bps .map(|next_bps| { - next_bps + let mut bps = next_bps .into_iter() .take(NUM_BLOCK_PRODUCER_SEATS) .map(Into::::into) .map(Into::>::into) - .collect() + .collect_vec(); + bps.resize(NUM_BLOCK_PRODUCER_SEATS, Default::default()); + bps }) .unwrap_or_else(|| vec![Default::default(); NUM_BLOCK_PRODUCER_SEATS]) } @@ -276,12 +421,13 @@ pub struct ValidatorStakeVariable { pub stake: BalanceVariable, } +const ACCOUNT_ID_PADDING_BYTE: u8 = b'#'; impl From for ValidatorStakeVariableValue { fn from(vs: ValidatorStake) -> Self { let public_key = CompressedEdwardsY(vs.public_key().unwrap_as_ed25519().0); let stake = vs.stake(); let mut account_id = vs.take_account_id().as_str().as_bytes().to_vec(); - account_id.resize(AccountId::MAX_LEN, 0); + account_id.resize(AccountId::MAX_LEN, ACCOUNT_ID_PADDING_BYTE); Self { account_id: account_id.try_into().unwrap(), // SAFETY: already checked this above public_key: public_key.into(), @@ -290,6 +436,24 @@ impl From for ValidatorStakeVariableValue { } } +impl Into for ValidatorStakeVariableValue { + fn into(self) -> ValidatorStakeView { + let unpadded_bytes = self + .account_id + .split(|x| *x == ACCOUNT_ID_PADDING_BYTE) + .collect_vec()[0]; + let account_id = String::from_utf8(unpadded_bytes.to_vec()).expect("invalid account bytes"); + println!("account id: {}", account_id); + let account_id = account_id.parse().expect("invalid account id"); + let public_key = PublicKey::ED25519(ED25519PublicKey(self.public_key.0.into())); + ValidatorStakeView::V1(ValidatorStakeViewV1 { + account_id, + public_key, + stake: self.stake.as_u128(), + }) + } +} + impl Default for ValidatorStakeVariableValue { fn default() -> Self { let bytes: [u8; AccountId::MAX_LEN] = [0u8; AccountId::MAX_LEN]; @@ -414,21 +578,8 @@ impl From for StakeInfoVariableValue { } } -// #[derive(Clone, Debug, Serialize, Deserialize)] -// pub struct HeaderHash; -// -// impl, const D: usize, const N: usize> Hint for HeaderHash { -// fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { -// let inner_lite_hash = input_stream.read_value::(); -// let inner_rest_hash = input_stream.read_value::(); -// let prev_block_hash = input_stream.read_value::(); -// -// let next_block_hash = sh; -// output_stream.write_value::(next_block_hash); -// } -// } - pub type ApprovalMessage = BytesVariable<41>; + // TODO: not sure these even need to be hints #[derive(Clone, Debug, Serialize, Deserialize)] pub struct BuildEndorsement; @@ -446,24 +597,6 @@ impl, const D: usize> Hint for BuildEndorsement { output_stream.write_value::(bytes.try_into().unwrap()); } } -// impl BuildEndorsement { -// pub fn build( -// &self, -// builder: &mut CircuitBuilder, -// next_block_hash: CryptoHash, -// next_block_height: U64Variable, -// ) -> BytesVariable { -// let mut input_stream = VariableStream::new(); -// input_stream.write(&next_block_hash); -// input_stream.write(&next_block_height); -// -// let mut output_stream = VariableStream::new(); -// let hint = BuildEndorsement::; -// let output_stream = hint.hint(&mut input_stream, &mut output_stream); -// let next_header = output_stream.read::(self); -// Self -// } -// } #[derive(CircuitVariable, Clone, Debug)] pub struct SyncedVariable { @@ -493,6 +626,44 @@ where } } +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct HashBpsInputs; + +impl, const D: usize> Hint for HashBpsInputs { + fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { + let bps = input_stream.read_value::>(); + let default_validator = + ValidatorStakeVariableValue::<>::Field>::default(); + + let bps = bps + .into_iter() + .filter(|x| x.account_id != default_validator.account_id) + .map(Into::::into) + .collect_vec(); + log::debug!("Bps to hash: {:#?}", bps); + let hash = CryptoHash::hash_borsh(bps); + log::debug!("Hash: {:#?}", hash); + + // TODO: figure out how to hash this in circuit + // It's non trivial because the account id is padded to the max len + output_stream.write_value::(hash.0.into()); + } +} + +impl HashBpsInputs { + pub fn hash, const D: usize>( + self, + b: &mut CircuitBuilder, + bps: &BpsArr, + ) -> CryptoHashVariable { + let mut input_stream = VariableStream::new(); + input_stream.write::>(&bps); + + let output_stream = b.hint(input_stream, self); + output_stream.read::(b) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/protocol/Cargo.toml b/crates/protocol/Cargo.toml index 6daf0ac..6c2afb3 100644 --- a/crates/protocol/Cargo.toml +++ b/crates/protocol/Cargo.toml @@ -31,3 +31,4 @@ hex.workspace = true pretty_env_logger.workspace = true rand = "*" serde_json.workspace = true +test-utils.workspace = true diff --git a/crates/protocol/src/experimental.rs b/crates/protocol/src/experimental.rs index 656ad58..06be21c 100644 --- a/crates/protocol/src/experimental.rs +++ b/crates/protocol/src/experimental.rs @@ -328,23 +328,10 @@ pub fn verify_proof(proof: Proof) -> bool { pub(crate) mod tests { use super::*; use crate::merkle_util::{compute_root_from_path, compute_root_from_path_and_item}; - use near_primitives_core::types::AccountId; use std::str::FromStr; + use test_utils::fixture; pub const BLOCK_MERKLE_ROOT: &str = "WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L"; - pub const LIGHT_CLIENT_HEAD: &str = "4bM5eXMDGxpFZXbWNT6TqX1HdZsWoHZ11KerCHJ8RKmU"; - - pub fn get_constants() -> (CryptoHash, CryptoHash) { - let block_root = CryptoHash::from_str(BLOCK_MERKLE_ROOT).unwrap(); - let light_client_head = CryptoHash::from_str(LIGHT_CLIENT_HEAD).unwrap(); - (light_client_head, block_root) - } - - fn read_proof Deserialize<'a>>(path: &str) -> T { - println!("Reading {}", path); - let path = format!("../../{path}"); - serde_json::from_reader(std::fs::File::open(path).unwrap()).unwrap() - } fn write_proof(path: &str, proof: &Proof) { std::fs::write( @@ -358,12 +345,8 @@ pub(crate) mod tests { } fn proof_fixture(is_new: bool) -> BasicProof { - let path = if is_new { - "fixtures/new.json" - } else { - "fixtures/old.json" - }; - read_proof(path) + let path = if is_new { "new.json" } else { "old.json" }; + fixture(path) } #[test] @@ -490,10 +473,10 @@ pub(crate) mod tests { }) .all(|(block_root, path)| { let proof = if path.contains("old") { - let proof: BasicProof = read_proof(&path); + let proof: BasicProof = fixture(&path); Proof::new(block_root, vec![proof]) } else { - read_proof(&path) + fixture(&path) }; write_proof(&path, &proof); @@ -502,17 +485,10 @@ pub(crate) mod tests { assert!(rewritten); } - // This test populates a reasonably large batch of proofs for verifying the - // slimmer onchain light client #[test] fn batch_proofs() { let _ = pretty_env_logger::try_init(); - let (head, common_root) = get_constants(); - let receiver_id = AccountId::from_str("da.topgunbakugo.testnet").unwrap(); - - let path = "fixtures/batch.json"; - - let p = read_proof(path); + let p = fixture("batch.json"); assert!(verify_proof(p)); } } diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 762a786..d7ef216 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -1,12 +1,15 @@ use crate::prelude::*; use error::Error; pub use merkle_util::*; +pub use near_crypto::ED25519PublicKey; pub use near_crypto::{PublicKey, Signature}; pub use near_primitives::{ block_header::ApprovalInner, block_header::BlockHeaderInnerLite, merkle::MerklePathItem, types::{validator_stake::ValidatorStake, BlockHeight, EpochId}, + views::LightClientBlockLiteView, + views::ValidatorStakeViewV1, views::{ validator_stake_view::ValidatorStakeView, BlockHeaderInnerLiteView, LightClientBlockView, }, @@ -219,7 +222,12 @@ impl Protocol { epoch_id: &CryptoHash, ) -> Result<(), Error> { if ![head.inner_lite.epoch_id, head.inner_lite.next_epoch_id].contains(epoch_id) { - log::debug!("Block is not in the current or next epoch"); + log::debug!( + "Next Block Epoch({:?}) is not in the current({:?}) or next({:?}) epoch", + epoch_id, + head.inner_lite.epoch_id, + head.inner_lite.next_epoch_id + ); Err(Error::BlockNotCurrentOrNextEpoch) } else { Ok(()) @@ -348,62 +356,24 @@ mod tests { use itertools::Itertools; use near_jsonrpc_primitives::types::light_client::RpcLightClientExecutionProofResponse; use serde_json::{self}; - - fn fixture(file: &str) -> LightClientBlockView { - serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) - .unwrap() - } - - fn get_next_epoch() -> LightClientBlockView { - fixture("2.json") - } - - fn get_first_epoch() -> LightClientBlockView { - fixture("1.json") - } - - fn get_current_epoch() -> LightClientBlockView { - fixture("current_epoch.json") - } - - fn view_to_lite_view(h: LightClientBlockView) -> Header { - Header { - prev_block_hash: h.prev_block_hash, - inner_rest_hash: h.inner_rest_hash, - inner_lite: h.inner_lite, - } - } - - fn test_state() -> (Header, Vec, LightClientBlockView) { - let first = get_first_epoch(); - let next = get_next_epoch(); - - ( - view_to_lite_view(first.clone()), - first - .next_bps - .clone() - .unwrap() - .into_iter() - .map(Into::into) - .collect(), - next, - ) - } + use test_utils::*; #[test] fn test_sync_across_epoch_boundaries() { - let (mut head, mut next_bps, next_block) = test_state(); + let (mut head, mut next_bps, next_block) = testnet_state(); + println!("head: {:#?}", head.inner_lite); let mut next_epoch_id = EpochId(head.inner_lite.next_epoch_id); let mut sync_and_update = |next_block: LightClientBlockView| { - let sync_next = Protocol::sync(&head, &next_bps, next_block.clone()).unwrap(); + let sync_next = Protocol::sync(&head, &next_bps[..], next_block.clone()).unwrap(); // Assert we matched the epoch id for the new BPS assert_eq!( head.inner_lite.next_epoch_id, sync_next.next_bps.as_ref().unwrap().0 .0 ); + println!("new head: {:#?}", sync_next.new_head.inner_lite); + head = sync_next.new_head; next_bps = sync_next.next_bps.unwrap().1; @@ -427,14 +397,12 @@ mod tests { sync_and_update(next_block.clone()); // Get next header, do next sync - let next_block = get_current_epoch(); - sync_and_update(next_block.clone()); + let next_block = test_last(); + sync_and_update(next_block.body); } #[test] fn test_validate_already_verified() { - pretty_env_logger::try_init().ok(); - let (head, _, _) = test_state(); assert_eq!( Protocol::ensure_not_already_verified(&head, &BlockHeight::MIN), @@ -444,8 +412,6 @@ mod tests { #[test] fn test_validate_bad_epoch() { - pretty_env_logger::try_init().ok(); - let (head, _, _) = test_state(); assert_eq!( Protocol::ensure_epoch_is_current_or_next( @@ -458,8 +424,6 @@ mod tests { #[test] fn test_next_epoch_bps_invalid() { - pretty_env_logger::try_init().ok(); - let (head, _, mut next_block) = test_state(); next_block.next_bps = None; @@ -475,8 +439,6 @@ mod tests { #[test] fn test_next_invalid_signature() { - pretty_env_logger::try_init().ok(); - let (_, next_bps, next_block) = test_state(); assert_eq!( Protocol::validate_signature( @@ -490,8 +452,6 @@ mod tests { #[test] fn test_next_invalid_signatures_no_approved_stake() { - pretty_env_logger::try_init().ok(); - let (_, next_bps, mut next_block) = test_state(); let approval_message = Protocol::reconstruct_approval_message(&next_block); @@ -514,15 +474,13 @@ mod tests { #[test] fn test_next_invalid_signatures_stake_isnt_sufficient() { - pretty_env_logger::try_init().ok(); - let (_, next_bps, next_block) = test_state(); let approval_message = Protocol::reconstruct_approval_message(&next_block); let StakeInfo { total, approved } = Protocol::validate_signatures( &next_block.approvals_after_next, - &next_bps, + &next_bps[..], &approval_message.unwrap(), ); @@ -546,8 +504,6 @@ mod tests { #[test] fn test_next_bps_invalid_hash() { - pretty_env_logger::try_init().ok(); - let (_, _, next_block) = test_state(); assert_eq!( @@ -561,8 +517,6 @@ mod tests { #[test] fn test_next_bps() { - pretty_env_logger::try_init().ok(); - let (_, _, next_block) = test_state(); assert_eq!( @@ -577,8 +531,6 @@ mod tests { #[test] fn test_next_bps_noop_on_empty() { - pretty_env_logger::try_init().ok(); - let (_, _, next_block) = test_state(); assert_eq!( Protocol::ensure_next_bps_is_valid(&next_block.inner_lite.next_bp_hash, None).unwrap(), @@ -588,7 +540,6 @@ mod tests { #[test] fn test_outcome_root() { - pretty_env_logger::try_init().ok(); let req = r#"{"outcome_proof":{"proof":[],"block_hash":"5CY72FinjVV2Hd5zRikYYMaKh67pftXJsw8vwRXAUAQF","id":"9UhBumQ3eEmPH5ALc3NwiDCQfDrFakteRD7rHE9CfZ32","outcome":{"logs":[],"receipt_ids":["2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"],"gas_burnt":2434069818500,"tokens_burnt":"243406981850000000000","executor_id":"datayalla.testnet","status":{"SuccessReceiptId":"2mrt6jXKwWzkGrhucAtSc8R3mjrhkwCjnqVckPdCMEDo"},"metadata":{"version":1,"gas_profile":null}}},"outcome_root_proof":[{"hash":"9f7YjLvzvSspJMMJ3DDTrFaEyPQ5qFqQDNoWzAbSTjTy","direction":"Right"},{"hash":"67ZxFmzWXbWJSyi7Wp9FTSbbJx2nMr7wSuW3EP1cJm4K","direction":"Left"}],"block_header_lite":{"prev_block_hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","inner_rest_hash":"G25j8jSWRyrXV317cPC3qYA4SyJWXsBfErjhBYQkxw5A","inner_lite":{"height":134481525,"epoch_id":"4tBzDozzGED3QiCRURfViVuyJy5ikaN9dVH7m2MYkTyw","next_epoch_id":"9gYJSiT3TQbKbwui5bdbzBA9PCMSSfiffWhBdMtcasm2","prev_state_root":"EwkRecSP8GRvaxL7ynCEoHhsL1ksU6FsHVLCevcccF5q","outcome_root":"8Eu5qpDUMpW5nbmTrTKmDH2VYqFEHTKPETSTpPoyGoGc","timestamp":1691615068679535000,"timestamp_nanosec":"1691615068679535094","next_bp_hash":"8LCFsP6LeueT4X3PEni9CMvH7maDYpBtfApWZdXmagss","block_merkle_root":"583vb6csYnczHyt5z6Msm4LzzGkceTZHdvXjC8vcWeGK"}},"block_proof":[{"hash":"AEnTyGRrk2roQkYSWoqYhzkbp5SWWJtCd71ZYyj1P26i","direction":"Left"},{"hash":"HgZaHXpb5zs4rxUQTeW69XBNLBJoo4sz2YEDh7aFnMpC","direction":"Left"},{"hash":"EYNXYsnESQkXo7B27a9xu6YgbDSyynNcByW5Q2SqAaKH","direction":"Right"},{"hash":"AbKbsD7snoSnmzAtwNqXLBT5sm7bZr48GCCLSdksFuzi","direction":"Left"},{"hash":"7KKmS7n3MtCfv7UqciidJ24Abqsk8m85jVQTh94KTjYS","direction":"Left"},{"hash":"5nKA1HCZMJbdCccZ16abZGEng4sMoZhKez74rcCFjnhL","direction":"Left"},{"hash":"BupagAycSLD7v42ksgMKJFiuCzCdZ6ksrGLwukw7Vfe3","direction":"Right"},{"hash":"D6v37P4kcVJh8N9bV417eqJoyMeQbuZ743oNsbKxsU7z","direction":"Right"},{"hash":"8sWxxbe1rdquP5VdYfQbw1UvtcXDRansJYJV5ySzyow4","direction":"Right"},{"hash":"CmKVKWRqEqi4UaeKKYXpPSesYqdQYwHQM3E4xLKEUAj8","direction":"Left"},{"hash":"3TvjFzVyPBvPpph5zL6VCASLCxdNeiKV6foPwUpAGqRv","direction":"Left"},{"hash":"AnzSG9f91ePS6L6ii3eAkocp4iKjp6wjzSwWsDYWLnMX","direction":"Right"},{"hash":"FYVJDL4T6c87An3pdeBvntB68NzpcPtpvLP6ifjxxNkr","direction":"Left"},{"hash":"2YMF6KE8XTz7Axj3uyAoFbZisWej9Xo8mxgVtauWCZaV","direction":"Left"},{"hash":"4BHtLcxqNfWSneBdW76qsd8om8Gjg58Qw5BX8PHz93hf","direction":"Left"},{"hash":"7G3QUT7NQSHyXNQyzm8dsaYrFk5LGhYaG7aVafKAekyG","direction":"Left"},{"hash":"3XaMNnvnX69gGqBJX43Na1bSTJ4VUe7z6h5ZYJsaSZZR","direction":"Left"},{"hash":"FKu7GtfviPioyAGXGZLBVTJeG7KY5BxGwuL447oAZxiL","direction":"Right"},{"hash":"BePd7DPKUQnGtnSds5fMJGBUwHGxSNBpaNLwceJGUcJX","direction":"Left"},{"hash":"2BVKWMd9pXZTEyE9D3KL52hAWAyMrXj1NqutamyurrY1","direction":"Left"},{"hash":"EWavHKhwQiT8ApnXvybvc9bFY6aJYJWqBhcrZpubKXtA","direction":"Left"},{"hash":"83Fsd3sdx5tsJkb6maBE1yViKiqbWCCNfJ4XZRsKnRZD","direction":"Left"},{"hash":"AaT9jQmUvVpgDHdFkLR2XctaUVdTti49enmtbT5hsoyL","direction":"Left"}]}"#; let p: RpcLightClientExecutionProofResponse = serde_json::from_str(req).unwrap(); @@ -603,12 +554,7 @@ mod tests { assert!(root_matches); } - #[test] - fn statically_test_lens() { - println!("approval: {:?}", std::mem::size_of::()); - } - - // Missed a part of LC spec regarding BPS handover, only the MAX_SEATS need to be taken + // FIXME: Missed a part of LC spec regarding BPS handover, only the MAX_SEATS need to be taken // TODO: change epoch_bps to only store MAX_SEATS and then for next #[test] fn test_enough_stake_in_next_epoch_not_this() { diff --git a/crates/protocol/src/prelude.rs b/crates/protocol/src/prelude.rs index 10089e0..9036d5d 100644 --- a/crates/protocol/src/prelude.rs +++ b/crates/protocol/src/prelude.rs @@ -1,5 +1,6 @@ pub use anyhow::anyhow; pub use anyhow::Result; +pub use itertools::izip; pub use itertools::Itertools; pub use log::{debug, error, info, trace, warn}; pub use near_primitives::types::AccountId; diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml new file mode 100644 index 0000000..4641fba --- /dev/null +++ b/crates/rpc/Cargo.toml @@ -0,0 +1,36 @@ +[package] +edition.workspace = true +license.workspace = true +name = "near-light-client-rpc" +version.workspace = true + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +borsh.workspace = true +either.workspace = true +futures.workspace = true +itertools.workspace = true +log.workspace = true +near-crypto.workspace = true +near-jsonrpc-client.workspace = true +near-jsonrpc-primitives.workspace = true +near-primitives-core.workspace = true +near-primitives.workspace = true +serde.workspace = true +thiserror.workspace = true + +# async-trait.workspace = true +# axum.workspace = true +# coerce.workspace = true +# config.workspace = true +# near-jsonrpc-client.workspace = true +# protobuf.workspace = true +# reqwest.workspace = true +# sled.workspace = true + +[dev-dependencies] +hex.workspace = true +pretty_env_logger.workspace = true +rand = "*" +serde_json.workspace = true diff --git a/bin/client/src/client/rpc.rs b/crates/rpc/src/lib.rs similarity index 55% rename from bin/client/src/client/rpc.rs rename to crates/rpc/src/lib.rs index de9bd8d..f36e348 100644 --- a/bin/client/src/client/rpc.rs +++ b/crates/rpc/src/lib.rs @@ -1,16 +1,22 @@ -use super::message::GetProof; use crate::prelude::*; +use async_trait::async_trait; use futures::TryFutureExt; use near_jsonrpc_client::{ - methods::{self, light_client_proof::RpcLightClientExecutionProofResponse}, + methods::{ + self, light_client_proof::RpcLightClientExecutionProofResponse, + validators::RpcValidatorResponse, + }, JsonRpcClient, }; -use near_primitives::views::LightClientBlockView; +use near_primitives::{ + types::{validator_stake::ValidatorStake, ValidatorStakeV1}, + views::{validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1}, +}; use std::fmt::{Display, Formatter}; -// TODO: retry, failover rpcs +pub mod prelude; -#[derive(Debug, Clone, Deserialize, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)] pub enum Network { Mainnet, #[default] @@ -38,6 +44,7 @@ impl Network { } } } + impl Display for Network { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let s = match self { @@ -68,11 +75,28 @@ impl NearRpcClient { NearRpcClient { client, archive } } +} - pub async fn fetch_latest_header( +#[async_trait] +pub trait LightClientRpc { + async fn fetch_latest_header( &self, latest_verified: &CryptoHash, - ) -> Option { + ) -> Result>; + async fn fetch_light_client_proof( + &self, + req: GetProof, + latest_verified: CryptoHash, + ) -> Result; + async fn fetch_epoch_bps(&self, epoch_id: &CryptoHash) -> Result>; +} + +#[async_trait] +impl LightClientRpc for NearRpcClient { + async fn fetch_latest_header( + &self, + latest_verified: &CryptoHash, + ) -> Result> { let req = methods::next_light_client_block::RpcLightClientNextBlockRequest { last_block_hash: *latest_verified, }; @@ -84,20 +108,16 @@ impl NearRpcClient { self.archive.call(&req) }) .await - .map_err(|e| { - log::error!("Error fetching latest header: {:?}", e); - e - }) - .ok()? + .map_err(|e| anyhow::format_err!("{:?}", e)) } - pub async fn fetch_light_client_proof( + async fn fetch_light_client_proof( &self, req: GetProof, latest_verified: CryptoHash, ) -> Result { let req = methods::light_client_proof::RpcLightClientExecutionProofRequest { - id: req.0, + id: req, light_client_head: latest_verified, }; self.client @@ -109,4 +129,41 @@ impl NearRpcClient { .await .map_err(|e| anyhow::format_err!("{:?}:{}", req.id, e)) } + + async fn fetch_epoch_bps(&self, epoch_id: &CryptoHash) -> Result> { + let req = methods::validators::RpcValidatorRequest { + epoch_reference: near_primitives::types::EpochReference::EpochId( + near_primitives::types::EpochId(*epoch_id), + ), + }; + log::debug!("requesting validators: {:?}", req); + self.client + .call(&req) + .or_else(|e| { + debug!("Error hitting main rpc, falling back to archive: {:?}", e); + self.archive.call(&req) + }) + .await + .map(|x| x.current_validators) + .map(|x| { + x.into_iter() + .map(|x| { + ValidatorStakeView::V1(ValidatorStakeViewV1 { + account_id: x.account_id, + public_key: x.public_key, + stake: x.stake, + }) + }) + .collect() + }) + .map_err(|e| anyhow::format_err!("{:?}:{}", epoch_id, e)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_name() {} } diff --git a/crates/rpc/src/prelude.rs b/crates/rpc/src/prelude.rs new file mode 100644 index 0000000..5553d87 --- /dev/null +++ b/crates/rpc/src/prelude.rs @@ -0,0 +1,16 @@ +pub use anyhow::anyhow; +pub use anyhow::Result; +pub use futures::FutureExt; +pub use futures::TryFutureExt; +pub use itertools::Itertools; +pub use log::{debug, error, info, trace, warn}; +pub use near_primitives::types::AccountId; +use near_primitives::types::TransactionOrReceiptId; +pub use near_primitives_core::borsh::{self, BorshDeserialize, BorshSerialize}; +pub use near_primitives_core::hash::CryptoHash; +pub use serde::{Deserialize, Serialize}; + +pub type Header = near_primitives::views::LightClientBlockLiteView; +pub type BasicProof = + near_jsonrpc_primitives::types::light_client::RpcLightClientExecutionProofResponse; +pub type GetProof = TransactionOrReceiptId; diff --git a/crates/test-utils/Cargo.toml b/crates/test-utils/Cargo.toml new file mode 100644 index 0000000..9c51369 --- /dev/null +++ b/crates/test-utils/Cargo.toml @@ -0,0 +1,31 @@ +[package] +edition.workspace = true +license.workspace = true +name = "test-utils" +version.workspace = true + +[dependencies] +anyhow.workspace = true +borsh.workspace = true +derive_more.workspace = true +either.workspace = true +itertools.workspace = true +log.workspace = true +near-crypto.workspace = true +near-jsonrpc-primitives.workspace = true +near-light-client-protocol.workspace = true +near-primitives-core.workspace = true +near-primitives.workspace = true +pretty_assertions.workspace = true +serde.workspace = true +thiserror.workspace = true +# async-trait.workspace = true +# near-jsonrpc-client.workspace = true +# protobuf.workspace = true +# reqwest.workspace = true +# sled.workspace = true + +hex.workspace = true +pretty_env_logger.workspace = true +rand = "*" +serde_json.workspace = true diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs new file mode 100644 index 0000000..dc314bd --- /dev/null +++ b/crates/test-utils/src/lib.rs @@ -0,0 +1,99 @@ +use derive_more::AsRef; +use derive_more::Into; +use near_light_client_protocol::{ + prelude::{BasicProof, Header, Itertools}, + LightClientBlockView, Protocol, StakeInfo, ValidatorStake, +}; +pub use near_primitives::hash::CryptoHash; +pub use pretty_assertions::assert_eq as pas_eq; +pub use serde::de::DeserializeOwned; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize, Into)] +pub struct LightClientFixture { + pub last_block_hash: CryptoHash, + pub body: T, +} + +pub fn fixture(file: &str) -> T { + serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) + .unwrap() +} + +pub fn lc(file: &str) -> LightClientFixture { + fixture(file) +} + +pub fn main_last() -> LightClientFixture { + lc("main_2.json") +} + +pub fn main_next() -> LightClientFixture { + lc("main_1.json") +} + +pub fn main_first() -> LightClientFixture { + lc("main_0.json") +} + +pub fn test_last() -> LightClientFixture { + lc("test_2.json") +} + +pub fn test_next() -> LightClientFixture { + lc("test_1.json") +} + +pub fn test_first() -> LightClientFixture { + lc("test_0.json") +} + +pub fn view_to_lite_view(h: LightClientBlockView) -> Header { + Header { + prev_block_hash: h.prev_block_hash, + inner_rest_hash: h.inner_rest_hash, + inner_lite: h.inner_lite, + } +} + +pub fn mainnet_state() -> (Header, Vec, LightClientBlockView) { + pretty_env_logger::try_init().ok(); + let first = main_first().body; + let head = view_to_lite_view(first.clone()); + let bps = first + .next_bps + .unwrap() + .into_iter() + .map(Into::into) + .collect(); + let next = main_next(); + + (head.into(), bps, next.body) +} + +pub fn testnet_state() -> (Header, Vec, LightClientBlockView) { + pretty_env_logger::try_init().ok(); + let first = test_first().body; + let head = view_to_lite_view(first.clone()); + let bps = first + .next_bps + .unwrap() + .into_iter() + .map(Into::into) + .collect(); + let next = test_next(); + + (head.into(), bps, next.body) +} + +pub fn test_state() -> (Header, Vec, LightClientBlockView) { + mainnet_state() +} + +pub fn to_header(bv: LightClientBlockView) -> Header { + Header { + prev_block_hash: bv.prev_block_hash, + inner_rest_hash: bv.inner_rest_hash, + inner_lite: bv.inner_lite, + } +} diff --git a/fixtures/86673090.json b/fixtures/86673090.json deleted file mode 100644 index a1c7b40..0000000 --- a/fixtures/86673090.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "approvals": [ - "ed25519:5EyE23RLUwqdJkPW9762sRosM838bUtn5SS2mt8e5xYriG4UfxVbEUaKPAdc9tGQkAem58hYDxvpBMoAPd2GT1sD", - "ed25519:4Mpvtnp6gASgz3pGApMG4P1Tvpxj3zkVmbqoNKvyWBrhMk8G8PdsaZyCHqzYwp43yCLb4dCFwsdDnJPmpGPdCFqq", - null, - "ed25519:4WT7358xtNLpgayEcvzRK4q3j59yVPfMnVK6rhWxUhhHvvyVmY8Q2aU5RP9v4TbGvuH4ETyJfYqu59ne5wCKcYp7", - "ed25519:5fHqyG14B24Q8BUu4dmi6VL8HLCQLu5J4WU9DmpxVQwysiEzUBBY3Gum4xHf21ordQdYUnKt43AewVqLMEwqgmfh", - "ed25519:3hKSLU2WSUitFSfiTzkvEeqTseqzn6L6Y2bFEB1zrNnCzTTmk58FVJBzzE69DLaZqfRntarqjQF2tsaiWkReaqVt", - null, - "ed25519:ccRZRiG1cjHGkshaFEbnbwdvZZBhMoQhUeupHh9rAo4VPU3XTE7merRoJRQn22uG6kcgqaENfDu8hitkeLz9h5K", - null, - null, - "ed25519:3QbVQUBnkYVfdxshCFcykn2sKeXnBsVEGQZ2aE1FMVs9Dg8fRQNBiE1znXRpRuPEFPih8HB2M8NvpCHnXVHThPEQ", - "ed25519:4FxR7aNf1B4tPHE1gPW4w5fdn5omZhgvhrFoKn9CsWxCDCnGk12mZBNJengBC5rP9yixJSN15Dj2UMFgQogeCgmo", - "ed25519:3YgSdETqTwQnaZoBM8y3W8942sLZmAgGzNXfbeV96ehXQ5L37Ye19xMng27U9cSbDRm6KhSo3DdSLBhM5PcsCJwt", - "ed25519:47Q9p7DCpDz3CFYhwSUPYymXq9xUhXZ2gAhx6ftrZFVng73n6SnBSoBUeNyLoxWooEdLzeeX6SC1gC5Gm4TdHgkH", - "ed25519:4Wb5Kjk81PYjEYPzSuTdhref8m2vdTU6aRZNFwkdrf6yDA27JhQh4QshxUqND2RGt5aygVQCQaSQE2ReWL89GaDu", - null, - "ed25519:2GpV67gpeJ5BQLkrsEQXmWvxVJEYo5LRTYKFdD1NJAW8sWuAqBTG1x86MWgFpwsgSRxt8D6BLDupVzh9uudDpbCg", - "ed25519:2QZtay8pcUY3Vd9C7Cx48rQMqMGDQSTySB9qzNtcmSyGFjCx9BTwKoQzHZNK4yMvwxTYLJr2fRANW2EYN3TEWyjK", - null, - "ed25519:4CGjzmDLbVXP5DoDrvsyYPivQiHWZtQetGRgayDisSLGM9UWVkyoMjLuohpcpYn7xjMv4zD3JDtxUVddxxmBsyky", - "ed25519:5TnzJtqpNBtBtajMV2ScZkxZ5Luyo7wgn1HZqEQMS1KaqGdtnFiSP6rR86Fk3ZimKciMexhdP8bJVKf5PRDmboqS", - "ed25519:5kFTm2sBffWSpoST9yCe28cZYFjWajdrRbBmA6aG7YCfcZmEMRbrauGepr4Kk4rUJDSy8NhDMraGkRh1j7oo1FqH", - "ed25519:3Bngm2RYrbbjUAThZ9KZpZXXh7H6GNTWdFr1ZBqxMVvPmPi9Fhnwsr8EsEZ39PavdN6UGgqPyPHXamxkb7DjxqAA", - "ed25519:5HQRYAR1Fjw8JEBGV6SBbUSoEvreVPXK4b6oBM5jBfNNTBG3rjngM2Peaox6D7yjowJfNgGonyA3UbhYbE9ZH9KM", - "ed25519:4dAS3dWvQrzZR4MGmVy6zbtvwdN9ZFRB5StbreTvDMQPsksXdFdMF3inW2GPJQv4d79yQMoXKLYyxzVE6hCUg6KY", - "ed25519:2BJwRznSvYZ8NYrh6q98ex4qQak7F1bgvKu1hds5B75ZBU7zq9RwEycJZYD2Y8NefkoxEj9ufc9oeDuXMb2bg5YT", - "ed25519:5KmYT9UNwwP6zCcKzYU4AgaKmS6EX8C9cRkcMsNaL1cNWWGLy3PBgoqvW2HHAuHg9bckSyKLxFS67BBvga5Evhqp", - "ed25519:465bTrzK51JoHU12g3ZGgnVDUt9iMzw9GKPqYbco5J2cSZGSfBEwvgN4tQn41k5HuR3DnXf63EKromZRASHmQ1Ns", - "ed25519:92UPamPaC9aubd3CV5n1xiY4n9Q56gK6N6TxGMFNuF4QPfxiTZgNTUDEqbERjd5Xr4chF9QgYHv21UYDzJLLZRF", - "ed25519:a1nHUsQcyBFDxeMqxLqrsdUGhUgZGZ9yiUAuyXP6Gk1zaaMQXzGEUW91Vytbat6wH2TYT7izAd2ocJRzHmmGFun", - "ed25519:DiqvANzRMsoVv153ktRyrdXGwzUzPEp5M2ZzMtiwHvSQ7auXM8yBgxBzV9zb4ia2KU1E2uKM3RY7m3jJQGUHWEy", - "ed25519:2uuMLXWZVTSu7F1mYna3CwMEupPByAE9Coayyvx7jY1jXJfJaT1y1DihASgcAgZdLPe9i7vm2G1rjakrmbwLXDF9", - null, - "ed25519:66ATciiU99d2RPMwnabuYE9q3hSEd3SeHefYcW2aAhNz8qZKghrmmBnRbe8qdrXbvvCaMF8oApGzK41RZixVqq2t", - "ed25519:5P5LM6xVAP6rLCMbX8aMUqUDD3Azd1BrayVSrLDrFBdd7vTZc8HVdy5uNVfQhf7kfUQTNw8YzNGaxM6WKGximP73", - "ed25519:P3JF33m6nj8L5xr2D5g8MQCbszaVAap4VWHuas66fPDArk2Vg6mKggKeeiZDvX5wtGUGnB6DWesz38YzyWPiPRR", - "ed25519:5dtM1KUy799LtskhnXZWd5ck8FdnGaCTCozXALo1KkMquWiRTSRX9yTovqs3fXfnyXPRBK8jg4Txxx7cJZjG7joQ", - "ed25519:GHsDcmB47Bv4kyThnYP4uMyAS3Ww5G698f2dxUbTMBZfptGJLsM9zEQsY2xWuN38Hu3rmvhDSpJodki4tFB2Yq1", - "ed25519:3bexxXkRpDdij9wBbwd37fCtUvSQJ9PZYALA9gN26nU5es49cYrVmPgBLDpvU8YhpGvsagW5AyWMUN6SfBbcovic", - "ed25519:4rUV6GnHkSejhb7PNBVrFafZp9eADiX6UWw3bFRSUbachSqcz9de8iJUtLZCmEdT5T3k3FYAnm3R9kZLwksh2kUx", - "ed25519:4RjXNdDiqWi7LxkHMDjM2h7ynksWqqyKC4GvzLqxbykqE6Vp7jKLcDsHFbjy5Nqa5DTqhfudji5nRVvfcXcqte12", - null, - "ed25519:2QZtay8pcUY3Vd9C7Cx48rQMqMGDQSTySB9qzNtcmSyGFjCx9BTwKoQzHZNK4yMvwxTYLJr2fRANW2EYN3TEWyjK", - "ed25519:bVXpA9Ph7bHtsRDZNfYSyCcEaXUgR6iydyuH9ZXyuZKedNBLSEXFrGEVtYo1te3ekz364u6GunaYWJNWR6dPEys", - "ed25519:4Q9BqoukYXS9fdfzJiXQMgsgLKieb1JfAa723tJ54HKg2Vx335yPxbLYtdau9bGMosVHbHE7nuC2xhZEkzaaAjwE", - "ed25519:2MrSHSYAadVazPE5GVpmmG41onoJRvFYDcAV4GWjYYX59GToZYBkN8GdZSr6MPA4GbUmMXjwq485w4QXGEyCzS6G", - "ed25519:2sjKECxBGDCMuLhbHkjNHfPeQPtUf1x5HUyB9izA3UHLXHtZJVYv7nxGfLFgeg1kXJ48PNmXqrQDX9gTKkJ2HJ49", - null, - "ed25519:ApLhgH5mWNn5FMMtNuqC6R8ufebwLvuWucboPSxp7hG1n7nuPmEoTfiY9eXE5CU61atJF6oqDXqSe1eT5gxWkxu", - "ed25519:3YfQJWcq87nvTKXDNWoSoU1Dd45bepoFsLogEBEKDM6dwVk3VwVEdbeKewfCcxqRWg6ToXL4y5cfGTP8K6Yv6UeU", - "ed25519:HGBjthmSMR1mc6by4VZys4BJJFFnFXL2FP1q8ZBo6YAUiDe5gjf7XXs3thoJQ8gTM2KSocaC79hJ6UHkzzyhQ46", - null, - "ed25519:65YrKCGddddFnXiNQM7h6gKnMAoum8gxRcF7DXkvq5c9926Rk2PjmKsTTPZFKdN5xT7F37FxRxvhpmq8FNmFgPKh", - "ed25519:2GhXAPXFSKMLCPPJBwifwt2xgMT3gxi8idz8uTahkFjejGVWLKWYhs6pE5CVVTjSrxYQVLbPWYwVbi4xzoGCvyX5", - "ed25519:F7mcPLLpVCjZBueeJSWTpVjUujeVtEWVdUUZAZngmHrctiEsQ3GPQG4tYAb4eBMqaDMR4CsaMPeDcvvucqQvS5c", - null, - null, - "ed25519:45MV7qHAkiyw3CHrSfedqB4iyQob7wGKE35w26SL2naWUEBxg68P4dy5xR8bTEzRBVjwyA9GB7jjk1GPwV4EwoBf", - null, - "ed25519:2EsSmrPm9GjbTDYUhg2ZrhT9iUpLvyuPqdeaY5VqpD6q8h4xQwECLMLBCydFurP6JR3eU4LqSvLitQJynrhqdjD5", - "ed25519:4P3EfGVSnumrypgbUY8ssc3zvGhHM67nw5pvJ6zAZLq3kMkXwnpiqoUQjgKL6ajRBUWwhJV5o3FKjvDoU3g4ZZJR", - "ed25519:5jcePF2VUe9K3UMzwkq323cLrXBG86EDz5tLoZpXBnmJ2Zq5BasYZpVQPjA33HFtoR93PH87mWUPSSyQwzrcfVme", - "ed25519:3mKQq2rUrSNCDkTBKyLFhCz2DsuyAcssmmP5kdgjLPQiG2kHpXEMQDFMo1g8RNZducCcQgFePUMNwJXMvqpp5DqG", - "ed25519:5hSuo3CxpWxEwaREGrsPpQyN8xqguJRQ1d7bRAT7QnLYQjLF1RR2xEAT5ouDSjnyDmJ9a3gd2uNTMsV6g7W3rL7X", - "ed25519:kHE4wh9kBpnzuBSHmsptMkdMZigqACiV7NMzCrGPRjrR9j9sNx7sLowhjtKxLkGvrAdaNYw2zFXQjE6jsBE2QAJ", - "ed25519:4QV34kRmmiWAugTS88AD6rSek3dgpEAZspHhvkwXrckP6carKCqngi1iHw1746395FWHhwTR13WQDeRXQV2VqYdY", - "ed25519:2ndsCzbHmr8sTVJ9qhNaD2DPv8zzmXLmCV38kSzUZv6Wur7C14YafejLn8Tbde9vgkngRv9U8JiCppUTs58rGPmw", - "ed25519:t1ot7rhp9hwRYsq28vLCijqxSc1RpX8JY9hxLaWmLWU4iAeXHs4XiGXyYr9sEtpxycENsaEyepRkGTnDZnk418p", - "ed25519:534aJtTXJVX8xCcgTVKLrs5XQeJJJtC8DczZVTCHVXb2s8o9KKxoFpY1jC4UktsJqhc61Gk1mLAn4v5omBDERdG1", - "ed25519:3uRa6zZsn5ZgsBuDSVQvDcUaxafvzhbuCFwWDeciW8Pwj9Sp9h851uePXRFXK3KNeCHYxFBDFuWnJBNipBnWhhPu", - "ed25519:f6h6a7pyNuHcvTUjiHJiHHhWdTko3vJe9CwVigse9HHbeJZyRGXZzneb8vugyRYuFc4EuSUqFNjKUWTNBh31W94", - "ed25519:3ejr97xuzX5MYJf3Ecsjb5JcxnWdG7zKYmY6asnNhLCCF1tcHKmSkzBy49ZWT1SM8YeJ53CMpce7DvAYSZiyik5H", - "ed25519:2LhrZgxTqErqwp7Fa4KGcTXKvn3nUnVvehvZEMtyTb9jG1eac4x82sHjrMC4cEQHk8JbNEiUWH2ymGkaAoR9F1LE", - "ed25519:4fUzGDTBNRCV1UoQ9Z7RSpGDnnd8DSw1NJBJ3QBtgcqS2mMY7RKSGA45kgmMGuacCeEoV7N4ozJJGmZmfXUmz4Vu", - "ed25519:kFrKBXb7WwhFL7bVwJiaKbeqfbGrqYSux8knu7quUNPRy5MiPoFyXnX5L7dvfp39yGCv3ueFvyJNt3JYNG2NVoz", - "ed25519:428dbpp38MZCT3iVYdHk1hBNi3SaZkf3BVPQzzxtQkeBEB23ciySw22ffsZZv8trX2fAcFuucnvDb6oDwvJ1MHyV", - "ed25519:p1kemVQixDh9GWc2hwFAFUNcMtHPHeXenawZyc6j1FEK4rtt1TB58PmvGB31mgqBcWVpfPpKtJe55c3ZLFTM3Vg", - "ed25519:64mijUyNR87k9Phq4YxC3EDog9cMqchXqGjszpHShdcGcs5D6j3h5jXCw2Z1KR4Ax2b3XWfg5Js1P2qxK26rnHZM", - "ed25519:4pqCeceFPwfjmVRzu2wn7RwM57pthbR3gbhvQHwvhMh8qkRbHwqxRgwypELatzHZipNYWyKUnGmkXCv7E6rawRSb", - "ed25519:3HQpQKBZH4A5XTRZ8KQgF9zM4oPZ9Lk5wvVsGiB4Ytz3WpyXnTG4EwwwxMjcLR5FSDTvGsJwWeUFRNbFt5UCazyV", - null, - "ed25519:2mfYPj9uc5Wj52Ei4yF7MdQu7HKyDQCMEtK2UYusFSi8eNamsVrsBpkhQK1sqQBYrURBMsyAbmDR7QkShn9UMJCS", - "ed25519:4jim8smGkvi3PscmJzaQrueshK2aQwDWjnLoz5fiUbAVpgbcj3P1JKmrmS445k2TUux7c13pSkE5qoF1NzYKmJeh", - "ed25519:4yWBe1o8GFkjEiso7c1PszL5LLMMDJoNvjhhFxPi6m3frKvDJmTFqALMQQBNSvTvcC9c7yMdGjf54cqLHfJ5qaRE", - "ed25519:4f13JLcebss9Af8XjBvVuskFRDgoy9rzLjBmd5BfkezPniwCAu23WcUjyhSkH6bApDf9jmCTiBR9N2BVWMkgSsQD", - "ed25519:34M1sQnVX4SrbLFLgNvc6YnBiTQZs8Z5Xg12PkjuM9YsSwDrg7JutsihTFSoZFASfPiaPrSLavB1Pi2XfZ885Vaj", - "ed25519:2wsDUAVZH6kZuHMurdBvEcgoc1pnoCXG4aF8ZhP9go5zVf9mFN2733wHypGh53hoWSK4Ybo9SfpErxLr1iPFQ3wD", - "ed25519:3je7ZxGKJVg1YvvwJ3e9RUNnsWSbvxnseUxu7A7gToJHQpBS7CGinH9BdRMjGdof1xnpropj5HKckHfxmwSnwfUw", - null, - "ed25519:31Kf4VqQ9N4icR6eHh9CrySfCDBmdo99zd1pJnumAjEiAYrRtTHXuTMXteq3GPGRGH1RoBUZoNHuoVR6cPFyE32z", - "ed25519:DqH33ngukpfKnVHyUNyQRssV2B6E39dQvPQcgprmjutV5xBfNNiYe9rk7BXdahEuCrV6rDbeRwP23gkpxyxhrUL", - "ed25519:4M3qQ2ciJnpsuuSnECYdmF9MTTj1tMZJ173xyWg8xELS14yUjgwKzXeTRYcttTWLW81Dr81PAUhxZUytmFqA1SRC", - "ed25519:7itcQvk7QKsiVEfKX5X7TfzBetxff2h4ezXfnwYTprhJH3mkh4wcRCSTcRJBqy6tLKHCfju7LeuSGTWWDRubqAs", - "ed25519:5AW64AoxQXsvRvzBX8nGAdKb89N2sM1DUfykPxHYYiKuNPW5bFBKDfZ4jA8podApKy1bkv4J3MHz6YxGaqsqmj3F", - "ed25519:36NdfXxtNavZGu7gfuA2D7rv5bxSsjUaM55TYwHiiT1ZbRxLmMu35kF6ck3zATA7f3iuEHyYAd3HUxzFP5arg9Pe", - null, - "ed25519:43y1TuLutVXWfXGE8jy3at38Rb2a6SR9WVzfgYt3GMrhg4cSN2ufczPy3UbBmyELEmPcryRtdbtg2MwSNWNXxWRj", - "ed25519:2i3PEqDsTVHPA6QUSH1ytVqBvzz5jtGSsriH8Z5qE6Mgn74ExNcTZx3SzvVBzX5Cx5EmVfcvvC2TMGg2PE1mzk5n", - "ed25519:CwvFG636dE7Y6ryYR483aDBH1vRNZbdR1ui4rz8TkFzSpmEAVzQ2ksfzQNxRgunLgG4ALm3XrXpPhTvUTVbUaRX", - "ed25519:4ZdqT5fbAAx4vWjb6dKJTwfsEbavAE7KV3QPGgnLq2mZozFLEdaG9wVaRRdjtriyLFq11qsW9mLjc89PC8msgFmf" - ], - "block_merkle_root": "G5QHBQ8qV2s65Ua7hEbChRggEZdMAuGQEWLcwJsHu6Hp", - "block_ordinal": 76633912, - "challenges_result": [], - "challenges_root": "11111111111111111111111111111111", - "chunk_headers_root": "5nRBSR5hqjQucDmP6xDT3fr3QWen96aWnq8jXAGNpnug", - "chunk_mask": [ - true, - true, - true, - true - ], - "chunk_receipts_root": "UBpXxifFY7Z4LE5UFB4x5tWYquiKHSCc9VqTLuNAWUf", - "chunk_tx_root": "F2chGkeJdCh7J4HYchAJV1Ku3TFk12RZKyC9TpYEGgz", - "chunks_included": 4, - "epoch_id": "FhmQexFCMWUBxNCWKgEKwvPbSWA4ccGMqJ7S5uTAdYYp", - "epoch_sync_data_hash": null, - "gas_price": "100000000", - "hash": "7xxCpbHg44N1jDw25MBqR5JuLCPBzzPenJS18jFmfyFd", - "height": 86673090, - "last_ds_final_block": "7aLAqDbJtwYQTVJz8xHTcRUgTYDGcYGkBptPCNXBrpSA", - "last_final_block": "8nnk9KLfnBdFbMeCSWHB2eEdZ1B7BcAzUxuX7Hcx1ZS2", - "latest_protocol_version": 58, - "next_bp_hash": "GjQ77x2L8jPUFa3Gfr5ASMrQ8d9jvQAQtmz4nSjxEibC", - "next_epoch_id": "5h3PDeeRRQjgyNvzbKepLcBJT3jWJdhu662LzfJGC8ub", - "outcome_root": "8cmecZJqqg6YE9fijMQaPqUreHp97ToB8r5kCn1MmKJ1", - "prev_hash": "7aLAqDbJtwYQTVJz8xHTcRUgTYDGcYGkBptPCNXBrpSA", - "prev_height": 86673089, - "prev_state_root": "FozYhU86PJriD5jz7sq1EZTdewUxsyxa4Raftk8t8h9S", - "random_value": "D1tx6xhfAR4cf5UMsrVou8Bb2FMc9JrfswrHs4kwawu7", - "rent_paid": "0", - "signature": "ed25519:2SHXz3ygwZGtzr6k8pmjZ68Pti2J72ChyF6tE4ftcVCYKqm1sTxBjnQsb6a5NrTjEfZtFoYkN1MHL9EGqwsMLEPy", - "timestamp": 1678091174831592651, - "timestamp_nanosec": "1678091174831592651", - "total_supply": "1123870259780195549872917842454102", - "validator_proposals": [], - "validator_reward": "0" -} \ No newline at end of file diff --git a/fixtures/86673091.json b/fixtures/86673091.json deleted file mode 100644 index 1eb2fb3..0000000 --- a/fixtures/86673091.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "approvals": [ - "ed25519:4hysQKrXdSAECK3NHuPCmSDwvWrxsjwu8sT4eDwuNSpHp7h2bfiPR7XdrcuyK87oPCUEoaKDjZx296VWJL888qmk", - null, - null, - "ed25519:5CuD2zeN5iQ2KWQGfafm6p37STZeVR7cHsgw3JxT52wpTkBzz8X3PjM9Bf2zSt46y5Aj5KGY2i1U5ocSBu71affo", - null, - "ed25519:2jdpy3KL2WNRUssWHLDkS1Ys7RVn3YZUkqHdL34XZs2sYB3HKDBeUGsFQqTB8UdLfDkHFvqeHvBydXVdxLWVSCsW", - null, - "ed25519:4ts2v9hQrqF8rJM3coooXVb8rs5sRxYRu3FXFucEHXX68MBbch8MLmYkRfa3ovTnziob6WvdgsdwroCWnF2NfaRJ", - null, - null, - "ed25519:3j2eobWVUr1G4VmFYSRynWt7a7jJhoMcWrYaAZBSGBxguSkEQ6KXKVjsFrxgKUQm5bbdBEn5XM99ugKhj9mmiysg", - "ed25519:3ExbRqni8qpT4vLnP6RLy8d9FcawgCfh3AsQrpBMT9LAhNTYGXQD22rAvd2Np22RkuTLSozK9kY3TEUiMXL8d5Jv", - "ed25519:4iSqA2tzF5WRRAJB7Bv8EFDU45Gk6krwkV21PvK4VfrMAx6s6389R3V2dEnYR4J1jNUnxXydrMkVhxmPwxRkbnJX", - "ed25519:4J8DARPsFEB5jnFqQDs9vaG4ZuVYSnZPv4kjyNoUXUkEWhuChXx2wgNZ7gqvMBcTMmR3wbmQRtHeW8KL19VMbRRn", - "ed25519:g3LuNHiyXVCv4BMrV8hPsJHUgBDqDfR1NgXE8Q1a1n739rWB61mT4E2WvGXL5RLA479gDpXD7TA9EwGdQHdiSKB", - "ed25519:4Rsp9sVTDyT2qJJyb2ZiHTqsjTRtpoEcVyE9vAC85Q7BfpKKvy9bH4cGcy42ytZBzXsXVNrgbcgCsokLpsHe4pjZ", - "ed25519:Ypypt69K5GasxXTHhMosEVSH1bf4mn8N4MPMwd9Moq6Ht6Qxbbag9Xhpavw8W5jmLDQwLoickSMreRTqDk84kKV", - "ed25519:c95VXgwgWmbocVzChZKfoY1A63EqRB3HDXSDVQp8JQKNCUobmovV57eKDTQMdVLvT5MiLRSsL19EujRdQYmBGRJ", - null, - "ed25519:3S6rvsx92WJkAJ6n4zEHrRu4AFhwxr4yy52tRbjxLysiGcpSQQMGfxHyLKFmmHBVt3Aqz77nwoosU5YAwSbwafCp", - "ed25519:5ddswmCSUMVQyXo1pGAFfJEM7WRGPVW5NJbFSJs7ncjB9jYKvKQAVsDGnx2wPUw1wUngRLKMg3RgNEJZM6JXb7Pj", - "ed25519:3gE4uHPKhJa58w9vRkzW3A2eQ2PTmyPCzgKmXNbFAiSHCdzsE8Bmi1oMLaXUmXmSEBaSQrhLNAayb9YJXEEYCYfF", - "ed25519:4CxDAGhMRrs77qKKXbWtXJncCKM9LpHVacSWLFwgyebV1eyicobUJsC1y45DpKweqXhxVfZXsuEBh24nvadM23Tm", - "ed25519:5sthkhdHNyS449bZ7KFBtCUFbsKxMWVvftwMB81HauNsrEkd3bjq94bqVUWEym1rUPEWR27H8R51WT9Ua2qsxDNS", - "ed25519:2BNuCAQ2cVpCmQ34BkKJvkKb6VPzFDm6q3L4aKurqxbkYbdR1nsH4UhE3EWC2n8Z2GGWizAGKyB5v1MsjhxNvpeE", - "ed25519:3KWeztXE9ziBeLSTQxToLTMfaA4R2jE6AVEpa53FbgxXwcP3KrtveHr5gqeGHiBCKPUc8s4b7hcTHjBK8RW7ArD4", - "ed25519:uAvRRQ1y9YKcqGtBWPuC2W4tHpEXgxpE7pYLURW7Kbxw2mu2dMUSYR4tJi885icP5Cx7AXWoSYE4Yv6Ug4Wg9bt", - "ed25519:5iY5ynmnJZ57LQ5yWxo717bLuSPkt3PuTwuYX9BwXGUcwVsa5bVTRrLs8zvZ2izJyTZugpjmH5ahdELHFJGfgQWW", - "ed25519:5tESvw7wPHPMAhiqty48J3h2fbVwYumMWyFiF6dZR5kvPd8cX7gfXeHMzntdjAxnqQAhUwQyjhPq2VfNCE9Rd9A5", - "ed25519:5CbG2TBqVGHK1H4curT63LCQ4FA6ENM8knS1aV28bQnmZKSaMjat4oGzz4D6V2CX2efwV2nZcNJAPJerSWiHSz4M", - "ed25519:34fF4fQRBVbtvQ56Vm6XRBcyYvMu8z6LrzNWrz2BHEs3dqMyv3fzJMKTNRjm7xuWGer4hciiszj141BuXB7RwAW7", - "ed25519:f3RoSCoQmXpZxVbWs6tPFgjaCXf82DnNoxgze8G183QjXVjZ1iCbwkP15YtrCkQQxSJo8S1nX48FaFwuRexrktw", - null, - "ed25519:21kyxM8TvaBc6PVWW2NSDVmirU98C4CZ4QdfTihwoKbVTnRU74jeMSttVTwtZGxqXVKJeTJ6QSizfkqxGAQFmyZ3", - "ed25519:2aMS6n4KHnrc8mfqQ5KBLVrJeM1huoWuWJW14DSvYTCjY3tBCLM2Xd92xVYaHyfo4oavMaLoVkZysXubo1L7W2PV", - null, - "ed25519:2W2juNiwbhqmxEDXQw4vPVkPufjMpJDUxGEZeKKV4V6bTtyB8mSzrXLEtKsUz4kYv9famJanDNpdJ1f9qWYELD9c", - "ed25519:5PxLWkJ9LbxNoWx81JrkFh4cqYn7FnHt6rVgMrAA6D4iE4DTSdDVJ5yPGa86W9JkmJ99xQU8f3J4RoUhs753rM7Q", - "ed25519:3qiLRz5aKjrsQSADnQ4rMoe51JwPU7bB1MEu8mvzQPLL7B1tkHVw9dBbiSJH9RE8679SYejqLH8Kv4NSkU7H7JCz", - "ed25519:52C8YkYN6mrp2ptMszbt7y7qpYAPuMooaU7AtiAPkidMLm6QsuZRDcZbcpBjfRrETS9f7AW2yrRBajjRkVbEq7AG", - "ed25519:3vWHfV5mmTG1sDWgJFiAsguo2tEb9qKFREKHABE5zgibG4smpboqBMGaxw2MZaAisfRNsXiaRX9WXHjvkqWv7DGC", - null, - "ed25519:c95VXgwgWmbocVzChZKfoY1A63EqRB3HDXSDVQp8JQKNCUobmovV57eKDTQMdVLvT5MiLRSsL19EujRdQYmBGRJ", - "ed25519:5i9S2Nsf2Wt3TMYG1smGDGcLuKhHUPr5ChecTrpBoeXHBAiQmMGdgR6RTvv5dFb35yAwKCqAaPMjGBHw7SkJghhH", - "ed25519:3afcUWK31nMf473tcKxZFMsmgwqb8sRySVwhsaY96KfvnbUXoQ1tBfsYKmemk8tRm6jpXbu7CqXmXPeKZpLCRnH5", - "ed25519:5QUTsptQa3yeBwfeyWnDNAUuEYFsQ2aa4CEhgPNEXxUqppDuHq287WnZARab3jTYdwoZu51UCU2UEEG1otvhwngF", - "ed25519:3T7uCRr99GtRBaXV7G5Jor9BQNRxMKvHvyBJWdrmbf5JtTJvTHkpRLKadcwsLSDJBx6QNYarovUCZ3M8fDodA4UH", - null, - "ed25519:2KpvvQHT4Mp2AwYijNfg4L6xo1V5VVXpBM24Ji8uAX1w5vsJ4nVdKT3Wi53YaWDheGqMRnUGs6tZjNx1XMza5wvW", - "ed25519:TQWc2qTfGP4mr831aQMGUJfk9QPpN2Whzgcq6zsSracTfuWnMQsUNVw8uVoCev9RBRXSf4HEwvAGHdc7heocF3W", - "ed25519:5mVvpNs8HYmB3WbR5GZQQsL9yG1jePTUCr9ZSkLNnYryHLcNwvXdPBtXYEXks1KsiduLznAhxTexv7q8nPTgf6y3", - null, - "ed25519:5RvkF1rmhFFg31VR8ESEAVELPAioU8Nnp8nUSsEMW7KQbixdoRX5X2XtWWyYbJCCQ4QthHH3WUZfgCFCpUfBYUDL", - "ed25519:4wDac2ivB1Gd4NtZStuoodGwmKWYhmnzLNJbdGF9Jy9GNZwKzzNmSmcSxKNx3eg3YNP3S9uJJ6JrnGJzwvs6sZJ8", - "ed25519:YR5zSdpbEeFjU15QjSy3WY74LuhcM9wm4M1ifB7nnj5jSXhhn2LyRTSMPknzWV3VW3djQtC264A9az7y3BS7db6", - null, - null, - "ed25519:4q4m9bGKT6TqjzQzDEswZ6w7SyDxiXYFPupkxwnyHtoeWbo42wrJGaeQt49NiUYpmE6cRi4cBsBRQHbJq6LBdex4", - null, - "ed25519:5xYkBJg45NvdYMj35o22Sryvwzwyhsvhvs4reJAtQgg6QuDyzsKHnLeJxrmEZGqckfaMuosXX9tmLoxJx3NAp71n", - "ed25519:4nu9xHDiGhaXqvLri9vp7HKsJ4D4MyvDL5397StAikHHukUsYDyGtgFQXnDFqpP2xddn9TzT9cQpk4rqeM6dpMqR", - "ed25519:4mxMj1Qqn79zbzb73uSzpYUVYqJ18qVF73goJj38xyt1v3iodBSuQPDUJZtotvxrfMs5FW6d5XyiwEjq848tvbU6", - null, - "ed25519:5Cm3Tuvr5ohbFSUXppjpTNWJEMg5fbzSTxsk4FqEtfFWAA6XmAW4YQehGFNXpEAcyLhUVYT7ZxjrYT6S1AhqnZQH", - "ed25519:3WyLX7a1sJoK3dD9VTpWnG5ofLcS7exgbwn7qAL7hQi8vfkxz8cMGzNpKeBt2NK1GS6RBag1i6KwN4GvpsLvJbBk", - "ed25519:2uPo4wBBeiaHZeW3zjjGjGK1FXC8Jxjx8VcucaJi5RveX249cFytx1cdZbwVh51JTTEXpYywp2R6JsFdPbkxqYZc", - "ed25519:3bR9RPz2fshcFDkT8CAjPgEUr2kDorKgFMyektyJ6Nvo4aN6tm3Qa5EZWAkYHKPNcVJzTJesBbUJAqguJgSzMkeH", - "ed25519:44MqDDL7zCQcw34PbAsxcqMSDqvLJWCNJQVPXWnKtYPGevo4mLYGjXqBHsGE2nLrL4YHxB64xUoggXvL3aCpUbNp", - "ed25519:3uCcg7NVpwRM2PKFj7eRDA3AjpWaW42Uk6M2J5fco3u1rV26nQBWWCQoxHJ3Ntza9nryveg6PkdieUipXMqWuUna", - "ed25519:3XFgvty9UsA8Ub8GkSXRB3WFwV5VQKebyECcqxKufF33CcbwZAv1k6E8KrPq43sSZD4njhoBbja6FYkxRttuGLEq", - "ed25519:3Dzmufoqbys381YscGu4gMg1VzEe1Mm298UcbYkTeJ2hbt5eJFYoquRzFfArZGahREPd3dL2pBTBp1sH9BHqQQWc", - "ed25519:4pewSif5ikGsWFs35hPVEENSxNU516GpXR8JjCnMyKC2wKeYaDz51dL5gU73tSB8HFChRpkrRWdxt7erL1nRLM5r", - "ed25519:5LnSKtHjiY8Vuzzhk2MXmLuyScpgqRFxGes1E1C4AnF3jLbhgmpK6umpW2JkS3L5TkuoTdkhMXnHFXQ3KS2mB8Hu", - "ed25519:54SZrQDqCPUbshL1XaB9JdWhtg2pXPjkbawzB2y9U2Pts6TYQHKanWyLhX2SWzPWPc2xFrAhXewqtdBJPHieSBpZ", - "ed25519:hjf3sWxwnGXiihxs9fDu52JnaBDy9d8bAZKKVMyAqtmnAK9FWSUMqHrZbYBKwLSMxoDHSTGk8F5PiAADLDZMYB1", - "ed25519:2nXfeF4BaeAHBx4NWEuPeJmtNAfSbg4Py97YiYt1Ku5uLSwoHQ3WpL9xCaiJfayEm3Bgz8GjAexPuTwevUGPEmHx", - "ed25519:2Wa2msRqAJ8eLewtDe9VFW4GR6wqJwZdG5n6wu7kqc3WzFkVfRtxEqLhHqVkA2egrqnZGaVzLTFSrkPmCoe2GudD", - "ed25519:39FsJJYaef8ui8bNbS7qaR3J6TE6798rqmhbJQETnwf5MXTRhKXwEC778YyaGB7miCAX7sGckRfLEhUhDjxPVMxV", - "ed25519:2W77QFnaUhzLBePkV4o1sezzPKNsGfo5dpueerMgiskiNfGvw7zJzLJBfgcdSMaC9vjJ5L7DFttzGWRg5DSKBBBD", - "ed25519:65YTygrJPtQYqueWoTUJfhchhBSpNEqHLFDxNbdoCQx7nTVzdRfjnDVhrohxL7qvYPH8tJ8g84MM13gADJ5haAsA", - "ed25519:4o3ZcT51drAAZAhFChSdr6c53U2Pv1nsjYt8mfzSJgRe7PjC9wPq8g14obzTR4ZPdsZuJQYMSQ7iDCZJb2nMLfcn", - "ed25519:3abrD5Lit9FC6ytmuqrmmTNrHypKrwCV3PoDhZAk5rNfFB3DhFS6jy1qj6Ladf4xmsGpGfLdXiqSm8pz1S32gAqw", - "ed25519:3Qn5w7zL3nQfbkUsvWqFkmPDBrizGouiHVnsPKqdboyMbw7YD3iuuABm82gLcXMptTvyFj4MiX5Msv4YppaFq98D", - "ed25519:EfPkfJFzLT6PbmVkJUTGfNMaSerKofUgz2a885WEV2mafB6WppADgFsDU5DPWsEU2UTZumuugNcYZC2Gdhx199h", - "ed25519:5Kz4oHu8GXb2xYEJ3cSHbM4hJskwyDYvka9Ct1xfS2KyrM8T4pCVQuzSCr9X8fCHtTw1FW4hFqx9FkU4w9u23xBm", - "ed25519:3SusMpwVsRy3zgk6QqCwtMLYZ7dkfKQBq9vn8AFfthiq4hpwVgppV6Q72PZaFXy5ryiDq2GR62BzigGjFBAyt9dg", - "ed25519:ToZE9XE5ShD6xvfk6gzHz4Su3MPq65vZtGhJ31HA6J34BspzhePtPLVLqzrKZvNWPcktwce9dZprqC4WJrC9KdF", - "ed25519:1EzjmHrNj9n7SDwDN7GccPp4X1sqZbde58TmLKtENofKVJ8nzkb9sxTLjwxRwuwRjWHt9DqZtLFivS3uQFup33m", - null, - "ed25519:2QWTEnujbuMdjyaN6aJjWZmoad7acqZ3GxZvuVNwMkVXBaTi3f8v7aaL4cdDZKvxHKLr7u9c1bpSxFcCzDnsHnBm", - "ed25519:Z2XaUQL2iABhf7jmfAJFos7hGAj891VwgAvCL5Fxtdy7miAAdmX2R1GBEG3YcytjZ3VxnDopReqddWm5PhRGeea", - "ed25519:2v7gzqt9djYH1jKLrwaza1jHHTJuUY8NX6Cwmeyj4cXYsc5RfSyBaczYUtxhBm6q6juMmUP5ZHX98CHuxw1ojrWa", - "ed25519:8RGcVPkJpUrWYSzzTr2aCNZvQGNCZ3Aw1HsRru9gSxwXHgcWKX3a89Tkq8XWyowrjGznYj5qVvcXcozXyrECSUx", - "ed25519:2X12WxxvUV1VgZcGCCLQygtK5ws9X637FyqYdZeVyMFjYkGwGFpcagdynW72VEZCbkWUW6QVcSnjgGygLk7YWBr8", - "ed25519:2XnPPTtGyygK6eDeDGiobaFyviWiWMK4ZeSNgJGDM9mmbDPB9JVjMDArZXsG1AxC8BZYoPEbksPkYMfLDqXe9EXT", - null, - "ed25519:W3nonS16Nr7ZwWCz31FLhGDAR5CsB8ugMT1WhRWCGv36187mcGZ7jPq35LD9gqNBJtY7sbipML2wCjpxtK97cKJ", - "ed25519:63nseD8cntHbP9ccPX3BErFECdnhWxGVkkr2EARDGUv62FQt1gH4UzTescV1RafQkdqPqVnVfuHdAmZnQMeydHgq", - "ed25519:5ZiwsuF9DadRmM355pudc758PqZFsfzm68RykBs3QCiDnWdF9o5vHJXYjtz6QEarxfVdnZZbKDMmb98Wd96PWnS8", - "ed25519:4mA73TyiTh8T984rt61aYSKCW3v4Agspxw1RtWPuLYwWQaKRT93b4zfvmLDRDY5AuhHKr3WFHE1aq2ofJKkJkMoc" - ], - "block_merkle_root": "yU3gW8PUfzyp4newC1Nw2PtYCaKuojHfG98LU49UKK6", - "block_ordinal": 76633913, - "challenges_result": [], - "challenges_root": "11111111111111111111111111111111", - "chunk_headers_root": "6Eesz6jrDdrUnjHY61Ywm5kZaj2bMvYGbWbCheVVSQ1W", - "chunk_mask": [ - true, - true, - true, - true - ], - "chunk_receipts_root": "DryDrLqJ3a4WhT7CHcaSKwnPbmPFtXkV6osxnNYWfcd6", - "chunk_tx_root": "8AKwCFpihT61nmj8bRHJUiCczJqe9oTw7B1QkiTiJ9W3", - "chunks_included": 4, - "epoch_id": "FhmQexFCMWUBxNCWKgEKwvPbSWA4ccGMqJ7S5uTAdYYp", - "epoch_sync_data_hash": null, - "gas_price": "100000000", - "hash": "64Ho8BgxGx7UuDsjXNbzLVt4kvVkxzt1bThCJb6e9qaq", - "height": 86673091, - "last_ds_final_block": "7xxCpbHg44N1jDw25MBqR5JuLCPBzzPenJS18jFmfyFd", - "last_final_block": "7aLAqDbJtwYQTVJz8xHTcRUgTYDGcYGkBptPCNXBrpSA", - "latest_protocol_version": 58, - "next_bp_hash": "GjQ77x2L8jPUFa3Gfr5ASMrQ8d9jvQAQtmz4nSjxEibC", - "next_epoch_id": "5h3PDeeRRQjgyNvzbKepLcBJT3jWJdhu662LzfJGC8ub", - "outcome_root": "EWmBduehGYj5diH8X7R6fC4ZFDyNUjH9Z3VUvPGLB317", - "prev_hash": "7xxCpbHg44N1jDw25MBqR5JuLCPBzzPenJS18jFmfyFd", - "prev_height": 86673090, - "prev_state_root": "A997vSvhkrTRsKRHnNvQV415Lp4BNBfAeoVBkRLwWafx", - "random_value": "46yc2RXFHjxjAz3ioW3NpoFoqmUNP5Kae5ywDDJ8ccnW", - "rent_paid": "0", - "signature": "ed25519:3EZgjArnbaJK7taUjaW7eZJjF7yNSyScjgxipnwLpVGjgSPFz1w5ptbtFXFZAvpP6s2uVqLGPmcpRcTu4JhfwNaJ", - "timestamp": 1678091176086673765, - "timestamp_nanosec": "1678091176086673765", - "total_supply": "1123870259776647285084581742454102", - "validator_proposals": [], - "validator_reward": "0" -} \ No newline at end of file diff --git a/fixtures/86673092.json b/fixtures/86673092.json deleted file mode 100644 index 99a7a67..0000000 --- a/fixtures/86673092.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "approvals": [ - "ed25519:67jvTS1VLidWiK3umjgkEMxnDaRzqVyaR6125eR8rKzSM7d1Bz5HV57cZFCEAtNaQ8pMtvBVGSSPQfxDMUbFo8zG", - null, - "ed25519:3hLHGgk7NFefLd6GutPje32o4xJvFUKbcBkfMB5h2yyKrZ5NCZm9LZ7qbR3GBqHdkkvWqtpUrDD6ma53JFWFFaUQ", - null, - "ed25519:32uV6fiDDAZQsvVK2AnfLUnP6NEFZk6XvBYzWFGBbf7ZFxg9mjyihgPoiQfAxzWdc8CxugjpCd5wDskSMsaEhC2E", - "ed25519:uzwMPcNXRrbxbX23M2qqJX2U1zEKoi2G9hzoWsLRFRqUhXrk511vyYJYR5AQrCznSFEJ2R5JQ1qiRp1wB5DAsbk", - "ed25519:51dTeJn72inchPEZzvgKbhTPyfddRkXyYZELJ67CzcgDQ3d5ug9pyuzny7dH2DVortn56wDrBfTHkexb5aHJmb5b", - "ed25519:2KZPoVcPBU3LKUzVrp9MxgvvbDEWFMWWDft1YmgsuEEKJT4qe895SYsM1jV5mBqzHnUzW5TUB5epUSDMLMd1NAoG", - null, - null, - "ed25519:4XHrP3JEvjkKPxpg4MmoXxEX7BspusUDA7gx72ViZWcRRjcLEb6xxikiJ9sPpXLkH5FkvWmvEZaYiqf85irGyUHE", - null, - "ed25519:8f1vj9P5S5RbChKCDxJH92EfKsMXUaKPiFa8unsEj3jnYygp8p56ztTCwnyhjbV52E7wS9ZvShJhSvWNQqJ5vtR", - "ed25519:3CKdu2rHSF2V9mP8oHX8VhwNaySY666xnwxoCd8eQ3AHbRYpUD4fj7USxpGHEAoZ443v6iBGzYFHYeZio1b3nwTf", - "ed25519:FYbTT88qkKcMpNUkEam8q5gWa8AoCAqQdCrjugRieHDnWpCXuSNT3d63DTu4LwpTmHcUDTA3rib5YovuEtDxnF9", - null, - "ed25519:4wGmkyNVrpDGaJXkVndR7jNMsUEaN9Sg3HK28eWFfwMeTFoyaMNGdoVmKd2fjbffR63Ue71siJKKtRGAia4ysqwb", - "ed25519:674aMxrWw9p4GZ3Tem2YG5s4Lhtru4mbxfZJkni4hLFvXCmQdtP3p6JzeGSSPnZAte7gom6PVicep1W75XTUTBcs", - "ed25519:41fPj6hoPEPLWBToLPRyNybmMoQbChU16LrpAd2o5RpCsRvVDNE4mnybnV3UHjvnZsFqoKPSA5DqB97E7EwoJZP4", - "ed25519:4nimS82UDzWww6tNihUL9swnbgp5RA9e3ki9LhpBuuqwVE6m22AbHdKrUMP7XuNCsD1MKGapYtmz4bh3USeND85D", - "ed25519:ijZYoszPyTxLDmzREKVTggoc3DXoVhDDroiCsccXTqvvipGYeUMRTqa6BH5A4GVRaUNSGsVuZrbf7HZK4VubAuf", - "ed25519:dtwsdGwh4tWNmTye3r7U8vsr3111P41ZZntMs5t8niifuxnH6HFfE2HnNw2tVzafLKjRE3uWMraby2GqqDuNjhE", - "ed25519:3SAdKNPnMG8X9W2fj9Ba5hkWn7p8RdhCc2fqP1bqa7A5RoizVGdmjPV7jaWpG7xjWHdezkJEepg3MCDxEmxESPFq", - "ed25519:2WgfVSsDkhjECtjYQPqLKEewe2eain7QCNYuMc5cByMoKvXq84TQw9DoZVGLMvYVMFvzbaUNYujpJdzT8JVgtNG4", - "ed25519:9fpfGMjUeC3DGiSnWjpDR3vRogGgT9KjnbcqGFtuGyM79fzTbjv7JBys5tH1kwug7wrcNqMfJj38BuoTxzCgy18", - "ed25519:5ecUnCj92L6NimcPGNCKEiK3bbXuv9gukjTsBhMtt2g7bdPnKotPPvKAqoLELsGanW9kUaZzpXbfHv8ptcMrdAZN", - "ed25519:3xraBpfFWCsWKjvsQMGvjzXrgbzpH5jfiXNDPGphkUCEVk8JsS9JWHiSr5SUnUvyfqcocP11SdCjQ4ahh7GeQSfX", - "ed25519:xn5PdDTveG3GometDA9JaZ7znnc4766a2ieTqa55S9kNwxsS9tUxfhagbQLNfC9pU1FQVrof1hEhK8mvfpuZ2nJ", - "ed25519:aoUsJG1X1oZPqVrYiAb2Mz6BiPCADJEzCKdaWpfPFAqgNxtTtPSJRB9WpHqH8iZ3wiqpr79rsqBYuXD7Y5R7Sg3", - "ed25519:4QnpQNystBLrpnJN66qD5GKXdBfHyv8sKXgVEd35nv7TwUk1nYfahy3HnvzL7tL2ZKfy31D9iv1kEKyUATTqMTmF", - "ed25519:3QUnnCQy5CwKNMdbn1nCYLyUd9b97FkfbPh3JajGjVHdrKeEpFecHTULSyCEU9tCLkpUCBdHZVYyckUtRhDRiL9g", - "ed25519:DGFgVg7DB9RbnDjqkoJQiJXXZwT7jdmTTkq256sToHXmzfbxQUZTjxkqRyHzKe8Sifkg8sYfWeaJbWG3RytVcCH", - "ed25519:5PiYmJAcF3TJ5FSUjJkesoTszdf9JdS7Q4P7Cj8yFLdB1pGHbDEAqZUaqFUSMBQRK5uWpPwzxQjdQ1NbqidMwoYR", - "ed25519:2KPKquRAgKjHdXUu11G4y8RwNwA8s1JMML4Bb893d9M5Guz13W2riVvVJUVwNHuajcGnGSLGhyyogTZZWYqsd4WB", - "ed25519:4uACLwWif3CXfjgZDabKCFtHHjTfSB97wrt1UegDY6h3wp69qZt9bCGLGVusUZBy42agjchNfwGNsBnVWgvdoJfs", - null, - "ed25519:3qCXS6qVfUaWMTc6CCXTR8BicsBxXhnvPGKNmE1JxKJhZguzKoaraZGSBoinHsWoudcdXjW2jxwNxRip7ShaAy2q", - "ed25519:4iN55QxwCYo4xjRtXVdyyRtWQzyKpYrEUtt58wjyYSRQc2be12WRjpqghZ4DTSssipVCibkyvb9tRf6CMVWE1Qpo", - "ed25519:2eCUMouC6eKCmxQvmYJmE28zyPmxqctVXAZwtUP8jMEg5b4MudcthP2aruMM2nRc1vqtkQXic1WgDTrWxM3YkgEz", - "ed25519:rKTS3yHaFEbeBn4J3cJh42dSEk6dsrKb83kUH1SKewJJWGF3eh7jHpYTTLkKS593P6oRsxazGgab4fC4mEhhwA7", - null, - null, - "ed25519:674aMxrWw9p4GZ3Tem2YG5s4Lhtru4mbxfZJkni4hLFvXCmQdtP3p6JzeGSSPnZAte7gom6PVicep1W75XTUTBcs", - "ed25519:2vnWtSxSkjCcL4qnaJ4EyEZxHhFUGsXcBsDxVfB3vGv1W1MGUahsRhHrHwCu6AouKqDM7wCsbatRbdVfFYgQXd4B", - "ed25519:65F6CLzh8HDxfAWrJT1KCmBp3dgLCV38QmKKqnX9H2pBBaVKa3cWRQLRRQaQtf8ERWCZxaqX3Fh2vCnBzkwCxRiM", - null, - "ed25519:itVkGX7rUD27iJqmmGDYFiZ6gPuSHrLKYSxtQgzoqFXuvzDTuhxYk2kjx4TuawFYLAzS1YNiRcQFvvCZajgVztm", - null, - "ed25519:67HZNjz32erMZwM3sKprZrC6iszp2uiuCHm7CYjVGkaCz3bMG7FtoB446zndxu5DqNQ7ruUznFpPXzNxWVc2aiWP", - "ed25519:3oTRFvvM2ac5HoJsCZjy8NJcfbT6aDZXex1qw1ekgXwoctEVkfPZkfkuYh1bDhRzidkHbDbk52AW9froYXSBrkmb", - "ed25519:2qtD3LZzYKM9fiMSCC8i3njrN8hFR5X75K6kQBSU5gJwG3bzLUgsPf65T66Ds5CUHufqX2iuqFqf1DipbYVy69wV", - null, - "ed25519:5EMM4zvAR4rrGAekZrzf4p2LfBLxqStGLn7hnyvY1gUZsvDybD6YZ7YjhBJVp9ufoagJUUQf6gftVvwmjVydYSBp", - "ed25519:2c1w892NbprjmtoRm3cJ2BxqQQGbWTqk5Px1T4Fetyni1xCbF7BpBAQkzsCBbFiGmKxRqnbouyHpQ39gdiciTEid", - "ed25519:3BWQs4xUUQe4fhJspLEQn9mBP28RieeGbACr8jcuheNDuuJuNPZPXtCjzYLGQG7qLDyQhkULC8gqoqXV2VfhZSu1", - "ed25519:5ZLgqG7z59kiWm1hzqmwnkKUcrTHNRUSfksLvDrgoExipKZ53umLDiXA2brf95jXubpCSVBMhswQ6BXNpYThw9Bu", - "ed25519:5PASfeTezoVd39cVdCVErNR68iJMF2HyGWJVRnfn7mATzkE27NSG3Cwz98h1wiqWNeNC2uUhrFr6dUDLHiyrdjAh", - "ed25519:4cdetD1Qk9vySK9fsdaaJ1Xm5jHaLpK17TrhWi9pSUeLyD6VYsh62TahKiahiWxo9bApYeatBEzEEGMb9ioaCjnn", - "ed25519:3BFggZLovnT5BCLYV3NvZaEQq7EJQMq6sbKv2CpgzwqT5tTHppDGrcVH94LcLVroPQqe6kbjnqaL9fFYiXq6b9nS", - "ed25519:2JpscRk1K6pmseRabg7RL5cwLnWhyXhUHeHKroJ2rTh2XajoyNTZhVDimD2LdGYweAgkHCFxoZSeb9ZWdTDpjRKT", - "ed25519:2NLfzwv8JpxvtBivd5ZRjjbZq4yfGFaivgwE5X3dFq71WVrg6vQRatrhM3yRHcpvrCFX4razw78JPBrcmn64MELr", - "ed25519:4JG1vnuxfzM1VDb7TSDrKprGJxeujEdqM7upugfpDiGaTP11ZmeHDS4zV5925pTWAjayD2g9XBCmFGg4SdELkZcR", - "ed25519:4qaUoRp7iw9Vd6VmV6WHi59HJBqk7XHBBYZDQz6vmUoooY1FJEs5qHUGYi9kPZpD8fzzdmPy8QYqpuSARCp6x2DV", - "ed25519:5pxGScNn8SddtRSepfTMnLQEzoVFWtSxbDzzLzJj9cpoY29LqtSaj6Rk633STexpM5Q7CumcvDNQVtLz43Nvs1k4", - null, - "ed25519:57sCrjR3QCHsdvfRzAwnEc74agcbusFtu9faL89181A9gUkAfhr82FASjGSdKpgYATLnxxtHWboWNELiCvskJsf8", - "ed25519:5ZGPE86zBZydmjisq8EKnZSR1duj1i1YXK59Hy38zkHEoiZ7jsCNda5Lo3t6b3hHv2kUenPcQjGUphv5KLrPZLjX", - null, - "ed25519:4Rf3nnn4WmCVAAya5x3oJFiyQHQ3WppHqEaeR4JdvaMMUH1ciZbb4MQ5T74ercQHUseHAn4e12MgqEvc94DZr9PC", - "ed25519:jcGkm13ikyd1pZNxTiWKoh7zc4w9vQYrXZFuRQcdz5HQ7uKcT2W66xw4yunnZJ2uXjQtHkFKnRCfFXgQrgpofZj", - "ed25519:2v2NC6HbvKqw6av2J5iCv2Uxh36tQB9sQPFWounE9zWpHAhb86onsBE6pceK8dBuGAGQ8YxoYyVeBRjHhQ72LyCb", - "ed25519:3DuxX6ypfgc3nSWrZy9oaBHygR5x8WYrwbPgXrNWKvYS2K3zLPnYPu4FqxnmZnM6AsseEHR675Fvg8NWB1B6uqt7", - "ed25519:4j2KCjvytZujGeLHDdxGSmcYWu5EopetH3UBH7XbsEcfHM36gtStBKnq6mfdu4BKVr6UD4iUsiHqpxrs28TcQKvo", - "ed25519:5a61EDB8sApuJKL6Rbe9XmtYQLMpeMg5ra3wFdduVK8AA6LbA7ZwpNHmc5nQ4ojbT9kbLEt15u3MBM2ap9RWvXdG", - "ed25519:2Wn4tFdk7vsswWYnXizp6GtAV3LRy1CKToN4x1T7KcdJSoECxxCanVuaPkf38gRahdNbkXJ4wJnft4exMV4yBeDh", - "ed25519:481GQ9h7fssDfwMtrcXWvMG4TeaSXczZ8VzxgfNLPbQpWVyGxrrwuudVpNc8MVDpPyKPX4yBWDJBL4YkXjJNLdCR", - "ed25519:5sXQUc719DfTxV4oKiGehWKgZvKo4rCikroUxhrkvEVxgU1Lo4piSHcs7msstveviPhqdtUdaSZaiaJnb4UWwHc2", - "ed25519:2cPFrC5wJH7jsQFEcuH1Vx2eANTTdovLrcscMqyozNGneo8YptkYtDZi2TkroMuGcDsazCneCyKXbAD43QDbfYBS", - "ed25519:x5kSD4ncYMSq6TZoAbugQpiTu6xLUAa3DS4pjLgFPaKnJb6HpxWCHopMPmCvk2hbzCVDMDcfmPmDo7k4giDogtq", - "ed25519:5uByef18CuCdCrfpi1BFFy8dG1aLwfdSzEMnbneMqmD3p2EGcyrCfQP9jH7HKy9Le88E6RsjPRwteq3MRpW7YW9B", - null, - null, - "ed25519:4HFBQuXUf9LakdkLF423jbhmsJNp4QjHtzhsS7YTx7oFxLm9LXTVQErz5PxMsYpcSVWADxqREyq2FN1C1tpbEEqJ", - "ed25519:3NQhhU6ufUoyDba9xptb2koT8JXELpYZZC5ou3fzpmFUBYwmLrs55RCnS2fndZZ2US1VAAGf51RVSrhkrGkmTKaF", - "ed25519:4viSJwbxURVejFXLRPeA6yaT9dS5VSgZatZ9Ru3Dmy1Rv5z9B2qy9JmUXzjuwHCdZ8VZSymzTwNmF67ydZpPsUHJ", - "ed25519:42MbZ9JDpQXqTsYeMBojen8DejrBKW3v3cSRDhbaRqK3xLhDZHCeeE6LSDQDWc1FuBtn5SNq7ZNDSq88ZUqgHWnS", - "ed25519:YqPrEWveHcCTB5atunW5bmHFCxQcZ4y9RFSTZGTtUCYXzHg8SLkGj1eNdqse9QTg5B8EFpEJsKKeXajwW9DP8om", - "ed25519:VCP7jMDSo7Ym2Hr9EQQwu9J5X2Nici6zwb4dCMRoFsWQ4bY5m5N2fC2NfahLhaTupZZjPE5fosUCJ6H7QdcgKNx", - null, - "ed25519:wPZ2njXUSi3QTEBAgKAnN9tAo1kRn9rDqpP8AEFRH5umW5XjMvqJM2b7PtNHG2nCzUxR4sLGhuTvWRzybzC7oyZ", - "ed25519:UGwNpcXTAoAeJN5GW2buzSdjN8ebrBC44Hv2amyo7y9ZqgYyn7TgeapV5WJYDofn4v3Agdx77EQsabkJv96YAuS", - "ed25519:WCst3Th2VX12DVz6KTYa1tjrGyH7xkks4BQtrrGfsZC12KV56vA9QhYtZiHhvgi25rX2wePJ8Y65wN45mvm2Siw", - "ed25519:3N95DirEpPE3YiwbYVy7s1g2rMKFNZTiWFfeC16i5dTeBtA6QwTB5uAudSViT2d7UtMjjL4UMiKuoutQuVVA4uUD", - "ed25519:ZYzjG74yTyGWpEqJSnLZdbA5ke37faAgiesRCfWZN9gz4GDmUFHxfPmS84J6cqhPng9VQgpufJDFJMQcneJYpCX", - "ed25519:G7Kqq2gZRHKL4eQGgCehAA1ZwEktZAo7XbcMdxnvF6QVDNWzGYkiZoyMErFh9dn9AKZXVxEiuVSHci1TjhiMTmx", - null, - "ed25519:3DcT7dHWyNzv5VTAMFuybxVbTKwpoYgLTvEq8mw422pHWg5wdWLo39yHRyuCgE6pjuK7HutCgcH4hXajAqAuGi3T", - "ed25519:3xBqYdR93xDUBqGciGvDbxsZ5tr2hURCsTgKEQAUEA3f49yX7iH8nT6oqxssBJZ8VCivmsTgX43smT1yuHqpP9eh", - null, - "ed25519:U1YGdZtFDm8BHE92m9baWUDt1oFGGTDwzRVd98K93GtafYUnF4UfJ97rkS56PZCuhYC3T9UgcDYo4LGnSU3QaER" - ], - "block_merkle_root": "399L6ovAtXNsNQwdziohUb4u9LJcCCSgUNjG3dFgghfD", - "block_ordinal": 76633914, - "challenges_result": [], - "challenges_root": "11111111111111111111111111111111", - "chunk_headers_root": "CnGLihV6kcFiv3sh9HEPG7HmVbF4F18iAuewFXzCuai2", - "chunk_mask": [ - true, - true, - true, - true - ], - "chunk_receipts_root": "8ac3b7gAbK2R1ZxKEJUd1JnrdHU3jQqALb9AmR1XDC4b", - "chunk_tx_root": "BkA7s42AmLGQwGxq286d5r2SH3Qt9arXxQhK7PeVqJ5M", - "chunks_included": 4, - "epoch_id": "FhmQexFCMWUBxNCWKgEKwvPbSWA4ccGMqJ7S5uTAdYYp", - "epoch_sync_data_hash": null, - "gas_price": "100000000", - "hash": "Doy7Y7aVMgN8YhdAseGBMHNmYoqzWsXszqJ7MFLNMcQ7", - "height": 86673092, - "last_ds_final_block": "64Ho8BgxGx7UuDsjXNbzLVt4kvVkxzt1bThCJb6e9qaq", - "last_final_block": "7xxCpbHg44N1jDw25MBqR5JuLCPBzzPenJS18jFmfyFd", - "latest_protocol_version": 58, - "next_bp_hash": "GjQ77x2L8jPUFa3Gfr5ASMrQ8d9jvQAQtmz4nSjxEibC", - "next_epoch_id": "5h3PDeeRRQjgyNvzbKepLcBJT3jWJdhu662LzfJGC8ub", - "outcome_root": "FWTgtobyEuNjujYoC1NPSLsBqHi9iZCVhvFefZrTbw6c", - "prev_hash": "64Ho8BgxGx7UuDsjXNbzLVt4kvVkxzt1bThCJb6e9qaq", - "prev_height": 86673091, - "prev_state_root": "E2zn3eDHtVWNjzjSLiitA4RTeL9qdyhDNxbqMVH2thJa", - "random_value": "4wDPEBNbGTg8hH2nGpZyTH7EBRN4KquqxGgNS919qMmr", - "rent_paid": "0", - "signature": "ed25519:2FVbjWHr6mSFUpRVF9o7T5WAyGdN634FnTjRmptHCN8MprqgkiVY1PZHjNUjUakDNzxTw7jGPHHsYHxZa21uMUmX", - "timestamp": 1678091177281053676, - "timestamp_nanosec": "1678091177281053676", - "total_supply": "1123870259775456041476524242454102", - "validator_proposals": [], - "validator_reward": "0" -} \ No newline at end of file diff --git a/fixtures/current_epoch.json b/fixtures/current_epoch.json deleted file mode 100644 index 20ecc1d..0000000 --- a/fixtures/current_epoch.json +++ /dev/null @@ -1,721 +0,0 @@ -{ - "approvals_after_next": [ - "ed25519:2VhGGz8cojutZkdWbZ3bUUc4fqVdM6oo3zBtadCfa2HpUw8revjxpbbs4upmF7JFEWgwgfnX8nnDregKLvEjgc7m", - null, - "ed25519:49KmyiPyt5q51xdtDkcQ3ETtyPsUq8ddUWPttNLrnGNKhCwpykaPy8zNhXiFYPQEaZ21SAB5Euo3k7U2kb7mFJcC", - "ed25519:2xvJ1PY4cbZ7DnVoQhX24Bi47ef6z23FByTjK5sbtZYer2W639KUaKSeEVQAs5Jz4jWbCpBGjDNRRgLNUBh8ZUfi", - "ed25519:49dng3dQytReroebX6po1S7y7JmewstX5JdbW2yK5tqzfdAbzyizozfYb3jS7FWpqcbVCU8j7hTep3rAX3xeWRDu", - "ed25519:4Xa1VPFo9WjcFKAFjRmvB4uAGcQVkrVMrgo7vX3MBYr6cDaXCRrKjk4UFzYqGJtD4jvkZrN7CH2LYmKm7QiE9U8s", - "ed25519:5i9irHTS7p1W1tHmi7ANfWfr4Epcn9VHFeNs3Uvq39CknfCW5xf3HnZXfcKMJXW9DX1qCmMU9eTBaYygZ5BZa8tR", - null, - null, - null, - null, - "ed25519:2wnBH5A73zCforWmtYQX2jmjF3DAo8Z3XcxvjFMiGjemYy1KbxLqhCjwfpeN2xB7ZCREEuBE6yriutFvtAvDWZdv", - "ed25519:2B7PqahnewnRz296wDYxpUCeSobM9w2sLYviGubk2h38sEvUWbgBi5Jxvbck9ADMPNEyiYEbetr95Zfv57tjm4fR", - "ed25519:5AWEsgjcn4QstDAdVYCJTTnjEyvCZ25Cp4h6canRJhFDFcUShkRSTBR38XoCKo9Amn7C1JWqVxkgk4wpogXSHcjD", - "ed25519:49efUuXm3BM5XY3HSFSPjtv47w5JuRtg1AGH5ojFtzBTvVsqgEVXpKXi6ZupDxMT26d9g3jyFWqzvis4PTHMD4Jg", - "ed25519:ePPSYDSAK4R1wmQc9HwbCuZd2FYgqRNknkFwREJSaA32sHHPykNoAJza8T1a8GVzHoTJFaaXNF1H5Apvg8ysqFo", - null, - "ed25519:3CqKXCuBtYkvwk5xsRwRCoYFwQeEScCUbJGuZZzn8H1hJkb7eSZAtvouUxVVMaRxyPGZciyFaLhpoX6X6veGbjqa", - "ed25519:4xfsJpdJApuRveVRsdMpuK7mDdx1MP3uL3U3Cnib5J5sQPbUS33MzegaFLr8LcYeUTLsSCT6ycMi4k7eeC4cx2uy", - "ed25519:4HnubxkveyE15tMZNcEDLq5DxxLyFT17XpsMD2jsw5BGUb6qCnTZuG5E8KQuvvbLMNcqnA9vrnhWbd2LxqtghaUs", - null, - "ed25519:562BGk9m5WwT2CruNiKTYJnquQjFadeURRYA97xZ6e4R6Gu19QAYkcryjCePZyS4kEKm2xjefDqpTaSgf2Kaf2VH", - null, - "ed25519:SvdETeddpFKbtHDCrvTnJKnu6SvE2mu1evahcPrf2RmqZK6Cz8dzAMykjvE2fVcxP46M3opovaFZxzc7o7Wt8cP", - "ed25519:2xPkMJbmdTbiXDhZ3R7QNaVL7Gh9qVaSXbon9LaKUg9aVtJZTxTVHXGDLC9rdU5Xkq35UGmzPyqVjULLUawZuGnV", - "ed25519:2oDV64kdMt4a2VuRiTeAoVu8Fpdz5RMs2twSFKYi7D6chBGjHxNrYGtLxhxFAScqDVmxDjUoRK1Dnvdytvtgd2n1", - "ed25519:4gVh6trN6irVVsTQMyQFdE1z2GJcfDuVbwCLz76CRP6UJ1LAB8Lk11TfXeckKy39qrExZjgpUxpfJidXYN7xYGYR", - "ed25519:PDxVou7E2mrxojsX42mL9zv73stcp8TdDAjb1UDT2F4MN8yd4YR7yYpsrK1NRxL2W7osAHyLnE1peWHdqBvzkLs", - "ed25519:4Cah1td6h1zgswNwSNosVicXWbQ38WUjEM782Zm556WWSsSYgjGezYy3vsvkABQuCPorBSHxngPgTYohcSzwo5j7", - null, - "ed25519:2Pm6xG7LvKD9fMEvtSkvMRizPFPP5qBrh29YqDvkCKmoYMJBZSoQJP7kSECWSdJannn1hJkzg8AUFE87FRvCh8E8", - "ed25519:2TNsyhbGWnJfN9e8Yaaggfbf3Yu7w7JpGAQnUe7LkzBKfruLF9yDxaAo4yc5CVJiVqX13NnQfPLcVPpaD1wgMFfV", - "ed25519:41CHKZLBr3pM2eE5wXjgaXrBM7ugTiBBn2JSfar2tHhoAtSKNimfyfws9DemJDs7LB8CBNc85WtqdwGgCsB1nWfP", - null, - null, - "ed25519:3ePYVb2Vnq2x8hm7sgoZWNVC3Hbx8RVXs37AVCpo1eLLLeReRocMDnDUsTss7kBHqMwi5QpZ8ZBUEocYFFX4MYhD", - "ed25519:h3YGEEUj628izdmDR4eBmqYhtFcMfQM14gpL8cmHzE1eCpLmVWE18xQFcdbGLAoW8RGsVPaYdBHbrkGznNA6rT3", - "ed25519:52wySwA9PdQNbrcJnw5oeaK86UGjKP1z8QcWPZZmi68indUqyHgo8x355AkH5hw61DoxGfZ2SCTMGSV9u2b5n8FU", - "ed25519:4ecMCbGYYkBFU8Udth8uozYMnvkQqNde41ZyzBfzABFSoxxv9rK7Tc1BfCeedtUJvmqGUWpwQ9wcWHgKT8BYqNf5", - "ed25519:23SyCVTm5KWjHHkAs4GFCZTvzZhB3G4QtpJNeSz8JgZdT6A77dabePnUqWpMMENF7rKF1dr8bri9doJR37PZB4bU", - null, - "ed25519:4saccLgvU75D4nBJWSPzd71mqtRGHhv2Kx5CtmGSGLxGG1Sd2BmZtrL9rHksQGjRVKxmHswv9RRDdj7JRKqCVJJx", - "ed25519:3CqKXCuBtYkvwk5xsRwRCoYFwQeEScCUbJGuZZzn8H1hJkb7eSZAtvouUxVVMaRxyPGZciyFaLhpoX6X6veGbjqa", - null, - "ed25519:5XmffM6JMYCQQum9764cGxRA7xDGYMUpY3T5Jaiv89f2XHNniA4ZHUN6LkWnnZbdbj97cJYbstvTgCspbWQvVdfH", - "ed25519:4J5LPAdP7Cbe4foYg3qQdTQyxLDVbZk79BR1xJEY1TQJrtJq9JyJPqHXxYibCqeAPVqXhWXJzMzn7BGjYuff8znN", - null, - "ed25519:47Hydvzd8rUcaWF7bkV1Vap7yPvFK7PeMSGMvhjRzNdfqjvEBiJoR4t9ktYVphx9BCQSzDQYdxjysR7yAMykq9rb", - "ed25519:4894KtUJZ6Fp1eoMWnUo3gPZLnMS8q2CMMGRYjXxTiEfM8oRDjzUKhg4x1QLUwCWoq593UpcyroqhcAUkufLXkgD", - null, - "ed25519:5wvk8hNhNzUefu2ig3eyPcx9FHQAqTa9ScornNdGQ7X5VFECzDtXKZh49VDs3SiSAyC8iuB8FgJdxmUq1b39Xoxk", - null, - "ed25519:21KSxZzZtDkLLH5RuJ1auP73qkuL4WXyRLtdvq1XSRrH8Yk1AyqhsJ54YbRbbXmetpRuXuHKENwN1hQsNd37vQZd", - "ed25519:4NcmdYz5VjHKmSRboX8NYsZLRGtGe6bPMcpCcWQdQfTXezDY6EtYL8awXWd6Y3kxaaZkJJ69FuFBazjtTTWADivu", - "ed25519:34sdiKBSp2jkjTySbM14ivoXseRBxpYus7jAfsBNnaa4KPxhpLXVW32proR1YCt732AErg2KnyC7xkJc3Y6CVJ8V", - null, - "ed25519:4aijMmx4KWhS4XmxBfxVCxnJ4s8Yz3iRrFBLYXywb5v13CtKxW9VKSNqwAXJw6jndVaPTo7rz53CsSWNG8CEujgz", - "ed25519:52MtGXV8G1Tq6jWWZZXxBVGVQQK8Egz2yt4TRMqEe4YPDgo9PmCwoNbpzPTSdBQXi4hwFDHpSP5aU1DdjnFLkrFA", - null, - "ed25519:5xBStwognhUYGVzX4dDyVTvJ5HpT5wqFnLcAbNVK9XAJXdivcZqX5MjFBLiwyPHUpPKvx25UEztbtpQVyTqjaorq", - null, - "ed25519:2GhyEXY4wR9iqWshGEF1tQ5Fwb6M6ZGUeXUwQjHed5eUQs71YwuYUyACgSH5VoMiJwGhPhitrjwBVqV9eLHbmDzv", - "ed25519:31wQipuDcL6FwTDd3NCwaqiUDyi7cZUcr7qUF54sU1akdrkQmdHmx1wvoYXf9CU6jrAnF8qrvhridMdgVtZPZvx1", - "ed25519:4DqZuCJx1pW7zYqqU1rU5K6Qf7TjP5LnVU89PfNkmnwfRcQeHaunkky5JC9qYNZLgpQ1nufb583DsakHD25fDNvJ", - "ed25519:5EoXqxQa1TcMsjh6DfzQqbkMJe6Gc2VeyJaFCNhaHuMgN9AEa394cpaQrceS8h9mowNDHGJU6KGHSUCbPrPXv3et", - "ed25519:59hxAGF8dSHwLaepMQKPHxqvFGHszQJfLhLjtjoXKYbidPfEPr1ZAF84X2npHoQ7SHwf7Ev47zEY2RCNUjvY4TuA", - "ed25519:2rKQJBW1LKRvh3Z134e8oNravs9q84Gr72NdrZTbHu8eepp7SgUoAPexCRgCh4f3ubeG5wE6yMdHRB1WTZ8RrCgd", - null, - "ed25519:46TMbMumBmNEP6cLDtS2LshuznVHoFdxzmqYunkqeQm5S761Q6LfgxHkLXx424NFjyebAhmWk6z5bVYHCtyczxJN", - "ed25519:2gWgD8Kyobc9XXGJ4346BVA4rB6wKMXjZyN6GsQPLNCsZEgR8cTk6gxhwgxHxUPDGkob8bsFmqU5hh8Xbochkb3s", - null, - "ed25519:61hGSWPcfZ6YxYW41WG69jhr9c5UrA2XrE2KZEEPHJkDHV4dJBFWvhtt8hXNz4cmPai2uwCy2DZSUgBYSR9sjaYn", - "ed25519:5MZU8UxnychBdGxzNH5k3fa37zRV7hgiauZRuPNXks5J4EgBS8UQxZU1JUnD4j4JhEQRAUmfJ1J5S6VPfKbQHSbX", - "ed25519:5EXH5GeSKE5T85XCuTbF5cMQbUPYG3nzXyKYM9eQL87v83v2U2dHaENa5AjgfY6NmXdfJjC7wNQuo2inASWvYFTi", - null, - null, - null, - "ed25519:5a38NPqoMHpXDqTthFZPFjKnv3cS7pyrrT5ziGNCwGBfaGk1VVyqrtDawmhKMBs8xhUmktXeXP9Wv2PQGdVkxh3", - "ed25519:5mG8yAgauHMZMyFMrPvQw8qGQ7D2xiksE4vekVPWH4bEbxUuwJtdHr5cQgqY87KfSqqbkgrcxozKGRi3CFVapm9g", - "ed25519:4BjQpErboUNcF28gzdxdKQWvRDb7SVZjx65knyCSqseHkZBRT25AfAJkdy8Ra6rPx43xK3YPxu38hbZmKG9nxFkn", - null, - "ed25519:3Uoo5KSZKfPGACtJLiH3KhFBs9N8iohXy5iUPK4BG3EFGHsPcUKLVboWnPevNRx7hcpmKsyxQbcRdndetDMVTWvi", - "ed25519:5uTYvfbViRcsmox5UPkfkzHmEQ9Z5uxdeZ6NvmtTwsyidqEYN1evryH1USrpmZR4t2gswDSLitoSywEFftZ6GmGB", - "ed25519:2B3V7Ms1ZPKcZ5NqJXW9MgRDgHW21gJV1kCu8nKASK451MdVUEdBTd4cyuAqduv5RZQd7F16XytdG7PDXam9BQcA", - "ed25519:AJZ6918C6QkmnS9CA6ZUAAgqPhCaq7Sqb2ZFPWVE84cRsubN9EAR1zK2dBRxX9ZtQhheyzAHy6RwCN8EDRJUHTM", - "ed25519:5VvRCFWLATSRSdEE85NQV3wNhRMnvmeXiV4oSHKyGwi8nowdVmnwmAT4kb7ro6Z1A74hYDqsRQjW4PC4Cxarcxq8", - null, - "ed25519:4PEddhHi6rrKjULmA5J4Sq5djmZ447CGuDQwUEhe2HNCxmLNWQ9njV7kxihmD4M5oidfvLvmdF7z9aDFfkzZBYfW", - "ed25519:5HVs2UR3Ba5ELFjHUmMVfww8M21K4K9wodqBHhXntuRk53GBZnLx8V8eqA5KVbSCJeZZktoeTyqMT9Pa5jMaCKHW", - "ed25519:31RMTcGQ546gn4MXUyytA6ugo1pKXVMa77cVMWtzMLHb6kQF4cPw4gdVE5B69waSaL1GzBtN7Ra7PMDgsMWoN8D6", - null, - "ed25519:vCcvHzko2DqtAtgPeodUzQ3ctemmZKwva5N6xroMcdxYW4CYiG4cgjseq4C72kGuoo1fmt8AQV1HSaG6wd7xeLA", - "ed25519:4Gpvq9SWy6ARfNKHMw6gEC6AmF1EMqXUbdkKW1tGGpw8ySrrPw1ZqFfqAVCyVueteZBgQLp7MSsiBp2v97Z3M4DV", - "ed25519:3Wn5NkmKk9RA5moGFTr5oW5QvHyF3fCnMVjDXDPi8WhwsgHQ9oEHpGpiFkpKKuJj1hTgeP4Yo76w1Nyv2Ya53XFt", - "ed25519:5nGyhoz9wwJJwaDMGnBN3fpxaMVNzSeBrTx2F1v6R6nTRS3Fd16vpGCezCr2r8BSzCMZDrTAqqXb62HeyXZGZbpj", - "ed25519:2WGZQemboLuyCrqoBKAD4GEGkWXCAo5SoN8z5oNzrNHJewesycHwrvoSuw8mmMSPBUQutqnowMtMxsPbgmJnxTpx", - "ed25519:5EzFyykbaPjWrkPRgE5CWkLSkKrA2PGkfPucSJDB4Tzw5VETAS6TuusEAD9TVH9zpHmWvQ6qcxHMgD5ycUKWXsuu", - "ed25519:4Qrtz6NqwegmRV3KWMKVXPiPQ2xJGKyVLwTQZ5gRipHUVaU6ovtoCh2Knk5rLr3BthZumWXYzbQiumS3Adq2GZWA", - null, - "ed25519:5sMjvdios6LjjCGiU2MMo7fjjkchJuxTwXroKWGD8jkzqFqGjyb1tEiD24sbHtuGdW1DTKLFLGzvLqKrexmf3vU8", - null - ], - "inner_lite": { - "block_merkle_root": "ExTQ1q1HvfPZy7BehiR8JmgwUd9j3DTzHrTPmr6r9scd", - "epoch_id": "5h3PDeeRRQjgyNvzbKepLcBJT3jWJdhu662LzfJGC8ub", - "height": 86716292, - "next_bp_hash": "ALsAx1zoiwiCvcJoSrNuGbtTk3XcUcXdMBGaZAW9C36m", - "next_epoch_id": "BCC27fXZwLaqs3MmuhvVfiSHtHjSw2y4zQfP6RTCT2QS", - "outcome_root": "EwkVmmLtfMwR29qGPUDVAEVPJZFPWjqTGBGpYDxLSja3", - "prev_state_root": "8NnmP9ZsBesVgrLwWbLTNVGp9T8NK2oRcBLAsL7eZsCp", - "timestamp": 1678142413035318546, - "timestamp_nanosec": "1678142413035318546" - }, - "inner_rest_hash": "49Jsd8ULPst4hPqn9gLV42pncN2B73Xgab18S4BRARMt", - "next_block_inner_hash": "381NRbYEm7wo1miWJhCvyGFC7WuMyhTJkDP62rrPmm79", - "next_bps": [ - { - "account_id": "figment.poolv1.near", - "public_key": "ed25519:7RjyY1bRKDqkshbKZtgpQdwsdxou8j9my8g1hPKZ9ngM", - "stake": "39206129243863608141066930499972", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "staked.poolv1.near", - "public_key": "ed25519:3JBVXqenru2ErAM1kHQ8qfd29dCkURLd6JKrFgtmcDTZ", - "stake": "33419809779120392920269809612199", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "astro-stakers.poolv1.near", - "public_key": "ed25519:2nPSBCzjqikgwrqUMcuEVReJhmkC91eqJGPGqH9sZc28", - "stake": "27294688224403596819807905373855", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "bzam6yjpnfnxsdmjf6pw.poolv1.near", - "public_key": "ed25519:2ZJqaaCAisK4u8E2i611zFfvNmrvevovnU3M7SpGHkLY", - "stake": "23416062305792484840940844551487", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "zavodil.poolv1.near", - "public_key": "ed25519:HHARoU1hANWF9hu7YRstDDvgyigBhUeUuqecRVr8dpUz", - "stake": "17630216582180625016114945099933", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "binancenode1.poolv1.near", - "public_key": "ed25519:Bb7uPEocbsiQwRfPmsiiiM88DodtuYnBDi6dKZ4JZo2N", - "stake": "14048896105546755595738737008478", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "yes_protocol1.poolv1.near", - "public_key": "ed25519:4bnrmHSMYkvsgjbQSaCY3AFwrfS1w17ACEUQdn7aC4iT", - "stake": "13632840600753345981723601120095", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "staking_yes_protocol1.poolv1.near", - "public_key": "ed25519:CVVcLtfAWj6k1DqKJwhYBQwjMQFmXzFY2NBdMxp1RqL1", - "stake": "13548114501459907012425142831555", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "epic.poolv1.near", - "public_key": "ed25519:68HExKDtw1CjGzopZ8fMAMhMSZRVKRhwLzLQmGKtFNzT", - "stake": "13361490946637633806027080459531", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "electric.poolv1.near", - "public_key": "ed25519:GpSr5KAZMZ1Cb4dHMRUVhmp95y2fmWtm4dEjAr8iAva5", - "stake": "13094194582706200726499022124313", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "aurora.pool.near", - "public_key": "ed25519:FZKXoWHFCXMrKiXjAKFdHo5g9PDom4bWMRFERBfufi2Y", - "stake": "12455530195608719577803023115066", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "stake1.poolv1.near", - "public_key": "ed25519:7EiVt9i7SmULDKEnAXBFSMzwUmZdxUYDFkP73MZuCH1h", - "stake": "11723004342951596666411372180029", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "sweat_validator.poolv1.near", - "public_key": "ed25519:677kArWPFPRDgWEBHqHj6BCmEdTVBsAcjQAc75Gtyq2j", - "stake": "11061535470684271849484334918122", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "dqw9k3e4422cxt92masmy.poolv1.near", - "public_key": "ed25519:EPNc2bHqRCz6TKLstNiusv9qZCRBL63zViwUAcgoZJZj", - "stake": "10479308296906700818189011839258", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "future_is_near.poolv1.near", - "public_key": "ed25519:F3vEGwYYGisaXwKJWrYgorB95DfArDby8bK5wydxD5fp", - "stake": "10309322520727981661721876402207", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "rekt.poolv1.near", - "public_key": "ed25519:FoAaUdVKEHtVokG1aVmJNou61YcfQhXmaZ5Hnfsz4fHC", - "stake": "10079667782041637158777028934416", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "kiln.poolv1.near", - "public_key": "ed25519:GAekByYrSuo3seuaGQx7V1ZTC3gWZY8JxZJ4aWW76LiT", - "stake": "7980652394651037069871965079140", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nearcrowd.poolv1.near", - "public_key": "ed25519:He7QeRuwizNEhBioYG3u4DZ8jWXyETiyNzFD3MkTjDMf", - "stake": "7002893129834998728551934925199", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "finoa.poolv1.near", - "public_key": "ed25519:62gxgzoie7FiK9dnWuiwM1bbuvhpceYDavK7SgdfEMJc", - "stake": "6862544459467539008922458111228", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "d1.poolv1.near", - "public_key": "ed25519:7ZhMRwnSHGJtWjGBZiRhhSi6XyqKeNHtnEXsVTNdrsk6", - "stake": "6522886931909028877795116092724", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "continue.poolv1.near", - "public_key": "ed25519:9rDZywYL3tnvzj6hnePw3MaPFPfSeSCLxBp1niTGbMaK", - "stake": "6418629997062742180813621956876", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "anonymous.poolv1.near", - "public_key": "ed25519:Hoj7LbPwNwAkLFhf8z2aDF1BG6NDSrq1BfkdaKqPfbXx", - "stake": "6271712752150531999559361269851", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "hashquark.poolv1.near", - "public_key": "ed25519:3YDdmN1vhF7yAWnYxGMHY46jcLE9h11HvEeF6Kntugeq", - "stake": "6176316778768669484263610930775", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "foundry.poolv1.near", - "public_key": "ed25519:5Qx8Fq3SK4Vu1sRRpf2HsNGLAqdNqgkKEebHMniLWhkW", - "stake": "5925879216899098565250728067432", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "near-fans.poolv1.near", - "public_key": "ed25519:AgV97ssnHm7qN8JhYZjwyDtuaT6Ms3Fgbw3WeAC8M3iF", - "stake": "5646665045313893189005647236282", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "stakin.poolv1.near", - "public_key": "ed25519:85UGfKdVoxX9u86JsBMxmVHBguYonnM3vTR2WoD5GkEg", - "stake": "5583623315375786166458286896325", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "neardevgov.poolv1.near", - "public_key": "ed25519:FsZH8qQGfHRxFUbrK5pCEDgN758ZmqUtcUtYRWWGCcAG", - "stake": "5554866332371942354526927649509", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "hb436_pool.poolv1.near", - "public_key": "ed25519:7oU4C3vWqkeup7aMfjyV1ojt7yKX7ShLfvNCahBRy1eW", - "stake": "5396966930657509205043842792722", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "chorusone.poolv1.near", - "public_key": "ed25519:AZwJAgu2qRxHwdpj8ioZEFGcc2jbaZGN7ZvUe7CuXtM7", - "stake": "5287147598217926353386779299664", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "08investinwomen_runbybisontrails.poolv1.near", - "public_key": "ed25519:C6yqxQ3suwjmm8ufG5e3BsHiwxUs9h839FCneF41V7TM", - "stake": "4857774634147130373813689246471", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "p2p-org.poolv1.near", - "public_key": "ed25519:J441YAvvYvjWs3aVzjc5KLLWRzmhQTEMaymPyWFkMGeG", - "stake": "4723790666044236105496108137009", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "northernlights.poolv1.near", - "public_key": "ed25519:7HXh6iS9Rh92Uj1c5T9fPjQXPLnti4Rr2cJQcJEYpdGV", - "stake": "4712387224906733281947973541174", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nearfans.poolv1.near", - "public_key": "ed25519:GM8vWM4TqTt7jh3sXYCAs2KPyn4vEmAceteBGEFYhyku", - "stake": "4710423887240747307183606599570", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "everstake.poolv1.near", - "public_key": "ed25519:4JLvwa1r2eAxHLyKeDJnpqMG5f2Z9rr49rwuTwb9g8u2", - "stake": "4623315567330451805820491717070", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "openshards.poolv1.near", - "public_key": "ed25519:4Xm73PiAGMZu3mZg4gF7j96iTAFHGbPvqzxBaTgKP4ub", - "stake": "4611959073339809590025288736983", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "dokiacapital.poolv1.near", - "public_key": "ed25519:FGcJJeWMyx1xDbfkcPM2oMeUeGaADJuPmeqx5rjsHn7t", - "stake": "4332759036466228308554905977698", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "accomplice.poolv1.near", - "public_key": "ed25519:5ck255MtkoGQxh9LfjNtdb4M7WHkUmjU7SBJCEkZP2B7", - "stake": "4266120587684739122299552723543", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "cryptium.poolv1.near", - "public_key": "ed25519:5Y9hW8cKBb5RnsJBqttHHC5ujz5zcZZ5xnrJPwkCWmGQ", - "stake": "4227791919561939934282903484058", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "blockdaemon.poolv1.near", - "public_key": "ed25519:3GNFSJiFQQ1rnR68T4eZRff2omPhg1CTewUHBJpQAdyc", - "stake": "4197683971126897677552917113311", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "pandora.poolv1.near", - "public_key": "ed25519:53N7KBhSkEP6tLuQmxZV9fAK16D1C2kWnuzes8KNyS7P", - "stake": "4146080022605167207664031127947", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "bisontrails.poolv1.near", - "public_key": "ed25519:Emk6wQJtpQZRJCvvPmmwP9GD2Pk37xxRpmb5uRvJpX62", - "stake": "4038512909923817748075892748374", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "smart-stake.poolv1.near", - "public_key": "ed25519:A6wpkLQiYqPZ1rbd9s5S1Bg3LxccVsQqiCRDUXwzJ6Hx", - "stake": "4003234307493046391337326649739", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nc2.poolv1.near", - "public_key": "ed25519:He7QeRuwizNEhBioYG3u4DZ8jWXyETiyNzFD3MkTjDMf", - "stake": "3869238705002385060975735647681", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "ideocolabventures.poolv1.near", - "public_key": "ed25519:6NFuvrmnJiokXibR9Z7TUHjB4NJnD1rJAHhBu9JWmBdh", - "stake": "3771051905041496783453388460098", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "stakesabai.poolv1.near", - "public_key": "ed25519:6abauNvvWnEkagjVpWRy2tZJdzPkmqurUjteMTKk5KQF", - "stake": "3535334314397193862153015712370", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "buildlinks.poolv1.near", - "public_key": "ed25519:Hd3irGt4zEqRPAzcFszX3oTkVWRFFxdecDvShCJSS1Wg", - "stake": "3526372164342614084796298814676", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "sharpdarts.poolv1.near", - "public_key": "ed25519:9XMHXqv7rM3QQxzjUu7dfKD7GhMkq8CEceaPdkhiBQUX", - "stake": "3434848476944224053624702383467", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "consensus_finoa_01.poolv1.near", - "public_key": "ed25519:3LqCGkM3uLjQjPmd3yVyaEnceinEL4cBfUm9vp5hJRTJ", - "stake": "3210187970648326218235433796250", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nodeasy.poolv1.near", - "public_key": "ed25519:8mjespqqUePSYSsxYxPqCUsZUuMxVJr1vjBRwFeCke5K", - "stake": "3175117754588187183467391312105", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "consensus_finoa_00.poolv1.near", - "public_key": "ed25519:62c41nzrrZAspLnPBC2A112PXBhJuj1cGkVE3ANwbzat", - "stake": "3137487132332056735962851894070", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "dsrvlabs.poolv1.near", - "public_key": "ed25519:9SACdsDDgXA2WZLfJvpkKbu22Exxtc4CMbeHmVnN2P4a", - "stake": "3068789867106978388439487819348", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "lux.poolv1.near", - "public_key": "ed25519:HzTGTDfTz63QGvvUdMGozFeaENFGyYAoSrqYJb23qZFN", - "stake": "3028423991046584165619348124538", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "lunanova.poolv1.near", - "public_key": "ed25519:qkfP4NsSuHybdLhdvvYQ2Y9xWPsd249thEvrzbJBKNc", - "stake": "2870316617608351013129493882339", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "brea.poolv1.near", - "public_key": "ed25519:8dce49J5G28yMGRcSiDnYNFh7GBSma8TmYaw5mGTSH1Z", - "stake": "2761858870237463180720625792343", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "zkv_staketosupportprivacy.poolv1.near", - "public_key": "ed25519:2kAo86DW8mDaLDg37rFhQY8UYSZVq1CtegUHBEDvpSMA", - "stake": "2689727012142129963731924151456", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "baziliknear.poolv1.near", - "public_key": "ed25519:E4LAWdgLifBEoaWvhRNy5vpdAnUc3GsUHePeiAurZY5v", - "stake": "2688388636772692288448305121899", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "erm.poolv1.near", - "public_key": "ed25519:88nnN6LAuCbJaj9wucd1WUMfTtdv2s3njpvozHft8oQ5", - "stake": "2535798066743341414045251252289", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "fish.poolv1.near", - "public_key": "ed25519:27KegJd17HeXHk9h5MqkT35QAuvYvo5GFgPTpSVU4kPN", - "stake": "2359349916980152012597982756209", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "01node.poolv1.near", - "public_key": "ed25519:5xz7EbcnPqabwoFezdJBxieK8S7XLsdHHuLwM4vLLhFt", - "stake": "2330998910140068045131278690848", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "stardust.poolv1.near", - "public_key": "ed25519:6rxCJpTnrT6NFuGg6d5Dj3FEUz1ScNU9u35ywB3dYhrX", - "stake": "2179193523704935865995375845863", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "republic.poolv1.near", - "public_key": "ed25519:5sT6xtwxvLARW6y3KURYmyFd5SokJFhiK4jyqbamzzZ6", - "stake": "2124651577543740701890267481063", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "moonlet.poolv1.near", - "public_key": "ed25519:GkDwzPckMfhkdYgyFG69Uph8RJ12BcV9xNeZW2q93ZJD", - "stake": "2060503312099452529479997679460", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "allnodes.poolv1.near", - "public_key": "ed25519:AGEeyukQdMtg8EttsU39YLgryhao8yQeVwQTut5bbWdL", - "stake": "2041189719996971478342261526212", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "masternode24.poolv1.near", - "public_key": "ed25519:5ZyaXsGCya4Sch5bqUfohvo7iRFYB9ancRouggWRsiDU", - "stake": "2013012692631849510294424733258", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "legends.poolv1.near", - "public_key": "ed25519:DNK46DeHKeJPF9YetmNxZnqtpkeLjdUb9ezSRCue3TpB", - "stake": "1968963206127000985432877551650", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "fresh.poolv1.near", - "public_key": "ed25519:6YHLXhohY8kMnkp5Jw4HrJ52xtdyt1rcP6AaWkKzh3ED", - "stake": "1908553262368274972364412463603", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nearkoreahub.poolv1.near", - "public_key": "ed25519:HUKmMJ59Hht8rcGG6uZ9M4qWsfbTCDtBgyV93YZnPXGE", - "stake": "1811363932350908894826349268172", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "inotel.poolv1.near", - "public_key": "ed25519:DmEDRntb9NwfbfdvDf6wzjsw1vxzQcJAAhFL2J75iLwr", - "stake": "1783140530783276198612825703651", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "appload.poolv1.near", - "public_key": "ed25519:6LbMVL6otkvZbpuC9sN3z7EXSMo3PT9noPeBdBZTFneM", - "stake": "1777016586059857984166086383996", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "qbit.poolv1.near", - "public_key": "ed25519:5DqZLnDu6PMEyhJzc5NhiMsoWeYMWG1bC4AULyafoXMv", - "stake": "1652745895856216988922137332983", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "jazza.poolv1.near", - "public_key": "ed25519:EW66Fkv7XcE9FiybuYtVURjHhYeEgwWWpzF685Vi7foY", - "stake": "1600810581770426565414413340826", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "avado.poolv1.near", - "public_key": "ed25519:FdLWsf42e3Sc7bdKMtxJMgWRP21ysZDSXFnS2vTwTaaA", - "stake": "1505671712920196582626546247266", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "satori.poolv1.near", - "public_key": "ed25519:9r8HYmw8mbys2Ng9BaKeQqZnaQTGCcBUbMatV5NeeWJj", - "stake": "1505563874806956005096650532342", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "ledgerbyfigment.poolv1.near", - "public_key": "ed25519:4JJTNeMaSb8W3NELh2rkkrDCqG1VpM3gdJ1hc9HFTBmN", - "stake": "1378902973337960064375143109943", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "atomic-nodes.poolv1.near", - "public_key": "ed25519:CpVAHE3JpfDoEPqjBDgYEjgG8JhM5BFKbjUD2N1EuvAL", - "stake": "1320330340013835475473012378960", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "pandateam.poolv1.near", - "public_key": "ed25519:Cu83NRziNLiT6HLu9kJ8svFoftZQ9wVmjScxjqCybppt", - "stake": "1319203644166316104758512034128", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "staking_sp2.poolv1.near", - "public_key": "ed25519:CS4uHAipvtxGz9irnoCX7SxT6d8zKpDj8Y3Fyf2zVgBp", - "stake": "1189875320275820429094732822094", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nonli-near.poolv1.near", - "public_key": "ed25519:91jusDFxjY32h51tfq2HoKhoPbGs66s88t1v2oZPBSxC", - "stake": "1185432705606468385332754514200", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "bridgetower_v1.poolv1.near", - "public_key": "ed25519:AHgnnt8yhNBpoZChBiHXfjaH6X2zMZaDDXmmSWHvDcWL", - "stake": "1035663254387646835799962119440", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "stakely_io.poolv1.near", - "public_key": "ed25519:HWp9E3gP91s25ddMS9xUWuzbJUpVGiPoitu5bT6hqMHs", - "stake": "1021258364486646824071027357415", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "calimero.pool.near", - "public_key": "ed25519:7A9aFJtr9yWh5eyAUUUSdXMoxzi1qBjshiVCjsDWWa1J", - "stake": "1015874783766921089538649131256", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "staking_opp_disc.poolv1.near", - "public_key": "ed25519:8XbCfLQVSwtwaBajvByG87CxPPbaFdryz5qEkde1fSGv", - "stake": "945252783112950401552190350991", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "galactic.poolv1.near", - "public_key": "ed25519:GFK83N32DbERtFg8rkpfNBsKtkFpmNQzyKFM9kJvPCMG", - "stake": "831246120998540891354298874477", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "cryptogarik.poolv1.near", - "public_key": "ed25519:45zFAC8pLgwn1d5pSBpBHesWbzngfRgd92zaom7K8m8j", - "stake": "828004032171300648370990744344", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "optimusvalidatornetwork.poolv1.near", - "public_key": "ed25519:C3CJMKaWdEzkqyNCKwnKud6wDNnzs7Ura63k16zm4LUU", - "stake": "801755793868841694119971272782", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "pathrocknetwork.poolv1.near", - "public_key": "ed25519:2iJQLVXubWafG7K1NzGVvjP54UJCgVg3cuPMktw8r7uQ", - "stake": "798288406254751164539305822812", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "dexagon.poolv1.near", - "public_key": "ed25519:AQHwptR3Ho348BpFXJDjkxpWMW5ZwN7xWM3XWAWSEEgs", - "stake": "781119997524930787753273551265", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "staking-power.poolv1.near", - "public_key": "ed25519:42ikqyV1BYmSnhHJ9EsLLy9kgeAg1mC3qqU1AJGaTEaW", - "stake": "739158259862982574010823948092", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "infiniteloop.poolv1.near", - "public_key": "ed25519:9BUwtDegzwKcmJBjLgUDLHc3pePgPKcWJXYGcZb33Nyr", - "stake": "694945966749165983829361965202", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "prophet.poolv1.near", - "public_key": "ed25519:BV5b4DpgCUy1TEitE4TVPhpTY7uDNpHc8DBPyH6cYCBq", - "stake": "671635020628939237380029587432", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "bitcoinsuisse.poolv1.near", - "public_key": "ed25519:Cy2sboVqjDk6d3d2A2AJZBdFvokjk7sjZpYATLjcQSCj", - "stake": "664239734198440103401629427218", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "cryptoblossom.poolv1.near", - "public_key": "ed25519:5opTNJEkCBYuyMgAghY2Sxp4bBtXYQtbEvZ3Wc5Awohb", - "stake": "657665183791735436571718632241", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "kosmos_and_p2p.poolv1.near", - "public_key": "ed25519:41GWxdQHe4Y2fuisvz5k5G2NwDFEavRkisoZkB5tfJuC", - "stake": "636577548907797834502568994402", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "readylayerone_staking.poolv1.near", - "public_key": "ed25519:6AuBsxxSCYHkuJW9Rhf7HK2qYKErtThZUrN5HFDnQ9eg", - "stake": "627738918419591761430004629136", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "n0ok.poolv1.near", - "public_key": "ed25519:EC1p3w9hd4XkYoUiAKc8PSQGVFGiUXTDJvqkurRdAFz5", - "stake": "603091766828423031754951292758", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "dragonfly.poolv1.near", - "public_key": "ed25519:6Gj8MRp9KqfdiXa35LJcZnqeBNNEZoYk6ysvpzHaruvq", - "stake": "573145205007582852162929757548", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "pangdao.poolv1.near", - "public_key": "ed25519:C35kAQVW6MHoWtUZ599WHXamRXVZnrHMVD1q85FERiem", - "stake": "536104952358448307683904244716", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "nearua.poolv1.near", - "public_key": "ed25519:6YRLTm4coawMYrchYs1ex5BLY7xtnPrnvGWgk6NJAQvy", - "stake": "471397693642001593493614085881", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "galaxydigital.poolv1.near", - "public_key": "ed25519:8ZD8CcSzSfVsYo7XyABHJsYcrpBE3EL5MwukoEfrNYMR", - "stake": "448811822469059379056147844225", - "validator_stake_struct_version": "V1" - }, - { - "account_id": "grassets.poolv1.near", - "public_key": "ed25519:GS8uhr7mhsBWB5c1JgvsJzpwZDGrcnB9Xnw7YRyMSQP5", - "stake": "418986205174954907945983151920", - "validator_stake_struct_version": "V1" - } - ], - "prev_block_hash": "HrafGqcmmviAysiDHZypHiqj5W6Edr7QLUK2rkP6dCRA" -} \ No newline at end of file diff --git a/fixtures/e2e_bps.json b/fixtures/e2e_bps.json new file mode 100644 index 0000000..9b1db62 --- /dev/null +++ b/fixtures/e2e_bps.json @@ -0,0 +1,86 @@ +[ + { + "validator_stake_struct_version": "V1", + "account_id": "01node.pool.f863973.m0", + "public_key": "ed25519:3iNqnvBgxJPXCxu6hNdvJso1PEAc1miAD35KQMBCA3aL", + "stake": "11170441638409425668975791338168" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "aurora.pool.f863973.m0", + "public_key": "ed25519:9c7mczZpNzJz98V1sDeGybfD4gMybP4JKHotH8RrrHTm", + "stake": "17889966138083499342131296757169" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "bee1stake.pool.f863973.m0", + "public_key": "ed25519:B7Mwy3sCCJ6GZzEojsKFXMjLQfVXPDC4Q1LjuHoZcyM6", + "stake": "951628760573009933043158953323" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "bisontrails.pool.f863973.m0", + "public_key": "ed25519:8g4P5EXyp2b2pfVMHY1QLfkRcY59hjPfWrFCKUWX3RmR", + "stake": "784322861597508336390510885838" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "everstake.pool.f863973.m0", + "public_key": "ed25519:4LDN8tZUTRRc4siGmYCPA67tRyxStACDchdGDZYKdFsw", + "stake": "3424542870162917789465110810613" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "forked.pool.f863973.m0", + "public_key": "ed25519:5CTpVEzEdmn5wK4y5e7DsqtRvQs3bM1ypUNU2RGj3mtL", + "stake": "19553588599682112903267112637" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "kiln.pool.f863973.m0", + "public_key": "ed25519:Bq8fe1eUgDRexX2CYDMhMMQBiN13j8vTAVFyTNhEfh1W", + "stake": "7466078259126542726635504903558" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "lavenderfive.pool.f863973.m0", + "public_key": "ed25519:AzwAiLDqprZKpDjhsH7dfyvFdfSasmPTjuJUAHfX1Pg4", + "stake": "30215218325260022435961435186" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "ni.pool.f863973.m0", + "public_key": "ed25519:GfCfFkLk2twbAWdsS3tr7C2eaiHN3znSfbshS5e8NqBS", + "stake": "3102526369640411151678859285501" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "p2p-org.pool.f863973.m0", + "public_key": "ed25519:5qyxefArHQfABdNv9ELuEiWcEo7DTzABM9LrMAKTCY3Z", + "stake": "100198001398444504508422270154" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "pathrocknetwork.pool.f863973.m0", + "public_key": "ed25519:CGzLGZEMb84nRSRZ7Au1ETAoQyN7SQXQi55fYafXq736", + "stake": "1716080041801977779897178399888" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "stakely_v2.pool.f863973.m0", + "public_key": "ed25519:7BanKZKGvFjK5Yy83gfJ71vPhqRwsDDyVHrV2FMJCUWr", + "stake": "5536803168134829098864689871766" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "stakesstone.pool.f863973.m0", + "public_key": "ed25519:3aAdsKUuzZbjW9hHnmLWFRKwXjmcxsnLNLfNL4gP1wJ8", + "stake": "1884761660283483727605426573806" + }, + { + "validator_stake_struct_version": "V1", + "account_id": "wolfedge-capital-testnet.pool.f863973.m0", + "public_key": "ed25519:CQEMcPQz6sqhAgoBm9ka9UeVcXj5NpNpRtDYYGkPggvg", + "stake": "4110455987307868059339044490" + } +] \ No newline at end of file diff --git a/fixtures/e2e_header.json b/fixtures/e2e_header.json new file mode 100644 index 0000000..7613b96 --- /dev/null +++ b/fixtures/e2e_header.json @@ -0,0 +1,15 @@ +{ + "prev_block_hash": "5dbt6rh82Xx6nNG1PuKoQj96g4jnWw6cyb8HNWPPkVJE", + "inner_rest_hash": "DZT9p28adyuiTSbUV5bsuPRxX9K7R1bag1AeUEMhm4bh", + "inner_lite": { + "height": 154654776, + "epoch_id": "FsJbcG3yvQQC81FVLgAsaHZrMBFbrPM22kgqfGcCdrFb", + "next_epoch_id": "Fjn8T3phCCSCXSdjtQ4DqHGV86yeS2MQ92qcufCEpwbf", + "prev_state_root": "F2NNVhJJJdC7oWMbjpaJL3HVNK9RxcCWuTXjrM32ShuP", + "outcome_root": "7SYchEDbwawjP2MVfZ2GinP8bBQU1hKFRz34b2ZzG3A8", + "timestamp": 1705334624027402581, + "timestamp_nanosec": "1705334624027402581", + "next_bp_hash": "AcNatyPz9nmg2e5dMKQAbNLjFfkLgBN7AbR31vcpVJ7z", + "block_merkle_root": "3huzCnEQhgDDMWyVNR9kNbQFJ7qJGy1J4MBrCJAWndW9" + } +} \ No newline at end of file diff --git a/fixtures/1.json b/fixtures/main_0.json similarity index 99% rename from fixtures/1.json rename to fixtures/main_0.json index 538b2ed..f8c0993 100644 --- a/fixtures/1.json +++ b/fixtures/main_0.json @@ -1,4 +1,6 @@ { + "last_block_hash": "G2zUHxU5d5mbXXCAgQdKtK3c9epb1mjqg3QYhzYSN7pZ", + "body": { "approvals_after_next": [ null, null, @@ -717,4 +719,5 @@ } ], "prev_block_hash": "B7dCe8xYAY8b379K626jDq7UiLqHDGSaN99YWZvixVAo" -} \ No newline at end of file +} +} diff --git a/fixtures/2.json b/fixtures/main_1.json similarity index 99% rename from fixtures/2.json rename to fixtures/main_1.json index b5b8fcf..9027d4e 100644 --- a/fixtures/2.json +++ b/fixtures/main_1.json @@ -1,4 +1,6 @@ { + "last_block_hash": "B35Jn6mLXACRcsf6PATMixqgzqJZd71JaNh1LScJjFuJ", + "body": { "approvals_after_next": [ "ed25519:5vvbBTHSa1zmqDRPLSSNZXCQQWuEpT3rvhWZTUyCHULHemVnGZU6asN9m9z7ArurmQYZKWKJhRXfWMipBQAHxRjf", null, @@ -717,4 +719,5 @@ } ], "prev_block_hash": "64Ho8BgxGx7UuDsjXNbzLVt4kvVkxzt1bThCJb6e9qaq" -} \ No newline at end of file +} +} diff --git a/fixtures/main_2.json b/fixtures/main_2.json new file mode 100644 index 0000000..8e906e0 --- /dev/null +++ b/fixtures/main_2.json @@ -0,0 +1,724 @@ +{ + "last_block_hash": "Doy7Y7aVMgN8YhdAseGBMHNmYoqzWsXszqJ7MFLNMcQ7", + "body": { + "approvals_after_next": [ + "ed25519:2VhGGz8cojutZkdWbZ3bUUc4fqVdM6oo3zBtadCfa2HpUw8revjxpbbs4upmF7JFEWgwgfnX8nnDregKLvEjgc7m", + null, + "ed25519:49KmyiPyt5q51xdtDkcQ3ETtyPsUq8ddUWPttNLrnGNKhCwpykaPy8zNhXiFYPQEaZ21SAB5Euo3k7U2kb7mFJcC", + "ed25519:2xvJ1PY4cbZ7DnVoQhX24Bi47ef6z23FByTjK5sbtZYer2W639KUaKSeEVQAs5Jz4jWbCpBGjDNRRgLNUBh8ZUfi", + "ed25519:49dng3dQytReroebX6po1S7y7JmewstX5JdbW2yK5tqzfdAbzyizozfYb3jS7FWpqcbVCU8j7hTep3rAX3xeWRDu", + "ed25519:4Xa1VPFo9WjcFKAFjRmvB4uAGcQVkrVMrgo7vX3MBYr6cDaXCRrKjk4UFzYqGJtD4jvkZrN7CH2LYmKm7QiE9U8s", + "ed25519:5i9irHTS7p1W1tHmi7ANfWfr4Epcn9VHFeNs3Uvq39CknfCW5xf3HnZXfcKMJXW9DX1qCmMU9eTBaYygZ5BZa8tR", + null, + null, + null, + null, + "ed25519:2wnBH5A73zCforWmtYQX2jmjF3DAo8Z3XcxvjFMiGjemYy1KbxLqhCjwfpeN2xB7ZCREEuBE6yriutFvtAvDWZdv", + "ed25519:2B7PqahnewnRz296wDYxpUCeSobM9w2sLYviGubk2h38sEvUWbgBi5Jxvbck9ADMPNEyiYEbetr95Zfv57tjm4fR", + "ed25519:5AWEsgjcn4QstDAdVYCJTTnjEyvCZ25Cp4h6canRJhFDFcUShkRSTBR38XoCKo9Amn7C1JWqVxkgk4wpogXSHcjD", + "ed25519:49efUuXm3BM5XY3HSFSPjtv47w5JuRtg1AGH5ojFtzBTvVsqgEVXpKXi6ZupDxMT26d9g3jyFWqzvis4PTHMD4Jg", + "ed25519:ePPSYDSAK4R1wmQc9HwbCuZd2FYgqRNknkFwREJSaA32sHHPykNoAJza8T1a8GVzHoTJFaaXNF1H5Apvg8ysqFo", + null, + "ed25519:3CqKXCuBtYkvwk5xsRwRCoYFwQeEScCUbJGuZZzn8H1hJkb7eSZAtvouUxVVMaRxyPGZciyFaLhpoX6X6veGbjqa", + "ed25519:4xfsJpdJApuRveVRsdMpuK7mDdx1MP3uL3U3Cnib5J5sQPbUS33MzegaFLr8LcYeUTLsSCT6ycMi4k7eeC4cx2uy", + "ed25519:4HnubxkveyE15tMZNcEDLq5DxxLyFT17XpsMD2jsw5BGUb6qCnTZuG5E8KQuvvbLMNcqnA9vrnhWbd2LxqtghaUs", + null, + "ed25519:562BGk9m5WwT2CruNiKTYJnquQjFadeURRYA97xZ6e4R6Gu19QAYkcryjCePZyS4kEKm2xjefDqpTaSgf2Kaf2VH", + null, + "ed25519:SvdETeddpFKbtHDCrvTnJKnu6SvE2mu1evahcPrf2RmqZK6Cz8dzAMykjvE2fVcxP46M3opovaFZxzc7o7Wt8cP", + "ed25519:2xPkMJbmdTbiXDhZ3R7QNaVL7Gh9qVaSXbon9LaKUg9aVtJZTxTVHXGDLC9rdU5Xkq35UGmzPyqVjULLUawZuGnV", + "ed25519:2oDV64kdMt4a2VuRiTeAoVu8Fpdz5RMs2twSFKYi7D6chBGjHxNrYGtLxhxFAScqDVmxDjUoRK1Dnvdytvtgd2n1", + "ed25519:4gVh6trN6irVVsTQMyQFdE1z2GJcfDuVbwCLz76CRP6UJ1LAB8Lk11TfXeckKy39qrExZjgpUxpfJidXYN7xYGYR", + "ed25519:PDxVou7E2mrxojsX42mL9zv73stcp8TdDAjb1UDT2F4MN8yd4YR7yYpsrK1NRxL2W7osAHyLnE1peWHdqBvzkLs", + "ed25519:4Cah1td6h1zgswNwSNosVicXWbQ38WUjEM782Zm556WWSsSYgjGezYy3vsvkABQuCPorBSHxngPgTYohcSzwo5j7", + null, + "ed25519:2Pm6xG7LvKD9fMEvtSkvMRizPFPP5qBrh29YqDvkCKmoYMJBZSoQJP7kSECWSdJannn1hJkzg8AUFE87FRvCh8E8", + "ed25519:2TNsyhbGWnJfN9e8Yaaggfbf3Yu7w7JpGAQnUe7LkzBKfruLF9yDxaAo4yc5CVJiVqX13NnQfPLcVPpaD1wgMFfV", + "ed25519:41CHKZLBr3pM2eE5wXjgaXrBM7ugTiBBn2JSfar2tHhoAtSKNimfyfws9DemJDs7LB8CBNc85WtqdwGgCsB1nWfP", + null, + null, + "ed25519:3ePYVb2Vnq2x8hm7sgoZWNVC3Hbx8RVXs37AVCpo1eLLLeReRocMDnDUsTss7kBHqMwi5QpZ8ZBUEocYFFX4MYhD", + "ed25519:h3YGEEUj628izdmDR4eBmqYhtFcMfQM14gpL8cmHzE1eCpLmVWE18xQFcdbGLAoW8RGsVPaYdBHbrkGznNA6rT3", + "ed25519:52wySwA9PdQNbrcJnw5oeaK86UGjKP1z8QcWPZZmi68indUqyHgo8x355AkH5hw61DoxGfZ2SCTMGSV9u2b5n8FU", + "ed25519:4ecMCbGYYkBFU8Udth8uozYMnvkQqNde41ZyzBfzABFSoxxv9rK7Tc1BfCeedtUJvmqGUWpwQ9wcWHgKT8BYqNf5", + "ed25519:23SyCVTm5KWjHHkAs4GFCZTvzZhB3G4QtpJNeSz8JgZdT6A77dabePnUqWpMMENF7rKF1dr8bri9doJR37PZB4bU", + null, + "ed25519:4saccLgvU75D4nBJWSPzd71mqtRGHhv2Kx5CtmGSGLxGG1Sd2BmZtrL9rHksQGjRVKxmHswv9RRDdj7JRKqCVJJx", + "ed25519:3CqKXCuBtYkvwk5xsRwRCoYFwQeEScCUbJGuZZzn8H1hJkb7eSZAtvouUxVVMaRxyPGZciyFaLhpoX6X6veGbjqa", + null, + "ed25519:5XmffM6JMYCQQum9764cGxRA7xDGYMUpY3T5Jaiv89f2XHNniA4ZHUN6LkWnnZbdbj97cJYbstvTgCspbWQvVdfH", + "ed25519:4J5LPAdP7Cbe4foYg3qQdTQyxLDVbZk79BR1xJEY1TQJrtJq9JyJPqHXxYibCqeAPVqXhWXJzMzn7BGjYuff8znN", + null, + "ed25519:47Hydvzd8rUcaWF7bkV1Vap7yPvFK7PeMSGMvhjRzNdfqjvEBiJoR4t9ktYVphx9BCQSzDQYdxjysR7yAMykq9rb", + "ed25519:4894KtUJZ6Fp1eoMWnUo3gPZLnMS8q2CMMGRYjXxTiEfM8oRDjzUKhg4x1QLUwCWoq593UpcyroqhcAUkufLXkgD", + null, + "ed25519:5wvk8hNhNzUefu2ig3eyPcx9FHQAqTa9ScornNdGQ7X5VFECzDtXKZh49VDs3SiSAyC8iuB8FgJdxmUq1b39Xoxk", + null, + "ed25519:21KSxZzZtDkLLH5RuJ1auP73qkuL4WXyRLtdvq1XSRrH8Yk1AyqhsJ54YbRbbXmetpRuXuHKENwN1hQsNd37vQZd", + "ed25519:4NcmdYz5VjHKmSRboX8NYsZLRGtGe6bPMcpCcWQdQfTXezDY6EtYL8awXWd6Y3kxaaZkJJ69FuFBazjtTTWADivu", + "ed25519:34sdiKBSp2jkjTySbM14ivoXseRBxpYus7jAfsBNnaa4KPxhpLXVW32proR1YCt732AErg2KnyC7xkJc3Y6CVJ8V", + null, + "ed25519:4aijMmx4KWhS4XmxBfxVCxnJ4s8Yz3iRrFBLYXywb5v13CtKxW9VKSNqwAXJw6jndVaPTo7rz53CsSWNG8CEujgz", + "ed25519:52MtGXV8G1Tq6jWWZZXxBVGVQQK8Egz2yt4TRMqEe4YPDgo9PmCwoNbpzPTSdBQXi4hwFDHpSP5aU1DdjnFLkrFA", + null, + "ed25519:5xBStwognhUYGVzX4dDyVTvJ5HpT5wqFnLcAbNVK9XAJXdivcZqX5MjFBLiwyPHUpPKvx25UEztbtpQVyTqjaorq", + null, + "ed25519:2GhyEXY4wR9iqWshGEF1tQ5Fwb6M6ZGUeXUwQjHed5eUQs71YwuYUyACgSH5VoMiJwGhPhitrjwBVqV9eLHbmDzv", + "ed25519:31wQipuDcL6FwTDd3NCwaqiUDyi7cZUcr7qUF54sU1akdrkQmdHmx1wvoYXf9CU6jrAnF8qrvhridMdgVtZPZvx1", + "ed25519:4DqZuCJx1pW7zYqqU1rU5K6Qf7TjP5LnVU89PfNkmnwfRcQeHaunkky5JC9qYNZLgpQ1nufb583DsakHD25fDNvJ", + "ed25519:5EoXqxQa1TcMsjh6DfzQqbkMJe6Gc2VeyJaFCNhaHuMgN9AEa394cpaQrceS8h9mowNDHGJU6KGHSUCbPrPXv3et", + "ed25519:59hxAGF8dSHwLaepMQKPHxqvFGHszQJfLhLjtjoXKYbidPfEPr1ZAF84X2npHoQ7SHwf7Ev47zEY2RCNUjvY4TuA", + "ed25519:2rKQJBW1LKRvh3Z134e8oNravs9q84Gr72NdrZTbHu8eepp7SgUoAPexCRgCh4f3ubeG5wE6yMdHRB1WTZ8RrCgd", + null, + "ed25519:46TMbMumBmNEP6cLDtS2LshuznVHoFdxzmqYunkqeQm5S761Q6LfgxHkLXx424NFjyebAhmWk6z5bVYHCtyczxJN", + "ed25519:2gWgD8Kyobc9XXGJ4346BVA4rB6wKMXjZyN6GsQPLNCsZEgR8cTk6gxhwgxHxUPDGkob8bsFmqU5hh8Xbochkb3s", + null, + "ed25519:61hGSWPcfZ6YxYW41WG69jhr9c5UrA2XrE2KZEEPHJkDHV4dJBFWvhtt8hXNz4cmPai2uwCy2DZSUgBYSR9sjaYn", + "ed25519:5MZU8UxnychBdGxzNH5k3fa37zRV7hgiauZRuPNXks5J4EgBS8UQxZU1JUnD4j4JhEQRAUmfJ1J5S6VPfKbQHSbX", + "ed25519:5EXH5GeSKE5T85XCuTbF5cMQbUPYG3nzXyKYM9eQL87v83v2U2dHaENa5AjgfY6NmXdfJjC7wNQuo2inASWvYFTi", + null, + null, + null, + "ed25519:5a38NPqoMHpXDqTthFZPFjKnv3cS7pyrrT5ziGNCwGBfaGk1VVyqrtDawmhKMBs8xhUmktXeXP9Wv2PQGdVkxh3", + "ed25519:5mG8yAgauHMZMyFMrPvQw8qGQ7D2xiksE4vekVPWH4bEbxUuwJtdHr5cQgqY87KfSqqbkgrcxozKGRi3CFVapm9g", + "ed25519:4BjQpErboUNcF28gzdxdKQWvRDb7SVZjx65knyCSqseHkZBRT25AfAJkdy8Ra6rPx43xK3YPxu38hbZmKG9nxFkn", + null, + "ed25519:3Uoo5KSZKfPGACtJLiH3KhFBs9N8iohXy5iUPK4BG3EFGHsPcUKLVboWnPevNRx7hcpmKsyxQbcRdndetDMVTWvi", + "ed25519:5uTYvfbViRcsmox5UPkfkzHmEQ9Z5uxdeZ6NvmtTwsyidqEYN1evryH1USrpmZR4t2gswDSLitoSywEFftZ6GmGB", + "ed25519:2B3V7Ms1ZPKcZ5NqJXW9MgRDgHW21gJV1kCu8nKASK451MdVUEdBTd4cyuAqduv5RZQd7F16XytdG7PDXam9BQcA", + "ed25519:AJZ6918C6QkmnS9CA6ZUAAgqPhCaq7Sqb2ZFPWVE84cRsubN9EAR1zK2dBRxX9ZtQhheyzAHy6RwCN8EDRJUHTM", + "ed25519:5VvRCFWLATSRSdEE85NQV3wNhRMnvmeXiV4oSHKyGwi8nowdVmnwmAT4kb7ro6Z1A74hYDqsRQjW4PC4Cxarcxq8", + null, + "ed25519:4PEddhHi6rrKjULmA5J4Sq5djmZ447CGuDQwUEhe2HNCxmLNWQ9njV7kxihmD4M5oidfvLvmdF7z9aDFfkzZBYfW", + "ed25519:5HVs2UR3Ba5ELFjHUmMVfww8M21K4K9wodqBHhXntuRk53GBZnLx8V8eqA5KVbSCJeZZktoeTyqMT9Pa5jMaCKHW", + "ed25519:31RMTcGQ546gn4MXUyytA6ugo1pKXVMa77cVMWtzMLHb6kQF4cPw4gdVE5B69waSaL1GzBtN7Ra7PMDgsMWoN8D6", + null, + "ed25519:vCcvHzko2DqtAtgPeodUzQ3ctemmZKwva5N6xroMcdxYW4CYiG4cgjseq4C72kGuoo1fmt8AQV1HSaG6wd7xeLA", + "ed25519:4Gpvq9SWy6ARfNKHMw6gEC6AmF1EMqXUbdkKW1tGGpw8ySrrPw1ZqFfqAVCyVueteZBgQLp7MSsiBp2v97Z3M4DV", + "ed25519:3Wn5NkmKk9RA5moGFTr5oW5QvHyF3fCnMVjDXDPi8WhwsgHQ9oEHpGpiFkpKKuJj1hTgeP4Yo76w1Nyv2Ya53XFt", + "ed25519:5nGyhoz9wwJJwaDMGnBN3fpxaMVNzSeBrTx2F1v6R6nTRS3Fd16vpGCezCr2r8BSzCMZDrTAqqXb62HeyXZGZbpj", + "ed25519:2WGZQemboLuyCrqoBKAD4GEGkWXCAo5SoN8z5oNzrNHJewesycHwrvoSuw8mmMSPBUQutqnowMtMxsPbgmJnxTpx", + "ed25519:5EzFyykbaPjWrkPRgE5CWkLSkKrA2PGkfPucSJDB4Tzw5VETAS6TuusEAD9TVH9zpHmWvQ6qcxHMgD5ycUKWXsuu", + "ed25519:4Qrtz6NqwegmRV3KWMKVXPiPQ2xJGKyVLwTQZ5gRipHUVaU6ovtoCh2Knk5rLr3BthZumWXYzbQiumS3Adq2GZWA", + null, + "ed25519:5sMjvdios6LjjCGiU2MMo7fjjkchJuxTwXroKWGD8jkzqFqGjyb1tEiD24sbHtuGdW1DTKLFLGzvLqKrexmf3vU8", + null + ], + "inner_lite": { + "block_merkle_root": "ExTQ1q1HvfPZy7BehiR8JmgwUd9j3DTzHrTPmr6r9scd", + "epoch_id": "5h3PDeeRRQjgyNvzbKepLcBJT3jWJdhu662LzfJGC8ub", + "height": 86716292, + "next_bp_hash": "ALsAx1zoiwiCvcJoSrNuGbtTk3XcUcXdMBGaZAW9C36m", + "next_epoch_id": "BCC27fXZwLaqs3MmuhvVfiSHtHjSw2y4zQfP6RTCT2QS", + "outcome_root": "EwkVmmLtfMwR29qGPUDVAEVPJZFPWjqTGBGpYDxLSja3", + "prev_state_root": "8NnmP9ZsBesVgrLwWbLTNVGp9T8NK2oRcBLAsL7eZsCp", + "timestamp": 1678142413035318546, + "timestamp_nanosec": "1678142413035318546" + }, + "inner_rest_hash": "49Jsd8ULPst4hPqn9gLV42pncN2B73Xgab18S4BRARMt", + "next_block_inner_hash": "381NRbYEm7wo1miWJhCvyGFC7WuMyhTJkDP62rrPmm79", + "next_bps": [ + { + "account_id": "figment.poolv1.near", + "public_key": "ed25519:7RjyY1bRKDqkshbKZtgpQdwsdxou8j9my8g1hPKZ9ngM", + "stake": "39206129243863608141066930499972", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "staked.poolv1.near", + "public_key": "ed25519:3JBVXqenru2ErAM1kHQ8qfd29dCkURLd6JKrFgtmcDTZ", + "stake": "33419809779120392920269809612199", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "astro-stakers.poolv1.near", + "public_key": "ed25519:2nPSBCzjqikgwrqUMcuEVReJhmkC91eqJGPGqH9sZc28", + "stake": "27294688224403596819807905373855", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bzam6yjpnfnxsdmjf6pw.poolv1.near", + "public_key": "ed25519:2ZJqaaCAisK4u8E2i611zFfvNmrvevovnU3M7SpGHkLY", + "stake": "23416062305792484840940844551487", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "zavodil.poolv1.near", + "public_key": "ed25519:HHARoU1hANWF9hu7YRstDDvgyigBhUeUuqecRVr8dpUz", + "stake": "17630216582180625016114945099933", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "binancenode1.poolv1.near", + "public_key": "ed25519:Bb7uPEocbsiQwRfPmsiiiM88DodtuYnBDi6dKZ4JZo2N", + "stake": "14048896105546755595738737008478", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "yes_protocol1.poolv1.near", + "public_key": "ed25519:4bnrmHSMYkvsgjbQSaCY3AFwrfS1w17ACEUQdn7aC4iT", + "stake": "13632840600753345981723601120095", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "staking_yes_protocol1.poolv1.near", + "public_key": "ed25519:CVVcLtfAWj6k1DqKJwhYBQwjMQFmXzFY2NBdMxp1RqL1", + "stake": "13548114501459907012425142831555", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "epic.poolv1.near", + "public_key": "ed25519:68HExKDtw1CjGzopZ8fMAMhMSZRVKRhwLzLQmGKtFNzT", + "stake": "13361490946637633806027080459531", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "electric.poolv1.near", + "public_key": "ed25519:GpSr5KAZMZ1Cb4dHMRUVhmp95y2fmWtm4dEjAr8iAva5", + "stake": "13094194582706200726499022124313", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "aurora.pool.near", + "public_key": "ed25519:FZKXoWHFCXMrKiXjAKFdHo5g9PDom4bWMRFERBfufi2Y", + "stake": "12455530195608719577803023115066", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stake1.poolv1.near", + "public_key": "ed25519:7EiVt9i7SmULDKEnAXBFSMzwUmZdxUYDFkP73MZuCH1h", + "stake": "11723004342951596666411372180029", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "sweat_validator.poolv1.near", + "public_key": "ed25519:677kArWPFPRDgWEBHqHj6BCmEdTVBsAcjQAc75Gtyq2j", + "stake": "11061535470684271849484334918122", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dqw9k3e4422cxt92masmy.poolv1.near", + "public_key": "ed25519:EPNc2bHqRCz6TKLstNiusv9qZCRBL63zViwUAcgoZJZj", + "stake": "10479308296906700818189011839258", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "future_is_near.poolv1.near", + "public_key": "ed25519:F3vEGwYYGisaXwKJWrYgorB95DfArDby8bK5wydxD5fp", + "stake": "10309322520727981661721876402207", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "rekt.poolv1.near", + "public_key": "ed25519:FoAaUdVKEHtVokG1aVmJNou61YcfQhXmaZ5Hnfsz4fHC", + "stake": "10079667782041637158777028934416", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "kiln.poolv1.near", + "public_key": "ed25519:GAekByYrSuo3seuaGQx7V1ZTC3gWZY8JxZJ4aWW76LiT", + "stake": "7980652394651037069871965079140", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nearcrowd.poolv1.near", + "public_key": "ed25519:He7QeRuwizNEhBioYG3u4DZ8jWXyETiyNzFD3MkTjDMf", + "stake": "7002893129834998728551934925199", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "finoa.poolv1.near", + "public_key": "ed25519:62gxgzoie7FiK9dnWuiwM1bbuvhpceYDavK7SgdfEMJc", + "stake": "6862544459467539008922458111228", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "d1.poolv1.near", + "public_key": "ed25519:7ZhMRwnSHGJtWjGBZiRhhSi6XyqKeNHtnEXsVTNdrsk6", + "stake": "6522886931909028877795116092724", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "continue.poolv1.near", + "public_key": "ed25519:9rDZywYL3tnvzj6hnePw3MaPFPfSeSCLxBp1niTGbMaK", + "stake": "6418629997062742180813621956876", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "anonymous.poolv1.near", + "public_key": "ed25519:Hoj7LbPwNwAkLFhf8z2aDF1BG6NDSrq1BfkdaKqPfbXx", + "stake": "6271712752150531999559361269851", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "hashquark.poolv1.near", + "public_key": "ed25519:3YDdmN1vhF7yAWnYxGMHY46jcLE9h11HvEeF6Kntugeq", + "stake": "6176316778768669484263610930775", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "foundry.poolv1.near", + "public_key": "ed25519:5Qx8Fq3SK4Vu1sRRpf2HsNGLAqdNqgkKEebHMniLWhkW", + "stake": "5925879216899098565250728067432", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "near-fans.poolv1.near", + "public_key": "ed25519:AgV97ssnHm7qN8JhYZjwyDtuaT6Ms3Fgbw3WeAC8M3iF", + "stake": "5646665045313893189005647236282", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakin.poolv1.near", + "public_key": "ed25519:85UGfKdVoxX9u86JsBMxmVHBguYonnM3vTR2WoD5GkEg", + "stake": "5583623315375786166458286896325", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "neardevgov.poolv1.near", + "public_key": "ed25519:FsZH8qQGfHRxFUbrK5pCEDgN758ZmqUtcUtYRWWGCcAG", + "stake": "5554866332371942354526927649509", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "hb436_pool.poolv1.near", + "public_key": "ed25519:7oU4C3vWqkeup7aMfjyV1ojt7yKX7ShLfvNCahBRy1eW", + "stake": "5396966930657509205043842792722", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorusone.poolv1.near", + "public_key": "ed25519:AZwJAgu2qRxHwdpj8ioZEFGcc2jbaZGN7ZvUe7CuXtM7", + "stake": "5287147598217926353386779299664", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "08investinwomen_runbybisontrails.poolv1.near", + "public_key": "ed25519:C6yqxQ3suwjmm8ufG5e3BsHiwxUs9h839FCneF41V7TM", + "stake": "4857774634147130373813689246471", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "p2p-org.poolv1.near", + "public_key": "ed25519:J441YAvvYvjWs3aVzjc5KLLWRzmhQTEMaymPyWFkMGeG", + "stake": "4723790666044236105496108137009", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "northernlights.poolv1.near", + "public_key": "ed25519:7HXh6iS9Rh92Uj1c5T9fPjQXPLnti4Rr2cJQcJEYpdGV", + "stake": "4712387224906733281947973541174", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nearfans.poolv1.near", + "public_key": "ed25519:GM8vWM4TqTt7jh3sXYCAs2KPyn4vEmAceteBGEFYhyku", + "stake": "4710423887240747307183606599570", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "everstake.poolv1.near", + "public_key": "ed25519:4JLvwa1r2eAxHLyKeDJnpqMG5f2Z9rr49rwuTwb9g8u2", + "stake": "4623315567330451805820491717070", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "openshards.poolv1.near", + "public_key": "ed25519:4Xm73PiAGMZu3mZg4gF7j96iTAFHGbPvqzxBaTgKP4ub", + "stake": "4611959073339809590025288736983", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dokiacapital.poolv1.near", + "public_key": "ed25519:FGcJJeWMyx1xDbfkcPM2oMeUeGaADJuPmeqx5rjsHn7t", + "stake": "4332759036466228308554905977698", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "accomplice.poolv1.near", + "public_key": "ed25519:5ck255MtkoGQxh9LfjNtdb4M7WHkUmjU7SBJCEkZP2B7", + "stake": "4266120587684739122299552723543", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "cryptium.poolv1.near", + "public_key": "ed25519:5Y9hW8cKBb5RnsJBqttHHC5ujz5zcZZ5xnrJPwkCWmGQ", + "stake": "4227791919561939934282903484058", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "blockdaemon.poolv1.near", + "public_key": "ed25519:3GNFSJiFQQ1rnR68T4eZRff2omPhg1CTewUHBJpQAdyc", + "stake": "4197683971126897677552917113311", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pandora.poolv1.near", + "public_key": "ed25519:53N7KBhSkEP6tLuQmxZV9fAK16D1C2kWnuzes8KNyS7P", + "stake": "4146080022605167207664031127947", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bisontrails.poolv1.near", + "public_key": "ed25519:Emk6wQJtpQZRJCvvPmmwP9GD2Pk37xxRpmb5uRvJpX62", + "stake": "4038512909923817748075892748374", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "smart-stake.poolv1.near", + "public_key": "ed25519:A6wpkLQiYqPZ1rbd9s5S1Bg3LxccVsQqiCRDUXwzJ6Hx", + "stake": "4003234307493046391337326649739", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nc2.poolv1.near", + "public_key": "ed25519:He7QeRuwizNEhBioYG3u4DZ8jWXyETiyNzFD3MkTjDMf", + "stake": "3869238705002385060975735647681", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "ideocolabventures.poolv1.near", + "public_key": "ed25519:6NFuvrmnJiokXibR9Z7TUHjB4NJnD1rJAHhBu9JWmBdh", + "stake": "3771051905041496783453388460098", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakesabai.poolv1.near", + "public_key": "ed25519:6abauNvvWnEkagjVpWRy2tZJdzPkmqurUjteMTKk5KQF", + "stake": "3535334314397193862153015712370", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "buildlinks.poolv1.near", + "public_key": "ed25519:Hd3irGt4zEqRPAzcFszX3oTkVWRFFxdecDvShCJSS1Wg", + "stake": "3526372164342614084796298814676", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "sharpdarts.poolv1.near", + "public_key": "ed25519:9XMHXqv7rM3QQxzjUu7dfKD7GhMkq8CEceaPdkhiBQUX", + "stake": "3434848476944224053624702383467", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "consensus_finoa_01.poolv1.near", + "public_key": "ed25519:3LqCGkM3uLjQjPmd3yVyaEnceinEL4cBfUm9vp5hJRTJ", + "stake": "3210187970648326218235433796250", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nodeasy.poolv1.near", + "public_key": "ed25519:8mjespqqUePSYSsxYxPqCUsZUuMxVJr1vjBRwFeCke5K", + "stake": "3175117754588187183467391312105", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "consensus_finoa_00.poolv1.near", + "public_key": "ed25519:62c41nzrrZAspLnPBC2A112PXBhJuj1cGkVE3ANwbzat", + "stake": "3137487132332056735962851894070", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dsrvlabs.poolv1.near", + "public_key": "ed25519:9SACdsDDgXA2WZLfJvpkKbu22Exxtc4CMbeHmVnN2P4a", + "stake": "3068789867106978388439487819348", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "lux.poolv1.near", + "public_key": "ed25519:HzTGTDfTz63QGvvUdMGozFeaENFGyYAoSrqYJb23qZFN", + "stake": "3028423991046584165619348124538", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "lunanova.poolv1.near", + "public_key": "ed25519:qkfP4NsSuHybdLhdvvYQ2Y9xWPsd249thEvrzbJBKNc", + "stake": "2870316617608351013129493882339", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "brea.poolv1.near", + "public_key": "ed25519:8dce49J5G28yMGRcSiDnYNFh7GBSma8TmYaw5mGTSH1Z", + "stake": "2761858870237463180720625792343", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "zkv_staketosupportprivacy.poolv1.near", + "public_key": "ed25519:2kAo86DW8mDaLDg37rFhQY8UYSZVq1CtegUHBEDvpSMA", + "stake": "2689727012142129963731924151456", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "baziliknear.poolv1.near", + "public_key": "ed25519:E4LAWdgLifBEoaWvhRNy5vpdAnUc3GsUHePeiAurZY5v", + "stake": "2688388636772692288448305121899", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "erm.poolv1.near", + "public_key": "ed25519:88nnN6LAuCbJaj9wucd1WUMfTtdv2s3njpvozHft8oQ5", + "stake": "2535798066743341414045251252289", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fish.poolv1.near", + "public_key": "ed25519:27KegJd17HeXHk9h5MqkT35QAuvYvo5GFgPTpSVU4kPN", + "stake": "2359349916980152012597982756209", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "01node.poolv1.near", + "public_key": "ed25519:5xz7EbcnPqabwoFezdJBxieK8S7XLsdHHuLwM4vLLhFt", + "stake": "2330998910140068045131278690848", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stardust.poolv1.near", + "public_key": "ed25519:6rxCJpTnrT6NFuGg6d5Dj3FEUz1ScNU9u35ywB3dYhrX", + "stake": "2179193523704935865995375845863", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "republic.poolv1.near", + "public_key": "ed25519:5sT6xtwxvLARW6y3KURYmyFd5SokJFhiK4jyqbamzzZ6", + "stake": "2124651577543740701890267481063", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "moonlet.poolv1.near", + "public_key": "ed25519:GkDwzPckMfhkdYgyFG69Uph8RJ12BcV9xNeZW2q93ZJD", + "stake": "2060503312099452529479997679460", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "allnodes.poolv1.near", + "public_key": "ed25519:AGEeyukQdMtg8EttsU39YLgryhao8yQeVwQTut5bbWdL", + "stake": "2041189719996971478342261526212", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "masternode24.poolv1.near", + "public_key": "ed25519:5ZyaXsGCya4Sch5bqUfohvo7iRFYB9ancRouggWRsiDU", + "stake": "2013012692631849510294424733258", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "legends.poolv1.near", + "public_key": "ed25519:DNK46DeHKeJPF9YetmNxZnqtpkeLjdUb9ezSRCue3TpB", + "stake": "1968963206127000985432877551650", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fresh.poolv1.near", + "public_key": "ed25519:6YHLXhohY8kMnkp5Jw4HrJ52xtdyt1rcP6AaWkKzh3ED", + "stake": "1908553262368274972364412463603", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nearkoreahub.poolv1.near", + "public_key": "ed25519:HUKmMJ59Hht8rcGG6uZ9M4qWsfbTCDtBgyV93YZnPXGE", + "stake": "1811363932350908894826349268172", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "inotel.poolv1.near", + "public_key": "ed25519:DmEDRntb9NwfbfdvDf6wzjsw1vxzQcJAAhFL2J75iLwr", + "stake": "1783140530783276198612825703651", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "appload.poolv1.near", + "public_key": "ed25519:6LbMVL6otkvZbpuC9sN3z7EXSMo3PT9noPeBdBZTFneM", + "stake": "1777016586059857984166086383996", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "qbit.poolv1.near", + "public_key": "ed25519:5DqZLnDu6PMEyhJzc5NhiMsoWeYMWG1bC4AULyafoXMv", + "stake": "1652745895856216988922137332983", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "jazza.poolv1.near", + "public_key": "ed25519:EW66Fkv7XcE9FiybuYtVURjHhYeEgwWWpzF685Vi7foY", + "stake": "1600810581770426565414413340826", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "avado.poolv1.near", + "public_key": "ed25519:FdLWsf42e3Sc7bdKMtxJMgWRP21ysZDSXFnS2vTwTaaA", + "stake": "1505671712920196582626546247266", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "satori.poolv1.near", + "public_key": "ed25519:9r8HYmw8mbys2Ng9BaKeQqZnaQTGCcBUbMatV5NeeWJj", + "stake": "1505563874806956005096650532342", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "ledgerbyfigment.poolv1.near", + "public_key": "ed25519:4JJTNeMaSb8W3NELh2rkkrDCqG1VpM3gdJ1hc9HFTBmN", + "stake": "1378902973337960064375143109943", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "atomic-nodes.poolv1.near", + "public_key": "ed25519:CpVAHE3JpfDoEPqjBDgYEjgG8JhM5BFKbjUD2N1EuvAL", + "stake": "1320330340013835475473012378960", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pandateam.poolv1.near", + "public_key": "ed25519:Cu83NRziNLiT6HLu9kJ8svFoftZQ9wVmjScxjqCybppt", + "stake": "1319203644166316104758512034128", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "staking_sp2.poolv1.near", + "public_key": "ed25519:CS4uHAipvtxGz9irnoCX7SxT6d8zKpDj8Y3Fyf2zVgBp", + "stake": "1189875320275820429094732822094", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nonli-near.poolv1.near", + "public_key": "ed25519:91jusDFxjY32h51tfq2HoKhoPbGs66s88t1v2oZPBSxC", + "stake": "1185432705606468385332754514200", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bridgetower_v1.poolv1.near", + "public_key": "ed25519:AHgnnt8yhNBpoZChBiHXfjaH6X2zMZaDDXmmSWHvDcWL", + "stake": "1035663254387646835799962119440", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakely_io.poolv1.near", + "public_key": "ed25519:HWp9E3gP91s25ddMS9xUWuzbJUpVGiPoitu5bT6hqMHs", + "stake": "1021258364486646824071027357415", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "calimero.pool.near", + "public_key": "ed25519:7A9aFJtr9yWh5eyAUUUSdXMoxzi1qBjshiVCjsDWWa1J", + "stake": "1015874783766921089538649131256", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "staking_opp_disc.poolv1.near", + "public_key": "ed25519:8XbCfLQVSwtwaBajvByG87CxPPbaFdryz5qEkde1fSGv", + "stake": "945252783112950401552190350991", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "galactic.poolv1.near", + "public_key": "ed25519:GFK83N32DbERtFg8rkpfNBsKtkFpmNQzyKFM9kJvPCMG", + "stake": "831246120998540891354298874477", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "cryptogarik.poolv1.near", + "public_key": "ed25519:45zFAC8pLgwn1d5pSBpBHesWbzngfRgd92zaom7K8m8j", + "stake": "828004032171300648370990744344", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "optimusvalidatornetwork.poolv1.near", + "public_key": "ed25519:C3CJMKaWdEzkqyNCKwnKud6wDNnzs7Ura63k16zm4LUU", + "stake": "801755793868841694119971272782", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pathrocknetwork.poolv1.near", + "public_key": "ed25519:2iJQLVXubWafG7K1NzGVvjP54UJCgVg3cuPMktw8r7uQ", + "stake": "798288406254751164539305822812", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dexagon.poolv1.near", + "public_key": "ed25519:AQHwptR3Ho348BpFXJDjkxpWMW5ZwN7xWM3XWAWSEEgs", + "stake": "781119997524930787753273551265", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "staking-power.poolv1.near", + "public_key": "ed25519:42ikqyV1BYmSnhHJ9EsLLy9kgeAg1mC3qqU1AJGaTEaW", + "stake": "739158259862982574010823948092", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "infiniteloop.poolv1.near", + "public_key": "ed25519:9BUwtDegzwKcmJBjLgUDLHc3pePgPKcWJXYGcZb33Nyr", + "stake": "694945966749165983829361965202", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "prophet.poolv1.near", + "public_key": "ed25519:BV5b4DpgCUy1TEitE4TVPhpTY7uDNpHc8DBPyH6cYCBq", + "stake": "671635020628939237380029587432", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bitcoinsuisse.poolv1.near", + "public_key": "ed25519:Cy2sboVqjDk6d3d2A2AJZBdFvokjk7sjZpYATLjcQSCj", + "stake": "664239734198440103401629427218", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "cryptoblossom.poolv1.near", + "public_key": "ed25519:5opTNJEkCBYuyMgAghY2Sxp4bBtXYQtbEvZ3Wc5Awohb", + "stake": "657665183791735436571718632241", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "kosmos_and_p2p.poolv1.near", + "public_key": "ed25519:41GWxdQHe4Y2fuisvz5k5G2NwDFEavRkisoZkB5tfJuC", + "stake": "636577548907797834502568994402", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "readylayerone_staking.poolv1.near", + "public_key": "ed25519:6AuBsxxSCYHkuJW9Rhf7HK2qYKErtThZUrN5HFDnQ9eg", + "stake": "627738918419591761430004629136", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "n0ok.poolv1.near", + "public_key": "ed25519:EC1p3w9hd4XkYoUiAKc8PSQGVFGiUXTDJvqkurRdAFz5", + "stake": "603091766828423031754951292758", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dragonfly.poolv1.near", + "public_key": "ed25519:6Gj8MRp9KqfdiXa35LJcZnqeBNNEZoYk6ysvpzHaruvq", + "stake": "573145205007582852162929757548", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pangdao.poolv1.near", + "public_key": "ed25519:C35kAQVW6MHoWtUZ599WHXamRXVZnrHMVD1q85FERiem", + "stake": "536104952358448307683904244716", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nearua.poolv1.near", + "public_key": "ed25519:6YRLTm4coawMYrchYs1ex5BLY7xtnPrnvGWgk6NJAQvy", + "stake": "471397693642001593493614085881", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "galaxydigital.poolv1.near", + "public_key": "ed25519:8ZD8CcSzSfVsYo7XyABHJsYcrpBE3EL5MwukoEfrNYMR", + "stake": "448811822469059379056147844225", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "grassets.poolv1.near", + "public_key": "ed25519:GS8uhr7mhsBWB5c1JgvsJzpwZDGrcnB9Xnw7YRyMSQP5", + "stake": "418986205174954907945983151920", + "validator_stake_struct_version": "V1" + } + ], + "prev_block_hash": "HrafGqcmmviAysiDHZypHiqj5W6Edr7QLUK2rkP6dCRA" + } + } diff --git a/fixtures/test_0.json b/fixtures/test_0.json new file mode 100644 index 0000000..30b103c --- /dev/null +++ b/fixtures/test_0.json @@ -0,0 +1,247 @@ +{ + "last_block_hash": "6taaeb6h2uJcuUvvmwXpYgagYvyHsFanWhm2ziGGHCff", + "body": { + "approvals_after_next": [ + "ed25519:VK3Hhut16e5agbePKPfsyrLVQRJGQwWamSRTRCQwJNFL7FuKtxfoPiRNbaYoEcUqSGvYNK8LXru4etnNtCQZyf2", + "ed25519:3AzJSuR438NiC53Rx2BqjcxxeFKQcXBPspJfTyQ5CAuSmrazNJ1vsXgub1dfJWGkLB9m7zD16AghdHbwyxHa3gwo", + "ed25519:4gFgfJefgLs78u1PfQckGstEbhLK1TCtDWCXUiYLHiXvGFVmPWgZbtU57DJbiLQqYkKUN2yfRohRTZA6w52TAcVS", + "ed25519:5Q3QdNsCa9j3siWQNAHXk4FTsiKntFwB1sFE4zUuM6S6gPx1cniPFEg3VfoShpVR9M9VPAr3AVfRmDFQGCvcvcKq", + "ed25519:2X1uEUuWGBF9D6FgK6GGXf3qVjeiqa4F4UzCatdtmRA6MPrePbv9W5AmGgaEePuYv81WytXU1xmfSGfaHhbpYyEt", + "ed25519:ftssnQfBCA8iEYLTcAkupddx82df53Hjm6T7qvD1ZWwmMF7CQDkKPxnBMC6CVL6wPrZX6Dsrz18RCTmyks3M7gV", + "ed25519:4d4kPwBhg27K8ZMC5A4MgVDu4kbKmZ6nMQUTQBfXsShGS5DwAyCks4f1jKWnbh8jW4bJERiJUWH4mhHStfoNNbgF", + "ed25519:3d3VNqdXZQyfKudgfAPmMr645Rn3RUxFNYsvsJJUkPmV75vbMYZyKLAGgXKNGUddtwawDrnRjbvJtaMwFraCSb4X", + "ed25519:63qxBKg1npU8SzanxtTZmz6BPQGoZyihe2rXko8DAyM9Kmxrg3xrQyoyk9yk9Mxa6kgw6HNTpPAEbSLVewzhzxB2", + "ed25519:124mNKfU8gHtMdCnhZMLfiREpy6Lh2ZQYLo1KJo8JThqQp4BwqJ4wMCGvDp7jcCBBfHWzXz1eqnZWMWFubvcZnXT", + "ed25519:4dq1ud5d12SNzcdGP2rFdJYH91a9FVGRteoRirNBudhz2LmiiEANqgfkB93SmxA7BuQRdKYkK42hbSNUPXdGQxWj", + "ed25519:4DozYNm9f9suvuWj87QfAMfquaEqJJpZi8cPMH8u8h3re9BMwbvu1RfVLZEaWziihwCQUJWV7Meiat5wfqj5FUt5", + "ed25519:5sp9Awt7UzzJGiJN3jMF2jSP5nxU2E1wC6PVoKL57XgTfmWkdxQUmNgev8HPZruMvVWRYkpW1dYa9hibRuPU9sQV", + "ed25519:29ByUDGKUE6c7rZA5A1nVaNK14Z6dHgMT6ejAnirvTgRci5EEmjUdJS69XES6Pk9VxeDTi1X19Hnnw67KPyQMHbC", + "ed25519:2Myim4fHvkaAJWpaeAavoF42nkvAqaTVixnav4v7fSPHFWgXLNM5L8FNZowzfBfKimu3juHSf5fNUtht7Y8ZU2oT", + "ed25519:4qNiUd6fM6aXRqBuda2Pvwjt5h3EPuvTrryXUUjoaz9c5Uh9Q2pYyY7k6ENC2RkNGxmTMzGKbhMmXQKpVesADcrJ", + "ed25519:2nBVHpagEujexVf3PJUkBxPdA7mWadZkKMmcZ3KyKNaue7ya7UrUB8yDUG9DoFkP5ZbYdZmkrdWDboFSUEMjB1ae", + null, + null, + "ed25519:3zWa7NL6WJz3MYgPGjKGf9eEAG4qCAdHwBmV3zuxAoE8RTQkhj91WnXfZd5o2TrtHQDJYKLAsaGd7EikiBar7Bs", + "ed25519:67Ph2NiNfr9LERQdRh25npY1xmimC9m1L1ofaW5jXuvbG4Byfp7WoC9DXrfWzjLuwK9tKS4oQLC6gLaHefVn5DiV", + "ed25519:3UbX3YBcyARb4CbtFRnzA25qRKswvFiLLgsZ8VAEjs7D1qoG75B7UpRh8aYrXK2U2WuFEkzLb9dQVRb7mzLUxjfT", + "ed25519:2wuLqd2ZNdTfHF367bzFXL7NV2Qk3m6YNEeCdMASnx1sUB4BULm3Q4WNF9ZGrAKSMAaEyxKGFA3tvyKDxoSk1wve", + null, + "ed25519:7mbR6ii13WLpPn1m259ym4k3Rb2DxbU8NKdo5VjaGNt2VnAqYojLW9gKa9HMErJP2bUPZTj9BsjGBCNjCZ1cDzx", + "ed25519:2UP2VsEcgSubk9AgKAHJ9pAM9imrF4Ms5rQvsPynU5w33HpjxHS7gzsakcdXq94SCgScTV3y6oU2SZ4PijKTmsKt", + "ed25519:3maB3cKsDSL7AJu8s3cmnJcpekjU93mhdnQH5UWTeLdDmEbnmZEHAewSBFqhCwFe5hHKgapKSV9VoMCRnwsgrVtw", + "ed25519:2KEVy7rQ6FK91yMc6mgF8ueP1vpr5c1eLBMxhn64nmtVzU5V3tQjD4jjrBQkTYD5eaGqvke2noTiU93DTHQzRU3T", + "ed25519:4wj8EycC9K7aQ8JpGTTrY5K2adqxZL76p8kvjjyKaqXip4dE9HwXRFqh7cTgy3sXbQvdJtxSZ64njHeDoWvJD1Ct", + null, + null, + null + ], + "inner_lite": { + "block_merkle_root": "3huzCnEQhgDDMWyVNR9kNbQFJ7qJGy1J4MBrCJAWndW9", + "epoch_id": "FsJbcG3yvQQC81FVLgAsaHZrMBFbrPM22kgqfGcCdrFb", + "height": 154654776, + "next_bp_hash": "AcNatyPz9nmg2e5dMKQAbNLjFfkLgBN7AbR31vcpVJ7z", + "next_epoch_id": "Fjn8T3phCCSCXSdjtQ4DqHGV86yeS2MQ92qcufCEpwbf", + "outcome_root": "7SYchEDbwawjP2MVfZ2GinP8bBQU1hKFRz34b2ZzG3A8", + "prev_state_root": "F2NNVhJJJdC7oWMbjpaJL3HVNK9RxcCWuTXjrM32ShuP", + "timestamp": 1705334624027402581, + "timestamp_nanosec": "1705334624027402581" + }, + "inner_rest_hash": "DZT9p28adyuiTSbUV5bsuPRxX9K7R1bag1AeUEMhm4bh", + "next_block_inner_hash": "DNCadyQPnQNYU3hA99zY2RfPQY4JpfRJeT8PewWpWQRQ", + "next_bps": [ + { + "account_id": "node1", + "public_key": "ed25519:6DSjZ8mvsRZDvFqFxo8tCKePG96omXW7eVYVSySmDk8e", + "stake": "51965991496563659315960459285056", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node2", + "public_key": "ed25519:GkDv7nSMS3xcqA45cpMvFmfV1o4fRF6zYo1JRR6mNqg5", + "stake": "51956315551249534697100259004698", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node3", + "public_key": "ed25519:ydgzeXHJ5Xyt7M1gXLxqLBW1Ejx6scNV5Nx2pxFM8su", + "stake": "51901364964498492263434600300098", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node0", + "public_key": "ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX", + "stake": "51807871317794349436390749741568", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "aurora.pool.f863973.m0", + "public_key": "ed25519:9c7mczZpNzJz98V1sDeGybfD4gMybP4JKHotH8RrrHTm", + "stake": "17889547137784368999057296757171", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "legends.pool.f863973.m0", + "public_key": "ed25519:AhQ6sUifJYgjqarXSAzdDZU9ZixpUesP9JEH1Vr7NbaF", + "stake": "16201913225042074278623061793112", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "01node.pool.f863973.m0", + "public_key": "ed25519:3iNqnvBgxJPXCxu6hNdvJso1PEAc1miAD35KQMBCA3aL", + "stake": "11170441638122498891243391338168", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator.pool.f863973.m0", + "public_key": "ed25519:93EQCbHLEY6cMuxDNe8LysWPy8zv5VsoqvHppMbMndpZ", + "stake": "10592433670906673196820699139628", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "kiln.pool.f863973.m0", + "public_key": "ed25519:Bq8fe1eUgDRexX2CYDMhMMQBiN13j8vTAVFyTNhEfh1W", + "stake": "7466078258914882102490404903558", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakely_v2.pool.f863973.m0", + "public_key": "ed25519:7BanKZKGvFjK5Yy83gfJ71vPhqRwsDDyVHrV2FMJCUWr", + "stake": "5536803167995073895287889871766", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator2.pool.f863973.m0", + "public_key": "ed25519:4BYnfLhhvNkcDe6U4W43uAqBXDaxM6DcN3YAbLKNUWSh", + "stake": "5302106052281372493614954324464", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator1.pool.f863973.m0", + "public_key": "ed25519:GSeKR7hJrgfBJ4FjS4GwQYaQzcVhuDun3PcjWZh4nGpT", + "stake": "5291814124144644904379619249839", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorusone.pool.f863973.m0", + "public_key": "ed25519:3TkUuDpzrq75KtJhkuLfNNJBPHR5QEWpDxrter3znwto", + "stake": "3830782869095601550208218306826", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "everstake.pool.f863973.m0", + "public_key": "ed25519:4LDN8tZUTRRc4siGmYCPA67tRyxStACDchdGDZYKdFsw", + "stake": "3424542869832679924363110810613", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "ni.pool.f863973.m0", + "public_key": "ed25519:GfCfFkLk2twbAWdsS3tr7C2eaiHN3znSfbshS5e8NqBS", + "stake": "3102526368747483216749759285501", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "foundryusa.pool.f863973.m0", + "public_key": "ed25519:ABGnMW8c87ZKWxvZLLWgvrNe72HN7UoSf4cTBxCHbEE5", + "stake": "2969728543420726431634300166705", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorus-one.pool.f863973.m0", + "public_key": "ed25519:6LFwyEEsqhuDxorWfsKcPPs324zLWTaoqk4o6RDXN7Qc", + "stake": "2699586772185217175436266507686", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "lunanova2.pool.f863973.m0", + "public_key": "ed25519:9Jv6e9Kye4wM9EL1XJvXY8CYsLi1HLdRKnTzXBQY44w9", + "stake": "2621112518848962964878885105004", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "valeraverim.pool.f863973.m0", + "public_key": "ed25519:3686ABqNUZc1qhLWLHg5xZpBzrWPiUCMNZxcCNmg3e2s", + "stake": "2470287532644478855780095683680", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nodeasy.pool.f863973.m0", + "public_key": "ed25519:25Dhg8NBvQhsVTuugav3t1To1X1zKiomDmnh8yN9hHMb", + "stake": "2422603751767713530958290540330", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakesstone.pool.f863973.m0", + "public_key": "ed25519:3aAdsKUuzZbjW9hHnmLWFRKwXjmcxsnLNLfNL4gP1wJ8", + "stake": "1884761660146474524590126573806", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pathrocknetwork.pool.f863973.m0", + "public_key": "ed25519:CGzLGZEMb84nRSRZ7Au1ETAoQyN7SQXQi55fYafXq736", + "stake": "1716080041579049406737178399888", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dsrvlabs.pool.f863973.m0", + "public_key": "ed25519:61ei2efmmLkeDR1CG6JDEC2U3oZCUuC2K1X16Vmxrud9", + "stake": "1582167714882447593375801170700", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bee1stake.pool.f863973.m0", + "public_key": "ed25519:B7Mwy3sCCJ6GZzEojsKFXMjLQfVXPDC4Q1LjuHoZcyM6", + "stake": "951628760427592588357858953323", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bisontrails.pool.f863973.m0", + "public_key": "ed25519:8g4P5EXyp2b2pfVMHY1QLfkRcY59hjPfWrFCKUWX3RmR", + "stake": "784322861457562867996710885838", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pennyvalidators.pool.f863973.m0", + "public_key": "ed25519:HiHdwq9rxi9hyxaGkazDHbYu4XL1j3J4TjgHQioyhEva", + "stake": "453985902267796464609404547243", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nw.pool.devnet", + "public_key": "ed25519:65XTtuthwFDL9LpK9FJystfEvJ6brtBpfYSnRMa5a2wN", + "stake": "351594742984477077395922766923", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "leadnode.pool.f863973.m0", + "public_key": "ed25519:CdP6CBFETfWYzrEedmpeqkR6rsJNeT22oUFn2mEDGk5i", + "stake": "222791099831338589442315274396", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "blueprint.pool.f863973.m0", + "public_key": "ed25519:DUfxa8EUaTQyVXgEm4NFCtiez7jsjbM3m838c7aRSEBn", + "stake": "138000501667279356740025791621", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "al3c5.pool.f863973.m0", + "public_key": "ed25519:BoYixTjyBePQ1VYP3s29rZfjtz1FLQ9og4FWZB5UgWCZ", + "stake": "113955994115662929112230612769", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "cymac.pool.f863973.m0", + "public_key": "ed25519:EzUKatz6stcg4pKA2HpwhQXhSDvef3Cxyo6zvsz87est", + "stake": "112838247651548890239554150501", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "a41.pool.f863973.m0", + "public_key": "ed25519:Gzg8dYaeBe6ime9dsMKUFiRZeWLjQ3VHjBCbapjsCmUf", + "stake": "55030000541997702601700000000", + "validator_stake_struct_version": "V1" + } + ], + "prev_block_hash": "5dbt6rh82Xx6nNG1PuKoQj96g4jnWw6cyb8HNWPPkVJE" + } +} diff --git a/fixtures/test_1.json b/fixtures/test_1.json new file mode 100644 index 0000000..59e84c3 --- /dev/null +++ b/fixtures/test_1.json @@ -0,0 +1,248 @@ +{ + "last_block_hash": "A6XdHk59MvQf3aMA4Fo4AbqFBRMrFTPkMzbK4xKi4Pyr", + "body": { + "approvals_after_next": [ + "ed25519:4iYR8JPp96vrgh4X7vJt6x4iXkcz8xNKzMzn9Zy9393grrahCNnpKUAFzfjynoa3pDaaFVH4TG9i3kC277GCqDh", + "ed25519:4JQWoZN6GwuXityiM9FtzutPSFT6NT4w9HyRVEHr77KCMASo65gg2WEbSxKr9b8hgKnxqsYtEnPURZo8158ZXgLu", + "ed25519:4miyB7FCbkEPARW5vZh5PkdjN2T3xU4kbdQTEJh34E9J94qQkNJxibw59cFkHYQ8p5jZNTJm8gqo2WRZ1C5MT5ys", + "ed25519:23sAhk87wCEk9y127pVTxzEHuPiPnhuGayqsm84ZDEssDZmmwBJV2AwgtJ8je7LLf3q5w58YH7ZdiCKRmRJVHU6y", + "ed25519:3Nxn2PXkn3ebBjeTggZtZxatCfVvBND5pK9JafrruEt4Mvm7vrTVb3wS5n6iiwzzgqPi2futbrrGg6hD159Tywcb", + "ed25519:4JDewsvjKo6b5qbi8TJT5QvG2oMDXjp6UGyD77cMiC9yBbpnsvqtqucT1ovWEZAejSEteTKh8MwTYNG4fqGxkgEK", + "ed25519:53ExLA4n8k8GPRtx9gyG3GAUkzVWMEMHfWP9JNxhfWnPvnFKdF4Rx7qt9LGMSxh6hHxPBwYrqrM2MJGiXTBBmU9g", + "ed25519:2b5RQYp2CQRC6Kde3Uw8gHpyPKbJJGHedBPDkPojFNddYDMU1xVxHe62RV3cUxv4pNr3GtC4ytdSzkjXyqXnUZWg", + "ed25519:Ck7SvjdBK6NshMJHHQ1mH8mTsRRXbxg9V9QdZF3MzyAZWv9sNZoovCyuSJQjJdnmZR41ZeYZhPMAYKa7rwii6ZV", + "ed25519:5T3eJwLWefGRpGKfMArKoY93nwgQbvN4tpTN5ETH7EDB89kpixn54k3HNR21hnwg5ZDuC4ZEPf97CCoWao5VDqmh", + "ed25519:5VeUZVNrTqqfyT6FdRukznT6AB8X8fR43Mv4aTPuNjneKpEXWeiPtWrQniQnaiz64CikMhi5K67FuuP48uDY62Ya", + "ed25519:45BerwL4v3JgXXcUnLAW3UAw8iTanQLo2okYbmzVkmSNB62GtmPf2PESEbgrd4jr3VNreb7oSxd7k3LAgNEV7Exn", + "ed25519:5tAqssJmXV6Fcy8T6qQ9W819om6c93Fmz5fk1iFDu2mnTw1bfYrNVPZxwbjNMxyU6EzSu4cjykBVmcGXm7EJtHr8", + "ed25519:462bhuLShbMmu6K8RkC6uc6fKmGmTzpC4iJcEqSdH5BS2q7sLmU2j2PWwAedg2Z8nXjVYRMCzci3FeYPZR8fkZK4", + "ed25519:4JMdzn7HHrkpZh4yvY6Cx9cyfHSE44tj8jABhty14WJccJTugomC8xDLQE6HYTuxgXrpVmS8Dz8oK3fzwMSZeWsr", + "ed25519:4yEHBfzWYhC7SSonhczffKvwWRJE5ViMXSkXpowAgZHbJMF2iKJtMfQk9jvf8XPWzsMj9W8eEBsmZfDLHVc1hyA6", + "ed25519:vhEsZ3bry9yHtLQjiWD6KZZYSfZp6Aea6zrDaF4Z8eJi6ESkaNzKksjrXRyroXWhbyZtQVTqJDtz44t6AJAA8D1", + "ed25519:4BqS5LjoEkS3CvvgfhgTiYsyoxTdg1wLYTUxyizENxpKUWvFVZPCeG4PTR7hGBth7nL1Duoh35bWr1Zhwnw5PwHc", + null, + null, + "ed25519:2QphJc3W6cuM9pKP3UJ1Rb31V3gfsNck4TrCkJesxQjTRD8vUoPJHRdmuNyh7x7uKEiy9Fm1nPzLdJUKvnpBvsXe", + "ed25519:4fjjCEvCr3Vd8kyjv1YYfXxZD3YcPmjxnEbeE4KdAA7pPip4FfbaAtv69rpguWP2YjQwRrW9rn6eVYvSXBFtVQJc", + "ed25519:4kGKNsRxhx3XzV2gapzpxfczyKyMxzsdWfUbDSZWRAbLK1965EKjuFXTqhhvHC5vS2L1MiYtHWDi9zwzDk8zYiyG", + "ed25519:Ff7Zj6HHHhLXfH8T3kKsQxJVF5EQLmLdTwBXtszLUaL3Um7qR1ZamXAxURXsK2cdgfbtpJkV4DwaH5Vx5VLZmow", + "ed25519:5gUPptJB6aDKJTELCVQBvK5DHAtPkMcMMSrEDTBdfkt7hGA9TmEbTcAyz1RSANRCzzUDphtMemD2VGLJen23yWpK", + "ed25519:274QMhhCkbkh6QpCQZ2q8eDGHMe7zoNDcun3GJPCgKnzfQ9e9hgndruuua8R5D68bTeEd3E5vsCzs3XgFdKYYkTL", + "ed25519:4tRmVgq11TpQgDKVuvj5RVRD7qFhrv8ztQRxPu6c8y4KfbE7xKGdPFEeG7UXWXruZFs1wrGKTu8HJyLrjVpWcDHD", + null, + "ed25519:4HvAS18pettmeiAinDe3ZoLTFLNjpRzUVmafqYqRT21RyGLxxH1cyTz5ER2h5U5PYLewCdkVNwEbXsfH56dqyiD9", + null, + "ed25519:3bCdULXmujMamQiwfNnkvVjjbLDedDNdr9Mpcp7zrSAp32ZC5QWMuPFAv8tG8QFV9mdT1Yk3K25NLe32x9EhwU8N", + "ed25519:XM5mNvN284AwzhT1BPs7MTt4UeESpvp73LyYg5ZXizKXJpo1j1xaQbh45Dru74qVP7uZp599Zbyo5reTe1bK2yA", + null + ], + "inner_lite": { + "block_merkle_root": "5geZEhgh6CExgjagwJ99fgQtf5Ej6dHL6WNJ7fNXgG8c", + "epoch_id": "Fjn8T3phCCSCXSdjtQ4DqHGV86yeS2MQ92qcufCEpwbf", + "height": 154697976, + "next_bp_hash": "HiGgVkmWFuvHdLaBCrp7G5Q9yzmSrxmyA78QhoVqHHwS", + "next_epoch_id": "FgBfwcG3XMnWBkqu3xbYH8Guju8iBNJHJcvxdHsL6svr", + "outcome_root": "2DoUX6XsDr5BxRN821ZxTLYYcQBzSSxPMTqMU4TLfu35", + "prev_state_root": "J28Pfz9gHzXsChqW2U5ArTcMkTc1ATx6duk7rynkTnHZ", + "timestamp": 1705361606832234145, + "timestamp_nanosec": "1705361606832234145" + }, + "inner_rest_hash": "2VFJq5AJCKnnai6mZFYtCyn1ZM6GmB4w5Rjy1StE7HXE", + "next_block_inner_hash": "FFUJkMD1wEQYLH3JBrhKGBCySXVvsp79zUBZF4ifyHnE", + "next_bps": [ + { + "account_id": "node1", + "public_key": "ed25519:6DSjZ8mvsRZDvFqFxo8tCKePG96omXW7eVYVSySmDk8e", + "stake": "51980883591416601010719726777959", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node2", + "public_key": "ed25519:GkDv7nSMS3xcqA45cpMvFmfV1o4fRF6zYo1JRR6mNqg5", + "stake": "51971204873229463484002611006028", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node3", + "public_key": "ed25519:ydgzeXHJ5Xyt7M1gXLxqLBW1Ejx6scNV5Nx2pxFM8su", + "stake": "51916238539076580840311339695332", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node0", + "public_key": "ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX", + "stake": "51822718099537070721488806689276", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "aurora.pool.f863973.m0", + "public_key": "ed25519:9c7mczZpNzJz98V1sDeGybfD4gMybP4JKHotH8RrrHTm", + "stake": "17895092803259114287724420293384", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "legends.pool.f863973.m0", + "public_key": "ed25519:AhQ6sUifJYgjqarXSAzdDZU9ZixpUesP9JEH1Vr7NbaF", + "stake": "16206556269879622555039863033060", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "01node.pool.f863973.m0", + "public_key": "ed25519:3iNqnvBgxJPXCxu6hNdvJso1PEAc1miAD35KQMBCA3aL", + "stake": "11173642795262854946815330034213", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator.pool.f863973.m0", + "public_key": "ed25519:93EQCbHLEY6cMuxDNe8LysWPy8zv5VsoqvHppMbMndpZ", + "stake": "10595469185547409447626687991414", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "kiln.pool.f863973.m0", + "public_key": "ed25519:Bq8fe1eUgDRexX2CYDMhMMQBiN13j8vTAVFyTNhEfh1W", + "stake": "7468217842007976196291671160040", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakely_v2.pool.f863973.m0", + "public_key": "ed25519:7BanKZKGvFjK5Yy83gfJ71vPhqRwsDDyVHrV2FMJCUWr", + "stake": "5538389871199320877264924449940", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator2.pool.f863973.m0", + "public_key": "ed25519:4BYnfLhhvNkcDe6U4W43uAqBXDaxM6DcN3YAbLKNUWSh", + "stake": "5303625497287173100081594363152", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator1.pool.f863973.m0", + "public_key": "ed25519:GSeKR7hJrgfBJ4FjS4GwQYaQzcVhuDun3PcjWZh4nGpT", + "stake": "5293330619752851761190952982195", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorusone.pool.f863973.m0", + "public_key": "ed25519:3TkUuDpzrq75KtJhkuLfNNJBPHR5QEWpDxrter3znwto", + "stake": "3831880671335147210435951074724", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "everstake.pool.f863973.m0", + "public_key": "ed25519:4LDN8tZUTRRc4siGmYCPA67tRyxStACDchdGDZYKdFsw", + "stake": "3425524339069666388552956739441", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "ni.pool.f863973.m0", + "public_key": "ed25519:GfCfFkLk2twbAWdsS3tr7C2eaiHN3znSfbshS5e8NqBS", + "stake": "3103415468246532541895473430716", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "foundryusa.pool.f863973.m0", + "public_key": "ed25519:ABGnMW8c87ZKWxvZLLWgvrNe72HN7UoSf4cTBxCHbEE5", + "stake": "2970579589997198167425850722035", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorus-one.pool.f863973.m0", + "public_key": "ed25519:6LFwyEEsqhuDxorWfsKcPPs324zLWTaoqk4o6RDXN7Qc", + "stake": "2700360401758961539837510871690", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "lunanova2.pool.f863973.m0", + "public_key": "ed25519:9Jv6e9Kye4wM9EL1XJvXY8CYsLi1HLdRKnTzXBQY44w9", + "stake": "2621863661185071626699112987798", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "valeraverim.pool.f863973.m0", + "public_key": "ed25519:3686ABqNUZc1qhLWLHg5xZpBzrWPiUCMNZxcCNmg3e2s", + "stake": "2470287532644478855780095683680", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakesstone.pool.f863973.m0", + "public_key": "ed25519:3aAdsKUuzZbjW9hHnmLWFRKwXjmcxsnLNLfNL4gP1wJ8", + "stake": "1885301783710511590471643861522", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pathrocknetwork.pool.f863973.m0", + "public_key": "ed25519:CGzLGZEMb84nRSRZ7Au1ETAoQyN7SQXQi55fYafXq736", + "stake": "1716571825486169408513188183201", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dsrvlabs.pool.f863973.m0", + "public_key": "ed25519:61ei2efmmLkeDR1CG6JDEC2U3oZCUuC2K1X16Vmxrud9", + "stake": "1582621122794136327048654501834", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bee1stake.pool.f863973.m0", + "public_key": "ed25519:B7Mwy3sCCJ6GZzEojsKFXMjLQfVXPDC4Q1LjuHoZcyM6", + "stake": "951901472501611026961984404965", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bisontrails.pool.f863973.m0", + "public_key": "ed25519:8g4P5EXyp2b2pfVMHY1QLfkRcY59hjPfWrFCKUWX3RmR", + "stake": "784547628028533758413173572394", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pennyvalidators.pool.f863973.m0", + "public_key": "ed25519:HiHdwq9rxi9hyxaGkazDHbYu4XL1j3J4TjgHQioyhEva", + "stake": "454116002760902808255722029483", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nw.pool.devnet", + "public_key": "ed25519:65XTtuthwFDL9LpK9FJystfEvJ6brtBpfYSnRMa5a2wN", + "stake": "351695500847678181284638315706", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "leadnode.pool.f863973.m0", + "public_key": "ed25519:CdP6CBFETfWYzrEedmpeqkR6rsJNeT22oUFn2mEDGk5i", + "stake": "222854945937138358386550711453", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "blueprint.pool.f863973.m0", + "public_key": "ed25519:DUfxa8EUaTQyVXgEm4NFCtiez7jsjbM3m838c7aRSEBn", + "stake": "138040049008009637755493563288", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "al3c5.pool.f863973.m0", + "public_key": "ed25519:BoYixTjyBePQ1VYP3s29rZfjtz1FLQ9og4FWZB5UgWCZ", + "stake": "113955994115662929112230612769", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "cymac.pool.f863973.m0", + "public_key": "ed25519:EzUKatz6stcg4pKA2HpwhQXhSDvef3Cxyo6zvsz87est", + "stake": "112870584143910008966689700738", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "p2p-org.pool.f863973.m0", + "public_key": "ed25519:5qyxefArHQfABdNv9ELuEiWcEo7DTzABM9LrMAKTCY3Z", + "stake": "100198001398444504508422270154", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "a41.pool.f863973.m0", + "public_key": "ed25519:Gzg8dYaeBe6ime9dsMKUFiRZeWLjQ3VHjBCbapjsCmUf", + "stake": "55030000541997702601700000000", + "validator_stake_struct_version": "V1" + } + ], + "prev_block_hash": "ATa5K9ofmjtLXsgkp2VNQhALi5hgJPmojMVQ1MtYUa8e" + } + } diff --git a/fixtures/test_2.json b/fixtures/test_2.json new file mode 100644 index 0000000..3e55f48 --- /dev/null +++ b/fixtures/test_2.json @@ -0,0 +1,235 @@ +{ + "last_block_hash": "EAUfcEw9BMjf1TqwqprD5rcMXbGrXmjdmmihLWEYbigA", + "body": { + "approvals_after_next": [ + "ed25519:EjkN3ekQRFPnAW9MFjTGE7ntb6V16spgMB6YYnejRzs6mzfbp6UB4ELHUR7tezZZyVL7AgAgAHwtHPBnJC6HHFf", + "ed25519:EPFUZAu9SXM8rm3JQMZdY4tF4nicUH8zPEdVnF96ukAZpHwFeUQKDLmrrWjopA95FhykvQTmuQUjYfNLTvDeXYi", + "ed25519:3uVsabfdcWDPeRK6yCinDWXonXxWhu6qv1MAHMHTYYsB6tcFCi3GLbdsddcdmTg2sDCbJUpkfwC51ZbUB7QATzx7", + "ed25519:fjdgPLhjDaLKQaUvPGuRkaAwUxFKA9rgkDT8uRQCqtts8oM3ZyS6gmkz53x3VLBFoWWDyM6aZCXQCvakpq1eEAe", + null, + null, + "ed25519:4kxomt3EQriQubccMgnUg9eQ5nkM7z4Fb3suA3nKQVc3D5P9HkvzN6wF5zEkvvG2TUELFDrCckbuLGFb38N4zDQc", + null, + null, + null, + null, + null, + "ed25519:5FVqGn2MK2CAWtzJmhPt9XktRvU9d6KNJ8BGST55qoKPJ9vZzADBDcW18iXHT8HqWixqBDLm5f9M46z2RSZoA64Z", + null, + "ed25519:4SHM7cVMmtpWcrJRcVLL5SU14WeyEpHGSEuvaU4hnr3NypKyekv6vMWdCU4DTTR6BoQjhYvtWXeqqZtMvPsJ9j7s", + null, + "ed25519:34EDE41YUxvrS6KSBkvM6VRMHzempoYawFt1bJrGLD9KRuYWJCJBQmt6axJuwh49tLpYMe4TCqw6Sq5C5kdDVzjY", + null, + null, + null, + null, + null, + null, + null, + "ed25519:5cEY3iPBcoooFKMds1zubY23yvfCaCARBm43Qv8xMrTuH6iPUW1Wjmvf8kc5SdC46HzBjYRXueZEURZuSQ5oeXnx", + null, + null, + null, + null, + "ed25519:5Z18ZBq9iQ3m6cZ8R3fsZ5ipJU81rqMmHnipstRfTX77AJshFCBpP8TxA8fK7aN44nrHdabncCJ9jFo6msWTzCnW", + null, + null + ], + "inner_lite": { + "block_merkle_root": "4Bo6a89Pr9AmKqBF54PExQ5J6QnuMgmac3SooXftFirj", + "epoch_id": "FgBfwcG3XMnWBkqu3xbYH8Guju8iBNJHJcvxdHsL6svr", + "height": 154741176, + "next_bp_hash": "2bg8kQAwnTYZetw6BRpWBvw69BSF9WE4Zws2bQgNyNcm", + "next_epoch_id": "EPpSEMnWuzHW4aTQ5hfAbkG4EyT8z7g9JvnUZH4yQFS5", + "outcome_root": "7Ntnzqbsmgg5g4vKGfyzR19ZswdXriYXzhzpCJgR89Zz", + "prev_state_root": "7ynM1RWwXiJtEVqFi9Zjn54FD9j7qU4wDNcBRLs9iPSu", + "timestamp": 1705388244771412430, + "timestamp_nanosec": "1705388244771412430" + }, + "inner_rest_hash": "VF86i5AC81TCtEfRfG1m4tZCz5DGt8FUYbiVfjajk4D", + "next_block_inner_hash": "HPX8ijJhWVtLh3cSupas2vudKFAZefvufA6zpxv5zoem", + "next_bps": [ + { + "account_id": "node1", + "public_key": "ed25519:6DSjZ8mvsRZDvFqFxo8tCKePG96omXW7eVYVSySmDk8e", + "stake": "51995849873243611939132459599779", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node2", + "public_key": "ed25519:GkDv7nSMS3xcqA45cpMvFmfV1o4fRF6zYo1JRR6mNqg5", + "stake": "51986168368370021532730821376618", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node3", + "public_key": "ed25519:ydgzeXHJ5Xyt7M1gXLxqLBW1Ejx6scNV5Nx2pxFM8su", + "stake": "51931186208367497781029863589354", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "node0", + "public_key": "ed25519:7PGseFbWxvYVgZ89K1uTJKYoKetWs7BJtbyXDzfbAcqX", + "stake": "51837638842520506321820685079720", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "aurora.pool.f863973.m0", + "public_key": "ed25519:9c7mczZpNzJz98V1sDeGybfD4gMybP4JKHotH8RrrHTm", + "stake": "17900245019402583650133465073632", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "legends.pool.f863973.m0", + "public_key": "ed25519:AhQ6sUifJYgjqarXSAzdDZU9ZixpUesP9JEH1Vr7NbaF", + "stake": "16211222444669702135933673463207", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "01node.pool.f863973.m0", + "public_key": "ed25519:3iNqnvBgxJPXCxu6hNdvJso1PEAc1miAD35KQMBCA3aL", + "stake": "11176821118717456771315953721266", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator.pool.f863973.m0", + "public_key": "ed25519:93EQCbHLEY6cMuxDNe8LysWPy8zv5VsoqvHppMbMndpZ", + "stake": "10598519821992269587094887938586", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "kiln.pool.f863973.m0", + "public_key": "ed25519:Bq8fe1eUgDRexX2CYDMhMMQBiN13j8vTAVFyTNhEfh1W", + "stake": "7470359030070502795722434017080", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakely_v2.pool.f863973.m0", + "public_key": "ed25519:7BanKZKGvFjK5Yy83gfJ71vPhqRwsDDyVHrV2FMJCUWr", + "stake": "5539984478778409079274412314443", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator2.pool.f863973.m0", + "public_key": "ed25519:4BYnfLhhvNkcDe6U4W43uAqBXDaxM6DcN3YAbLKNUWSh", + "stake": "5305152511612693872683364078590", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "fastvalidator1.pool.f863973.m0", + "public_key": "ed25519:GSeKR7hJrgfBJ4FjS4GwQYaQzcVhuDun3PcjWZh4nGpT", + "stake": "5294854669987962601093008353993", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorusone.pool.f863973.m0", + "public_key": "ed25519:3TkUuDpzrq75KtJhkuLfNNJBPHR5QEWpDxrter3znwto", + "stake": "3832983942424293301319485066620", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "everstake.pool.f863973.m0", + "public_key": "ed25519:4LDN8tZUTRRc4siGmYCPA67tRyxStACDchdGDZYKdFsw", + "stake": "3426510612590284723534740848915", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "ni.pool.f863973.m0", + "public_key": "ed25519:GfCfFkLk2twbAWdsS3tr7C2eaiHN3znSfbshS5e8NqBS", + "stake": "3104309000394639023138702227876", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "foundryusa.pool.f863973.m0", + "public_key": "ed25519:ABGnMW8c87ZKWxvZLLWgvrNe72HN7UoSf4cTBxCHbEE5", + "stake": "2971434876176689081354111194088", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "chorus-one.pool.f863973.m0", + "public_key": "ed25519:6LFwyEEsqhuDxorWfsKcPPs324zLWTaoqk4o6RDXN7Qc", + "stake": "2701137886711820880744418684468", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "lunanova2.pool.f863973.m0", + "public_key": "ed25519:9Jv6e9Kye4wM9EL1XJvXY8CYsLi1HLdRKnTzXBQY44w9", + "stake": "2622618545437785136715521089346", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "stakesstone.pool.f863973.m0", + "public_key": "ed25519:3aAdsKUuzZbjW9hHnmLWFRKwXjmcxsnLNLfNL4gP1wJ8", + "stake": "1885844597972525233055555116008", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pathrocknetwork.pool.f863973.m0", + "public_key": "ed25519:CGzLGZEMb84nRSRZ7Au1ETAoQyN7SQXQi55fYafXq736", + "stake": "1717066059294035141561843218976", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "dsrvlabs.pool.f863973.m0", + "public_key": "ed25519:61ei2efmmLkeDR1CG6JDEC2U3oZCUuC2K1X16Vmxrud9", + "stake": "1583076789418337934155466345470", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bee1stake.pool.f863973.m0", + "public_key": "ed25519:B7Mwy3sCCJ6GZzEojsKFXMjLQfVXPDC4Q1LjuHoZcyM6", + "stake": "952175543126836190103726170469", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "bisontrails.pool.f863973.m0", + "public_key": "ed25519:8g4P5EXyp2b2pfVMHY1QLfkRcY59hjPfWrFCKUWX3RmR", + "stake": "784773514321136890208157331616", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "pennyvalidators.pool.f863973.m0", + "public_key": "ed25519:HiHdwq9rxi9hyxaGkazDHbYu4XL1j3J4TjgHQioyhEva", + "stake": "454246751367119221511607975024", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "nw.pool.devnet", + "public_key": "ed25519:65XTtuthwFDL9LpK9FJystfEvJ6brtBpfYSnRMa5a2wN", + "stake": "351796760649730627846279409552", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "leadnode.pool.f863973.m0", + "public_key": "ed25519:CdP6CBFETfWYzrEedmpeqkR6rsJNeT22oUFn2mEDGk5i", + "stake": "222919110100903924760392563095", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "blueprint.pool.f863973.m0", + "public_key": "ed25519:DUfxa8EUaTQyVXgEm4NFCtiez7jsjbM3m838c7aRSEBn", + "stake": "138079793355047795768517097405", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "cymac.pool.f863973.m0", + "public_key": "ed25519:EzUKatz6stcg4pKA2HpwhQXhSDvef3Cxyo6zvsz87est", + "stake": "112903081724858326049928307120", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "p2p-org.pool.f863973.m0", + "public_key": "ed25519:5qyxefArHQfABdNv9ELuEiWcEo7DTzABM9LrMAKTCY3Z", + "stake": "100198001398444504508422270154", + "validator_stake_struct_version": "V1" + }, + { + "account_id": "a41.pool.f863973.m0", + "public_key": "ed25519:Gzg8dYaeBe6ime9dsMKUFiRZeWLjQ3VHjBCbapjsCmUf", + "stake": "55045849262927169777589487275", + "validator_stake_struct_version": "V1" + } + ], + "prev_block_hash": "EqCBWBif1xyr6pq4Kvr6s4aPhEMRqBerfDVBJp4GDDUG" + } +} diff --git a/fixtures/well_known_header.json b/fixtures/well_known_header.json deleted file mode 100644 index c21a06c..0000000 --- a/fixtures/well_known_header.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "height": 4, - "prev_height": 3, - "epoch_id": "11111111111111111111111111111111", - "next_epoch_id": "AuatKw3hiGmXed3uT2u4Die6ZRGZhEHn34kTyVpGnYLM", - "prev_hash": "BUcVEkMq3DcZzDGgeh1sb7FFuD86XYcXpEt25Cf34LuP", - "prev_state_root": "Bn786g4GdJJigSP4qRSaVCfeMotWVX88cV1LTZhD6o3z", - "chunk_receipts_root": "9ETNjrt6MkwTgSVMMbpukfxRshSD1avBUUa4R4NuqwHv", - "chunk_headers_root": "Fk7jeakmi8eruvv4L4ToKs7MV1YG64ETZtASQYjGBWK1", - "chunk_tx_root": "7tkzFg8RHBmMw1ncRJZCCZAizgq4rwCftTKYLce8RU8t", - "outcome_root": "7tkzFg8RHBmMw1ncRJZCCZAizgq4rwCftTKYLce8RU8t", - "chunks_included": 1, - "challenges_root": "11111111111111111111111111111111", - "timestamp": 1642022757141096960, - "timestamp_nanosec": "1642022757141096960", - "random_value": "GxYrjCxQtfG2K7hX6w4aPs3usTskzfCkbVc2icSQMF7h", - "validator_proposals": [], - "chunk_mask": [ - true - ], - "gas_price": "1000000000", - "block_ordinal": 4, - "rent_paid": "0", - "validator_reward": "0", - "total_supply": "3000000000000000000000000000000000", - "challenges_result": [], - "last_final_block": "GTudmqKJQjEVCrdi31vcHqXoEpvEScmZ9BhBf3gPJ4pp", - "last_ds_final_block": "BUcVEkMq3DcZzDGgeh1sb7FFuD86XYcXpEt25Cf34LuP", - "next_bp_hash": "236RGxQc2xSqukyiBkixtZSqKu679ZxeS6vP8zzAL9vW", - "block_merkle_root": "Gf3uWgULzc5WDuaAq4feehh7M1TFRFxTWVv2xH6AsnpA", - "epoch_sync_data_hash": "4JTQn5LGcxdx4xstsAXgXHcP3oHKatzdzHBw6atBDSWV", - "approvals": [ - "ed25519:5Jdeg8rk5hAbcooyxXQSTcxBgUK39Z8Qtfkhqmpi26biU26md5wBiFvkAEGXrMyn3sgq3cTMG8Lr3HD7RxWPjkPh", - "ed25519: 4vqTaN6bucu6ALsb1m15e8HWGGxLQeKJhWrcU8zPRrzfkZbakaSzW8rfas2ZG89rFKheZUyrnZRKooRny6YKFyKi" - ], - "signature": "ed25519:5mGi9dyuyt7TnSpPFjbEWSJThDdiEV9NNQB11knXvRbxSv8XfBT5tdVVFypeqpZjeB3fD7qgJpWhTj3KvdGbcXdu", - "latest_protocol_version": 50 -} \ No newline at end of file diff --git a/succinct.json b/succinct.json new file mode 100644 index 0000000..b87fd55 --- /dev/null +++ b/succinct.json @@ -0,0 +1,14 @@ +{ + "entrypoints": [ + { + "name": "sync", + "framework": "plonky2x", + "baseDir": ".", + "buildCommand": "cargo build --release --bin sync && mv target/release/sync build/ && RUST_LOG=debug ./build/sync build", + "proveCommand": "RUST_LOG=debug ./build/sync prove input.json", + "requiredArtifacts": [ + "sync" + ] + } + ] +} From 24662399f4841f827e921129278a9b8055f49c70 Mon Sep 17 00:00:00 2001 From: dndll Date: Wed, 31 Jan 2024 17:40:18 +0000 Subject: [PATCH 25/67] wip: batchcircuit --- Cargo.lock | 11 +- Cargo.toml | 5 +- bin/client/src/client/mod.rs | 42 ++---- bin/operator/src/main.rs | 2 +- circuits/plonky2x/input.bin | 1 + circuits/plonky2x/src/builder.rs | 77 ++++------- circuits/plonky2x/src/hint.rs | 151 +++++++++++---------- circuits/plonky2x/src/lib.rs | 200 ++++++++++++++++++++++++++-- circuits/plonky2x/src/merkle.rs | 76 ++++++++++- circuits/plonky2x/src/test_utils.rs | 10 +- circuits/plonky2x/src/variables.rs | 165 +++++++++++------------ crates/rpc/src/lib.rs | 27 +++- 12 files changed, 499 insertions(+), 268 deletions(-) create mode 100644 circuits/plonky2x/input.bin diff --git a/Cargo.lock b/Cargo.lock index f8527a3..f75a957 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3697,7 +3697,7 @@ dependencies = [ "near-primitives-core", "pretty_env_logger", "protobuf 3.2.0", - "rand 0.8.5", + "rand 0.7.3", "reqwest", "serde", "serde_json", @@ -3721,7 +3721,7 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "test-utils", @@ -3746,7 +3746,7 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "thiserror", @@ -4901,7 +4901,6 @@ source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b [[package]] name = "plonky2x" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#889643f4b1c331ce585b992c02cadbccaa79cfc8" dependencies = [ "anyhow", "array-macro", @@ -4927,6 +4926,7 @@ dependencies = [ "num-bigint 0.4.4", "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", "plonky2x-derive", + "pretty_assertions", "rand 0.8.5", "reqwest", "serde", @@ -4943,7 +4943,6 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#889643f4b1c331ce585b992c02cadbccaa79cfc8" dependencies = [ "proc-macro2", "quote", @@ -6635,7 +6634,7 @@ dependencies = [ "near-primitives-core", "pretty_assertions", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 32d861b..53f5441 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,5 +46,6 @@ near-light-client-protocol = { path = "crates/protocol" } near-light-client-rpc = { path = "crates/rpc" } near-light-clientx = { path = "circuits/plonky2x" } test-utils = { path = "crates/test-utils" } -# [patch."https://github.com/succinctlabs/succinctx.git"] -# plonky2x = { path = "./vendor/succinctx/plonky2x/core" } + +[patch."https://github.com/succinctlabs/succinctx.git"] +plonky2x = { path = "./vendor/succinctx/plonky2x/core" } diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 7b7eafe..739e80a 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -242,30 +242,6 @@ impl LightClient { .ok() } - pub async fn batch_fetch_proofs( - &self, - last_verified_hash: &CryptoHash, - p: BatchGetProof, - collect_errors: bool, - ) -> Result<(Vec, Vec)> { - let mut futs = vec![]; - for req in p.0 { - let proof = self - .client - .fetch_light_client_proof(req.0, *last_verified_hash); - futs.push(proof); - } - let unpin_futs: Vec<_> = futs.into_iter().map(Box::pin).collect(); - - let proofs: Vec> = futures::future::join_all(unpin_futs).await; - let (proofs, errors): (Vec<_>, Vec<_>) = if collect_errors { - proofs.into_iter().partition_result() - } else { - (proofs.into_iter().collect::>>()?, vec![]) - }; - Ok((proofs, errors)) - } - pub async fn verify_proof(&self, p: Proof) -> Result { anyhow::ensure!( self.store @@ -278,9 +254,14 @@ impl LightClient { } // TODO: this and below are the same except from two lines - pub async fn get_proofs(&self, p: BatchGetProof) -> Result> { + pub async fn get_proofs(&self, req: BatchGetProof) -> Result> { + let req = req.0.into_iter().map(|p| p.0).collect(); let head = self.store.head().await?; - let proofs = self.batch_fetch_proofs(&head.hash(), p, false).await?.0; + let proofs = self + .client + .batch_fetch_proofs(&head.hash(), req, false) + .await? + .0; self.store .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) @@ -294,10 +275,15 @@ impl LightClient { pub async fn experimental_get_proofs( &self, - p: BatchGetProof, + req: BatchGetProof, ) -> Result<(ExperimentalProof, Vec)> { + let req = req.0.into_iter().map(|p| p.0).collect(); + let head = self.store.head().await?; - let (proofs, errors) = self.batch_fetch_proofs(&head.hash(), p, true).await?; + let (proofs, errors) = self + .client + .batch_fetch_proofs(&head.hash(), req, true) + .await?; let p = protocol::experimental::Proof::new(head.inner_lite.block_merkle_root, proofs); self.store .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 523c880..25f8fb4 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -3,7 +3,7 @@ use near_light_clientx::{plonky2x::backend::function::Plonky2xFunction, SyncCirc fn main() { cfg_if::cfg_if! { if #[cfg(feature = "sync")] { - SyncCircuit::<1>::entrypoint(); + SyncCircuit::entrypoint(); } else { panic!("No circuit feature enabled"); } diff --git a/circuits/plonky2x/input.bin b/circuits/plonky2x/input.bin new file mode 100644 index 0000000..a26284a --- /dev/null +++ b/circuits/plonky2x/input.bin @@ -0,0 +1 @@ +0x44cf18d28ab7b9f7f5adb3cf3fd6d8a2a4f93f8fdad01a9e86ae4b5b2b17836fba9c6629085351fbea47cdc2851d8f76c940dcba41702fb91a4b832857734ce8000000000937d838dce68dd6fb22e016c8405dfbfdc90f4a9cef98e5fb3c7afc0e1f46a2b5e11022daf909af5b24b30011f952baccbdab560b1e16bd2d16efabb9f2ee3ffee398fad05d5c913e8db18af4d1fda9f2a18595ac481a324b9f94b02abc18595a39ad365fb163b24a02808b1fe26cd012313376d914a7e58017c722062aba155f9a078117aa90ce2853e1558ec8ea8e1910a48364bfb4faf1085779ad3f4311ff5b7af12c8f20a0ad34a56928328499c4518899bcc03deb1eb9b8247f88c65d6c0cf8cd4b46cf5bce18a0e2 \ No newline at end of file diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 185afa4..b9ba5a1 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,8 +1,8 @@ -use crate::merkle::NearMerkleTree; +use crate::merkle::{MerklePathVariable, NearMerkleTree}; use crate::variables::{ ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, BuildEndorsement, - CryptoHashVariable, HeaderVariable, MerklePathVariable, ProofVariable, StakeInfoVariable, - SyncedVariable, ValidatorStakeVariable, + CryptoHashVariable, HeaderVariable, ProofVariable, StakeInfoVariable, SyncedVariable, + ValidatorStakeVariable, }; use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; use near_light_client_protocol::prelude::Itertools; @@ -266,8 +266,7 @@ impl, const D: usize> Sync for CircuitBuilder let d = self.ensure_stake_is_sufficient(&stake); self.assertx(d); - // TODO: might not need this now, also the logic is wrong because nbps is always >0 - let (next_bps_epoch, next_bps) = if next_block.next_bps.len() > 0 { + if next_block.next_bps.len() > 0 { // TODO: hashing bps in circut let e = self.ensure_next_bps_is_valid( &next_block.header.inner_lite.next_bp_hash, @@ -275,21 +274,11 @@ impl, const D: usize> Sync for CircuitBuilder ); self.assertx(e); assert!(next_block.next_bps.len() == NUM_BLOCK_PRODUCER_SEATS); - ( - next_block.header.inner_lite.next_epoch_id, - next_block.next_bps.to_owned(), - ) - } else { - let eid = self.constant::([0u8; 32].into()); - let bps = self.constant::>( - vec![Default::default(); NUM_BLOCK_PRODUCER_SEATS].into(), - ); - (eid, bps) - }; + } SyncedVariable { new_head: next_block.header.to_owned(), - next_bps_epoch, - next_bps, + next_bps_epoch: next_block.header.inner_lite.next_epoch_id, + next_bps: next_block.next_bps.to_owned(), } } @@ -320,17 +309,11 @@ impl, const D: usize> Sync for CircuitBuilder } pub trait Verify, const D: usize> { - fn verify( - &mut self, - proof: ProofVariable, - ) -> BoolVariable; + fn verify(&mut self, proof: ProofVariable) -> BoolVariable; } impl, const D: usize> Verify for CircuitBuilder { - fn verify( - &mut self, - proof: ProofVariable, - ) -> BoolVariable { + fn verify(&mut self, proof: ProofVariable) -> BoolVariable { let block_hash = proof.block_header.hash(self); let block_hash_matches = self.is_equal(block_hash, proof.outcome_proof_block_hash); @@ -635,11 +618,7 @@ mod beefy_tests { const BLOCK_PROOF_AMT: usize = 26; let define = |builder: &mut B| { - let proof = builder.read::>(); + let proof = builder.read::(); let expected_outcome_root = builder.read::(); let expected_block_root = builder.read::(); @@ -664,14 +643,13 @@ mod beefy_tests { builder.write::(proof_verified); }; let writer = |input: &mut PI| { - input - .write::>( - near_light_client_protocol::Proof::Basic { - head_block_root: block_root, - proof: Box::new(fixture("old.json")), - } - .into(), - ); + input.write::( + near_light_client_protocol::Proof::Basic { + head_block_root: block_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); input.write::(p.block_header_lite.inner_lite.outcome_root.0.into()); input.write::(block_root.0.clone().into()); }; @@ -694,24 +672,19 @@ mod beefy_tests { const BLOCK_PROOF_AMT: usize = 26; let define = |builder: &mut B| { - let registered_proof = builder.read::>(); + let registered_proof = builder.read::(); let proof_verified = builder.verify(registered_proof); builder.write::(proof_verified); }; let writer = |input: &mut PI| { - input - .write::>( - near_light_client_protocol::Proof::Basic { - head_block_root: block_root, - proof: Box::new(fixture("old.json")), - } - .into(), - ); + input.write::( + near_light_client_protocol::Proof::Basic { + head_block_root: block_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); }; let assertions = |mut output: PO| { assert!(output.read::(), "proof verified"); diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index 5f609dc..dde55c0 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -1,15 +1,13 @@ -use crate::variables::bps_to_variable; +use crate::variables::normalise_account_id; use crate::variables::BlockVariable; -use crate::variables::BpsArr; use crate::variables::CryptoHashVariable; use crate::variables::HeaderVariable; -use crate::variables::ValidatorStakeVariable; +use crate::variables::ProofVariable; +use crate::variables::TransactionOrReceiptIdVariable; use async_trait::async_trait; -use near_light_client_protocol::prelude::anyhow; -use near_light_client_protocol::prelude::izip; use near_light_client_protocol::prelude::CryptoHash; -use near_light_client_protocol::prelude::Itertools; -use near_light_client_protocol::LightClientBlockLiteView; +use near_light_client_protocol::Proof; +use near_light_client_rpc::prelude::GetProof; use near_light_client_rpc::{LightClientRpc, NearRpcClient, Network}; use plonky2x::{frontend::hint::asynchronous::hint::AsyncHint, prelude::*}; use serde::{Deserialize, Serialize}; @@ -52,17 +50,84 @@ impl FetchNextHeaderInputs { } } +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct FetchProofInputs(pub Network); + +#[async_trait] +impl, const D: usize, const B: usize> AsyncHint + for FetchProofInputs +{ + async fn hint( + &self, + input_stream: &mut ValueStream, + output_stream: &mut ValueStream, + ) { + let client = NearRpcClient::new(self.0.clone()); + let block_merkle_root = input_stream.read_value::().0; + let last_verified = input_stream.read_value::().0; + + let mut reqs = vec![]; + for _ in 0..B { + let tx = input_stream.read_value::(); + reqs.push(if tx.is_transaction { + GetProof::Transaction { + transaction_hash: CryptoHash(tx.id.into()), + sender_id: normalise_account_id::(&tx.account), + } + } else { + GetProof::Receipt { + receipt_id: CryptoHash(tx.id.into()), + receiver_id: normalise_account_id::(&tx.account), + } + }); + } + + let proofs = client + .batch_fetch_proofs(&CryptoHash(last_verified), reqs, false) + .await + .expect("Failed to fetch proofs") + .0; + assert_eq!(proofs.len(), B, "Invalid number of proofs"); + + log::info!("Fetched {} proofs", proofs.len()); + + for p in proofs.into_iter() { + output_stream.write_value::( + Proof::Basic { + proof: Box::new(p), + head_block_root: CryptoHash(block_merkle_root), + } + .into(), + ); + } + } +} +impl FetchProofInputs { + pub fn fetch, const D: usize>( + self, + b: &mut CircuitBuilder, + head: &HeaderVariable, + reqs: &[TransactionOrReceiptIdVariable], + ) -> ArrayVariable { + let mut input_stream = VariableStream::new(); + + input_stream.write::(&head.inner_lite.block_merkle_root); + input_stream.write::(&head.hash(b)); + input_stream.write_slice::(reqs); + + let output_stream = b.async_hint(input_stream, self); + let proofs = output_stream.read_vec::(b, N); + proofs.into() + } +} + #[cfg(test)] mod tests { use super::*; use crate::{ test_utils::{builder_suite, test_state, B, PI, PO}, - variables::{BlockVariableValue, HeaderVariableValue}, - }; - use near_light_client_protocol::{ - prelude::Header, BlockHeaderInnerLiteView, LightClientBlockView, + variables::{BlockVariableValue, HeaderVariable}, }; - use std::str::FromStr; #[test] fn test_fetch_header() { @@ -85,66 +150,4 @@ mod tests { }; builder_suite(define, writer, assertions); } - // #[test] - // fn test_fetch_info2() { - // let head = Header { - // prev_block_hash: CryptoHash::from_str("5dbt6rh82Xx6nNG1PuKoQj96g4jnWw6cyb8HNWPPkVJE") - // .unwrap(), - // inner_rest_hash: CryptoHash::from_str("DZT9p28adyuiTSbUV5bsuPRxX9K7R1bag1AeUEMhm4bh") - // .unwrap(), - // inner_lite: BlockHeaderInnerLiteView { - // height: 154654776, - // epoch_id: CryptoHash::from_str("FsJbcG3yvQQC81FVLgAsaHZrMBFbrPM22kgqfGcCdrFb") - // .unwrap(), - // next_epoch_id: CryptoHash::from_str("Fjn8T3phCCSCXSdjtQ4DqHGV86yeS2MQ92qcufCEpwbf") - // .unwrap(), - // prev_state_root: CryptoHash::from_str( - // "F2NNVhJJJdC7oWMbjpaJL3HVNK9RxcCWuTXjrM32ShuP", - // ) - // .unwrap(), - // outcome_root: CryptoHash::from_str("7SYchEDbwawjP2MVfZ2GinP8bBQU1hKFRz34b2ZzG3A8") - // .unwrap(), - // timestamp: 1705334624027402581, - // timestamp_nanosec: 1705334624027402581, - // next_bp_hash: CryptoHash::from_str("AcNatyPz9nmg2e5dMKQAbNLjFfkLgBN7AbR31vcpVJ7z") - // .unwrap(), - // block_merkle_root: CryptoHash::from_str( - // "3huzCnEQhgDDMWyVNR9kNbQFJ7qJGy1J4MBrCJAWndW9", - // ) - // .unwrap(), - // }, - // }; - // - // let define = |b: &mut B| { - // let header = b.read::(); - // let header_hash = header.hash(b); - // let mut outputs = b.async_hint( - // FetchBatchInputs::<2>::write_inputs(&header, &header_hash), - // FetchBatchInputs::<2>(near_light_client_rpc::Network::Testnet), - // ); - // let outputs = FetchBatchInputs::<2>::read_outputs(&mut outputs, b); - // - // b.write::>(outputs.0); - // for i in outputs.1.as_vec() { - // b.write::(i); - // } - // }; - // let writer = |input: &mut PI| { - // input.write::(head.into()); - // }; - // let assertions = |mut output: PO| { - // let bps = output - // .read::>() - // .into_iter() - // .map(|x| x.account_id) - // .collect_vec(); - // assert_eq!(bps.len(), 50); - // - // let inputs = output.read::(); - // println!("inputs: {:?}", inputs); - // let inputs = output.read::(); - // println!("inputs: {:?}", inputs); - // }; - // builder_suite(define, writer, assertions); - // } } diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index c13306d..c9eb63e 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -2,12 +2,19 @@ use builder::Sync; use hint::FetchNextHeaderInputs; +use plonky2x::frontend::mapreduce::generator::{MapReduceDynamicGenerator, MapReduceGenerator}; +use plonky2x::prelude::plonky2::hash::hashing::PlonkyPermutation; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use variables::{ - BpsArr, CryptoHashVariable, HashBpsInputs, HeaderVariable, ValidatorStakeVariable, + BlockHeightVariable, BpsArr, CryptoHashVariable, HashBpsInputs, HeaderVariable, + ValidatorStakeVariable, }; use variables::{BuildEndorsement, EncodeInner, SyncedVariable}; +use crate::builder::Verify; +use crate::hint::FetchProofInputs; +use crate::variables::{ProofVariable, TransactionOrReceiptIdVariable}; + /// Building blocks injected into the CircuitBuilder mod builder; mod hint; @@ -31,9 +38,9 @@ mod test_utils; // protocol crate // TODO: determine fees, allows integrators to charge #[derive(Debug, Clone)] -pub struct SyncCircuit; +pub struct SyncCircuit; -impl Circuit for SyncCircuit { +impl Circuit for SyncCircuit { fn define, const D: usize>(b: &mut CircuitBuilder) where <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: @@ -71,15 +78,124 @@ impl Circuit for SyncCircuit { } } +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofMapReduceState { + pub height_indices: ArrayVariable, + pub results: ArrayVariable, +} + +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofMapReduceCtx { + pub zero: BlockHeightVariable, + pub result: BoolVariable, +} + +#[derive(Debug, Clone)] +pub struct ProofCircuit; + +impl Circuit for ProofCircuit { + fn define, const D: usize>(b: &mut CircuitBuilder) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher<>::Field>, + { + assert!(N % B == 0, "Cannot batch by this configuration"); + + let network = near_light_client_rpc::Network::Testnet; + + let trusted_head = b.read::(); + let ids = b.read::>(); + + let proofs = FetchProofInputs::(network).fetch(b, &trusted_head, &ids.data); + + let zero = b.zero::(); + let _false = b._false(); + + let ctx = ProofMapReduceCtx { + zero, + result: _false, + }; + + let output = b + .mapreduce_dynamic::<_, ProofVariable, ProofMapReduceState, Self, B, _, _>( + ctx, + proofs.data, + |ctx, proofs, b| { + let mut heights = vec![]; + let mut results = vec![]; + for p in proofs.data { + heights.push(p.block_header.inner_lite.height); + results.push(b.verify(p)); + } + b.watch_slice(&heights, "map job -- heights"); + b.watch_slice(&results, "map job -- results"); + + heights.resize(N, ctx.zero); + results.resize(N, ctx.result); + + let state = ProofMapReduceState { + height_indices: heights.into(), + results: results.into(), + }; + + state + }, + |ctx, mut left, right, b| { + let mut r_heights = right.height_indices.data; + let mut r_results = right.results.data; + + left.height_indices + .data + .iter_mut() + .zip(left.results.data.iter_mut()) + .for_each(|(h, r)| { + let is_zero = b.is_equal(h.clone(), ctx.zero); + *h = b.select(is_zero, r_heights.pop().unwrap(), *h); + *r = b.select(is_zero, r_results.pop().unwrap(), *r); + }); + + left + }, + ); + b.write::>(output); + } + + fn register_generators, const D: usize>(registry: &mut HintRegistry) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher, + { + registry.register_async_hint::>(); + registry.register_hint::(); + + let dynamic_id = MapReduceDynamicGenerator::::id(); + + registry.register_simple::, + Self, + B, + D, + >>(dynamic_id); + } +} + #[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { + use std::str::FromStr; + use super::*; - use crate::test_utils::{builder_suite, testnet_state, B, PI, PO}; + use crate::{ + test_utils::{builder_suite, testnet_state, B, PI, PO}, + variables::TransactionOrReceiptIdVariableValue, + }; use ::test_utils::CryptoHash; use near_light_client_protocol::{prelude::Itertools, ValidatorStake}; use near_light_client_rpc::{LightClientRpc, NearRpcClient}; - use near_primitives::types::AccountId; + use near_primitives::types::{AccountId, TransactionOrReceiptId}; use serial_test::serial; #[test] @@ -89,7 +205,7 @@ mod beefy_tests { let (header, _, _) = testnet_state(); let define = |b: &mut B| { - SyncCircuit::::define(b); + SyncCircuit::define(b); }; let writer = |input: &mut PI| { input.evm_write::(header.into()); @@ -127,8 +243,74 @@ mod beefy_tests { } #[test] - fn test_prove() {} + #[serial] + fn beefy_test_verify_e2e() { + let (header, _, _) = testnet_state(); - #[test] - fn test_verify() {} + const AMT: usize = 4; + const BATCH: usize = 1; + + fn tx(hash: &str, sender: &str) -> TransactionOrReceiptId { + TransactionOrReceiptId::Transaction { + transaction_hash: CryptoHash::from_str(hash).unwrap(), + sender_id: sender.parse().unwrap(), + } + } + fn rx(hash: &str, receiver: &str) -> TransactionOrReceiptId { + TransactionOrReceiptId::Receipt { + receipt_id: CryptoHash::from_str(hash).unwrap(), + receiver_id: receiver.parse().unwrap(), + } + } + + let txs: Vec> = vec![ + tx( + "3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz", + "zavodil.testnet", + ), + // rx( + // "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", + // "priceoracle.testnet", + // ), + // rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), + // tx( + // "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", + // "hotwallet.dev-kaiching.testnet", + // ), + // rx( + // "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", + // "wallet.dev-kaiching.testnet", + // ), + // rx("9Zp41hsK5NEfkjiv3PhtqpgbRiHqsvpFcwe6CHrQ2kh2", "system"), + tx( + "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", + "operator_manager.orderly.testnet", + ), + tx( + "FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg", + "operator-manager.orderly-qa.testnet", + ), + tx( + "4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST", + "operator-manager.orderly-dev.testnet", + ), + ] + .into_iter() + .map(Into::into) + .collect_vec(); + + assert_eq!(txs.len(), AMT); + + let define = |b: &mut B| { + ProofCircuit::::define(b); + }; + let writer = |input: &mut PI| { + input.write::(header.into()); + input.write::>(txs.into()); + }; + let assertions = |mut output: PO| { + println!("{:#?}", output.read::>()); + }; + builder_suite(define, writer, assertions); + } } diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs index f6afdea..73e4045 100644 --- a/circuits/plonky2x/src/merkle.rs +++ b/circuits/plonky2x/src/merkle.rs @@ -1,3 +1,4 @@ +use near_light_client_protocol::{merkle_util::MerklePath, prelude::Itertools}; use plonky2x::prelude::*; /// This is an unprefixed merkle tree without collision resistance, this should probably adapt the @@ -21,13 +22,20 @@ impl, const D: usize> NearMerkleTree for CircuitBuilder Bytes32Variable { let mut hash_so_far = leaf; + let default = self.constant::(INACTIVE_NODE.into()); + for i in 0..PROOF_DEPTH { let aunt = proof[i]; let path_index = path_indices[i]; + let left_hash_pair = self.inner_hash(&hash_so_far, &aunt); let right_hash_pair = self.inner_hash(&aunt, &hash_so_far); - hash_so_far = self.select(path_index, right_hash_pair, left_hash_pair) + let aunt_is_default = self.is_equal(aunt, default); + + let hash = self.select(path_index, right_hash_pair, left_hash_pair); + + hash_so_far = self.select(aunt_is_default, hash_so_far, hash) } hash_so_far } @@ -35,7 +43,6 @@ impl, const D: usize> NearMerkleTree for CircuitBuilder bool near_light_client_protocol::Direction::Right => false, } } + +const INACTIVE_NODE: [u8; 32] = [255; 32]; + +#[derive(CircuitVariable, Clone, Debug)] +pub struct MerklePathVariable { + pub path: ArrayVariable, + pub indices: ArrayVariable, +} +impl From for MerklePathVariableValue { + fn from(path: MerklePath) -> Self { + assert!(path.len() <= MAX_LEN, "merkle path too long"); + + let mut indices = path + .iter() + .map(|x| &x.direction) + .map(determine_direction) + .collect_vec(); + + indices.resize(MAX_LEN, Default::default()); + + let mut path = path.iter().map(|x| x.hash.0.into()).collect_vec(); + path.resize(MAX_LEN, INACTIVE_NODE.into()); + + Self { path, indices } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{test_utils::*, variables::ProofVariable}; + + #[test] + fn test_path_is_ignored_if_default() { + let block_root = + CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); + + let define = |b: &mut B| { + let p = b.read::(); + let hash = p.block_header.hash(b); + + let root = b.get_root_from_merkle_proof_hashed_leaf_unindex( + &p.block_proof.path, + &p.block_proof.indices, + hash, + ); + let v = b.is_equal(root, p.head_block_root); + + b.write::(v); + }; + let writer = |input: &mut PI| { + input.write::( + near_light_client_protocol::Proof::Basic { + head_block_root: block_root, + proof: Box::new(fixture("old.json")), + } + .into(), + ); + }; + let assertions = |mut output: PO| { + assert!(output.read::()); + }; + builder_suite(define, writer, assertions); + } +} diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index 3220b71..7af59be 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -27,11 +27,11 @@ pub fn builder_suite( let mut inputs = circuit.input(); writer(&mut inputs); - if let PublicInput::Bytes(bytes) = &mut inputs { - std::fs::write("input.bin", hex!(bytes)).unwrap(); - } else { - panic!("input is not bytes"); - } + // if let PublicInput::Bytes(bytes) = &mut inputs { + // std::fs::write("input.bin", hex!(bytes)).unwrap(); + // } else { + // panic!("input is not bytes"); + // } let (proof, output) = circuit.prove(&inputs); diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 9408a7a..b529193 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -1,14 +1,14 @@ -use crate::merkle::determine_direction; use ethers::types::U256; use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; use near_light_client_protocol::prelude::{Header, Itertools}; use near_light_client_protocol::{ - merkle_util::MerklePath, prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, - LightClientBlockView, Signature, ValidatorStake, + prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, LightClientBlockView, + Signature, ValidatorStake, }; use near_light_client_protocol::{ ED25519PublicKey, Proof, PublicKey, StakeInfo, Synced, ValidatorStakeView, ValidatorStakeViewV1, }; +use near_light_client_rpc::prelude::GetProof; use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; use plonky2x::frontend::curta::ec::point::CompressedEdwardsYVariable; use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; @@ -19,46 +19,19 @@ use plonky2x::prelude::*; use pretty_assertions::assert_eq; use serde::{Deserialize, Serialize}; -// TODO: remove any unused fields like account id etc? -// TODO: if we use borsh here be careful of order +use crate::merkle::MerklePathVariable; +// TODO: remove any unused fields like account id etc? /// TODO: check if BPS seats changes for testnet/mainnet + /// Type for omitting the size across the codebase for arrays that are the same size as BPS pub(crate) type BpsArr = ArrayVariable; pub type CryptoHashVariable = Bytes32Variable; pub type BlockHeightVariable = U64Variable; pub type BalanceVariable = U128Variable; -pub type AccountIdVariable = BytesVariable<{ AccountId::MAX_LEN }>; // TODO: decide if this is a - // reasonable way - -// TODO: add handling of empty path elements -#[derive(CircuitVariable, Clone, Debug)] -pub struct MerklePathVariable { - pub path: ArrayVariable, - pub indices: ArrayVariable, -} -impl From for MerklePathVariableValue { - fn from(path: MerklePath) -> Self { - assert!(path.len() <= A); - - let mut indices = path - .iter() - .map(|x| &x.direction) - .map(determine_direction) - .collect_vec(); - // FIXME: Hmm, this seems problematic potentially since it might hash the wrong way - // verify. - // - // TODO: grow these but exclude them in tree - indices.resize(A, Default::default()); - - let mut path = path.iter().map(|x| x.hash.0.into()).collect_vec(); - path.resize(A, Default::default()); - - Self { path, indices } - } -} +pub type AccountIdVariable = BytesVariable<{ AccountId::MAX_LEN }>; +pub type AccountIdVariableValue = ::ValueType; #[derive(CircuitVariable, Clone, Debug)] pub struct HeaderVariable { @@ -363,23 +336,6 @@ impl From for BlockVariableValue { } } -pub(crate) fn bps_to_variable>( - next_bps: Option>, -) -> Vec> { - next_bps - .map(|next_bps| { - let mut bps = next_bps - .into_iter() - .take(NUM_BLOCK_PRODUCER_SEATS) - .map(Into::::into) - .map(Into::>::into) - .collect_vec(); - bps.resize(NUM_BLOCK_PRODUCER_SEATS, Default::default()); - bps - }) - .unwrap_or_else(|| vec![Default::default(); NUM_BLOCK_PRODUCER_SEATS]) -} - #[derive(CircuitVariable, Clone, Debug)] pub struct BpsApprovals { pub is_active: BpsArr, @@ -414,6 +370,23 @@ impl From>>> } } +pub(crate) fn bps_to_variable>( + next_bps: Option>, +) -> Vec> { + next_bps + .map(|next_bps| { + let mut bps = next_bps + .into_iter() + .take(NUM_BLOCK_PRODUCER_SEATS) + .map(Into::::into) + .map(Into::>::into) + .collect_vec(); + bps.resize(NUM_BLOCK_PRODUCER_SEATS, Default::default()); + bps + }) + .unwrap_or_else(|| vec![Default::default(); NUM_BLOCK_PRODUCER_SEATS]) +} + #[derive(CircuitVariable, Clone, Debug)] pub struct ValidatorStakeVariable { pub account_id: AccountIdVariable, @@ -426,8 +399,7 @@ impl From for ValidatorStakeVariableValue { fn from(vs: ValidatorStake) -> Self { let public_key = CompressedEdwardsY(vs.public_key().unwrap_as_ed25519().0); let stake = vs.stake(); - let mut account_id = vs.take_account_id().as_str().as_bytes().to_vec(); - account_id.resize(AccountId::MAX_LEN, ACCOUNT_ID_PADDING_BYTE); + let account_id = pad_account_id(&vs.take_account_id()); Self { account_id: account_id.try_into().unwrap(), // SAFETY: already checked this above public_key: public_key.into(), @@ -436,15 +408,26 @@ impl From for ValidatorStakeVariableValue { } } +pub(crate) fn pad_account_id(account_id: &AccountId) -> [u8; AccountId::MAX_LEN] { + let mut account_id = account_id.as_str().as_bytes().to_vec(); + account_id.resize(AccountId::MAX_LEN, ACCOUNT_ID_PADDING_BYTE); + account_id.try_into().expect("invalid account bytes") +} + +pub(crate) fn normalise_account_id( + account_id: &AccountIdVariableValue, +) -> AccountId { + let unpadded_bytes = account_id + .split(|x| *x == ACCOUNT_ID_PADDING_BYTE) + .collect_vec()[0]; + let account_str = String::from_utf8(unpadded_bytes.to_vec()).expect("invalid account bytes"); + log::trace!("account id: {}", account_str); + account_str.parse().expect("invalid account id") +} + impl Into for ValidatorStakeVariableValue { fn into(self) -> ValidatorStakeView { - let unpadded_bytes = self - .account_id - .split(|x| *x == ACCOUNT_ID_PADDING_BYTE) - .collect_vec()[0]; - let account_id = String::from_utf8(unpadded_bytes.to_vec()).expect("invalid account bytes"); - println!("account id: {}", account_id); - let account_id = account_id.parse().expect("invalid account id"); + let account_id = normalise_account_id::(&self.account_id); let public_key = PublicKey::ED25519(ED25519PublicKey(self.public_key.0.into())); ValidatorStakeView::V1(ValidatorStakeViewV1 { account_id, @@ -507,19 +490,18 @@ impl Default for SignatureVariableValue { } #[derive(CircuitVariable, Clone, Debug)] -pub struct ProofVariable { +pub struct ProofVariable { pub head_block_root: CryptoHashVariable, // TODO: constrain the outcome hash by borsh encoding in the circuit, not here pub outcome_hash: CryptoHashVariable, pub outcome_proof_block_hash: CryptoHashVariable, - pub outcome_proof: MerklePathVariable, // TODO: get real number here - pub outcome_root_proof: MerklePathVariable, // TODO: get real number here + pub outcome_proof: MerklePathVariable<16>, // TODO: get real number here + pub outcome_root_proof: MerklePathVariable<8>, // TODO: get real number here pub block_header: HeaderVariable, - pub block_proof: MerklePathVariable, // TODO: get real number here + pub block_proof: MerklePathVariable<64>, // TODO: get real number here } -impl From - for ProofVariableValue +impl From for ProofVariableValue where F: RichField, { @@ -544,25 +526,6 @@ where } } -// TODO: likely these don't need to be constrained in the circuit so wont need to -// implement circuit variable for these, we blind these in the batch proofs anyway -// pub struct ExecutionOutcomeWithId { -// pub proof: MerklePath<32>, -// pub block_hash: CryptoHash, -// pub id: CryptoHash, -// pub outcome: ExecutionOutcome, -// } -// -// pub pub struct ExecutionOutcome { -// pub logs: Vec, -// pub receipt_ids: Vec, -// pub gas_burnt: U64Variable, -// pub tokens_burnt: Balance, -// pub executor_id: AccountId, -// pub status: ExecutionStatusView, -// pub metadata: ExecutionMetadataView, -// } - #[derive(CircuitVariable, Clone, Debug)] pub struct StakeInfoVariable { pub approved: BalanceVariable, @@ -664,6 +627,36 @@ impl HashBpsInputs { } } +#[derive(CircuitVariable, Clone, Debug)] +pub struct TransactionOrReceiptIdVariable { + pub is_transaction: BoolVariable, + pub id: CryptoHashVariable, + pub account: AccountIdVariable, +} + +impl From for TransactionOrReceiptIdVariableValue { + fn from(value: GetProof) -> Self { + match value { + GetProof::Transaction { + transaction_hash, + sender_id, + } => Self { + is_transaction: true.into(), + id: transaction_hash.0.into(), + account: pad_account_id(&sender_id).into(), + }, + GetProof::Receipt { + receipt_id, + receiver_id, + } => Self { + is_transaction: false.into(), + id: receipt_id.0.into(), + account: pad_account_id(&receiver_id).into(), + }, + } + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index f36e348..205c6fc 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -75,6 +75,27 @@ impl NearRpcClient { NearRpcClient { client, archive } } + pub async fn batch_fetch_proofs( + &self, + last_verified_hash: &CryptoHash, + reqs: Vec, + collect_errors: bool, + ) -> Result<(Vec, Vec)> { + let mut futs = vec![]; + for req in reqs { + let proof = self.fetch_light_client_proof(req, *last_verified_hash); + futs.push(proof); + } + let unpin_futs: Vec<_> = futs.into_iter().map(Box::pin).collect(); + + let proofs: Vec> = futures::future::join_all(unpin_futs).await; + let (proofs, errors): (Vec<_>, Vec<_>) = if collect_errors { + proofs.into_iter().partition_result() + } else { + (proofs.into_iter().collect::>>()?, vec![]) + }; + Ok((proofs, errors)) + } } #[async_trait] @@ -104,7 +125,7 @@ impl LightClientRpc for NearRpcClient { self.client .call(&req) .or_else(|e| { - debug!("Error hitting main rpc, falling back to archive: {:?}", e); + trace!("Error hitting main rpc, falling back to archive: {:?}", e); self.archive.call(&req) }) .await @@ -123,7 +144,7 @@ impl LightClientRpc for NearRpcClient { self.client .call(&req) .or_else(|e| { - debug!("Error hitting main rpc, falling back to archive: {:?}", e); + trace!("Error hitting main rpc, falling back to archive: {:?}", e); self.archive.call(&req) }) .await @@ -140,7 +161,7 @@ impl LightClientRpc for NearRpcClient { self.client .call(&req) .or_else(|e| { - debug!("Error hitting main rpc, falling back to archive: {:?}", e); + trace!("Error hitting main rpc, falling back to archive: {:?}", e); self.archive.call(&req) }) .await From 3eb074e59d1688a63a5f46af66376937714a208e Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 2 Feb 2024 19:41:44 +0000 Subject: [PATCH 26/67] feat: use a hint for joining instead --- Cargo.lock | 3 +- Cargo.toml | 4 +- circuits/plonky2x/src/lib.rs | 118 ++++++++++++++++++++++++++--------- 3 files changed, 91 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f75a957..48a59c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4901,6 +4901,7 @@ source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b [[package]] name = "plonky2x" version = "0.1.0" +source = "git+https://github.com/succinctlabs/succinctx.git#c3c5a10a5bd60838b7749d55c79a9816dd05c21b" dependencies = [ "anyhow", "array-macro", @@ -4926,7 +4927,6 @@ dependencies = [ "num-bigint 0.4.4", "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", "plonky2x-derive", - "pretty_assertions", "rand 0.8.5", "reqwest", "serde", @@ -4943,6 +4943,7 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" +source = "git+https://github.com/succinctlabs/succinctx.git#c3c5a10a5bd60838b7749d55c79a9816dd05c21b" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 53f5441..30bfd5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,5 +47,5 @@ near-light-client-rpc = { path = "crates/rpc" } near-light-clientx = { path = "circuits/plonky2x" } test-utils = { path = "crates/test-utils" } -[patch."https://github.com/succinctlabs/succinctx.git"] -plonky2x = { path = "./vendor/succinctx/plonky2x/core" } +# [patch."https://github.com/succinctlabs/succinctx.git"] +# plonky2x = { path = "./vendor/succinctx/plonky2x/core" } diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index c9eb63e..1635c61 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,10 +1,16 @@ #![feature(generic_const_exprs)] +use std::collections::VecDeque; + use builder::Sync; use hint::FetchNextHeaderInputs; +use near_light_client_protocol::prelude::Itertools; +use plonky2x::frontend::hint::simple::hint::Hint; use plonky2x::frontend::mapreduce::generator::{MapReduceDynamicGenerator, MapReduceGenerator}; use plonky2x::prelude::plonky2::hash::hashing::PlonkyPermutation; +use plonky2x::prelude::plonky2::iop::target::BoolTarget; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; +use serde::{Deserialize, Serialize}; use variables::{ BlockHeightVariable, BpsArr, CryptoHashVariable, HashBpsInputs, HeaderVariable, ValidatorStakeVariable, @@ -140,22 +146,7 @@ impl Circuit for ProofCircuit { state }, - |ctx, mut left, right, b| { - let mut r_heights = right.height_indices.data; - let mut r_results = right.results.data; - - left.height_indices - .data - .iter_mut() - .zip(left.results.data.iter_mut()) - .for_each(|(h, r)| { - let is_zero = b.is_equal(h.clone(), ctx.zero); - *h = b.select(is_zero, r_heights.pop().unwrap(), *h); - *r = b.select(is_zero, r_results.pop().unwrap(), *r); - }); - - left - }, + |_ctx, left, right, b| MergeProofReductionHint::.merge(b, &left, &right), ); b.write::>(output); } @@ -179,6 +170,71 @@ impl Circuit for ProofCircuit { B, D, >>(dynamic_id); + registry.register_hint::>(); + } +} + +// Hinting for this as it's taking too much effort to do it in a constrained way +// +// |ctx, mut left, right, b| { +// let mut r_heights = right.height_indices.data; +// let mut r_results = right.results.data; +// +// left.height_indices +// .data +// .iter_mut() +// .zip(left.results.data.iter_mut()) +// .for_each(|(h, r)| { +// let is_zero = b.is_equal(h.clone(), ctx.zero); +// *h = b.select(is_zero, r_heights.pop().unwrap(), *h); +// *r = b.select(is_zero, r_results.pop().unwrap(), *r); +// }); +// +// left +// }, +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct MergeProofReductionHint; + +impl, const D: usize, const N: usize> Hint + for MergeProofReductionHint +{ + fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { + let left = input_stream.read_value::>(); + let right = input_stream.read_value::>(); + + let (mut height_indices, mut results): (Vec<_>, Vec<_>) = left + .height_indices + .iter() + .chain(right.height_indices.iter()) + .zip(left.results.iter().chain(right.results.iter())) + .filter_map(|(h, r)| if *h != 0 { Some((*h, *r)) } else { None }) + .inspect(|(h, r)| log::debug!("heights/results: {:#?}, {:#?}", h, r)) + .unzip(); + height_indices.resize(N, 0); + results.resize(N, false); + + output_stream.write_value::>( + ProofMapReduceStateValue:: { + height_indices, + results, + }, + ) + } +} + +impl MergeProofReductionHint { + fn merge, const D: usize>( + self, + b: &mut CircuitBuilder, + left: &ProofMapReduceState, + right: &ProofMapReduceState, + ) -> ProofMapReduceState { + let mut input_stream = VariableStream::new(); + input_stream.write::>(left); + input_stream.write::>(right); + + let output_stream = b.hint(input_stream, self); + output_stream.read::>(b) } } @@ -247,8 +303,8 @@ mod beefy_tests { fn beefy_test_verify_e2e() { let (header, _, _) = testnet_state(); - const AMT: usize = 4; - const BATCH: usize = 1; + const AMT: usize = 8; + const BATCH: usize = 2; fn tx(hash: &str, sender: &str) -> TransactionOrReceiptId { TransactionOrReceiptId::Transaction { @@ -268,19 +324,19 @@ mod beefy_tests { "3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz", "zavodil.testnet", ), - // rx( - // "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", - // "priceoracle.testnet", - // ), - // rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), - // tx( - // "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", - // "hotwallet.dev-kaiching.testnet", - // ), - // rx( - // "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", - // "wallet.dev-kaiching.testnet", - // ), + rx( + "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", + "priceoracle.testnet", + ), + rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), + tx( + "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", + "hotwallet.dev-kaiching.testnet", + ), + rx( + "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", + "wallet.dev-kaiching.testnet", + ), // rx("9Zp41hsK5NEfkjiv3PhtqpgbRiHqsvpFcwe6CHrQ2kh2", "system"), tx( "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", From 3984c2f688010aa85b30f1be05dadf9752bb77cf Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 2 Feb 2024 20:07:14 +0000 Subject: [PATCH 27/67] feat: expose to succinctx --- bin/operator/Cargo.toml | 8 ++- bin/operator/src/main.rs | 13 +++- circuits/plonky2x/src/lib.rs | 98 +++++++++-------------------- circuits/plonky2x/src/test_utils.rs | 8 +-- crates/rpc/src/lib.rs | 10 +++ succinct.json | 12 +++- 6 files changed, 73 insertions(+), 76 deletions(-) diff --git a/bin/operator/Cargo.toml b/bin/operator/Cargo.toml index 2437e53..4b51c4c 100644 --- a/bin/operator/Cargo.toml +++ b/bin/operator/Cargo.toml @@ -11,10 +11,16 @@ name = "sync" path = "src/main.rs" required-features = [ "sync" ] +[[bin]] +name = "verify" +path = "src/main.rs" +required-features = [ "verify" ] + [dependencies] cfg-if = "*" near-light-clientx.workspace = true [features] -default = [ "sync" ] +default = [ ] sync = [ ] +verify = [ ] diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 25f8fb4..3c4b437 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -1,9 +1,18 @@ -use near_light_clientx::{plonky2x::backend::function::Plonky2xFunction, SyncCircuit}; +use near_light_clientx::plonky2x::backend::function::Plonky2xFunction; + +// Testnet +const NETWORK: usize = 1; fn main() { cfg_if::cfg_if! { if #[cfg(feature = "sync")] { - SyncCircuit::entrypoint(); + use near_light_clientx::SyncCircuit; + SyncCircuit::::entrypoint(); + } else if #[cfg(feature = "verify")] { + const PROOF_AMT: usize = 64; + const PROOF_BATCH_SIZE: usize = 8; + use near_light_clientx::VerifyCircuit; + VerifyCircuit::::entrypoint(); } else { panic!("No circuit feature enabled"); } diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index 1635c61..76dbc4a 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,21 +1,11 @@ -#![feature(generic_const_exprs)] - -use std::collections::VecDeque; - use builder::Sync; use hint::FetchNextHeaderInputs; -use near_light_client_protocol::prelude::Itertools; use plonky2x::frontend::hint::simple::hint::Hint; -use plonky2x::frontend::mapreduce::generator::{MapReduceDynamicGenerator, MapReduceGenerator}; -use plonky2x::prelude::plonky2::hash::hashing::PlonkyPermutation; -use plonky2x::prelude::plonky2::iop::target::BoolTarget; +use plonky2x::frontend::mapreduce::generator::MapReduceDynamicGenerator; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use serde::{Deserialize, Serialize}; -use variables::{ - BlockHeightVariable, BpsArr, CryptoHashVariable, HashBpsInputs, HeaderVariable, - ValidatorStakeVariable, -}; -use variables::{BuildEndorsement, EncodeInner, SyncedVariable}; +use variables::{BlockHeightVariable, HashBpsInputs, HeaderVariable}; +use variables::{BuildEndorsement, EncodeInner}; use crate::builder::Verify; use crate::hint::FetchProofInputs; @@ -44,28 +34,30 @@ mod test_utils; // protocol crate // TODO: determine fees, allows integrators to charge #[derive(Debug, Clone)] -pub struct SyncCircuit; +pub struct SyncCircuit; -impl Circuit for SyncCircuit { +impl Circuit for SyncCircuit { fn define, const D: usize>(b: &mut CircuitBuilder) where <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: plonky2::plonk::config::AlgebraicHasher<>::Field>, { - let network = near_light_client_rpc::Network::Testnet; let trusted_head = b.evm_read::(); - // This is a very interesting cheat to be able to get the BPS for the next epoch - // without the need to store the BPS, we can verify the hash of the BPS in the circuit - let bps = FetchNextHeaderInputs(near_light_client_rpc::Network::Testnet) + // This is a very interesting trick to be able to get the BPS for the next epoch + // without the need to store the BPS, we verify the hash of the BPS in the circuit + let bps = FetchNextHeaderInputs(NETWORK.into()) .fetch(b, &trusted_head.inner_lite.next_epoch_id) .unwrap() .next_bps; + let bps_hash = HashBpsInputs.hash(b, &bps); b.assert_is_equal(trusted_head.inner_lite.next_bp_hash, bps_hash); let head_hash = trusted_head.hash(b); - let next_block = FetchNextHeaderInputs(network).fetch(b, &head_hash).unwrap(); + let next_block = FetchNextHeaderInputs(NETWORK.into()) + .fetch(b, &head_hash) + .unwrap(); b.watch(&bps_hash, "calculate_bps_hash"); let synced = b.sync(&trusted_head, &bps, &next_block); @@ -97,36 +89,34 @@ pub struct ProofMapReduceCtx { } #[derive(Debug, Clone)] -pub struct ProofCircuit; +pub struct VerifyCircuit; -impl Circuit for ProofCircuit { +impl Circuit + for VerifyCircuit +{ fn define, const D: usize>(b: &mut CircuitBuilder) where <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: plonky2::plonk::config::AlgebraicHasher<>::Field>, { - assert!(N % B == 0, "Cannot batch by this configuration"); - - let network = near_light_client_rpc::Network::Testnet; + assert!( + N % B == 0, + "Cannot batch by this configuration, must be a power of 2" + ); let trusted_head = b.read::(); let ids = b.read::>(); - let proofs = FetchProofInputs::(network).fetch(b, &trusted_head, &ids.data); - - let zero = b.zero::(); - let _false = b._false(); - - let ctx = ProofMapReduceCtx { - zero, - result: _false, - }; + let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); let output = b .mapreduce_dynamic::<_, ProofVariable, ProofMapReduceState, Self, B, _, _>( - ctx, + (), proofs.data, |ctx, proofs, b| { + let zero = b.zero::(); + let _false = b._false(); + let mut heights = vec![]; let mut results = vec![]; for p in proofs.data { @@ -136,8 +126,8 @@ impl Circuit for ProofCircuit { b.watch_slice(&heights, "map job -- heights"); b.watch_slice(&results, "map job -- results"); - heights.resize(N, ctx.zero); - results.resize(N, ctx.result); + heights.resize(N, zero); + results.resize(N, _false); let state = ProofMapReduceState { height_indices: heights.into(), @@ -250,18 +240,18 @@ mod beefy_tests { }; use ::test_utils::CryptoHash; use near_light_client_protocol::{prelude::Itertools, ValidatorStake}; - use near_light_client_rpc::{LightClientRpc, NearRpcClient}; use near_primitives::types::{AccountId, TransactionOrReceiptId}; use serial_test::serial; + const NETWORK: usize = 1; + #[test] #[serial] fn beefy_test_sync_e2e() { - const SYNC_AMT: usize = 1; let (header, _, _) = testnet_state(); let define = |b: &mut B| { - SyncCircuit::define(b); + SyncCircuit::::define(b); }; let writer = |input: &mut PI| { input.evm_write::(header.into()); @@ -272,32 +262,6 @@ mod beefy_tests { builder_suite(define, writer, assertions); } - fn account_ids>(bps: Vec) -> Vec { - bps.into_iter() - .map(Into::::into) - .map(|x| x.account_id().clone()) - .collect_vec() - } - - #[tokio::test] - async fn test_epoch_madness() { - use pretty_assertions::assert_eq; - let c = NearRpcClient::new(near_light_client_rpc::Network::Testnet); - let (h, bps, n) = testnet_state(); - println!("{:#?}", h); - - assert_eq!(h.inner_lite.next_bp_hash, CryptoHash::hash_borsh(&bps)); - let bps = account_ids(bps); - - let next_epoch = c.fetch_latest_header(&h.inner_lite.next_epoch_id).await; - let ne_nbps = account_ids(next_epoch.unwrap().unwrap().next_bps.unwrap()); - assert_eq!(ne_nbps, bps); - - let nb_epoch = c.fetch_latest_header(&n.inner_lite.epoch_id).await; - let nb_nbps = account_ids(nb_epoch.unwrap().unwrap().next_bps.unwrap()); - assert_eq!(nb_nbps, bps); - } - #[test] #[serial] fn beefy_test_verify_e2e() { @@ -358,7 +322,7 @@ mod beefy_tests { assert_eq!(txs.len(), AMT); let define = |b: &mut B| { - ProofCircuit::::define(b); + VerifyCircuit::::define(b); }; let writer = |input: &mut PI| { input.write::(header.into()); diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index 7af59be..bdac923 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -27,11 +27,9 @@ pub fn builder_suite( let mut inputs = circuit.input(); writer(&mut inputs); - // if let PublicInput::Bytes(bytes) = &mut inputs { - // std::fs::write("input.bin", hex!(bytes)).unwrap(); - // } else { - // panic!("input is not bytes"); - // } + if let PublicInput::Bytes(bytes) = &mut inputs { + std::fs::write("input.bin", hex!(bytes)).unwrap(); + } let (proof, output) = circuit.prove(&inputs); diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 205c6fc..b5b9013 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -45,6 +45,16 @@ impl Network { } } +impl From for Network { + fn from(n: usize) -> Self { + match n { + 0 => Self::Mainnet, + 1 => Self::Testnet, + _ => Self::Localnet, + } + } +} + impl Display for Network { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let s = match self { diff --git a/succinct.json b/succinct.json index b87fd55..105efea 100644 --- a/succinct.json +++ b/succinct.json @@ -4,11 +4,21 @@ "name": "sync", "framework": "plonky2x", "baseDir": ".", - "buildCommand": "cargo build --release --bin sync && mv target/release/sync build/ && RUST_LOG=debug ./build/sync build", + "buildCommand": "cargo build --release --bin sync --features=sync && mv target/release/sync build/ && RUST_LOG=debug ./build/sync build", "proveCommand": "RUST_LOG=debug ./build/sync prove input.json", "requiredArtifacts": [ "sync" ] + }, + { + "name": "verify", + "framework": "plonky2x", + "baseDir": ".", + "buildCommand": "cargo build --release --bin verify --features=verify && mv target/release/verify build/ && RUST_LOG=debug ./build/verify build", + "proveCommand": "RUST_LOG=debug ./build/verify prove input.json", + "requiredArtifacts": [ + "verify" + ] } ] } From c4acc369ea9257edd0c180f302b65499161ab995 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 5 Feb 2024 11:38:10 +0000 Subject: [PATCH 28/67] chore: add statelessnet --- bin/client/Cargo.toml | 44 +++++++++++++++++++++------------------- bin/client/src/config.rs | 2 ++ crates/rpc/src/lib.rs | 15 +++++++------- statelessnet.toml | 5 +++++ 4 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 statelessnet.toml diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml index 279ffa0..9032d08 100644 --- a/bin/client/Cargo.toml +++ b/bin/client/Cargo.toml @@ -5,31 +5,33 @@ name = "near-light-client" version.workspace = true [dependencies] -anyhow.workspace = true -async-trait.workspace = true -axum.workspace = true -borsh.workspace = true -coerce.workspace = true -config.workspace = true -either.workspace = true -futures.workspace = true -hex.workspace = true -itertools.workspace = true -log.workspace = true +anyhow.workspace = true +async-trait.workspace = true +axum.workspace = true +borsh.workspace = true +reqwest.workspace = true +serde.workspace = true +serde_json.workspace = true +sled.workspace = true +thiserror.workspace = true +tokio.workspace = true +coerce.workspace = true +config.workspace = true +either.workspace = true +futures.workspace = true +hex.workspace = true +itertools.workspace = true +log.workspace = true +pretty_env_logger.workspace = true +protobuf.workspace = true + near-crypto.workspace = true near-jsonrpc-client.workspace = true near-primitives-core.workspace = true near-primitives.workspace = true -pretty_env_logger.workspace = true -protobuf.workspace = true -protocol = { path = "../../crates/protocol", package = "near-light-client-protocol" } -reqwest.workspace = true -rpc = { path = "../../crates/rpc", package = "near-light-client-rpc" } -serde.workspace = true -serde_json.workspace = true -sled.workspace = true -thiserror.workspace = true -tokio.workspace = true + +protocol = { path = "../../crates/protocol", package = "near-light-client-protocol" } +rpc = { path = "../../crates/rpc", package = "near-light-client-rpc" } [dev-dependencies] rand = "*" diff --git a/bin/client/src/config.rs b/bin/client/src/config.rs index cea5eb8..6a37c03 100644 --- a/bin/client/src/config.rs +++ b/bin/client/src/config.rs @@ -27,6 +27,8 @@ impl Config { let run_mode = env::var("NEAR_LIGHT_CLIENT_NETWORK") .unwrap_or_else(|_| "testnet".into()) .to_lowercase(); + log::debug!("Run mode {run_mode}"); + let default_path = env::var("NEAR_LIGHT_CLIENT_CONFIG_FILE").unwrap_or_else(|_| "default".to_string()); diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index b5b9013..688fac5 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -2,15 +2,11 @@ use crate::prelude::*; use async_trait::async_trait; use futures::TryFutureExt; use near_jsonrpc_client::{ - methods::{ - self, light_client_proof::RpcLightClientExecutionProofResponse, - validators::RpcValidatorResponse, - }, + methods::{self, light_client_proof::RpcLightClientExecutionProofResponse}, JsonRpcClient, }; -use near_primitives::{ - types::{validator_stake::ValidatorStake, ValidatorStakeV1}, - views::{validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1}, +use near_primitives::views::{ + validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1, }; use std::fmt::{Display, Formatter}; @@ -22,6 +18,7 @@ pub enum Network { #[default] Testnet, Localnet, + Statelessnet, } impl Network { @@ -31,6 +28,7 @@ impl Network { match self { Self::Mainnet => MAINNET_RPC_ENDPOINT, Self::Testnet => TESTNET_RPC_ENDPOINT, + Self::Statelessnet => "https://rpc.statelessnet.near.org", _ => "http://`localhost:3030", } } @@ -40,6 +38,7 @@ impl Network { match self { Self::Mainnet => MAINNET_RPC_ARCHIVE_ENDPOINT, Self::Testnet => TESTNET_RPC_ARCHIVE_ENDPOINT, + Self::Statelessnet => "https://archival-rpc.statelessnet.near.org", _ => "http://`localhost:3030", } } @@ -50,6 +49,7 @@ impl From for Network { match n { 0 => Self::Mainnet, 1 => Self::Testnet, + 48 => Self::Statelessnet, _ => Self::Localnet, } } @@ -60,6 +60,7 @@ impl Display for Network { let s = match self { Self::Mainnet => "mainnet", Self::Testnet => "testnet", + Self::Statelessnet => "statelessnet", _ => "localnet", }; write!(f, "{}", s) diff --git a/statelessnet.toml b/statelessnet.toml new file mode 100644 index 0000000..646ff68 --- /dev/null +++ b/statelessnet.toml @@ -0,0 +1,5 @@ +catchup = true +host = "0.0.0.0:3030" +network = "Statelessnet" +starting_head = "HqbXSLFKKvNiqruwkYj2pittRZJyXuBKHRWTVHRVcwEb" +state_path = "statelessnetstate.db" From 1e857f514c3d2bd3648990623c559d85b2fc0ae4 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 5 Feb 2024 14:34:16 +0000 Subject: [PATCH 29/67] feat: reformat and split modules --- .gitignore | 2 +- bin/client/src/client/message.rs | 3 +- bin/client/src/client/mod.rs | 16 +- bin/client/src/client/store.rs | 8 +- bin/client/src/config.rs | 6 +- bin/client/src/controller.rs | 9 +- bin/client/src/main.rs | 3 +- circuits/plonky2x/src/builder.rs | 39 +-- circuits/plonky2x/src/circuits/mod.rs | 5 + circuits/plonky2x/src/circuits/sync.rs | 110 ++++++++ circuits/plonky2x/src/circuits/verify.rs | 256 ++++++++++++++++++ circuits/plonky2x/src/hint.rs | 17 +- circuits/plonky2x/src/lib.rs | 327 +---------------------- circuits/plonky2x/src/merkle.rs | 5 +- circuits/plonky2x/src/test_utils.rs | 9 +- circuits/plonky2x/src/variables.rs | 30 +-- crates/protocol/src/config.rs | 4 +- crates/protocol/src/experimental.rs | 13 +- crates/protocol/src/lib.rs | 22 +- crates/protocol/src/merkle_util.rs | 7 +- crates/protocol/src/prelude.rs | 12 +- crates/rpc/src/lib.rs | 6 +- crates/rpc/src/prelude.rs | 12 +- crates/test-utils/src/lib.rs | 3 +- rustfmt.toml | 8 + 25 files changed, 502 insertions(+), 430 deletions(-) create mode 100644 circuits/plonky2x/src/circuits/mod.rs create mode 100644 circuits/plonky2x/src/circuits/sync.rs create mode 100644 circuits/plonky2x/src/circuits/verify.rs create mode 100644 rustfmt.toml diff --git a/.gitignore b/.gitignore index e14e618..e1b5154 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ local.toml -state.db +*.db diff --git a/bin/client/src/client/message.rs b/bin/client/src/client/message.rs index 7c44749..e2b7ce0 100644 --- a/bin/client/src/client/message.rs +++ b/bin/client/src/client/message.rs @@ -1,8 +1,9 @@ -use crate::prelude::*; use coerce::actor::message::Message; use near_primitives::types::TransactionOrReceiptId; use protocol::{experimental::Proof as ExperimentalProof, Proof}; +use crate::prelude::*; + pub struct Shutdown; impl Message for Shutdown { diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 739e80a..423d558 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -1,17 +1,19 @@ -use self::{message::BatchGetProof, store::Store}; -use crate::prelude::*; -use crate::{ - client::store::{head_key, Collection, Entity}, - config::Config, -}; +use std::{str::FromStr, sync::Arc}; + use coerce::actor::{context::ActorContext, message::Handler, Actor}; use message::{Archive, GetProof, Head, Shutdown, VerifyProof}; use near_primitives::views::validator_stake_view::ValidatorStakeView; use protocol::{Proof, Protocol}; use rpc::LightClientRpc; -use std::{str::FromStr, sync::Arc}; use tokio::time; +use self::{message::BatchGetProof, store::Store}; +use crate::{ + client::store::{head_key, Collection, Entity}, + config::Config, + prelude::*, +}; + pub mod message; mod store; diff --git a/bin/client/src/client/store.rs b/bin/client/src/client/store.rs index ef71065..649438a 100644 --- a/bin/client/src/client/store.rs +++ b/bin/client/src/client/store.rs @@ -1,9 +1,10 @@ -use super::Header; -use crate::prelude::*; use ::sled::IVec; use near_primitives::types::validator_stake::ValidatorStake; use tokio::sync::RwLock; +use super::Header; +use crate::prelude::*; + pub struct Store(pub RwLock); impl Store { @@ -99,11 +100,12 @@ pub fn head_key() -> CryptoHash { } pub mod sled { - use super::*; use ::sled::{open, transaction::TransactionError, Batch, Db, Transactional, Tree}; use borsh::ser::BorshSerialize as BorshSerializeExt; use itertools::Itertools; + use super::*; + pub struct Store { db: Db, block_producers: Tree, diff --git a/bin/client/src/config.rs b/bin/client/src/config.rs index 6a37c03..df8b86f 100644 --- a/bin/client/src/config.rs +++ b/bin/client/src/config.rs @@ -1,7 +1,9 @@ -use crate::prelude::*; +use std::{env, path::PathBuf}; + use config::{Config as ConfigTrait, ConfigError, Environment, File}; use rpc::Network; -use std::{env, path::PathBuf}; + +use crate::prelude::*; #[derive(Debug, Deserialize, Clone)] pub struct Config { diff --git a/bin/client/src/controller.rs b/bin/client/src/controller.rs index c5f6501..4383da8 100644 --- a/bin/client/src/controller.rs +++ b/bin/client/src/controller.rs @@ -1,5 +1,3 @@ -use crate::prelude::*; -use crate::{client::LightClient, config::Config}; use axum::{ extract::{Path, State}, http::StatusCode, @@ -10,6 +8,8 @@ use axum::{ use coerce::actor::LocalActorRef; use tokio::task::JoinHandle; +use crate::{client::LightClient, config::Config, prelude::*}; + // TODO: replace with jsonrpc pub(crate) fn init(config: &Config, ctx: LocalActorRef) -> JoinHandle> { let controller = Router::new() @@ -78,11 +78,12 @@ mod header { } mod proof { - use super::*; - use crate::client::message::{BatchGetProof, GetProof, VerifyProof}; use axum::Json; use protocol::Proof; + use super::*; + use crate::client::message::{BatchGetProof, GetProof, VerifyProof}; + pub(super) async fn post_get_proof( State(client): State>, Json(params): Json, diff --git a/bin/client/src/main.rs b/bin/client/src/main.rs index b38a1d6..48844ff 100644 --- a/bin/client/src/main.rs +++ b/bin/client/src/main.rs @@ -1,6 +1,7 @@ -use crate::client::{message::Shutdown, LightClient}; use coerce::actor::{system::ActorSystem, IntoActor}; +use crate::client::{message::Shutdown, LightClient}; + mod client; mod config; mod controller; diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index b9ba5a1..fc771d7 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -1,14 +1,16 @@ -use crate::merkle::{MerklePathVariable, NearMerkleTree}; -use crate::variables::{ - ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, BuildEndorsement, - CryptoHashVariable, HeaderVariable, ProofVariable, StakeInfoVariable, SyncedVariable, - ValidatorStakeVariable, -}; -use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; -use near_light_client_protocol::prelude::Itertools; +use near_light_client_protocol::{config::NUM_BLOCK_PRODUCER_SEATS, prelude::Itertools}; use plonky2x::prelude::*; use pretty_assertions::assert_eq; +use crate::{ + merkle::{MerklePathVariable, NearMerkleTree}, + variables::{ + ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, + BuildEndorsement, CryptoHashVariable, HeaderVariable, ProofVariable, StakeInfoVariable, + SyncedVariable, ValidatorStakeVariable, + }, +}; + pub trait Ensure, const D: usize> { fn ensure_not_already_verified( &mut self, @@ -288,7 +290,8 @@ impl, const D: usize> Sync for CircuitBuilder self.curta_sha256_pair(next_block.next_block_inner_hash, next_header_hash); let should_hint = false; - // TODO: decide if we should constrain this way or just hint in the manual encodes + // TODO: decide if we should constrain this way or just hint in the manual + // encodes if should_hint { let mut input_stream = VariableStream::new(); input_stream.write(&next_block_hash); @@ -359,12 +362,11 @@ fn to_le_bytes, V: CircuitVariable, const D: usize, const #[cfg(test)] mod tests { + use near_light_client_protocol::{Protocol, StakeInfo}; + use self::assert_eq; use super::*; - use crate::test_utils::*; - use crate::variables::*; - use near_light_client_protocol::Protocol; - use near_light_client_protocol::StakeInfo; + use crate::{test_utils::*, variables::*}; #[test] fn test_header_hash() { @@ -555,14 +557,15 @@ mod tests { #[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { - use crate::builder::Ensure; - use crate::builder::Sync; - use crate::builder::Verify; - use crate::test_utils::*; - use crate::variables::*; use near_light_client_protocol::prelude::BasicProof; use serial_test::serial; + use crate::{ + builder::{Ensure, Sync, Verify}, + test_utils::*, + variables::*, + }; + #[test] #[serial] fn beefy_test_next_bps() { diff --git a/circuits/plonky2x/src/circuits/mod.rs b/circuits/plonky2x/src/circuits/mod.rs new file mode 100644 index 0000000..3b2075c --- /dev/null +++ b/circuits/plonky2x/src/circuits/mod.rs @@ -0,0 +1,5 @@ +pub mod sync; +pub mod verify; + +pub use sync::SyncCircuit; +pub use verify::VerifyCircuit; diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs new file mode 100644 index 0000000..d1c23ab --- /dev/null +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -0,0 +1,110 @@ +pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; + +use crate::{ + builder::Sync, + hint::FetchNextHeaderInputs, + variables::{ + BlockHeightVariable, BuildEndorsement, EncodeInner, HashBpsInputs, HeaderVariable, + }, +}; + +// TODO: determine how much we can bootstrap from RB +// TODO: sync & prove for txs later than sync head +// TODO: async proof requests, based on a receipt/txs id (should be able to use +// light client rpc lib TODO: batch proof requests for a set of receipts/txs, +// must be bounded TODO: batching/experimental proofs +// TODO[Style]: Shared trait for protocol functionality between crate <> circuit +// TODO[Style]: macro to share all the same implementation with semantic type +// differences between protocol crate +// TODO: determine fees, allows integrators to charge +#[derive(Debug, Clone)] +pub struct SyncCircuit; + +impl Circuit for SyncCircuit { + fn define, const D: usize>(b: &mut CircuitBuilder) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher<>::Field>, + { + let trusted_head = b.evm_read::(); + + // This is a very interesting trick to be able to get the BPS for the next epoch + // without the need to store the BPS, we verify the hash of the BPS in the + // circuit + let bps = FetchNextHeaderInputs(NETWORK.into()) + .fetch(b, &trusted_head.inner_lite.next_epoch_id) + .unwrap() + .next_bps; + + let bps_hash = HashBpsInputs.hash(b, &bps); + b.assert_is_equal(trusted_head.inner_lite.next_bp_hash, bps_hash); + + let head_hash = trusted_head.hash(b); + let next_block = FetchNextHeaderInputs(NETWORK.into()) + .fetch(b, &head_hash) + .unwrap(); + b.watch(&bps_hash, "calculate_bps_hash"); + + let synced = b.sync(&trusted_head, &bps, &next_block); + b.evm_write::(synced.new_head); + } + + fn register_generators, const D: usize>(registry: &mut HintRegistry) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher, + { + registry.register_async_hint::(); + registry.register_hint::(); + registry.register_hint::(); + registry.register_hint::(); + } +} + +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofMapReduceVariable { + pub height_indices: ArrayVariable, + pub results: ArrayVariable, +} + +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofMapReduceCtx { + pub zero: BlockHeightVariable, + pub result: BoolVariable, +} + +#[cfg(feature = "beefy-tests")] +#[cfg(test)] +mod beefy_tests { + use std::str::FromStr; + + use ::test_utils::CryptoHash; + use near_light_client_protocol::prelude::Itertools; + use near_primitives::types::TransactionOrReceiptId; + use serial_test::serial; + + use super::*; + use crate::{ + test_utils::{builder_suite, testnet_state, B, PI, PO}, + variables::TransactionOrReceiptIdVariableValue, + }; + + const NETWORK: usize = 1; + + #[test] + #[serial] + fn beefy_test_sync_e2e() { + let (header, _, _) = testnet_state(); + + let define = |b: &mut B| { + SyncCircuit::::define(b); + }; + let writer = |input: &mut PI| { + input.evm_write::(header.into()); + }; + let assertions = |mut output: PO| { + println!("{:#?}", output.evm_read::()); + }; + builder_suite(define, writer, assertions); + } +} diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs new file mode 100644 index 0000000..a012630 --- /dev/null +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -0,0 +1,256 @@ +use plonky2x::frontend::{ + hint::simple::hint::Hint, mapreduce::generator::MapReduceDynamicGenerator, +}; +pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; +use serde::{Deserialize, Serialize}; + +use crate::{ + builder::Verify, + hint::FetchProofInputs, + variables::{ + BlockHeightVariable, EncodeInner, HeaderVariable, ProofVariable, + TransactionOrReceiptIdVariable, + }, +}; + +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofMapReduceVariable { + pub height_indices: ArrayVariable, + pub results: ArrayVariable, +} + +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofMapReduceCtx { + pub zero: BlockHeightVariable, + pub result: BoolVariable, +} + +#[derive(Debug, Clone)] +pub struct VerifyCircuit; + +impl Circuit + for VerifyCircuit +{ + fn define, const D: usize>(b: &mut CircuitBuilder) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher<>::Field>, + { + assert!( + N % B == 0, + "Cannot batch by this configuration, must be a power of 2" + ); + + let trusted_head = b.read::(); + let ids = b.read::>(); + + let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); + + let output = b + .mapreduce_dynamic::<_, ProofVariable, ProofMapReduceVariable, Self, B, _, _>( + (), + proofs.data, + |ctx, proofs, b| { + let zero = b.zero::(); + let _false = b._false(); + + let mut heights = vec![]; + let mut results = vec![]; + for p in proofs.data { + heights.push(p.block_header.inner_lite.height); + results.push(b.verify(p)); + } + b.watch_slice(&heights, "map job -- heights"); + b.watch_slice(&results, "map job -- results"); + + heights.resize(N, zero); + results.resize(N, _false); + + let state = ProofMapReduceVariable { + height_indices: heights.into(), + results: results.into(), + }; + + state + }, + |_ctx, left, right, b| MergeProofHint::.merge(b, &left, &right), + ); + b.write::>(output); + } + + fn register_generators, const D: usize>(registry: &mut HintRegistry) + where + <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: + plonky2::plonk::config::AlgebraicHasher, + { + registry.register_async_hint::>(); + registry.register_hint::(); + + let dynamic_id = MapReduceDynamicGenerator::::id(); + + registry.register_simple::, + Self, + B, + D, + >>(dynamic_id); + registry.register_hint::>(); + } +} + +// Hinting for this as it's taking too much effort to do it in a constrained way +// +// |ctx, mut left, right, b| { +// let mut r_heights = right.height_indices.data; +// let mut r_results = right.results.data; +// +// left.height_indices +// .data +// .iter_mut() +// .zip(left.results.data.iter_mut()) +// .for_each(|(h, r)| { +// let is_zero = b.is_equal(h.clone(), ctx.zero); +// *h = b.select(is_zero, r_heights.pop().unwrap(), *h); +// *r = b.select(is_zero, r_results.pop().unwrap(), *r); +// }); +// +// left +// }, +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct MergeProofHint; + +impl, const D: usize, const N: usize> Hint for MergeProofHint { + fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { + let left = input_stream.read_value::>(); + let right = input_stream.read_value::>(); + + let (mut height_indices, mut results): (Vec<_>, Vec<_>) = left + .height_indices + .iter() + .chain(right.height_indices.iter()) + .zip(left.results.iter().chain(right.results.iter())) + .filter_map(|(h, r)| if *h != 0 { Some((*h, *r)) } else { None }) + .inspect(|(h, r)| log::debug!("heights/results: {:#?}, {:#?}", h, r)) + .unzip(); + height_indices.resize(N, 0); + results.resize(N, false); + + output_stream.write_value::>(ProofMapReduceVariableValue::< + N, + L::Field, + > { + height_indices, + results, + }) + } +} + +impl MergeProofHint { + fn merge, const D: usize>( + self, + b: &mut CircuitBuilder, + left: &ProofMapReduceVariable, + right: &ProofMapReduceVariable, + ) -> ProofMapReduceVariable { + let mut input_stream = VariableStream::new(); + input_stream.write::>(left); + input_stream.write::>(right); + + let output_stream = b.hint(input_stream, self); + output_stream.read::>(b) + } +} + +#[cfg(feature = "beefy-tests")] +#[cfg(test)] +mod beefy_tests { + use std::str::FromStr; + + use ::test_utils::CryptoHash; + use near_light_client_protocol::prelude::Itertools; + use near_primitives::types::TransactionOrReceiptId; + use serial_test::serial; + + use super::*; + use crate::{ + test_utils::{builder_suite, testnet_state, B, PI, PO}, + variables::TransactionOrReceiptIdVariableValue, + }; + + const NETWORK: usize = 1; + + #[test] + #[serial] + fn beefy_test_verify_e2e() { + let (header, _, _) = testnet_state(); + + const AMT: usize = 8; + const BATCH: usize = 2; + + fn tx(hash: &str, sender: &str) -> TransactionOrReceiptId { + TransactionOrReceiptId::Transaction { + transaction_hash: CryptoHash::from_str(hash).unwrap(), + sender_id: sender.parse().unwrap(), + } + } + fn rx(hash: &str, receiver: &str) -> TransactionOrReceiptId { + TransactionOrReceiptId::Receipt { + receipt_id: CryptoHash::from_str(hash).unwrap(), + receiver_id: receiver.parse().unwrap(), + } + } + + // TODO: test way more of these, pull the last 64 transactions and prove them + let txs: Vec> = vec![ + tx( + "3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz", + "zavodil.testnet", + ), + rx( + "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", + "priceoracle.testnet", + ), + rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), + tx( + "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", + "hotwallet.dev-kaiching.testnet", + ), + rx( + "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", + "wallet.dev-kaiching.testnet", + ), + tx( + "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", + "operator_manager.orderly.testnet", + ), + tx( + "FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg", + "operator-manager.orderly-qa.testnet", + ), + tx( + "4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST", + "operator-manager.orderly-dev.testnet", + ), + ] + .into_iter() + .map(Into::into) + .collect_vec(); + + assert_eq!(txs.len(), AMT); + + let define = |b: &mut B| { + VerifyCircuit::::define(b); + }; + let writer = |input: &mut PI| { + input.write::(header.into()); + input.write::>(txs.into()); + }; + let assertions = |mut output: PO| { + println!("{:#?}", output.read::>()); + }; + builder_suite(define, writer, assertions); + } +} diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index dde55c0..0675890 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -1,17 +1,14 @@ -use crate::variables::normalise_account_id; -use crate::variables::BlockVariable; -use crate::variables::CryptoHashVariable; -use crate::variables::HeaderVariable; -use crate::variables::ProofVariable; -use crate::variables::TransactionOrReceiptIdVariable; use async_trait::async_trait; -use near_light_client_protocol::prelude::CryptoHash; -use near_light_client_protocol::Proof; -use near_light_client_rpc::prelude::GetProof; -use near_light_client_rpc::{LightClientRpc, NearRpcClient, Network}; +use near_light_client_protocol::{prelude::CryptoHash, Proof}; +use near_light_client_rpc::{prelude::GetProof, LightClientRpc, NearRpcClient, Network}; use plonky2x::{frontend::hint::asynchronous::hint::AsyncHint, prelude::*}; use serde::{Deserialize, Serialize}; +use crate::variables::{ + normalise_account_id, BlockVariable, CryptoHashVariable, HeaderVariable, ProofVariable, + TransactionOrReceiptIdVariable, +}; + #[derive(Debug, Clone, Deserialize, Serialize)] pub struct FetchNextHeaderInputs(pub Network); diff --git a/circuits/plonky2x/src/lib.rs b/circuits/plonky2x/src/lib.rs index 76dbc4a..273df1a 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/circuits/plonky2x/src/lib.rs @@ -1,18 +1,9 @@ -use builder::Sync; -use hint::FetchNextHeaderInputs; -use plonky2x::frontend::hint::simple::hint::Hint; -use plonky2x::frontend::mapreduce::generator::MapReduceDynamicGenerator; +pub use circuits::*; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; -use serde::{Deserialize, Serialize}; -use variables::{BlockHeightVariable, HashBpsInputs, HeaderVariable}; -use variables::{BuildEndorsement, EncodeInner}; - -use crate::builder::Verify; -use crate::hint::FetchProofInputs; -use crate::variables::{ProofVariable, TransactionOrReceiptIdVariable}; /// Building blocks injected into the CircuitBuilder mod builder; +pub mod circuits; mod hint; /// Unprefixed merkle tree without collision resistance mod merkle; @@ -20,317 +11,3 @@ mod variables; #[cfg(test)] mod test_utils; - -// TODO: epoch sync, store head per epoch -// TODO: determine how much we can bootstrap from RB -// TODO: sync & prove for txs later than sync head -// TODO: async proof requests, based on a receipt/txs id (should be able to use light client rpc lib -// TODO: batch proof requests for a set of receipts/txs, must be bounded -// TODO: proof relay -// TODO: proof relay batches and batching factor -// TODO: batching/experimental proofs -// TODO[Style]: Shared trait for protocol functionality between crate <> circuit -// TODO[Style]: macro to share all the same implementation with semantic type differences between -// protocol crate -// TODO: determine fees, allows integrators to charge -#[derive(Debug, Clone)] -pub struct SyncCircuit; - -impl Circuit for SyncCircuit { - fn define, const D: usize>(b: &mut CircuitBuilder) - where - <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: - plonky2::plonk::config::AlgebraicHasher<>::Field>, - { - let trusted_head = b.evm_read::(); - - // This is a very interesting trick to be able to get the BPS for the next epoch - // without the need to store the BPS, we verify the hash of the BPS in the circuit - let bps = FetchNextHeaderInputs(NETWORK.into()) - .fetch(b, &trusted_head.inner_lite.next_epoch_id) - .unwrap() - .next_bps; - - let bps_hash = HashBpsInputs.hash(b, &bps); - b.assert_is_equal(trusted_head.inner_lite.next_bp_hash, bps_hash); - - let head_hash = trusted_head.hash(b); - let next_block = FetchNextHeaderInputs(NETWORK.into()) - .fetch(b, &head_hash) - .unwrap(); - b.watch(&bps_hash, "calculate_bps_hash"); - - let synced = b.sync(&trusted_head, &bps, &next_block); - b.evm_write::(synced.new_head); - } - - fn register_generators, const D: usize>(registry: &mut HintRegistry) - where - <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: - plonky2::plonk::config::AlgebraicHasher, - { - registry.register_async_hint::(); - registry.register_hint::(); - registry.register_hint::(); - registry.register_hint::(); - } -} - -#[derive(CircuitVariable, Debug, Clone)] -pub struct ProofMapReduceState { - pub height_indices: ArrayVariable, - pub results: ArrayVariable, -} - -#[derive(CircuitVariable, Debug, Clone)] -pub struct ProofMapReduceCtx { - pub zero: BlockHeightVariable, - pub result: BoolVariable, -} - -#[derive(Debug, Clone)] -pub struct VerifyCircuit; - -impl Circuit - for VerifyCircuit -{ - fn define, const D: usize>(b: &mut CircuitBuilder) - where - <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: - plonky2::plonk::config::AlgebraicHasher<>::Field>, - { - assert!( - N % B == 0, - "Cannot batch by this configuration, must be a power of 2" - ); - - let trusted_head = b.read::(); - let ids = b.read::>(); - - let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); - - let output = b - .mapreduce_dynamic::<_, ProofVariable, ProofMapReduceState, Self, B, _, _>( - (), - proofs.data, - |ctx, proofs, b| { - let zero = b.zero::(); - let _false = b._false(); - - let mut heights = vec![]; - let mut results = vec![]; - for p in proofs.data { - heights.push(p.block_header.inner_lite.height); - results.push(b.verify(p)); - } - b.watch_slice(&heights, "map job -- heights"); - b.watch_slice(&results, "map job -- results"); - - heights.resize(N, zero); - results.resize(N, _false); - - let state = ProofMapReduceState { - height_indices: heights.into(), - results: results.into(), - }; - - state - }, - |_ctx, left, right, b| MergeProofReductionHint::.merge(b, &left, &right), - ); - b.write::>(output); - } - - fn register_generators, const D: usize>(registry: &mut HintRegistry) - where - <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: - plonky2::plonk::config::AlgebraicHasher, - { - registry.register_async_hint::>(); - registry.register_hint::(); - - let dynamic_id = MapReduceDynamicGenerator::::id(); - - registry.register_simple::, - Self, - B, - D, - >>(dynamic_id); - registry.register_hint::>(); - } -} - -// Hinting for this as it's taking too much effort to do it in a constrained way -// -// |ctx, mut left, right, b| { -// let mut r_heights = right.height_indices.data; -// let mut r_results = right.results.data; -// -// left.height_indices -// .data -// .iter_mut() -// .zip(left.results.data.iter_mut()) -// .for_each(|(h, r)| { -// let is_zero = b.is_equal(h.clone(), ctx.zero); -// *h = b.select(is_zero, r_heights.pop().unwrap(), *h); -// *r = b.select(is_zero, r_results.pop().unwrap(), *r); -// }); -// -// left -// }, -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct MergeProofReductionHint; - -impl, const D: usize, const N: usize> Hint - for MergeProofReductionHint -{ - fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { - let left = input_stream.read_value::>(); - let right = input_stream.read_value::>(); - - let (mut height_indices, mut results): (Vec<_>, Vec<_>) = left - .height_indices - .iter() - .chain(right.height_indices.iter()) - .zip(left.results.iter().chain(right.results.iter())) - .filter_map(|(h, r)| if *h != 0 { Some((*h, *r)) } else { None }) - .inspect(|(h, r)| log::debug!("heights/results: {:#?}, {:#?}", h, r)) - .unzip(); - height_indices.resize(N, 0); - results.resize(N, false); - - output_stream.write_value::>( - ProofMapReduceStateValue:: { - height_indices, - results, - }, - ) - } -} - -impl MergeProofReductionHint { - fn merge, const D: usize>( - self, - b: &mut CircuitBuilder, - left: &ProofMapReduceState, - right: &ProofMapReduceState, - ) -> ProofMapReduceState { - let mut input_stream = VariableStream::new(); - input_stream.write::>(left); - input_stream.write::>(right); - - let output_stream = b.hint(input_stream, self); - output_stream.read::>(b) - } -} - -#[cfg(feature = "beefy-tests")] -#[cfg(test)] -mod beefy_tests { - use std::str::FromStr; - - use super::*; - use crate::{ - test_utils::{builder_suite, testnet_state, B, PI, PO}, - variables::TransactionOrReceiptIdVariableValue, - }; - use ::test_utils::CryptoHash; - use near_light_client_protocol::{prelude::Itertools, ValidatorStake}; - use near_primitives::types::{AccountId, TransactionOrReceiptId}; - use serial_test::serial; - - const NETWORK: usize = 1; - - #[test] - #[serial] - fn beefy_test_sync_e2e() { - let (header, _, _) = testnet_state(); - - let define = |b: &mut B| { - SyncCircuit::::define(b); - }; - let writer = |input: &mut PI| { - input.evm_write::(header.into()); - }; - let assertions = |mut output: PO| { - println!("{:#?}", output.evm_read::()); - }; - builder_suite(define, writer, assertions); - } - - #[test] - #[serial] - fn beefy_test_verify_e2e() { - let (header, _, _) = testnet_state(); - - const AMT: usize = 8; - const BATCH: usize = 2; - - fn tx(hash: &str, sender: &str) -> TransactionOrReceiptId { - TransactionOrReceiptId::Transaction { - transaction_hash: CryptoHash::from_str(hash).unwrap(), - sender_id: sender.parse().unwrap(), - } - } - fn rx(hash: &str, receiver: &str) -> TransactionOrReceiptId { - TransactionOrReceiptId::Receipt { - receipt_id: CryptoHash::from_str(hash).unwrap(), - receiver_id: receiver.parse().unwrap(), - } - } - - let txs: Vec> = vec![ - tx( - "3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz", - "zavodil.testnet", - ), - rx( - "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", - "priceoracle.testnet", - ), - rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), - tx( - "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", - "hotwallet.dev-kaiching.testnet", - ), - rx( - "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", - "wallet.dev-kaiching.testnet", - ), - // rx("9Zp41hsK5NEfkjiv3PhtqpgbRiHqsvpFcwe6CHrQ2kh2", "system"), - tx( - "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", - "operator_manager.orderly.testnet", - ), - tx( - "FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg", - "operator-manager.orderly-qa.testnet", - ), - tx( - "4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST", - "operator-manager.orderly-dev.testnet", - ), - ] - .into_iter() - .map(Into::into) - .collect_vec(); - - assert_eq!(txs.len(), AMT); - - let define = |b: &mut B| { - VerifyCircuit::::define(b); - }; - let writer = |input: &mut PI| { - input.write::(header.into()); - input.write::>(txs.into()); - }; - let assertions = |mut output: PO| { - println!("{:#?}", output.read::>()); - }; - builder_suite(define, writer, assertions); - } -} diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs index 73e4045..ddf38b7 100644 --- a/circuits/plonky2x/src/merkle.rs +++ b/circuits/plonky2x/src/merkle.rs @@ -1,8 +1,9 @@ use near_light_client_protocol::{merkle_util::MerklePath, prelude::Itertools}; use plonky2x::prelude::*; -/// This is an unprefixed merkle tree without collision resistance, this should probably adapt the -/// tendermint tree or introduce this functionality to succintx's simple tree +/// This is an unprefixed merkle tree without collision resistance, this should +/// probably adapt the tendermint tree or introduce this functionality to +/// succintx's simple tree pub trait NearMerkleTree { fn get_root_from_merkle_proof_hashed_leaf_unindex( &mut self, diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index bdac923..05f6819 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -1,7 +1,10 @@ -pub use near_primitives::hash::CryptoHash; -pub use plonky2x::backend::circuit::{PublicInput, PublicOutput}; -pub use plonky2x::prelude::*; pub use std::str::FromStr; + +pub use near_primitives::hash::CryptoHash; +pub use plonky2x::{ + backend::circuit::{PublicInput, PublicOutput}, + prelude::*, +}; pub use test_utils::*; pub type B = CircuitBuilder; diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index b529193..b534087 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -1,21 +1,20 @@ use ethers::types::U256; -use near_light_client_protocol::config::NUM_BLOCK_PRODUCER_SEATS; -use near_light_client_protocol::prelude::{Header, Itertools}; use near_light_client_protocol::{ - prelude::AccountId, prelude::CryptoHash, BlockHeaderInnerLiteView, LightClientBlockView, - Signature, ValidatorStake, -}; -use near_light_client_protocol::{ - ED25519PublicKey, Proof, PublicKey, StakeInfo, Synced, ValidatorStakeView, ValidatorStakeViewV1, + config::NUM_BLOCK_PRODUCER_SEATS, + prelude::{AccountId, CryptoHash, Header, Itertools}, + BlockHeaderInnerLiteView, ED25519PublicKey, LightClientBlockView, Proof, PublicKey, Signature, + StakeInfo, Synced, ValidatorStake, ValidatorStakeView, ValidatorStakeViewV1, }; use near_light_client_rpc::prelude::GetProof; -use plonky2x::frontend::curta::ec::point::CompressedEdwardsY; -use plonky2x::frontend::curta::ec::point::CompressedEdwardsYVariable; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariable; -use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::EDDSASignatureVariableValue; -use plonky2x::frontend::hint::simple::hint::Hint; -use plonky2x::frontend::vars::EvmVariable; -use plonky2x::prelude::*; +use plonky2x::{ + frontend::{ + curta::ec::point::{CompressedEdwardsY, CompressedEdwardsYVariable}, + ecc::curve25519::ed25519::eddsa::{EDDSASignatureVariable, EDDSASignatureVariableValue}, + hint::simple::hint::Hint, + vars::EvmVariable, + }, + prelude::*, +}; use pretty_assertions::assert_eq; use serde::{Deserialize, Serialize}; @@ -24,7 +23,8 @@ use crate::merkle::MerklePathVariable; // TODO: remove any unused fields like account id etc? /// TODO: check if BPS seats changes for testnet/mainnet -/// Type for omitting the size across the codebase for arrays that are the same size as BPS +/// Type for omitting the size across the codebase for arrays that are the same +/// size as BPS pub(crate) type BpsArr = ArrayVariable; pub type CryptoHashVariable = Bytes32Variable; diff --git a/crates/protocol/src/config.rs b/crates/protocol/src/config.rs index c536fe4..6ef4215 100644 --- a/crates/protocol/src/config.rs +++ b/crates/protocol/src/config.rs @@ -1,4 +1,4 @@ // https://github.com/near/nearcore/blob/master/nearcore/src/config.rs#L133C1-L134C1 -// TODO: expose this from NP, currently this is a risk that the light client could be exploited -// if the max seats changes without knowing +// TODO: expose this from NP, currently this is a risk that the light client +// could be exploited if the max seats changes without knowing pub const NUM_BLOCK_PRODUCER_SEATS: usize = 50; diff --git a/crates/protocol/src/experimental.rs b/crates/protocol/src/experimental.rs index 06be21c..028bfb6 100644 --- a/crates/protocol/src/experimental.rs +++ b/crates/protocol/src/experimental.rs @@ -1,4 +1,3 @@ -use crate::{prelude::*, Protocol}; use either::Either; use itertools::Itertools; use near_primitives::{ @@ -9,6 +8,8 @@ use near_primitives::{ use near_primitives_core::hash::CryptoHash; use serde::{Deserialize, Serialize}; +use crate::{prelude::*, Protocol}; + /// Requires only needed parts of the LightClientBlockLiteView, and pre hashes /// the inner_lite. #[derive(Debug, Clone, BorshSerialize, BorshDeserialize, Serialize, Deserialize)] @@ -326,11 +327,13 @@ pub fn verify_proof(proof: Proof) -> bool { #[cfg(test)] pub(crate) mod tests { - use super::*; - use crate::merkle_util::{compute_root_from_path, compute_root_from_path_and_item}; use std::str::FromStr; + use test_utils::fixture; + use super::*; + use crate::merkle_util::{compute_root_from_path, compute_root_from_path_and_item}; + pub const BLOCK_MERKLE_ROOT: &str = "WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L"; fn write_proof(path: &str, proof: &Proof) { @@ -397,8 +400,8 @@ pub(crate) mod tests { let mut blinded = original.into_iter().map(BlindedProof::from).collect_vec(); let mut cache = MerkleCache::default(); cache.cache(&mut blinded); - // Since the proofs were the same, the cache should contain all of the paths for all of the - // proofs + // Since the proofs were the same, the cache should contain all of the paths for + // all of the proofs itertools::assert_equal(paths, cache.items); } diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index d7ef216..b35f78d 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -1,20 +1,18 @@ -use crate::prelude::*; use error::Error; pub use merkle_util::*; -pub use near_crypto::ED25519PublicKey; -pub use near_crypto::{PublicKey, Signature}; +pub use near_crypto::{ED25519PublicKey, PublicKey, Signature}; pub use near_primitives::{ - block_header::ApprovalInner, - block_header::BlockHeaderInnerLite, + block_header::{ApprovalInner, BlockHeaderInnerLite}, merkle::MerklePathItem, types::{validator_stake::ValidatorStake, BlockHeight, EpochId}, - views::LightClientBlockLiteView, - views::ValidatorStakeViewV1, views::{ - validator_stake_view::ValidatorStakeView, BlockHeaderInnerLiteView, LightClientBlockView, + validator_stake_view::ValidatorStakeView, BlockHeaderInnerLiteView, + LightClientBlockLiteView, LightClientBlockView, ValidatorStakeViewV1, }, }; +use crate::prelude::*; + pub mod config; pub mod error; pub mod merkle_util; @@ -352,12 +350,13 @@ macro_rules! cvec { #[cfg(test)] mod tests { - use super::*; use itertools::Itertools; use near_jsonrpc_primitives::types::light_client::RpcLightClientExecutionProofResponse; use serde_json::{self}; use test_utils::*; + use super::*; + #[test] fn test_sync_across_epoch_boundaries() { let (mut head, mut next_bps, next_block) = testnet_state(); @@ -554,8 +553,9 @@ mod tests { assert!(root_matches); } - // FIXME: Missed a part of LC spec regarding BPS handover, only the MAX_SEATS need to be taken - // TODO: change epoch_bps to only store MAX_SEATS and then for next + // FIXME: Missed a part of LC spec regarding BPS handover, only the MAX_SEATS + // need to be taken TODO: change epoch_bps to only store MAX_SEATS and then + // for next #[test] fn test_enough_stake_in_next_epoch_not_this() { todo!(); diff --git a/crates/protocol/src/merkle_util.rs b/crates/protocol/src/merkle_util.rs index 3f2ebb1..cd526b0 100644 --- a/crates/protocol/src/merkle_util.rs +++ b/crates/protocol/src/merkle_util.rs @@ -1,9 +1,8 @@ -use crate::prelude::*; -pub use near_primitives::merkle::combine_hash; -pub use near_primitives::merkle::MerklePath; -pub use near_primitives::merkle::{Direction, MerklePathItem}; +pub use near_primitives::merkle::{combine_hash, Direction, MerklePath, MerklePathItem}; use near_primitives_core::types::MerkleHash; +use crate::prelude::*; + pub fn verify_hash<'a>( root: MerkleHash, path: impl Iterator, diff --git a/crates/protocol/src/prelude.rs b/crates/protocol/src/prelude.rs index 9036d5d..13c83d2 100644 --- a/crates/protocol/src/prelude.rs +++ b/crates/protocol/src/prelude.rs @@ -1,11 +1,11 @@ -pub use anyhow::anyhow; -pub use anyhow::Result; -pub use itertools::izip; -pub use itertools::Itertools; +pub use anyhow::{anyhow, Result}; +pub use itertools::{izip, Itertools}; pub use log::{debug, error, info, trace, warn}; pub use near_primitives::types::AccountId; -pub use near_primitives_core::borsh::{self, BorshDeserialize, BorshSerialize}; -pub use near_primitives_core::hash::CryptoHash; +pub use near_primitives_core::{ + borsh::{self, BorshDeserialize, BorshSerialize}, + hash::CryptoHash, +}; pub use serde::{Deserialize, Serialize}; pub type Header = near_primitives::views::LightClientBlockLiteView; diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 688fac5..f620cf6 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -1,4 +1,5 @@ -use crate::prelude::*; +use std::fmt::{Display, Formatter}; + use async_trait::async_trait; use futures::TryFutureExt; use near_jsonrpc_client::{ @@ -8,7 +9,8 @@ use near_jsonrpc_client::{ use near_primitives::views::{ validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1, }; -use std::fmt::{Display, Formatter}; + +use crate::prelude::*; pub mod prelude; diff --git a/crates/rpc/src/prelude.rs b/crates/rpc/src/prelude.rs index 5553d87..1e42be8 100644 --- a/crates/rpc/src/prelude.rs +++ b/crates/rpc/src/prelude.rs @@ -1,13 +1,13 @@ -pub use anyhow::anyhow; -pub use anyhow::Result; -pub use futures::FutureExt; -pub use futures::TryFutureExt; +pub use anyhow::{anyhow, Result}; +pub use futures::{FutureExt, TryFutureExt}; pub use itertools::Itertools; pub use log::{debug, error, info, trace, warn}; pub use near_primitives::types::AccountId; use near_primitives::types::TransactionOrReceiptId; -pub use near_primitives_core::borsh::{self, BorshDeserialize, BorshSerialize}; -pub use near_primitives_core::hash::CryptoHash; +pub use near_primitives_core::{ + borsh::{self, BorshDeserialize, BorshSerialize}, + hash::CryptoHash, +}; pub use serde::{Deserialize, Serialize}; pub type Header = near_primitives::views::LightClientBlockLiteView; diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs index dc314bd..3a5a7ad 100644 --- a/crates/test-utils/src/lib.rs +++ b/crates/test-utils/src/lib.rs @@ -1,5 +1,4 @@ -use derive_more::AsRef; -use derive_more::Into; +use derive_more::{AsRef, Into}; use near_light_client_protocol::{ prelude::{BasicProof, Header, Itertools}, LightClientBlockView, Protocol, StakeInfo, ValidatorStake, diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..cd5d6b1 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,8 @@ +# Justification: Rust will be moving to this going forward +group_imports = "StdExternalCrate" + +# Justification: Just cleaner +imports_granularity = "Crate" + +format_code_in_doc_comments = true +wrap_comments = true From 7d0c51a25828305536e5a4968a7550d60b980079 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 5 Feb 2024 15:52:02 +0000 Subject: [PATCH 30/67] feat: data driven batch test on consumer hardware --- .gitignore | 1 + Cargo.lock | 1 + bin/operator/src/main.rs | 2 +- circuits/plonky2x/src/circuits/verify.rs | 191 +++++++++++++---------- circuits/plonky2x/src/hint.rs | 1 + circuits/plonky2x/src/variables.rs | 1 + crates/rpc/Cargo.toml | 1 + crates/rpc/src/lib.rs | 142 +++++++++++++++-- fixtures/ids.json | 1 + 9 files changed, 239 insertions(+), 102 deletions(-) create mode 100644 fixtures/ids.json diff --git a/.gitignore b/.gitignore index e1b5154..9b84683 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ **/target /vendor /build/* +circuits/plonky2x/build .direnv diff --git a/Cargo.lock b/Cargo.lock index 48a59c3..f4283d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3750,6 +3750,7 @@ dependencies = [ "serde", "serde_json", "thiserror", + "tokio", ] [[package]] diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 3c4b437..0b13fc7 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -1,6 +1,6 @@ use near_light_clientx::plonky2x::backend::function::Plonky2xFunction; -// Testnet +// Testnet, FIXME: this is error prone, use something else const NETWORK: usize = 1; fn main() { diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index a012630..b0182ef 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -1,7 +1,8 @@ -use plonky2x::frontend::{ - hint::simple::hint::Hint, mapreduce::generator::MapReduceDynamicGenerator, -}; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; +use plonky2x::{ + frontend::{hint::simple::hint::Hint, mapreduce::generator::MapReduceDynamicGenerator}, + prelude::plonky2::plonk::config::{AlgebraicHasher, GenericConfig}, +}; use serde::{Deserialize, Serialize}; use crate::{ @@ -13,18 +14,15 @@ use crate::{ }, }; +// TODO: improve the way we can lookup the transaction, ideally map +// TransactionOrReceiptId => Proof and map this way, now we are not limited by +// the data transformation #[derive(CircuitVariable, Debug, Clone)] pub struct ProofMapReduceVariable { pub height_indices: ArrayVariable, pub results: ArrayVariable, } -#[derive(CircuitVariable, Debug, Clone)] -pub struct ProofMapReduceCtx { - pub zero: BlockHeightVariable, - pub result: BoolVariable, -} - #[derive(Debug, Clone)] pub struct VerifyCircuit; @@ -33,75 +31,63 @@ impl Circuit { fn define, const D: usize>(b: &mut CircuitBuilder) where - <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: - plonky2::plonk::config::AlgebraicHasher<>::Field>, + <>::Config as GenericConfig>::Hasher: + AlgebraicHasher<>::Field>, { - assert!( - N % B == 0, - "Cannot batch by this configuration, must be a power of 2" - ); - let trusted_head = b.read::(); let ids = b.read::>(); + println!("len of ids: {}", ids.data.len()); let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); - let output = b - .mapreduce_dynamic::<_, ProofVariable, ProofMapReduceVariable, Self, B, _, _>( - (), - proofs.data, - |ctx, proofs, b| { - let zero = b.zero::(); - let _false = b._false(); - - let mut heights = vec![]; - let mut results = vec![]; - for p in proofs.data { - heights.push(p.block_header.inner_lite.height); - results.push(b.verify(p)); - } - b.watch_slice(&heights, "map job -- heights"); - b.watch_slice(&results, "map job -- results"); - - heights.resize(N, zero); - results.resize(N, _false); - - let state = ProofMapReduceVariable { - height_indices: heights.into(), - results: results.into(), - }; - - state - }, - |_ctx, left, right, b| MergeProofHint::.merge(b, &left, &right), - ); + let output = b.mapreduce_dynamic::<_, _, _, Self, B, _, _>( + (), + proofs.data, + |_, proofs, b| { + let mut heights = vec![]; + let mut results = vec![]; + + // TODO[Optimisation]: could parallelise these + for p in proofs.data { + heights.push(p.block_header.inner_lite.height); + results.push(b.verify(p)); + } + + b.watch_slice(&heights, "map job -- heights"); + b.watch_slice(&results, "map job -- results"); + + let zero = b.zero::(); + let _false = b._false(); + heights.resize(N, zero); + results.resize(N, _false); + + let state = ProofMapReduceVariable:: { + height_indices: heights.into(), + results: results.into(), + }; + + state + }, + |_, l, r, b| MergeProofHint::.merge(b, &l, &r), + ); b.write::>(output); } fn register_generators, const D: usize>(registry: &mut HintRegistry) where - <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: - plonky2::plonk::config::AlgebraicHasher, + <>::Config as GenericConfig>::Hasher: AlgebraicHasher, { registry.register_async_hint::>(); - registry.register_hint::(); - - let dynamic_id = MapReduceDynamicGenerator::::id(); - - registry.register_simple::, - Self, - B, - D, - >>(dynamic_id); registry.register_hint::>(); + + // We hash in verify + registry.register_hint::(); } } // Hinting for this as it's taking too much effort to do it in a constrained way +// It's probably a security risk that we'd need to fix later since technically +// these can just be changed post-verification // // |ctx, mut left, right, b| { // let mut r_heights = right.height_indices.data; @@ -133,8 +119,8 @@ impl, const D: usize, const N: usize> Hint for Merge .chain(right.height_indices.iter()) .zip(left.results.iter().chain(right.results.iter())) .filter_map(|(h, r)| if *h != 0 { Some((*h, *r)) } else { None }) - .inspect(|(h, r)| log::debug!("heights/results: {:#?}, {:#?}", h, r)) .unzip(); + height_indices.resize(N, 0); results.resize(N, false); @@ -170,9 +156,13 @@ mod beefy_tests { use std::str::FromStr; use ::test_utils::CryptoHash; - use near_light_client_protocol::prelude::Itertools; + use near_light_client_protocol::{ + prelude::{Header, Itertools}, + BlockHeaderInnerLite, BlockHeaderInnerLiteView, + }; use near_primitives::types::TransactionOrReceiptId; use serial_test::serial; + use test_utils::fixture; use super::*; use crate::{ @@ -187,8 +177,9 @@ mod beefy_tests { fn beefy_test_verify_e2e() { let (header, _, _) = testnet_state(); - const AMT: usize = 8; - const BATCH: usize = 2; + // TODO: test many configs of these + const AMT: usize = 2; + const BATCH: usize = 1; fn tx(hash: &str, sender: &str) -> TransactionOrReceiptId { TransactionOrReceiptId::Transaction { @@ -213,27 +204,27 @@ mod beefy_tests { "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", "priceoracle.testnet", ), - rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), - tx( - "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", - "hotwallet.dev-kaiching.testnet", - ), - rx( - "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", - "wallet.dev-kaiching.testnet", - ), - tx( - "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", - "operator_manager.orderly.testnet", - ), - tx( - "FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg", - "operator-manager.orderly-qa.testnet", - ), - tx( - "4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST", - "operator-manager.orderly-dev.testnet", - ), + // rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), + // tx( + // "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", + // "hotwallet.dev-kaiching.testnet", + // ), + // rx( + // "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", + // "wallet.dev-kaiching.testnet", + // ), + // tx( + // "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", + // "operator_manager.orderly.testnet", + // ), + // tx( + // "FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg", + // "operator-manager.orderly-qa.testnet", + // ), + // tx( + // "4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST", + // "operator-manager.orderly-dev.testnet", + // ), ] .into_iter() .map(Into::into) @@ -253,4 +244,34 @@ mod beefy_tests { }; builder_suite(define, writer, assertions); } + + // TODO: ignore flag as this test will likely be overkill + #[test] + #[serial] + fn beefy_test_data_driven_verify_e2e() { + let (header, _, _) = testnet_state(); + + const AMT: usize = 128; + const BATCH: usize = 4; + + let ids = fixture::>("ids.json") + .into_iter() + .take(AMT) + .map(Into::>::into) + .collect_vec(); + + assert_eq!(ids.len(), AMT); + + let define = |b: &mut B| { + VerifyCircuit::::define(b); + }; + let writer = |input: &mut PI| { + input.write::(header.into()); + input.write::>(ids.into()); + }; + let assertions = |mut output: PO| { + println!("{:#?}", output.read::>()); + }; + builder_suite(define, writer, assertions); + } } diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index 0675890..40df141 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -47,6 +47,7 @@ impl FetchNextHeaderInputs { } } +// TODO: refactor into some client-like carrier for all hints that is serdeable #[derive(Debug, Clone, Deserialize, Serialize)] pub struct FetchProofInputs(pub Network); diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index b534087..f9eb043 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -627,6 +627,7 @@ impl HashBpsInputs { } } +// TODO: EVM these, maybe macro? #[derive(CircuitVariable, Clone, Debug)] pub struct TransactionOrReceiptIdVariable { pub is_transaction: BoolVariable, diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index 4641fba..2e32c32 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -34,3 +34,4 @@ hex.workspace = true pretty_env_logger.workspace = true rand = "*" serde_json.workspace = true +tokio.workspace = true diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index f620cf6..7511c7c 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -154,6 +154,7 @@ impl LightClientRpc for NearRpcClient { id: req, light_client_head: latest_verified, }; + log::debug!("requesting proof: {:?}", req); self.client .call(&req) .or_else(|e| { @@ -164,11 +165,10 @@ impl LightClientRpc for NearRpcClient { .map_err(|e| anyhow::format_err!("{:?}:{}", req.id, e)) } + // It's cleaner to get epoch bps based on epoch id async fn fetch_epoch_bps(&self, epoch_id: &CryptoHash) -> Result> { - let req = methods::validators::RpcValidatorRequest { - epoch_reference: near_primitives::types::EpochReference::EpochId( - near_primitives::types::EpochId(*epoch_id), - ), + let req = methods::next_light_client_block::RpcLightClientNextBlockRequest { + last_block_hash: *epoch_id, }; log::debug!("requesting validators: {:?}", req); self.client @@ -178,17 +178,11 @@ impl LightClientRpc for NearRpcClient { self.archive.call(&req) }) .await - .map(|x| x.current_validators) - .map(|x| { - x.into_iter() - .map(|x| { - ValidatorStakeView::V1(ValidatorStakeViewV1 { - account_id: x.account_id, - public_key: x.public_key, - stake: x.stake, - }) - }) - .collect() + .map_err(|e| anyhow::format_err!("{:?}", e)) + .and_then(|x| x.ok_or_else(|| anyhow::format_err!("no block found for {:?}", epoch_id))) + .and_then(|x| { + x.next_bps + .ok_or_else(|| anyhow::format_err!("no BPS found for {:?}", epoch_id)) }) .map_err(|e| anyhow::format_err!("{:?}:{}", epoch_id, e)) } @@ -196,8 +190,124 @@ impl LightClientRpc for NearRpcClient { #[cfg(test)] mod tests { + use std::str::FromStr; + + use near_primitives::{ + types::{BlockId, BlockReference, TransactionOrReceiptId}, + views::{BlockView, ChunkView}, + }; + use super::*; + async fn fetch_chunk(c: &NearRpcClient, chunk_id: &CryptoHash) -> Result { + println!("fetching chunk: {:?}", chunk_id); + let req = methods::chunk::RpcChunkRequest { + chunk_reference: near_jsonrpc_primitives::types::chunks::ChunkReference::ChunkHash { + chunk_id: *chunk_id, + }, + }; + c.client + .call(&req) + .or_else(|e| { + trace!("Error hitting main rpc, falling back to archive: {:?}", e); + c.archive.call(&req) + }) + .await + .map_err(|e| anyhow::format_err!("{:?}", e)) + } + + async fn fetch_block(c: &NearRpcClient, block_reference: BlockReference) -> Result { + println!("fetching block: {:?}", block_reference); + let req = methods::block::RpcBlockRequest { block_reference }; + c.client + .call(&req) + .or_else(|e| { + trace!("Error hitting main rpc, falling back to archive: {:?}", e); + c.archive.call(&req) + }) + .await + .map_err(|e| anyhow::format_err!("{:?}", e)) + } + + async fn fetch_ids(client: &NearRpcClient, block: &BlockView) -> Vec { + let futs = block + .chunks + .iter() + .map(|c| fetch_chunk(client, &c.chunk_hash).map(|x| x.unwrap())) + .map(Box::pin) + .collect_vec(); + let chunks = futures::future::join_all(futs).await; + + let receipts = chunks + .iter() + .map(|c| c.receipts.clone()) + .flatten() + .map(|r| TransactionOrReceiptId::Receipt { + receipt_id: r.receipt_id, + receiver_id: r.receiver_id, + }) + .collect_vec(); + let txs = chunks + .iter() + .map(|c| c.transactions.clone()) + .flatten() + .map(|t| TransactionOrReceiptId::Transaction { + transaction_hash: t.hash, + sender_id: t.signer_id, + }) + .collect_vec(); + + vec![receipts, txs].concat() + } + + #[tokio::test] + async fn test_get_ids() { + let client = NearRpcClient::new(Network::Testnet); + + let first_block = fetch_block( + &client, + BlockReference::BlockId(BlockId::Hash( + CryptoHash::from_str("6taaeb6h2uJcuUvvmwXpYgagYvyHsFanWhm2ziGGHCff").unwrap(), + )), + ) + .await + .unwrap() + .header; + + let mut ids = vec![]; + + let ids_to_fetch = 1024; + + let mut block = first_block.prev_hash; + + while ids.len() < ids_to_fetch { + let next_block = fetch_block(&client, BlockReference::BlockId(BlockId::Hash(block))) + .await + .unwrap(); + ids.extend(fetch_ids(&client, &next_block).await); + block = next_block.header.prev_hash; + } + + std::fs::write("ids.json", serde_json::to_string(&ids).unwrap()).unwrap(); + + // .and_then(|b| async { + // Ok(b.chunks + // .iter() + // .map(|c| fetch_chunk(&client, &c.chunk_hash)) + // .map(Box::pin) + // .collect_vec()) + // }) + // .await; + // For each in 0..10 + // + // get parent block + // get all chunks by chunk hash + // get all receipts + // get all txs + } + #[test] - fn test_name() {} + fn test_rpc() { + todo!() + } } diff --git a/fixtures/ids.json b/fixtures/ids.json new file mode 100644 index 0000000..48d2a33 --- /dev/null +++ b/fixtures/ids.json @@ -0,0 +1 @@ +[{"type":"receipt","receipt_id":"Bcj5ipQD9e4dw2rZYEKq9UEcXWRaaCJswziFT6EDMSdq","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"AUE2x5y4s8sZDRfaTMznW2Kx9uTgicQG9fzebvBgqq9","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9","receiver_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"hQ4NQefXahZR8LcsTKWQPKi81zCFKfCJsyMewoxmg9F","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo","receiver_id":"priceoracle.testnet"},{"type":"receipt","receipt_id":"4JkyYYCCFjbMpbLmRWYHEEXkpKeV6AzVfhJck7rGKudn","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9Zp41hsK5NEfkjiv3PhtqpgbRiHqsvpFcwe6CHrQ2kh2","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz","sender_id":"zavodil.testnet"},{"type":"transaction","transaction_hash":"6qTggNtcCeks9pscLxmFHSzDe6bnfy4sX8WBQj6MYU3X","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"3gSQ6tZE7M5tkRSoNbMERTRR45QErXiAGEYjodzWcGTL","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"8N91Gtum3vSHSe66f1atCPAztTi2y3zXUNFZYf7qXoE8","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"9ZuwWLYnYUGvTeMMBU5KubP4xMGbfMJ8gt3r1AeRHus2","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"yZmQCtrnz7CauPqAjYVFNLokzgWm8QrdP7mNm6Y1nBU","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"26YmnfTUCCL77VxjARA8jnCzupTAQnD7JQLvGDhEA4h8","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"BgPrJhYfC6gNh4pYMQ3BnPWPMgBDphLH3H8RNnW27tAc","receiver_id":"asset-manager.orderly.testnet"},{"type":"transaction","transaction_hash":"3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"57hyHzGLxcYGgDyqeGPTVN6J8Gms4CVsjqFsySA1B9qc","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AR78eh3QNfyyyy4UV2a9bax9zkudrP9zphCa9nDyeBcv","receiver_id":"ykaju2a8jcfg.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"3sPxpYGTXYfNT6FvsrwUi9M8MMcuoahpAs3powS29XJH","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"7twejH9ZMD4t4zdLtJqANKhG37bckia8RLX5494Fw1SM","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"DgRM8CNGkMokkhqcYFLUL39AcQ89a3AsNQrs4DynVohm","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"CQno9p4ea2A8TyYddGRJTr7Xh9ZSq6uP123QqR2r9nM1","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AAoyzc41aoKjua4k9fJLEA5nGXFa9LMWWHtGKanJzscj","receiver_id":"aurora"},{"type":"transaction","transaction_hash":"FcQx6PWhDpHLyQJWd4HhfZ2xrkUcBfa3h57zsEtxwV4g","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"DsjV3URFPGbVcFbWrpR9zT5BrrhzAZFG4n2qh8zSe7jX","sender_id":"relay.aurora"},{"type":"receipt","receipt_id":"E3uAZcoK3z2Vwmngg7epGy6LyHMvC5fJQDHjwwjgb5E5","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"B4LoLw8na3PEtzo1ngh7iXcpWUR4Kv2SbwERrtRxCHip","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"7Pk6Lov1rqkYeAJgnT82EySuokoVPyN8w4aMEQdPVudr","receiver_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"3xxbDeKJQS6EmbtTELWuUJ3Zou4LTF27LzZbcLXCEHbU","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"9AvZKNAmK94x8hqwcshNDmmRu3dMUQv7eNZXR2WuE6nt","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"FsdqZDxLcaSWoopSCAXPpNUkA4nr1kUkuzxBukkNqTv2","sender_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"dBsQDEoSDijFTtZPdYHEkGUB5sWZg1XAvbRhxa8Jmpi","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"E4kHaTr5DroFkKXJUrzfXKtPRjyR68YAqGyb3dSnKGuD","receiver_id":"lwjdvlvzfo79.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"5FJCmPzb9Kfxesf1kbNnoJ3ZxbPQ4yj4EZhbsKjcCoqr","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"CokutTqGaabTnrKSi13bAUzeECdwByMRnj99BwRG7fRu","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"BvnUudsAkCaKvVvJ74prZFXds8PdpE925p8xZmRjYJ2C","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"GikmFvGMVn2UeJEcnDjN3BMEL5YmgCUypQDMBXLvW5g9","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"5ypE9P9j9ASjmunm6kSLrTtuJ5HByR6Hf3cCKrqffRS4","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"68yQ89pQowx5DKFgNpgL4zcwrKgEaN96xGXmZZ8jBMzL","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"EfAZduDmKxNoMSYDqHEpD2nuBXJhyaCyeWtDhRnri9d1","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"8mUxUveBaHz7fi3ZS9kN1Ss6fkeBqvuR1pSeYWdunMXS","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"AYUaHUAxBUYKt1ThDttNatx7XV5FKH9bFMWmmrhWWU7y","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"BxkNFzGUUBafcn8PY9X4vgDT9KgZNhUkbU7dsCXd7hNz","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"5gg7aEBjbuKKvYogcbLRjB69AXfDXkGeSsd3P1qMhB77","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"2awfPH5inWJgnDKToFrbm516MofkvJG5A1NR8b3ky65p","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"8WC45pj89X8RXaSXV13yKh3gmpVMaChBDskxYBisFg8g","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"EQqdHTCe4ZYc6NKGeCbE89SV9Ft86wWpVyXVjACM38UP","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"GCaGAJ9yBJtg3RJxafAwT8M7jQgUcWcADg1ujHEii194","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"4jEzH53nTjHjWDu8BiJaFQZPBP3T57XM5q971vQjB8kN","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DcvY1wVUk5YsTL1s6G4K74gEACyrpeXAW8XUC11yib35","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"3Z6Ki6NtKAPqYjGbkUTnNQ4fc7bPPDVFvcvfoM5CsvnC","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"EMpoVsh6yt2xYghBDVC8HscXzUeWHJrZEwW1Kk6MXydq","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"E47awk7rt6vrFewuYdDM2N6qN6TbFKKm3jZbQUHb53fb","receiver_id":"73uvy8y6kxr8.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"HwhMdANKVFq6dPLuADeS5KZ67Rde2gUutZ8S2gXuL72Y","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"5eX8FWckCEiaRL19BbFHM1N9TbzdFZZWj1mN7dXr6ogv","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"C7NiDYZbbuQLGDnvB62tadnb8kWguYVVEWqaB1QStjba","receiver_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"Cgm82SB7JNWPTDh5dbyzFLvE7kvp3A87Aqz5RqeXT71g","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"86bhXNvcUjTz1dLVdNLWBxo1A6AUBso5wSHuordGHCxR","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"6WRoqR8Zq87YSEop8xsBG7QyRxGJ4dH3w95v1NcQvyDm","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"D2jCP5FAYbuAjyMWV1Fv3HqgDMKCdeAQMC98aWZN8TGr","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"FfDx9vhagyqLCxRBoxa6ZXqVgczhHaPuRpBY61ktpM19","sender_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"DheV2jZJEuq9RSAopQuDXgFsfwB5BsKE3yV18jCfVjbM","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"53vz1by3LYYKzDZcJskcUm7Smv297wWFKPSvwD7pLJPd","receiver_id":"dtazz1s6wte2.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Hcy5vxQWYvGdrmevVaz6248Tg1k3QZtHQu1hUUsvoxkD","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"7MbcKn6ajP7EC34tEFj575rZBwDLPmJqQ5eDySkPeKAx","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"DYuZi3qLKAEGWFKBMCp2xA5HyH8oS6EWuzzeQuxQEXda","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"AZ18KJ6W3nJ1JScJVdAxm8j4cqHnc4XTGFpSCitQadTf","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AsZ8b8QYtK5Fs8XUDEmEx1A2at9bWr8r1aS8VnLcEtd3","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"CAvm9Arji4Kpdvcp9xk9qc9p83i2P2CfRMm9jyo2DFfi","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"7jrdAT6NRQjDnpDu8QmUAbZ6oyLjEgMwzPLZsXpRPQVC","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"DR4FE9zXS1cQaAGU7f7y78p9yn4akVQHFEskSH2PD3Vh","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"HcsL2SBdF8LtjJsFos6NkqpueMn1s1toYD77SdB5szy4","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"9LXG1JNhvuPfdo9fGZvBacxXe9NAASSPZmsW4mpCn1f4","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"C9TSpXgbu7YRJ5Jm1dMuj8KfMLH7eJHxk2jENteGJzCP","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"9RBAJxHTEeE5v9QQAeZANNq9ydTTc87jvuGyrtCdo63P","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AkmPwHhqviQSNv3Ee1TGFg4EuHK62fPMyTrykJXfJGom","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"GMDVAQhmhe9TEhpsY74FgJeL5QU1aMwqQz54BsSQ885T","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"FnLggXc5oiEjiEgeQYQV6BQsYKnPtramMMMiU2ZedANe","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"8gpNzBHQBH9ZWrw7cA8BAqw5ZRyNWbg1pDPoK8U6JTud","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GGRLsLh79FFtCDfDMSwt15k2DTiho39WXRPqMd4SANRK","receiver_id":"zavodil.testnet"},{"type":"transaction","transaction_hash":"6eqiiQjc2N5HGMbQMzwuBtniQFtpWhetc1aq3yEuWJsA","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"F6R3jvNT91MnjQwYEJ53kzak2EN49UPd1EHBWB9vi9Vo","receiver_id":"12fbh1glcgat.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8s2tqX1x8TJqS7enoMU1gsxp4hPExUkc8zg7nND4Pfj1","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"9qjjnRnuiJhgFAZonH9zfVcw7P437DdMMsa3aXQxqkRA","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DF7N8Add65ksvhLofgN9W898jK7DWxhZhe6F51HLohBg","sender_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"nYio38Xrm5wY8WmJSdQ9tEo9Re7wSF2A8mT8rRSxFa6","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"BYBGZKDmuUwaFs5c26i4UXM3Kv2KYZFQkb92J3YHrCoV","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"4H2tHD5PQ4NxFiJRZq7jos5Df4jQgM5ig2jaX1NQMTrY","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"FB4bRfgozXaHu44zTCgq12FUoZbJt1Vv96KQGbzjTJJz","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"CvozzbMChCeAKg6jm7UgJuqrA8KkpWPsL5mcnbLcbiqk","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"GoRr9hrxMarjxNAcwwREeRbSBT1RYstPeNQaVajJurff","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"27dU68Bf5EVKv931qQGzpAEuKFrXYcrdKg11jdwRin6S","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"4sZCtWBxQUFXR1YtYhFn7Fn786fNtGMhqfbPw2wEr5Wg","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"uUomhhuxwhUkrj6dCddfHdbbY1paygejSAeJyuwkBZH","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GHe3crwmPJZ4fU9yQieVKsS5BYLbrAMbxgPbvpaTmqFt","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"97x4tdZRgSWHsDFAfZbNFyHzAWRBoNmaBum4Uw92m1bL","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"5dYTWJ4sUsQXgNYbZLYnFJYEBGnxFxfrcNzhZcouWT5j","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"GccuQBBSBtknXJyWwXuNdgiGi4QGvYeyKhPvcuwR2Xii","receiver_id":"68frdria49vm.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GjDGzTvKHX3syTJXNwV53Vx7FYnUkPojrfcaN9Q6DpYx","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"AU5NoxAG5a8GKxWSNncH915uDaCUSQnVRNrZnQ6vwia3","receiver_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"3cWJrJmaewhX93UnduHRU2M8sW8F8qwEoD1xJsBTaJSs","receiver_id":"price-oracle-v1.nearlend-official.testnet"},{"type":"transaction","transaction_hash":"8N8K3idQm4yFT6jn9wwTh7jTj9XiG564T6T67yqyVWqe","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"9sc3pjhPHAsGJnH9ui68kht4bhNCzBPgYatpR79Cspm5","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"9FCCaaeYwSHgaYfGquGAWheCHpKwNPfWHnWBi78vFR5F","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"D7mcCM26QXUxvMbPTfmw1jeZRYTLQdBTZDpDXqdYQMEW","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"AdyN4mXDa5UoLCf9XQTQ7HvQbQ2g24VcATDVGWhy46zq","sender_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"HezCULqMkxpwQkbxSCtuhHac9deHyLPZ6L9D8QMEEFHq","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"DCvFdk3n5cWvD8NVQ7hgBVVrYcKB29A6RewxXPLMwKP","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8ztnGoe1e2mVN6giAzhopE27CUBbJKHzictagWFv6eUf","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"4KHMyieDVBVgw7H4jB7GFsgc5WVkkkkcuWjHUWhoxQ9m","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8MVX9Yjj3uzUZXYvL2VCfyrGASbij6ghR2zQMpDtf1s7","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"AAVFCoFRqVdjurTEGMZL4jSp2oZtFqtTcAGb31KNxtyk","receiver_id":"testnet"},{"type":"receipt","receipt_id":"Eo5fKR6YaSBzKW9vJUtVADEmoiAqqCSVutVYpvNm27Ry","receiver_id":"testnet"},{"type":"receipt","receipt_id":"9Dv2dZx3Fe6RffSRN8eTML6Ad4NwwWMbMVDbUMrXoF5W","receiver_id":"aurora"},{"type":"transaction","transaction_hash":"HM18RA6nrZYjdXz8q4HbWaqxteae64K5WoXv1rnfe2Uf","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"CQNbeL8ggXuZhKHEDzsi3rNi26Tza8eHFXCY3M46U1JW","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"8TGttUnnyfpVvxjjqXjy8vkKwb8uNwBkwgpnXizVaco3","receiver_id":"dev-1705307954732-23212261612584"},{"type":"receipt","receipt_id":"F69bauLbRkLHU5z8Rpwtj5oRyqiFr4XLhKKt5JMaB3b8","receiver_id":"dev-1705307954716-26005621820061"},{"type":"transaction","transaction_hash":"CqVVswF3dEMQ8uJciL2RC19txKwsKm1CiJU1YDNxnJEV","sender_id":"relay.aurora"},{"type":"transaction","transaction_hash":"Bkc69B8zVNfwoukDZptpcG76rhgE1ekvp21roCLa3k4b","sender_id":"testnet"},{"type":"transaction","transaction_hash":"4LW882GsjTojrXSqLEcLYRD4Dfns2bbTaizpfEWDXeAR","sender_id":"testnet"},{"type":"receipt","receipt_id":"8c6ePJ4xvUKB24z9146bjRXdCfX2Rqx7zxYPVG127M4K","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"3AqgqHdwYWWwFC3qWU443bDNS3vxRSTdj6dMUpzxvKoi","receiver_id":"vvtjqhhfnrl2.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"4zzAH9GA3LfzcKuH5eRzM7ywF8PLADuCsFNb6fva6f42","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"HdxzgzSZJjcBxYpWNMK6UpdEpoTKzpr4SrEvWVtdF97s","receiver_id":"testnet"},{"type":"receipt","receipt_id":"J4wZi1ydzgjhuJgwL6UYTN5TkHYha9S8zRoGvoCNft6w","receiver_id":"testnet"},{"type":"receipt","receipt_id":"ECiFmZbnGkp58AknPRNJdZM7VjQ6NxRRsFsJ2Q1pJDzy","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"7RuTSrDAZhAkXLqxYKoPqZv9mHKvWJdT4BxAtq6SKVEq","receiver_id":"dev-1705307951157-46295630099921"},{"type":"receipt","receipt_id":"84Tscq1mQuNq6rtp1YVcBGwZcv7nnmFY58ekQ5ZpN2xj","receiver_id":"dev-1705307951144-39784510361521"},{"type":"receipt","receipt_id":"699GLHexZMhH7HKdkNBQMktTMDr3AvdHpb5Pdu8CeLkC","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"acAXEvqvNxYbJXDa34ApA8XHdXFtdZLUmDWz7s6cvM9","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7z5Zc7jojgmPz8HkF1KkNDSAy2FTMtXbhwTwGhfxjBw4","sender_id":"testnet"},{"type":"transaction","transaction_hash":"64ViGfWopTMWyTgdDqvZU5wigx6m4ysfQFAeH8bKP8JX","sender_id":"testnet"},{"type":"transaction","transaction_hash":"HDXxhUfEnooUb3B4Earft18ibBvWdTs3Bk9SDKv6Nd9W","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"G9i4dZgzDZzgBrgBEtooLm9cVVBJGfaqBtjFm4cdnVPa","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"AjhoYqQrYhq6mAz1LP47YLxfssDCK9V1jZ3gKDMMAM9B","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"GVHMrJZY6VGaKhY5Ay2uihGHK5wtjB4qBBdrRsXLaFLr","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4rGJ7mSkt8V4tgYHjoNLc3s4BxaqkQTszxrftDtJLFAQ","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"2iTTQdUQCwGDCVVYWKdCxrznMgP2tHnpjsnq27SVxJte","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"A4nZmcuzmchT1QDiWs8yeBZ134bovwBWibuFScFork7f","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"D9aMyFpgBQk1CpPTrhEqgdKEAcPF3NexeWBXmf8d4B2c","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Gfgs99YvvGae9q6z5WDMpdhVkAHmwFjZ7yk8p7Jsbit","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"GSiDVPdWYQFJ8WrJrXbQa7az7qAFzfR4WYK2snNDxWJv","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"qnLPZdSybWhkUQEwG8vHGtFMcHuKtUoWX2oHYnxVfCC","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"Gqn6vq2QNL8NbhgW9sDKgbCij2TwUTtuGDWr9gybfsbk","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"4X8euaFjsFZP98A1bCfkgDMFashgtSxHns4mU1ReZWPY","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AcAenoXYdKTu3AvLGScBnXsPG4vedWs1hcysRnksB1RB","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"E4sgW7Ucyjp9YHFiJZTdoGtUAvdGAFYSNKCht1BJijN9","receiver_id":"y1rifte3q9bd.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"BZekNMxiCSkanDBWc1ayTE67uFra3gsXvvA8ZNeyaNS8","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"68QsmAVyaVft3WWJ8FhitTuVGosnQL5MJMNZD4SNpN4f","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"8grJwgNZjCX2358axxFnCMr8T9mvK9choDYtcG5juBWc","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"BX4d2vHY1EYVAAkBQhHsJZQbumaaDHjBTejGNiYwMaZV","receiver_id":"testnet"},{"type":"receipt","receipt_id":"2Fzou4H3regnvi3BmwhxzuebvqGscqrJXNouqrLLiNYJ","receiver_id":"testnet"},{"type":"receipt","receipt_id":"3anHYE6zuA7J9Tid2U3WosdSUaZkDMNUozg5qvh1oMNr","receiver_id":"dev-1705307935659-11845443462054"},{"type":"receipt","receipt_id":"C5bdGmjQY7GqmwwJf9yUZMZ6CkSDFmYHSNEGQCGskByc","receiver_id":"dev-1705307935640-33745202086023"},{"type":"receipt","receipt_id":"BvkNQa76y6nCDvn8Yw6KRHuvF3yvHd7a1Ce1qacVa2DB","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"HNU4FP3FUbor7AAsnUSYmmM9teL5km3hQNSJEeLdHguN","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"Cqn2FgbLvt3dApw2DdY8NBHLmhdk5ALBrYCNWRLnNsA4","sender_id":"testnet"},{"type":"transaction","transaction_hash":"ETG5NiqhbrqbhUVRbKMyEXcLX3Bus6ZhoR6rGraUVuVx","sender_id":"testnet"},{"type":"transaction","transaction_hash":"6XvR3i2zvweL91DPj22DB6ocqw3VCewcaTJ8dDCvu7xQ","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4KqpmX1QL1dTCZFmYx7nKeEVZEXysjG8jdGrnoCZ1u2h","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CGJ8FKxudQhrskhj8tBAgyYEhyz7kH3VowRVycfYnEBb","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9tSG4wHi3pMrJz8wcj2ugaFNfgjokCkNh313kj2mAZsh","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2EmQBak3VUFpU8LkSvB2qodqY6u8xehoeN19TekNRjh9","receiver_id":"c1c4pchrv82x.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"Fkp93fAsqEabGsXrP2spXwjeTjZ1NRoarugAgmdke2ex","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"UgpM3HsF8R5x24qoYYkqo2tY9Ha5VGDovbXCa7Qo1DF","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"EsXjsen7ofj7cYDu6wcR7kdFUFK1yVWwKU8JGzPGbUcW","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"2PefNKhfkQfkY8UuHtXDDq2zgM6pyBt9or9ToTtCWs7K","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"E9NijeLA4QshKLWJzVDy9La8LPAbiYyYA9R4qxnC1FnK","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"EKm17Ay3rcXAnJiK18fQhRCKG2rE8e6nn4bQvpRGYxWV","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"BVmRaPbPeE15LjacNnu7cA4Ga3mBQnA5VoGAeyHMuAia","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"CXoi3YEf8NZDnUBufEXY3wGWwHb8ZnG6XZ63gvhnXCbb","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"GhQRQfBsyJceeiU5Jtd1HP2YGkNMohbsARRo8t9vCc8n","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"EeyfPx8Kp6XqFYj6F78Jet19RjAJwW1XQi8zQ79Akq9a","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"ANTjxVGXXdERtH52Q6CUV6KUfkSqP1gpQQsubMk48w7e","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"4JFfdWzCWz1vu28TxUeGQdTUoQmDMtvYpYRVpNH2AVXn","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"9Ufq1ofQkCoGMwutrxm4iLMS4pKR6GTzp3YQzFhRvb3L","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DoojfJrNoovzoJSnLP1jHwFgZT41DKA4ruBx9jobHhpK","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"BAqhtD62ezehhGUMXZhhUWLeAC3efZMEToPZephtwD4i","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"rMCNpYUtzjnfcnkwtUF3VERMezq8yVpsVgse6DyAnGF","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4Bxxfd9nDMBJhJWTP1Rem6K8zZoe7PU8DZmiHrkQYicj","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"6HwrBUmZyCmzP3EQNKsf3Kt6PMJW4RMYT79smyyjCnTo","receiver_id":"cjf9jw75emqs.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7BRVmMb2gJTwex8eY18Xp9N1xUz876b1BtcffjFRj4PF","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"Bcj4bZdat8Crs3wPcL5vcyTQJgsQf4mjCM1BgkpQ8FcJ","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Cxp89bX52LDTWganpMUv8Qqw36jmnp4UgpmvyW1qNQf7","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"BNntaXTfaN7GF134qEQARdNpeVSFmX6FxNNeijq3JHZy","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GaSy31UJvqWC8mMmjEeF3qfzm6DqMLtL1oT9CRVCvuUW","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"66R4sNtB27tbGk5VUxzeuczVVBNXkD4gZANZdE28SVbr","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"4XJQg9N2PKDCxYJ5hftSNwGkBdGf8TZAP4i5PGV7to4V","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7ALubTZubmVpYHPMqjqr39isPBcMB2rVgzJ9bTunANU7","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"BEm6cv8nhb5duZjfYj4avo9r5kFTEQg6qVQ5wwcv6Q9G","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"3moyEexyEdLjpshaMRxzTVASS6WWnifunT9m3oaBPdME","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"3P9sYM7vQMVuv4arcqE1nj3Gf5iRpdXoV22geJNK5by8","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DHFa1o8Zo6V2TZ9BQzYxBB6Wuuj5NWmrVYdcvbCsw7RZ","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"AAMLmTEDmxu2J39982G3eeyBhcSCFxXqA6HwVLZ4Pzjm","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"GiYZ5AbHkgKnq9k88HqrB7Unp9BMcukUVraG7UqJU8KY","receiver_id":"pgqqae3lbkkm.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8wR6f4uGWHTdHTfTbt4w38Emeo7hB6CQ1e9J4mLEggiH","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"ZDTRHH5q5GipARy6ab5gXmiJ2hnjwmmdfM3ryDQV6pz","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"3YGSU9Ke48Hv9r2946RjUg17qPMq9yw3JU6aVfD6PyWW","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"HLDEMJsKFwJT4D1sami9LHKpT1kiz6Lts8wQjWHgxKd1","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"81Paj9Lh6ZLbbrRWFwj6YtUoEoqRUnySrP7RXErtYUmz","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"E4hj5EpuuBuRoMLJVBjyyNrUfw9x6gJ3Hq1NmxfRL8uu","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"3eoN7KGVf1p3rZe4Y6gx3RfSQYK2DbTFx7gGLvWauKRB","receiver_id":"137cf7bd5cc55e0bd42456532b513a7fcc9047093df608fcc5f84ffe585b6066"},{"type":"receipt","receipt_id":"Y3kGVBqybHnQYEP3FWyHZHHhHvwRNWozKgetgzyTskV","receiver_id":"testnet"},{"type":"receipt","receipt_id":"KJGhxbTxkxzRHquAM7Tg2BeKtkacWHgVGRAygaVurNB","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"Cg1WuH5NWNPY225WdTvNztWFedcVgbSSbq8wr4AkELsZ","receiver_id":"bulls_acct.testnet"},{"type":"receipt","receipt_id":"4raiaa9bfejJPKxhPm2wgJ6iXyKV76KSBGerrEHoS3kX","receiver_id":"testnet"},{"type":"receipt","receipt_id":"rxtVaiHjtKpK57hFtu4rhaoPPy1aCaTzsGkjK8wyWSp","receiver_id":"dev-1705307926477-27596965257070"},{"type":"receipt","receipt_id":"9zuMFMFNLCVsMSqb6wpv3s39URXioqfcUqRrBBt8aTj8","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"AJXvDMKP2nLLuCWbYbT8oynZbkn3qzQ6VwpzLQSARFT4","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"Ar5nyeWUw8LrAAzQYz8FytVux6R1wihaD7pVZKwKPhTj","receiver_id":"dev-1705307926431-91453828422938"},{"type":"receipt","receipt_id":"Feq2jEYjY3VpNukMsSa7QmPYNamPBXkjLy8zkmzQ16y6","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"37cV9JUmdi11czrUe66xz3gPJCitqMvyECRZeW9iJzyG","sender_id":"137cf7bd5cc55e0bd42456532b513a7fcc9047093df608fcc5f84ffe585b6066"},{"type":"transaction","transaction_hash":"EKXDX4RJzcnz5HuW1CErcqGcK114YsKFNotU6boXRuDZ","sender_id":"testnet"},{"type":"transaction","transaction_hash":"4wMCZ8bdfexTpKDQBshQmukEnpcjYJa76PVtwZgGJ4dV","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"AV36SJ2hUUi5BAD3RbgvaTERFwEbF5hvaRFibhWtVh3x","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8Tx9DeDk7TK4XquQTsS5FdsHpW7eENYBQVNqf1UoxduP","receiver_id":"aurora"},{"type":"transaction","transaction_hash":"ETZp8SjKfSrUujvAMs4pdtgC5xScZopepkWpB3Uk4qV","sender_id":"testnet"},{"type":"transaction","transaction_hash":"EvPZftJRJ4iMAAfsRQ4J1jFHSNQnGbwsSGE7qjSrgx1n","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"8z2uWsLxQTZBmGWbGNZ58CNqHGPiqkTiPR19raz4YbsY","sender_id":"relay.aurora"},{"type":"receipt","receipt_id":"GASozGFtYVJXniCe5RYm6yTyMCFfDv9A6cieoich96dJ","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"9ewramutTHiEZWooFv12JkpWritgVHo6uDFpzEtBCZd1","receiver_id":"9l94qo4u79w0.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"9cafH6D9aDp8ucujqAxUB9mWByL3368sVdH98AWmYwU3","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DxWjTkvaxms5Zr6GCHPw4BxfQAoUs8JqRWK7bDKLTH8i","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"EDSTB6DfGgJ5DqQUbqkD6gqkrJ9SFB4Tyd4ECzyJSegX","receiver_id":"testnet"},{"type":"receipt","receipt_id":"EJfVvpwMsHz1NHGbkS6LGqVXN2qneGYsbkYjKajRoGo1","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"C7h71p7NVSHpcsQAYiV7WB63yj9SMMdc3jqMoHF2A3iz","receiver_id":"testnet"},{"type":"receipt","receipt_id":"51d6aKfsbSgM22CgyqERJctboPpp2NaByfqtFnZQMa78","receiver_id":"dev-1705307919672-34015732945741"},{"type":"receipt","receipt_id":"Hdc4eCrm6AmD2ywGiJafvWWM61KDjSRr3dnQELv1RdWp","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"9QR9rrioFSeEVkxQvj7RpbTcwdpU6NjVchStn7QLz5R4","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"QyjCHQrBN143vftm2MEKVQJqqvXUeFjzo2HP71J5xV6","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"H98tSMrFViq5ZtBLdgJiyRhGB3PitwMu4vnetSznXv2Y","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"6zDqK9xdiceuNN2kgejgBVXFGTNqWyuJrNVbZQMvhDkc","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"85HrksDfB4Pt6CJaHQkJdVn2nqQcEdZyYcRrEk7CqMpz","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AoRcE1QxgFYQcu3nS8mkFmDmLUZd6Nfxhcdcuq3krjH1","receiver_id":"dev-1705307919784-37188855122138"},{"type":"receipt","receipt_id":"9ZLkBrAf4HjncCUw6ZykUshmArYfKneXthdzUQfREVri","receiver_id":"oracle-2.testnet"},{"type":"transaction","transaction_hash":"HDGqo5cUMMweBQcn31cHtTVm1BaQr6nnL93fv2nwjx9K","sender_id":"testnet"},{"type":"receipt","receipt_id":"9S2UPDykbH4qZJ96bKJhiATVVKc9Ta1rkPdnC8MJe5ut","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"ErKaA4gCMu6pDos3svw2RBzPectbanV7un4rtWHcwWv6","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"BUGPwqY17BYfzU8BjX3EtDkMGwkbkm5ay9KpNb5zgZrG","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"6Kg7TUugwUWBVHgkS3z1LKjgoKeKYz9b5gpExRijer1Z","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"3eVHwtVhUnJEYAQHrVgAeVEDWenXFze6N1y6PJtBJ6AH","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"CdSLnmYeppgPz7WwcjkhKFo4b6bgiMWwFE8tC5yvZG5P","sender_id":"testnet"},{"type":"transaction","transaction_hash":"5D3jekGJpArngn4w2mNbHESLCvGZYwYGJkLZcAsxKXTe","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"FgMHm6aV99iJ9PsMzwUMn1nVPti4Emr25Uburc35SPof","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"5r7r8kgHrMXXCDkXFkvKdViaZoes39UeZo79zvVqJPKT","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"4fsVpL3nksKRYaW7MGisU1MxEXABiAjWKsbLENaeG4Zn","sender_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"4VkBk5bkzDfyzkue4hgUZ7QY2rTLaSK93CkKB52VByr3","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"G6wm8f6fKGxnvh62g4o61zLCvmqEYVRfPQJwxqQdDKH2","receiver_id":"ramptest.testnet"},{"type":"receipt","receipt_id":"4T936LUHhkJWUPNAQmiBRaLcfWmwCkjVnbiNdDacTNty","receiver_id":"kll8a7p5mh4d.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8fzjF1nwehiYVjJHAqZgPC1LQeijHJRpexdAzQgdLPcy","receiver_id":"0e88a35855325f20d9cbd614755797220af4afba15c037c8d6a290a89cdc8b8f"},{"type":"receipt","receipt_id":"55MWqWf3y6ZJRCE2TwGntXDuy8mvDEY3n1SJvj447212","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"2iz4fapepNdGMSTZADDpA3DK2ashTtUiZpzHmea8pAQP","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4jpCpTTV7y4VvpwHoWvjWLeu1zUvmA1orNL2ZPwDcmwd","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"FG1TzuSaTNoZEW796SputEymKWKYbDYvgLGsn3fVeH8j","sender_id":"ramptest.testnet"},{"type":"transaction","transaction_hash":"ErDTkCmrtK6ext4WHSw3FgLgeqFFRNZ4ZWJTURMTrL4P","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"4RTejskoh7Wb2KdNH6UkE492wM79AtqDFmy44YVyTGNh","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AXgiZXHy7kMs6mMLkSF1bQHJumdMTjaVztyHodHFaVq1","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3TPWtP3UCZTKwzXphAprtZqh8QtQtJ8Mn4LbM36uhYXm","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"632Cy5ZX2tjEFE1DSf5DXNQVKUxbCLZb92nVDDZCHzgn","sender_id":"bhc15.testnet"},{"type":"receipt","receipt_id":"2wgtsApxzGvaacLNCzEde75Nwofe3VhHBK32TcXSB7WJ","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2ZDerPY6zwPceZHH7rMDTbKbdJkVsFpx2gWkJ1sMWsdR","receiver_id":"0q34eghn01vv.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8Uo3arAX2ZwLeXuWvWPn241YAV4vXxyksqSozARoRAq9","receiver_id":"testnet"},{"type":"receipt","receipt_id":"2yy5VJCjvNXiRBsAQH4oFmD71RXcbPK6RCQypoByrkST","receiver_id":"testnet"},{"type":"receipt","receipt_id":"C3GrEKzkaBoU7NfZ8P2HVtnaxXTSYAD3DR42i6LAJQo","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"FU7PmA5AUQxfUSmeY8TrZTEhDjPJXsqe18cv7G1vzAv1","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"46LqbXPA6gQjHyWVdmbCWapPHUknXiBswozueZWJQEAF","receiver_id":"dev-1705307910944-61831820799278"},{"type":"receipt","receipt_id":"AachQMGn3CzQ5MJXZAhzfvZGXA4ja2oEL2LvbyAqtBrb","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"88T25wvh8k3SXPN3Zv35PgwkBHQt8jcZn5Fws8gPTBZQ","receiver_id":"dev-1705307910940-63645215141528"},{"type":"receipt","receipt_id":"APjUhHPiLmmUcGKXLPJkisMA4RnA3XehxShHktrxAFjS","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"CQiPGrmbyzb3rZvS2uPELY9gwacxpuso5gU37J8AqHqZ","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"Em48RmHvsyPRpEF3NU3izqMV2GdY5UQkN1v5UARNU3Jz","sender_id":"testnet"},{"type":"transaction","transaction_hash":"3Wa2TD8TXXesB8P3xN3zg4rvJyHngp71PHaNNjcvwbgT","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"7hk88yT21FuVHcrMyZCaTU5Q53iJzBWPt18hQUXSyqx8","sender_id":"testnet"},{"type":"receipt","receipt_id":"23jmNcxbs3QquTYLX1eNcQWbBE3RAUu27CMFC5pTpewT","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"4ZDVp1sz3wp7RwyHAGzgc7w52VedUmHCxC5J2wHfugq5","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"9LqgJqe8ewcnA1nwD57MKy3MVuLWRbA4GVSxKh3qAkM9","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"HrnxtphU4f61rdakx5Hs3YWwFhdNTUEnxD5jnmCCboo","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"Ayb4aPGDk4YaQv8jTD5kEqMSjD9nUmMGRG94hr1H4wPp","receiver_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"6XrLiZa9NNEUYUXZhWjEftYsXnUkdcPBmXqABy6pM2f8","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"EystZsb29ZCHua6howqB4rW4uoHiLmmqp1wdvggVH4Sh","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"4PfQuQCRbEwBrdHvSKYJBzVk1uMooPpwg57hLeUcaFhH","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"AdBx5TxbU6B8oMTt5ERdaEvMjQHkez4qskux4fARHJKm","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7Ap7oR2KciE6fgrgpvv8aYsmps7F3Uehdw8KKtjxGQJ7","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"7FZxHdMxz2kyiGoFuFwL4AcEUM6X2ZgFRoxmaJ4qcTHB","receiver_id":"testnet"},{"type":"receipt","receipt_id":"HJUpQMwNHrJJZUmynMfjhbBCmLrtehtBKdjpaXkaMAa7","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"9J1ogtDDMdnpswejteNHcdVeAUbqyJfjevLQ7pTfWpxe","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"EGhfVcoKQKyiqcxaGFbfmgC8G9qZPMuGFbJkg5hnsmyt","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"3E1aJHc9djkQJNWicMZggR6YPbZkPJL7VfDQ68fKL7Ya","sender_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"BfPn3CFLjy4A1G57Q31SgdmehFR1A9vfMa9CNksqdqjH","receiver_id":"dev-1705307898433-26034121630686"},{"type":"receipt","receipt_id":"BmGXFE61s3BerQpccgAZREhvTsKXfMbXqpHfuvixkHqz","receiver_id":"dev-1705307898466-81907073670185"},{"type":"receipt","receipt_id":"12YXBaXQD1pMicv2XAy8NpvHRbnE2KQQTMd2RQhhxTya","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DrhDG7sJbYipxR1BWntNjqt6RD3nrw1nGQpV97sDpbcm","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"6xnmoEYq4cE6DBLJDHfokrSw13rEHDzNTdqGV6XcWTsg","sender_id":"testnet"},{"type":"transaction","transaction_hash":"3cwMmToPyLVgc658k2J7Lzu7gbxZuo8MPNT9PjMkn1qu","sender_id":"testnet"},{"type":"receipt","receipt_id":"3PyK3NKvdmZAR4DsYeCuQrcAMjoQU12tC6DzQ8abVt4Y","receiver_id":"j21jwivujppq.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"C6MEJkm3Fgd5pAeGj8kcxYRvewXoMVbGeaxRXQSXj8Ak","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"38j7iZDr9RhXYgGumBYn4cUx8d3THbT2EuoK9ey6h6cZ","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3B9gsr6aepyFnWFU5NgrbgnkPJjorTZgLEduHn7jhLxK","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"5hno1hpABWKfhZrnQNQrNeftbiXeUE2nkyV1ve8AJWd7","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Fs1snRARpfMPzGdd3WHALSF8pNGkPGYEVjRJTZLSexfW","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"4c2qJ6koBSoAQAJmM7uyukcCdQmcvrWmFHNeoFuvevee","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AYoR6onupvM6Gv2XSyhSyydkhzYBuwHi3TKpggeCs5Bw","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"CMDT8PFrAuBYN1BzYDMWkyYvpkS6wZwMCjG16KwYSmdz","sender_id":"bhc13.testnet"},{"type":"receipt","receipt_id":"7REkFmUqJ1kk9mAnrRknd5hheGWvszKvBx8qwvZuwVpR","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Hcd7g9nFSKrUyPTLrYDd1cxATvL6DUHnftS5RGUtQ3jt","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"FTKmyfNjPapcKmTmRgHRsmaL6mDtuvpLEANLJNSQNYox","receiver_id":"4wppo22o4q7d.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7Mt1fobGjafwC6W1oti7D8iYxKnJwgDierLfVSzU7KLM","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"5gCAZ8Njeobxrg5NsjY327361NHYh1XGgfJtkwRxK8op","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"5puFb1DPWk7vnEhBCJjoxSZvVaRyfMCSQSzo9HRhzkGf","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"BzVZd89LT4UsT8EdsHMj7W6B9HXhvURFYTzZyvsA5kC1","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"GEyK6YvY33af3QpTh9xgB6qSGMbH1gXSE6vhmd3p4k2r","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"2yU3wbMaADVa5yNQwrteJuMtpZ11Upw8nC81KBxVMiHb","receiver_id":"testnet"},{"type":"receipt","receipt_id":"3Ef1FpTfwu5w9pZq2dMFZKXjERM5NvPyd5fqF4EcYyeP","receiver_id":"testnet"},{"type":"receipt","receipt_id":"C7wxqZ9JeFJT9dEb2L9GMiE21SQB7e85efuP7jVLJmeS","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"9fhVYpxUvRtofxxXi92pV26tQjwqem2GDs8JY2kHCEkE","receiver_id":"dev-1705307898829-35355796779017"},{"type":"receipt","receipt_id":"C11VQHuw2P6QhqWTvdukh21qxxJgMG22LTHsrEpp5FcZ","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"39beQnAfJbds2QhYK6mwRADR3n57Fv7z9aLd75siUj5K","receiver_id":"dev-1705307898858-90397935745110"},{"type":"receipt","receipt_id":"6s5MYdhZF1Kw62uijZ7Ym8qC2JwvyMVdXXmYSUXs3k3u","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"8BrMtq6jpMLHRxxjKxo2aSGtg7xWzX9gD7K53mVbZDnr","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"E2NZbSxTfZJ2pBw8WeZHsag2619wAmemgC3HBmmWMzdC","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"6X8EK3HoCFCbcoRR7RNSqqRrDT3uCg1mRXwkVZGCZLU8","sender_id":"testnet"},{"type":"transaction","transaction_hash":"4NkCDrdjY3Jd2dJbt4X59hkHbG5co3SxYTUNAALqDmRx","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"HrifTYWLyW5ABrizokCsUB9ucpNqYmAnwYNzBLL3Cjyi","sender_id":"testnet"},{"type":"transaction","transaction_hash":"8ngd9uVW5T5Q2NG7jcHh3sYz2P3jqXkdWQ1AaYmCpDfC","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"EyFFfe3HKSGCwcHuJMJTxpZUwgWr1Utre8h9pJzXgK3o","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"5u53aFNKuAvBcACxNFGx3h6WfYdpkvLQcrSzSJsx46nd","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"H4HywdHZoibZyMkHcVjEvNhpHPycSc2c89btgqBSPpgc","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"E6SY7Mb5zM9bAX5RjfAos1LTkrLgcYbHwn9Y9SghP7PE","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"68XYxPEmndTstRXLrUT4LxRNzMoP4ZTF7yWauaXRBQNy","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"2rXmHAbk8YZN2YGnKw8QfeGJUsJArLBhMpFxvh5s7WSv","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"4zy6PwvZF9LR1L4wMnZPpfJ9q1htHPxdrS1wLy8vFXrz","receiver_id":"5-ft.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"8nWPwYgXN22NNDctRoXbWPayRADqzBBD6o5sArxBBuRB","receiver_id":"testnet"},{"type":"receipt","receipt_id":"AiXXDjUzJHg3jVpDhuxuVYh13TKDQqCYKGWHhoUZGYGm","receiver_id":"testnet"},{"type":"receipt","receipt_id":"4cUnbLZyHZ7zaiYW332gEcRS619988fp8qf6Sf5tga5C","receiver_id":"aurora"},{"type":"receipt","receipt_id":"DwYs3r9HGeQZBqhnj2B915MWXTGZ6sStqoLLo5eijvpY","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"o488CGEfsN6xVGPz4HpnwWJ3pkvizzNbbpLuyr9sqWh","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"Gj4zCiCtJMLBAuLKekBjP8FtapoBdRPXKzVYKcq8fBJw","receiver_id":"zaru71wae3xm.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4AXsbA6PpSPa58Mpbhq7G8oyyZbUfiGNwTdw4s1ediey","receiver_id":"dev-1705307896734-91056264654871"},{"type":"receipt","receipt_id":"EEMnzGWFkJhjEJrJRbK2xrRUGKk31VURFU6hkWWAshZJ","receiver_id":"dev-1705307896718-65112976037726"},{"type":"transaction","transaction_hash":"8PR3U56NpGFzf6aPCxAjb5krsJPTnuWWXPG1aj5ci3Z6","sender_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"transaction","transaction_hash":"F41htcw4KnAirmtbsuSCFEZq4PEErQj99KnLTjXuNwLn","sender_id":"relay.aurora"},{"type":"transaction","transaction_hash":"AvLUZkMWXMPAsZcbN6msP53qxifQKaEoFVRdajUnzWJF","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"BoTUruNPYK31dn6zmmvqcVD98yWJYdJx6mwUvhm6cxZF","sender_id":"testnet"},{"type":"transaction","transaction_hash":"DEKdqsUKsPXyaL5za8HzGCZJrf5oiBizERQ4A4giEhuu","sender_id":"testnet"},{"type":"receipt","receipt_id":"9MB8qBQTYT7yY4AMwBDDFq21Ui8xjsmf9euFrQpajHpo","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"13tXtnS2uBStKxPhVgqdM4YKm1ZkZEhavkT9ZZJVvggx","receiver_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"Ffr1anKFzzi1DWdRdzmCVGvd8GZXgK5JhKqaWekBvTB7","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"FtXuCxzWuVyTJPbzuZJvfx39BkGf7dYf2hXg499yNXA1","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"3wveX6eXzBYFv2p4BVnb7DRxQLSLWdPBa868B1dKAcY2","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"6BKKPfy23aLmZhci8AHbUNTcg692FTgfGgwEgSMM6Ehn","receiver_id":"price-oracle-v1.nearlend-official.testnet"},{"type":"receipt","receipt_id":"AbcJusprBecgG9NfV2Pwy2dAEcmmj2Ry8ndWnXHBHjZz","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"FBLH6KwCkLzhQdwcUSxVNUwRDqiPKZw1Smd6o4GX8YSs","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"FqBVYpxRFMJdUC5LNaaQKGHj7NSELfbAa34n3rws36CX","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"GcDAF1ybPVs7uMacth3Ju4dcbzaa68Fv81My7g64BqPs","receiver_id":"5-ft.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"8mh9HkZ33pBtyURijc34vAeiT2rwvff6b1FetQYfaQYA","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"4UMs5gaqkN8KAHxX48d1qdossGhryqSiqEtNBJJxYjTi","sender_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"83h2M6ee7pdc7tDbo6AxouJU1pztfGi1Xdr4ESqa6bAt","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"5yq7SyHH8Kp7Tvjs2EJ9aWeLdJgbEHnYYcC3ZxhyNTEb","receiver_id":"5-ft.dev-1705192023920-59281357047296"},{"type":"transaction","transaction_hash":"3yLteDqyFqya4CX6ySkjK5WPaBxTjKJAG6sov4P89NWM","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GhZzj2NptNY9YTWYLxjqu8qHx7Ki1YBtpy2356AVLxNV","receiver_id":"ray.5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"CFaqYyetKq4Vyh27zyVGCKWFo2DuK59qRXqx1S5tkJDy","receiver_id":"5-ft.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"gwQDmw8R3up9k6KHzFcxAgZuagGak3zHaNDqxwqxYtg","receiver_id":"5-ft.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"CUcGzRfv4H1ASVLirzWnXXrCa7GiB5a1xBtRQmmNN8Bk","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"HxFPHfv6ipvGz6aQoZDZ1MSF9NyU1cvumTHfo7TuDqei","receiver_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"CJeA4nu83Mri2TSqjA1ggNAjFR3USZVXna8FZXkZTzZ","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"DfhX7fwxPG6wrZJHu3quL3JH9wpgsRVvRegy6fuJwMaX","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"GJQACSipp1fuRphvb2Fu7qPNQtMNrihJdwsCPi3mxx9C","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"vtzV6vE4j9R9tZsuie8PuTaXdvnXgegb4ojskLkC53k","sender_id":"5-manager.dev-1705192023920-59281357047296"},{"type":"receipt","receipt_id":"AB9SKoVPvhcM8rKAp5nh7XLRCmDxb8EUKW18ui35DV1A","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"BafDCd9LSjRnZwFWhXKWmavV7j9ombwwxr2vwVdSA1RX","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"42KKwyRV3mTYMka9RtuVEkFYPZgLjPi1pVN7sa5M1ydC","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"CtcUqSTSkHLP5L4htPUkKSLbUN4He824ymuEwXNdH9Hy","receiver_id":"8tcxyh4eaepg.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"A7z2fzjRoAM1pqertM46F2mPoiDoZMtCRTNt5AJRimij","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"5TJ16YvPQCuM6uauFcTrPcUgGfcLZVw9oryACUBSUbry","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"HtL9Vd6UtJzXnN6VYuKx8S8J8JCAeJzi34ZQSorxzzpF","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"267ataDuMW3r4kp1JeM4MtUbbvP9dyNrjAGEXbEo2KUy","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"BMGboW7FQH7miwnU74GN2ktntu7sm98SshNsai3j28ec","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"Ed8YULdQXHPSZ4LF5thA8e28koou5YKPYTeFXHnJqged","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"J7EhMakp5kGHkJwCRJr7YNiX8bNZLkSY96bNi4yuknWA","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"9aoJTjvWzcvNNFVgTVfA3d6242eZ3Br6JMm9sthEQTrh","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"GXu7Mee4Xt1mXT7tGTTRQVx4yTJQKgPsVpo9foCdT5ec","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"HaMd5RGQ4sKWQy4Sv5Ti55J98o9yjd97bNKoJ6gVbUM5","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"DCoVFX5qDp28ff4xXhwJUJfSL69kZWqZcZLrNtNo4P77","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"35N8UqhoxemuFMVNKQvcRpKaCm3Sb6VQhb2RE5JKN5Xg","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"FBQDL1Md8DfrrYCQuNsUJoZ3omPu2pGcFf1a5SU29R3Q","receiver_id":"1vf8lat3eupe.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2ke2B2grA4UNgLZdLzPLNNWzq9YhYc5c8RtKDjkzm5UK","receiver_id":"testnet"},{"type":"receipt","receipt_id":"2n5FExgNXjGUdKXT7JWy2uy3osMxk5kqGNR114Efc5eL","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"8QNg73mgKNLsmkmSru5zcoYCMJzVQ1irVsDNCXyBrXhm","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"6vSCV1u1vYCs1c6dRGSY8Hw9ZYddhscFcrbontJBJh45","receiver_id":"dev-1705307878625-77546670858145"},{"type":"receipt","receipt_id":"DzN1ZqtLtbifhDtvYbiQErKdmiYEivSKFeTfLUjoFnmp","receiver_id":"dev-1705307878607-95984362744421"},{"type":"transaction","transaction_hash":"6Hw6PdzzM4B3w9sv2MVSrUAidqXsMbKXEKTr4ni1R5eP","sender_id":"testnet"},{"type":"transaction","transaction_hash":"AvSHRnF1JY1mfvuCnorFMaaSzB2eehia5wP8aXrPVqNm","sender_id":"testnet"},{"type":"receipt","receipt_id":"Sf2A5AxxYj3hv1MquBXHAqtxua6oiwpKf86Fy6CG2zp","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Ds8pzP4gKC29Y13uqLSkuHL91oqgqEiUwba58BGER8NM","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DZ1BazQkJY215TtDwnSwASGW2ZMPuDabNw2aY89iEcaC","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"5wfj3ZYEHpbo1NWnjdqJtjY2JV428py2U2qo9vn7pAMx","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"CeaeXCcAbeSGauY73SPi8u8nLgfXv5FSvbVYEwPsMN2g","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"BwWV2oQ7HzRS6yKnN8jEYy7siiuWCAAMwNEeYPR38RJq","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"26i1mbzFQcMBN4iCfrDFTZUEVb13L16TPGrnnHTZSxBA","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"7P7Fbrr7CMAMnn2r8psQSRK8HvAkKnvHhpJmJuArhHuH","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"4BizbdPg8YLUwG6SybYhJdUsKdEuAPfkFMzMpRPDVaAq","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"Eqp97EsTs1RBWUkJpbW62HFfATZKqHTRu1jaT5P4XxxJ","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"3exN6XrXZzNMZvPHSjYsuZwqkJZTJR6jyywjSGXHjHt8","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"8mHPa5oRECdDm29fL9wRqp2NQ5PxVGqnzGQYWRcN7qNQ","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"3Dudq7DB5HGUu8yR9cSvo7fAQRGmyTFrWLfhEDGh69gi","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"GUutW5WSA1RnajtQ13SAYb3joHZmfYpb3s2ko1J9ZqZE","receiver_id":"amca4m99b1u8.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"BsEU9eEjSQ1mqmEthvB5CkuDEQsCWUovN1AEwHbsLttF","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"CqeF4iuk9LzCf1pWJvgbsAERzFJ7PaLpLryuJ2bE68hh","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"EhuKzKnLKoknG8bk325Lqp7dc6wLqWYXVBvmBBv2LTyh","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"6Rd37YNfmpSSkREmrF6doC2pcehrJsw4FFuE6t46416D","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"6pz1zC4MyEAPnBmkjpnKKzCVdDW4aYNP5ek3JxeiZUsi","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"FkQjBGFCw9UsMLwqqydEyyfeP36rdcWYyQdkhxoV6EGB","receiver_id":"testnet"},{"type":"receipt","receipt_id":"EuzSjBDMP3TfMdXZLbmKz8mJUqfHhciEptV3H74Sz8Kv","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"4JLRSK6ppBniqv2dS8g8DV6yqnQ7pw5otNJwYPfitc3c","receiver_id":"testnet"},{"type":"receipt","receipt_id":"GKsPr1kVBCGbepGEw8mzq91DJfP4gG5NMh9JmZWShCm","receiver_id":"dev-1705307874862-35306783139366"},{"type":"receipt","receipt_id":"GP1K1ndb9fSRGrF6RUSjvAw6m139EoWWWCRSY7frW8HA","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3FB28U76MD2syh4jzjXFkxymDPp9HYZTnot53aBFT4Xg","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"A49XD6VGqMVymQv3ZbDyZ7eCZjvg5THs7tQaGXZ3Cke9","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"6vEEcNPm5P37q5LSFU4kYrVPGxKpvx6g4NjfkGVWTs8p","receiver_id":"dev-1705307874874-37652742511081"},{"type":"transaction","transaction_hash":"6viJ2PGP5pP7BF6PLBu9V5dJrMnChP8NuNyPy8i8qpYm","sender_id":"testnet"},{"type":"transaction","transaction_hash":"DxG6fA6fkrymd9snoiy7dxpMTHVFMPhR8hXSNAoTaaAY","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"EnNjTWXD3nQFhMctPbZHwGw2fQM9VHtBLi9tvBAN8fqm","sender_id":"testnet"},{"type":"receipt","receipt_id":"6EF1aWsz3m5cBxzjt3G3z21ppxFQK6SRZfKewYbutKDR","receiver_id":"testnet"},{"type":"receipt","receipt_id":"GUN23uhWrZshq9x8kFM67jtdXkw3nCmPb8AkUR1QkC7z","receiver_id":"testnet"},{"type":"receipt","receipt_id":"7LmEfPZaJaUS6zHnpqoTpupNYDKK6CFrtGBju1B74XFY","receiver_id":"dev-1705307872205-99213567112810"},{"type":"receipt","receipt_id":"3FZug3PSDbSwgN7KV8FwaioPACpDnFRAwXtKJ94vg64p","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AFueZUywagapg3zzSQzZrVNL7S9rJci5H4vqXFqrZWxY","receiver_id":"rrbqctvnufrc.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4JZzXjVqBsnYmmEDeHd37pc3VtS3caDPUx6kwF5joKpJ","receiver_id":"dev-1705307872188-88884159947877"},{"type":"transaction","transaction_hash":"EkFx8AUJJVTduPWUSJp84vbZYaS3JbweTuQ921yPaWJK","sender_id":"testnet"},{"type":"transaction","transaction_hash":"EP79Q5dbvF6yaYBqRRdfWGxoVbJTcEPmf1xTRYu9csXF","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DJYbqnB1sfaQUTo4MMwRnnCnVhyLqtyx9tQvfCtXxXzL","sender_id":"testnet"},{"type":"receipt","receipt_id":"8hw27x4nErnoAxb5dSsvCJZMvbEBGU2uZ3GB879LpeKu","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"CKUjpSErCByppV418o9o3NYMm7TNtgm43pPduAn9X5s8","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"8uZt6DQsw2sq3xrFt3RJNieS6LKDhH25qoUyG4Cj6pC4","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"CuwcRofqQBPpoKzAUpa3ksANv6Te8cXoWpK9Qoc6tzEC","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"GH2NVDouBgGcwcMcxfd2QaXTVeu8uuFxfFDMW6WF4hwz","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"Fsk5TnJ6eywZqxTZiLrysALurQ1oQh9c6FiFre3U25es","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"9jhcCd3FLM13E2LEk9n3Dn3t16RofCDPMXhphuCznphn","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9BTMpPUWiMjLrh1aVxiW8shc93rgwiLQmuqdTay2MLXB","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2GTdLdYM5qF8zTMeqxuuqPQFBq9H2K9KRyiZvhrcGGen","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"GdbxinJkfMtzdofWC5wd3QPkKh4wvzdCmXkbQyBjDoht","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"2iWKHQA9vc391e8t4DKCQt35fBYgQfyypTrG5ateEvnV","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"H54N6mtrYANytHTbqnMPWPQV3qiie9C74b4vnq58QKT8","receiver_id":"zavodil.testnet"},{"type":"transaction","transaction_hash":"5qaSDBKCJsPqofHiLcP9QzXfMBTmvBmno9kaGi9hUHZK","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"Dye9o49RwotXeyc9iAUEjiGF6LQT3YXADCNqC8faKt9V","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"eYKK4wxVWsqSPoN4Y5qWuwbEjDSi8NojNDzpkoUwoPR","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"GZdRoPNAprgnuZJvD6MP6YiTNJNvKipXdLBeAQ12FFuQ","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"FEhmoRM2Moy3SXif3xR23Ux3LESX5trg2MjxQwckxTe3","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"AicFkvxgPAGStRGCdzWMcgV4J1jYbzmH9gpZcGrihEh7","sender_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"DX91kPfQPho6GLr98Dv2iuVb4ae1dNXNmuaA7qXm2R8P","receiver_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"B8iNpBjtxsWTn6843y2z1Z5LbNwYxkeyBuFjnwmnjBmx","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"B3Fgnxc16h1z1mRSVxj2u1717rhmA1vVVxzxvHA8SNjN","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"94KT7n6zxKnWXe7sGgStvwfxSNCRMU5sBUuJFrC76Wi9","receiver_id":"yoshiko.testnet"},{"type":"receipt","receipt_id":"xgdoW6E7BNTtbJezgtNnxRv37UZeRwPwFTXp3UQSCnZ","receiver_id":"yoshiko.testnet"},{"type":"receipt","receipt_id":"8AKbJYPs3sKY2BCiaiwztHRbZTAkTGYw4ZBunoWYBdGp","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"4RB8d44ipPuLPgy2mL55iMKGHZ1vDMnkix3N4T31BfT7","receiver_id":"priceoracle.testnet"},{"type":"receipt","receipt_id":"HqjbxjyYt3RXb7tiCP9CgVWyERFYwA3XjwnwMAC1JGe3","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"7aRcVbT1DEzQFgG3snoyoxBtGLZsX2yWPA6EJiYqrHAK","receiver_id":"u20d2otgkumg.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4cGiFWPqYdE2uBCVNRsKphG6iXMKJEziUDVM546uwPCm","receiver_id":"aurora"},{"type":"receipt","receipt_id":"7veqnMBDeJsGnJJeKh5HWGWtLgkcT7p1f5hEDX3Pwjui","receiver_id":"athlete.promotional.basketball.playible.testnet"},{"type":"transaction","transaction_hash":"3bVfoDA6ikR2WpCRTrSXtZQ9MTBHTonr3qNky3bcX73T","sender_id":"oracle-2.testnet"},{"type":"transaction","transaction_hash":"DsWufLkBqKUjfcM22MFgJDZuqcHVuFtdtspVZVzZ36Hk","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"Hjd2BVMJbcwqeXUQKNVwn89u6TKh6MUcFb3Juyk9fAWk","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"FwatXJbHzbiabtHhonkkHu8sjvKMat5cBNa3fFk4tFBz","sender_id":"relay.aurora"},{"type":"transaction","transaction_hash":"66fQKS6Bmpmi6Y3gX3yrzhLwGTedrrX6T4eT6LRLnLAr","sender_id":"yoshiko.testnet"},{"type":"receipt","receipt_id":"5DYpU8wsUBWnskoK1xBJeXvH22RAEwGDjt2SQkbugAhd","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"FjBpFiCo8kFxikSV6frSSq5vDZL2RGHiBRykoQf3X4YG","receiver_id":"dev-1699209171769-38068923418802"},{"type":"receipt","receipt_id":"BrfheXfYfgXNMSxapyd7MBZ133MZhw9baDKDMhHyMCag","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"BaNYzySwPn2yALxKPHhzf5taPi7yikUPuRVJ1AcGCXDY","receiver_id":"pebbledev.testnet"},{"type":"transaction","transaction_hash":"3HvvgPffbvzciZLRkBNg1C9vMG6n2y9BpKKWZfgpvkZi","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7fKad7uM7qTzJ5kA85t7pYtzskb5FM8RUfCj9PmHnckK","sender_id":"dev-1699209171769-38068923418802"},{"type":"transaction","transaction_hash":"8zx2aBEeZL2GDG8UxwQt5b3U2vDxLtFy9VYEFjuV8KBn","sender_id":"pebbledev.testnet"},{"type":"receipt","receipt_id":"DBdf76FsVWhECc4qD4SbCz2bGxuCiCtguWgxXCBnifMt","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Bop4PowkKx2sRca8BYKQYcob1HqzQiVgDnzqNqN3skpS","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"BRYW4mie5t6NHx2NVE996GRDKRwSmotbugpVRA79bhR3","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"5xiBH6w7w7Yiaqy87D363KxMQffFTaeM6xTWa4wn1Ut9","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"AZ4XbqnwQYPRRcNUtBp4v6MT4zcLDG3qq1hGt29sH4ER","receiver_id":"dev-1699209171769-38068923418802"},{"type":"receipt","receipt_id":"AX4Gct61w12k6iR3P8ad3b4sETHhSuLp38QWF4J7G7oz","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"FnTY4wcFRPiFcR5qyPv593dneKchT8BfbrjWGUFGdNBS","receiver_id":"pebbledev.testnet"},{"type":"receipt","receipt_id":"26AAaEsjthHfsaWDfgHDm3pGXQTmR1uKvzeug6BRT5w4","receiver_id":"pcjs4axc5e7y.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"6aH14X5u4jx2JRph1iArg58dEMvkW2ye6DgQ8sRycXhk","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"8h6PpD2f9q3wXroKNJGyAVUBMQWaswAS1HEW6qjoUZNp","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Bj13ZD8febthbJ3XooWU6hYS6nAxbxV4LP2jr4yTURuv","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"HW4ewYRR9AGNA6uGySQeCVYYu9yGUTCM3XJo8ho8cf4c","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"MkA3UXdjojDFaVrrMhhriDdGHEt6pNfWcPPyzUanqA7","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"8ALt92vR52CXpQPudMed2dduD8Ay3qiB2cBbuYmVEHuu","sender_id":"dev-1699209171769-38068923418802"},{"type":"transaction","transaction_hash":"6hLCLJHNiAg6SWL2f78GfGGDS4EdgMfXi34NV7yDRy1X","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"FsiiL1PfH5Y73eLjDVgzvAA1LWCJ9HVnxaTnwWwjeus2","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"HmSbYrTghMZ1ePiy7g1js5xS1G46tTHjoakZt9dQ3DtK","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"HNdJb95k99monmSWJ7HGSGauiaMyJ9GKWebgPFiYf3BK","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"32A9mYNig9ard1L4uRgqv64SFdj75yGjBzUtnbbYqkkx","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"9aA4VauEdpksMxe396pVpiGUgjQ9p1CTN4ft48Ji3xZ9","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"6m5FG2ncuVc8hKB1g3w9z6MfNnaJzLJ94voegicf6mzm","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"7Af1Cfuy1PcwfpQ925HuodF8PYW9WrMrTZatV9nF6j7m","receiver_id":"testnet"},{"type":"receipt","receipt_id":"EeHPSMWkoFt8hRrBH8WvjAfdCzXedoTUMmc6kvXk7brL","receiver_id":"testnet"},{"type":"receipt","receipt_id":"FGm6ZWhXqe6KvLgBeyzcEphvqxoZXi7JX2FF6gDJzdtL","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"98Tmqkonc3AunTETcZsCp8ZyjFmGCaQZnkdAvMVkxxiN","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2bJwBXVfVDvJveWz19Np4DkuQ1fWCWfXrEjDSyeYv35h","receiver_id":"dev-1705307857554-98615941249117"},{"type":"receipt","receipt_id":"FP4khnYzze9s46xfEoxyT5cJrSPgQArsfASVzTsP3ZEk","receiver_id":"dev-1705307857650-69966122322948"},{"type":"receipt","receipt_id":"36weAPLP4X9LW4YtE6P8GmhbMNwQWyHsux4Nw92wiBJW","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"6BXZE2hpZu6hHsFE3TAx6qvvjpufwZDK5UcPohC4z7gd","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"EQsSLytLFxCRLzsj6TRTtpX7xt7u1sh2Lvs7Zy2saABU","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"CKrtimMN4zdxgQTYRjZkVkHCMw5vEmhExREKvVYjLrgQ","sender_id":"testnet"},{"type":"transaction","transaction_hash":"3iqKVMszUHGjkqrvkGHMChn9mVGjNqx4VbpkzzxufNqv","sender_id":"testnet"},{"type":"transaction","transaction_hash":"EGbWgiMUeA7qGFJCfsvKDWMgDGBm4pLNzeQfkMvsSso2","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"Djnvd3g7hSsAyBEfK7fwE19CdHoxFfKrFN8eJ3HYxyiG","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"G83mfiKjyqUhaKDppeN739GNvKT41GMiRNBXZCVxz97p","receiver_id":"0vubdoy5ife1.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DsyXG5Kvv3kKKNCFDa8wenpZ8gZW2GzHj35tGbH227he","sender_id":"pebbledev.testnet"},{"type":"transaction","transaction_hash":"GD2cubVLx9xAYenvdiiZgWi2NL4bfStssNBCshxxDVhy","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"F9XbwX4eDjdvZ2ZB6FdTVYSFch4GocgcZ76NRD8jt5N3","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"AduydF4DkqTkZ4xWStEUT2WBHkK7dQL4vU4Edf5CZeen","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9seTCerCF3L3LvvMRLooXZiJHma8EBCY5WUXUyrZNfEV","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4hXtg4Cu9DFNdpVtaRwPvD3TEExpJamwGuXyxFapp5WB","receiver_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"Xtr54tEmpo7UC9RD97kn7toLbpZzL5sCQi59jWsRevY","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2FVfgNw8bqLis9oNzbZVRAB6ruwPbikvF5KiPBxysrBo","receiver_id":"priceoracle.testnet"},{"type":"transaction","transaction_hash":"FihZNBc8vHvCbLTuNwXGdfFNDFtjZgC4jzcbYZak4RUR","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2EeMx4ZUffRZQ9MVm1EgSdHsa9Fh24sCzVG6h5C7sDtK","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"9W6NJGDTsGUCQzQGN8nh8RccRaKBggAbvFRKKp7t3gvU","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"nZasMKuRg8XsbBzqWeJ55yJx89rpaPghei6NHg6p9Ue","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"3CPBhUtz1NQiqfH6kh7Mq2wit8CwocGUhCvbEu5nquuu","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3JrmWoRsD2ms1qbKNFGk7HdJ41yAuwgmuSmgqacsUH6D","sender_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"5ssHDEa5etgKoaH4aNLsh5i31E8t1r29xPRLJ1VGJKaP","receiver_id":"testnet"},{"type":"receipt","receipt_id":"8goQYKZbxZD93UHt95WscftoMyJdkPbf1bvuTd5Bk32F","receiver_id":"testnet"},{"type":"receipt","receipt_id":"6WRG8jq4QPhExbdfEAc3357U79Tj3CtWmgckQKpfaTC4","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"DJ3sHW6ZxNNV3zgWUUcrYk1CJcTGH7D2uKiLAoRE94j6","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"GmhiQ4WKLB543g6ZBvApWCCohA26PChfBb7qo7vThptA","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"EAJWhSxsj66bGHGpCmtThNHEhTs5b2Dz3yY8HfcMb3Px","receiver_id":"dev-1705307847872-52609250766362"},{"type":"receipt","receipt_id":"EKQgm4uD18Rk3xuMwGNJEXRCUjsm4Fv4pNtz1ySabDsL","receiver_id":"dev-1705307847895-22300198841507"},{"type":"transaction","transaction_hash":"BKL91qhzPjAMgqH3UFSAPm7nUhG1SHENFJUZzgspSfjD","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"AW2tWQZ8xUBh7KhTzHYWX6S3jrogiHqiacJ4GsgtPdhF","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"57ty8LXfDyWrgsqm6wPRJtxtzGZbqUAZEDduRhVjhzAE","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"8qwymcUEU9KtfE78HBj9FPTBMctZAqJCnJVP7H7Z1taA","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7MSD1GUBqRPanWAFqdbxmzbHE9GcLcTEpX7tFnFhNeeK","sender_id":"testnet"},{"type":"transaction","transaction_hash":"4J6KXc5EcDKHTV7x8BM8tKCeim85Q8HFnqJwj9jaHB1W","sender_id":"testnet"},{"type":"receipt","receipt_id":"BytpP7PmyTZuSyA7hH3MBcyoLYUdZnFwW6EQfqqw2ZZZ","receiver_id":"8luca09ft80h.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DxBJW2G3CQCnRkiggEfaipKZgmDNBkDubSMiEKzsJht8","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"oLcrH7wywbKGXXdvYHweiuxP7UNcU38HHx1L1112bjJ","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"HtV35UYqT87Pug9Yc11FE2LVu2GN2pvy1g8s83ZuxuSb","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"BKfVC3KSxcj7BU7MidRQh18Q1SiaubnHrW3PoMGexe9c","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"6U4Xcatm88u7eWCTndCCBLzDgZKPTtofknsL4eV47R1T","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"Cs71f5WLGj5GQVHbmgS4aHGCNxKgQVfbARqnN6xLJkEZ","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"Bxvw5EkPMYgZ5V4ngM1AAnTGvaX6E3Vw8KoUfpnaJQfS","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"EN1dUzkQi2CaiinNp4yqHoFAbye1XVjwX9qQSnMTfjVU","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"7zZ1wNcrZkbNEP5ZF5BSmQHt1w4BdvPughqR1NHvYgiU","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"956rcc2qq21cjSnQmgpZ9du5C6gztiR1m4AYGphZ9tU8","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"XbkhFpPBpYS7YXEJrefV4ocyEKH9mdfiYhrZ2Cr7SVz","receiver_id":"5hxn883xxege.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Azjbzezau7KFtbCEhE4gcmNShzsussV4JMDA5PrVTSqR","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"3Gw4qLojge7zC68dzU1cAKeUs5ibXUvoovqoucR3uLxQ","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"HP95raWT3ek1R6fvL6e1fnT2A5efcm9Ch9PDwNocqyDs","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"ExKut7Mf4Mbqv2bxAJDeyabDEXLPsYyjc26in8B1HbqN","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"Axd5NJNev4mGC5V87nHQQffW13zR8CsNbxhxJJdMW8CT","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"DEz48Sg3o1sK3NsSdkKhQBXsicQCgarzM3tZrmVArqq5","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"F3d4rEghtdn1D2fn6qCi9D2vnX5FYuZxr4sVjeXgVmCY","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"2R8rLziQXf6jrjg6ZpFgxCRH37xG9HECtEJMJKvtXJXL","receiver_id":"asset-manager.orderly.testnet"},{"type":"transaction","transaction_hash":"52jw8BSDocthzi8CEDNkjjKHy4et7vuuGoFNHY9eTW92","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"BtpUxmo3WB7SBZQfVzy9myNejK1Gi2EWyEf4ZYt4PcJS","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"D7PpPHXKYci9KF72TLnW49xcxPHWsCQm7PFnXkRkmu1M","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"G4PhhKq7WDgfWzWHJhZY5x9ZS3eqh8wo9cjWXs2FT4ua","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"FmAibdKQPQg5C3wjFVN4oNDhCf31d7Z5bm9sydmv1tBt","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"46Tkb1uqqVXDqnQCwKgvAGQPbNFaoxB9LaFGs72jFNh1","receiver_id":"testnet"},{"type":"receipt","receipt_id":"AhrgBBgUjHabEizJV2ahW3i6aHsXkQYQoJ8P4wua9zK","receiver_id":"testnet"},{"type":"receipt","receipt_id":"ELCBuF6E4RkYsuAkkqQZuQWtsVUSiZ7AKyRBguQsFCTL","receiver_id":"testnet"},{"type":"receipt","receipt_id":"7nAXEpWiuzshXR87sBXdduWvM6Ua8wjFURbhbixP3Cym","receiver_id":"dev-1705307837661-46681505814982"},{"type":"receipt","receipt_id":"DSQcPFszkmqYGn16gTUze4jzazHgwVLC86YgE33fF93t","receiver_id":"dev-1705307837671-19734995528860"},{"type":"receipt","receipt_id":"EkZV5QCYYqjq9GhtGedR645xBQtLWQrUAEe4rrugddVa","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"Cz7dR1CtwuKmgmwNEHsdhqJYkYUu5y4pKXvDpzwk1g1Z","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CEfSpje7uRfebQtFeGfH9NAXp5J8P2Fp44uBEBa9rNFq","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"5MQMoTbfrv4dzoZ7L7bUgZwFRVauJN7EHojyC7gXHWiB","receiver_id":"testnet"},{"type":"receipt","receipt_id":"7niRGhjABrG1qU2E3NG8s6mDFG3DUZ4MJH8Pxy84yiFu","receiver_id":"dev-1705307818231-78108509900081"},{"type":"receipt","receipt_id":"DpjyXVGUmzhRge14qZqGhg4BEmEwxo9MqdtMknu1pdYV","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"MdmXmF8fYvad8CChVn5stEKuJqYbJGKpB8RQ6A45u48","sender_id":"testnet"},{"type":"transaction","transaction_hash":"GAp8HFwWHMe6AYmzsruHCTEGs9rRCgdWYSBRHY6ePMme","sender_id":"testnet"},{"type":"receipt","receipt_id":"Ahmhv1HgeRYjJjEtqxnEqogTrtGxvc2X8Yk584RXeTuo","receiver_id":"dev-1705307818215-85371038755866"},{"type":"receipt","receipt_id":"9kCb95S8zh4N5KjV33QDriKPsuamRBjmzPvQncCbmXMV","receiver_id":"aurora"},{"type":"transaction","transaction_hash":"F1yqYqHv3fi1nD4x2Qer46v4yAwXt8nV7xQtENJgdk9R","sender_id":"testnet"},{"type":"transaction","transaction_hash":"8GWoCFCRQBsT3Ufk2hpDWW5yoHAmMjuA5jkEnHT5MsJT","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2AGSwbFAjzPuhGzgFsUvCB1kpMbquAcTQBuieVHCU1mf","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"47sd586RJFziwHgVqGREAnEdYbacXcKkTJeKFLAmysW9","sender_id":"testnet"},{"type":"transaction","transaction_hash":"Fg8KZxzh8am1C5ReMn83Psm91qbnGSvzVKVmj2hxXpQC","sender_id":"relay.aurora"},{"type":"receipt","receipt_id":"EPMMuW6PBj4ZSB4yjj26YeLC2P8XgxD79qaHbZEo5qxU","receiver_id":"ys2rm4iswpa7.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"6BRveb46fL5Lum9cz1c4jTqSxJDFpg2jZy9fi9XSErpM","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8sQ2TkrZyVRzs4b9Sw5yFZ8rLEsZC4HMR2rfbx4G7AUz","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"F9nqrTARSoRTHGBL68UKMVfJMVRGmFt3rqGdebRiUXiW","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"5RsfPZwA4bZ5DrNYU3SeonmF1BxqjLeFbbLMMhnB6zy9","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2pCtjcn1FvFgXh5TxVBod7qbTxuRYtbGJzMor2FgKvm5","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"2SWsPeazuntYAxG5DLa2HKomMYhpRhQ63A5PvAug6PMc","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"GQfDL3zu4b2GYhch49W92saBqSqDkPRz4Ejj4gw95LaK","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"8i9cMiFvDJbNQuRZw4e4t9E4tHZrHsTmg7mtChC4oL9b","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"7W4NgQPJEUPyJz87kXWgEdogHsRMKZBwQ1dP9wibcvfs","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Eh3DTgTSJMgXzrsM6EmthkjJq8AWtxpV9p8nDm7GobHH","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"C25aD4p4UoiAmPJ82tsc3rx2hpNdqfq5q9TiDiYaQ4yM","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2Sg3tGc8JDhVE379LwBpYQBGonYuqcRneRQttVBGNweD","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"DHB58dWfhPR2PiH6CzMJTeetk5jhwA2zgXhYQQSD1mfg","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"7zYvuVG1KtMKi7cubi7BD4paLgf9LmHjUVG1v5ZS1hmH","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"F6crUHkLV4yU4R4RHuzfZxn3xHSsUfKBFicFiHQUnoPz","receiver_id":"e9izgqoggd8y.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DA3CTCyqhoHRTjKSRJEZ4FGBZTSc2zNE2fHmsjXg6obn","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"84bZ4m3PW2SpSrPdjzTMNEKjeV9aszf5NHqac6w5d3uv","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"284ejVED9Wa6zAEPE128q51N1voZCyMxyFRnuSD5ZiHH","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"GbqxkEiLhCeQaZ56SLC2WfXmD9UxnHHvsWEXtxFNTg6C","receiver_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"6rKqZ4doQHkFB7raNMxqTfsYTJeJomAV1G5hzsGSkGDh","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CJDtRazTG4hqqjWER8xwrhtSmSHmPfn7YfQnxf9qB58y","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"5AmRgzA27J1v5Y2HKzgNKjuadUfMP6ovQLQ4QBtM6z4H","receiver_id":"exchange.ref-dev.testnet"},{"type":"receipt","receipt_id":"HHJLJrFtVgcfdevr3oJA4X4idXLPzNRsZsmkgR1Xh733","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"GwV5EZguzXuYQPoJkrTroZkCudcNtb2YtLy19mfq3qfN","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"AtPmWjG8KwMyAsGuoBP3zdbASX5bzHQXkUqRSpbQifer","receiver_id":"boostfarm-dev.ref-dev.testnet"},{"type":"receipt","receipt_id":"Fr1KjSrQYaefosE7osZcTH87xX4gZgqT6oxVyUR2ffNA","receiver_id":"exchange.ref-dev.testnet"},{"type":"receipt","receipt_id":"ARsJFDf15wkx6SsWvzaZjtKH9dccCjwHM5yrqHdtvSwt","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"AAkGzQSVcEfD3CoRqgic4qrgnDSfsHEWbbsyww1hB7ks","receiver_id":"exchange.ref-dev.testnet"},{"type":"receipt","receipt_id":"EzZgijeSWqypWvfJRWUA5w1VmxKzdFTEKLfNKn3YpB3z","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"BnD6LtEAnyH7GPdff5gXY6BexjUJjTR6uzJmZVxLXUB2","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GDBAh3Ys9DCqj4GwbcfiTMdARhtfaidiHjatVi1zLb74","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CBbTrNUGSKKMpUFGKif9ERSxnow8B3y1JbLLcEWXpGSF","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"BD2m54q7ibL56mM6vC1ACKjURSMCdztyCwQDe5QpTwam","sender_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"37Rs9fWCue4W5SREVNYuFRS4N66ydCVDYqEWE467EEs8","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"HxCALtUuE4ZRG65ZkSGYBfbr8cC3XNCfRoZesfoici1v","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"vCX8rcFoEFz4GzX5N87euvtbM3AT3WVBNnDpBihE6LE","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GHjeFZcEFNLQa9XvsumUYW2cf5DCKRYjvG7AB3xNk1Kc","receiver_id":"345pclllrzhu.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"6QkcqHFLiiC3MnwKB5xQ3ZwzwqrReMUkRQ2vuCbLs51z","receiver_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"CKjaER62rLqY1ia89ZU2B4n21Rn6rR6DU5xov1aDu9Et","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GeHp1jtFKWsFoniuZYbB7gjkk5BfLmUnPeiPr6CVsGSV","receiver_id":"boostfarm-dev.ref-dev.testnet"},{"type":"receipt","receipt_id":"p92TBBxTR674PUhviHe3g4fzS8mcD9Sed27uz5FDVEd","receiver_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"7ds2qKnrHTW8Aju6awf4uLw7RQqYAhjFRrHQSxM9JLV9","receiver_id":"testnet"},{"type":"receipt","receipt_id":"27SNX5DcPjNFJJ45vBx4cj3x9HPddTT2SvU4rwzkWnjn","receiver_id":"testnet"},{"type":"receipt","receipt_id":"8H1xs4pKvfNC2cZNUcNv3pbDeRoDNCK1bueYrRst5saM","receiver_id":"price-oracle-v1.nearlend-official.testnet"},{"type":"receipt","receipt_id":"GbFwqrLJSTUoBkxFquq5JX7CTPgat4ogAqDUWeE3HKSe","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"Hyfrv7GEgZEHJDFYRJPsBXJSWXUToJWAsBLAH3ncnbya","sender_id":"nico111.testnet"},{"type":"receipt","receipt_id":"Bp58HbGSmhpYyqTBZha3x8h4R8kEtNyB3Bibifrv7uk3","receiver_id":"dev-1705307819711-48099469624020"},{"type":"receipt","receipt_id":"gdkmHGJDtqogNx2VDhofzbaYTXt7CKKp8isBYjbSQqx","receiver_id":"dev-1705307819745-10803656075488"},{"type":"receipt","receipt_id":"6D79XgKcecCKhskcDSHXcrPa1Q213iGGx8M7aPmfp4gw","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"C3wWigoVJYBhAFKcwGa2uWcGDdbbNwwUF7J2d2bEUCZr","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3tcX53vqCyggpvHnZ5z8YxCmyeaGEYJFVX1JmLn9saLF","sender_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"CFsyZxQMwKuPGm4YMifh2g5aPJm57tBxKPUmaKesRsFu","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"SbkE1svxBpELejfE2GTH37YAXL5gu53PW1baHQtc5W4","sender_id":"testnet"},{"type":"transaction","transaction_hash":"3Uch9NHR7mnn22z8m5BDHDsUy4e9Mk4HXhJtbUvQ4zgf","sender_id":"testnet"},{"type":"transaction","transaction_hash":"5sAJ8Qn94Br88iyPzTXfv3MkJmWiDE414xS4QkDYbX3S","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"J5nXqeDUSnQV5fEgGZ4iKhhk7MohY38KU1ncmfiAFefR","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"FFrQeU4M5BU4QHskn7Te8BGm6b23CQAzr3FQ7TYEMBQY","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"HBXDGpCNEktzjcmPCfQg34xtvc6yViKVcnGhBG8fLHop","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"HLGkf2h4BC6Srg1URuuJPMEHtUTkV5FSjQDZV7V7xN2n","receiver_id":"testnet"},{"type":"receipt","receipt_id":"598R2twzFfaEUPY8uv98cKfwiHasVCCMc6CP3woNC9Ez","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"EVNPe8qmmomLWtyCDS2452iRRQo91ak1SxSXQLQj6XkX","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"A9CaAnLQfidVrd5nksxY5uNPbt7BuhwWZJY7fGwh64s9","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"6nCpQVeeRkkPnScnkwo2vXXejMkQQSCvLnZ7bZLXn8NA","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"DdDtXNbGQbRezY8djR8gxwWsXa9hgdmv1944iJBmAubQ","receiver_id":"dev-1705307819106-47174631681836"},{"type":"receipt","receipt_id":"EuzLNbGzgQ9D8kSNbtVfgov4RMcidv4qn2Wcuq231TY4","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"DqMkLSwtcDoUzAXnWSZzSsFDaLHeCQdNNZvAM5U8hYWe","receiver_id":"dev-1705307819128-59250772899611"},{"type":"receipt","receipt_id":"AVQ2ppbLa2aL4R1MKRjdLccNLJFkenvXUPSqUYJDcru8","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"CNxbsXJDmAihj57K7TQRjYvTnWASSTtiH58SjpLCM9eg","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"9Tw4px4WjJiUmzaaigCCazsdpWsJwgjD6xZc5vLaAWkU","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"986FvtMCBFKHAVB2eTyEty5PVXn41UU4oY2gHzsvx2Ey","sender_id":"testnet"},{"type":"transaction","transaction_hash":"oCA7UT3eRKLPmo5TKf2EuMnzvzGULS6npo9vqsHBuMJ","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"SnZ8phAZJefoaHW1XzsegCWXDZt6HX8rGArmJkRW4Kd","sender_id":"testnet"},{"type":"receipt","receipt_id":"EepTkM2QN26W5KoU4bN7d7wqDouMVVm3cwpiwpt4sbd9","receiver_id":"49qzzuam1rde.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"92vXrLaBHaYsL8HBqCnRo2UGWJv6R7PX8wFsn5sVWWDp","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"5BFW9fo92pkgWVqTtJ1nmgthFcwoJQX3TTy4JvTzfAhu","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2pkFMJHXc9koakvkxVXf8hodMDNvgxMkSzHEUZeCxGxm","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"EztUUum7dkfTbBE6XM5CQedgWKqW176YjAK9UwLgic6n","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"564Ahf25aayQBAGVjp19tuVKhGbCNt28aCDwdE8dZMd2","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"6kXiES6ahyF25FVx3VuzkCfk9SWw3aRbCT8B7NpZ4bkc","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8ihpbidzX7EhvUQwU3RG9CQqh6Ljx7iApfVpd2Sbcmr1","receiver_id":"oracle-2.testnet"},{"type":"transaction","transaction_hash":"3AGm6kjAgQLPYnkY2eX5DKeSmqLK8DY1qakikpBonKBD","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"7B8nTRTQaMF9wHSqETnqjcJwVeNLMJMmFPLGbUvAsroW","receiver_id":"priceoracle.testnet"},{"type":"receipt","receipt_id":"4Y3S8EFJT7rTE75jF6ZmgMTgHbBuTsKdWjTUmc3U9mKy","receiver_id":"arkana-buidl-asia.testnet"},{"type":"transaction","transaction_hash":"96q6uSCNgEWJD4xkeXeABDYESMH6YBkeMqccKb2rC35X","sender_id":"oracle-2.testnet"},{"type":"receipt","receipt_id":"E7H9UYJ2H9DMFrfVKU5d5zZXvCSjk3EYdkKjWZR4kLBc","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CaYPiDMcE1M3sxfnAmVoHgSUburAwhZkUj8e1ABJedNN","receiver_id":"arkana-buidl-asia.testnet"},{"type":"receipt","receipt_id":"HopCmFzcpkx4YU6T4DTEQXKebR5PdfrJ4ykrJPrvqtx5","receiver_id":"wrap.testnet"},{"type":"receipt","receipt_id":"EdYWaJrCc9oKUCPwxdQkv5Y9vwepc2tHrfyjkUEdLmzX","receiver_id":"fzg8m1vhpju6.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8wX57YEkzVB45sr5o24ZEZCA6BnKksoseosZsA48wksr","receiver_id":"dev-1702349001521-56718665013362"},{"type":"receipt","receipt_id":"5bheCkXHfZ5aBxYaH7DoNwJ1yiF5atakWpkdAm248A4G","receiver_id":"wrap.testnet"},{"type":"receipt","receipt_id":"8QMWsRqoHA2Q3Zs8pQTrom9P8iqMTuUhHYcYpxYHtGBn","receiver_id":"arkana-buidl-asia.testnet"},{"type":"receipt","receipt_id":"6ZJyTfd9DMpT31tNYmorkA9w1JidTArP2VhthqwqPJJ7","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"3KViRVMdUyakQJjWfDiRRBiTReCjwyjvqY4R2BnEBvhK","receiver_id":"wrap.testnet"},{"type":"receipt","receipt_id":"7iEYSk1RiCPwLajKY2DF9DsN9DV1KNGKb6J5PbeWjVBr","receiver_id":"arkana-buidl-asia.testnet"},{"type":"receipt","receipt_id":"ESaVAW8EPMaCxEat2XcY7Gz9tg6szaaq3d8fc7Js4aAy","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"HgBjVrZjrQWKvrZFdYaAY2TibTnFwXyhjHSGvCY4kKMw","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DYp3ViETt8c2hxDdbYNwv75bQou9yHfFj1bQGwFaGtoS","receiver_id":"full-pagebacker2076287.arkana-buidl-asia.testnet"},{"type":"transaction","transaction_hash":"6CoYgGovA9w78EzpkqK4KjFeHz1X8BfGsxDdyADwWTbj","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"3nvsbHVVW5hyyCWdkQqZQbMjWjTGB39yrMCtYoE3bDUR","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"DroDMfXYZBiKECFBWrLvTRCNDYuNsiDFrVTkeb7otRF9","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"Ff4nrX1Evb79rH8TbSH7VXo6fqj9YgB4GiUqrejn8LoH","receiver_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"5C2S32Uy4qWZrCXDxRNWpt7ndS5JkGMjXv9C485c3wFQ","sender_id":"arkana-buidl-asia.testnet"},{"type":"receipt","receipt_id":"4J7zpDxEtDRPdLeM3sge2Q8x6Dpv2B9cibf2somzgVxd","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"CcgGoWVS4zE9yqPZR17PyyZPkaHznjhE63X9XdPVs3tY","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"FpGnkhoeiUAwZYiS34qw1EjVCtBHUbt9XgFWv6xiGbm4","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"H1Khr5zmULB1BfUEzcEPtmkGZXHuSCXG3zs2TpibRjZ1","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"BmgjGZM5DT4kN1tthvu4oFdoULUpPkWsdfrthj7zDwYn","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"G7fqA2LYSgZsz9Vz9RvUjoH2n6c7isRiHDcmb1sMJnuN","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"5ZNLB1LXoEJ6n92mGFQg5WjkAtBMMnPsoTLJWbAv6s3z","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Ddewf2yopnchebA5JsSKQArKqZH482k23rrZiG8DcPoB","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Ah74AMdsJRe2b9mmswWSXCdqkApywWXNdD3n4MJMixbN","receiver_id":"bhc8521.testnet"},{"type":"receipt","receipt_id":"BhPLjed2d4pUuVx2Xaeks4WdXbUimeV74CDwW6ZCfdAg","receiver_id":"staking.bhc8521.testnet"},{"type":"transaction","transaction_hash":"31iNM4tXMuUBLqtAN52xTsB2XX4ApGmGVceJAu63J4ns","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8LpPuro1PYRh8T5MUaWivCuMSHrwqZQmQLTvE835Vg3T","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"BZ4rtTLazCRRpwEfg21GwQduCCjvz8hJ63SHpUkHoCGX","sender_id":"bhc8521.testnet"},{"type":"receipt","receipt_id":"AKZtWyTSVwUg8an4bjD5FWkEMCCmdGHGssDsmrHnzLJt","receiver_id":"testnet"},{"type":"receipt","receipt_id":"9UGAYfQw9DPHJDJyhcxMrfjwsFykDfxaNSkmaMBjizXA","receiver_id":"dev-1705307805064-79489375308037"},{"type":"receipt","receipt_id":"9Ce2bDCB6amKY85VTcmvYJtAzxDZWC5tTWXZTfRFk356","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"DHoKDshQ6suGxNomNVqoFX9PjeQxUJ8gEs4WdXTu6BX1","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"BLLkf94F4WVJg266Daa6PhjwrowER2W5P6u5fh3jFjc1","receiver_id":"dev-1705307805076-31477167337320"},{"type":"transaction","transaction_hash":"Hq9NuBQAVN6xYFtaTTCPiudKhUxuT9AuPPcCSKZxqf4v","sender_id":"testnet"},{"type":"receipt","receipt_id":"BYsMdrSRva7kBKjvfydt3sTwkNpGThg9NWwVPqmr4iTr","receiver_id":"fr312vodm1sg.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"ECDge6FPWD2Qerr8gCbpg5MN17tsYQ9Y3Bt5y3NuDg3s","receiver_id":"aurora"},{"type":"transaction","transaction_hash":"HTU2ozC56PTXuUfEpqnKc31TdfszC9LxNartTFtRYG95","sender_id":"testnet"},{"type":"transaction","transaction_hash":"E932KryZP8eVgQfrQgBjMVeg1GhWCeEAgpnFkRrksHpH","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"8TdTuvki4Ry3GDr2RJ3XHbvrUQp3YppmMzUsaJrsHfLo","sender_id":"relay.aurora"},{"type":"receipt","receipt_id":"BqdXUrprC1amV6xxk4DDYoDyTSg2UyxCJssxfa7GmDv9","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"44TrM1g8tqryk7Gbs8yz7PBir9DRENpsQPMNGLVfzCMj","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8mzq49akkpBZ5traqvZiGF7XFBvdwZ2nkNarHJnSTcgE","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"DhWvMNKqiS7wkJBFWGVjmExt6KytRh4PnR8msV6oREhL","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"4vHHJsxxyEz7yWDFAnhqEy41r1VaQPkQiCDTrjjJE3Jp","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"8nc3XMMBdgrGMXJizQTiGWTHM8MosFeafCnCFUEBdXT2","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"H2gEMQnXqEroe24vc1eA2oayZdpN1k7txNRQyLDgyuTi","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"6vnhzsfiwirgwwure8wbQuD3hg6RRb9Vi8EmS27D5rVV","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"4MwtErZ3kjrMHujSzdcWWbjmiLRWzJLPESB54vh4Z7cM","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Bsnf8XhZWBujYXGbwycQydc8QVECSnvafeN74Vapq9h1","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"44RvZxZWpWBuV5GKXbbTSJB2tgSbC7RrSDThPBYGhxt4","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"CnqqHKDNV61tR2h4djp2RBvAG4oYBEZy1Y2UA6yZdfb2","receiver_id":"hyjndcqmxppl.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"62CMjXc1mhEj51ierVCtDjhVdq5wtkQGGNMh1crvSV3","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"2r2gTYDnSY7P7yVPRAx9sMvGWr1NStQHSEzHeMcvvmDo","receiver_id":"asset-manager.orderly.testnet"},{"type":"transaction","transaction_hash":"As8vMm97JkrDRMKk4NX6PdEcFCaR2DZwf5SATw5FadnA","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"38mA1vScktN33RwGrWkANQ7ZgpSCUrRynuEjBzuVcWGw","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"APpphs1A9XHaQ33QAJdvLiAcGjsPvwWj6GbxUCnHRvQd","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"9XbCKkxSXFXVPn2ipc9A92g2DQTsVisS21JZn2WgefJw","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"3L9YAtehP3tHZKhDw7VXjrQ6KppDLNfd8u5WGnFqpwji","receiver_id":"testnet"},{"type":"receipt","receipt_id":"FryEVdwXXTT5rgVu88CgeANf7nPe5vkpZ795ZKh85x37","receiver_id":"testnet"},{"type":"receipt","receipt_id":"2rMpezkwJonFr8XC5aWRpGmaCkY65z1EXGLHLhvs4XzH","receiver_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"HbsaFopRaA5ubsXgJsxo4saA2rFRnhE9uybyyQFvCKkX","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"5VMnAyzmGPYq2ukCP9tpFfe39qK625DameZwqSpk1fDu","receiver_id":"dev-1705307798949-31444104784078"},{"type":"receipt","receipt_id":"36XGDpDzFJKLNRtozmViF4zg85ULjfJcdgYEHUbTMVpJ","receiver_id":"dev-1705307798965-79857125077397"},{"type":"receipt","receipt_id":"CG9aeyULTp1gHYz9q2DRRZxHhejr51cEP55EDqH2M9FS","receiver_id":"priceoracle.testnet"},{"type":"receipt","receipt_id":"FbTwYwoqeihci8FeLNaHwuwFqpuDESz6xfVvarTPgAgu","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"27tFPK2fmxeTeKhu15bM4yJXXNqFZ8msSkT7UQ1pPS5T","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"9NePxdVcTM65MpREEDtBA6gf5TeX4nCrEs3irAQYGifF","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"81LUyKYqEoxi8WnZrE3wwJjeRrfXpsY21mTL583QmoMF","receiver_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"Cv2tnHsn2SyDAZniDYD4N2DHb9NmTvNNwCRAppob558x","sender_id":"testnet"},{"type":"transaction","transaction_hash":"Bo7AyzVpsVtwtdCgwFPpFSYu8uQV15GV1WpuSkUtYCKd","sender_id":"testnet"},{"type":"transaction","transaction_hash":"J4VMwmPXZusEVzHYk5zveTSwnWAj2LiqqPvavfgz3Lrr","sender_id":"zavodil.testnet"},{"type":"transaction","transaction_hash":"HjKbptwP7jB8WEnt734yKiLnpKD1HzcarHgwVQngRpHU","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"ABB5rMfvZEqytWRUtZ3wpp4ikTW8UPHt1sgujcVA6sNn","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"5t2w2eiKweYLomcvHaohoKVjbRojGzBmwHVfQrZpALDk","receiver_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"91NgYQuDLKRkfysKziQuXxu5Br5LDiPaqVd55ne7ZHa3","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2mK8penEpmZKyij3EY5yQ17tLQbSmSbKKWz5uPeVf6Kb","receiver_id":"exchange.ref-dev.testnet"},{"type":"transaction","transaction_hash":"6aEt9mWx3BmbwRyNGrFT9vLrWEURuRiUq6rGnJteL8We","sender_id":"nico111.testnet"},{"type":"receipt","receipt_id":"EjbxKY5nVaJMp6iR6SNhX2WL1DYGLtHxTGN98tjbASaJ","receiver_id":"applebear.testnet"},{"type":"receipt","receipt_id":"HhhmnbAamoiycfXwemk25cynHNbP2Lsbsutr1arNyBrc","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"J2uSaeh65izgiwMtB9EW8j94bHgWaCcSmPkS81vyPNsy","receiver_id":"rkytkftle0ys.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"6C23bBzSnRSJkVm369H4azZ64DXFwGVQjBdnTsApFcHS","sender_id":"temp-1705307791079.testnet"},{"type":"transaction","transaction_hash":"H97cg3M3JKaScfs74CDcVrU5po2M6jgSRcRzM7sqsphp","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"J2n1Xn7HsL7sxLEJtQjuLduHSmMv6yQi65UobBu9pYSp","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"Ca5zaaV7uNAKK93ydixMEu22UjGNB6Ajph5yc6sTvkK5","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"3S4NnViwPkAg1SjRGbggsqk5vQrSRVUwSH4kRkquZmCw","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"6JZgWaQvZN1FgbgahtCeWtbHu9wv2yUuzfoEym1rXjqr","receiver_id":"testnet"},{"type":"receipt","receipt_id":"2shX5MX3iEVZQ7wkaprw7rd3aAq94Fpf3MhyuZkWLe3f","receiver_id":"nico111.testnet"},{"type":"receipt","receipt_id":"47ZjC98yjzakyGcRJi3qTcwGLiStVGzYAmBx9gm6d2a1","receiver_id":"usdc.fakes.testnet"},{"type":"receipt","receipt_id":"9axUnmMM4nsdPsGt7SSP3ZqLhpR8ssxHzKCuJXTu4kLv","receiver_id":"temp-1705307791079.testnet"},{"type":"receipt","receipt_id":"7mEqPE1MeGy46tYkYNQemMYiFNhGqJrMbvRVewi1NFc6","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"8Bd5EkrT2o5dfD6oDvcytrD4SkeiVFG8R2vZAAr9Bcny","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2KJmK42QikiY41zVPHfhTnwm2Lxo3XUBcwAuraHxZLya","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"Hug3DKE9jwhqNd1Duys6iQSDvrfcoVBRKiDiLvayLQRp","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"6a3DLhDC2crMngFdkET1C3Ufxg2g8rShU9qEVEoCm91i","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"8x6R36XJBpNc9YN8vdGF4WPjXJv8p6gNXeBEwRyquwNq","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"3R6XUecZqj7iwdKQnVeTfcmyZW3UoNL8ULuGmENm2rDN","receiver_id":"exchange.ref-dev.testnet"},{"type":"receipt","receipt_id":"7UifWEijLb7kcpve2MMxhbZdDcJyocSqxeB7J6H9AxjV","receiver_id":"usdc.fakes.testnet"},{"type":"receipt","receipt_id":"EgMK7mCt2QCsx7qpe42tztSn1re3dwnJAA9Y5dD5fg9h","receiver_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"3KtkAJr1kxgJGY2BoDhzjC8Kzf5uW44RMkhhcgho54BM","sender_id":"testnet"},{"type":"receipt","receipt_id":"5Xk7fBpz6ADAp9U3aeQZZ4N881iAxfwLfJ8NDxzw5TFu","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"6XbaTtrawA7Co3EGnQ4Z8JdWW3QS1SRMSeHA8BWkmbwr","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"B5AJrY9esXaXg7DN9LxBciisifXLsaiSmbtbCA4QyQMo","receiver_id":"usdc.fakes.testnet"},{"type":"receipt","receipt_id":"77risbi2vZCpGvekhmvau767wFHCHBv1zdYmvbvgYU1a","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"8pcFgzSeH4ukNfY4WuS3YpuqbowdikcnFqG9ZPTpHHLZ","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"HfHpwDwh1vsm9jWwWDpecz4Y1ACRJdi2bBeHEpJZgE5D","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"6QFZdL2DhaeujKdvVdsmxLge9UBJekU9ZAB8rtPmiL6w","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"BzqFV34ybLugKYpMrQvKH61qFxgaWAih28CvEwsf9U62","sender_id":"nico111.testnet"},{"type":"transaction","transaction_hash":"DnSs3zfKU5otLyUuEZAUDLtq8RqHno4MZktZbFXZ4N5j","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"CrDxXz1oG8HkS8gYPj9T16HFwNSSsX3eFeY1MNp3gQEP","receiver_id":"applebear.testnet"},{"type":"receipt","receipt_id":"FMNYwCMPiYmhwVqKtj8Xov9dDGvNMGe3tA4dN5KgNtK5","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"bMtjZage7MXyZCpYjRNcgH8ywMGAsTDCuuLubLUtHtv","sender_id":"temp-1705307785575.testnet"},{"type":"receipt","receipt_id":"AaCgjGwraHxc7PTbXZTi5oNrnzEiFjkTeZY6ZXY5dxJW","receiver_id":"61ms34eq1y42.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DyD4D5p34KV8XLZnfrcKZhfGVAXTMTBaM2bpBUj4eGK6","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"6VvbXspgFK8aUhzpcotmhhnv3L9ke5W5uREXbx4YjtPn","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2VvBLPzDseWnSyj98E7CCr7ZE9BZnSLEek4wj6sTH3qx","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9BjR4jSHw68UT2gDkyyeaUYsijvwRMp5GuZx4132acxb","receiver_id":"testnet"},{"type":"receipt","receipt_id":"HMdanLQPNhXQ8fwRKEEecPd11FrwzccBqYuREwXFbPUk","receiver_id":"serburberibar.testnet"},{"type":"receipt","receipt_id":"E7tog5sHCv7uZU24YaJSxuALmMwfhh5sXWZkbT38ajsz","receiver_id":"temp-1705307785575.testnet"},{"type":"transaction","transaction_hash":"8GqxHMnTT8GWZ7qE8jWnU7NgAQTphvXsgxCGjwfXk4sn","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"HQUgjVjwiT2iiUYb9gs7KLX3GkxMkUgrVbkQHtmNXoBw","receiver_id":"dev-1700181646813-30367561749085"},{"type":"transaction","transaction_hash":"Bj9v56mNwpSA8es6EDvnZHXfiEtsQAwGoJ3azV3N6qvV","sender_id":"testnet"},{"type":"receipt","receipt_id":"FeX7gmMTmdf3YcsjnYNZ8Eoa4Gbot4kME6mzNq2x9FNe","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"66qqnDyFf167i2w3SA7QnhmX5qTmuMxGwcGdWHJBcaec","sender_id":"serburberibar.testnet"},{"type":"receipt","receipt_id":"2fefgiS7JmLqKjtbHctxG1CAVSmhMfwoCwEDgo5SsDDq","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Gku7G9pfr32zNRg6e3u2WCAjKsWVT8geFQvKHqPafe34","receiver_id":"applebear.testnet"},{"type":"transaction","transaction_hash":"HnUrGDgpDNAxNxcU2gtHKgfereh5o2FSn6wLEHrKL9mm","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"AyMKZyHaGf9bJxn7MmygXkuxKBSHZunR2MqxbjuRUXm","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"D7w1R1NKgPFhRxWz1fGWNKDPLq6EF4oFrzCkKH68Z8ET","sender_id":"temp-1705307779565.testnet"},{"type":"receipt","receipt_id":"CAPZ5XG9yKZ6AG8Xikrzj9Mbp5uHZqahgHAe5QuV4rKg","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2ix2geQJajQps2f4jXEpJEqQhb3fbvRDLr7K4ti4biK5","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"3koYJD3zCj7dpfo6ey8oDc2wS4Vky7CDsCwjepAAgKzY","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"DBNrcrxM7s569b5SNAfXSAJ3gCy1e7f7qcj6wTTLzHgh","receiver_id":"l0buc6lh26h2.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8ftt4CXpmbW3bAMqn6iLEQGwtzDqDW1cGU5NUpLTtk4J","receiver_id":"testnet"},{"type":"receipt","receipt_id":"2tqVdmq1hjPKi4ajkkayCVKevX3oE9cywX18ikLTUdUE","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"2tdVkSkKWM5JxWKPzgYrvLApWNw36hHjJNg4A4m2DaKB","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"71DwMyAnsiT1mVgsZH9MptrxqzfT8koiZCNyBtsGJVWr","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Eh7cMZ7xaso7p5qsFDDCmQGznSGUVPnefLRky21ioNR2","receiver_id":"temp-1705307779565.testnet"},{"type":"transaction","transaction_hash":"9XGvNFPCSyGhCmHn3gU38fy5M5K6SkWe8wFnPSSgJm6","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"7kpFaqoo677FTc2vLCEYMsLqowWWJZA723ojW7wKvYV1","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"2gJ2myK3khzu6MNASoksg5VeuSTNHDexQVQaZwk94886","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"Gg5aKWQYuRWbmND1cfRDvYYBhCABhNzjBXJCuNS5AyPo","receiver_id":"asset-manager.orderly.testnet"},{"type":"transaction","transaction_hash":"9TBgWyzjT18Xkr255GXvvSP5sNDvn8rnsjWrwBZiK3Mv","sender_id":"testnet"},{"type":"transaction","transaction_hash":"GyEdA3Bf9Q4zfuUUDPPhA5WuKxiHKNc7H8VrBQVDmJiH","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"ECh3QyN5s9aJFhaM7CkVAP5PfneQ5KYPkvR1LzL7hotH","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"2XzgM7NpgZLYZXXrqm83uDEQYcBwzJvt1naFpTces6iq","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"Fwg3S36jQgABh11j3NAdHkkfR4rjMLEPwm7GzR1eXe6e","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"EAC1hmzTmy72uZ5NjazWPMLL1VdutXvUQYyf242LkT7W","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Bk4F1vMqayj9Q2wMVAtNFwL4dFCZnngGkyfaHwHw5epK","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"4xijxh7YqCLLDkX357K3PxSFBJyiHEtmxVt6UezEbwWE","receiver_id":"applebear.testnet"},{"type":"receipt","receipt_id":"8ybdiKMhC2HpKVYWUJNSkSng3h6y1Dec6GRcmmmNa9NL","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"39FpHuTjNnQN6NNd93Ez1irwqHC4vFe29GYX9z2M7sd6","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"JBXzeBCYNnqUgyZhcFYG8DhMro7C9hUL99adMRNZpbdt","receiver_id":"aurora"},{"type":"receipt","receipt_id":"AnMRY2nLS851YvPsnJTKGPZBixiGpJwyqHzvF1aP9e9Q","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"9WBwzvC3JgEh4mmYh8BZDoowkzgwL7owiA6jhicLD21t","sender_id":"temp-1705307774087.testnet"},{"type":"transaction","transaction_hash":"9UUSSjSDarZN84b3i5831ETCCSrVxUA3Ub1EJNMsUP1U","sender_id":"relay.aurora"},{"type":"transaction","transaction_hash":"BRs62S8puKmHfCLiDeLcwBW4jKumAcYUDwprNiST2S8t","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"B8DQJfk7rfSQwLzWVFobmJPDRaHbWVd15CtVL7vWqmvk","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2cDqqMSSAJ7khpGmHJcSikim9XsoGbcBUr5Rw2xLWpfZ","receiver_id":"lqykp8mqr904.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"9TwhFdUfBBtDShmCoeZeW6XMXrmWJMmhqWFgJ7yFivEy","receiver_id":"testnet"},{"type":"receipt","receipt_id":"4De7XSQ4tyJgJ7rMoi4d2FAWQSX2ArQWUqwqJZ8kmQzF","receiver_id":"temp-1705307774087.testnet"},{"type":"transaction","transaction_hash":"DvwWAH7bwhWoHiV5XrV1N9rbtGyCbwyJeNCFNF6Yfhkz","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"HKV5zAoj4ZJXATFXBrAaSiKY8q8AEvuCHh2oMxxKjbyV","sender_id":"testnet"},{"type":"receipt","receipt_id":"823eM34ytTQyR3V1wr8D3fMrmJw8tQ7itnwTtA5egMMu","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"7iqyZTricahutiafpUsVwdNpNGhsq7evVjqDcd3AKG8z","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"AkUdoXJ13wQbLj9NRdNwWhG9LvMxiWJMgpaHfCcB5SvH","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CM2LqLip8neNbXFtRgjoqvSjETWN3rmn6WFmyjBLcCbQ","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"9TfeQa4g8BPnQiyRgmNbDK6hwXzzpa3Hd2J8sSKRk4JR","receiver_id":"applebear.testnet"},{"type":"transaction","transaction_hash":"68MfAYbrnxMQ51iqHG8p4DLjHVzoFzGsmnZhmGcFuHrN","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"9qpoJPRcBE5Tbnhc7hptS9UDmxwMuxTejvKPPzur5Dud","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"J3XCo7Bxk1NSTg2tjexHZPejbvphYfgzhyAN7mUxZaLW","sender_id":"temp-1705307768570.testnet"},{"type":"receipt","receipt_id":"HQamKUb3Bu9sd4WuRrofE67SAxPniM3waYxMXt2poH5i","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"2fKG7CrYvqHj47SbMCkDVQn1R23Esd3jwiv7ZKAwS31o","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"CDWhWYyAwKCPp7Ese7tqaMw4dUShZSEH6CRBS36ERADr","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"AUBNyyKgpgrBLRJPgMNnQJZPzWauAehijw2JJfUqc86G","receiver_id":"bhc8521.testnet"},{"type":"receipt","receipt_id":"22vQ11NbSXe9LELKSy9jbDWhfD4NyKXvxLBtCFX52tHf","receiver_id":"staking.bhc8521.testnet"},{"type":"receipt","receipt_id":"4g4GFAtdxuQjUT5n8okdRo74wJvQtDyw8nad2cwmwujr","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"2WMKwdnmZEgsHD3sezg5gLazmqpofqUAq5kJ8SqT3Z3a","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"BcEw3zvEGHDVEfG1ewRPe55gMXPXbxQv9SRXpuDwQZTz","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"FGn4ocYtv66X1BPUmdhMyd84FHfCwmZbnuKTUgozs7mN","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"7x27JzEbU22oyMwo3HuWbb9eKwzjSS5VUkZULx5Mu9hq","receiver_id":"ttja473ppgmo.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"Dkp9G8VHMevv7P6M6UrT7AbW9rkcJmiFYXfbfYL7CaeA","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"2YaZCwEuwLZjmM5DHvH6Ej3eh2pWA4vbPfs6CsP6Jruw","sender_id":"bhc8521.testnet"},{"type":"transaction","transaction_hash":"CJnsFX84688D8vuqyFxeoqKUn5899gLq5tQA9LhtnmJA","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"8va8nCmKbAW9zaTmoBJMQzQyaGDsBpiJyYfmZi9xyTvo","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"5sN6Bx6PZP5JKQGY8cKdnx9PxuahvxWTZ33FVpmctYrV","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"79d91Fg2wJrYoadNX78y13TmfLpC4ysFgwjQCGBSAMxd","receiver_id":"temp-1705307768570.testnet"},{"type":"transaction","transaction_hash":"LUWhDHLgTPypdsWQx6ZZWqwqjytgjRv7nMsPdv45uyX","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7HXaDhcqy6HykFipoJmKajtfFonoBgRCrcDRBgjKPFq2","sender_id":"testnet"},{"type":"receipt","receipt_id":"3umPbf3mwhgyUHNCnACamcKKVUc64nenWGSVDjbbX4yk","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9sueXbodHKd188y9jwj3TB8pwS8noiJ5rkqrjneDE49c","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"6YhuaCoA6AQre6UqPNZEw4NuCp77VZVZrb5ExWcLwtau","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8RuwEQK9yop4dYoT3kxrjLRCXaLVL2kx81N7C2bEXYTc","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4GEfvjwsVa3MTogFAc8DXDcct9uscuD5SFMb4aiK4yqY","receiver_id":"applebear.testnet"},{"type":"transaction","transaction_hash":"zzhHC6gTHBFrRfMdPn5CBLtZDeQx5np6qvEn3GpgAfP","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"Bk7rRrnMqaCqvNREfcbdMXb9Dx8FAvumpMXq1Yp2HXwB","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"GSXj5MeUTtc2hNq36UUR7tJWaA83rGiTF22ZJRXvM5dF","sender_id":"temp-1705307763050.testnet"},{"type":"receipt","receipt_id":"7FvemErDZ4rcSR6UyDirs9qsCGFEDnXFEr5fr6Bcadnw","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"jjM7ECquudVPjmuM7adgC8qViJRvqaZ4GF7Vs1Vop4a","receiver_id":"testnet"},{"type":"receipt","receipt_id":"FwyU8uTxFnj68kW8qB8b9juV157Gj5pMQ3qKAXsYz9aQ","receiver_id":"temp-1705307763050.testnet"},{"type":"receipt","receipt_id":"Ahq7kCVUDxz1ZtfBJtEUhdjLy6i2WZ4969BuH3DyjRRa","receiver_id":"4y4e1nt68oji.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"5CL21jNbXXN9DpVzvfnTWkFVZUmoVRwHj9iPUmeL4waa","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"8fDS1fVpS9yT4YgfErqEGyM7CB6gDiaWcTYdC4CwasFe","sender_id":"testnet"},{"type":"transaction","transaction_hash":"GBsZ45z6LTbPQNt4dMaJtk3wM79f3DmY8hgB1L5ycVKh","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"TMbmjNecmrY6H3pFygxXyrAR9NCKQdwzQaKYnixuDqi","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"CJSTAfwG64nmdcfp9oa9o3N8QRKiByVzk1UQRKoTa5qE","receiver_id":"oracle-2.testnet"},{"type":"transaction","transaction_hash":"AumrEfXgM3gJSypJRq4HeCcXk5TKkJhY1rY7JNCTqSLV","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"91L5TBq6ZMFauFpsL9AqLev3wBe3o3nLoJryrn4PECVY","receiver_id":"priceoracle.testnet"},{"type":"receipt","receipt_id":"Gk6ZGirVY8rEDLNm1TsVh5Qj8Bs6HdEojqPfG3Ux9971","receiver_id":"applebear.testnet"},{"type":"receipt","receipt_id":"GMufFqSmDXhTCpYTh9m1bp2podT7tcwBsJQhHwM2z17X","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DCJMbCJCMByQChr2n4WzyX3h71YGTtdJc4rQmiSA7eS6","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"3DFZwywW1pszEn5YkTW5ivYmk97mACHUR12FDPj8GCZB","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"4RzzPdcfE5o9frXrFCNu9TknRLXmyLAWCFLCXfJcSqYG","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"7wqBw4KjhMF6XHQus149dAJ6UrtGbjpBSKvNYwR9FPdK","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"J14gsFJM2BU6bmK2kd6CjkJT3FgjuP4WTn1ngHBAze6h","sender_id":"oracle-2.testnet"},{"type":"transaction","transaction_hash":"DPxyJvcfZDJRqtDGENaPUEtYP2iFY4tkfXBxkTDkpHEr","sender_id":"temp-1705307757533.testnet"},{"type":"receipt","receipt_id":"7xyytos6GckQz4nM9JGAA83uTT57AZJPPr3ro18BdNJb","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"3XbPeoyTcz8ZghD6L7dRcZV5S6PeDymegD8YNMj7qfzr","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"4FZ8j8H6pQcM25jHtQgpKPRfqFTwawyfRbAjPoMBuvxo","receiver_id":"asset-manager.orderly.testnet"},{"type":"transaction","transaction_hash":"BFbJnwnCtQJbA6SRqB92F6maEaLcfKWcN86HYJtq5dBV","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"7ijuPCvAjBx7zSpRkReEpWoaauR76EfaBsWgKWnw3qJt","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"9McQDTLvhCP35pNgA5awRwAnbK6dFah4ubSZogMtSADz","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"BgNYq8UcLS7VpCMd2L8PyPCVxvBXdxh6JoP48UxF6tzG","sender_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"FAykAPcQGQMQdEYvUEUQvY7u2B5DxeiFm4xDZ4g2suT","receiver_id":"testnet"},{"type":"receipt","receipt_id":"DUGXpzP71UWaS5VFvPWWBNZFogjBUyMEzRebKUqRzcfP","receiver_id":"temp-1705307757533.testnet"},{"type":"receipt","receipt_id":"BXybt7LNBpc7pzd2RVh5AVjiTfqa4cbMhxJZNiXQMz1b","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4rYskvzQt3MirPphZ2FKSisNqRRUxZYo6FRunYTC6eHh","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"EyQEmNTMj6JhoaRtebH7MH6ZEpkUHnFxYNeqZDDeMPoD","sender_id":"testnet"},{"type":"receipt","receipt_id":"84G35SZcWZcYfWkVskuVwMw97sH6MASMhgJJYyM1zmF5","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"HZPc5jxj6LgHUeahWPnWLcdete3JEDG3WtUNpSSbZie1","receiver_id":"ehzs8rz8ddt8.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"2HXSeyyNBhhKFiGpgkxZpyYY7dkzesLEkturb8Wqgq3j","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"CFi9XtWFgRAxV16ZgX9VZ4NE5pEGTNnefbgNn7qJ2fjY","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"84WyHPKxtQhCrVVZbpNwgNhoV4kn6BmpZWtzXTAerg97","receiver_id":"applebear.testnet"},{"type":"transaction","transaction_hash":"7XDd5j9LvW1Lhxvd9SQjXAo29e2PXyAR53rQQgau773D","sender_id":"staking.bhc8521.testnet"},{"type":"transaction","transaction_hash":"BkBbie5MZLVxuAWm5Vfw6X2kypXjvUQrpNW3PJahpeQj","sender_id":"temp-1705307752525.testnet"},{"type":"receipt","receipt_id":"HqLNFKjFRmV7LccaiheFrckf9aG7ogKT1UGVwinCmGbp","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"B3pj5pT2mDovF7sCodoXzjFejQYdhvrknGGtvrok5yCp","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"GFPFo9vX87TaxDGsV4UrJuuU5F6qHpm2jvfiyYdM8UM1","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"FhmzPxAqr5VHCdvK1K5Kema2uyDhJvMWquvZo6s5NiFy","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4BguhWZF4i3XtJxyKXBQZbBsikdyicRJPtX7taUHsUhK","receiver_id":"temp-1705307752525.testnet"},{"type":"receipt","receipt_id":"5FZ2PT6Qg3GSM6BqhdU8hTeMuQLSmhpLyoqok9xaMDft","receiver_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"4o38cT9n6rGAv8yWXKNCQhxQZX5xdkaDEhCKHi8t1Vzk","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"CACWsqoJvJGkeMKsNqahocrLZ4UnUrJ1FX3sc5jJBGv2","receiver_id":"price-oracle-v1.nearlend-official.testnet"},{"type":"receipt","receipt_id":"EXNSBtTy5YjTVqwB1eFvzaKSWKhoekykrzvRjgK2529K","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"B1omhdomvoiSPrr1kMUUtwJVT5BtchRwMwNhiF6ZBTvB","sender_id":"testnet"},{"type":"receipt","receipt_id":"3ekMws3PbFgdHZyiEn6UBgeWNvvwdFKN6C3ugNUC156y","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"8yyuZDx3tZ23yto4DxjRv5jsh2iYc7qQexRRBi4CgZk1","sender_id":"s-lam1.testnet"},{"type":"transaction","transaction_hash":"Dhd9HvBPRJ8dYoUa1SnojEhRq2AuwY6766vNRVAykSSQ","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"4qRmaR5J686H75dcx2RarEBSZLzU5MFNvUDB5ZyAqEmb","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"EQKzBJSXNuj68F7SNvkcHUjZnkbS4EKJf83RPKQzGtCf","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"62pxMPj2qj3V29EVwuo6HjQf41MxwYmSP4aF1MNTh9tP","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"8zD9JBBWJdk6VuMqL8dsWPhocdv862TQsTw8mRafck7v","receiver_id":"ilvrjq2hv9ns.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"J9d5J3Eb7bY4nZj75vq8WuaGD9C8X9joJSSSi1hpdoug","receiver_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"DvL4SD4mpQUc1Ux9bgZFmpPJhSBBZekCdgV2njnCzH86","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"J2stAKSLdLCiygjLwbGHczXckXdzXs2d7bMJ8btabjAn","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"DnAAVQg1fvqSAub9N7K3SwrAFB6A56iSkwtS9bpejjGB","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"65RxPUKpt9ecsKtcBbrMWyB7cw3Fw7WuGmjYV8c7Njpn","receiver_id":"priceoracle.testnet"},{"type":"receipt","receipt_id":"KxHZ9VD57joHnpcpZMtTwHVdECJPG525Fo6R1nsRjYj","receiver_id":"applebear.testnet"},{"type":"transaction","transaction_hash":"8CrgmdaBKCWfWadEWDJ5xMDBZZyeDraUkmsf39wpcsnu","sender_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"E1GyP8orNiBHTH71Y2HvKT7gbw5NU6PxVnZghMyCCZG1","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"9zNQYPSRYPD6BPcPKwerrsHWHEubEuY8boKKqCyC3tQg","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"HrJ5kKfG1aNb5gJ2pPzXzTVbwWhCYAYodvdyeqgJTs6N","sender_id":"temp-1705307745505.testnet"},{"type":"transaction","transaction_hash":"Go6hT8kDB3qcb2XS6rNtwGHASYp44Jt61vCP7Z2DrFqX","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"AaQTeza1wDJshtzxGCiqGmUFETbDmASB97R4kq5ZCbgS","sender_id":"zavodil.testnet"},{"type":"receipt","receipt_id":"5n1jXPHxLzrRtEcZKGGS2Uiwrjb6omXWxYjUL4NDsuap","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"CWqDmfn8C34wzH2ifjLCCs5G86UEnBxujXVVpL1FUnGb","receiver_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"4jsiX5ujgWQP4Ak5H9A6SYqPsDW5ZQZvomfgSpMLDn6v","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8aMRTJFUrQs6m5uL8zzgteKnVFrkbZcMEJ14C6X1Gvbn","receiver_id":"price-oracle-v1.nearlend-official.testnet"},{"type":"receipt","receipt_id":"82tVMBBJwF8Q3j2PPjiRJuxmJqDcStLzde8fxXHRMGN6","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"3jCcaKswLFLcodHSbrb38twSmmhRFJUAQouUmvhrGsMi","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"5niRYcxG3yMgNmctjFABkrF1yAKwWL794wJSHdnwepme","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"GhRhjvRxaRwJzwi3ak3pMpGs13HWdME1WoHyECja3qtz","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"DcSLpcKcRkQhCi93M6vZXGkDL3bziTWcLohegt7p7tZF","sender_id":"s-lam1.testnet"},{"type":"receipt","receipt_id":"4N853GZ1P8CuLCJ6j5PBuuiNwXzJpxP1bBDtk6AHfKwr","receiver_id":"relay.aurora"},{"type":"receipt","receipt_id":"GKqByK2wAHYEbJenRxkYheMpxwByM4NkvWZdfZerbQn8","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"9kePVBL6LdzFaxAahy5UnS2mxk4SnTKt1stBooe5Rdo","receiver_id":"temp-1705307745505.testnet"},{"type":"receipt","receipt_id":"HRcpQE1tURdkuNQDvbiPGda4AzvhRkrN4t5LNfghMtPA","receiver_id":"aurora"},{"type":"receipt","receipt_id":"AMRxi5sAfv6WTxqciiTpZ4vyqrqjKRfY8KbjcXLUzJub","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"DTQDzMVyFx5W6LU9STz7c8re5W6Nqv1YhsasNAnzAkTN","receiver_id":"aurora"},{"type":"transaction","transaction_hash":"G4Bh5vMco2NjdhWKp49k2FduWcur34hZ6HH2hRaUKCw7","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"xkzuJAMkAVPUi1vwuKovjVADS2KaW8QjHw62oBx6wGH","sender_id":"testnet"},{"type":"transaction","transaction_hash":"GeG2C8LkZFj6Pn4uyGnc3e3ZmbVGC9Cgrp2Yf2U6svyV","sender_id":"relay.aurora"},{"type":"receipt","receipt_id":"7Twnb975W8R6CKVEWegrhi1JGHydR5zmzydR1fP6Pda7","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"transaction","transaction_hash":"CKVfpWPV3QQiJ5wfQdjsNpwchqA3jUtZUG2qDpMvqW4","sender_id":"relay.aurora"},{"type":"receipt","receipt_id":"CRqM5tuz9hcmFhkSpeoT4rn9d68QP7GuQonhhDwH7YJY","receiver_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"HjGHb5iTzWQ2oUqM4UFuRJmija2rxGQYiJGcirDiq5UJ","receiver_id":"bhc8521.testnet"},{"type":"transaction","transaction_hash":"97uTVfZKxPMadP5RWjgKeTja5qDiiWKyyjFuqhyruk9Z","sender_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"EocTbZdsT6mfWJgXHEN3S1BdBzRWmNYPUZaxhtw6cBS9","receiver_id":"staking.bhc8521.testnet"},{"type":"receipt","receipt_id":"8PV12EPHocJg7WtNaUNU8LATDi29bDZpX4gAGWGn3fzb","receiver_id":"wi2zj8a44ww9.users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"GoJ93V2GQRAuGQYW1uKzhQqrz4UKnbTVh7X5UD3k3rJR","sender_id":"bhc8521.testnet"},{"type":"transaction","transaction_hash":"672tcEtJCDdMDvZbH1Gz81piNDQvRwBhmEjjtvHzkoUz","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2c8Fyu9H7ihjxYaEM78EzC68CeN2TC6euimjRsQBdLD2","receiver_id":"applebear.testnet"},{"type":"receipt","receipt_id":"AUgHY84ypiaA356cQQwJxPdDXJ5nyezYSep6rjCKogRq","receiver_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"C44CMoXmqpKdRZwPbjgzXCBZzfvpPewPi5wAHpxr1v9H","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"7akzoWwP6Kxnk3wCzMaKiYWnFwwoeFATXMYo61DkwWHZ","receiver_id":"comicdeer.testnet"},{"type":"transaction","transaction_hash":"GenuEHkF8LehYoZyYXg4575JxCbDfPVsH376URGWpb54","sender_id":"temp-1705307739983.testnet"},{"type":"receipt","receipt_id":"31UhY8whxQut1jzhbc79M37A1NY7YirNHNnZGMVDXVjF","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"AeaoBWLmbr4qwvRE4V71pEv1gx3Qbip8nqW4fj61Kczv","sender_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"6wCb1fvmR16CyUDE7ehnVh23VGQBkYp16RWfgd2aqgy","sender_id":"temp-1705307739377.testnet"},{"type":"receipt","receipt_id":"HbLpDaQS36oij4YpMWxQTfLbQFH3Cf6oQ5EjLfRnn2Ga","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"DPE2WfQ9MG3Ejr7sppNTTgYzwyqGLEfpgNhJfxS2LjjV","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"Dg8GFhanR27tJA24EC9y7knWuJLmsSLfi615vsKizRQM","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"3UPPVspH68a79hdi9HwbxH3yKrbCTztmLiakSfrwVjAe","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"AziRTxKMqC4E1Wn63B1QdCrCTzddRs173tNZx6pRkSau","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"GPDR68TDMnZ9ufYzBMKoptpozb8gi8E7rASSwb8woZGw","receiver_id":"temp-1705307739983.testnet"},{"type":"receipt","receipt_id":"Dfihs3YB8iUEvMTuRGmzQtN5jM7fTfR7NJRBUG4kbiEg","receiver_id":"testnet"},{"type":"receipt","receipt_id":"EFdUNSmV1izaLZrvZRnsGkJSwAdUXPNi3poxe8pxEZnZ","receiver_id":"temp-1705307739377.testnet"},{"type":"receipt","receipt_id":"H2W49UqNusj5HmacN6zkSHmzM2NRQ4YZZR4NBtYWFpyR","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"43c13ha3WLKq8KY313QS7zFsJrTz1FcNhfo3dauPuPut","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"569ivh78HtkNzMtAwV9nrZcw52KRLavKomeEHf5PFvwP","sender_id":"testnet"},{"type":"receipt","receipt_id":"Ea9uzwJbiVku4iLgttb9jBpDP3h2eu5bLkznRyQRACxG","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"AGXGwswvaL2j3ZR5EzdKoL9o3vn3zxwu4nvof7ewwW87","sender_id":"testnet"},{"type":"transaction","transaction_hash":"5NuxFavFcXuQBy94VBaQ3hPhuEneeoG7ouEgqwCDrBty","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"GsgohZDa1G7oL4we5NreYcWdaGEPpYsDuKXH4eDPKvGX","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"29misn96KZENH7LiFouVME9xoMdTjEkP3yrTAFwQxsvq","receiver_id":"klbswp0a1vx8.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8xDaH77bash1UYfGnEehC3hJQiL3AXbx8E3HqS9zLbTD","receiver_id":"applebear.testnet"},{"type":"transaction","transaction_hash":"J1UxZyLEqwbdBcbeUUvsC6c1LiqE1XRnnCwi7kh8bNno","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"E6x1wD66F21qfb2cirDrBFCGCuvVBkWdwLBPZGHkXqkk","receiver_id":"comicdeer.testnet"},{"type":"transaction","transaction_hash":"63oedx7DyoC3Go3Moh1GoCtumt8jCjAoegcQu4LiohXh","sender_id":"temp-1705307734894.testnet"},{"type":"transaction","transaction_hash":"8ketL1ZE7JZnxQQk6PHm832kxvo5mYmxvjJeJGqHUJe8","sender_id":"temp-1705307734347.testnet"},{"type":"receipt","receipt_id":"HGnmfz15V5V13V3ggPbfJXFURM2VApYDEDqmrQ7k8dnP","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"7pZGBfeVq3ipGjB2yumpWpg71x87b28tLjHiiQvHkzFb","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"2LzQai317mSFL9WH3RVGpZ3Q6a4aW1N6YzPoGTuPUJNk","receiver_id":"testnet"},{"type":"receipt","receipt_id":"DQxrJdHSKMMp7SggYX8NboHZAoLfzpZWz1hRvcwDD5UB","receiver_id":"temp-1705307734894.testnet"},{"type":"receipt","receipt_id":"ET94UwU3piYVZiEjEJndj5bod9fzm2AVuMBzCbWSWMLZ","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"75jRwwtXiHqEBJryDjsnmPJ4sYQdNS5TPHU9WVxgNTgf","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"EGjCXPSdKCgPZsWw9A5CshcgQHJk7jaYFGaTAEEbnoqs","receiver_id":"temp-1705307734347.testnet"},{"type":"transaction","transaction_hash":"7fRTLkNAefQmBEMsQ6HnGhHNA1YkCmduDb7R7SP2kT3g","sender_id":"testnet"},{"type":"receipt","receipt_id":"FJ3cDdxosiZegJ4WNYjBhXZ7BfYdMaLpPAXzJjajrZv6","receiver_id":"users.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"H9aX55Tqm1CW36QARgLte3YZ9Wdf3fhm4tjLygYFqFbN","sender_id":"testnet"},{"type":"receipt","receipt_id":"CnCvsHRvKzAuzXPw43ZXtRLu5ZH2ww58XQGUUgWYjNBe","receiver_id":"0pqglttllt1f.users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"HDknH3enjr78hRcC3wR5rKiKMG5GERfLi9soAPoW2hR8","receiver_id":"applebear.testnet"},{"type":"receipt","receipt_id":"AALcw5BdUqPGracwTjMxpocG8tWiLrTWHEC4gAk5ZDoq","receiver_id":"perp.spin-fi.testnet"},{"type":"transaction","transaction_hash":"6NTTnsdahx26Jzubk6bvynCz4ZViUoGQjQQyPaXgirNT","sender_id":"users.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"8wbnwD6b1knr2YhZom11Ldgujahi4M4ZsfumbC9zo8uj","receiver_id":"v2_1.perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"2iCRM8o3uEwKKEoKc3UrWi3S8Ge5gwgd7mVqpYss99od","receiver_id":"comicdeer.testnet"},{"type":"transaction","transaction_hash":"8qoHBsjGtwQcjM9W8yM2L98EokAU4hMZpVnD9x3JCEv1","sender_id":"temp-1705307729372.testnet"},{"type":"transaction","transaction_hash":"9EMfeSscicikVrDv6mHJ73wi3K8HAwcRH3buAQfE93R5","sender_id":"temp-1705307728821.testnet"},{"type":"transaction","transaction_hash":"3tkpFoRZdWP5dEPpAZhXX1GWyzNhgg8orkYL2oCMQPkh","sender_id":"perp.spin-fi.testnet"},{"type":"receipt","receipt_id":"GBLCtHewjdxSrk8f1ttRSGSRAqR7CvPMWGHM8bi1P1WT","receiver_id":"operator-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"4qpF4SRRVmHq155FrhK1RCDbZNnxMtmLXfccL97AMKqS","receiver_id":"operator_manager.orderly.testnet"},{"type":"receipt","receipt_id":"S9PXMk58XgSTom9eJWC3szry2QK4ggRLnjnpv6QXNw1","receiver_id":"operator-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"7Uhb1LojjwC9pVrryc53kAEwkY1z7B3VWf2DueD5HCdz","receiver_id":"hotwallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"79UG9E86GX1CHeePXMgEQgxWfzsnPSfwYnBMiafAK6NB","receiver_id":"wallet.dev-kaiching.testnet"},{"type":"receipt","receipt_id":"4VRxmA79eB7qL4PqJK4QX2ayYpLJZ3W3dJBb8q1euAD7","receiver_id":"asset-manager.orderly-qa.testnet"},{"type":"receipt","receipt_id":"Fk4iDHJrtKZr6ow8c4R9TyixvTz3QHUMHWA3zqNZizni","receiver_id":"asset-manager.orderly.testnet"},{"type":"receipt","receipt_id":"ATocjDbjKLXyBayuoxXtsTKpAiYmZsBhRtYCwzGVh1hi","receiver_id":"asset-manager.orderly-dev.testnet"},{"type":"receipt","receipt_id":"99xzZxX5W4oAFjEwYX9C3bcApsr7J5tiWacwGbnb5sKb","receiver_id":"testnet"},{"type":"receipt","receipt_id":"AkvWzeUbwUcw76LQvBV1XVmHMZh26nbMSkQvbBfnfXQu","receiver_id":"temp-1705307729372.testnet"},{"type":"receipt","receipt_id":"9A3JPegdSynaeEM2EWVFysUBDv3S3kcCrsXwvAae7JtT","receiver_id":"testnet"},{"type":"transaction","transaction_hash":"CtfpEjzFM41fkfduXwoyM41Fxc52uKpeV2tmWMDenrz","sender_id":"hotwallet.dev-kaiching.testnet"},{"type":"transaction","transaction_hash":"5UhNLf3A8wjYZSZa3YGfLgaU7g4t8uUEX898u2r5NgPK","sender_id":"operator-manager.orderly-qa.testnet"},{"type":"transaction","transaction_hash":"Aw29U5ccvJx7NSe1258YjBjG4YJPpDjP4WBNZB2cFQBH","sender_id":"operator_manager.orderly.testnet"},{"type":"transaction","transaction_hash":"6t9v25pvgVJYtCSiyjt73ngLwFnUJV7YqyKf49WDqKLD","sender_id":"operator-manager.orderly-dev.testnet"}] \ No newline at end of file From e00916b5201d5cd72d6270279ed934e85e9e2b37 Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 8 Feb 2024 12:04:34 +0000 Subject: [PATCH 31/67] wip: contracts --- circuits/plonky2x/contracts/foundry.toml | 6 + .../plonky2x/contracts/script/Deploy.s.sol | 28 ++++ circuits/plonky2x/contracts/src/NearX.sol | 140 ++++++++++++++++++ .../contracts/src/interfaces/INearX.sol | 31 ++++ .../src/interfaces/ISuccinctGateway.sol | 81 ++++++++++ circuits/plonky2x/contracts/test/NearX.t.sol | 33 +++++ circuits/plonky2x/src/circuits/sync.rs | 2 + circuits/plonky2x/src/circuits/verify.rs | 1 + flake.nix | 3 + 9 files changed, 325 insertions(+) create mode 100644 circuits/plonky2x/contracts/foundry.toml create mode 100644 circuits/plonky2x/contracts/script/Deploy.s.sol create mode 100644 circuits/plonky2x/contracts/src/NearX.sol create mode 100644 circuits/plonky2x/contracts/src/interfaces/INearX.sol create mode 100644 circuits/plonky2x/contracts/src/interfaces/ISuccinctGateway.sol create mode 100644 circuits/plonky2x/contracts/test/NearX.t.sol diff --git a/circuits/plonky2x/contracts/foundry.toml b/circuits/plonky2x/contracts/foundry.toml new file mode 100644 index 0000000..4ff40c4 --- /dev/null +++ b/circuits/plonky2x/contracts/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file diff --git a/circuits/plonky2x/contracts/script/Deploy.s.sol b/circuits/plonky2x/contracts/script/Deploy.s.sol new file mode 100644 index 0000000..1031d29 --- /dev/null +++ b/circuits/plonky2x/contracts/script/Deploy.s.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import "forge-std/Script.sol"; +import {NearX} from "../src/NearX.sol"; + +contract DeployScript is Script { + function setUp() public {} + + function run() public { + vm.startBroadcast(); + + address gateway = 0x6e4f1e9eA315EBFd69d18C2DB974EEf6105FB803; + + // Use the below to interact with an already deployed ZK light client. + NearX lightClient = new NearX(gateway); + + bytes32 syncFunctionId = vm.envBytes32("SYNC_FUNCTION_ID"); + lightClient.updateSyncId(verifyFunctionId); + + bytes32 verifyFunctionId = vm.envBytes32("VERIFY_FUNCTION_ID"); + lightClient.updateVerifyId(verifyFunctionId); + + uint64 height = uint64(vm.envUint("GENESIS_HEIGHT")); + bytes32 header = vm.envBytes32("GENESIS_HEADER"); + lightClient.setGenesisHeader(header); + } +} diff --git a/circuits/plonky2x/contracts/src/NearX.sol b/circuits/plonky2x/contracts/src/NearX.sol new file mode 100644 index 0000000..12c8eb9 --- /dev/null +++ b/circuits/plonky2x/contracts/src/NearX.sol @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import {ISuccinctGateway} from "./interfaces/ISuccinctGateway.sol"; +import {INearX, TransactionOrReceiptId} from "./interfaces/INearX.sol"; + +/// @notice The NearX contract is a light client for Near. +/// @dev +contract NearX is INearX { + /// TODO: integrate this in a nice way + uint64 public constant NETWORK = 1; + + /// @notice The address of the gateway contract. + address public gateway; + + /// @notice The latest header that has been committed. + bytes32 public latestHeader; + + /// @notice Sync function id. + bytes32 public syncFunctionId; + + /// @notice Verify function id. + bytes32 public verifyFunctionId; + + /// @notice Initialize the contract with the address of the gateway contract. + constructor(address _gateway) { + gateway = _gateway; + } + + /// @notice Update the address of the gateway contract. + function updateGateway(address _gateway) external { + gateway = _gateway; + } + + /// @notice Update the function ID for header range. + function updateSyncId(bytes32 _functionId) external { + syncFunctionId = _functionId; + } + + /// @notice Update the function ID for next header. + function updateVerifyId(bytes32 _functionId) external { + verifyFunctionId = _functionId; + } + + /// Note: Only for testnet. The genesis header should be set when initializing the contract. + function setGenesisHeader(bytes32 _header) external { + latestHeader = _header; + } + + function ensureInitialized() internal { + if (latestHeader == bytes32(0)) { + revert HeaderNotInitialised(); + } + } + + /// @notice Inputs of a sync request. + function requestSync() external payable { + ensureInitialized(); + + ISuccinctGateway(gateway).requestCall{value: msg.value}( + syncFunctionId, + abi.encodePacked(latestHeader), + address(this), + abi.encodeWithSelector(this.sync.selector, latestHeader), + 500000 + ); + + emit SyncRequested(latestHeader); + } + + /// @notice Stores the new header for targetBlock. + function sync() external { + ensureInitialized(); + + // Encode the circuit input. + bytes memory input = abi.encodePacked(latestHeader); + + // Call gateway to get the proof result. + bytes memory requestResult = ISuccinctGateway(gateway).verifiedCall( + syncFunctionId, + input + ); + + // Read the target header from request result. + bytes32 targetHeader = abi.decode(requestResult, (bytes32)); + + latestHeader = targetHeader; + + emit HeadUpdate(targetHeader); + } + + function requestVerify(TransactionOrReceiptId[] memory ids) + external + payable + { + ensureInitialized(); + + ISuccinctGateway(gateway).requestCall{value: msg.value}( + verifyFunctionId, + abi.encodePacked(latestHeader, encodePackedIds(ids)), + address(this), + abi.encodeWithSelector(this.verify.selector, latestHeader, ids), + 500000 + ); + emit VerifyRequested(latestHeader, ids); + } + + function verify(TransactionOrReceiptId[] memory ids) external { + ensureInitialized(); + + bytes memory input = abi.encodePacked( + latestHeader, + encodePackedIds(ids) + ); + + // Call gateway to get the proof result. + bytes memory requestResult = ISuccinctGateway(gateway).verifiedCall( + verifyFunctionId, + input + ); + // TODO: emit event for the ids and their verification status + } + + function encodePackedIds(TransactionOrReceiptId[] memory ids) + internal + pure + returns (bytes memory) + { + bytes memory output; + for (uint256 i = 0; i < ids.length; i++) { + output = abi.encodePacked( + output, + ids[i].isTransaction, + ids[i].id, + ids[i].account + ); + } + return output; + } +} diff --git a/circuits/plonky2x/contracts/src/interfaces/INearX.sol b/circuits/plonky2x/contracts/src/interfaces/INearX.sol new file mode 100644 index 0000000..9de34d5 --- /dev/null +++ b/circuits/plonky2x/contracts/src/interfaces/INearX.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +interface INearX { + /// @notice Emits event with the new head update. + event HeadUpdate(bytes32 headerHash); + + /// @notice Inputs of a sync request. + /// @param trustedHeader The header hash of the trusted block. + event SyncRequested(bytes32 indexed trustedHeader); + + /// @notice Inputs of a verify request. + /// @param trustedHeader The header hash of the trusted block. + /// @param ids The transaction or receipt ids to verify. + event VerifyRequested( + bytes32 indexed trustedHeader, + TransactionOrReceiptId[] indexed ids + ); + + /// @notice Trusted header not found. + error TrustedHeaderNotFound(); + + /// @notice Header not Initialised. + error HeaderNotInitialised(); +} + +struct TransactionOrReceiptId { + bool isTransaction; + bytes32 id; + string account; +} diff --git a/circuits/plonky2x/contracts/src/interfaces/ISuccinctGateway.sol b/circuits/plonky2x/contracts/src/interfaces/ISuccinctGateway.sol new file mode 100644 index 0000000..1be5839 --- /dev/null +++ b/circuits/plonky2x/contracts/src/interfaces/ISuccinctGateway.sol @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +interface ISuccinctGatewayEvents { + event RequestCallback( + uint32 indexed nonce, + bytes32 indexed functionId, + bytes input, + bytes context, + address callbackAddress, + bytes4 callbackSelector, + uint32 callbackGasLimit, + uint256 feeAmount + ); + event RequestCall( + bytes32 indexed functionId, + bytes input, + address entryAddress, + bytes entryCalldata, + uint32 entryGasLimit, + address sender, + uint256 feeAmount + ); + event RequestFulfilled( + uint32 indexed nonce, + bytes32 indexed functionId, + bytes32 inputHash, + bytes32 outputHash + ); + event Call( + bytes32 indexed functionId, + bytes32 inputHash, + bytes32 outputHash + ); + event SetFeeVault(address indexed oldFeeVault, address indexed newFeeVault); + event ProverUpdated(address indexed prover, bool added); +} + +interface ISuccinctGatewayErrors { + error InvalidRequest( + uint32 nonce, + bytes32 expectedRequestHash, + bytes32 requestHash + ); + error CallbackFailed(bytes4 callbackSelector, bytes output, bytes context); + error InvalidCall(bytes32 functionId, bytes input); + error CallFailed(address callbackAddress, bytes callbackData); + error InvalidProof( + address verifier, + bytes32 inputHash, + bytes32 outputHash, + bytes proof + ); + error ReentrantFulfill(); + error OnlyProver(address sender); +} + +interface ISuccinctGateway is ISuccinctGatewayEvents, ISuccinctGatewayErrors { + function requestCallback( + bytes32 functionId, + bytes memory input, + bytes memory context, + bytes4 callbackSelector, + uint32 callbackGasLimit + ) external payable returns (bytes32); + + function requestCall( + bytes32 functionId, + bytes memory input, + address entryAddress, + bytes memory entryData, + uint32 entryGasLimit + ) external payable; + + function verifiedCall( + bytes32 functionId, + bytes memory input + ) external view returns (bytes memory); + + function isCallback() external view returns (bool); +} diff --git a/circuits/plonky2x/contracts/test/NearX.t.sol b/circuits/plonky2x/contracts/test/NearX.t.sol new file mode 100644 index 0000000..b485a3f --- /dev/null +++ b/circuits/plonky2x/contracts/test/NearX.t.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import "forge-std/Test.sol"; +import "../src/NearX.sol"; + +contract NearXTest is Test { + NearX public lightClient; + + function setUp() public { + lightClient = new NearX(address(0)); + } + + function testGetEncodePackedSync() public view { + uint64 height = 10000; + // TODO: + bytes32 header = hex"A0123D5E4B8B8888A61F931EE2252D83568B97C223E0ECA9795B29B8BD8CBA2D"; + bytes memory encodedInput = abi.encodePacked(height, header); + console.logBytes(encodedInput); + } + + function testGetEncodePackedVerify() public view { + // TODO: + bytes32 header = hex"A0123D5E4B8B8888A61F931EE2252D83568B97C223E0ECA9795B29B8BD8CBA2D"; + uint64 requestedHeight = 10004; + bytes memory encodedInput = abi.encodePacked( + height, + header, + requestedHeight + ); + console.logBytes(encodedInput); + } +} diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index d1c23ab..e5351b1 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -26,6 +26,8 @@ impl Circuit for SyncCircuit { <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: plonky2::plonk::config::AlgebraicHasher<>::Field>, { + // TODO: decide if we wanna just store the hash here, hint to go get it and then + // verify let trusted_head = b.evm_read::(); // This is a very interesting trick to be able to get the BPS for the next epoch diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index b0182ef..3af2fdd 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -40,6 +40,7 @@ impl Circuit let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); + // TODO: write some outputs here for each ID let output = b.mapreduce_dynamic::<_, _, _, Self, B, _, _>( (), proofs.data, diff --git a/flake.nix b/flake.nix index b5e880b..62207a2 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,9 @@ llvmPackages_11.libclang protobuf + nodejs + solc + ]; buildInputs = with pkgs; [ (rustVersion.override { extensions = [ "rust-src" ]; }) From 9750ed9acaafeb8d503adaefc7de6e0ab4dbf85e Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 8 Feb 2024 12:21:26 +0000 Subject: [PATCH 32/67] feat!: only read/write trusted header hashes to the circuit BREAKING CHANGE: no use of raw headers in the circuit --- circuits/plonky2x/contracts/foundry.toml | 9 +++-- circuits/plonky2x/src/builder.rs | 1 + circuits/plonky2x/src/circuits/sync.rs | 48 +++++++++++------------- circuits/plonky2x/src/hint.rs | 36 ++++++++++++++++++ crates/rpc/src/lib.rs | 19 +++++++++- 5 files changed, 80 insertions(+), 33 deletions(-) diff --git a/circuits/plonky2x/contracts/foundry.toml b/circuits/plonky2x/contracts/foundry.toml index 4ff40c4..6919f48 100644 --- a/circuits/plonky2x/contracts/foundry.toml +++ b/circuits/plonky2x/contracts/foundry.toml @@ -1,6 +1,7 @@ [profile.default] -src = "src" -out = "out" -libs = ["lib"] +libs = [ "lib" ] +out = "out" +src = "src" + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config -# See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index fc771d7..79f96e4 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -277,6 +277,7 @@ impl, const D: usize> Sync for CircuitBuilder self.assertx(e); assert!(next_block.next_bps.len() == NUM_BLOCK_PRODUCER_SEATS); } + // FIXME: remove this, return the new head SyncedVariable { new_head: next_block.header.to_owned(), next_bps_epoch: next_block.header.inner_lite.next_epoch_id, diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index e5351b1..22c0a04 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -2,17 +2,13 @@ pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use crate::{ builder::Sync, - hint::FetchNextHeaderInputs, + hint::{FetchHeaderInputs, FetchNextHeaderInputs}, variables::{ - BlockHeightVariable, BuildEndorsement, EncodeInner, HashBpsInputs, HeaderVariable, + BlockHeightVariable, BuildEndorsement, CryptoHashVariable, EncodeInner, HashBpsInputs, }, }; -// TODO: determine how much we can bootstrap from RB -// TODO: sync & prove for txs later than sync head -// TODO: async proof requests, based on a receipt/txs id (should be able to use -// light client rpc lib TODO: batch proof requests for a set of receipts/txs, -// must be bounded TODO: batching/experimental proofs +// TODO: lazy sync // TODO[Style]: Shared trait for protocol functionality between crate <> circuit // TODO[Style]: macro to share all the same implementation with semantic type // differences between protocol crate @@ -26,29 +22,34 @@ impl Circuit for SyncCircuit { <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: plonky2::plonk::config::AlgebraicHasher<>::Field>, { - // TODO: decide if we wanna just store the hash here, hint to go get it and then - // verify - let trusted_head = b.evm_read::(); + let trusted_header_hash = b.evm_read::(); + + let untrusted = FetchHeaderInputs(NETWORK.into()).fetch(b, &trusted_header_hash); + let untrusted_hash = untrusted.hash(b); + b.assert_is_equal(trusted_header_hash, untrusted_hash); + let head = untrusted; // This is a very interesting trick to be able to get the BPS for the next epoch // without the need to store the BPS, we verify the hash of the BPS in the // circuit let bps = FetchNextHeaderInputs(NETWORK.into()) - .fetch(b, &trusted_head.inner_lite.next_epoch_id) + .fetch(b, &head.inner_lite.next_epoch_id) .unwrap() .next_bps; let bps_hash = HashBpsInputs.hash(b, &bps); - b.assert_is_equal(trusted_head.inner_lite.next_bp_hash, bps_hash); + b.assert_is_equal(head.inner_lite.next_bp_hash, bps_hash); - let head_hash = trusted_head.hash(b); + let head_hash = head.hash(b); let next_block = FetchNextHeaderInputs(NETWORK.into()) .fetch(b, &head_hash) - .unwrap(); + .expect("Failed to fetch next block"); b.watch(&bps_hash, "calculate_bps_hash"); - let synced = b.sync(&trusted_head, &bps, &next_block); - b.evm_write::(synced.new_head); + let synced = b.sync(&head, &bps, &next_block); + b.watch(&synced.new_head, "new_head"); + let synced_hash = synced.new_head.hash(b); + b.evm_write::(synced_hash); } fn register_generators, const D: usize>(registry: &mut HintRegistry) @@ -78,18 +79,10 @@ pub struct ProofMapReduceCtx { #[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { - use std::str::FromStr; - - use ::test_utils::CryptoHash; - use near_light_client_protocol::prelude::Itertools; - use near_primitives::types::TransactionOrReceiptId; use serial_test::serial; use super::*; - use crate::{ - test_utils::{builder_suite, testnet_state, B, PI, PO}, - variables::TransactionOrReceiptIdVariableValue, - }; + use crate::test_utils::{builder_suite, testnet_state, B, PI, PO}; const NETWORK: usize = 1; @@ -97,15 +90,16 @@ mod beefy_tests { #[serial] fn beefy_test_sync_e2e() { let (header, _, _) = testnet_state(); + let header = header.hash().0; let define = |b: &mut B| { SyncCircuit::::define(b); }; let writer = |input: &mut PI| { - input.evm_write::(header.into()); + input.evm_write::(header.into()); }; let assertions = |mut output: PO| { - println!("{:#?}", output.evm_read::()); + let hash = output.evm_read::(); }; builder_suite(define, writer, assertions); } diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index 40df141..ea0c43b 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -47,6 +47,42 @@ impl FetchNextHeaderInputs { } } +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct FetchHeaderInputs(pub Network); + +#[async_trait] +impl, const D: usize> AsyncHint for FetchHeaderInputs { + async fn hint( + &self, + input_stream: &mut ValueStream, + output_stream: &mut ValueStream, + ) { + let client = NearRpcClient::new(self.0.clone()); + + let h = input_stream.read_value::().0; + + let header = client + .fetch_header(&CryptoHash(h)) + .await + .expect("Failed to fetch header"); + + output_stream.write_value::(header.into()); + } +} + +impl FetchHeaderInputs { + pub fn fetch, const D: usize>( + self, + b: &mut CircuitBuilder, + hash: &CryptoHashVariable, + ) -> HeaderVariable { + let mut input_stream = VariableStream::new(); + input_stream.write::(hash); + + let output_stream = b.async_hint(input_stream, self); + output_stream.read::(b) + } +} // TODO: refactor into some client-like carrier for all hints that is serdeable #[derive(Debug, Clone, Deserialize, Serialize)] pub struct FetchProofInputs(pub Network); diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 7511c7c..51d4f95 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -6,8 +6,9 @@ use near_jsonrpc_client::{ methods::{self, light_client_proof::RpcLightClientExecutionProofResponse}, JsonRpcClient, }; -use near_primitives::views::{ - validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1, +use near_primitives::{ + block_header::BlockHeader, + views::{validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1}, }; use crate::prelude::*; @@ -109,6 +110,20 @@ impl NearRpcClient { }; Ok((proofs, errors)) } + pub async fn fetch_header(&self, hash: &CryptoHash) -> Result
{ + let req = methods::block::RpcBlockRequest { + block_reference: near_primitives::types::BlockReference::BlockId( + near_primitives::types::BlockId::Hash(*hash), + ), + }; + self.client + .call(&req) + .await + .map_err(|e| anyhow!(e)) + .map(|x| x.header) + .map(BlockHeader::from) + .map(Into::into) + } } #[async_trait] From 360ae8fb28b234b5621c4e11ee09ab7d56cb7c27 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 9 Feb 2024 09:27:47 +0000 Subject: [PATCH 33/67] chore: forge init --- .../forge/.github/workflows/test.yml | 34 ++++++++++ circuits/plonky2x/contracts/forge/.gitignore | 14 ++++ circuits/plonky2x/contracts/forge/README.md | 66 +++++++++++++++++++ .../plonky2x/contracts/forge/foundry.toml | 6 ++ .../contracts/forge/script/Counter.s.sol | 12 ++++ .../plonky2x/contracts/forge/src/Counter.sol | 14 ++++ .../contracts/forge/test/Counter.t.sol | 24 +++++++ 7 files changed, 170 insertions(+) create mode 100644 circuits/plonky2x/contracts/forge/.github/workflows/test.yml create mode 100644 circuits/plonky2x/contracts/forge/.gitignore create mode 100644 circuits/plonky2x/contracts/forge/README.md create mode 100644 circuits/plonky2x/contracts/forge/foundry.toml create mode 100644 circuits/plonky2x/contracts/forge/script/Counter.s.sol create mode 100644 circuits/plonky2x/contracts/forge/src/Counter.sol create mode 100644 circuits/plonky2x/contracts/forge/test/Counter.t.sol diff --git a/circuits/plonky2x/contracts/forge/.github/workflows/test.yml b/circuits/plonky2x/contracts/forge/.github/workflows/test.yml new file mode 100644 index 0000000..09880b1 --- /dev/null +++ b/circuits/plonky2x/contracts/forge/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test + +on: workflow_dispatch + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + id: build + + - name: Run Forge tests + run: | + forge test -vvv + id: test diff --git a/circuits/plonky2x/contracts/forge/.gitignore b/circuits/plonky2x/contracts/forge/.gitignore new file mode 100644 index 0000000..85198aa --- /dev/null +++ b/circuits/plonky2x/contracts/forge/.gitignore @@ -0,0 +1,14 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/circuits/plonky2x/contracts/forge/README.md b/circuits/plonky2x/contracts/forge/README.md new file mode 100644 index 0000000..9265b45 --- /dev/null +++ b/circuits/plonky2x/contracts/forge/README.md @@ -0,0 +1,66 @@ +## Foundry + +**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** + +Foundry consists of: + +- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). +- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. +- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. +- **Chisel**: Fast, utilitarian, and verbose solidity REPL. + +## Documentation + +https://book.getfoundry.sh/ + +## Usage + +### Build + +```shell +$ forge build +``` + +### Test + +```shell +$ forge test +``` + +### Format + +```shell +$ forge fmt +``` + +### Gas Snapshots + +```shell +$ forge snapshot +``` + +### Anvil + +```shell +$ anvil +``` + +### Deploy + +```shell +$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key +``` + +### Cast + +```shell +$ cast +``` + +### Help + +```shell +$ forge --help +$ anvil --help +$ cast --help +``` diff --git a/circuits/plonky2x/contracts/forge/foundry.toml b/circuits/plonky2x/contracts/forge/foundry.toml new file mode 100644 index 0000000..e883058 --- /dev/null +++ b/circuits/plonky2x/contracts/forge/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/circuits/plonky2x/contracts/forge/script/Counter.s.sol b/circuits/plonky2x/contracts/forge/script/Counter.s.sol new file mode 100644 index 0000000..1a47b40 --- /dev/null +++ b/circuits/plonky2x/contracts/forge/script/Counter.s.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Script, console2} from "forge-std/Script.sol"; + +contract CounterScript is Script { + function setUp() public {} + + function run() public { + vm.broadcast(); + } +} diff --git a/circuits/plonky2x/contracts/forge/src/Counter.sol b/circuits/plonky2x/contracts/forge/src/Counter.sol new file mode 100644 index 0000000..aded799 --- /dev/null +++ b/circuits/plonky2x/contracts/forge/src/Counter.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +contract Counter { + uint256 public number; + + function setNumber(uint256 newNumber) public { + number = newNumber; + } + + function increment() public { + number++; + } +} diff --git a/circuits/plonky2x/contracts/forge/test/Counter.t.sol b/circuits/plonky2x/contracts/forge/test/Counter.t.sol new file mode 100644 index 0000000..c0dfa7d --- /dev/null +++ b/circuits/plonky2x/contracts/forge/test/Counter.t.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import {Test, console2} from "forge-std/Test.sol"; +import {Counter} from "../src/Counter.sol"; + +contract CounterTest is Test { + Counter public counter; + + function setUp() public { + counter = new Counter(); + counter.setNumber(0); + } + + function testIncrement() public { + counter.increment(); + assertEq(counter.number(), 1); + } + + function testSetNumber(uint256 x) public { + counter.setNumber(x); + assertEq(counter.number(), x); + } +} From c9d5ebaee25877f22b88c1ebff56c531b488f033 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 9 Feb 2024 09:27:51 +0000 Subject: [PATCH 34/67] forge install: forge-std v1.7.6 --- .gitignore | 16 +++++++++ .gitmodules | 3 ++ .../plonky2x/contracts/{forge => }/README.md | 0 .../forge/.github/workflows/test.yml | 34 ------------------- circuits/plonky2x/contracts/forge/.gitignore | 14 -------- .../plonky2x/contracts/forge/foundry.toml | 6 ---- .../contracts/forge/script/Counter.s.sol | 12 ------- .../plonky2x/contracts/forge/src/Counter.sol | 14 -------- .../contracts/forge/test/Counter.t.sol | 24 ------------- circuits/plonky2x/contracts/foundry.toml | 7 ++-- .../plonky2x/contracts/script/Deploy.s.sol | 2 +- circuits/plonky2x/contracts/test/NearX.t.sol | 6 +--- 12 files changed, 24 insertions(+), 114 deletions(-) create mode 100644 .gitmodules rename circuits/plonky2x/contracts/{forge => }/README.md (100%) delete mode 100644 circuits/plonky2x/contracts/forge/.github/workflows/test.yml delete mode 100644 circuits/plonky2x/contracts/forge/.gitignore delete mode 100644 circuits/plonky2x/contracts/forge/foundry.toml delete mode 100644 circuits/plonky2x/contracts/forge/script/Counter.s.sol delete mode 100644 circuits/plonky2x/contracts/forge/src/Counter.sol delete mode 100644 circuits/plonky2x/contracts/forge/test/Counter.t.sol diff --git a/.gitignore b/.gitignore index 9b84683..1fc5f51 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,19 @@ circuits/plonky2x/build local.toml *.db + +# Compiler files +circuits/plonky2x/contracts/cache +circuits/plonky2x/contracts/out +circuits/plonky2x/contracts/lib + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7ba2fc1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "circuits/plonky2x/contracts/forge/lib/forge-std"] + path = circuits/plonky2x/contracts/forge/lib/forge-std + url = https://github.com/foundry-rs/forge-std diff --git a/circuits/plonky2x/contracts/forge/README.md b/circuits/plonky2x/contracts/README.md similarity index 100% rename from circuits/plonky2x/contracts/forge/README.md rename to circuits/plonky2x/contracts/README.md diff --git a/circuits/plonky2x/contracts/forge/.github/workflows/test.yml b/circuits/plonky2x/contracts/forge/.github/workflows/test.yml deleted file mode 100644 index 09880b1..0000000 --- a/circuits/plonky2x/contracts/forge/.github/workflows/test.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: test - -on: workflow_dispatch - -env: - FOUNDRY_PROFILE: ci - -jobs: - check: - strategy: - fail-fast: true - - name: Foundry project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Run Forge build - run: | - forge --version - forge build --sizes - id: build - - - name: Run Forge tests - run: | - forge test -vvv - id: test diff --git a/circuits/plonky2x/contracts/forge/.gitignore b/circuits/plonky2x/contracts/forge/.gitignore deleted file mode 100644 index 85198aa..0000000 --- a/circuits/plonky2x/contracts/forge/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# Compiler files -cache/ -out/ - -# Ignores development broadcast logs -!/broadcast -/broadcast/*/31337/ -/broadcast/**/dry-run/ - -# Docs -docs/ - -# Dotenv file -.env diff --git a/circuits/plonky2x/contracts/forge/foundry.toml b/circuits/plonky2x/contracts/forge/foundry.toml deleted file mode 100644 index e883058..0000000 --- a/circuits/plonky2x/contracts/forge/foundry.toml +++ /dev/null @@ -1,6 +0,0 @@ -[profile.default] -src = "src" -out = "out" -libs = ["lib"] - -# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/circuits/plonky2x/contracts/forge/script/Counter.s.sol b/circuits/plonky2x/contracts/forge/script/Counter.s.sol deleted file mode 100644 index 1a47b40..0000000 --- a/circuits/plonky2x/contracts/forge/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Script, console2} from "forge-std/Script.sol"; - -contract CounterScript is Script { - function setUp() public {} - - function run() public { - vm.broadcast(); - } -} diff --git a/circuits/plonky2x/contracts/forge/src/Counter.sol b/circuits/plonky2x/contracts/forge/src/Counter.sol deleted file mode 100644 index aded799..0000000 --- a/circuits/plonky2x/contracts/forge/src/Counter.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -contract Counter { - uint256 public number; - - function setNumber(uint256 newNumber) public { - number = newNumber; - } - - function increment() public { - number++; - } -} diff --git a/circuits/plonky2x/contracts/forge/test/Counter.t.sol b/circuits/plonky2x/contracts/forge/test/Counter.t.sol deleted file mode 100644 index c0dfa7d..0000000 --- a/circuits/plonky2x/contracts/forge/test/Counter.t.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console2} from "forge-std/Test.sol"; -import {Counter} from "../src/Counter.sol"; - -contract CounterTest is Test { - Counter public counter; - - function setUp() public { - counter = new Counter(); - counter.setNumber(0); - } - - function testIncrement() public { - counter.increment(); - assertEq(counter.number(), 1); - } - - function testSetNumber(uint256 x) public { - counter.setNumber(x); - assertEq(counter.number(), x); - } -} diff --git a/circuits/plonky2x/contracts/foundry.toml b/circuits/plonky2x/contracts/foundry.toml index 6919f48..e883058 100644 --- a/circuits/plonky2x/contracts/foundry.toml +++ b/circuits/plonky2x/contracts/foundry.toml @@ -1,7 +1,6 @@ [profile.default] -libs = [ "lib" ] -out = "out" -src = "src" +src = "src" +out = "out" +libs = ["lib"] # See more config options https://github.com/foundry-rs/foundry/tree/master/config - diff --git a/circuits/plonky2x/contracts/script/Deploy.s.sol b/circuits/plonky2x/contracts/script/Deploy.s.sol index 1031d29..1ff9864 100644 --- a/circuits/plonky2x/contracts/script/Deploy.s.sol +++ b/circuits/plonky2x/contracts/script/Deploy.s.sol @@ -16,7 +16,7 @@ contract DeployScript is Script { NearX lightClient = new NearX(gateway); bytes32 syncFunctionId = vm.envBytes32("SYNC_FUNCTION_ID"); - lightClient.updateSyncId(verifyFunctionId); + lightClient.updateSyncId(syncFunctionId); bytes32 verifyFunctionId = vm.envBytes32("VERIFY_FUNCTION_ID"); lightClient.updateVerifyId(verifyFunctionId); diff --git a/circuits/plonky2x/contracts/test/NearX.t.sol b/circuits/plonky2x/contracts/test/NearX.t.sol index b485a3f..e780b0b 100644 --- a/circuits/plonky2x/contracts/test/NearX.t.sol +++ b/circuits/plonky2x/contracts/test/NearX.t.sol @@ -23,11 +23,7 @@ contract NearXTest is Test { // TODO: bytes32 header = hex"A0123D5E4B8B8888A61F931EE2252D83568B97C223E0ECA9795B29B8BD8CBA2D"; uint64 requestedHeight = 10004; - bytes memory encodedInput = abi.encodePacked( - height, - header, - requestedHeight - ); + bytes memory encodedInput = abi.encodePacked(header, requestedHeight); console.logBytes(encodedInput); } } From c62c5bd45b66baca0d35f35f4f6fe6fb31816f94 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 9 Feb 2024 11:46:57 +0000 Subject: [PATCH 35/67] feat!: reference Ids in the proof verification --- .gitignore | 1 + Cargo.lock | 2 +- bin/client/src/client/message.rs | 2 +- bin/client/src/client/mod.rs | 40 +++---- bin/client/src/controller.rs | 4 - bin/operator/Cargo.toml | 6 +- bin/operator/src/main.rs | 16 ++- circuits/plonky2x/contracts/test/NearX.t.sol | 11 +- circuits/plonky2x/src/circuits/sync.rs | 7 +- circuits/plonky2x/src/circuits/verify.rs | 112 +++++++------------ circuits/plonky2x/src/hint.rs | 49 +++++--- circuits/plonky2x/src/test_utils.rs | 3 + crates/rpc/src/lib.rs | 74 +++++++----- 13 files changed, 173 insertions(+), 154 deletions(-) diff --git a/.gitignore b/.gitignore index 1fc5f51..6df420d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /vendor /build/* circuits/plonky2x/build +**input.bin .direnv diff --git a/Cargo.lock b/Cargo.lock index f4283d5..5fb2773 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3757,7 +3757,7 @@ dependencies = [ name = "near-light-client-succint-operator" version = "0.2.0" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "near-light-clientx", ] diff --git a/bin/client/src/client/message.rs b/bin/client/src/client/message.rs index e2b7ce0..b7f67c3 100644 --- a/bin/client/src/client/message.rs +++ b/bin/client/src/client/message.rs @@ -35,7 +35,7 @@ impl Message for GetProof { pub struct BatchGetProof(pub Vec); impl Message for BatchGetProof { - type Result = Option<(ExperimentalProof, Vec)>; + type Result = Option; } pub struct VerifyProof { diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 423d558..9f7ff7a 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -255,43 +255,43 @@ impl LightClient { Protocol::inclusion_proof_verify(p) } - // TODO: this and below are the same except from two lines pub async fn get_proofs(&self, req: BatchGetProof) -> Result> { let req = req.0.into_iter().map(|p| p.0).collect(); let head = self.store.head().await?; - let proofs = self - .client - .batch_fetch_proofs(&head.hash(), req, false) - .await? - .0; + let proofs = self.client.batch_fetch_proofs(&head.hash(), req).await; + let (oks, errs): (Vec<_>, Vec<_>) = proofs.into_values().partition_result(); + + if !errs.is_empty() { + return Err(anyhow::format_err!("Failed to fetch proofs: {:?}", errs)); + } self.store .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) .await?; - Ok(proofs + Ok(oks .into_iter() .map(|x| (head.inner_lite.block_merkle_root, x)) .map(Into::into) .collect()) } - pub async fn experimental_get_proofs( - &self, - req: BatchGetProof, - ) -> Result<(ExperimentalProof, Vec)> { + pub async fn experimental_get_proofs(&self, req: BatchGetProof) -> Result { let req = req.0.into_iter().map(|p| p.0).collect(); let head = self.store.head().await?; - let (proofs, errors) = self - .client - .batch_fetch_proofs(&head.hash(), req, true) - .await?; - let p = protocol::experimental::Proof::new(head.inner_lite.block_merkle_root, proofs); - self.store - .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) - .await?; + let proofs = self.client.batch_fetch_proofs(&head.hash(), req).await; - Ok((p, errors)) + let (oks, errs): (Vec<_>, Vec<_>) = proofs.into_values().partition_result(); + if !errs.is_empty() { + return Err(anyhow::format_err!("Failed to fetch proofs: {:?}", errs)); + } else { + let p = protocol::experimental::Proof::new(head.inner_lite.block_merkle_root, oks); + self.store + .insert(&[(head.inner_lite.block_merkle_root, Entity::UsedRoot)]) + .await?; + + Ok(p) + } } } diff --git a/bin/client/src/controller.rs b/bin/client/src/controller.rs index 4383da8..c8107d2 100644 --- a/bin/client/src/controller.rs +++ b/bin/client/src/controller.rs @@ -127,10 +127,6 @@ mod proof { .and_then(|x| x.ok_or_else(|| anyhow::anyhow!("Failed to get batch proof"))) .map_err(ErrorMapper) .map_err(IntoResponse::into_response) - .map(|(proofs, errors)| BatchProofWithErrors { - proofs, - errors: errors.into_iter().map(|e| e.to_string()).collect(), - }) .map(axum::Json) } } diff --git a/bin/operator/Cargo.toml b/bin/operator/Cargo.toml index 4b51c4c..ad3a43e 100644 --- a/bin/operator/Cargo.toml +++ b/bin/operator/Cargo.toml @@ -17,10 +17,12 @@ path = "src/main.rs" required-features = [ "verify" ] [dependencies] -cfg-if = "*" +cfg-if = "1.0.0" near-light-clientx.workspace = true [features] -default = [ ] +default = [ "testnet" ] +mainnet = [ ] sync = [ ] +testnet = [ ] verify = [ ] diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 0b13fc7..1caa739 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -1,7 +1,15 @@ use near_light_clientx::plonky2x::backend::function::Plonky2xFunction; // Testnet, FIXME: this is error prone, use something else -const NETWORK: usize = 1; +cfg_if::cfg_if! { + if #[cfg(feature = "mainnet")] { + const NETWORK: usize = 0; + } else if #[cfg(feature = "testnet")] { + const NETWORK: usize = 1; + } else { + panic!("provide a NETWORK feature"); + } +} fn main() { cfg_if::cfg_if! { @@ -10,7 +18,11 @@ fn main() { SyncCircuit::::entrypoint(); } else if #[cfg(feature = "verify")] { const PROOF_AMT: usize = 64; - const PROOF_BATCH_SIZE: usize = 8; + const PROOF_BATCH_SIZE: usize = 4; + + assert!(PROOF_AMT % PROOF_BATCH_SIZE == 0); + assert!(PROOF_AMT / PROOF_BATCH_SIZE.is_power_of_two()); + use near_light_clientx::VerifyCircuit; VerifyCircuit::::entrypoint(); } else { diff --git a/circuits/plonky2x/contracts/test/NearX.t.sol b/circuits/plonky2x/contracts/test/NearX.t.sol index e780b0b..0c5fa53 100644 --- a/circuits/plonky2x/contracts/test/NearX.t.sol +++ b/circuits/plonky2x/contracts/test/NearX.t.sol @@ -12,18 +12,17 @@ contract NearXTest is Test { } function testGetEncodePackedSync() public view { - uint64 height = 10000; // TODO: - bytes32 header = hex"A0123D5E4B8B8888A61F931EE2252D83568B97C223E0ECA9795B29B8BD8CBA2D"; - bytes memory encodedInput = abi.encodePacked(height, header); + bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + bytes memory encodedInput = abi.encodePacked(header); console.logBytes(encodedInput); } function testGetEncodePackedVerify() public view { // TODO: - bytes32 header = hex"A0123D5E4B8B8888A61F931EE2252D83568B97C223E0ECA9795B29B8BD8CBA2D"; - uint64 requestedHeight = 10004; - bytes memory encodedInput = abi.encodePacked(header, requestedHeight); + bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + + bytes memory encodedInput = abi.encodePacked(header); console.logBytes(encodedInput); } } diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index 22c0a04..1d45e80 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -23,9 +23,11 @@ impl Circuit for SyncCircuit { plonky2::plonk::config::AlgebraicHasher<>::Field>, { let trusted_header_hash = b.evm_read::(); + b.watch(&trusted_header_hash, "trusted_header_hash"); let untrusted = FetchHeaderInputs(NETWORK.into()).fetch(b, &trusted_header_hash); let untrusted_hash = untrusted.hash(b); + b.watch(&untrusted_hash, "untrusted_hash"); b.assert_is_equal(trusted_header_hash, untrusted_hash); let head = untrusted; @@ -82,9 +84,7 @@ mod beefy_tests { use serial_test::serial; use super::*; - use crate::test_utils::{builder_suite, testnet_state, B, PI, PO}; - - const NETWORK: usize = 1; + use crate::test_utils::{builder_suite, testnet_state, B, NETWORK, PI, PO}; #[test] #[serial] @@ -100,6 +100,7 @@ mod beefy_tests { }; let assertions = |mut output: PO| { let hash = output.evm_read::(); + println!("hash: {:?}", hash); }; builder_suite(define, writer, assertions); } diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index 3af2fdd..c715938 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -1,27 +1,27 @@ +use near_light_client_protocol::prelude::Itertools; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use plonky2x::{ - frontend::{hint::simple::hint::Hint, mapreduce::generator::MapReduceDynamicGenerator}, + frontend::hint::simple::hint::Hint, prelude::plonky2::plonk::config::{AlgebraicHasher, GenericConfig}, }; use serde::{Deserialize, Serialize}; use crate::{ builder::Verify, - hint::FetchProofInputs, - variables::{ - BlockHeightVariable, EncodeInner, HeaderVariable, ProofVariable, - TransactionOrReceiptIdVariable, - }, + hint::{FetchProofInputs, ProofInputVariable}, + variables::{CryptoHashVariable, EncodeInner, HeaderVariable, TransactionOrReceiptIdVariable}, }; +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofVerificationResultVariable { + pub id: CryptoHashVariable, + pub result: BoolVariable, +} + // TODO: improve the way we can lookup the transaction, ideally map // TransactionOrReceiptId => Proof and map this way, now we are not limited by // the data transformation -#[derive(CircuitVariable, Debug, Clone)] -pub struct ProofMapReduceVariable { - pub height_indices: ArrayVariable, - pub results: ArrayVariable, -} +pub type ProofMapReduceVariable = ArrayVariable; #[derive(Debug, Clone)] pub struct VerifyCircuit; @@ -36,7 +36,6 @@ impl Circuit { let trusted_head = b.read::(); let ids = b.read::>(); - println!("len of ids: {}", ids.data.len()); let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); @@ -45,29 +44,25 @@ impl Circuit (), proofs.data, |_, proofs, b| { - let mut heights = vec![]; let mut results = vec![]; // TODO[Optimisation]: could parallelise these - for p in proofs.data { - heights.push(p.block_header.inner_lite.height); - results.push(b.verify(p)); + for ProofInputVariable { id, proof } in proofs.data { + let result = b.verify(proof); + results.push(ProofVerificationResultVariable { id, result }); } - b.watch_slice(&heights, "map job -- heights"); - b.watch_slice(&results, "map job -- results"); - - let zero = b.zero::(); + let zero = b.constant::([0u8; 32].into()); let _false = b._false(); - heights.resize(N, zero); - results.resize(N, _false); - - let state = ProofMapReduceVariable:: { - height_indices: heights.into(), - results: results.into(), - }; - - state + results.resize( + N, + ProofVerificationResultVariable { + id: zero, + result: _false, + }, + ); + + results.into() }, |_, l, r, b| MergeProofHint::.merge(b, &l, &r), ); @@ -114,24 +109,21 @@ impl, const D: usize, const N: usize> Hint for Merge let left = input_stream.read_value::>(); let right = input_stream.read_value::>(); - let (mut height_indices, mut results): (Vec<_>, Vec<_>) = left - .height_indices - .iter() - .chain(right.height_indices.iter()) - .zip(left.results.iter().chain(right.results.iter())) - .filter_map(|(h, r)| if *h != 0 { Some((*h, *r)) } else { None }) - .unzip(); - - height_indices.resize(N, 0); - results.resize(N, false); + let mut results = left + .into_iter() + .chain(right.into_iter()) + .filter_map(|r| if r.id.0 != [0u8; 32] { Some(r) } else { None }) + .collect_vec(); - output_stream.write_value::>(ProofMapReduceVariableValue::< + results.resize( N, - L::Field, - > { - height_indices, - results, - }) + ProofVerificationResultVariableValue:: { + id: [0u8; 32].into(), + result: false, + }, + ); + + output_stream.write_value::>(results.into()); } } @@ -157,22 +149,17 @@ mod beefy_tests { use std::str::FromStr; use ::test_utils::CryptoHash; - use near_light_client_protocol::{ - prelude::{Header, Itertools}, - BlockHeaderInnerLite, BlockHeaderInnerLiteView, - }; + use near_light_client_protocol::prelude::Itertools; use near_primitives::types::TransactionOrReceiptId; use serial_test::serial; use test_utils::fixture; use super::*; use crate::{ - test_utils::{builder_suite, testnet_state, B, PI, PO}, + test_utils::{builder_suite, testnet_state, B, NETWORK, PI, PO}, variables::TransactionOrReceiptIdVariableValue, }; - const NETWORK: usize = 1; - #[test] #[serial] fn beefy_test_verify_e2e() { @@ -205,27 +192,6 @@ mod beefy_tests { "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", "priceoracle.testnet", ), - // rx("3UzHjFP8hVR2P6JJHwWchhcXPUV3vuPCDhtdWK7JmTy9", "system"), - // tx( - // "3V1qYGZe9NBc4EQjg5RzM5CrDiRgxqbQsYaRvMTyU4UR", - // "hotwallet.dev-kaiching.testnet", - // ), - // rx( - // "CjaBC9EJE2eYg1vAy6sjJWpzgAroMv7tbFkhyz5Nhk3h", - // "wallet.dev-kaiching.testnet", - // ), - // tx( - // "4VqSnHtFPGsgRJ7f4iz75bibCfbEiqYjnyEdentUyvbr", - // "operator_manager.orderly.testnet", - // ), - // tx( - // "FTLQF8KxwThbfriNk8jNHJsmNk9mteXwQ71Q6hc7JLbg", - // "operator-manager.orderly-qa.testnet", - // ), - // tx( - // "4VvKfzUzQVA6zNSSG1CZRbiTe4QRz5rwAzcZadKi1EST", - // "operator-manager.orderly-dev.testnet", - // ), ] .into_iter() .map(Into::into) diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index ea0c43b..a9166e1 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use async_trait::async_trait; use near_light_client_protocol::{prelude::CryptoHash, Proof}; use near_light_client_rpc::{prelude::GetProof, LightClientRpc, NearRpcClient, Network}; @@ -117,32 +119,39 @@ impl, const D: usize, const B: usize> AsyncHint } let proofs = client - .batch_fetch_proofs(&CryptoHash(last_verified), reqs, false) + .batch_fetch_proofs(&CryptoHash(last_verified), reqs) .await - .expect("Failed to fetch proofs") - .0; + .into_iter() + .map(|(k, p)| (k, p.expect("Failed to fetch proof"))) + .map(|(k, p)| { + ( + k, + Proof::Basic { + proof: Box::new(p), + head_block_root: CryptoHash(block_merkle_root), + }, + ) + }) + .collect::>(); + assert_eq!(proofs.len(), B, "Invalid number of proofs"); log::info!("Fetched {} proofs", proofs.len()); - for p in proofs.into_iter() { - output_stream.write_value::( - Proof::Basic { - proof: Box::new(p), - head_block_root: CryptoHash(block_merkle_root), - } - .into(), - ); + for (k, p) in proofs.into_iter() { + output_stream.write_value::(k.0.into()); + output_stream.write_value::(p.into()); } } } + impl FetchProofInputs { pub fn fetch, const D: usize>( self, b: &mut CircuitBuilder, head: &HeaderVariable, reqs: &[TransactionOrReceiptIdVariable], - ) -> ArrayVariable { + ) -> ArrayVariable { let mut input_stream = VariableStream::new(); input_stream.write::(&head.inner_lite.block_merkle_root); @@ -150,11 +159,23 @@ impl FetchProofInputs { input_stream.write_slice::(reqs); let output_stream = b.async_hint(input_stream, self); - let proofs = output_stream.read_vec::(b, N); - proofs.into() + let mut inputs = vec![]; + for _ in 0..N { + inputs.push(ProofInputVariable { + id: output_stream.read::(b), + proof: output_stream.read::(b), + }); + } + inputs.into() } } +#[derive(CircuitVariable, Debug, Clone)] +pub struct ProofInputVariable { + pub id: CryptoHashVariable, + pub proof: ProofVariable, +} + #[cfg(test)] mod tests { use super::*; diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index 05f6819..30f30cc 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -7,6 +7,9 @@ pub use plonky2x::{ }; pub use test_utils::*; +// Testnet Repr +pub const NETWORK: usize = 1; + pub type B = CircuitBuilder; pub type PI = PublicInput; pub type PO = PublicOutput; diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 51d4f95..3342dfd 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -1,10 +1,13 @@ -use std::fmt::{Display, Formatter}; +use std::{ + collections::HashMap, + fmt::{Display, Formatter}, +}; use async_trait::async_trait; use futures::TryFutureExt; use near_jsonrpc_client::{ methods::{self, light_client_proof::RpcLightClientExecutionProofResponse}, - JsonRpcClient, + JsonRpcClient, MethodCallResult, }; use near_primitives::{ block_header::BlockHeader, @@ -93,36 +96,32 @@ impl NearRpcClient { &self, last_verified_hash: &CryptoHash, reqs: Vec, - collect_errors: bool, - ) -> Result<(Vec, Vec)> { + ) -> HashMap> { let mut futs = vec![]; for req in reqs { - let proof = self.fetch_light_client_proof(req, *last_verified_hash); - futs.push(proof); + futs.push(Box::pin(async { + ( + match req { + near_primitives::types::TransactionOrReceiptId::Transaction { + transaction_hash, + .. + } => transaction_hash, + near_primitives::types::TransactionOrReceiptId::Receipt { + receipt_id, + .. + } => receipt_id, + }, + self.fetch_light_client_proof(req, *last_verified_hash) + .await, + ) + })); } - let unpin_futs: Vec<_> = futs.into_iter().map(Box::pin).collect(); - let proofs: Vec> = futures::future::join_all(unpin_futs).await; - let (proofs, errors): (Vec<_>, Vec<_>) = if collect_errors { - proofs.into_iter().partition_result() - } else { - (proofs.into_iter().collect::>>()?, vec![]) - }; - Ok((proofs, errors)) - } - pub async fn fetch_header(&self, hash: &CryptoHash) -> Result
{ - let req = methods::block::RpcBlockRequest { - block_reference: near_primitives::types::BlockReference::BlockId( - near_primitives::types::BlockId::Hash(*hash), - ), - }; - self.client - .call(&req) - .await - .map_err(|e| anyhow!(e)) - .map(|x| x.header) - .map(BlockHeader::from) - .map(Into::into) + let proofs: Vec<(CryptoHash, Result)> = futures::future::join_all(futs).await; + proofs.into_iter().fold(HashMap::new(), |mut acc, (r, p)| { + acc.insert(r, p); + acc + }) } } @@ -138,10 +137,29 @@ pub trait LightClientRpc { latest_verified: CryptoHash, ) -> Result; async fn fetch_epoch_bps(&self, epoch_id: &CryptoHash) -> Result>; + async fn fetch_header(&self, hash: &CryptoHash) -> Result
; } #[async_trait] impl LightClientRpc for NearRpcClient { + async fn fetch_header(&self, hash: &CryptoHash) -> Result
{ + let req = methods::block::RpcBlockRequest { + block_reference: near_primitives::types::BlockReference::BlockId( + near_primitives::types::BlockId::Hash(*hash), + ), + }; + self.client + .call(&req) + .or_else(|e| { + trace!("Error hitting main rpc, falling back to archive: {:?}", e); + self.archive.call(&req) + }) + .await + .map_err(|e| anyhow!(e)) + .map(|x| x.header) + .map(BlockHeader::from) + .map(Into::into) + } async fn fetch_latest_header( &self, latest_verified: &CryptoHash, From 94a4442793faacd47b60d12a1fca2c294b17f36f Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 9 Feb 2024 11:49:40 +0000 Subject: [PATCH 36/67] chore: test parameters --- Makefile | 17 ++++++++++ bin/operator/src/main.rs | 6 ++-- circuits/plonky2x/input.bin | 1 - circuits/plonky2x/src/circuits/sync.rs | 2 +- circuits/plonky2x/src/circuits/verify.rs | 14 +++++++- circuits/plonky2x/src/test_utils.rs | 42 ++++++++++++++++++++++-- succinct.json | 4 +-- 7 files changed, 76 insertions(+), 10 deletions(-) delete mode 100644 circuits/plonky2x/input.bin diff --git a/Makefile b/Makefile index 7de0c96..da531fb 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,20 @@ IMAGE_TAG?=0.0.1 docker: DOCKER_BUILDKIT=1 docker build --progress=plain -t $(TAG_PREFIX)/light-client:$(IMAGE_TAG) . + +BUILDCIRCUIT := cargo build --release --bin +MVCIRCUIT := mv -f target/release + +build-sync-circuit: + $(BUILDCIRCUIT) sync --features=sync + $(MVCIRCUIT)/sync build/ + RUST_LOG=debug ./build/sync build +.PHONY: build-sync-circuit + +# TODO: build various parameters of NUM:BATCH, e.g 1024x64 2x1, 128x4, etc +build-verify-circuit: + $(BUILDCIRCUIT) verify --features=verify + $(MVCIRCUIT)/verify build/ + RUST_LOG=debug ./build/verify build +.PHONY: build-verify-circuit + diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 1caa739..8f73b8b 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -17,11 +17,11 @@ fn main() { use near_light_clientx::SyncCircuit; SyncCircuit::::entrypoint(); } else if #[cfg(feature = "verify")] { - const PROOF_AMT: usize = 64; - const PROOF_BATCH_SIZE: usize = 4; + const PROOF_AMT: usize = 2; + const PROOF_BATCH_SIZE: usize = 1; assert!(PROOF_AMT % PROOF_BATCH_SIZE == 0); - assert!(PROOF_AMT / PROOF_BATCH_SIZE.is_power_of_two()); + assert!((PROOF_AMT / PROOF_BATCH_SIZE).is_power_of_two()); use near_light_clientx::VerifyCircuit; VerifyCircuit::::entrypoint(); diff --git a/circuits/plonky2x/input.bin b/circuits/plonky2x/input.bin deleted file mode 100644 index a26284a..0000000 --- a/circuits/plonky2x/input.bin +++ /dev/null @@ -1 +0,0 @@ -0x44cf18d28ab7b9f7f5adb3cf3fd6d8a2a4f93f8fdad01a9e86ae4b5b2b17836fba9c6629085351fbea47cdc2851d8f76c940dcba41702fb91a4b832857734ce8000000000937d838dce68dd6fb22e016c8405dfbfdc90f4a9cef98e5fb3c7afc0e1f46a2b5e11022daf909af5b24b30011f952baccbdab560b1e16bd2d16efabb9f2ee3ffee398fad05d5c913e8db18af4d1fda9f2a18595ac481a324b9f94b02abc18595a39ad365fb163b24a02808b1fe26cd012313376d914a7e58017c722062aba155f9a078117aa90ce2853e1558ec8ea8e1910a48364bfb4faf1085779ad3f4311ff5b7af12c8f20a0ad34a56928328499c4518899bcc03deb1eb9b8247f88c65d6c0cf8cd4b46cf5bce18a0e2 \ No newline at end of file diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index 1d45e80..206946c 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -49,7 +49,6 @@ impl Circuit for SyncCircuit { b.watch(&bps_hash, "calculate_bps_hash"); let synced = b.sync(&head, &bps, &next_block); - b.watch(&synced.new_head, "new_head"); let synced_hash = synced.new_head.hash(b); b.evm_write::(synced_hash); } @@ -60,6 +59,7 @@ impl Circuit for SyncCircuit { plonky2::plonk::config::AlgebraicHasher, { registry.register_async_hint::(); + registry.register_async_hint::(); registry.register_hint::(); registry.register_hint::(); registry.register_hint::(); diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index c715938..d4edd99 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -1,7 +1,7 @@ use near_light_client_protocol::prelude::Itertools; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use plonky2x::{ - frontend::hint::simple::hint::Hint, + frontend::{hint::simple::hint::Hint, mapreduce::generator::MapReduceDynamicGenerator}, prelude::plonky2::plonk::config::{AlgebraicHasher, GenericConfig}, }; use serde::{Deserialize, Serialize}; @@ -78,6 +78,18 @@ impl Circuit // We hash in verify registry.register_hint::(); + + let dynamic_id = MapReduceDynamicGenerator::::id(); + + registry.register_simple::, + ProofMapReduceVariable, + Self, + B, + D, + >>(dynamic_id); } } diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index 30f30cc..bdb1d30 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -1,6 +1,8 @@ +use std::fs; pub use std::str::FromStr; pub use near_primitives::hash::CryptoHash; +use plonky2x::backend::function::{BytesRequestData, ProofRequest}; pub use plonky2x::{ backend::circuit::{PublicInput, PublicOutput}, prelude::*, @@ -33,8 +35,44 @@ pub fn builder_suite( let mut inputs = circuit.input(); writer(&mut inputs); - if let PublicInput::Bytes(bytes) = &mut inputs { - std::fs::write("input.bin", hex!(bytes)).unwrap(); + match &inputs { + PublicInput::Bytes(bytes) => { + let req = ProofRequest::::Bytes( + plonky2x::backend::function::ProofRequestBase { + release_id: "todo".to_string(), + parent_id: None, + files: None, + data: BytesRequestData { + input: bytes.clone(), + }, + }, + ); + fs::write( + "../../fixtures/input.bytes", + serde_json::to_string(&req).unwrap(), + ) + .unwrap(); + } + PublicInput::Elements(elements) => { + println!("Writing input.elements.json"); + let req = ProofRequest::::Elements( + plonky2x::backend::function::ProofRequestBase { + release_id: "todo".to_string(), + parent_id: None, + files: None, + data: plonky2x::backend::function::ElementsRequestData { + circuit_id: "todo".to_string(), + input: elements.clone(), + }, + }, + ); + fs::write( + "../../fixtures/input.elements.json", + serde_json::to_string(&req).unwrap(), + ) + .unwrap(); + } + _ => {} } let (proof, output) = circuit.prove(&inputs); diff --git a/succinct.json b/succinct.json index 105efea..15389d1 100644 --- a/succinct.json +++ b/succinct.json @@ -4,7 +4,7 @@ "name": "sync", "framework": "plonky2x", "baseDir": ".", - "buildCommand": "cargo build --release --bin sync --features=sync && mv target/release/sync build/ && RUST_LOG=debug ./build/sync build", + "buildCommand": "make build-sync-circuit", "proveCommand": "RUST_LOG=debug ./build/sync prove input.json", "requiredArtifacts": [ "sync" @@ -14,7 +14,7 @@ "name": "verify", "framework": "plonky2x", "baseDir": ".", - "buildCommand": "cargo build --release --bin verify --features=verify && mv target/release/verify build/ && RUST_LOG=debug ./build/verify build", + "buildCommand": "make build-verify-circuit", "proveCommand": "RUST_LOG=debug ./build/verify prove input.json", "requiredArtifacts": [ "verify" From 4b3015f3ec82d2158e9332a0403cd909f90d2947 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 9 Feb 2024 15:58:42 +0000 Subject: [PATCH 37/67] wip: use evm IO --- Cargo.lock | 3 +- circuits/plonky2x/src/circuits/verify.rs | 40 ++++++-- circuits/plonky2x/src/test_utils.rs | 1 - circuits/plonky2x/src/variables.rs | 121 ++++++++++++++++++++++- 4 files changed, 152 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5fb2773..94b9cea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4902,7 +4902,6 @@ source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b [[package]] name = "plonky2x" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#c3c5a10a5bd60838b7749d55c79a9816dd05c21b" dependencies = [ "anyhow", "array-macro", @@ -4928,6 +4927,7 @@ dependencies = [ "num-bigint 0.4.4", "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", "plonky2x-derive", + "pretty_assertions", "rand 0.8.5", "reqwest", "serde", @@ -4944,7 +4944,6 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" -source = "git+https://github.com/succinctlabs/succinctx.git#c3c5a10a5bd60838b7749d55c79a9816dd05c21b" dependencies = [ "proc-macro2", "quote", diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index d4edd99..92d8245 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -9,7 +9,10 @@ use serde::{Deserialize, Serialize}; use crate::{ builder::Verify, hint::{FetchProofInputs, ProofInputVariable}, - variables::{CryptoHashVariable, EncodeInner, HeaderVariable, TransactionOrReceiptIdVariable}, + variables::{ + byte_from_bool, CryptoHashVariable, EncodeInner, HeaderVariable, + TransactionOrReceiptIdVariable, + }, }; #[derive(CircuitVariable, Debug, Clone)] @@ -34,10 +37,13 @@ impl Circuit <>::Config as GenericConfig>::Hasher: AlgebraicHasher<>::Field>, { - let trusted_head = b.read::(); - let ids = b.read::>(); + let trusted_head = b.evm_read::(); + let mut ids = vec![]; + for _ in 0..N { + ids.push(b.evm_read::()); + } - let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids.data); + let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids); // TODO: write some outputs here for each ID let output = b.mapreduce_dynamic::<_, _, _, Self, B, _, _>( @@ -66,7 +72,12 @@ impl Circuit }, |_, l, r, b| MergeProofHint::.merge(b, &l, &r), ); - b.write::>(output); + for r in output.data { + b.evm_write::(r.id); + let _true = b._true(); + let passed = byte_from_bool(b, r.result); + b.evm_write::(passed); + } } fn register_generators, const D: usize>(registry: &mut HintRegistry) @@ -90,6 +101,8 @@ impl Circuit B, D, >>(dynamic_id); + + // TODO: register_watch_generator! } } @@ -215,11 +228,22 @@ mod beefy_tests { VerifyCircuit::::define(b); }; let writer = |input: &mut PI| { - input.write::(header.into()); - input.write::>(txs.into()); + input.evm_write::(header.into()); + for tx in txs { + input.evm_write::(tx.into()); + } }; let assertions = |mut output: PO| { - println!("{:#?}", output.read::>()); + let mut results = vec![]; + for _ in 0..AMT { + let id = output.evm_read::(); + let result = output.evm_read::(); + results.push(ProofVerificationResultVariableValue:: { + id, + result: result != 0, + }); + } + println!("{:#?}", results); }; builder_suite(define, writer, assertions); } diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index bdb1d30..30b1563 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -54,7 +54,6 @@ pub fn builder_suite( .unwrap(); } PublicInput::Elements(elements) => { - println!("Writing input.elements.json"); let req = ProofRequest::::Elements( plonky2x::backend::function::ProofRequestBase { release_id: "todo".to_string(), diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index f9eb043..03ff292 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -409,7 +409,11 @@ impl From for ValidatorStakeVariableValue { } pub(crate) fn pad_account_id(account_id: &AccountId) -> [u8; AccountId::MAX_LEN] { - let mut account_id = account_id.as_str().as_bytes().to_vec(); + let account_id = account_id.as_str().as_bytes().to_vec(); + pad_account_bytes(account_id) +} + +pub(crate) fn pad_account_bytes(mut account_id: Vec) -> [u8; AccountId::MAX_LEN] { account_id.resize(AccountId::MAX_LEN, ACCOUNT_ID_PADDING_BYTE); account_id.try_into().expect("invalid account bytes") } @@ -658,12 +662,125 @@ impl From for TransactionOrReceiptIdVariableValue { } } +pub fn byte_from_bool, const D: usize>( + b: &mut CircuitBuilder, + bool: BoolVariable, +) -> ByteVariable { + let zero = b._false(); + let mut bits = [zero; 8]; + bits[7] = bool.into(); + + ByteVariable::from_be_bits(bits) +} + +impl EvmVariable for TransactionOrReceiptIdVariable { + fn encode, const D: usize>( + &self, + builder: &mut CircuitBuilder, + ) -> Vec { + let mut bytes = vec![]; + bytes.extend_from_slice(&byte_from_bool(builder, self.is_transaction).encode(builder)); + bytes.extend_from_slice(&self.id.encode(builder)); + bytes.extend_from_slice(&self.account.encode(builder)); + bytes + } + + fn decode, const D: usize>( + builder: &mut CircuitBuilder, + bytes: &[ByteVariable], + ) -> Self { + let zero = builder.zero::(); + let is_receipt = builder.is_equal(bytes[0], zero); + let is_transaction = builder.not(is_receipt); + Self { + is_transaction, + id: CryptoHashVariable::decode(builder, &bytes[1..33]), + account: AccountIdVariable::decode(builder, &bytes[33..33 + AccountId::MAX_LEN]), + } + } + fn encode_value(value: Self::ValueType) -> Vec { + let mut bytes = vec![value.is_transaction as u8]; + bytes.extend_from_slice(&CryptoHashVariable::encode_value::(value.id)); + bytes.extend_from_slice(&AccountIdVariable::encode_value::(pad_account_bytes( + value.account.to_vec(), + ))); + bytes + } + fn decode_value(bytes: &[u8]) -> Self::ValueType { + assert_eq!(bytes.len(), 1 + 32 + AccountId::MAX_LEN); + + Self::ValueType { + is_transaction: bytes[0] != 0, + id: CryptoHashVariable::decode_value::(&bytes[1..33]), + account: AccountIdVariable::decode_value::(&bytes[33..33 + AccountId::MAX_LEN]), + } + } +} #[cfg(test)] mod tests { + use std::str::FromStr; + + use ::test_utils::CryptoHash; + use near_light_client_protocol::prelude::Itertools; + use near_primitives::types::TransactionOrReceiptId; + use serial_test::serial; + use test_utils::fixture; + use super::*; + use crate::{ + test_utils::{builder_suite, testnet_state, B, NETWORK, PI, PO}, + variables::TransactionOrReceiptIdVariableValue, + }; + + #[test] + fn test_serialise_tx() { + fn tx(hash: &str, sender: &str) -> TransactionOrReceiptId { + TransactionOrReceiptId::Transaction { + transaction_hash: CryptoHash::from_str(hash).unwrap(), + sender_id: sender.parse().unwrap(), + } + } + fn rx(hash: &str, receiver: &str) -> TransactionOrReceiptId { + TransactionOrReceiptId::Receipt { + receipt_id: CryptoHash::from_str(hash).unwrap(), + receiver_id: receiver.parse().unwrap(), + } + } + + // TODO: test way more of these, pull the last 64 transactions and prove them + let txs: Vec> = vec![ + tx( + "3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz", + "zavodil.testnet", + ), + rx( + "9cVuYLKYF26QevZ315RLb9ArU3gbcgPc4LDRJfZQyZHo", + "priceoracle.testnet", + ), + ] + .into_iter() + .map(Into::into) + .collect_vec(); + + let define = |b: &mut B| { + let receipt = b.evm_read::(); + b.evm_write::(receipt); + let tx = b.evm_read::(); + b.evm_write::(tx); + }; + let writer = |input: &mut PI| { + input.evm_write::(txs[0].clone().into()); + input.evm_write::(txs[1].clone().into()); + }; + let assertions = |mut output: PO| { + println!("{:#?}", output.evm_read::()); + println!("{:#?}", output.evm_read::()); + }; + builder_suite(define, writer, assertions); + } #[test] - fn tests() { + fn test_encode_transaction() { todo!() } } From cf3f4a34bc14524fd27deef376793a67a43f5f07 Mon Sep 17 00:00:00 2001 From: dndll Date: Mon, 12 Feb 2024 10:40:47 +0000 Subject: [PATCH 38/67] fix: dependency hell --- .gitignore | 1 - .gitmodules | 6 + .taplo.toml | 2 +- Cargo.lock | 2087 ++++++++-------------------------------------- Cargo.toml | 23 +- vendor/starkyx | 1 + vendor/succinctx | 1 + 7 files changed, 387 insertions(+), 1734 deletions(-) create mode 160000 vendor/starkyx create mode 160000 vendor/succinctx diff --git a/.gitignore b/.gitignore index 6df420d..3652aea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ **/target -/vendor /build/* circuits/plonky2x/build **input.bin diff --git a/.gitmodules b/.gitmodules index 7ba2fc1..817cb6f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ [submodule "circuits/plonky2x/contracts/forge/lib/forge-std"] path = circuits/plonky2x/contracts/forge/lib/forge-std url = https://github.com/foundry-rs/forge-std +[submodule "vendor/starkyx"] + path = vendor/starkyx + url = git@github.com:succinctlabs/starkyx.git +[submodule "vendor/succinctx"] + path = vendor/succinctx + url = git@github.com:succinctlabs/succinctx.git diff --git a/.taplo.toml b/.taplo.toml index 2d196b7..363d372 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -16,4 +16,4 @@ compact_arrays = false # Alphabetically reorder keys that are not separated by empty lines. reorder_keys = true -exclude = [ "vendor/*", "build/*", ".direnv/*" ] +exclude = [ "vendor/**", "build/**", ".direnv/**" ] diff --git a/Cargo.lock b/Cargo.lock index 94b9cea..72723db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "actix" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cba56612922b907719d4a01cf11c8d5b458e7d3dba946d0435f20f58d6795ed2" +checksum = "fb72882332b6d6282f428b77ba0358cb2687e61a6f6df6a6d3871e8a177c2d4f" dependencies = [ "actix-macros", "actix-rt", @@ -100,16 +100,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher 0.4.4", "cpufeatures", ] [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom 0.2.12", "once_cell", @@ -118,26 +118,17 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "const-random", "once_cell", "version_check", "zerocopy", ] -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -199,9 +190,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -252,18 +243,6 @@ version = "2.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "220a2c618ab466efe41d0eace94dfeff1c35e3aa47891bdb95e1c0fefffd3c99" -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.4" @@ -340,7 +319,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version 0.4.0", + "rustc_version", ] [[package]] @@ -356,14 +335,13 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -484,7 +462,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -580,38 +558,13 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "blake3" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", + "generic-array", ] [[package]] @@ -620,23 +573,10 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ - "borsh-derive 1.3.1", + "borsh-derive", "cfg_aliases", ] -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "borsh-derive" version = "1.3.1" @@ -651,28 +591,6 @@ dependencies = [ "syn_derive", ] -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "brotli" version = "3.4.0" @@ -722,28 +640,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "bytecheck" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -810,9 +706,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" dependencies = [ "serde", ] @@ -825,7 +721,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.21", + "semver", "serde", "serde_json", "thiserror", @@ -841,12 +737,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -861,9 +751,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -871,7 +761,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -880,7 +770,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -895,9 +785,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -905,21 +795,21 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -929,18 +819,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "cloudabi" -version = "0.0.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags 1.3.2", -] +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "coerce" @@ -1020,7 +901,7 @@ dependencies = [ "bech32", "bs58 0.5.0", "digest 0.10.7", - "generic-array 0.14.7", + "generic-array", "hex", "ripemd", "serde", @@ -1057,11 +938,11 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +checksum = "18d59688ad0945eaf6b84cb44fedbe93484c81b48970e98f09db8a22832d7961" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "hex", "proptest", @@ -1122,15 +1003,6 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" -[[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "cpufeatures" version = "0.2.12" @@ -1140,122 +1012,13 @@ dependencies = [ "libc", ] -[[package]] -name = "cranelift-bforest" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5bb9245ec7dcc04d03110e538d31f0969d301c9d673145f4b4d5c3478539a3" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-codegen" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebb18d10e5ddac43ba4ca8fd4e310938569c3e484cc01b6372b27dc5bb4dfd28" -dependencies = [ - "bumpalo", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", - "gimli", - "hashbrown 0.14.3", - "log", - "regalloc2", - "smallvec", - "target-lexicon 0.12.13", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3ce6d22982c1b9b6b012654258bab1a13947bb12703518bef06b1a4867c3d6" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47220fd4f9a0ce23541652b6f16f83868d282602c600d14934b2a4c166b4bd80" - -[[package]] -name = "cranelift-control" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5a4c42672aea9b6e820046b52e47a1c05d3394a6cdf4cb3c3c4b702f954bd2" -dependencies = [ - "arbitrary", -] - -[[package]] -name = "cranelift-entity" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b4e9a3296fc827f9d35135dc2c0c8dd8d8359eb1ef904bae2d55d5bcb0c9f94" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "cranelift-frontend" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ec537d0f0b8e084517f3e7bfa1d89af343d7c7df455573fca9f272d4e01267" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon 0.12.13", -] - -[[package]] -name = "cranelift-isle" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bab6d69919d210a50331d35cc6ce111567bc040aebac63a8ae130d0400a075" - -[[package]] -name = "cranelift-native" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f32e81605f352cf37af5463f11cd7deec7b6572741931a8d372f7fdd4a744f5d" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon 0.12.13", -] - -[[package]] -name = "cranelift-wasm" -version = "0.101.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edaa4cbec1bc787395c074233df2652dd62f3e29d3ee60329514a0a51e6b045" -dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", - "itertools 0.10.5", - "log", - "smallvec", - "wasmparser 0.115.0", - "wasmtime-types", -] - [[package]] name = "crc32fast" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1286,15 +1049,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.19" @@ -1313,7 +1067,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "generic-array 0.14.7", + "generic-array", "rand_core 0.6.4", "subtle", "zeroize", @@ -1325,7 +1079,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.7", + "generic-array", "typenum", ] @@ -1335,7 +1089,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.7", + "generic-array", "subtle", ] @@ -1351,7 +1105,7 @@ dependencies = [ [[package]] name = "curta" version = "0.1.0" -source = "git+https://github.com/succinctlabs/curta.git#ebbd97c0f4f91bfa792fa5746e1d3f5334316189" +source = "git+https://github.com/dndll/starkyx.git#7f676e81dcf13393d9ca3bb825bf8e2a7c046cba" dependencies = [ "anyhow", "bincode", @@ -1361,7 +1115,7 @@ dependencies = [ "itertools 0.10.5", "log", "num", - "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", "plonky2_maybe_rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.8.5", "serde", @@ -1374,14 +1128,14 @@ version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", "platforms", "rand_core 0.6.4", - "rustc_version 0.4.0", + "rustc_version", "subtle", "zeroize", ] @@ -1399,9 +1153,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" dependencies = [ "darling_core", "darling_macro", @@ -1409,23 +1163,23 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 2.0.48", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" dependencies = [ "darling_core", "quote", @@ -1438,9 +1192,9 @@ version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "hashbrown 0.14.3", - "lock_api 0.4.11", + "lock_api", "once_cell", "parking_lot_core 0.9.9", ] @@ -1451,15 +1205,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid 1.7.0", -] - [[package]] name = "der" version = "0.7.8" @@ -1500,7 +1245,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", + "rustc_version", "syn 1.0.109", ] @@ -1510,22 +1255,13 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -1564,7 +1300,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "dirs-sys-next", ] @@ -1602,12 +1338,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dissimilar" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" - [[package]] name = "dlv-list" version = "0.3.0" @@ -1626,59 +1356,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" -[[package]] -name = "dynasm" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dynasm" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33dc03612f42465a8ed7f5e354bc2b79ba54cedefa81d5bd3a064f1835adaba8" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dynasmrt" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" -dependencies = [ - "byteorder", - "dynasm 1.2.3", - "memmap2", -] - -[[package]] -name = "dynasmrt" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7dccc31a678058996aef614f6bd418ced384da70f284e83e2b7bf29b27b6a28" -dependencies = [ - "byteorder", - "dynasm 2.0.0", - "fnv", - "memmap2", -] - [[package]] name = "easy-ext" version = "0.2.9" @@ -1711,9 +1388,9 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", @@ -1726,9 +1403,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" dependencies = [ "serde", ] @@ -1743,7 +1420,7 @@ dependencies = [ "crypto-bigint", "digest 0.10.7", "ff", - "generic-array 0.14.7", + "generic-array", "group", "pkcs8", "rand_core 0.6.4", @@ -1767,7 +1444,7 @@ version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1814,27 +1491,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "enumset" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "env_logger" version = "0.9.3" @@ -1869,35 +1525,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.2.8" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", "windows-sys 0.52.0", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eth-keystore" version = "0.5.0" @@ -1970,9 +1605,9 @@ dependencies = [ [[package]] name = "ethers" -version = "2.0.11" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5344eea9b20effb5efeaad29418215c4d27017639fd1f908260f59cbbd226e" +checksum = "6c7cd562832e2ff584fa844cd2f6e5d4f35bbe11b28c7c9b8df957b2e1d0c701" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1986,9 +1621,9 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf35eb7d2e2092ad41f584951e08ec7c077b142dba29c4f1b8f52d2efddc49c" +checksum = "35dc9a249c066d17e8947ff52a4116406163cf92c7f0763cb8c001760b26403f" dependencies = [ "ethers-core", "once_cell", @@ -1998,9 +1633,9 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "2.0.11" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0111ead599d17a7bff6985fd5756f39ca7033edc79a31b23026a8d5d64fa95cd" +checksum = "43304317c7f776876e47f2f637859f6d0701c1ec7930a150f169d5fbe7d76f5a" dependencies = [ "const-hex", "ethers-contract-abigen", @@ -2017,9 +1652,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbdfb952aafd385b31d316ed80d7b76215ce09743c172966d840e96924427e0c" +checksum = "f9f96502317bf34f6d71a3e3d270defaa9485d754d789e15a8e04a84161c95eb" dependencies = [ "Inflector", "const-hex", @@ -2035,15 +1670,15 @@ dependencies = [ "serde", "serde_json", "syn 2.0.48", - "toml 0.8.8", + "toml 0.8.10", "walkdir", ] [[package]] name = "ethers-contract-derive" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7465c814a2ecd0de0442160da13584205d1cdc08f4717a6511cad455bd5d7dc4" +checksum = "452ff6b0a64507ce8d67ffd48b1da3b42f03680dcf5382244e9c93822cbbf5de" dependencies = [ "Inflector", "const-hex", @@ -2057,18 +1692,18 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918b1a9ba585ea61022647def2f27c29ba19f6d2a4a4c8f68a9ae97fd5769737" +checksum = "aab3cef6cc1c9fd7f787043c81ad3052eff2b96a3878ef1526aa446311bdbfc9" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "bytes", "cargo_metadata", "chrono", "const-hex", "elliptic-curve", "ethabi", - "generic-array 0.14.7", + "generic-array", "k256", "num_enum", "once_cell", @@ -2087,14 +1722,14 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "facabf8551b4d1a3c08cb935e7fca187804b6c2525cc0dafb8e5a6dd453a24de" +checksum = "16d45b981f5fa769e1d0343ebc2a44cfa88c9bc312eb681b676318b40cef6fb1" dependencies = [ "chrono", "ethers-core", "reqwest", - "semver 1.0.21", + "semver", "serde", "serde_json", "thiserror", @@ -2103,9 +1738,9 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "2.0.11" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681ece6eb1d10f7cf4f873059a77c04ff1de4f35c63dd7bccde8f438374fcb93" +checksum = "145211f34342487ef83a597c1e69f0d3e01512217a7c72cc8a25931854c7dca0" dependencies = [ "async-trait", "auto_impl", @@ -2130,9 +1765,9 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.11" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" +checksum = "fb6b15393996e3b8a78ef1332d6483c11d839042c17be58decc92fa8b1c3508a" dependencies = [ "async-trait", "auto_impl", @@ -2167,9 +1802,9 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "2.0.11" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb1b714e227bbd2d8c53528adb580b203009728b17d0d0e4119353aa9bc5532" +checksum = "b3b125a103b56aef008af5d5fb48191984aa326b50bfd2557d231dc499833de3" dependencies = [ "async-trait", "coins-bip32", @@ -2186,11 +1821,11 @@ dependencies = [ [[package]] name = "ethers-solc" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2e46e3ec8ef0c986145901fa9864205dc4dcee701f9846be2d56112d34bdea" +checksum = "d21df08582e0a43005018a858cc9b465c5fff9cf4056651be64f844e57d1f55f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "const-hex", "dirs 5.0.1", "dunce", @@ -2203,7 +1838,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.21", + "semver", "serde", "serde_json", "solang-parser", @@ -2218,20 +1853,14 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ "indenter", "once_cell", ] -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - [[package]] name = "fastrand" version = "2.0.1" @@ -2258,7 +1887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" dependencies = [ "addchain", - "cfg-if 1.0.0", + "cfg-if", "num-bigint 0.3.3", "num-integer", "num-traits", @@ -2269,25 +1898,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" - -[[package]] -name = "finite-wasm" -version = "0.5.0" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d81b511929c2669eaf64e36471cf27c2508133e62ade9d49e608e8d675e7854" -dependencies = [ - "bitvec", - "dissimilar", - "num-traits", - "prefix-sum-vec", - "thiserror", - "wasm-encoder 0.27.0", - "wasmparser 0.105.0", - "wasmprinter", -] +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "fixed-hash" @@ -2490,28 +2103,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "fxprof-processed-profile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" -dependencies = [ - "bitflags 2.4.2", - "debugid", - "fxhash", - "serde", - "serde_json", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2529,7 +2120,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] @@ -2540,7 +2131,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -2552,11 +2143,6 @@ name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -dependencies = [ - "fallible-iterator", - "indexmap 2.1.0", - "stable_deref_trait", -] [[package]] name = "glob" @@ -2599,7 +2185,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.11", - "indexmap 2.1.0", + "indexmap 2.2.3", "slab", "tokio", "tokio-util 0.7.10", @@ -2618,38 +2204,29 @@ dependencies = [ "futures-sink", "futures-util", "http 1.0.0", - "indexmap 2.1.0", + "indexmap 2.2.3", "slab", "tokio", "tokio-util 0.7.10", "tracing", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.7", -] - [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", ] [[package]] @@ -2658,7 +2235,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", "allocator-api2", "rayon", "serde", @@ -2708,9 +2285,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -2897,12 +2474,11 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ "bytes", - "futures-channel", "futures-util", "http 1.0.0", "http-body 1.0.0", @@ -2910,14 +2486,13 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3009,9 +2584,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -3024,7 +2599,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -3033,18 +2608,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.4", - "libc", - "windows-sys 0.48.0", + "cfg-if", ] [[package]] @@ -3055,12 +2619,12 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.4", - "rustix 0.38.30", + "hermit-abi 0.3.5", + "libc", "windows-sys 0.52.0", ] @@ -3084,9 +2648,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -3099,18 +2663,18 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -3167,7 +2731,7 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "elliptic-curve", "once_cell", @@ -3231,17 +2795,11 @@ dependencies = [ "spin 0.5.2", ] -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -3266,27 +2824,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.11" @@ -3303,35 +2846,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "loupe" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6a72dfa44fe15b5e76b94307eeb2ff995a8c5b283b55008940c02e0c5b634d" -dependencies = [ - "loupe-derive", - "rustversion", -] - -[[package]] -name = "loupe-derive" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "mach2" version = "0.4.2" @@ -3362,7 +2876,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "digest 0.10.7", ] @@ -3372,43 +2886,6 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix 0.38.30", -] - -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.8.0" @@ -3418,22 +2895,13 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "metrics" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", "metrics-macros", "portable-atomic", ] @@ -3469,14 +2937,14 @@ dependencies = [ [[package]] name = "metrics-util" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111cb375987443c3de8d503580b536f77dc8416d32db62d9456db5d93bd7ac47" +checksum = "4de2ed6e491ed114b40b732e4d1659a9d53992ebd87490c44a6ffe23739d973e" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.13.2", + "hashbrown 0.13.1", "indexmap 1.9.3", "metrics", "num_cpus", @@ -3510,9 +2978,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -3528,12 +2996,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - [[package]] name = "multimap" version = "0.8.3" @@ -3564,15 +3026,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35cbb989542587b47205e608324ddd391f0cee1c22b4b64ae49f458334b95907" dependencies = [ - "borsh 1.3.1", + "borsh", "serde", ] [[package]] name = "near-chain-configs" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76b655beb5257d45071f6ba053cf73f851cc9855f2cf896a798112c651568f5d" +checksum = "d05e5a8ace81c09d7eb165dffc1742358a021b2fa761f2160943305f83216003" dependencies = [ "anyhow", "bytesize", @@ -3593,9 +3055,9 @@ dependencies = [ [[package]] name = "near-config-utils" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9c343b5e619b8b3a26c3c193fe9f62456c1d9972afd9fbcf9514a6d9aa6d4d" +checksum = "2ae1eaab1d545a9be7a55b6ef09f365c2017f93a03063547591d12c0c6d27e58" dependencies = [ "anyhow", "json_comments", @@ -3605,12 +3067,12 @@ dependencies = [ [[package]] name = "near-crypto" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bffdcef917385f1ef12c0ec21b3144d2c8788dbea1015d8fed838689dc093e5" +checksum = "2991d2912218a80ec0733ac87f84fa803accea105611eea209d4419271957667" dependencies = [ "blake2", - "borsh 1.3.1", + "borsh", "bs58 0.4.0", "c2-chacha", "curve25519-dalek", @@ -3632,20 +3094,20 @@ dependencies = [ [[package]] name = "near-fmt" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "657c2b640b2e4283f64d32abb46062ac5d2e6e7a066af689ed613da3f5b3ed27" +checksum = "b7d998dfc1e04001608899b2498ad5a782c7d036b73769d510de21964db99286" dependencies = [ "near-primitives-core", ] [[package]] name = "near-jsonrpc-client" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120ff206766c6bff62e919e3dcaf5c3a184a52ea072ad0947bb123768b65ece7" +checksum = "18ad81e015f7aced8925d5b9ba3f369b36da9575c15812cfd0786bc1213284ca" dependencies = [ - "borsh 1.3.1", + "borsh", "lazy_static", "log", "near-chain-configs", @@ -3660,9 +3122,9 @@ dependencies = [ [[package]] name = "near-jsonrpc-primitives" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c247803e0ee0c66e879a717c36b16d4b10c6cfd888538929b7be862f89483330" +checksum = "b0ce745e954ae776eef05957602e638ee9581106a3675946fb43c2fe7e38ef03" dependencies = [ "arbitrary", "near-chain-configs", @@ -3681,13 +3143,13 @@ dependencies = [ "anyhow", "async-trait", "axum 0.7.4", - "borsh 1.3.1", + "borsh", "coerce", "config", "either", "futures", "hex", - "itertools 0.12.0", + "itertools 0.12.1", "log", "near-crypto", "near-jsonrpc-client", @@ -3697,7 +3159,7 @@ dependencies = [ "near-primitives-core", "pretty_env_logger", "protobuf 3.2.0", - "rand 0.7.3", + "rand 0.8.5", "reqwest", "serde", "serde_json", @@ -3711,17 +3173,17 @@ name = "near-light-client-protocol" version = "0.2.0" dependencies = [ "anyhow", - "borsh 1.3.1", + "borsh", "either", "hex", - "itertools 0.12.0", + "itertools 0.12.1", "log", "near-crypto", "near-jsonrpc-primitives", "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.7.3", + "rand 0.8.5", "serde", "serde_json", "test-utils", @@ -3734,11 +3196,11 @@ version = "0.2.0" dependencies = [ "anyhow", "async-trait", - "borsh 1.3.1", + "borsh", "either", "futures", "hex", - "itertools 0.12.0", + "itertools 0.12.1", "log", "near-crypto", "near-jsonrpc-client", @@ -3746,7 +3208,7 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.7.3", + "rand 0.8.5", "serde", "serde_json", "thiserror", @@ -3757,7 +3219,7 @@ dependencies = [ name = "near-light-client-succint-operator" version = "0.2.0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "near-light-clientx", ] @@ -3766,7 +3228,7 @@ name = "near-light-clientx" version = "0.1.0" dependencies = [ "async-trait", - "borsh 1.3.1", + "borsh", "ethers", "hex", "log", @@ -3786,9 +3248,9 @@ dependencies = [ [[package]] name = "near-o11y" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd1e98a5d3ecd782dc59abe6341c30b4072e32b5b353a0073fe238fbb641a2a" +checksum = "d20762631bc8253030013bbae9b5f0542691edc1aa6722f1e8141cc9b928ae5b" dependencies = [ "actix", "base64 0.21.7", @@ -3814,12 +3276,12 @@ dependencies = [ [[package]] name = "near-parameters" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df64b6d50fc466b960b08ae6f3f9100581e72252bf13f37c19e6e67a12bca6e9" +checksum = "e9f16a59b6c3e69b0585be951af6fe42a0ba86c0e207cb8c63badd19efd16680" dependencies = [ "assert_matches", - "borsh 1.3.1", + "borsh", "enum-map", "near-account-id", "near-primitives-core", @@ -3833,15 +3295,15 @@ dependencies = [ [[package]] name = "near-primitives" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44419e132fe6c2cda430dcb5935d9f2eba9505a69a6c641ffc76a37802c2f98d" +checksum = "0462b067732132babcc89d5577db3bfcb0a1bcfbaaed3f2db4c11cd033666314" dependencies = [ "arbitrary", "base64 0.21.7", - "borsh 1.3.1", + "borsh", "bytesize", - "cfg-if 1.0.0", + "cfg-if", "chrono", "derive_more", "easy-ext", @@ -3875,13 +3337,13 @@ dependencies = [ [[package]] name = "near-primitives-core" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99513c0a2b28e2bdf6998b8cc5a84eacfd54f0d2694bb40e19ac34a14c19d73c" +checksum = "8443eb718606f572c438be6321a097a8ebd69f8e48d953885b4f16601af88225" dependencies = [ "arbitrary", "base64 0.21.7", - "borsh 1.3.1", + "borsh", "bs58 0.4.0", "derive_more", "enum-map", @@ -3897,9 +3359,9 @@ dependencies = [ [[package]] name = "near-rpc-error-core" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31d5c61a12a22b5b7f841d5a3ecd4872be9ec515ef7ad05e89ed0f9de893622" +checksum = "80fca203c51edd9595ec14db1d13359fb9ede32314990bf296b6c5c4502f6ab7" dependencies = [ "quote", "serde", @@ -3908,9 +3370,9 @@ dependencies = [ [[package]] name = "near-rpc-error-macro" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cace511b9001dec586708b569383c237d7431de5a1b3a4e87292be463f1f53d" +checksum = "897a445de2102f6732c8a185d922f5e3bf7fd0a41243ce40854df2197237f799" dependencies = [ "fs2", "near-rpc-error-core", @@ -3920,105 +3382,28 @@ dependencies = [ [[package]] name = "near-stdx" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae2d331bd3597b4ed6b2e00b37b04231f37d1f8ba9a3fa1e8968a2345f68932" - -[[package]] -name = "near-vm-compiler" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81324e709188a02f2158fec445acfd0b366dae3a233cccdba00bb78276fe9b5a" -dependencies = [ - "enumset", - "finite-wasm", - "near-vm-types", - "near-vm-vm", - "rkyv", - "smallvec", - "target-lexicon 0.12.13", - "thiserror", - "tracing", - "wasmparser 0.99.0", -] - -[[package]] -name = "near-vm-compiler-singlepass" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d400fde9b5dbd965d83d9986df7e631f4d86cdbd55dc5d4e5a32267f5554d0" -dependencies = [ - "dynasm 2.0.0", - "dynasmrt 2.0.0", - "enumset", - "finite-wasm", - "lazy_static", - "memoffset 0.8.0", - "more-asserts", - "near-vm-compiler", - "near-vm-types", - "near-vm-vm", - "rayon", - "smallvec", - "strum 0.24.1", - "tracing", -] - -[[package]] -name = "near-vm-engine" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48e0def5a51ff916a79eba9e37d24d1f6b8af0635c5c50026d34f4f3808704d" -dependencies = [ - "backtrace", - "cfg-if 1.0.0", - "crossbeam-queue", - "enumset", - "finite-wasm", - "lazy_static", - "memmap2", - "more-asserts", - "near-vm-compiler", - "near-vm-types", - "near-vm-vm", - "region", - "rkyv", - "rustc-demangle", - "rustix 0.37.27", - "target-lexicon 0.12.13", - "thiserror", - "tracing", -] +checksum = "855fd5540e3b4ff6fedf12aba2db1ee4b371b36f465da1363a6d022b27cb43b8" [[package]] name = "near-vm-runner" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ff5288c4ace5124e9e2a88bade90363ff4e348f4e1074b909e9f699a156793" +checksum = "c56c80bdb1954808f59bd36a9112377197b38d424991383bf05f52d0fe2e0da5" dependencies = [ - "anyhow", "base64 0.21.7", - "borsh 1.3.1", + "borsh", "ed25519-dalek", "enum-map", - "finite-wasm", - "loupe", - "memoffset 0.8.0", + "memoffset", "near-crypto", "near-parameters", "near-primitives-core", "near-stdx", - "near-vm-compiler", - "near-vm-compiler-singlepass", - "near-vm-engine", - "near-vm-types", - "near-vm-vm", "num-rational 0.3.2", "once_cell", - "parity-wasm 0.41.0", - "parity-wasm 0.42.2", "prefix-sum-vec", - "pwasm-utils", "ripemd", "serde", "serde_repr", @@ -4028,55 +3413,9 @@ dependencies = [ "strum 0.24.1", "thiserror", "tracing", - "wasm-encoder 0.27.0", - "wasmer-compiler-near", - "wasmer-compiler-singlepass-near", - "wasmer-engine-near", - "wasmer-engine-universal-near", - "wasmer-runtime-core-near", - "wasmer-runtime-near", - "wasmer-types-near", - "wasmer-vm-near", - "wasmparser 0.78.2", - "wasmtime", "zeropool-bn", ] -[[package]] -name = "near-vm-types" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb41769aba6d16957b9766350fad7132965259bb0f612ae2f87cfabbafbec7d" -dependencies = [ - "indexmap 1.9.3", - "num-traits", - "rkyv", - "thiserror", -] - -[[package]] -name = "near-vm-vm" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6e1ab70baaf0e9348b1fdf93e3123a1ae7213b8247d57ff336eed951476015" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "finite-wasm", - "indexmap 1.9.3", - "libc", - "memoffset 0.8.0", - "more-asserts", - "near-vm-types", - "region", - "rkyv", - "thiserror", - "tracing", - "wasmparser 0.99.0", - "winapi", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -4092,19 +3431,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "nix" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 0.1.10", - "libc", - "void", -] - [[package]] name = "nom" version = "7.1.3" @@ -4164,29 +3490,34 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ "num-traits", "rand 0.8.5", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -4220,9 +3551,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -4234,7 +3565,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.4", + "hermit-abi 0.3.5", "libc", ] @@ -4253,7 +3584,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 2.0.48", @@ -4265,9 +3596,6 @@ version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ - "crc32fast", - "hashbrown 0.14.3", - "indexmap 2.1.0", "memchr", ] @@ -4289,7 +3617,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "auto_impl", "bytes", "ethereum-types", @@ -4315,7 +3643,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ "bitflags 2.4.2", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -4432,22 +3760,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] -name = "page_size" -version = "0.4.2" +name = "parity-scale-codec" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "parity-scale-codec" -version = "3.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" -dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", @@ -4467,28 +3785,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "parity-wasm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" - -[[package]] -name = "parity-wasm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" - -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.3", -] - [[package]] name = "parking_lot" version = "0.11.2" @@ -4496,7 +3792,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api 0.4.11", + "lock_api", "parking_lot_core 0.8.6", ] @@ -4506,31 +3802,17 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.11", + "lock_api", "parking_lot_core 0.9.9", ] -[[package]] -name = "parking_lot_core" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi", -] - [[package]] name = "parking_lot_core" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall 0.2.16", @@ -4544,7 +3826,7 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.4.1", "smallvec", @@ -4562,12 +3844,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - [[package]] name = "path-slash" version = "0.2.1" @@ -4619,9 +3895,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.6" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" +checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" dependencies = [ "memchr", "thiserror", @@ -4630,9 +3906,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.6" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" +checksum = "22e1288dbd7786462961e69bfd4df7848c1e37e8b74303dbdab82c3a9cdd2809" dependencies = [ "pest", "pest_generator", @@ -4640,9 +3916,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.6" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" +checksum = "1381c29a877c6d34b8c176e734f35d7f7f5b3adaefe940cb4d1bb7af94678e2e" dependencies = [ "pest", "pest_meta", @@ -4653,9 +3929,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.6" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" +checksum = "d0934d6907f148c22a3acbda520c7eed243ad7487a30f51f6ce52b58b7077a8a" dependencies = [ "once_cell", "pest", @@ -4669,7 +3945,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.3", ] [[package]] @@ -4679,7 +3955,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version 0.4.0", + "rustc_version", ] [[package]] @@ -4735,18 +4011,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -4790,9 +4066,9 @@ checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "plonky2" version = "0.1.4" -source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd#d2598bded0cb24d36b0a9900e8ffd104c470831b" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", "anyhow", "getrandom 0.2.12", "hashbrown 0.14.3", @@ -4800,22 +4076,23 @@ dependencies = [ "keccak-hash", "log", "num", - "plonky2_field 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", - "plonky2_maybe_rayon 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", - "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "plonky2_field 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", + "plonky2_maybe_rayon 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", + "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", "rand 0.8.5", "serde", "serde_json", "static_assertions", "unroll", + "web-time", ] [[package]] name = "plonky2" version = "0.1.4" -source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" +source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", "anyhow", "getrandom 0.2.12", "hashbrown 0.14.3", @@ -4832,17 +4109,18 @@ dependencies = [ "serde_json", "static_assertions", "unroll", + "web-time", ] [[package]] name = "plonky2_field" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd#d2598bded0cb24d36b0a9900e8ffd104c470831b" dependencies = [ "anyhow", "itertools 0.11.0", "num", - "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "plonky2_util 0.1.1 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", "rand 0.8.5", "serde", "static_assertions", @@ -4852,7 +4130,7 @@ dependencies = [ [[package]] name = "plonky2_field" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" +source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" dependencies = [ "anyhow", "itertools 0.11.0", @@ -4876,7 +4154,7 @@ dependencies = [ [[package]] name = "plonky2_maybe_rayon" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd#d2598bded0cb24d36b0a9900e8ffd104c470831b" dependencies = [ "rayon", ] @@ -4884,7 +4162,7 @@ dependencies = [ [[package]] name = "plonky2_maybe_rayon" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" +source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" dependencies = [ "rayon", ] @@ -4892,16 +4170,17 @@ dependencies = [ [[package]] name = "plonky2_util" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d#2d36559dad7adaff46631f31c7e6b24b80096eee" +source = "git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd#d2598bded0cb24d36b0a9900e8ffd104c470831b" [[package]] name = "plonky2_util" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#b8a16b39c7f84491dfae9b9dc3b7ded98bb2839b" +source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" [[package]] name = "plonky2x" version = "0.1.0" +source = "git+https://github.com/dndll/succinctx.git#9698a57ab5c6681eabc8dc105869581c4ce7d21b" dependencies = [ "anyhow", "array-macro", @@ -4925,9 +4204,8 @@ dependencies = [ "log", "num", "num-bigint 0.4.4", - "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=2d36559d)", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", "plonky2x-derive", - "pretty_assertions", "rand 0.8.5", "reqwest", "serde", @@ -4944,6 +4222,7 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" +source = "git+https://github.com/dndll/succinctx.git#9698a57ab5c6681eabc8dc105869581c4ce7d21b" dependencies = [ "proc-macro2", "quote", @@ -5034,15 +4313,6 @@ dependencies = [ "uint", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.11", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -5068,7 +4338,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.21.0", + "toml_edit 0.21.1", ] [[package]] @@ -5110,7 +4380,7 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fnv", "lazy_static", "memchr", @@ -5214,46 +4484,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "pwasm-utils" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" -dependencies = [ - "byteorder", - "log", - "parity-wasm 0.41.0", -] - [[package]] name = "quanta" version = "0.11.1" @@ -5404,12 +4634,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.16" @@ -5448,28 +4672,15 @@ dependencies = [ "smallvec", ] -[[package]] -name = "regalloc2" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" -dependencies = [ - "hashbrown 0.13.2", - "log", - "rustc-hash", - "slice-group-by", - "smallvec", -] - [[package]] name = "regex" version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ - "aho-corasick 1.1.2", + "aho-corasick", "memchr", - "regex-automata 0.4.4", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -5484,11 +4695,11 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ - "aho-corasick 1.1.2", + "aho-corasick", "memchr", "regex-syntax 0.8.2", ] @@ -5511,32 +4722,11 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "region" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" -dependencies = [ - "bitflags 1.3.2", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "rend" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" -dependencies = [ - "bytecheck", -] - [[package]] name = "reqwest" -version = "0.11.23" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ "async-compression", "base64 0.21.7", @@ -5563,6 +4753,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -5625,35 +4816,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "rkyv" -version = "0.7.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" -dependencies = [ - "bitvec", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid 1.7.0", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rlp" version = "0.5.2" @@ -5728,7 +4890,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "ordered-multimap", ] @@ -5738,60 +4900,31 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.21", -] - -[[package]] -name = "rustix" -version = "0.37.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" -dependencies = [ - "bitflags 1.3.2", - "errno 0.3.8", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", + "semver", ] [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ "bitflags 2.4.2", - "errno 0.3.8", + "errno", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys", "windows-sys 0.52.0", ] @@ -5862,7 +4995,7 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "derive_more", "parity-scale-codec", "scale-info-derive", @@ -5917,12 +5050,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "sec1" version = "0.7.3" @@ -5931,7 +5058,7 @@ checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", - "generic-array 0.14.7", + "generic-array", "pkcs8", "subtle", "zeroize", @@ -5979,15 +5106,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.21" @@ -5997,12 +5115,6 @@ dependencies = [ "serde", ] -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "send_wrapper" version = "0.4.0" @@ -6017,37 +5129,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] -[[package]] -name = "serde-bench" -version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" -dependencies = [ - "byteorder", - "serde", -] - -[[package]] -name = "serde_bytes" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -6056,9 +5149,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -6118,16 +5211,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.5.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58c3a1b3e418f61c25b2aeb43fc6c95eaa252b8cecdda67f401943e9e08d33f" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.3", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -6135,9 +5229,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.5.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2068b437a31fc68f25dd7edc296b078f04b45145c199d8eed9866e45f1ff274" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", @@ -6147,11 +5241,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.30" +version = "0.9.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -6189,7 +5283,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -6200,7 +5294,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -6265,12 +5359,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - [[package]] name = "simple_asn1" version = "0.6.2" @@ -6291,9 +5379,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "sketches-ddsketch" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" [[package]] name = "slab" @@ -6320,12 +5408,6 @@ dependencies = [ "parking_lot 0.11.2", ] -[[package]] -name = "slice-group-by" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" - [[package]] name = "smallvec" version = "1.13.1" @@ -6389,18 +5471,6 @@ dependencies = [ "der", ] -[[package]] -name = "sptr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" @@ -6426,6 +5496,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "strum" version = "0.24.1" @@ -6487,16 +5563,16 @@ dependencies = [ [[package]] name = "svm-rs" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20689c7d03b6461b502d0b95d6c24874c7d24dea2688af80486a130a06af3b07" +checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" dependencies = [ "dirs 5.0.1", "fs2", "hex", "once_cell", "reqwest", - "semver 1.0.21", + "semver", "serde", "serde_json", "sha2", @@ -6572,28 +5648,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "target-lexicon" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" - -[[package]] -name = "target-lexicon" -version = "0.12.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" - [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", - "redox_syscall 0.4.1", - "rustix 0.38.30", + "rustix", "windows-sys 0.52.0", ] @@ -6622,11 +5685,11 @@ name = "test-utils" version = "0.2.0" dependencies = [ "anyhow", - "borsh 1.3.1", + "borsh", "derive_more", "either", "hex", - "itertools 0.12.0", + "itertools 0.12.1", "log", "near-crypto", "near-jsonrpc-primitives", @@ -6635,7 +5698,7 @@ dependencies = [ "near-primitives-core", "pretty_assertions", "pretty_env_logger", - "rand 0.7.3", + "rand 0.8.5", "serde", "serde_json", "thiserror", @@ -6643,18 +5706,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", @@ -6667,18 +5730,19 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -6693,10 +5757,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -6726,9 +5791,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -6853,14 +5918,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.22.4", ] [[package]] @@ -6878,7 +5943,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "toml_datetime", "winnow", ] @@ -6889,18 +5954,29 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "toml_datetime", "winnow", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" +dependencies = [ + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", @@ -7179,9 +6255,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-xid" @@ -7246,7 +6322,7 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d82b1bc5417102a73e8464c686eef947bdfb99fcdfc0a4f228e81afa9526470a" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "serde", "serde_json", "utoipa-gen", @@ -7333,12 +6409,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - [[package]] name = "walkdir" version = "2.4.0" @@ -7372,19 +6442,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", @@ -7397,11 +6467,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -7409,9 +6479,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7419,9 +6489,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", @@ -7432,458 +6502,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - -[[package]] -name = "wasm-encoder" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77053dc709db790691d3732cfc458adc5acc881dec524965c608effdcd9c581" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca90ba1b5b0a70d3d49473c5579951f3bddc78d47b59256d2f9d4922b150aca" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasmer-compiler-near" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fdae7245128f284476e6db9653ef0a15b011975091bcd7f9d7303132409662" -dependencies = [ - "enumset", - "rkyv", - "smallvec", - "target-lexicon 0.12.13", - "thiserror", - "wasmer-types-near", - "wasmer-vm-near", - "wasmparser 0.78.2", -] - -[[package]] -name = "wasmer-compiler-singlepass-near" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4af0e438015585eb27b2c6f6869c58c540bfe27408b686b1778470bf301050" -dependencies = [ - "byteorder", - "dynasm 1.2.3", - "dynasmrt 1.2.3", - "lazy_static", - "memoffset 0.6.5", - "more-asserts", - "rayon", - "smallvec", - "wasmer-compiler-near", - "wasmer-types-near", - "wasmer-vm-near", -] - -[[package]] -name = "wasmer-engine-near" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4048411cabb2c94c7d8d11d9d0282cc6b15308b61ebc1e122c40e89865ebb5c5" -dependencies = [ - "backtrace", - "enumset", - "lazy_static", - "memmap2", - "more-asserts", - "rustc-demangle", - "target-lexicon 0.12.13", - "thiserror", - "wasmer-compiler-near", - "wasmer-types-near", - "wasmer-vm-near", -] - -[[package]] -name = "wasmer-engine-universal-near" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f31c3d2850ac7957406d3c9581d9435ea8126a26478709fa7e931b6f562b4d" -dependencies = [ - "cfg-if 1.0.0", - "enumset", - "leb128", - "region", - "rkyv", - "thiserror", - "wasmer-compiler-near", - "wasmer-engine-near", - "wasmer-types-near", - "wasmer-vm-near", - "winapi", -] - -[[package]] -name = "wasmer-runtime-core-near" -version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3fac37da3c625e98708c5dd92d3f642aaf700fd077168d3d0fff277ec6a165" -dependencies = [ - "bincode", - "blake3", - "borsh 0.9.3", - "cc", - "digest 0.8.1", - "errno 0.2.8", - "hex", - "indexmap 1.9.3", - "lazy_static", - "libc", - "nix", - "page_size", - "parking_lot 0.10.2", - "rustc_version 0.2.3", - "serde", - "serde-bench", - "serde_bytes", - "serde_derive", - "smallvec", - "target-lexicon 0.10.0", - "wasmparser 0.51.4", - "winapi", -] - -[[package]] -name = "wasmer-runtime-near" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158e6fff11e5e1ef805af50637374d5bd43d92017beafa18992cdf7f3f7ae3e4" -dependencies = [ - "lazy_static", - "memmap", - "serde", - "serde_derive", - "wasmer-runtime-core-near", - "wasmer-singlepass-backend-near", -] - -[[package]] -name = "wasmer-singlepass-backend-near" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6edd0ba6c0bcf9b279186d4dbe81649dda3e5ef38f586865943de4dcd653f8" -dependencies = [ - "bincode", - "borsh 0.9.3", - "byteorder", - "dynasm 1.2.3", - "dynasmrt 1.2.3", - "lazy_static", - "libc", - "nix", - "serde", - "serde_derive", - "smallvec", - "wasmer-runtime-core-near", -] - -[[package]] -name = "wasmer-types-near" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba154adffb0fbd33f5dabd3788a1744d846b43e6e090d44269c7ee8fa5743e4" -dependencies = [ - "indexmap 1.9.3", - "rkyv", - "thiserror", -] - -[[package]] -name = "wasmer-vm-near" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a5585596f6e9915d606de944aece51626736fb1191aefb5b2ef108c6f7604a" -dependencies = [ - "backtrace", - "cc", - "cfg-if 1.0.0", - "indexmap 1.9.3", - "libc", - "memoffset 0.6.5", - "more-asserts", - "region", - "rkyv", - "thiserror", - "wasmer-types-near", - "winapi", -] - -[[package]] -name = "wasmparser" -version = "0.51.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" - -[[package]] -name = "wasmparser" -version = "0.78.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65" - -[[package]] -name = "wasmparser" -version = "0.99.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef3b717afc67f848f412d4f02c127dd3e35a0eecd58c684580414df4fde01d3" -dependencies = [ - "indexmap 1.9.3", - "url", -] - -[[package]] -name = "wasmparser" -version = "0.105.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83be9e0b3f9570dc1979a33ae7b89d032c73211564232b99976553e5c155ec32" -dependencies = [ - "indexmap 1.9.3", - "url", -] - -[[package]] -name = "wasmparser" -version = "0.115.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06c0641a4add879ba71ccb3a1e4278fd546f76f1eafb21d8f7b07733b547cd5" -dependencies = [ - "indexmap 2.1.0", - "semver 1.0.21", -] - -[[package]] -name = "wasmprinter" -version = "0.2.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b0e5ed7a74a065637f0d7798ce5f29cadb064980d24b0c82af5200122fa0d8" -dependencies = [ - "anyhow", - "wasmparser 0.105.0", -] - -[[package]] -name = "wasmtime" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca54f6090ce46973f33a79f265924b204f248f91aec09229bce53d19d567c1a6" -dependencies = [ - "anyhow", - "bincode", - "bumpalo", - "cfg-if 1.0.0", - "fxprof-processed-profile", - "indexmap 2.1.0", - "libc", - "log", - "object", - "once_cell", - "paste", - "psm", - "serde", - "serde_derive", - "serde_json", - "target-lexicon 0.12.13", - "wasm-encoder 0.35.0", - "wasmparser 0.115.0", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-jit", - "wasmtime-runtime", - "windows-sys 0.48.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54984bc0b5689da87a43d7c181d23092b4d5cfcbb7ae3eb6b917dd55865d95e6" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "wasmtime-cranelift" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cf3cee8be02f5006d21b773ffd6802f96a0b7d661ff2ad8a01fb93df458b1aa" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", - "gimli", - "log", - "object", - "target-lexicon 0.12.13", - "thiserror", - "wasmparser 0.115.0", - "wasmtime-cranelift-shared", - "wasmtime-environ", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-cranelift-shared" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420fd2a69bc162957f4c94f21c7fa08ecf60d916f4e87b56332507c555da381d" -dependencies = [ - "anyhow", - "cranelift-codegen", - "cranelift-control", - "cranelift-native", - "gimli", - "object", - "target-lexicon 0.12.13", - "wasmtime-environ", -] - -[[package]] -name = "wasmtime-environ" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6a445ce2b2810127caee6c1b79b8da4ae57712b05556a674592c18b7500a14" -dependencies = [ - "anyhow", - "cranelift-entity", - "gimli", - "indexmap 2.1.0", - "log", - "object", - "serde", - "serde_derive", - "target-lexicon 0.12.13", - "thiserror", - "wasmparser 0.115.0", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-jit" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f0f6586c61125fbfc13c3108c3dd565d21f314dd5bac823b9a5b7ab576d21f1" -dependencies = [ - "addr2line", - "anyhow", - "bincode", - "cfg-if 1.0.0", - "cpp_demangle", - "gimli", - "log", - "object", - "rustc-demangle", - "rustix 0.38.30", - "serde", - "serde_derive", - "target-lexicon 0.12.13", - "wasmtime-environ", - "wasmtime-jit-icache-coherence", - "wasmtime-runtime", - "windows-sys 0.48.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109a9e46afe33580b952b14a4207354355f19bcdf0b47485b397b68409eaf553" -dependencies = [ - "once_cell", - "wasmtime-versioned-export-macros", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f67e6be36375c39cff57ed3b137ab691afbf2d9ba8ee1c01f77888413f218749" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "wasmtime-runtime" -version = "14.0.4" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d07986b2327b5e7f535ed638fbde25990fc8f85400194fda0d26db71c7b685e" -dependencies = [ - "anyhow", - "cc", - "cfg-if 1.0.0", - "indexmap 2.1.0", - "libc", - "log", - "mach", - "memfd", - "memoffset 0.9.0", - "paste", - "rand 0.8.5", - "rustix 0.38.30", - "sptr", - "wasm-encoder 0.35.0", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-jit-debug", - "wasmtime-versioned-export-macros", - "wasmtime-wmemcheck", - "windows-sys 0.48.0", -] +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] -name = "wasmtime-types" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e810a0d2e869abd1cb42bd232990f6bd211672b3d202d2ae7e70ffb97ed70ea3" -dependencies = [ - "cranelift-entity", - "serde", - "serde_derive", - "thiserror", - "wasmparser 0.115.0", -] - -[[package]] -name = "wasmtime-versioned-export-macros" -version = "14.0.4" +name = "web-sys" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b5575a75e711ca6c36bb9ad647c93541cdc8e34218031acba5da3f35919dd3" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "wasmtime-wmemcheck" -version = "14.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dafab2db172a53e23940e0fa3078c202f567ee5f13f4b42f66b694fab43c658" - -[[package]] -name = "web-sys" -version = "0.3.67" +name = "web-time" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "2ee269d72cc29bf77a2c4bc689cc750fb39f5cbd493d2205bbb3f5c7779cf7b0" dependencies = [ "js-sys", "wasm-bindgen", @@ -7891,9 +6528,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "which" @@ -7904,7 +6541,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.30", + "rustix", ] [[package]] @@ -8081,9 +6718,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" dependencies = [ "memchr", ] @@ -8094,7 +6731,7 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "windows-sys 0.48.0", ] @@ -8109,7 +6746,7 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version 0.4.0", + "rustc_version", "send_wrapper 0.6.0", "thiserror", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 30bfd5a..fdeb375 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,16 +36,25 @@ serde_json = "1.0" # TODO: upgrade # Near specific -near-crypto = "0.19" -near-jsonrpc-client = "0.7" -near-jsonrpc-primitives = "0.19" -near-primitives = "0.19" -near-primitives-core = "0.19" +near-crypto = "0.20" +near-jsonrpc-client = "0.8" +near-jsonrpc-primitives = "0.20" +near-primitives = "0.20" +near-primitives-core = "0.20" near-light-client-protocol = { path = "crates/protocol" } near-light-client-rpc = { path = "crates/rpc" } near-light-clientx = { path = "circuits/plonky2x" } test-utils = { path = "crates/test-utils" } -# [patch."https://github.com/succinctlabs/succinctx.git"] -# plonky2x = { path = "./vendor/succinctx/plonky2x/core" } +[patch."https://github.com/succinctlabs/curta.git"] +#curta = { git = "https://github.com/succinctlabs/starkyx.git" } +curta = { git = "https://github.com/dndll/starkyx.git" } + +[patch."https://github.com/succinctlabs/starkyx.git"] +#curta = { path = "./vendor/starkyx/curta" } +curta = { git = "https://github.com/dndll/starkyx.git" } + +[patch."https://github.com/succinctlabs/succinctx.git"] +#plonky2x = { path = "./vendor/succinctx/plonky2x/core" } +plonky2x = { git = "https://github.com/dndll/succinctx.git" } diff --git a/vendor/starkyx b/vendor/starkyx new file mode 160000 index 0000000..7f676e8 --- /dev/null +++ b/vendor/starkyx @@ -0,0 +1 @@ +Subproject commit 7f676e81dcf13393d9ca3bb825bf8e2a7c046cba diff --git a/vendor/succinctx b/vendor/succinctx new file mode 160000 index 0000000..9698a57 --- /dev/null +++ b/vendor/succinctx @@ -0,0 +1 @@ +Subproject commit 9698a57ab5c6681eabc8dc105869581c4ce7d21b From 822217429d4b95a9cf34ba3e2a9971bbce7160a0 Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 13 Feb 2024 11:55:10 +0000 Subject: [PATCH 39/67] fix: mapreduce inputs were registering incorrectly in the generator --- .gitignore | 2 ++ Cargo.lock | 8 +++++--- circuits/plonky2x/src/circuits/verify.rs | 14 ++++++++------ circuits/plonky2x/src/test_utils.rs | 2 +- circuits/plonky2x/src/variables.rs | 5 ++--- crates/protocol/src/config.rs | 3 +++ fixtures/input.bytes.json | 1 + 7 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 fixtures/input.bytes.json diff --git a/.gitignore b/.gitignore index 3652aea..880e03b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ local.toml circuits/plonky2x/contracts/cache circuits/plonky2x/contracts/out circuits/plonky2x/contracts/lib +wrapped/ +build/ # Ignores development broadcast logs !/broadcast diff --git a/Cargo.lock b/Cargo.lock index 72723db..f5e9f0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1105,7 +1105,6 @@ dependencies = [ [[package]] name = "curta" version = "0.1.0" -source = "git+https://github.com/dndll/starkyx.git#7f676e81dcf13393d9ca3bb825bf8e2a7c046cba" dependencies = [ "anyhow", "bincode", @@ -4180,7 +4179,6 @@ source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403f [[package]] name = "plonky2x" version = "0.1.0" -source = "git+https://github.com/dndll/succinctx.git#9698a57ab5c6681eabc8dc105869581c4ce7d21b" dependencies = [ "anyhow", "array-macro", @@ -4222,7 +4220,6 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" -source = "git+https://github.com/dndll/succinctx.git#9698a57ab5c6681eabc8dc105869581c4ce7d21b" dependencies = [ "proc-macro2", "quote", @@ -6865,3 +6862,8 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "curta" +version = "0.1.0" +source = "git+https://github.com/dndll/starkyx.git#7f676e81dcf13393d9ca3bb825bf8e2a7c046cba" diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index 92d8245..86b5b0d 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -45,8 +45,11 @@ impl Circuit let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids); + let zero = b.constant::([0u8; 32].into()); + let _false = b._false(); + // TODO: write some outputs here for each ID - let output = b.mapreduce_dynamic::<_, _, _, Self, B, _, _>( + let output = b.mapreduce_dynamic::<(), ProofInputVariable, ArrayVariable, Self, B, _, _>( (), proofs.data, |_, proofs, b| { @@ -58,8 +61,6 @@ impl Circuit results.push(ProofVerificationResultVariable { id, result }); } - let zero = b.constant::([0u8; 32].into()); - let _false = b._false(); results.resize( N, ProofVerificationResultVariable { @@ -95,8 +96,8 @@ impl Circuit registry.register_simple::, - ProofMapReduceVariable, + ProofInputVariable, + ArrayVariable, Self, B, D, @@ -176,13 +177,14 @@ mod beefy_tests { use ::test_utils::CryptoHash; use near_light_client_protocol::prelude::Itertools; use near_primitives::types::TransactionOrReceiptId; + use plonky2x::frontend::vars::EvmVariable; use serial_test::serial; use test_utils::fixture; use super::*; use crate::{ test_utils::{builder_suite, testnet_state, B, NETWORK, PI, PO}, - variables::TransactionOrReceiptIdVariableValue, + variables::{HeaderVariableValue, TransactionOrReceiptIdVariableValue}, }; #[test] diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index 30b1563..0c8e1ce 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -48,7 +48,7 @@ pub fn builder_suite( }, ); fs::write( - "../../fixtures/input.bytes", + "../../fixtures/input.bytes.json", serde_json::to_string(&req).unwrap(), ) .unwrap(); diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 03ff292..39cc86d 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -1,6 +1,6 @@ use ethers::types::U256; use near_light_client_protocol::{ - config::NUM_BLOCK_PRODUCER_SEATS, + config::{ACCOUNT_DATA_SEPARATOR, NUM_BLOCK_PRODUCER_SEATS}, prelude::{AccountId, CryptoHash, Header, Itertools}, BlockHeaderInnerLiteView, ED25519PublicKey, LightClientBlockView, Proof, PublicKey, Signature, StakeInfo, Synced, ValidatorStake, ValidatorStakeView, ValidatorStakeViewV1, @@ -394,7 +394,7 @@ pub struct ValidatorStakeVariable { pub stake: BalanceVariable, } -const ACCOUNT_ID_PADDING_BYTE: u8 = b'#'; +const ACCOUNT_ID_PADDING_BYTE: u8 = ACCOUNT_DATA_SEPARATOR; impl From for ValidatorStakeVariableValue { fn from(vs: ValidatorStake) -> Self { let public_key = CompressedEdwardsY(vs.public_key().unwrap_as_ed25519().0); @@ -747,7 +747,6 @@ mod tests { } } - // TODO: test way more of these, pull the last 64 transactions and prove them let txs: Vec> = vec![ tx( "3z2zqitrXNYQs19z5tK5a4bZSxdx7baqzGFUyGAkW9Mz", diff --git a/crates/protocol/src/config.rs b/crates/protocol/src/config.rs index 6ef4215..8e8971f 100644 --- a/crates/protocol/src/config.rs +++ b/crates/protocol/src/config.rs @@ -2,3 +2,6 @@ // TODO: expose this from NP, currently this is a risk that the light client // could be exploited if the max seats changes without knowing pub const NUM_BLOCK_PRODUCER_SEATS: usize = 50; + +// Used by nearcore to determine the end of the account in the state trie. +pub const ACCOUNT_DATA_SEPARATOR: u8 = b','; diff --git a/fixtures/input.bytes.json b/fixtures/input.bytes.json new file mode 100644 index 0000000..1091cdf --- /dev/null +++ b/fixtures/input.bytes.json @@ -0,0 +1 @@ +{"type":"req_bytes","releaseId":"todo","parentId":null,"files":null,"data":{"input":"0x44cf18d28ab7b9f7f5adb3cf3fd6d8a2a4f93f8fdad01a9e86ae4b5b2b17836fba9c6629085351fbea47cdc2851d8f76c940dcba41702fb91a4b832857734ce8000000000937d838dce68dd6fb22e016c8405dfbfdc90f4a9cef98e5fb3c7afc0e1f46a2b5e11022daf909af5b24b30011f952baccbdab560b1e16bd2d16efabb9f2ee3ffee398fad05d5c913e8db18af4d1fda9f2a18595ac481a324b9f94b02abc18595a39ad365fb163b24a02808b1fe26cd012313376d914a7e58017c722062aba155f9a078117aa90ce2853e1558ec8ea8e1910a48364bfb4faf1085779ad3f4311ff5b7af12c8f20a0ad34a56928328499c4518899bcc03deb1eb9b8247f88c65d6c0cf8cd4b46cf5bce18a0e2012c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d797a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c007ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"}} \ No newline at end of file From 5342629fb81e9cfa05a97e72a0fcf7e2c72ab4dc Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 13 Feb 2024 11:58:43 +0000 Subject: [PATCH 40/67] test: pre write inputs to build directory --- circuits/plonky2x/src/test_utils.rs | 63 +++++++++++++---------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index 0c8e1ce..b908ab4 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -35,43 +35,36 @@ pub fn builder_suite( let mut inputs = circuit.input(); writer(&mut inputs); - match &inputs { - PublicInput::Bytes(bytes) => { - let req = ProofRequest::::Bytes( - plonky2x::backend::function::ProofRequestBase { - release_id: "todo".to_string(), - parent_id: None, - files: None, - data: BytesRequestData { - input: bytes.clone(), - }, + let proof_req = match &inputs { + PublicInput::Bytes(bytes) => Some(ProofRequest::::Bytes( + plonky2x::backend::function::ProofRequestBase { + release_id: "todo".to_string(), + parent_id: None, + files: None, + data: BytesRequestData { + input: bytes.clone(), }, - ); - fs::write( - "../../fixtures/input.bytes.json", - serde_json::to_string(&req).unwrap(), - ) - .unwrap(); - } - PublicInput::Elements(elements) => { - let req = ProofRequest::::Elements( - plonky2x::backend::function::ProofRequestBase { - release_id: "todo".to_string(), - parent_id: None, - files: None, - data: plonky2x::backend::function::ElementsRequestData { - circuit_id: "todo".to_string(), - input: elements.clone(), - }, + }, + )), + PublicInput::Elements(elements) => Some(ProofRequest::::Elements( + plonky2x::backend::function::ProofRequestBase { + release_id: "todo".to_string(), + parent_id: None, + files: None, + data: plonky2x::backend::function::ElementsRequestData { + circuit_id: "todo".to_string(), + input: elements.clone(), }, - ); - fs::write( - "../../fixtures/input.elements.json", - serde_json::to_string(&req).unwrap(), - ) - .unwrap(); - } - _ => {} + }, + )), + _ => None, + }; + if let Some(req) = proof_req { + fs::write( + "../../build/input.json", + serde_json::to_string(&req).unwrap(), + ) + .unwrap(); } let (proof, output) = circuit.prove(&inputs); From bfd57bd37bd866c7ddb13cf16c0c72fbc92d5e8b Mon Sep 17 00:00:00 2001 From: dndll Date: Tue, 13 Feb 2024 17:43:31 +0000 Subject: [PATCH 41/67] wip: contracts --- .gitignore | 16 +- .gitmodules | 9 ++ Cargo.toml | 8 +- Makefile | 32 ++++ bin/operator/src/main.rs | 2 + .../{contracts => contract}/README.md | 0 circuits/plonky2x/contract/foundry.toml | 7 + .../plonky2x/contract/script/Deploy.s.sol | 28 ++++ .../plonky2x/contract/script/Initialise.s.sol | 34 +++++ .../plonky2x/contract/script/Upgrade.s.sol | 34 +++++ circuits/plonky2x/contract/src/NearX.sol | 129 ++++++++++++++++ .../contract/src/interfaces/INearX.sol | 85 +++++++++++ .../src/interfaces/ISuccinctGateway.sol | 0 circuits/plonky2x/contract/test/NearX.t.sol | 43 ++++++ circuits/plonky2x/contracts/foundry.toml | 6 - .../plonky2x/contracts/script/Deploy.s.sol | 28 ---- circuits/plonky2x/contracts/src/NearX.sol | 140 ------------------ .../contracts/src/interfaces/INearX.sol | 31 ---- circuits/plonky2x/contracts/test/NearX.t.sol | 28 ---- circuits/plonky2x/src/circuits/mod.rs | 1 + circuits/plonky2x/src/circuits/verify.rs | 7 +- fixtures/input.bytes.json | 1 - 22 files changed, 419 insertions(+), 250 deletions(-) rename circuits/plonky2x/{contracts => contract}/README.md (100%) create mode 100644 circuits/plonky2x/contract/foundry.toml create mode 100644 circuits/plonky2x/contract/script/Deploy.s.sol create mode 100644 circuits/plonky2x/contract/script/Initialise.s.sol create mode 100644 circuits/plonky2x/contract/script/Upgrade.s.sol create mode 100644 circuits/plonky2x/contract/src/NearX.sol create mode 100644 circuits/plonky2x/contract/src/interfaces/INearX.sol rename circuits/plonky2x/{contracts => contract}/src/interfaces/ISuccinctGateway.sol (100%) create mode 100644 circuits/plonky2x/contract/test/NearX.t.sol delete mode 100644 circuits/plonky2x/contracts/foundry.toml delete mode 100644 circuits/plonky2x/contracts/script/Deploy.s.sol delete mode 100644 circuits/plonky2x/contracts/src/NearX.sol delete mode 100644 circuits/plonky2x/contracts/src/interfaces/INearX.sol delete mode 100644 circuits/plonky2x/contracts/test/NearX.t.sol delete mode 100644 fixtures/input.bytes.json diff --git a/.gitignore b/.gitignore index 880e03b..0bbdff0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,16 +10,18 @@ local.toml *.db # Compiler files -circuits/plonky2x/contracts/cache -circuits/plonky2x/contracts/out -circuits/plonky2x/contracts/lib +circuits/plonky2x/contract/cache +circuits/plonky2x/contract/out +circuits/plonky2x/contract/lib +# Ignores development broadcast logs +!**broadcast +**broadcast/*/31337/ +**broadcast/**/dry-run/ +circuits/plonky2x/contract/broadcast + wrapped/ build/ -# Ignores development broadcast logs -!/broadcast -/broadcast/*/31337/ -/broadcast/**/dry-run/ # Docs docs/ diff --git a/.gitmodules b/.gitmodules index 817cb6f..f34d21e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,12 @@ [submodule "vendor/succinctx"] path = vendor/succinctx url = git@github.com:succinctlabs/succinctx.git +[submodule "circuits/plonky2x/verifier/lib/openzeppelin-contracts-upgradeable"] + path = circuits/plonky2x/verifier/lib/openzeppelin-contracts-upgradeable + url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable +[submodule "circuits/plonky2x/verifier/lib/openzeppelin-contracts"] + path = circuits/plonky2x/verifier/lib/openzeppelin-contracts + url = https://github.com/OpenZeppelin/openzeppelin-contracts +[submodule "circuits/plonky2x/verifier/lib/foundry-devops"] + path = circuits/plonky2x/verifier/lib/foundry-devops + url = https://github.com/chainaccelorg/foundry-devops diff --git a/Cargo.toml b/Cargo.toml index fdeb375..961b35b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,9 +52,9 @@ test-utils = { path = "crates/test-utils" } curta = { git = "https://github.com/dndll/starkyx.git" } [patch."https://github.com/succinctlabs/starkyx.git"] -#curta = { path = "./vendor/starkyx/curta" } -curta = { git = "https://github.com/dndll/starkyx.git" } +curta = { path = "./vendor/starkyx/curta" } +#curta = { git = "https://github.com/dndll/starkyx.git" } [patch."https://github.com/succinctlabs/succinctx.git"] -#plonky2x = { path = "./vendor/succinctx/plonky2x/core" } -plonky2x = { git = "https://github.com/dndll/succinctx.git" } +plonky2x = { path = "./vendor/succinctx/plonky2x/core" } +#plonky2x = { git = "https://github.com/dndll/succinctx.git" } diff --git a/Makefile b/Makefile index da531fb..cd22ecc 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +.EXPORT_ALL_VARIABLES: +include .env + TAG_PREFIX?=near IMAGE_TAG?=0.0.1 @@ -20,3 +23,32 @@ build-verify-circuit: RUST_LOG=debug ./build/verify build .PHONY: build-verify-circuit + +SYNC_FUNCTION_ID=0x350c2939eb7ff2185612710a2b641b4b46faab68e1e2c57b6f15e0af0674f5e9 +VERIFY_FUNCTION_ID=0x39fb2562b80725bb7538dd7d850126964e565a1a837d2d7f2a018e185b08fc0e +ETH_RPC=https://goerli.gateway.tenderly.co +NEAR_CHECKPOINT_HEADER_HASH=0x63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3 +CHAIN_ID=5 +CD_CONTRACTS=cd ./circuits/plonky2x/contract + +build-contracts: + $(CD_CONTRACTS) && forge build + +deploy: build-contracts + $(CD_CONTRACTS) && forge script Deploy \ + --rpc-url $(ETH_RPC) \ + --private-key $$ETH_PRIVATE_KEY \ + --broadcast \ + --verify \ + --verifier etherscan + +initialise: + cd $(ETH_CONTRACTS_PATH) && forge script Initialise \ + --rpc-url $(ETH_RPC) \ + --private-key $$ETH_PRIVATE_KEY \ + --broadcast \ + --verify \ + --verifier etherscan + +# TODO: upgrade + diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 8f73b8b..24ee4e8 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -11,6 +11,8 @@ cfg_if::cfg_if! { } } +// TODO: make this use a nicer API for use by the prover. +// TODO: perpetually sync, use queue etc fn main() { cfg_if::cfg_if! { if #[cfg(feature = "sync")] { diff --git a/circuits/plonky2x/contracts/README.md b/circuits/plonky2x/contract/README.md similarity index 100% rename from circuits/plonky2x/contracts/README.md rename to circuits/plonky2x/contract/README.md diff --git a/circuits/plonky2x/contract/foundry.toml b/circuits/plonky2x/contract/foundry.toml new file mode 100644 index 0000000..15402f9 --- /dev/null +++ b/circuits/plonky2x/contract/foundry.toml @@ -0,0 +1,7 @@ +[profile.default] +fs_permissions = [ { access = "read", path = "./broadcast" } ] +libs = [ "lib" ] +out = "out" +remappings = [ "@openzeppelin/contracts=lib/openzeppelin-contracts/contracts", "@openzeppelin/contracts-upgradeable=lib/openzeppelin-contracts-upgradeable/contracts" ] +src = "src" +# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/circuits/plonky2x/contract/script/Deploy.s.sol b/circuits/plonky2x/contract/script/Deploy.s.sol new file mode 100644 index 0000000..4e3042a --- /dev/null +++ b/circuits/plonky2x/contract/script/Deploy.s.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.19; + +import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; +import {NearX} from "../src/NearX.sol"; +import {Script} from "forge-std/Script.sol"; + +contract Deploy is Script { + function setUp() public {} + + function run() external returns (address) { + address proxy = deployNearX(); + return proxy; + } + + function deployNearX() public returns (address) { + vm.startBroadcast(); + + NearX lightClient = new NearX(); + + ERC1967Proxy proxy = new ERC1967Proxy(address(lightClient), ""); + + lightClient.initialize(); + + vm.stopBroadcast(); + return address(proxy); + } +} diff --git a/circuits/plonky2x/contract/script/Initialise.s.sol b/circuits/plonky2x/contract/script/Initialise.s.sol new file mode 100644 index 0000000..c8ae6ce --- /dev/null +++ b/circuits/plonky2x/contract/script/Initialise.s.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.19; + +import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; +import {NearX} from "../src/NearX.sol"; +import {Script} from "forge-std/Script.sol"; +import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol"; + +contract Initialise is Script { + function setUp() public {} + + function run() external { + address proxyAddress = DevOpsTools.get_most_recent_deployment( + "ERC1967Proxy", + block.chainid + ); + vm.startBroadcast(); + NearX lightClient = NearX(payable(proxyAddress)); + + address initialGateway = 0x6e4f1e9eA315EBFd69d18C2DB974EEf6105FB803; + lightClient.updateGateway(initialGateway); + + bytes32 syncFunctionId = vm.envBytes32("SYNC_FUNCTION_ID"); + lightClient.updateSyncId(syncFunctionId); + + bytes32 verifyFunctionId = vm.envBytes32("VERIFY_FUNCTION_ID"); + lightClient.updateVerifyId(verifyFunctionId); + + bytes32 header = vm.envBytes32("NEAR_CHECKPOINT_HEADER_HASH"); + lightClient.setCheckpointHeader(header); + + vm.stopBroadcast(); + } +} diff --git a/circuits/plonky2x/contract/script/Upgrade.s.sol b/circuits/plonky2x/contract/script/Upgrade.s.sol new file mode 100644 index 0000000..5a654af --- /dev/null +++ b/circuits/plonky2x/contract/script/Upgrade.s.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {Script} from "forge-std/Script.sol"; +import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; +import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol"; +import {NearX} from "../src/NearX.sol"; + +contract Upgrade is Script { + function run() external returns (address) { + address mostRecentlyDeployedProxy = DevOpsTools + .get_most_recent_deployment("ERC1967Proxy", block.chainid); + vm.startBroadcast(); + + NearX newAddress = new NearX(); + + vm.stopBroadcast(); + address proxy = upgrade(mostRecentlyDeployedProxy, address(newAddress)); + return proxy; + } + + function upgrade(address proxyAddress, address newAddress) + public + returns (address) + { + vm.startBroadcast(); + + NearX proxy = NearX(payable(proxyAddress)); + proxy.upgradeToAndCall(address(newAddress), ""); + + vm.stopBroadcast(); + return address(proxy); + } +} diff --git a/circuits/plonky2x/contract/src/NearX.sol b/circuits/plonky2x/contract/src/NearX.sol new file mode 100644 index 0000000..a71adb4 --- /dev/null +++ b/circuits/plonky2x/contract/src/NearX.sol @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; +import {ISuccinctGateway} from "./interfaces/ISuccinctGateway.sol"; +import {INearX, TransactionOrReceiptId, encodePackedIds, decodePackedIds} from "./interfaces/INearX.sol"; + +/// @notice The NearX contract is a light client for Near. +contract NearX is INearX, Initializable, OwnableUpgradeable, UUPSUpgradeable { + uint32 public constant DEFAULT_GAS_LIMIT = 1000000; + + /// @notice The address of the gateway contract. + address public gateway; + + constructor() { + _disableInitializers(); + } + + function initialize() public initializer { + __Ownable_init(msg.sender); //sets owner to msg.sender + __UUPSUpgradeable_init(); + } + + function _authorizeUpgrade(address newImplementation) + internal + override + onlyOwner + {} + + /// @notice Sync function id. + bytes32 public syncFunctionId; + + /// @notice Verify function id. + bytes32 public verifyFunctionId; + + /// @notice The latest header that has been committed. + bytes32 public latestHeader; + + function updateGateway(address _gateway) external onlyOwner { + gateway = _gateway; + } + + function updateSyncId(bytes32 _functionId) external onlyOwner { + syncFunctionId = _functionId; + } + + function updateVerifyId(bytes32 _functionId) external onlyOwner { + verifyFunctionId = _functionId; + } + + /// Note: Only for testnet. The genesis header should be set when initializing the contract. + function setCheckpointHeader(bytes32 _header) external onlyOwner { + latestHeader = _header; + } + + function ensureInitialized() internal view { + if (gateway == address(0)) { + revert GatewayNotInitialised(); + } + if (syncFunctionId == bytes32(0) || verifyFunctionId == bytes32(0)) { + revert FunctionIdsNotInitialised(); + } + if (latestHeader == bytes32(0)) { + revert HeaderNotInitialised(); + } + } + + /// @notice Inputs of a sync request. + function requestSync() external payable { + ensureInitialized(); + bytes memory context; + + ISuccinctGateway(gateway).requestCallback{value: msg.value}( + syncFunctionId, + abi.encodePacked(latestHeader), + context, + NearX.handleSync.selector, + DEFAULT_GAS_LIMIT + ); + + emit SyncRequested(latestHeader); + } + + function handleSync(bytes memory _output, bytes memory _context) external { + if (msg.sender != gateway || !ISuccinctGateway(gateway).isCallback()) { + revert NotFromSuccinctGateway(msg.sender); + } + + bytes32 targetHeader = abi.decode(_output, (bytes32)); + + latestHeader = targetHeader; + + emit HeadUpdate(targetHeader); + } + + function requestVerify(TransactionOrReceiptId[] memory ids) + external + payable + { + ensureInitialized(); + bytes memory context; + bytes memory input = abi.encodePacked( + latestHeader, + encodePackedIds(ids) + ); + + ISuccinctGateway(gateway).requestCallback{value: msg.value}( + verifyFunctionId, + input, + context, + NearX.handleVerify.selector, + DEFAULT_GAS_LIMIT + ); + + emit VerifyRequested(latestHeader, ids); + } + + function handleVerify(bytes memory _output, bytes memory _context) + external + { + if (msg.sender != gateway || !ISuccinctGateway(gateway).isCallback()) { + revert NotFromSuccinctGateway(msg.sender); + } + TransactionOrReceiptId[] memory ids = decodePackedIds(_output); + emit VerifyResult(ids); + } +} diff --git a/circuits/plonky2x/contract/src/interfaces/INearX.sol b/circuits/plonky2x/contract/src/interfaces/INearX.sol new file mode 100644 index 0000000..59d1f3a --- /dev/null +++ b/circuits/plonky2x/contract/src/interfaces/INearX.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +interface INearX { + /// @notice Emits event with the new head update. + event HeadUpdate(bytes32 headerHash); + + /// @notice Inputs of a sync request. + /// @param trustedHeader The header hash of the trusted block. + event SyncRequested(bytes32 indexed trustedHeader); + + /// @notice Inputs of a verify request. + /// @param trustedHeader The header hash of the trusted block. + /// @param ids The transaction or receipt ids to verify. + event VerifyRequested( + bytes32 indexed trustedHeader, + TransactionOrReceiptId[] indexed ids + ); + + /// @notice Trusted header not found. + error TrustedHeaderNotFound(); + + /// @notice Header not Initialised. + error HeaderNotInitialised(); + + /// @notice Not from Succinct Gateway. + error NotFromSuccinctGateway(address); + + error GatewayNotInitialised(); + + error FunctionIdsNotInitialised(); + + /// @notice The result of the verification request + event VerifyResult(TransactionOrReceiptId[] ids); +} + +uint256 constant MAX_LEN = 64; + +struct TransactionOrReceiptId { + bool isTransaction; + bytes32 id; + bytes account; +} + +function encodePackedIds(TransactionOrReceiptId[] memory ids) + pure + returns (bytes memory) +{ + bytes memory output; + for (uint256 i = 0; i < ids.length; i++) { + output = abi.encodePacked( + output, + ids[i].isTransaction, + ids[i].id, + ids[i].account + ); + } + return output; +} + +function decodePackedIds(bytes memory _input) + pure + returns (TransactionOrReceiptId[] memory) +{ + uint256 idsLength = _input.length / 1 + 32 + MAX_LEN; + TransactionOrReceiptId[] memory ids = new TransactionOrReceiptId[]( + idsLength + ); + + for (uint256 i = 0; i < idsLength; i++) { + ids[i] = decodeTransactionOrReceiptId(_input); + } + return ids; +} + +function decodeTransactionOrReceiptId(bytes memory _input) + pure + returns (TransactionOrReceiptId memory id) +{ + id.isTransaction = abi.decode(_input, (bool)); + id.id = abi.decode(_input, (bytes32)); + bytes32 accountX = abi.decode(_input, (bytes32)); + bytes32 accountY = abi.decode(_input, (bytes32)); + id.account = abi.encodePacked(accountX, accountY); +} diff --git a/circuits/plonky2x/contracts/src/interfaces/ISuccinctGateway.sol b/circuits/plonky2x/contract/src/interfaces/ISuccinctGateway.sol similarity index 100% rename from circuits/plonky2x/contracts/src/interfaces/ISuccinctGateway.sol rename to circuits/plonky2x/contract/src/interfaces/ISuccinctGateway.sol diff --git a/circuits/plonky2x/contract/test/NearX.t.sol b/circuits/plonky2x/contract/test/NearX.t.sol new file mode 100644 index 0000000..3859530 --- /dev/null +++ b/circuits/plonky2x/contract/test/NearX.t.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; + +import "forge-std/Test.sol"; +import "../src/NearX.sol"; + +contract NearXTest is Test { + NearX public lightClient; + + function setUp() public { + lightClient = new NearX(); + } + + function testGetEncodePackedSync() public view { + // TODO: + bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + bytes memory encodedInput = abi.encodePacked(header); + console.logBytes(encodedInput); + } + + function testGetEncodePackedVerify() public view { + // TODO: + bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + bytes tx = hex"012c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d797a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + bytes rx = hex"007ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + + TransactionOrReceiptId[] memory ids = new TransactionOrReceiptId[](2); + ids[0].isTransaction = true; + ids[0] + .id = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + ids[1].isTransaction = false; + ids[1] + .id = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + ids[1] + .account = hex"0000000000000000000000000000000000000000000000000000000000000000"; + bytes memory encodedInput = abi.encodePacked( + latestHeader, + encodePackedIds(ids) + ); + + console.logBytes(encodedInput); + } +} diff --git a/circuits/plonky2x/contracts/foundry.toml b/circuits/plonky2x/contracts/foundry.toml deleted file mode 100644 index e883058..0000000 --- a/circuits/plonky2x/contracts/foundry.toml +++ /dev/null @@ -1,6 +0,0 @@ -[profile.default] -src = "src" -out = "out" -libs = ["lib"] - -# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/circuits/plonky2x/contracts/script/Deploy.s.sol b/circuits/plonky2x/contracts/script/Deploy.s.sol deleted file mode 100644 index 1ff9864..0000000 --- a/circuits/plonky2x/contracts/script/Deploy.s.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import "forge-std/Script.sol"; -import {NearX} from "../src/NearX.sol"; - -contract DeployScript is Script { - function setUp() public {} - - function run() public { - vm.startBroadcast(); - - address gateway = 0x6e4f1e9eA315EBFd69d18C2DB974EEf6105FB803; - - // Use the below to interact with an already deployed ZK light client. - NearX lightClient = new NearX(gateway); - - bytes32 syncFunctionId = vm.envBytes32("SYNC_FUNCTION_ID"); - lightClient.updateSyncId(syncFunctionId); - - bytes32 verifyFunctionId = vm.envBytes32("VERIFY_FUNCTION_ID"); - lightClient.updateVerifyId(verifyFunctionId); - - uint64 height = uint64(vm.envUint("GENESIS_HEIGHT")); - bytes32 header = vm.envBytes32("GENESIS_HEADER"); - lightClient.setGenesisHeader(header); - } -} diff --git a/circuits/plonky2x/contracts/src/NearX.sol b/circuits/plonky2x/contracts/src/NearX.sol deleted file mode 100644 index 12c8eb9..0000000 --- a/circuits/plonky2x/contracts/src/NearX.sol +++ /dev/null @@ -1,140 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; - -import {ISuccinctGateway} from "./interfaces/ISuccinctGateway.sol"; -import {INearX, TransactionOrReceiptId} from "./interfaces/INearX.sol"; - -/// @notice The NearX contract is a light client for Near. -/// @dev -contract NearX is INearX { - /// TODO: integrate this in a nice way - uint64 public constant NETWORK = 1; - - /// @notice The address of the gateway contract. - address public gateway; - - /// @notice The latest header that has been committed. - bytes32 public latestHeader; - - /// @notice Sync function id. - bytes32 public syncFunctionId; - - /// @notice Verify function id. - bytes32 public verifyFunctionId; - - /// @notice Initialize the contract with the address of the gateway contract. - constructor(address _gateway) { - gateway = _gateway; - } - - /// @notice Update the address of the gateway contract. - function updateGateway(address _gateway) external { - gateway = _gateway; - } - - /// @notice Update the function ID for header range. - function updateSyncId(bytes32 _functionId) external { - syncFunctionId = _functionId; - } - - /// @notice Update the function ID for next header. - function updateVerifyId(bytes32 _functionId) external { - verifyFunctionId = _functionId; - } - - /// Note: Only for testnet. The genesis header should be set when initializing the contract. - function setGenesisHeader(bytes32 _header) external { - latestHeader = _header; - } - - function ensureInitialized() internal { - if (latestHeader == bytes32(0)) { - revert HeaderNotInitialised(); - } - } - - /// @notice Inputs of a sync request. - function requestSync() external payable { - ensureInitialized(); - - ISuccinctGateway(gateway).requestCall{value: msg.value}( - syncFunctionId, - abi.encodePacked(latestHeader), - address(this), - abi.encodeWithSelector(this.sync.selector, latestHeader), - 500000 - ); - - emit SyncRequested(latestHeader); - } - - /// @notice Stores the new header for targetBlock. - function sync() external { - ensureInitialized(); - - // Encode the circuit input. - bytes memory input = abi.encodePacked(latestHeader); - - // Call gateway to get the proof result. - bytes memory requestResult = ISuccinctGateway(gateway).verifiedCall( - syncFunctionId, - input - ); - - // Read the target header from request result. - bytes32 targetHeader = abi.decode(requestResult, (bytes32)); - - latestHeader = targetHeader; - - emit HeadUpdate(targetHeader); - } - - function requestVerify(TransactionOrReceiptId[] memory ids) - external - payable - { - ensureInitialized(); - - ISuccinctGateway(gateway).requestCall{value: msg.value}( - verifyFunctionId, - abi.encodePacked(latestHeader, encodePackedIds(ids)), - address(this), - abi.encodeWithSelector(this.verify.selector, latestHeader, ids), - 500000 - ); - emit VerifyRequested(latestHeader, ids); - } - - function verify(TransactionOrReceiptId[] memory ids) external { - ensureInitialized(); - - bytes memory input = abi.encodePacked( - latestHeader, - encodePackedIds(ids) - ); - - // Call gateway to get the proof result. - bytes memory requestResult = ISuccinctGateway(gateway).verifiedCall( - verifyFunctionId, - input - ); - // TODO: emit event for the ids and their verification status - } - - function encodePackedIds(TransactionOrReceiptId[] memory ids) - internal - pure - returns (bytes memory) - { - bytes memory output; - for (uint256 i = 0; i < ids.length; i++) { - output = abi.encodePacked( - output, - ids[i].isTransaction, - ids[i].id, - ids[i].account - ); - } - return output; - } -} diff --git a/circuits/plonky2x/contracts/src/interfaces/INearX.sol b/circuits/plonky2x/contracts/src/interfaces/INearX.sol deleted file mode 100644 index 9de34d5..0000000 --- a/circuits/plonky2x/contracts/src/interfaces/INearX.sol +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -interface INearX { - /// @notice Emits event with the new head update. - event HeadUpdate(bytes32 headerHash); - - /// @notice Inputs of a sync request. - /// @param trustedHeader The header hash of the trusted block. - event SyncRequested(bytes32 indexed trustedHeader); - - /// @notice Inputs of a verify request. - /// @param trustedHeader The header hash of the trusted block. - /// @param ids The transaction or receipt ids to verify. - event VerifyRequested( - bytes32 indexed trustedHeader, - TransactionOrReceiptId[] indexed ids - ); - - /// @notice Trusted header not found. - error TrustedHeaderNotFound(); - - /// @notice Header not Initialised. - error HeaderNotInitialised(); -} - -struct TransactionOrReceiptId { - bool isTransaction; - bytes32 id; - string account; -} diff --git a/circuits/plonky2x/contracts/test/NearX.t.sol b/circuits/plonky2x/contracts/test/NearX.t.sol deleted file mode 100644 index 0c5fa53..0000000 --- a/circuits/plonky2x/contracts/test/NearX.t.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import "forge-std/Test.sol"; -import "../src/NearX.sol"; - -contract NearXTest is Test { - NearX public lightClient; - - function setUp() public { - lightClient = new NearX(address(0)); - } - - function testGetEncodePackedSync() public view { - // TODO: - bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; - bytes memory encodedInput = abi.encodePacked(header); - console.logBytes(encodedInput); - } - - function testGetEncodePackedVerify() public view { - // TODO: - bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; - - bytes memory encodedInput = abi.encodePacked(header); - console.logBytes(encodedInput); - } -} diff --git a/circuits/plonky2x/src/circuits/mod.rs b/circuits/plonky2x/src/circuits/mod.rs index 3b2075c..a1c8e4c 100644 --- a/circuits/plonky2x/src/circuits/mod.rs +++ b/circuits/plonky2x/src/circuits/mod.rs @@ -1,5 +1,6 @@ pub mod sync; pub mod verify; +// TODO: CIRCUIT SERIALISATION TESTS!!! pub use sync::SyncCircuit; pub use verify::VerifyCircuit; diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index 86b5b0d..cd5d103 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -15,17 +15,14 @@ use crate::{ }, }; +pub type ProofMapReduceVariable = ArrayVariable; + #[derive(CircuitVariable, Debug, Clone)] pub struct ProofVerificationResultVariable { pub id: CryptoHashVariable, pub result: BoolVariable, } -// TODO: improve the way we can lookup the transaction, ideally map -// TransactionOrReceiptId => Proof and map this way, now we are not limited by -// the data transformation -pub type ProofMapReduceVariable = ArrayVariable; - #[derive(Debug, Clone)] pub struct VerifyCircuit; diff --git a/fixtures/input.bytes.json b/fixtures/input.bytes.json deleted file mode 100644 index 1091cdf..0000000 --- a/fixtures/input.bytes.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"req_bytes","releaseId":"todo","parentId":null,"files":null,"data":{"input":"0x44cf18d28ab7b9f7f5adb3cf3fd6d8a2a4f93f8fdad01a9e86ae4b5b2b17836fba9c6629085351fbea47cdc2851d8f76c940dcba41702fb91a4b832857734ce8000000000937d838dce68dd6fb22e016c8405dfbfdc90f4a9cef98e5fb3c7afc0e1f46a2b5e11022daf909af5b24b30011f952baccbdab560b1e16bd2d16efabb9f2ee3ffee398fad05d5c913e8db18af4d1fda9f2a18595ac481a324b9f94b02abc18595a39ad365fb163b24a02808b1fe26cd012313376d914a7e58017c722062aba155f9a078117aa90ce2853e1558ec8ea8e1910a48364bfb4faf1085779ad3f4311ff5b7af12c8f20a0ad34a56928328499c4518899bcc03deb1eb9b8247f88c65d6c0cf8cd4b46cf5bce18a0e2012c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d797a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c007ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"}} \ No newline at end of file From 771e64b2f21c869b76dd34151631cdf5f2c589fd Mon Sep 17 00:00:00 2001 From: dndll Date: Wed, 14 Feb 2024 13:04:54 +0000 Subject: [PATCH 42/67] fix: witness some safety values in headers and add default result to ctx --- .gitmodules | 3 + Cargo.lock | 20 ++- Cargo.toml | 8 +- Makefile | 27 +++- bin/operator/Cargo.toml | 4 +- circuits/plonky2x/contract/foundry.toml | 3 +- .../contract/lib/solidity-bytes-utils | 1 + .../plonky2x/contract/script/Verify.s.sol | 39 +++++ circuits/plonky2x/contract/src/NearX.sol | 8 +- .../contract/src/interfaces/Bytes.sol | 151 ++++++++++++++++++ .../contract/src/interfaces/INearX.sol | 85 ++++++++-- circuits/plonky2x/contract/test/NearX.t.sol | 62 +++++-- circuits/plonky2x/src/builder.rs | 1 + circuits/plonky2x/src/circuits/sync.rs | 8 +- circuits/plonky2x/src/circuits/verify.rs | 51 +++--- circuits/plonky2x/src/hint.rs | 17 +- circuits/plonky2x/src/merkle.rs | 2 +- vendor/succinctx | 2 +- 18 files changed, 407 insertions(+), 85 deletions(-) create mode 160000 circuits/plonky2x/contract/lib/solidity-bytes-utils create mode 100644 circuits/plonky2x/contract/script/Verify.s.sol create mode 100644 circuits/plonky2x/contract/src/interfaces/Bytes.sol diff --git a/.gitmodules b/.gitmodules index f34d21e..29700af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "circuits/plonky2x/verifier/lib/foundry-devops"] path = circuits/plonky2x/verifier/lib/foundry-devops url = https://github.com/chainaccelorg/foundry-devops +[submodule "circuits/plonky2x/contract/lib/solidity-bytes-utils"] + path = circuits/plonky2x/contract/lib/solidity-bytes-utils + url = https://github.com/GNSPS/solidity-bytes-utils diff --git a/Cargo.lock b/Cargo.lock index f5e9f0f..c6dda70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1105,6 +1105,7 @@ dependencies = [ [[package]] name = "curta" version = "0.1.0" +source = "git+https://github.com/dndll/starkyx.git#7f676e81dcf13393d9ca3bb825bf8e2a7c046cba" dependencies = [ "anyhow", "bincode", @@ -3158,7 +3159,7 @@ dependencies = [ "near-primitives-core", "pretty_env_logger", "protobuf 3.2.0", - "rand 0.8.5", + "rand 0.7.3", "reqwest", "serde", "serde_json", @@ -3182,7 +3183,7 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "test-utils", @@ -3207,7 +3208,7 @@ dependencies = [ "near-primitives", "near-primitives-core", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "thiserror", @@ -3215,7 +3216,7 @@ dependencies = [ ] [[package]] -name = "near-light-client-succint-operator" +name = "near-light-client-succinct-operator" version = "0.2.0" dependencies = [ "cfg-if", @@ -3583,7 +3584,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.48", @@ -4179,6 +4180,7 @@ source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403f [[package]] name = "plonky2x" version = "0.1.0" +source = "git+https://github.com/dndll/succinctx.git#b2540e29d54bcf97bc922d57b50acfe89665398a" dependencies = [ "anyhow", "array-macro", @@ -4220,6 +4222,7 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" +source = "git+https://github.com/dndll/succinctx.git#b2540e29d54bcf97bc922d57b50acfe89665398a" dependencies = [ "proc-macro2", "quote", @@ -5695,7 +5698,7 @@ dependencies = [ "near-primitives-core", "pretty_assertions", "pretty_env_logger", - "rand 0.8.5", + "rand 0.7.3", "serde", "serde_json", "thiserror", @@ -6862,8 +6865,3 @@ dependencies = [ "cc", "pkg-config", ] - -[[patch.unused]] -name = "curta" -version = "0.1.0" -source = "git+https://github.com/dndll/starkyx.git#7f676e81dcf13393d9ca3bb825bf8e2a7c046cba" diff --git a/Cargo.toml b/Cargo.toml index 961b35b..fdeb375 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,9 +52,9 @@ test-utils = { path = "crates/test-utils" } curta = { git = "https://github.com/dndll/starkyx.git" } [patch."https://github.com/succinctlabs/starkyx.git"] -curta = { path = "./vendor/starkyx/curta" } -#curta = { git = "https://github.com/dndll/starkyx.git" } +#curta = { path = "./vendor/starkyx/curta" } +curta = { git = "https://github.com/dndll/starkyx.git" } [patch."https://github.com/succinctlabs/succinctx.git"] -plonky2x = { path = "./vendor/succinctx/plonky2x/core" } -#plonky2x = { git = "https://github.com/dndll/succinctx.git" } +#plonky2x = { path = "./vendor/succinctx/plonky2x/core" } +plonky2x = { git = "https://github.com/dndll/succinctx.git" } diff --git a/Makefile b/Makefile index cd22ecc..e89be5d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .EXPORT_ALL_VARIABLES: -include .env +-include .env TAG_PREFIX?=near IMAGE_TAG?=0.0.1 @@ -26,7 +26,7 @@ build-verify-circuit: SYNC_FUNCTION_ID=0x350c2939eb7ff2185612710a2b641b4b46faab68e1e2c57b6f15e0af0674f5e9 VERIFY_FUNCTION_ID=0x39fb2562b80725bb7538dd7d850126964e565a1a837d2d7f2a018e185b08fc0e -ETH_RPC=https://goerli.gateway.tenderly.co +ETH_RPC=https://rpc.goerli.eth.gateway.fm NEAR_CHECKPOINT_HEADER_HASH=0x63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3 CHAIN_ID=5 CD_CONTRACTS=cd ./circuits/plonky2x/contract @@ -43,12 +43,33 @@ deploy: build-contracts --verifier etherscan initialise: - cd $(ETH_CONTRACTS_PATH) && forge script Initialise \ + $(CD_CONTRACTS) && forge script Initialise \ --rpc-url $(ETH_RPC) \ --private-key $$ETH_PRIVATE_KEY \ --broadcast \ --verify \ --verifier etherscan +upgrade: + $(CD_CONTRACTS) && forge script Upgrade \ + --rpc-url $(ETH_RPC) \ + --private-key $$ETH_PRIVATE_KEY \ + --broadcast \ + --verify \ + --verifier etherscan +verify: + $(CD_CONTRACTS) && forge script Verify \ + --rpc-url $(ETH_RPC) \ + --private-key $$ETH_PRIVATE_KEY \ + --broadcast \ + --verify \ + --verifier etherscan + +# verify-contract: +# cd circuits/plonky2x/contracts/ && forge verify-contract \ +# --chain=5 \ +# --watch \ +# 0x438634f4dF74CdD6963c750c30E3e9bf9F029838 \ +# src/NearX.sol:NearX # TODO: upgrade diff --git a/bin/operator/Cargo.toml b/bin/operator/Cargo.toml index ad3a43e..e53fe6a 100644 --- a/bin/operator/Cargo.toml +++ b/bin/operator/Cargo.toml @@ -1,11 +1,9 @@ [package] edition.workspace = true license.workspace = true -name = "near-light-client-succint-operator" +name = "near-light-client-succinct-operator" version.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [[bin]] name = "sync" path = "src/main.rs" diff --git a/circuits/plonky2x/contract/foundry.toml b/circuits/plonky2x/contract/foundry.toml index 15402f9..f78b70d 100644 --- a/circuits/plonky2x/contract/foundry.toml +++ b/circuits/plonky2x/contract/foundry.toml @@ -1,7 +1,8 @@ [profile.default] fs_permissions = [ { access = "read", path = "./broadcast" } ] libs = [ "lib" ] +optimizer = true +optimizer-runs = 1_000_000 out = "out" remappings = [ "@openzeppelin/contracts=lib/openzeppelin-contracts/contracts", "@openzeppelin/contracts-upgradeable=lib/openzeppelin-contracts-upgradeable/contracts" ] src = "src" -# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/circuits/plonky2x/contract/lib/solidity-bytes-utils b/circuits/plonky2x/contract/lib/solidity-bytes-utils new file mode 160000 index 0000000..e0115c4 --- /dev/null +++ b/circuits/plonky2x/contract/lib/solidity-bytes-utils @@ -0,0 +1 @@ +Subproject commit e0115c4d231910df47ce3b60625ce562fe4af985 diff --git a/circuits/plonky2x/contract/script/Verify.s.sol b/circuits/plonky2x/contract/script/Verify.s.sol new file mode 100644 index 0000000..0b9f306 --- /dev/null +++ b/circuits/plonky2x/contract/script/Verify.s.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import {Script} from "forge-std/Script.sol"; +import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; +import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol"; +import {NearX, TransactionOrReceiptId} from "../src/NearX.sol"; + +contract Verify is Script { + function run() external { + address proxyAddress = DevOpsTools.get_most_recent_deployment( + "ERC1967Proxy", + block.chainid + ); + TransactionOrReceiptId[] memory ids = new TransactionOrReceiptId[](2); + + ids[0].isTransaction = true; + bytes32 txId = hex"2c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d79"; + ids[0].id = txId; + bytes + memory txAccount = hex"7a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + ids[0].account = txAccount; + + ids[1].isTransaction = false; + bytes32 rxId = hex"7ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e"; + ids[1].id = rxId; + bytes + memory rxAccount = hex"70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + ids[1].account = rxAccount; + + vm.startBroadcast(); + + NearX lightClient = NearX(payable(proxyAddress)); + + lightClient.requestVerify(ids); + + vm.stopBroadcast(); + } +} diff --git a/circuits/plonky2x/contract/src/NearX.sol b/circuits/plonky2x/contract/src/NearX.sol index a71adb4..0838af4 100644 --- a/circuits/plonky2x/contract/src/NearX.sol +++ b/circuits/plonky2x/contract/src/NearX.sol @@ -5,7 +5,7 @@ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Own import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {ISuccinctGateway} from "./interfaces/ISuccinctGateway.sol"; -import {INearX, TransactionOrReceiptId, encodePackedIds, decodePackedIds} from "./interfaces/INearX.sol"; +import {INearX, TransactionOrReceiptId, ProofVerificationResult, encodePackedIds, decodePackedIds, decodePackedResults} from "./interfaces/INearX.sol"; /// @notice The NearX contract is a light client for Near. contract NearX is INearX, Initializable, OwnableUpgradeable, UUPSUpgradeable { @@ -117,13 +117,13 @@ contract NearX is INearX, Initializable, OwnableUpgradeable, UUPSUpgradeable { emit VerifyRequested(latestHeader, ids); } - function handleVerify(bytes memory _output, bytes memory _context) + function handleVerify(bytes calldata _output, bytes memory _context) external { if (msg.sender != gateway || !ISuccinctGateway(gateway).isCallback()) { revert NotFromSuccinctGateway(msg.sender); } - TransactionOrReceiptId[] memory ids = decodePackedIds(_output); - emit VerifyResult(ids); + ProofVerificationResult[] memory results = decodePackedResults(_output); + emit VerifyResult(results); } } diff --git a/circuits/plonky2x/contract/src/interfaces/Bytes.sol b/circuits/plonky2x/contract/src/interfaces/Bytes.sol new file mode 100644 index 0000000..7ce2504 --- /dev/null +++ b/circuits/plonky2x/contract/src/interfaces/Bytes.sol @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: MIT +// OpenZeppelin Contracts (utils/Bytes.sol) +pragma solidity ^0.8.4; + +/** + * @dev Provides a set of functions to operate with packed data in bytes array. + * + * _Available since v4.8.1 + */ +library Bytes { + /** + * @dev Read uint from input bytes array + */ + function _readUint( + bytes memory input, + uint256 offset, + uint256 length + ) private pure returns (uint256 result) { + require(offset + length <= input.length, "Bytes: Out of range"); + assembly { + // Read 256 bits at the given offset + result := mload(add(add(input, 0x20), offset)) + } + } + + /** + * @dev Convert bytes to bytes32 array + */ + function toBytes32Array(bytes memory input) + internal + pure + returns (bytes32[] memory) + { + require(input.length % 32 == 0, "Bytes: Invalid input length"); + bytes32[] memory result = new bytes32[](input.length / 32); + assembly { + // Read length of input + let length := mload(input) + + // Seek offset to the beginning + let offset := add(input, 0x20) + + // Point result offset to the beginging + let resultOffset := add(result, 0x20) + + for { + let i := 0 + } lt(i, length) { + i := add(i, 0x20) + } { + // Copy 32 bytes to bytes32 array + mstore(resultOffset, mload(add(offset, i))) + // resultOffset += 32 + resultOffset := add(resultOffset, 0x20) + } + } + return result; + } + + /** + * @dev Read sub bytes array from input bytes array + */ + function readBytes( + bytes memory input, + uint256 offset, + uint256 length + ) internal pure returns (bytes memory result, uint256 nextOffset) { + nextOffset = offset + length; + require(nextOffset <= input.length, "Bytes: Out of range"); + result = new bytes(length); + assembly { + // Set seek to the given offset of the input + let seek := add(add(input, 0x20), offset) + let resultOffset := add(result, 0x20) + + for { + let i := 0 + } lt(i, length) { + i := add(i, 0x20) + } { + mstore(add(resultOffset, i), mload(add(seek, i))) + } + } + } + + /** + * @dev Read uint256 from input bytes array + */ + function readUint256(bytes memory input, uint256 offset) + internal + pure + returns (uint256 result, uint256 nextOffset) + { + return (_readUint(input, offset, 32), offset + 32); + } + + /** + * @dev Read uint160 from input bytes array + */ + function readUint160(bytes memory input, uint256 offset) + internal + pure + returns (uint160 result, uint256 nextOffset) + { + return (uint160(_readUint(input, offset, 20) >> 96), offset + 20); + } + + /** + * @dev Read uint128 from input bytes array + */ + function readUint128(bytes memory input, uint256 offset) + internal + pure + returns (uint128 result, uint256 nextOffset) + { + return (uint128(_readUint(input, offset, 16) >> 128), offset + 16); + } + + /** + * @dev Read uint64 from input bytes array + */ + function readUint64(bytes memory input, uint256 offset) + internal + pure + returns (uint64 result, uint256 nextOffset) + { + return (uint64(_readUint(input, offset, 8) >> 192), offset + 8); + } + + /** + * @dev Read uint32 from input bytes array + */ + function readUint32(bytes memory input, uint256 offset) + internal + pure + returns (uint32 result, uint256 nextOffset) + { + return (uint32(_readUint(input, offset, 4) >> 224), offset + 4); + } + + /** + * @dev Read uint16 from input bytes array + */ + function readUint16(bytes memory input, uint256 offset) + internal + pure + returns (uint16 result, uint256 nextOffset) + { + return (uint16(_readUint(input, offset, 2) >> 240), offset + 2); + } +} diff --git a/circuits/plonky2x/contract/src/interfaces/INearX.sol b/circuits/plonky2x/contract/src/interfaces/INearX.sol index 59d1f3a..db3f8f4 100644 --- a/circuits/plonky2x/contract/src/interfaces/INearX.sol +++ b/circuits/plonky2x/contract/src/interfaces/INearX.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import "./Bytes.sol"; + interface INearX { /// @notice Emits event with the new head update. event HeadUpdate(bytes32 headerHash); @@ -31,7 +33,7 @@ interface INearX { error FunctionIdsNotInitialised(); /// @notice The result of the verification request - event VerifyResult(TransactionOrReceiptId[] ids); + event VerifyResult(ProofVerificationResult[] results); } uint256 constant MAX_LEN = 64; @@ -48,12 +50,20 @@ function encodePackedIds(TransactionOrReceiptId[] memory ids) { bytes memory output; for (uint256 i = 0; i < ids.length; i++) { - output = abi.encodePacked( - output, - ids[i].isTransaction, - ids[i].id, - ids[i].account - ); + if (i > 0) { + output = abi.encodePacked( + output, + ids[i].isTransaction, + ids[i].id, + ids[i].account + ); + } else { + output = abi.encodePacked( + ids[i].isTransaction, + ids[i].id, + ids[i].account + ); + } } return output; } @@ -62,13 +72,17 @@ function decodePackedIds(bytes memory _input) pure returns (TransactionOrReceiptId[] memory) { - uint256 idsLength = _input.length / 1 + 32 + MAX_LEN; + uint256 iterationLength = 1 + 32 + MAX_LEN; + uint256 idsLength = _input.length / iterationLength; TransactionOrReceiptId[] memory ids = new TransactionOrReceiptId[]( idsLength ); + bytes memory nextBytes; + uint256 offset = 0; for (uint256 i = 0; i < idsLength; i++) { - ids[i] = decodeTransactionOrReceiptId(_input); + (nextBytes, offset) = Bytes.readBytes(_input, offset, iterationLength); + ids[i] = decodeTransactionOrReceiptId(nextBytes); } return ids; } @@ -77,9 +91,52 @@ function decodeTransactionOrReceiptId(bytes memory _input) pure returns (TransactionOrReceiptId memory id) { - id.isTransaction = abi.decode(_input, (bool)); - id.id = abi.decode(_input, (bytes32)); - bytes32 accountX = abi.decode(_input, (bytes32)); - bytes32 accountY = abi.decode(_input, (bytes32)); - id.account = abi.encodePacked(accountX, accountY); + bytes memory nextBytes; + uint256 offset = 0; + + (nextBytes, offset) = Bytes.readBytes(_input, offset, 1); + id.isTransaction = uint8(bytes1(nextBytes)) != 0; + + (nextBytes, offset) = Bytes.readBytes(_input, offset, 32); + id.id = abi.decode(nextBytes, (bytes32)); + + (nextBytes, offset) = Bytes.readBytes(_input, offset, MAX_LEN); + id.account = nextBytes; +} + +struct ProofVerificationResult { + bytes32 id; + bool result; +} + +function decodePackedResults(bytes memory _input) + pure + returns (ProofVerificationResult[] memory) +{ + uint256 iterationLength = 1 + 32; + uint256 idsLength = _input.length / iterationLength; + ProofVerificationResult[] memory results = new ProofVerificationResult[]( + idsLength + ); + + bytes memory nextBytes; + uint256 offset = 0; + for (uint256 i = 0; i < idsLength; i++) { + (nextBytes, offset) = Bytes.readBytes(_input, offset, iterationLength); + results[i] = decodeProofVerificationResult(nextBytes); + } + return results; +} + +function decodeProofVerificationResult(bytes memory _input) + pure + returns (ProofVerificationResult memory result) +{ + bytes memory nextBytes; + uint256 offset = 0; + (nextBytes, offset) = Bytes.readBytes(_input, offset, 32); + result.id = abi.decode(nextBytes, (bytes32)); + + (nextBytes, offset) = Bytes.readBytes(_input, offset, 1); + result.result = uint8(bytes1(nextBytes)) != 0; } diff --git a/circuits/plonky2x/contract/test/NearX.t.sol b/circuits/plonky2x/contract/test/NearX.t.sol index 3859530..e168c10 100644 --- a/circuits/plonky2x/contract/test/NearX.t.sol +++ b/circuits/plonky2x/contract/test/NearX.t.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.13; import "forge-std/Test.sol"; import "../src/NearX.sol"; +import {Bytes} from "../src/interfaces/Bytes.sol"; contract NearXTest is Test { NearX public lightClient; @@ -18,26 +19,61 @@ contract NearXTest is Test { console.logBytes(encodedInput); } - function testGetEncodePackedVerify() public view { + function testGetEncodePackedVerify() public { // TODO: bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; - bytes tx = hex"012c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d797a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; - bytes rx = hex"007ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + bytes memory txIsAccount = hex"01"; + bytes32 txId = hex"2c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d79"; + bytes + memory txAccount = hex"7a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + + bytes memory rxIsAccount = hex"00"; + bytes32 rxId = hex"7ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e"; + bytes + memory rxAccount = hex"70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; TransactionOrReceiptId[] memory ids = new TransactionOrReceiptId[](2); + ids[0].isTransaction = true; - ids[0] - .id = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; + ids[0].id = txId; + ids[0].account = txAccount; + ids[1].isTransaction = false; - ids[1] - .id = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; - ids[1] - .account = hex"0000000000000000000000000000000000000000000000000000000000000000"; - bytes memory encodedInput = abi.encodePacked( - latestHeader, - encodePackedIds(ids) + ids[1].id = rxId; + ids[1].account = rxAccount; + + bytes memory encodedIds = encodePackedIds(ids); + bytes memory encodedInput = abi.encodePacked(header, encodedIds); + + bytes + memory expected = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3012c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d797a61766f64696c2e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c007ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e70726963656f7261636c652e746573746e65742c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c"; + + assertEq(encodedInput, expected); + + bytes32 encodedHeader = bytes32(encodedInput); + assertEq(header, encodedHeader); + + TransactionOrReceiptId[] memory decodedIds = decodePackedIds( + encodedIds ); + assertEq(ids[0].isTransaction, decodedIds[0].isTransaction); + assertEq(ids[0].id, decodedIds[0].id); + assertEq(ids[0].account, decodedIds[0].account); + assertEq(ids[1].isTransaction, decodedIds[1].isTransaction); + assertEq(ids[1].id, decodedIds[1].id); + assertEq(ids[1].account, decodedIds[1].account); + } - console.logBytes(encodedInput); + function testDecodeResult() public { + bytes + memory inputData = hex"7ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e012c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d7901"; + ProofVerificationResult[] memory results = decodePackedResults( + inputData + ); + bytes + memory outputTest = hex"2c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d79017ff581f8517ec58459099a5af2465d5232fdcdd7c4da9c3d42a887bf6bd5457e01"; + ProofVerificationResult[] memory expected = decodePackedResults( + outputTest + ); } } diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 79f96e4..5cf9835 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -3,6 +3,7 @@ use plonky2x::prelude::*; use pretty_assertions::assert_eq; use crate::{ + hint::FetchHeaderInputs, merkle::{MerklePathVariable, NearMerkleTree}, variables::{ ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index 206946c..0cd61a5 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -23,13 +23,7 @@ impl Circuit for SyncCircuit { plonky2::plonk::config::AlgebraicHasher<>::Field>, { let trusted_header_hash = b.evm_read::(); - b.watch(&trusted_header_hash, "trusted_header_hash"); - - let untrusted = FetchHeaderInputs(NETWORK.into()).fetch(b, &trusted_header_hash); - let untrusted_hash = untrusted.hash(b); - b.watch(&untrusted_hash, "untrusted_hash"); - b.assert_is_equal(trusted_header_hash, untrusted_hash); - let head = untrusted; + let head = FetchHeaderInputs(NETWORK.into()).fetch(b, &trusted_header_hash); // This is a very interesting trick to be able to get the BPS for the next epoch // without the need to store the BPS, we verify the hash of the BPS in the diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index cd5d103..31d7c9a 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -3,12 +3,13 @@ pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use plonky2x::{ frontend::{hint::simple::hint::Hint, mapreduce::generator::MapReduceDynamicGenerator}, prelude::plonky2::plonk::config::{AlgebraicHasher, GenericConfig}, + register_watch_generator, }; use serde::{Deserialize, Serialize}; use crate::{ builder::Verify, - hint::{FetchProofInputs, ProofInputVariable}, + hint::{FetchHeaderInputs, FetchProofInputs, ProofInputVariable}, variables::{ byte_from_bool, CryptoHashVariable, EncodeInner, HeaderVariable, TransactionOrReceiptIdVariable, @@ -34,22 +35,29 @@ impl Circuit <>::Config as GenericConfig>::Hasher: AlgebraicHasher<>::Field>, { - let trusted_head = b.evm_read::(); + let trusted_header_hash = b.evm_read::(); + let head = FetchHeaderInputs(NETWORK.into()).fetch(b, &trusted_header_hash); + let mut ids = vec![]; for _ in 0..N { ids.push(b.evm_read::()); } - let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &trusted_head, &ids); + let proofs = FetchProofInputs::(NETWORK.into()).fetch(b, &head, &ids); + // Init a default result for N let zero = b.constant::([0u8; 32].into()); let _false = b._false(); + let default = ProofVerificationResultVariable { + id: zero, + result: _false, + }; // TODO: write some outputs here for each ID - let output = b.mapreduce_dynamic::<(), ProofInputVariable, ArrayVariable, Self, B, _, _>( - (), + let output = b.mapreduce_dynamic::, Self, B, _, _>( + default, proofs.data, - |_, proofs, b| { + |default, proofs, b| { let mut results = vec![]; // TODO[Optimisation]: could parallelise these @@ -60,19 +68,16 @@ impl Circuit results.resize( N, - ProofVerificationResultVariable { - id: zero, - result: _false, - }, + default, ); results.into() }, |_, l, r, b| MergeProofHint::.merge(b, &l, &r), ); + b.watch_slice(&output.data, "output"); for r in output.data { b.evm_write::(r.id); - let _true = b._true(); let passed = byte_from_bool(b, r.result); b.evm_write::(passed); } @@ -84,6 +89,7 @@ impl Circuit { registry.register_async_hint::>(); registry.register_hint::>(); + registry.register_async_hint::(); // We hash in verify registry.register_hint::(); @@ -92,7 +98,7 @@ impl Circuit registry.register_simple::, Self, @@ -100,7 +106,7 @@ impl Circuit D, >>(dynamic_id); - // TODO: register_watch_generator! + register_watch_generator!(registry, L, D, ProofVerificationResultVariable); } } @@ -130,14 +136,23 @@ pub struct MergeProofHint; impl, const D: usize, const N: usize> Hint for MergeProofHint { fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let left = input_stream.read_value::>(); + log::debug!("Left results: {:?}", left); let right = input_stream.read_value::>(); + log::debug!("Right results: {:?}", right); let mut results = left .into_iter() .chain(right.into_iter()) - .filter_map(|r| if r.id.0 != [0u8; 32] { Some(r) } else { None }) + .filter_map(|r| { + if r.id.0 != [0u8; 32] && r.id.0 != [255u8; 32] { + Some(r) + } else { + None + } + }) .collect_vec(); + log::debug!("Merged results: {:?}", results); results.resize( N, ProofVerificationResultVariableValue:: { @@ -171,12 +186,10 @@ impl MergeProofHint { mod beefy_tests { use std::str::FromStr; - use ::test_utils::CryptoHash; use near_light_client_protocol::prelude::Itertools; use near_primitives::types::TransactionOrReceiptId; - use plonky2x::frontend::vars::EvmVariable; use serial_test::serial; - use test_utils::fixture; + use test_utils::{fixture, CryptoHash}; use super::*; use crate::{ @@ -227,7 +240,7 @@ mod beefy_tests { VerifyCircuit::::define(b); }; let writer = |input: &mut PI| { - input.evm_write::(header.into()); + input.evm_write::(header.hash().0.into()); for tx in txs { input.evm_write::(tx.into()); } @@ -268,7 +281,7 @@ mod beefy_tests { VerifyCircuit::::define(b); }; let writer = |input: &mut PI| { - input.write::(header.into()); + input.evm_write::(header.hash().0.into()); input.write::>(ids.into()); }; let assertions = |mut output: PO| { diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index a9166e1..b7d7d65 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -73,16 +73,20 @@ impl, const D: usize> AsyncHint for FetchHeaderInput } impl FetchHeaderInputs { + /// Fetches a header based on its known hash and witnesses the result. pub fn fetch, const D: usize>( self, b: &mut CircuitBuilder, - hash: &CryptoHashVariable, + trusted_hash: &CryptoHashVariable, ) -> HeaderVariable { let mut input_stream = VariableStream::new(); - input_stream.write::(hash); + input_stream.write::(trusted_hash); let output_stream = b.async_hint(input_stream, self); - output_stream.read::(b) + let untrusted = output_stream.read::(b); + let untrusted_hash = untrusted.hash(b); + b.assert_is_equal(*trusted_hash, untrusted_hash); + untrusted } } // TODO: refactor into some client-like carrier for all hints that is serdeable @@ -136,7 +140,7 @@ impl, const D: usize, const B: usize> AsyncHint assert_eq!(proofs.len(), B, "Invalid number of proofs"); - log::info!("Fetched {} proofs", proofs.len()); + log::debug!("Fetched {} proofs", proofs.len()); for (k, p) in proofs.into_iter() { output_stream.write_value::(k.0.into()); @@ -166,6 +170,11 @@ impl FetchProofInputs { proof: output_stream.read::(b), }); } + // Witness that each head block root in each proof is the same as the trusted + // head + inputs.iter().for_each(|x| { + b.assert_is_equal(x.proof.head_block_root, head.inner_lite.block_merkle_root) + }); inputs.into() } } diff --git a/circuits/plonky2x/src/merkle.rs b/circuits/plonky2x/src/merkle.rs index ddf38b7..7667292 100644 --- a/circuits/plonky2x/src/merkle.rs +++ b/circuits/plonky2x/src/merkle.rs @@ -3,7 +3,7 @@ use plonky2x::prelude::*; /// This is an unprefixed merkle tree without collision resistance, this should /// probably adapt the tendermint tree or introduce this functionality to -/// succintx's simple tree +/// succinct's simple tree pub trait NearMerkleTree { fn get_root_from_merkle_proof_hashed_leaf_unindex( &mut self, diff --git a/vendor/succinctx b/vendor/succinctx index 9698a57..b2540e2 160000 --- a/vendor/succinctx +++ b/vendor/succinctx @@ -1 +1 @@ -Subproject commit 9698a57ab5c6681eabc8dc105869581c4ce7d21b +Subproject commit b2540e29d54bcf97bc922d57b50acfe89665398a From 9462c9db64c3e1dbd17b75feae845aaa78965a82 Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 13:42:04 +0000 Subject: [PATCH 43/67] wip: test 128x8 batch --- bin/operator/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/operator/src/main.rs b/bin/operator/src/main.rs index 24ee4e8..d294e00 100644 --- a/bin/operator/src/main.rs +++ b/bin/operator/src/main.rs @@ -19,8 +19,8 @@ fn main() { use near_light_clientx::SyncCircuit; SyncCircuit::::entrypoint(); } else if #[cfg(feature = "verify")] { - const PROOF_AMT: usize = 2; - const PROOF_BATCH_SIZE: usize = 1; + const PROOF_AMT: usize = 128; + const PROOF_BATCH_SIZE: usize = 4; assert!(PROOF_AMT % PROOF_BATCH_SIZE == 0); assert!((PROOF_AMT / PROOF_BATCH_SIZE).is_power_of_two()); From e14fd8f5f9d72006d83e53837e56f44cba3211b8 Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 16:14:12 +0000 Subject: [PATCH 44/67] test: remove redundant verify test --- circuits/plonky2x/src/builder.rs | 65 +------------------------------- 1 file changed, 2 insertions(+), 63 deletions(-) diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 5cf9835..078ab42 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -570,7 +570,7 @@ mod beefy_tests { #[test] #[serial] - fn beefy_test_next_bps() { + fn beefy_builder_test_next_bps() { let (header, bps, _) = testnet_state(); let bps_hash = CryptoHash::hash_borsh(bps.clone()); @@ -612,73 +612,12 @@ mod beefy_tests { #[test] #[serial] - fn beefy_test_proof() { + fn beefy_builder_test_proof_blackbox() { let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); - let p: BasicProof = fixture("old.json"); - let outcome_hash = CryptoHash::hash_borsh(p.outcome_proof.to_hashes()); - - const OUTCOME_PROOF_AMT: usize = 2; - const OUTCOME_ROOT_PROOF_AMT: usize = 2; - const BLOCK_PROOF_AMT: usize = 26; - - let define = |builder: &mut B| { - let proof = builder.read::(); - let expected_outcome_root = builder.read::(); - let expected_block_root = builder.read::(); - - // TODO: to_hashes - let outcome_hash = builder.constant::(outcome_hash.0.into()); - let root_matches = builder.verify_outcome( - &expected_outcome_root, - &proof.outcome_proof, - &outcome_hash, - &proof.outcome_root_proof, - ); - builder.write::(root_matches); - - // TODO: to_hashes - let block_hash = - builder.constant::(p.block_header_lite.hash().0.into()); - let root_matches = - builder.verify_block(&expected_block_root, &proof.block_proof, &block_hash); - builder.write::(root_matches); - - let proof_verified = builder.verify(proof); - builder.write::(proof_verified); - }; - let writer = |input: &mut PI| { - input.write::( - near_light_client_protocol::Proof::Basic { - head_block_root: block_root, - proof: Box::new(fixture("old.json")), - } - .into(), - ); - input.write::(p.block_header_lite.inner_lite.outcome_root.0.into()); - input.write::(block_root.0.clone().into()); - }; - let assertions = |mut output: PO| { - assert!(output.read::(), "outcome root matches"); - assert!(output.read::(), "block root matches"); - assert!(output.read::(), "proof verified"); - }; - builder_suite(define, writer, assertions); - } - - #[test] - #[serial] - fn beefy_test_proof_blackbox() { - let block_root = - CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); - - const OUTCOME_PROOF_AMT: usize = 2; - const OUTCOME_ROOT_PROOF_AMT: usize = 2; - const BLOCK_PROOF_AMT: usize = 26; let define = |builder: &mut B| { let registered_proof = builder.read::(); - let proof_verified = builder.verify(registered_proof); builder.write::(proof_verified); }; From 3ea8254727b13a4633d97948c01fc57dc5954eca Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 16:14:33 +0000 Subject: [PATCH 45/67] style: cleanup and lints --- bin/client/src/client/mod.rs | 3 +- bin/client/src/client/store.rs | 3 +- circuits/plonky2x/Cargo.toml | 7 +- circuits/plonky2x/src/builder.rs | 25 +++---- circuits/plonky2x/src/circuits/sync.rs | 12 --- circuits/plonky2x/src/circuits/verify.rs | 30 +++++--- circuits/plonky2x/src/hint.rs | 2 +- circuits/plonky2x/src/test_utils.rs | 1 + circuits/plonky2x/src/variables.rs | 93 ++++++++++-------------- crates/protocol/src/lib.rs | 6 +- crates/rpc/src/lib.rs | 12 ++- crates/test-utils/src/lib.rs | 11 +-- 12 files changed, 89 insertions(+), 116 deletions(-) diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 9f7ff7a..1de74d0 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -283,7 +283,7 @@ impl LightClient { let (oks, errs): (Vec<_>, Vec<_>) = proofs.into_values().partition_result(); if !errs.is_empty() { - return Err(anyhow::format_err!("Failed to fetch proofs: {:?}", errs)); + Err(anyhow::format_err!("Failed to fetch proofs: {:?}", errs)) } else { let p = protocol::experimental::Proof::new(head.inner_lite.block_merkle_root, oks); self.store @@ -297,7 +297,6 @@ impl LightClient { #[cfg(test)] mod tests { - use super::*; #[test] fn t() {} diff --git a/bin/client/src/client/store.rs b/bin/client/src/client/store.rs index 649438a..e263b4f 100644 --- a/bin/client/src/client/store.rs +++ b/bin/client/src/client/store.rs @@ -101,7 +101,6 @@ pub fn head_key() -> CryptoHash { pub mod sled { use ::sled::{open, transaction::TransactionError, Batch, Db, Transactional, Tree}; - use borsh::ser::BorshSerialize as BorshSerializeExt; use itertools::Itertools; use super::*; @@ -263,7 +262,7 @@ pub mod sled { let ref_count = old_ref .map(|ov| ov.to_vec()) .and_then(|ov| u32::try_from_slice(&ov).ok()) - .unwrap_or_else(|| 0); + .unwrap_or(0); log::debug!("Incrementing ref count for {:?}, {}", key, ref_count); borsh::to_vec(&(ref_count + 1)).ok() } diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index 126d07f..55dd953 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -1,7 +1,8 @@ [package] -edition = "2021" -name = "near-light-clientx" -version = "0.1.0" +edition = "2021" +name = "near-light-clientx" +resolver = "2" +version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index 078ab42..fc998e8 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -3,7 +3,6 @@ use plonky2x::prelude::*; use pretty_assertions::assert_eq; use crate::{ - hint::FetchHeaderInputs, merkle::{MerklePathVariable, NearMerkleTree}, variables::{ ApprovalMessage, BlockHeightVariable, BlockVariable, BpsApprovals, BpsArr, @@ -251,20 +250,20 @@ impl, const D: usize> Sync for CircuitBuilder epoch_bps: &BpsArr, next_block: &BlockVariable, ) -> SyncedVariable { - let a = self.ensure_not_already_verified(&head, &next_block.header.inner_lite.height); + let a = self.ensure_not_already_verified(head, &next_block.header.inner_lite.height); self.assertx(a); - let b = self.ensure_epoch_is_current_or_next(&head, &next_block.header.inner_lite.epoch_id); + let b = self.ensure_epoch_is_current_or_next(head, &next_block.header.inner_lite.epoch_id); self.assertx(b); let c = self.ensure_if_next_epoch_contains_next_bps( - &head, + head, &next_block.header.inner_lite.epoch_id, &next_block.next_bps, ); self.assertx(c); - let approval = self.reconstruct_approval_message(&next_block); + let approval = self.reconstruct_approval_message(next_block); let stake = self.validate_signatures(&next_block.approvals_after_next, epoch_bps, approval); let d = self.ensure_stake_is_sufficient(&stake); self.assertx(d); @@ -299,12 +298,11 @@ impl, const D: usize> Sync for CircuitBuilder input_stream.write(&next_block_hash); input_stream.write(&next_block.header.inner_lite.height); let output_stream = self.hint(input_stream, BuildEndorsement); - let msg = output_stream.read::(self); - msg + output_stream.read::(self) } else { let mut bytes = vec![ByteVariable::zero(self)]; bytes.extend_from_slice(&next_block_hash.as_bytes()); - let blocks_to_advance = self.constant::(2u64.into()); + let blocks_to_advance = self.constant::(2u64); let height = self.add(blocks_to_advance, next_block.header.inner_lite.height); bytes.extend_from_slice(&to_le_bytes::<_, _, D, 8>(self, &height).0); let bytes: [ByteVariable; 41] = bytes.try_into().unwrap(); @@ -459,7 +457,7 @@ mod tests { #[test] fn test_ensure_next_bps() { - let (header, bps, nbps_hash) = testnet_state(); + let (header, bps, _) = testnet_state(); let bps_hash = CryptoHash::hash_borsh(bps.clone()); let define = |builder: &mut B| { @@ -559,7 +557,6 @@ mod tests { #[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { - use near_light_client_protocol::prelude::BasicProof; use serial_test::serial; use crate::{ @@ -638,7 +635,7 @@ mod beefy_tests { #[test] #[serial] - fn beefy_test_sync_across_epoch_boundaries() { + fn beefy_builder_test_sync_across_epoch_boundaries() { let (head, next_bps, next_block) = test_state(); let define = |builder: &mut B| { @@ -657,16 +654,14 @@ mod beefy_tests { let header = output.read::(); println!("header: {:?}", header); }; - // TODO: next two builder_suite(define, writer, assertions); } - // TODO: probably not needed #[test] #[serial] - fn beefy_test_bounded_signatures() { + fn beefy_builder_test_bounded_signatures() { let (_, bps, next_block) = test_state(); - const BPS_AMT: usize = 5; + const BPS_AMT: usize = 15; let define = |builder: &mut B| { let bps = builder.read::>(); diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index 0cd61a5..5faee83 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -60,18 +60,6 @@ impl Circuit for SyncCircuit { } } -#[derive(CircuitVariable, Debug, Clone)] -pub struct ProofMapReduceVariable { - pub height_indices: ArrayVariable, - pub results: ArrayVariable, -} - -#[derive(CircuitVariable, Debug, Clone)] -pub struct ProofMapReduceCtx { - pub zero: BlockHeightVariable, - pub result: BoolVariable, -} - #[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index 31d7c9a..a38cb6a 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -10,10 +10,7 @@ use serde::{Deserialize, Serialize}; use crate::{ builder::Verify, hint::{FetchHeaderInputs, FetchProofInputs, ProofInputVariable}, - variables::{ - byte_from_bool, CryptoHashVariable, EncodeInner, HeaderVariable, - TransactionOrReceiptIdVariable, - }, + variables::{byte_from_bool, CryptoHashVariable, EncodeInner, TransactionOrReceiptIdVariable}, }; pub type ProofMapReduceVariable = ArrayVariable; @@ -137,12 +134,13 @@ impl, const D: usize, const N: usize> Hint for Merge fn hint(&self, input_stream: &mut ValueStream, output_stream: &mut ValueStream) { let left = input_stream.read_value::>(); log::debug!("Left results: {:?}", left); + let right = input_stream.read_value::>(); log::debug!("Right results: {:?}", right); let mut results = left .into_iter() - .chain(right.into_iter()) + .chain(right) .filter_map(|r| { if r.id.0 != [0u8; 32] && r.id.0 != [255u8; 32] { Some(r) @@ -153,6 +151,7 @@ impl, const D: usize, const N: usize> Hint for Merge .collect_vec(); log::debug!("Merged results: {:?}", results); + results.resize( N, ProofVerificationResultVariableValue:: { @@ -161,7 +160,7 @@ impl, const D: usize, const N: usize> Hint for Merge }, ); - output_stream.write_value::>(results.into()); + output_stream.write_value::>(results); } } @@ -269,23 +268,34 @@ mod beefy_tests { const AMT: usize = 128; const BATCH: usize = 4; - let ids = fixture::>("ids.json") + let txs = fixture::>("ids.json") .into_iter() .take(AMT) .map(Into::>::into) .collect_vec(); - assert_eq!(ids.len(), AMT); + assert_eq!(txs.len(), AMT); let define = |b: &mut B| { VerifyCircuit::::define(b); }; let writer = |input: &mut PI| { input.evm_write::(header.hash().0.into()); - input.write::>(ids.into()); + for tx in txs { + input.evm_write::(tx.into()); + } }; let assertions = |mut output: PO| { - println!("{:#?}", output.read::>()); + let mut results = vec![]; + for _ in 0..AMT { + let id = output.evm_read::(); + let result = output.evm_read::(); + results.push(ProofVerificationResultVariableValue:: { + id, + result: result != 0, + }); + } + println!("{:#?}", results); }; builder_suite(define, writer, assertions); } diff --git a/circuits/plonky2x/src/hint.rs b/circuits/plonky2x/src/hint.rs index b7d7d65..4f7c2bb 100644 --- a/circuits/plonky2x/src/hint.rs +++ b/circuits/plonky2x/src/hint.rs @@ -195,7 +195,7 @@ mod tests { #[test] fn test_fetch_header() { - let (header, bps, nb) = test_state(); + let (header, _, nb) = test_state(); let define = |b: &mut B| { let header = b.read::(); diff --git a/circuits/plonky2x/src/test_utils.rs b/circuits/plonky2x/src/test_utils.rs index b908ab4..e8aeb42 100644 --- a/circuits/plonky2x/src/test_utils.rs +++ b/circuits/plonky2x/src/test_utils.rs @@ -74,6 +74,7 @@ pub fn builder_suite( circuit.verify(&proof, &inputs, &output); } +#[allow(dead_code)] pub fn mock_builder_suite( define: F, writer: WriteInputs, diff --git a/circuits/plonky2x/src/variables.rs b/circuits/plonky2x/src/variables.rs index 39cc86d..bd4ae00 100644 --- a/circuits/plonky2x/src/variables.rs +++ b/circuits/plonky2x/src/variables.rs @@ -64,8 +64,7 @@ impl HeaderVariable { ) -> CryptoHashVariable { let inner_lite = self.inner_lite.hash(b); let lite_rest = b.curta_sha256_pair(inner_lite, self.inner_rest_hash); - let hash = b.curta_sha256_pair(lite_rest, self.prev_block_hash); - hash + b.curta_sha256_pair(lite_rest, self.prev_block_hash) } } impl EvmVariable for HeaderVariable { @@ -138,17 +137,17 @@ pub struct HeaderInnerVariable { impl From for HeaderInnerVariableValue { fn from(header: BlockHeaderInnerLiteView) -> Self { Self { - height: header.height.into(), + height: header.height, epoch_id: header.epoch_id.0.into(), next_epoch_id: header.next_epoch_id.0.into(), prev_state_root: header.prev_state_root.0.into(), outcome_root: header.outcome_root.0.into(), + // Maybe don't need this anymore timestamp: if header.timestamp > 0 { header.timestamp } else { header.timestamp_nanosec - } - .into(), + }, next_bp_hash: header.next_bp_hash.0.into(), block_merkle_root: header.block_merkle_root.0.into(), } @@ -172,9 +171,9 @@ impl HeaderInnerVariable { input_stream.write(&self.block_merkle_root); let output_bytes = b.hint(input_stream, EncodeInner); - let bytes = output_bytes.read::>(b); - bytes + output_bytes.read::>(b) } + pub(crate) fn hash, const D: usize>( &self, b: &mut CircuitBuilder, @@ -318,10 +317,11 @@ pub struct BlockVariable { impl From for BlockVariableValue { fn from(block: LightClientBlockView) -> Self { + // TODO[Optimisation]: Constrain these in-circuit let next_bps_hash = block .next_bps .as_ref() - .map(|bps| CryptoHash::hash_borsh(bps)) + .map(CryptoHash::hash_borsh) .unwrap_or_default() .0 .into(); @@ -346,26 +346,20 @@ impl From>>> for BpsApprovalsValue { fn from(approvals: Vec>>) -> Self { - let mut is_active = vec![false; AMT]; - let mut signatures = vec![Default::default(); AMT]; - - approvals + let (signatures, is_active) = approvals .into_iter() .take(AMT) - .enumerate() - .for_each(|(i, s)| { - is_active[i] = s.is_some(); + .map(|s| { + let is_active = s.is_some(); let s: SignatureVariableValue = s.into(); - signatures[i] = s; - }); + + (s.signature, is_active) + }) + .unzip(); Self { - is_active: is_active.into(), - signatures: signatures - .into_iter() - .map(|x| x.signature) - .collect_vec() - .into(), + is_active, + signatures, } } } @@ -398,12 +392,12 @@ const ACCOUNT_ID_PADDING_BYTE: u8 = ACCOUNT_DATA_SEPARATOR; impl From for ValidatorStakeVariableValue { fn from(vs: ValidatorStake) -> Self { let public_key = CompressedEdwardsY(vs.public_key().unwrap_as_ed25519().0); - let stake = vs.stake(); + let stake = vs.stake().into(); let account_id = pad_account_id(&vs.take_account_id()); Self { - account_id: account_id.try_into().unwrap(), // SAFETY: already checked this above - public_key: public_key.into(), - stake: stake.into(), + account_id, + public_key, + stake, } } } @@ -429,34 +423,32 @@ pub(crate) fn normalise_account_id( account_str.parse().expect("invalid account id") } -impl Into for ValidatorStakeVariableValue { - fn into(self) -> ValidatorStakeView { - let account_id = normalise_account_id::(&self.account_id); - let public_key = PublicKey::ED25519(ED25519PublicKey(self.public_key.0.into())); +impl From> for ValidatorStakeView { + fn from(val: ValidatorStakeVariableValue) -> Self { + let account_id = normalise_account_id::(&val.account_id); + let public_key = PublicKey::ED25519(ED25519PublicKey(val.public_key.0)); ValidatorStakeView::V1(ValidatorStakeViewV1 { account_id, public_key, - stake: self.stake.as_u128(), + stake: val.stake.as_u128(), }) } } impl Default for ValidatorStakeVariableValue { fn default() -> Self { - let bytes: [u8; AccountId::MAX_LEN] = [0u8; AccountId::MAX_LEN]; - let pk = CompressedEdwardsY::default(); - let stake = 0_u128; + let account_id: [u8; AccountId::MAX_LEN] = [0u8; AccountId::MAX_LEN]; + let public_key = CompressedEdwardsY::default(); Self { - account_id: bytes.into(), - public_key: pk.into(), - stake: stake.into(), + account_id, + public_key, + stake: u128::default().into(), } } } pub type PublicKeyVariable = CompressedEdwardsYVariable; -pub type PublicKeyVariableValue = CompressedEdwardsY; #[derive(CircuitVariable, Clone, Debug)] pub struct SignatureVariable { @@ -558,7 +550,7 @@ impl, const D: usize> Hint for BuildEndorsement { let next_block_height = input_stream.read_value::(); bytes.push(0u8); - bytes.extend_from_slice(&next_block_hash.as_bytes()); + bytes.extend_from_slice(next_block_hash.as_bytes()); bytes.extend_from_slice(&(next_block_height + 2).to_le_bytes()); output_stream.write_value::(bytes.try_into().unwrap()); @@ -624,7 +616,7 @@ impl HashBpsInputs { bps: &BpsArr, ) -> CryptoHashVariable { let mut input_stream = VariableStream::new(); - input_stream.write::>(&bps); + input_stream.write::>(bps); let output_stream = b.hint(input_stream, self); output_stream.read::(b) @@ -646,17 +638,17 @@ impl From for TransactionOrReceiptIdVariableValue { transaction_hash, sender_id, } => Self { - is_transaction: true.into(), + is_transaction: true, id: transaction_hash.0.into(), - account: pad_account_id(&sender_id).into(), + account: pad_account_id(&sender_id), }, GetProof::Receipt { receipt_id, receiver_id, } => Self { - is_transaction: false.into(), + is_transaction: false, id: receipt_id.0.into(), - account: pad_account_id(&receiver_id).into(), + account: pad_account_id(&receiver_id), }, } } @@ -668,7 +660,7 @@ pub fn byte_from_bool, const D: usize>( ) -> ByteVariable { let zero = b._false(); let mut bits = [zero; 8]; - bits[7] = bool.into(); + bits[7] = bool; ByteVariable::from_be_bits(bits) } @@ -723,12 +715,10 @@ mod tests { use ::test_utils::CryptoHash; use near_light_client_protocol::prelude::Itertools; use near_primitives::types::TransactionOrReceiptId; - use serial_test::serial; - use test_utils::fixture; use super::*; use crate::{ - test_utils::{builder_suite, testnet_state, B, NETWORK, PI, PO}, + test_utils::{builder_suite, B, PI, PO}, variables::TransactionOrReceiptIdVariableValue, }; @@ -777,9 +767,4 @@ mod tests { }; builder_suite(define, writer, assertions); } - - #[test] - fn test_encode_transaction() { - todo!() - } } diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index b35f78d..2d25790 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -157,15 +157,15 @@ impl Protocol { ) -> bool { let outcome_root = compute_root_from_path(outcome_proof, *outcome_hash); #[cfg(test)] - println!("outcome_root: {:?}", hex::encode(&outcome_root)); + println!("outcome_root: {:?}", hex::encode(outcome_root)); let leaf = CryptoHash::hash_borsh(outcome_root); #[cfg(test)] - println!("leaf: {:?}", hex::encode(&leaf)); + println!("leaf: {:?}", hex::encode(leaf)); let outcome_root = compute_root_from_path(outcome_root_proof, leaf); #[cfg(test)] - println!("outcome_root: {:?}", hex::encode(&outcome_root)); + println!("outcome_root: {:?}", hex::encode(outcome_root)); log::debug!("outcome_root: {:?}", outcome_root); &outcome_root == expected_outcome_root diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 3342dfd..9f2077c 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -7,11 +7,11 @@ use async_trait::async_trait; use futures::TryFutureExt; use near_jsonrpc_client::{ methods::{self, light_client_proof::RpcLightClientExecutionProofResponse}, - JsonRpcClient, MethodCallResult, + JsonRpcClient, }; use near_primitives::{ block_header::BlockHeader, - views::{validator_stake_view::ValidatorStakeView, LightClientBlockView, ValidatorStakeViewV1}, + views::{validator_stake_view::ValidatorStakeView, LightClientBlockView}, }; use crate::prelude::*; @@ -273,8 +273,7 @@ mod tests { let receipts = chunks .iter() - .map(|c| c.receipts.clone()) - .flatten() + .flat_map(|c| c.receipts.clone()) .map(|r| TransactionOrReceiptId::Receipt { receipt_id: r.receipt_id, receiver_id: r.receiver_id, @@ -282,15 +281,14 @@ mod tests { .collect_vec(); let txs = chunks .iter() - .map(|c| c.transactions.clone()) - .flatten() + .flat_map(|c| c.transactions.clone()) .map(|t| TransactionOrReceiptId::Transaction { transaction_hash: t.hash, sender_id: t.signer_id, }) .collect_vec(); - vec![receipts, txs].concat() + [receipts, txs].concat() } #[tokio::test] diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs index 3a5a7ad..3ce4aba 100644 --- a/crates/test-utils/src/lib.rs +++ b/crates/test-utils/src/lib.rs @@ -1,8 +1,5 @@ -use derive_more::{AsRef, Into}; -use near_light_client_protocol::{ - prelude::{BasicProof, Header, Itertools}, - LightClientBlockView, Protocol, StakeInfo, ValidatorStake, -}; +use derive_more::Into; +use near_light_client_protocol::{prelude::Header, LightClientBlockView, ValidatorStake}; pub use near_primitives::hash::CryptoHash; pub use pretty_assertions::assert_eq as pas_eq; pub use serde::de::DeserializeOwned; @@ -67,7 +64,7 @@ pub fn mainnet_state() -> (Header, Vec, LightClientBlockView) { .collect(); let next = main_next(); - (head.into(), bps, next.body) + (head, bps, next.body) } pub fn testnet_state() -> (Header, Vec, LightClientBlockView) { @@ -82,7 +79,7 @@ pub fn testnet_state() -> (Header, Vec, LightClientBlockView) { .collect(); let next = test_next(); - (head.into(), bps, next.body) + (head, bps, next.body) } pub fn test_state() -> (Header, Vec, LightClientBlockView) { From d608435c8a175af1cc265643fdaf557cec3522ac Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 16:34:35 +0000 Subject: [PATCH 46/67] chore: move operator and ignore the beefy tests --- Cargo.lock | 9 +------ Makefile | 9 +++++++ bin/operator/Cargo.toml | 26 ------------------- circuits/plonky2x/Cargo.toml | 12 +++++++-- circuits/plonky2x/src/builder.rs | 5 +++- circuits/plonky2x/src/circuits/sync.rs | 2 +- circuits/plonky2x/src/circuits/verify.rs | 3 ++- .../plonky2x}/src/main.rs | 11 ++------ 8 files changed, 29 insertions(+), 48 deletions(-) delete mode 100644 bin/operator/Cargo.toml rename {bin/operator => circuits/plonky2x}/src/main.rs (79%) diff --git a/Cargo.lock b/Cargo.lock index c6dda70..17868d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3215,20 +3215,13 @@ dependencies = [ "tokio", ] -[[package]] -name = "near-light-client-succinct-operator" -version = "0.2.0" -dependencies = [ - "cfg-if", - "near-light-clientx", -] - [[package]] name = "near-light-clientx" version = "0.1.0" dependencies = [ "async-trait", "borsh", + "cfg-if", "ethers", "hex", "log", diff --git a/Makefile b/Makefile index e89be5d..05d83cc 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,15 @@ IMAGE_TAG?=0.0.1 docker: DOCKER_BUILDKIT=1 docker build --progress=plain -t $(TAG_PREFIX)/light-client:$(IMAGE_TAG) . +test: + cargo test --workspace + +# Runs all of the beefy tests that require a pretty good machine, builds all proofs in release mode +# NOTE: this might OOM if your machine is small! At least 32GB of ram is recommended with a very modern CPU. +# Likely OSX will not work and your fans will turn on! +beefy-test: + RUST_LOG=debug cargo test --workspace --ignored --release + BUILDCIRCUIT := cargo build --release --bin MVCIRCUIT := mv -f target/release diff --git a/bin/operator/Cargo.toml b/bin/operator/Cargo.toml deleted file mode 100644 index e53fe6a..0000000 --- a/bin/operator/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -edition.workspace = true -license.workspace = true -name = "near-light-client-succinct-operator" -version.workspace = true - -[[bin]] -name = "sync" -path = "src/main.rs" -required-features = [ "sync" ] - -[[bin]] -name = "verify" -path = "src/main.rs" -required-features = [ "verify" ] - -[dependencies] -cfg-if = "1.0.0" -near-light-clientx.workspace = true - -[features] -default = [ "testnet" ] -mainnet = [ ] -sync = [ ] -testnet = [ ] -verify = [ ] diff --git a/circuits/plonky2x/Cargo.toml b/circuits/plonky2x/Cargo.toml index 55dd953..fa20a2d 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/circuits/plonky2x/Cargo.toml @@ -9,6 +9,7 @@ version = "0.1.0" [dependencies] async-trait.workspace = true borsh.workspace = true +cfg-if = "1.0.0" ethers = "2.0.11" hex.workspace = true log.workspace = true @@ -31,5 +32,12 @@ test-utils.workspace = true tokio.workspace = true [features] -beefy-tests = [ ] -default = [ "beefy-tests" ] +default = [ "testnet" ] + +# Network features +mainnet = [ ] +testnet = [ ] + +# Circuit features +sync = [ ] +verify = [ ] diff --git a/circuits/plonky2x/src/builder.rs b/circuits/plonky2x/src/builder.rs index fc998e8..6e5ff9a 100644 --- a/circuits/plonky2x/src/builder.rs +++ b/circuits/plonky2x/src/builder.rs @@ -554,7 +554,6 @@ mod tests { /// - A LOT of RAM if running in release /// /// TODO: CI for only beefy tests -#[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { use serial_test::serial; @@ -567,6 +566,7 @@ mod beefy_tests { #[test] #[serial] + #[ignore] fn beefy_builder_test_next_bps() { let (header, bps, _) = testnet_state(); let bps_hash = CryptoHash::hash_borsh(bps.clone()); @@ -609,6 +609,7 @@ mod beefy_tests { #[test] #[serial] + #[ignore] fn beefy_builder_test_proof_blackbox() { let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); @@ -635,6 +636,7 @@ mod beefy_tests { #[test] #[serial] + #[ignore] fn beefy_builder_test_sync_across_epoch_boundaries() { let (head, next_bps, next_block) = test_state(); @@ -659,6 +661,7 @@ mod beefy_tests { #[test] #[serial] + #[ignore] fn beefy_builder_test_bounded_signatures() { let (_, bps, next_block) = test_state(); const BPS_AMT: usize = 15; diff --git a/circuits/plonky2x/src/circuits/sync.rs b/circuits/plonky2x/src/circuits/sync.rs index 5faee83..14dda91 100644 --- a/circuits/plonky2x/src/circuits/sync.rs +++ b/circuits/plonky2x/src/circuits/sync.rs @@ -60,7 +60,6 @@ impl Circuit for SyncCircuit { } } -#[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { use serial_test::serial; @@ -70,6 +69,7 @@ mod beefy_tests { #[test] #[serial] + #[ignore] fn beefy_test_sync_e2e() { let (header, _, _) = testnet_state(); let header = header.hash().0; diff --git a/circuits/plonky2x/src/circuits/verify.rs b/circuits/plonky2x/src/circuits/verify.rs index a38cb6a..0adb923 100644 --- a/circuits/plonky2x/src/circuits/verify.rs +++ b/circuits/plonky2x/src/circuits/verify.rs @@ -180,7 +180,6 @@ impl MergeProofHint { } } -#[cfg(feature = "beefy-tests")] #[cfg(test)] mod beefy_tests { use std::str::FromStr; @@ -198,6 +197,7 @@ mod beefy_tests { #[test] #[serial] + #[ignore] fn beefy_test_verify_e2e() { let (header, _, _) = testnet_state(); @@ -262,6 +262,7 @@ mod beefy_tests { // TODO: ignore flag as this test will likely be overkill #[test] #[serial] + #[ignore] fn beefy_test_data_driven_verify_e2e() { let (header, _, _) = testnet_state(); diff --git a/bin/operator/src/main.rs b/circuits/plonky2x/src/main.rs similarity index 79% rename from bin/operator/src/main.rs rename to circuits/plonky2x/src/main.rs index d294e00..decf00b 100644 --- a/bin/operator/src/main.rs +++ b/circuits/plonky2x/src/main.rs @@ -1,15 +1,8 @@ +#[cfg(any(feature = "sync", feature = "verify"))] use near_light_clientx::plonky2x::backend::function::Plonky2xFunction; // Testnet, FIXME: this is error prone, use something else -cfg_if::cfg_if! { - if #[cfg(feature = "mainnet")] { - const NETWORK: usize = 0; - } else if #[cfg(feature = "testnet")] { - const NETWORK: usize = 1; - } else { - panic!("provide a NETWORK feature"); - } -} +const NETWORK: usize = 1; // TODO: make this use a nicer API for use by the prover. // TODO: perpetually sync, use queue etc From d76d925bd83973949b9e9071cd79417af7194aeb Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 17:00:56 +0000 Subject: [PATCH 47/67] chore: clean up directory structure --- .gitignore | 23 +- Cargo.lock | 249 ++++-------------- Cargo.toml | 7 +- Makefile | 29 +- bin/client/src/controller.rs | 24 +- .../contract/lib/solidity-bytes-utils | 1 - circuits/plonky2x/src/circuits/mod.rs | 6 - {circuits/plonky2x => nearx}/Cargo.lock | 0 {circuits/plonky2x => nearx}/Cargo.toml | 17 +- .../plonky2x => nearx}/contract/README.md | 0 .../plonky2x => nearx}/contract/foundry.toml | 0 .../contract/script/Deploy.s.sol | 0 .../contract/script/Initialise.s.sol | 2 + .../contract/script/Upgrade.s.sol | 0 .../contract/script/Verify.s.sol | 0 .../plonky2x => nearx}/contract/src/NearX.sol | 2 +- .../contract/src/interfaces/Bytes.sol | 0 .../contract/src/interfaces/INearX.sol | 0 .../src/interfaces/ISuccinctGateway.sol | 0 .../contract/test/NearX.t.sol | 2 - {circuits/plonky2x => nearx}/src/builder.rs | 0 {circuits/plonky2x => nearx}/src/hint.rs | 0 {circuits/plonky2x => nearx}/src/lib.rs | 8 +- {circuits/plonky2x => nearx}/src/main.rs | 0 {circuits/plonky2x => nearx}/src/merkle.rs | 0 .../src/circuits => nearx/src}/sync.rs | 0 .../plonky2x => nearx}/src/test_utils.rs | 0 {circuits/plonky2x => nearx}/src/variables.rs | 0 .../src/circuits => nearx/src}/verify.rs | 0 succinct.json | 4 +- .taplo.toml => taplo.toml | 0 31 files changed, 117 insertions(+), 257 deletions(-) delete mode 160000 circuits/plonky2x/contract/lib/solidity-bytes-utils delete mode 100644 circuits/plonky2x/src/circuits/mod.rs rename {circuits/plonky2x => nearx}/Cargo.lock (100%) rename {circuits/plonky2x => nearx}/Cargo.toml (74%) rename {circuits/plonky2x => nearx}/contract/README.md (100%) rename {circuits/plonky2x => nearx}/contract/foundry.toml (100%) rename {circuits/plonky2x => nearx}/contract/script/Deploy.s.sol (100%) rename {circuits/plonky2x => nearx}/contract/script/Initialise.s.sol (93%) rename {circuits/plonky2x => nearx}/contract/script/Upgrade.s.sol (100%) rename {circuits/plonky2x => nearx}/contract/script/Verify.s.sol (100%) rename {circuits/plonky2x => nearx}/contract/src/NearX.sol (98%) rename {circuits/plonky2x => nearx}/contract/src/interfaces/Bytes.sol (100%) rename {circuits/plonky2x => nearx}/contract/src/interfaces/INearX.sol (100%) rename {circuits/plonky2x => nearx}/contract/src/interfaces/ISuccinctGateway.sol (100%) rename {circuits/plonky2x => nearx}/contract/test/NearX.t.sol (99%) rename {circuits/plonky2x => nearx}/src/builder.rs (100%) rename {circuits/plonky2x => nearx}/src/hint.rs (100%) rename {circuits/plonky2x => nearx}/src/lib.rs (66%) rename {circuits/plonky2x => nearx}/src/main.rs (100%) rename {circuits/plonky2x => nearx}/src/merkle.rs (100%) rename {circuits/plonky2x/src/circuits => nearx/src}/sync.rs (100%) rename {circuits/plonky2x => nearx}/src/test_utils.rs (100%) rename {circuits/plonky2x => nearx}/src/variables.rs (100%) rename {circuits/plonky2x/src/circuits => nearx/src}/verify.rs (100%) rename .taplo.toml => taplo.toml (100%) diff --git a/.gitignore b/.gitignore index 0bbdff0..d498792 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,26 @@ **/target -/build/* -circuits/plonky2x/build -**input.bin +# Nixos Direnv .direnv +# Light client local config file local.toml +# Lightclient DBs *.db -# Compiler files -circuits/plonky2x/contract/cache -circuits/plonky2x/contract/out -circuits/plonky2x/contract/lib +# ZK Compiler files +build/ +wrapped/ +nearx/build +nearx/contract/cache +nearx/contract/out +nearx/contract/lib # Ignores development broadcast logs !**broadcast **broadcast/*/31337/ **broadcast/**/dry-run/ -circuits/plonky2x/contract/broadcast - -wrapped/ -build/ - +nearx/contract/broadcast # Docs docs/ diff --git a/Cargo.lock b/Cargo.lock index 17868d0..ef731f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -96,9 +96,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher 0.4.4", @@ -357,46 +357,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core 0.3.4", + "axum-core", "bitflags 1.3.2", "bytes", "futures-util", - "http 0.2.11", - "http-body 0.4.6", - "hyper 0.14.28", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" -dependencies = [ - "async-trait", - "axum-core 0.4.3", - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "http-body-util", - "hyper 1.1.0", - "hyper-util", + "http", + "http-body", + "hyper", "itoa", "matchit", "memchr", @@ -413,7 +380,6 @@ dependencies = [ "tower", "tower-layer", "tower-service", - "tracing", ] [[package]] @@ -425,35 +391,14 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.11", - "http-body 0.4.6", + "http", + "http-body", "mime", "rustversion", "tower-layer", "tower-service", ] -[[package]] -name = "axum-core" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "http-body-util", - "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "backtrace" version = "0.3.69" @@ -831,7 +776,7 @@ checksum = "3311405ed7a9b541faddd4e2de71cfa908e5558658d504f7954d2aee684b96a6" dependencies = [ "anyhow", "async-trait", - "axum 0.6.20", + "axum", "byteorder", "bytes", "chrono", @@ -1780,7 +1725,7 @@ dependencies = [ "futures-timer", "futures-util", "hashers", - "http 0.2.11", + "http", "instant", "jsonwebtoken", "once_cell", @@ -2184,26 +2129,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.2.3", - "slab", - "tokio", - "tokio-util 0.7.10", - "tracing", -] - -[[package]] -name = "h2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 1.0.0", + "http", "indexmap 2.2.3", "slab", "tokio", @@ -2327,17 +2253,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http-body" version = "0.4.6" @@ -2345,30 +2260,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.11", - "pin-project-lite", -] - -[[package]] -name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http 1.0.0", -] - -[[package]] -name = "http-body-util" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" -dependencies = [ - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", + "http", "pin-project-lite", ] @@ -2400,9 +2292,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.24", - "http 0.2.11", - "http-body 0.4.6", + "h2", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -2414,25 +2306,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2 0.4.2", - "http 1.0.0", - "http-body 1.0.0", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "tokio", -] - [[package]] name = "hyper-rustls" version = "0.24.2" @@ -2440,8 +2313,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.11", - "hyper 0.14.28", + "http", + "hyper", "rustls", "tokio", "tokio-rustls", @@ -2453,7 +2326,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.28", + "hyper", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -2466,28 +2339,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.28", + "hyper", "native-tls", "tokio", "tokio-native-tls", ] -[[package]] -name = "hyper-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" -dependencies = [ - "bytes", - "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "hyper 1.1.0", - "pin-project-lite", - "socket2", - "tokio", -] - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -2913,7 +2770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" dependencies = [ "base64 0.21.7", - "hyper 0.14.28", + "hyper", "indexmap 1.9.3", "ipnet", "metrics", @@ -3138,11 +2995,11 @@ dependencies = [ [[package]] name = "near-light-client" -version = "0.2.0" +version = "0.3.0" dependencies = [ "anyhow", "async-trait", - "axum 0.7.4", + "axum", "borsh", "coerce", "config", @@ -3170,7 +3027,7 @@ dependencies = [ [[package]] name = "near-light-client-protocol" -version = "0.2.0" +version = "0.3.0" dependencies = [ "anyhow", "borsh", @@ -3192,7 +3049,7 @@ dependencies = [ [[package]] name = "near-light-client-rpc" -version = "0.2.0" +version = "0.3.0" dependencies = [ "anyhow", "async-trait", @@ -3217,7 +3074,7 @@ dependencies = [ [[package]] name = "near-light-clientx" -version = "0.1.0" +version = "0.3.0" dependencies = [ "async-trait", "borsh", @@ -3703,7 +3560,7 @@ dependencies = [ "async-trait", "futures", "futures-util", - "http 0.2.11", + "http", "opentelemetry", "prost", "thiserror", @@ -4083,7 +3940,7 @@ dependencies = [ [[package]] name = "plonky2" version = "0.1.4" -source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" +source = "git+https://github.com/mir-protocol/plonky2.git#8753162b77190f02ec6bbf1c3e31d6c3c843eb8e" dependencies = [ "ahash 0.8.8", "anyhow", @@ -4099,7 +3956,6 @@ dependencies = [ "rand 0.8.5", "rand_chacha 0.3.1", "serde", - "serde_json", "static_assertions", "unroll", "web-time", @@ -4123,7 +3979,7 @@ dependencies = [ [[package]] name = "plonky2_field" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" +source = "git+https://github.com/mir-protocol/plonky2.git#8753162b77190f02ec6bbf1c3e31d6c3c843eb8e" dependencies = [ "anyhow", "itertools 0.11.0", @@ -4155,7 +4011,7 @@ dependencies = [ [[package]] name = "plonky2_maybe_rayon" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" +source = "git+https://github.com/mir-protocol/plonky2.git#8753162b77190f02ec6bbf1c3e31d6c3c843eb8e" dependencies = [ "rayon", ] @@ -4168,7 +4024,7 @@ source = "git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd#d2598bded0 [[package]] name = "plonky2_util" version = "0.1.1" -source = "git+https://github.com/mir-protocol/plonky2.git#b600142cd454b95eba403fa1f86f582ff8688c79" +source = "git+https://github.com/mir-protocol/plonky2.git#8753162b77190f02ec6bbf1c3e31d6c3c843eb8e" [[package]] name = "plonky2x" @@ -4727,10 +4583,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.24", - "http 0.2.11", - "http-body 0.4.6", - "hyper 0.14.28", + "h2", + "http", + "http-body", + "hyper", "hyper-rustls", "hyper-tls", "ipnet", @@ -5675,7 +5531,7 @@ dependencies = [ [[package]] name = "test-utils" -version = "0.2.0" +version = "0.3.0" dependencies = [ "anyhow", "borsh", @@ -5918,7 +5774,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.4", + "toml_edit 0.22.5", ] [[package]] @@ -5938,7 +5794,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.2.3", "toml_datetime", - "winnow", + "winnow 0.5.39", ] [[package]] @@ -5949,7 +5805,7 @@ checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap 2.2.3", "toml_datetime", - "winnow", + "winnow 0.5.39", ] [[package]] @@ -5960,20 +5816,20 @@ checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap 2.2.3", "toml_datetime", - "winnow", + "winnow 0.5.39", ] [[package]] name = "toml_edit" -version = "0.22.4" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" +checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" dependencies = [ "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.1", ] [[package]] @@ -5988,10 +5844,10 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2 0.3.24", - "http 0.2.11", - "http-body 0.4.6", - "hyper 0.14.28", + "h2", + "http", + "http-body", + "hyper", "hyper-timeout", "percent-encoding", "pin-project", @@ -6175,7 +6031,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http 0.2.11", + "http", "httparse", "log", "rand 0.8.5", @@ -6340,7 +6196,7 @@ version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84614caa239fb25b2bb373a52859ffd94605ceb256eeb1d63436325cf81e3653" dependencies = [ - "axum 0.6.20", + "axum", "mime_guess", "regex", "rust-embed", @@ -6718,6 +6574,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" diff --git a/Cargo.toml b/Cargo.toml index fdeb375..94222a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [workspace.package] edition = "2021" license = "MIT" -version = "0.2.0" +version = "0.3.0" [workspace] -members = [ "bin/*", "crates/*", "circuits/*" ] +members = [ "bin/*", "crates/*", "nearx" ] resolver = "2" [workspace.dependencies] @@ -17,7 +17,7 @@ itertools = "0.12" log = "0.4" pretty_assertions = "1.4" pretty_env_logger = "0.5" -sled = "0.34" # TODO: maybe heavy +sled = "0.34" # TODO: maybe heavy, use heed instead thiserror = "1.0" # Async @@ -34,7 +34,6 @@ protobuf = "=3.2.0" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" -# TODO: upgrade # Near specific near-crypto = "0.20" near-jsonrpc-client = "0.8" diff --git a/Makefile b/Makefile index 05d83cc..7623105 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ -include .env TAG_PREFIX?=near -IMAGE_TAG?=0.0.1 +IMAGE_TAG?=0.0.3 docker: DOCKER_BUILDKIT=1 docker build --progress=plain -t $(TAG_PREFIX)/light-client:$(IMAGE_TAG) . @@ -16,23 +16,29 @@ test: beefy-test: RUST_LOG=debug cargo test --workspace --ignored --release -BUILDCIRCUIT := cargo build --release --bin -MVCIRCUIT := mv -f target/release +BUILDCIRCUIT := cargo build --release --bin near-light-clientx --features +MVCIRCUIT := mv -f target/release/near-light-clientx build-sync-circuit: - $(BUILDCIRCUIT) sync --features=sync - $(MVCIRCUIT)/sync build/ + $(BUILDCIRCUIT) sync + $(MVCIRCUIT) build/sync RUST_LOG=debug ./build/sync build .PHONY: build-sync-circuit +prove-sync-circuit: + RUST_LOG=debug ./build/sync prove input.json + # TODO: build various parameters of NUM:BATCH, e.g 1024x64 2x1, 128x4, etc build-verify-circuit: - $(BUILDCIRCUIT) verify --features=verify - $(MVCIRCUIT)/verify build/ + $(BUILDCIRCUIT) verify + $(MVCIRCUIT) build/verify RUST_LOG=debug ./build/verify build .PHONY: build-verify-circuit +prove-verify-circuit: + RUST_LOG=debug ./build/verify prove input.json +# TODO: these should be configurable and need updating SYNC_FUNCTION_ID=0x350c2939eb7ff2185612710a2b641b4b46faab68e1e2c57b6f15e0af0674f5e9 VERIFY_FUNCTION_ID=0x39fb2562b80725bb7538dd7d850126964e565a1a837d2d7f2a018e185b08fc0e ETH_RPC=https://rpc.goerli.eth.gateway.fm @@ -73,12 +79,3 @@ verify: --verify \ --verifier etherscan - -# verify-contract: -# cd circuits/plonky2x/contracts/ && forge verify-contract \ -# --chain=5 \ -# --watch \ -# 0x438634f4dF74CdD6963c750c30E3e9bf9F029838 \ -# src/NearX.sol:NearX -# TODO: upgrade - diff --git a/bin/client/src/controller.rs b/bin/client/src/controller.rs index c8107d2..1d8c027 100644 --- a/bin/client/src/controller.rs +++ b/bin/client/src/controller.rs @@ -1,4 +1,7 @@ +use std::{net::SocketAddr, str::FromStr}; + use axum::{ + body, extract::{Path, State}, http::StatusCode, response::{IntoResponse, Response}, @@ -26,16 +29,15 @@ pub(crate) fn init(config: &Config, ctx: LocalActorRef) -> JoinHand .with_state(ctx.clone()); let host = config.host.clone(); - tokio::spawn(async { - let listener = tokio::net::TcpListener::bind(host).await.map_err(|e| { - log::error!("Failed to start server: {:?}", e); - anyhow::anyhow!(e) - })?; - println!("listening on {}", listener.local_addr().unwrap()); - axum::serve(listener, controller).await.map_err(|e| { - log::error!("Failed to start server: {:?}", e); - anyhow::anyhow!(e) - }) + tokio::spawn(async move { + let addr = SocketAddr::from_str(&host).map_err(|e| anyhow::anyhow!(e))?; + axum::Server::bind(&addr) + .serve(controller.into_make_service()) + .await + .map_err(|e| { + log::error!("Failed to start server: {:?}", e); + anyhow::anyhow!(e) + }) }) } @@ -137,7 +139,7 @@ where T: ToString, { fn into_response(self) -> Response { - let mut r = Response::new(self.0.to_string().into()); + let mut r = Response::new(body::boxed(self.0.to_string())); *r.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; r } diff --git a/circuits/plonky2x/contract/lib/solidity-bytes-utils b/circuits/plonky2x/contract/lib/solidity-bytes-utils deleted file mode 160000 index e0115c4..0000000 --- a/circuits/plonky2x/contract/lib/solidity-bytes-utils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e0115c4d231910df47ce3b60625ce562fe4af985 diff --git a/circuits/plonky2x/src/circuits/mod.rs b/circuits/plonky2x/src/circuits/mod.rs deleted file mode 100644 index a1c8e4c..0000000 --- a/circuits/plonky2x/src/circuits/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod sync; -pub mod verify; - -// TODO: CIRCUIT SERIALISATION TESTS!!! -pub use sync::SyncCircuit; -pub use verify::VerifyCircuit; diff --git a/circuits/plonky2x/Cargo.lock b/nearx/Cargo.lock similarity index 100% rename from circuits/plonky2x/Cargo.lock rename to nearx/Cargo.lock diff --git a/circuits/plonky2x/Cargo.toml b/nearx/Cargo.toml similarity index 74% rename from circuits/plonky2x/Cargo.toml rename to nearx/Cargo.toml index fa20a2d..39b5d10 100644 --- a/circuits/plonky2x/Cargo.toml +++ b/nearx/Cargo.toml @@ -1,10 +1,9 @@ [package] -edition = "2021" -name = "near-light-clientx" -resolver = "2" -version = "0.1.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "A ZK light client for NEAR" +edition.workspace = true +name = "near-light-clientx" +resolver = "2" +version.workspace = true [dependencies] async-trait.workspace = true @@ -15,7 +14,8 @@ hex.workspace = true log.workspace = true pretty_assertions = "1.4.0" serde.workspace = true -# Circuits + +# Circuit related things plonky2 = { git = "https://github.com/mir-protocol/plonky2.git" } plonky2x = { git = "https://github.com/succinctlabs/succinctx.git" } @@ -32,8 +32,9 @@ test-utils.workspace = true tokio.workspace = true [features] -default = [ "testnet" ] +default = [ "testnet" ] +# FIXME: these features are not great - will be replaced by a full fledged operator # Network features mainnet = [ ] testnet = [ ] diff --git a/circuits/plonky2x/contract/README.md b/nearx/contract/README.md similarity index 100% rename from circuits/plonky2x/contract/README.md rename to nearx/contract/README.md diff --git a/circuits/plonky2x/contract/foundry.toml b/nearx/contract/foundry.toml similarity index 100% rename from circuits/plonky2x/contract/foundry.toml rename to nearx/contract/foundry.toml diff --git a/circuits/plonky2x/contract/script/Deploy.s.sol b/nearx/contract/script/Deploy.s.sol similarity index 100% rename from circuits/plonky2x/contract/script/Deploy.s.sol rename to nearx/contract/script/Deploy.s.sol diff --git a/circuits/plonky2x/contract/script/Initialise.s.sol b/nearx/contract/script/Initialise.s.sol similarity index 93% rename from circuits/plonky2x/contract/script/Initialise.s.sol rename to nearx/contract/script/Initialise.s.sol index c8ae6ce..2a78171 100644 --- a/circuits/plonky2x/contract/script/Initialise.s.sol +++ b/nearx/contract/script/Initialise.s.sol @@ -6,6 +6,7 @@ import {NearX} from "../src/NearX.sol"; import {Script} from "forge-std/Script.sol"; import {DevOpsTools} from "lib/foundry-devops/src/DevOpsTools.sol"; +// TODO: scripts need to support multiple envs contract Initialise is Script { function setUp() public {} @@ -17,6 +18,7 @@ contract Initialise is Script { vm.startBroadcast(); NearX lightClient = NearX(payable(proxyAddress)); + // Succinct's goerli gateway address initialGateway = 0x6e4f1e9eA315EBFd69d18C2DB974EEf6105FB803; lightClient.updateGateway(initialGateway); diff --git a/circuits/plonky2x/contract/script/Upgrade.s.sol b/nearx/contract/script/Upgrade.s.sol similarity index 100% rename from circuits/plonky2x/contract/script/Upgrade.s.sol rename to nearx/contract/script/Upgrade.s.sol diff --git a/circuits/plonky2x/contract/script/Verify.s.sol b/nearx/contract/script/Verify.s.sol similarity index 100% rename from circuits/plonky2x/contract/script/Verify.s.sol rename to nearx/contract/script/Verify.s.sol diff --git a/circuits/plonky2x/contract/src/NearX.sol b/nearx/contract/src/NearX.sol similarity index 98% rename from circuits/plonky2x/contract/src/NearX.sol rename to nearx/contract/src/NearX.sol index 0838af4..3fb5e28 100644 --- a/circuits/plonky2x/contract/src/NearX.sol +++ b/nearx/contract/src/NearX.sol @@ -19,7 +19,7 @@ contract NearX is INearX, Initializable, OwnableUpgradeable, UUPSUpgradeable { } function initialize() public initializer { - __Ownable_init(msg.sender); //sets owner to msg.sender + __Ownable_init(msg.sender); __UUPSUpgradeable_init(); } diff --git a/circuits/plonky2x/contract/src/interfaces/Bytes.sol b/nearx/contract/src/interfaces/Bytes.sol similarity index 100% rename from circuits/plonky2x/contract/src/interfaces/Bytes.sol rename to nearx/contract/src/interfaces/Bytes.sol diff --git a/circuits/plonky2x/contract/src/interfaces/INearX.sol b/nearx/contract/src/interfaces/INearX.sol similarity index 100% rename from circuits/plonky2x/contract/src/interfaces/INearX.sol rename to nearx/contract/src/interfaces/INearX.sol diff --git a/circuits/plonky2x/contract/src/interfaces/ISuccinctGateway.sol b/nearx/contract/src/interfaces/ISuccinctGateway.sol similarity index 100% rename from circuits/plonky2x/contract/src/interfaces/ISuccinctGateway.sol rename to nearx/contract/src/interfaces/ISuccinctGateway.sol diff --git a/circuits/plonky2x/contract/test/NearX.t.sol b/nearx/contract/test/NearX.t.sol similarity index 99% rename from circuits/plonky2x/contract/test/NearX.t.sol rename to nearx/contract/test/NearX.t.sol index e168c10..8ef5fc8 100644 --- a/circuits/plonky2x/contract/test/NearX.t.sol +++ b/nearx/contract/test/NearX.t.sol @@ -13,14 +13,12 @@ contract NearXTest is Test { } function testGetEncodePackedSync() public view { - // TODO: bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; bytes memory encodedInput = abi.encodePacked(header); console.logBytes(encodedInput); } function testGetEncodePackedVerify() public { - // TODO: bytes32 header = hex"63b87190ffbaa36d7dab50f918fe36f70ab26910a0e9d797161e2356561598e3"; bytes memory txIsAccount = hex"01"; bytes32 txId = hex"2c53bcfe871da28decc45c3437f5864568d91af6d990dbc2662f11ce44c18d79"; diff --git a/circuits/plonky2x/src/builder.rs b/nearx/src/builder.rs similarity index 100% rename from circuits/plonky2x/src/builder.rs rename to nearx/src/builder.rs diff --git a/circuits/plonky2x/src/hint.rs b/nearx/src/hint.rs similarity index 100% rename from circuits/plonky2x/src/hint.rs rename to nearx/src/hint.rs diff --git a/circuits/plonky2x/src/lib.rs b/nearx/src/lib.rs similarity index 66% rename from circuits/plonky2x/src/lib.rs rename to nearx/src/lib.rs index 273df1a..b0aadd3 100644 --- a/circuits/plonky2x/src/lib.rs +++ b/nearx/src/lib.rs @@ -1,13 +1,17 @@ -pub use circuits::*; pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; +pub use sync::SyncCircuit; +pub use verify::VerifyCircuit; /// Building blocks injected into the CircuitBuilder mod builder; -pub mod circuits; mod hint; /// Unprefixed merkle tree without collision resistance mod merkle; mod variables; +/// Circuits for use by the operator +pub mod sync; +pub mod verify; + #[cfg(test)] mod test_utils; diff --git a/circuits/plonky2x/src/main.rs b/nearx/src/main.rs similarity index 100% rename from circuits/plonky2x/src/main.rs rename to nearx/src/main.rs diff --git a/circuits/plonky2x/src/merkle.rs b/nearx/src/merkle.rs similarity index 100% rename from circuits/plonky2x/src/merkle.rs rename to nearx/src/merkle.rs diff --git a/circuits/plonky2x/src/circuits/sync.rs b/nearx/src/sync.rs similarity index 100% rename from circuits/plonky2x/src/circuits/sync.rs rename to nearx/src/sync.rs diff --git a/circuits/plonky2x/src/test_utils.rs b/nearx/src/test_utils.rs similarity index 100% rename from circuits/plonky2x/src/test_utils.rs rename to nearx/src/test_utils.rs diff --git a/circuits/plonky2x/src/variables.rs b/nearx/src/variables.rs similarity index 100% rename from circuits/plonky2x/src/variables.rs rename to nearx/src/variables.rs diff --git a/circuits/plonky2x/src/circuits/verify.rs b/nearx/src/verify.rs similarity index 100% rename from circuits/plonky2x/src/circuits/verify.rs rename to nearx/src/verify.rs diff --git a/succinct.json b/succinct.json index 15389d1..6f71bf6 100644 --- a/succinct.json +++ b/succinct.json @@ -5,7 +5,7 @@ "framework": "plonky2x", "baseDir": ".", "buildCommand": "make build-sync-circuit", - "proveCommand": "RUST_LOG=debug ./build/sync prove input.json", + "proveCommand": "make prove-sync-circuit", "requiredArtifacts": [ "sync" ] @@ -15,7 +15,7 @@ "framework": "plonky2x", "baseDir": ".", "buildCommand": "make build-verify-circuit", - "proveCommand": "RUST_LOG=debug ./build/verify prove input.json", + "proveCommand": "make prove-verify-circuit", "requiredArtifacts": [ "verify" ] diff --git a/.taplo.toml b/taplo.toml similarity index 100% rename from .taplo.toml rename to taplo.toml From 8bcc362b8e35bbffa0afb3a14c1376bbf55695e2 Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 17:09:45 +0000 Subject: [PATCH 48/67] ci: test solidity on PR --- .github/workflows/on_pull_request.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 0c9afaa..4ba4af5 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -21,6 +21,7 @@ jobs: with: command: fmt args: --all -- --check + test-rust: name: "Test Rust" runs-on: @@ -33,7 +34,7 @@ jobs: - name: "Install cargo-nextest" run: cargo install cargo-nextest - name: "Run tests" - run: cargo nextest run --workspace --locked --no-default-features + run: cargo nextest run --workspace --locked --no-fail-fast test-beefy-proofs: name: "Test Beefy Proofs" @@ -47,4 +48,18 @@ jobs: - name: "Install cargo-nextest" run: cargo install cargo-nextest - name: "Run tests" - run: cargo nextest run --workspace --locked --no-default-features + run: cargo nextest run --workspace --locked --no-fail-fast + + test-solidity-contracts: + name: "Test Solidity Contracts" + runs-on: + group: beefygroup + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 + - name: "Install forge" + run: cargo install --git https://github.com/foundry-rs/foundry --bins --locked anvil cast chisel forge + - name: "Run tests" + run: cd nearx/contract && forge test -vv From 3ac02f53b842a222f27fd8ef732bcec397aa2518 Mon Sep 17 00:00:00 2001 From: dndll Date: Thu, 15 Feb 2024 17:10:27 +0000 Subject: [PATCH 49/67] ci: note on releasing to succinct on tag --- .github/workflows/on_main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on_main.yml b/.github/workflows/on_main.yml index 2aeb4fd..3689b47 100644 --- a/.github/workflows/on_main.yml +++ b/.github/workflows/on_main.yml @@ -34,3 +34,4 @@ jobs: ghcr.io/near/near-light-client/light-client:${{ github.sha }} ghcr.io/near/near-light-client/light-client:latest +# TODO: releasing to succinct on tag From 593f3ac045e727e9a5f3d108d514706b47e45205 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 09:52:15 +0000 Subject: [PATCH 50/67] build: update dependencies to latest plonky2x/starkyx --- Cargo.lock | 178 +++++++++++++++++++++++------------------------ Cargo.toml | 8 +-- vendor/starkyx | 2 +- vendor/succinctx | 2 +- 4 files changed, 93 insertions(+), 97 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef731f0..64bc164 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -65,7 +65,7 @@ checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -297,7 +297,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -308,7 +308,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -341,7 +341,7 @@ checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -532,7 +532,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "syn_derive", ] @@ -575,9 +575,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "byte-slice-cast" @@ -759,7 +759,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -959,9 +959,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -1047,26 +1047,6 @@ dependencies = [ "cipher 0.4.4", ] -[[package]] -name = "curta" -version = "0.1.0" -source = "git+https://github.com/dndll/starkyx.git#7f676e81dcf13393d9ca3bb825bf8e2a7c046cba" -dependencies = [ - "anyhow", - "bincode", - "curve25519-dalek", - "env_logger 0.9.3", - "hex", - "itertools 0.10.5", - "log", - "num", - "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", - "plonky2_maybe_rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.8.5", - "serde", - "subtle-encoding", -] - [[package]] name = "curve25519-dalek" version = "4.1.1" @@ -1093,14 +1073,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "darling" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" +checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955" dependencies = [ "darling_core", "darling_macro", @@ -1108,27 +1088,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" +checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "darling_macro" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" +checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" dependencies = [ "darling_core", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1178,7 +1158,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1433,7 +1413,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1614,7 +1594,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.48", + "syn 2.0.49", "toml 0.8.10", "walkdir", ] @@ -1632,7 +1612,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1658,7 +1638,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.48", + "syn 2.0.49", "tempfile", "thiserror", "tiny-keccak", @@ -1996,7 +1976,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2211,9 +2191,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -2480,7 +2460,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.5", + "hermit-abi 0.3.6", "libc", "windows-sys 0.52.0", ] @@ -2789,7 +2769,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3215,7 +3195,7 @@ checksum = "80fca203c51edd9595ec14db1d13359fb9ede32314990bf296b6c5c4502f6ab7" dependencies = [ "quote", "serde", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3227,7 +3207,7 @@ dependencies = [ "fs2", "near-rpc-error-core", "serde", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3415,7 +3395,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.5", + "hermit-abi 0.3.6", "libc", ] @@ -3437,7 +3417,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3509,7 +3489,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3774,7 +3754,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3838,7 +3818,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3876,7 +3856,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3903,9 +3883,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" @@ -4029,7 +4009,7 @@ source = "git+https://github.com/mir-protocol/plonky2.git#8753162b77190f02ec6bbf [[package]] name = "plonky2x" version = "0.1.0" -source = "git+https://github.com/dndll/succinctx.git#b2540e29d54bcf97bc922d57b50acfe89665398a" +source = "git+https://github.com/dndll/succinctx.git#4e539f2ea4a42cedcd0b056346ef8009cc24f619" dependencies = [ "anyhow", "array-macro", @@ -4038,7 +4018,6 @@ dependencies = [ "base64 0.13.1", "bincode", "clap", - "curta", "curve25519-dalek", "digest 0.10.7", "dotenv", @@ -4063,6 +4042,7 @@ dependencies = [ "serde_with", "sha2", "sha256", + "starkyx", "tokio", "tracing", "uuid 1.7.0", @@ -4071,11 +4051,11 @@ dependencies = [ [[package]] name = "plonky2x-derive" version = "0.1.0" -source = "git+https://github.com/dndll/succinctx.git#b2540e29d54bcf97bc922d57b50acfe89665398a" +source = "git+https://github.com/dndll/succinctx.git#4e539f2ea4a42cedcd0b056346ef8009cc24f619" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4135,7 +4115,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4719,7 +4699,7 @@ dependencies = [ "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.48", + "syn 2.0.49", "walkdir", ] @@ -4993,7 +4973,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5034,7 +5014,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5085,7 +5065,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5123,7 +5103,7 @@ checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5320,6 +5300,26 @@ dependencies = [ "der", ] +[[package]] +name = "starkyx" +version = "0.1.0" +source = "git+https://github.com/dndll/starkyx.git#80604accb5f6a287e31f945e4e923c3d0e1a7832" +dependencies = [ + "anyhow", + "bincode", + "curve25519-dalek", + "env_logger 0.9.3", + "hex", + "itertools 0.10.5", + "log", + "num", + "plonky2 0.1.4 (git+https://github.com/mir-protocol/plonky2.git?rev=d2598bd)", + "plonky2_maybe_rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "serde", + "subtle-encoding", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -5392,7 +5392,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5443,9 +5443,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -5461,7 +5461,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5570,7 +5570,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5675,7 +5675,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5774,7 +5774,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.5", + "toml_edit 0.22.6", ] [[package]] @@ -5794,7 +5794,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.2.3", "toml_datetime", - "winnow 0.5.39", + "winnow 0.5.40", ] [[package]] @@ -5805,7 +5805,7 @@ checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap 2.2.3", "toml_datetime", - "winnow 0.5.39", + "winnow 0.5.40", ] [[package]] @@ -5816,14 +5816,14 @@ checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap 2.2.3", "toml_datetime", - "winnow 0.5.39", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ "indexmap 2.2.3", "serde", @@ -5939,7 +5939,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -6187,7 +6187,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -6310,7 +6310,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -6344,7 +6344,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6567,9 +6567,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.39" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] @@ -6653,7 +6653,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 94222a2..38d28a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,13 +46,9 @@ near-light-client-rpc = { path = "crates/rpc" } near-light-clientx = { path = "circuits/plonky2x" } test-utils = { path = "crates/test-utils" } -[patch."https://github.com/succinctlabs/curta.git"] -#curta = { git = "https://github.com/succinctlabs/starkyx.git" } -curta = { git = "https://github.com/dndll/starkyx.git" } - [patch."https://github.com/succinctlabs/starkyx.git"] -#curta = { path = "./vendor/starkyx/curta" } -curta = { git = "https://github.com/dndll/starkyx.git" } +starkyx = { git = "https://github.com/dndll/starkyx.git" } +#curta = { path = "./vendor/starkyx/starkyx" } [patch."https://github.com/succinctlabs/succinctx.git"] #plonky2x = { path = "./vendor/succinctx/plonky2x/core" } diff --git a/vendor/starkyx b/vendor/starkyx index 7f676e8..80604ac 160000 --- a/vendor/starkyx +++ b/vendor/starkyx @@ -1 +1 @@ -Subproject commit 7f676e81dcf13393d9ca3bb825bf8e2a7c046cba +Subproject commit 80604accb5f6a287e31f945e4e923c3d0e1a7832 diff --git a/vendor/succinctx b/vendor/succinctx index b2540e2..4e539f2 160000 --- a/vendor/succinctx +++ b/vendor/succinctx @@ -1 +1 @@ -Subproject commit b2540e29d54bcf97bc922d57b50acfe89665398a +Subproject commit 4e539f2ea4a42cedcd0b056346ef8009cc24f619 From 78e3d06bed6c34a75ff949bb4f8ed2052f2edd96 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:02:23 +0000 Subject: [PATCH 51/67] fix: total stake should only validate this epochs producers There's a slight miss in the light client spec where the signature set contains this & next epochs signatures on epoch boundaries, artificially raising the stake. --- crates/protocol/src/lib.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index 2d25790..3e09afa 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -1,3 +1,4 @@ +use config::NUM_BLOCK_PRODUCER_SEATS; use error::Error; pub use merkle_util::*; pub use near_crypto::{ED25519PublicKey, PublicKey, Signature}; @@ -253,6 +254,7 @@ impl Protocol { signatures .iter() .zip(epoch_bps.iter()) + .take(NUM_BLOCK_PRODUCER_SEATS) .fold((0, 0), |(total_stake, approved_stake), (sig, vs)| { let pk = vs.public_key(); let stake = vs.stake(); @@ -468,7 +470,7 @@ mod tests { &approval_message.unwrap(), ); - assert_eq!((total, approved), (512915271547861520119028536348929, 0)); + assert_eq!((total, approved), (440511369730158962073902098744970, 0)); } #[test] @@ -486,8 +488,8 @@ mod tests { assert_eq!( (total, approved), ( - 512915271547861520119028536348929, - 345140782903867823005444871054881 + 440511369730158962073902098744970, + 296239000750863364078617965755968 ) ); @@ -552,12 +554,4 @@ mod tests { ); assert!(root_matches); } - - // FIXME: Missed a part of LC spec regarding BPS handover, only the MAX_SEATS - // need to be taken TODO: change epoch_bps to only store MAX_SEATS and then - // for next - #[test] - fn test_enough_stake_in_next_epoch_not_this() { - todo!(); - } } From bdd7e3f1185cc7025e88043e1cd45a2e6d162213 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:06:59 +0000 Subject: [PATCH 52/67] ci: test older ci group --- .github/workflows/on_pull_request.yml | 6 +++--- crates/rpc/src/lib.rs | 20 -------------------- nearx/src/test_utils.rs | 6 +----- 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 4ba4af5..9b5074b 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -25,7 +25,7 @@ jobs: test-rust: name: "Test Rust" runs-on: - group: ubuntu-22.04-16core + group: ubuntu-22.04-32core steps: - name: Checkout uses: actions/checkout@v3 @@ -39,7 +39,7 @@ jobs: test-beefy-proofs: name: "Test Beefy Proofs" runs-on: - group: beefygroup + group: ubuntu-22.04-32core steps: - name: Checkout uses: actions/checkout@v3 @@ -53,7 +53,7 @@ jobs: test-solidity-contracts: name: "Test Solidity Contracts" runs-on: - group: beefygroup + group: ubuntu-22.04-16core steps: - name: Checkout uses: actions/checkout@v3 diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 9f2077c..740a185 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -320,25 +320,5 @@ mod tests { } std::fs::write("ids.json", serde_json::to_string(&ids).unwrap()).unwrap(); - - // .and_then(|b| async { - // Ok(b.chunks - // .iter() - // .map(|c| fetch_chunk(&client, &c.chunk_hash)) - // .map(Box::pin) - // .collect_vec()) - // }) - // .await; - // For each in 0..10 - // - // get parent block - // get all chunks by chunk hash - // get all receipts - // get all txs - } - - #[test] - fn test_rpc() { - todo!() } } diff --git a/nearx/src/test_utils.rs b/nearx/src/test_utils.rs index e8aeb42..7889d9d 100644 --- a/nearx/src/test_utils.rs +++ b/nearx/src/test_utils.rs @@ -60,11 +60,7 @@ pub fn builder_suite( _ => None, }; if let Some(req) = proof_req { - fs::write( - "../../build/input.json", - serde_json::to_string(&req).unwrap(), - ) - .unwrap(); + fs::write("../build/input.json", serde_json::to_string(&req).unwrap()).unwrap(); } let (proof, output) = circuit.prove(&inputs); From abccb64f2f073eee220921d118c3c1b97bc14b21 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:14:22 +0000 Subject: [PATCH 53/67] test: use workspace directory for path management --- crates/rpc/src/lib.rs | 3 ++- crates/test-utils/src/lib.rs | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 740a185..c016a6e 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -291,7 +291,8 @@ mod tests { [receipts, txs].concat() } - #[tokio::test] + // this is committed in the repo, only needed for gathering data + // #[tokio::test] async fn test_get_ids() { let client = NearRpcClient::new(Network::Testnet); diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs index 3ce4aba..f7d1c39 100644 --- a/crates/test-utils/src/lib.rs +++ b/crates/test-utils/src/lib.rs @@ -1,3 +1,5 @@ +use std::path::{Path, PathBuf}; + use derive_more::Into; use near_light_client_protocol::{prelude::Header, LightClientBlockView, ValidatorStake}; pub use near_primitives::hash::CryptoHash; @@ -11,9 +13,23 @@ pub struct LightClientFixture { pub body: T, } -pub fn fixture(file: &str) -> T { - serde_json::from_reader(std::fs::File::open(format!("../../fixtures/{}", file)).unwrap()) +pub fn workspace_dir() -> PathBuf { + let output = std::process::Command::new(env!("CARGO")) + .arg("locate-project") + .arg("--workspace") + .arg("--message-format=plain") + .output() .unwrap() + .stdout; + let cargo_path = Path::new(std::str::from_utf8(&output).unwrap().trim()); + cargo_path.parent().unwrap().to_path_buf() +} + +pub fn fixture(file: &str) -> T { + serde_json::from_reader( + std::fs::File::open(format!("{}/fixtures/{}", workspace_dir().display(), file)).unwrap(), + ) + .unwrap() } pub fn lc(file: &str) -> LightClientFixture { @@ -93,3 +109,13 @@ pub fn to_header(bv: LightClientBlockView) -> Header { inner_lite: bv.inner_lite, } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_workspace_dir() { + println!("{:?}", workspace_dir()); + } +} From 5fcd9f8009db0839de4be0632fc13c42e24db924 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:16:34 +0000 Subject: [PATCH 54/67] test: promote merkle test to beefy --- nearx/src/merkle.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nearx/src/merkle.rs b/nearx/src/merkle.rs index 7667292..98b39b3 100644 --- a/nearx/src/merkle.rs +++ b/nearx/src/merkle.rs @@ -89,7 +89,8 @@ mod tests { use crate::{test_utils::*, variables::ProofVariable}; #[test] - fn test_path_is_ignored_if_default() { + #[ignore] + fn beefy_test_path_is_ignored_if_default() { let block_root = CryptoHash::from_str("WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L").unwrap(); From a3f3c5c24c80346ab2ccc0e2dfff5d2d53e9f865 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:18:19 +0000 Subject: [PATCH 55/67] build: specify nightly since avx/ahash issue cannot handle 1.78 see more: stdarch_x86_avx512 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3b35aa6..8d9329f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,5 +2,5 @@ # This specifies the version of Rust we use to build. # Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`. # The version specified below, should be at least as high as the maximum `rust-version` within the workspace. -channel = "nightly" +channel = "nightly-2023-12-31" components = [ "rustfmt", "clippy" ] From e2a0be17a221839f46e8b687e65df4482974d35c Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:26:27 +0000 Subject: [PATCH 56/67] ci: remove needless caching --- .github/workflows/on_pull_request.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 9b5074b..a103bf6 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -5,7 +5,6 @@ on: branches: - master - # TODO: beefy machine for tests jobs: lint: name: "Lint" @@ -15,12 +14,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - uses: Swatinem/rust-cache@v2 - - name: "Check rust format" - uses: actions-rs/cargo@v1 with: - command: fmt - args: --all -- --check + cache-workspaces: |- + . + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 test-rust: name: "Test Rust" @@ -30,7 +28,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - uses: Swatinem/rust-cache@v2 + with: + cache-workspaces: |- + . - name: "Install cargo-nextest" run: cargo install cargo-nextest - name: "Run tests" @@ -44,7 +44,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - uses: Swatinem/rust-cache@v2 + with: + cache-workspaces: |- + . - name: "Install cargo-nextest" run: cargo install cargo-nextest - name: "Run tests" @@ -58,7 +60,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - uses: Swatinem/rust-cache@v2 + with: + cache-workspaces: |- + . - name: "Install forge" run: cargo install --git https://github.com/foundry-rs/foundry --bins --locked anvil cast chisel forge - name: "Run tests" From 6b7f6900826c0b4d1e675538fa4f83d3d4937705 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:36:32 +0000 Subject: [PATCH 57/67] ci: cancel if multiple jobs --- .github/workflows/on_pull_request.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index a103bf6..e843f86 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -1,5 +1,9 @@ name: "Check PR is ready for merge" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: pull_request: branches: @@ -13,7 +17,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: cache-workspaces: |- . @@ -27,7 +31,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: cache-workspaces: |- . @@ -43,7 +47,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: cache-workspaces: |- . @@ -59,7 +63,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: cache-workspaces: |- . From 5b68af22a1e8ade44e35f8c1636d123ea47d984e Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:36:22 +0000 Subject: [PATCH 58/67] test: remove dead function --- crates/protocol/src/experimental.rs | 1 + crates/rpc/src/lib.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/protocol/src/experimental.rs b/crates/protocol/src/experimental.rs index 028bfb6..ad8aaad 100644 --- a/crates/protocol/src/experimental.rs +++ b/crates/protocol/src/experimental.rs @@ -336,6 +336,7 @@ pub(crate) mod tests { pub const BLOCK_MERKLE_ROOT: &str = "WWrLWbWHwSmjtTn5oBZPYgRCuCYn6fkYVa4yhPWNK4L"; + #[allow(dead_code)] fn write_proof(path: &str, proof: &Proof) { std::fs::write( path.to_string().replace(".json", ".hex"), diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index c016a6e..07ba25f 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -232,6 +232,7 @@ mod tests { use super::*; + #[allow(dead_code)] async fn fetch_chunk(c: &NearRpcClient, chunk_id: &CryptoHash) -> Result { println!("fetching chunk: {:?}", chunk_id); let req = methods::chunk::RpcChunkRequest { @@ -249,6 +250,7 @@ mod tests { .map_err(|e| anyhow::format_err!("{:?}", e)) } + #[allow(dead_code)] async fn fetch_block(c: &NearRpcClient, block_reference: BlockReference) -> Result { println!("fetching block: {:?}", block_reference); let req = methods::block::RpcBlockRequest { block_reference }; @@ -262,6 +264,7 @@ mod tests { .map_err(|e| anyhow::format_err!("{:?}", e)) } + #[allow(dead_code)] async fn fetch_ids(client: &NearRpcClient, block: &BlockView) -> Vec { let futs = block .chunks @@ -291,8 +294,9 @@ mod tests { [receipts, txs].concat() } - // this is committed in the repo, only needed for gathering data // #[tokio::test] + // this is committed in the repo, only needed for gathering data + #[allow(dead_code)] async fn test_get_ids() { let client = NearRpcClient::new(Network::Testnet); From 962f4764df5cad853db0f303c15c0d8a9f28d822 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 10:48:02 +0000 Subject: [PATCH 59/67] ci: add dependency audit --- .github/workflows/dependency_audit.yml | 18 ++++++++++++++++++ .github/workflows/on_pull_request.yml | 7 +++++-- nearx/src/main.rs | 1 + nearx/src/sync.rs | 4 +--- nearx/src/verify.rs | 2 +- 5 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/dependency_audit.yml diff --git a/.github/workflows/dependency_audit.yml b/.github/workflows/dependency_audit.yml new file mode 100644 index 0000000..85a4dab --- /dev/null +++ b/.github/workflows/dependency_audit.yml @@ -0,0 +1,18 @@ +name: "Audit depdencies" + +# Midnight each day +on: + schedule: + - cron: '0 0 * * *' + +jobs: + security_audit: + name: "Security audit" + runs-on: + group: ubuntu-22.04-8core + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index e843f86..1028788 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -21,8 +21,11 @@ jobs: with: cache-workspaces: |- . - - name: Rustfmt Check - uses: actions-rust-lang/rustfmt@v1 + - uses: actions-rust-lang/rustfmt@v1 + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features test-rust: name: "Test Rust" diff --git a/nearx/src/main.rs b/nearx/src/main.rs index decf00b..a46d3e2 100644 --- a/nearx/src/main.rs +++ b/nearx/src/main.rs @@ -2,6 +2,7 @@ use near_light_clientx::plonky2x::backend::function::Plonky2xFunction; // Testnet, FIXME: this is error prone, use something else +#[allow(dead_code)] const NETWORK: usize = 1; // TODO: make this use a nicer API for use by the prover. diff --git a/nearx/src/sync.rs b/nearx/src/sync.rs index 14dda91..efd1ef0 100644 --- a/nearx/src/sync.rs +++ b/nearx/src/sync.rs @@ -3,9 +3,7 @@ pub use plonky2x::{self, backend::circuit::Circuit, prelude::*}; use crate::{ builder::Sync, hint::{FetchHeaderInputs, FetchNextHeaderInputs}, - variables::{ - BlockHeightVariable, BuildEndorsement, CryptoHashVariable, EncodeInner, HashBpsInputs, - }, + variables::{BuildEndorsement, CryptoHashVariable, EncodeInner, HashBpsInputs}, }; // TODO: lazy sync diff --git a/nearx/src/verify.rs b/nearx/src/verify.rs index 0adb923..8e3ca18 100644 --- a/nearx/src/verify.rs +++ b/nearx/src/verify.rs @@ -192,7 +192,7 @@ mod beefy_tests { use super::*; use crate::{ test_utils::{builder_suite, testnet_state, B, NETWORK, PI, PO}, - variables::{HeaderVariableValue, TransactionOrReceiptIdVariableValue}, + variables::TransactionOrReceiptIdVariableValue, }; #[test] From 29bd044e8d8df9a519bc4e51f16f9fe5f44dc16d Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 11:31:05 +0000 Subject: [PATCH 60/67] ci: forge install dependencies --- .github/workflows/on_pull_request.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 1028788..34b9322 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -57,7 +57,7 @@ jobs: - name: "Install cargo-nextest" run: cargo install cargo-nextest - name: "Run tests" - run: cargo nextest run --workspace --locked --no-fail-fast + run: cargo nextest run --workspace --locked --ignored --no-fail-fast test-solidity-contracts: name: "Test Solidity Contracts" @@ -72,5 +72,7 @@ jobs: . - name: "Install forge" run: cargo install --git https://github.com/foundry-rs/foundry --bins --locked anvil cast chisel forge + - name: "Forge install" + run: cd nearx/contract && forge install - name: "Run tests" run: cd nearx/contract && forge test -vv From 6027ef7d2b87a26d450eff2494599fefc9554d62 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 11:39:29 +0000 Subject: [PATCH 61/67] ci: run ignored-only --- .github/workflows/on_pull_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 34b9322..d9327ae 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -56,8 +56,8 @@ jobs: . - name: "Install cargo-nextest" run: cargo install cargo-nextest - - name: "Run tests" - run: cargo nextest run --workspace --locked --ignored --no-fail-fast + - name: "Run beefy tests" + run: cargo nextest run --workspace --locked --run-ignored ignored-only --no-fail-fast test-solidity-contracts: name: "Test Solidity Contracts" From afdff1ab5e4e705a3548c392183cd92e9ebdcf03 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 11:57:21 +0000 Subject: [PATCH 62/67] ci: foundry caching --- .github/workflows/on_pull_request.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index d9327ae..f9eea01 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -70,8 +70,12 @@ jobs: with: cache-workspaces: |- . - - name: "Install forge" - run: cargo install --git https://github.com/foundry-rs/foundry --bins --locked anvil cast chisel forge + - name: "Install Foundry" + uses: taiki-e/cache-cargo-install-action@v1 + with: + git: https://github.com/foundry-rs/foundry + tool: forge + rev: 6ee3e88d2a48c7df48c85986e67f73cd2e6403d8 - name: "Forge install" run: cd nearx/contract && forge install - name: "Run tests" From d784a8a03285277a9c0ccfd0782d33a2e26d5747 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 15:04:07 +0000 Subject: [PATCH 63/67] fix: size was not fulfilled for block signatures --- crates/rpc/src/lib.rs | 2 +- nearx/src/hint.rs | 12 ++++++------ nearx/src/sync.rs | 23 +++++++++++++---------- nearx/src/variables.rs | 17 ++++++++++++++--- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/crates/rpc/src/lib.rs b/crates/rpc/src/lib.rs index 07ba25f..f82fc66 100644 --- a/crates/rpc/src/lib.rs +++ b/crates/rpc/src/lib.rs @@ -18,7 +18,7 @@ use crate::prelude::*; pub mod prelude; -#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)] pub enum Network { Mainnet, #[default] diff --git a/nearx/src/hint.rs b/nearx/src/hint.rs index 4f7c2bb..bd6c209 100644 --- a/nearx/src/hint.rs +++ b/nearx/src/hint.rs @@ -37,14 +37,14 @@ impl, const D: usize> AsyncHint for FetchNextHeaderI impl FetchNextHeaderInputs { pub fn fetch, const D: usize>( - self, + &self, b: &mut CircuitBuilder, hash: &CryptoHashVariable, ) -> Option { let mut input_stream = VariableStream::new(); input_stream.write::(hash); - let output_stream = b.async_hint(input_stream, self); + let output_stream = b.async_hint(input_stream, self.clone()); Some(output_stream.read::(b)) } } @@ -75,14 +75,14 @@ impl, const D: usize> AsyncHint for FetchHeaderInput impl FetchHeaderInputs { /// Fetches a header based on its known hash and witnesses the result. pub fn fetch, const D: usize>( - self, + &self, b: &mut CircuitBuilder, trusted_hash: &CryptoHashVariable, ) -> HeaderVariable { let mut input_stream = VariableStream::new(); input_stream.write::(trusted_hash); - let output_stream = b.async_hint(input_stream, self); + let output_stream = b.async_hint(input_stream, self.clone()); let untrusted = output_stream.read::(b); let untrusted_hash = untrusted.hash(b); b.assert_is_equal(*trusted_hash, untrusted_hash); @@ -151,7 +151,7 @@ impl, const D: usize, const B: usize> AsyncHint impl FetchProofInputs { pub fn fetch, const D: usize>( - self, + &self, b: &mut CircuitBuilder, head: &HeaderVariable, reqs: &[TransactionOrReceiptIdVariable], @@ -162,7 +162,7 @@ impl FetchProofInputs { input_stream.write::(&head.hash(b)); input_stream.write_slice::(reqs); - let output_stream = b.async_hint(input_stream, self); + let output_stream = b.async_hint(input_stream, self.clone()); let mut inputs = vec![]; for _ in 0..N { inputs.push(ProofInputVariable { diff --git a/nearx/src/sync.rs b/nearx/src/sync.rs index efd1ef0..0070385 100644 --- a/nearx/src/sync.rs +++ b/nearx/src/sync.rs @@ -20,27 +20,30 @@ impl Circuit for SyncCircuit { <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: plonky2::plonk::config::AlgebraicHasher<>::Field>, { + let network = NETWORK.into(); + let fetch_header = FetchHeaderInputs(network); + let fetch_next_header = FetchNextHeaderInputs(network); + let trusted_header_hash = b.evm_read::(); - let head = FetchHeaderInputs(NETWORK.into()).fetch(b, &trusted_header_hash); // This is a very interesting trick to be able to get the BPS for the next epoch // without the need to store the BPS, we verify the hash of the BPS in the // circuit - let bps = FetchNextHeaderInputs(NETWORK.into()) - .fetch(b, &head.inner_lite.next_epoch_id) + let header = fetch_header.fetch(b, &trusted_header_hash); + let bps = fetch_next_header + .fetch(b, &header.inner_lite.next_epoch_id) .unwrap() .next_bps; let bps_hash = HashBpsInputs.hash(b, &bps); - b.assert_is_equal(head.inner_lite.next_bp_hash, bps_hash); + b.assert_is_equal(header.inner_lite.next_bp_hash, bps_hash); + b.watch(&bps_hash, "calculate_bps_hash"); - let head_hash = head.hash(b); - let next_block = FetchNextHeaderInputs(NETWORK.into()) - .fetch(b, &head_hash) + let next_block = fetch_next_header + .fetch(b, &trusted_header_hash) .expect("Failed to fetch next block"); - b.watch(&bps_hash, "calculate_bps_hash"); - let synced = b.sync(&head, &bps, &next_block); + let synced = b.sync(&header, &bps, &next_block); let synced_hash = synced.new_head.hash(b); b.evm_write::(synced_hash); } @@ -50,8 +53,8 @@ impl Circuit for SyncCircuit { <>::Config as plonky2::plonk::config::GenericConfig>::Hasher: plonky2::plonk::config::AlgebraicHasher, { - registry.register_async_hint::(); registry.register_async_hint::(); + registry.register_async_hint::(); registry.register_hint::(); registry.register_hint::(); registry.register_hint::(); diff --git a/nearx/src/variables.rs b/nearx/src/variables.rs index bd4ae00..1f75f73 100644 --- a/nearx/src/variables.rs +++ b/nearx/src/variables.rs @@ -326,13 +326,23 @@ impl From for BlockVariableValue { .0 .into(); - Self { + let variable = Self { next_block_inner_hash: block.next_block_inner_hash.0.into(), header: block.clone().into(), next_bps: bps_to_variable(block.next_bps), approvals_after_next: block.approvals_after_next.into(), next_bps_hash, - } + }; + assert_eq!(variable.next_bps.len(), NUM_BLOCK_PRODUCER_SEATS); + assert_eq!( + variable.approvals_after_next.is_active.len(), + NUM_BLOCK_PRODUCER_SEATS + ); + assert_eq!( + variable.approvals_after_next.signatures.len(), + NUM_BLOCK_PRODUCER_SEATS + ); + variable } } @@ -345,7 +355,8 @@ pub struct BpsApprovals { impl From>>> for BpsApprovalsValue { - fn from(approvals: Vec>>) -> Self { + fn from(mut approvals: Vec>>) -> Self { + approvals.resize(AMT, None); let (signatures, is_active) = approvals .into_iter() .take(AMT) From e842e118f38849f0f0d5394fda370d59cda97674 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 15:08:02 +0000 Subject: [PATCH 64/67] ci: parallel debug tests --- .github/workflows/on_pull_request.yml | 83 ++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 14 deletions(-) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index f9eea01..1976efb 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -1,3 +1,4 @@ +# See workflow runs at https://github.com/nextest-rs/reuse-build-partition-example/actions/workflows/ci.yml. name: "Check PR is ready for merge" concurrency: @@ -8,6 +9,12 @@ on: pull_request: branches: - master + # schedule: + # # Run this every day at 01:00 UTC. + # - cron: 0 1 * * * + +env: + CARGO_TERM_COLOR: always jobs: lint: @@ -25,12 +32,36 @@ jobs: - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features + args: --all-features + + build-test-artifacts: + name: Build test artifacts + runs-on: ubuntu-20.04-16core + steps: + - uses: actions/checkout@v3 + with: + # By default actions/checkout checks out a merge commit. Check out the PR head instead. + # https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 + with: + cache-workspaces: |- + . + - name: "Install cargo-nextest" + run: cargo install cargo-nextest + - name: Build and archive tests + run: cargo nextest archive -r --workspace --archive-file nextest-archive.tar.zst --locked + - name: Upload archive to workflow + uses: actions/upload-artifact@v3 + with: + name: nextest-archive + path: nextest-archive.tar.zst test-rust: name: "Test Rust" runs-on: - group: ubuntu-22.04-32core + group: ubuntu-22.04-8core + needs: build-test-artifacts steps: - name: Checkout uses: actions/checkout@v3 @@ -40,24 +71,44 @@ jobs: . - name: "Install cargo-nextest" run: cargo install cargo-nextest - - name: "Run tests" - run: cargo nextest run --workspace --locked --no-fail-fast - - test-beefy-proofs: - name: "Test Beefy Proofs" - runs-on: - group: ubuntu-22.04-32core + - name: "Run normal tests" + run: | + cargo nextest run \ + --archive-file nextest-archive.tar.zst \ + --no-fail-fast + + run-tests-partitioned: + name: "Run Beefy tests partitioned" + needs: build-test-artifacts + strategy: + matrix: + os: [ubuntu-22.04-32core, ubuntu-20.04-32core] + include: + - os: ubuntu-22.04-32core + share: 1 + - os: ubuntu-20.04-32core + share: 2 + runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: cache-workspaces: |- . - name: "Install cargo-nextest" run: cargo install cargo-nextest - - name: "Run beefy tests" - run: cargo nextest run --workspace --locked --run-ignored ignored-only --no-fail-fast + - name: Download archive + uses: actions/download-artifact@v3 + with: + name: nextest-archive + - name: Run tests + run: | + cargo nextest run \ + --run-ignored ignored-only \ + --archive-file nextest-archive.tar.zst \ + --partition count:${{ matrix.share }}/2 test-solidity-contracts: name: "Test Solidity Contracts" @@ -66,6 +117,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + submodules: recursive + token: ${{ secrets.GITHUB_TOKEN }} - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: cache-workspaces: |- @@ -79,4 +133,5 @@ jobs: - name: "Forge install" run: cd nearx/contract && forge install - name: "Run tests" - run: cd nearx/contract && forge test -vv + run: cd nearx/contract && forge test -vv + From a52b8c5c8910f63d0f69ae79f3bccf5d7b55b270 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 16:23:17 +0000 Subject: [PATCH 65/67] test: disable extremely beefy test --- nearx/src/verify.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nearx/src/verify.rs b/nearx/src/verify.rs index 8e3ca18..4d7ced2 100644 --- a/nearx/src/verify.rs +++ b/nearx/src/verify.rs @@ -260,9 +260,10 @@ mod beefy_tests { } // TODO: ignore flag as this test will likely be overkill - #[test] - #[serial] - #[ignore] + // #[test] + // #[serial] + // #[ignore] + #[allow(dead_code)] // Justification: huge test, takes 36 minutes. keep for local testing fn beefy_test_data_driven_verify_e2e() { let (header, _, _) = testnet_state(); From 002092d6a12155c026d43f2818c07c455e90ae2e Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 16:33:37 +0000 Subject: [PATCH 66/67] ci: download archive --- .github/workflows/on_pull_request.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 1976efb..050796a 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -71,6 +71,10 @@ jobs: . - name: "Install cargo-nextest" run: cargo install cargo-nextest + - name: Download archive + uses: actions/download-artifact@v3 + with: + name: nextest-archive - name: "Run normal tests" run: | cargo nextest run \ From dda185c8f90459c3a3309ececdb384458efd9dc5 Mon Sep 17 00:00:00 2001 From: dndll Date: Fri, 16 Feb 2024 16:44:37 +0000 Subject: [PATCH 67/67] build: fix forge submodules --- .gitmodules | 24 +++++++++---------- bin/client/src/client/mod.rs | 2 +- nearx/contract/lib/forge-std | 1 + nearx/contract/lib/foundry-devops | 1 + nearx/contract/lib/openzeppelin-contracts | 1 + .../lib/openzeppelin-contracts-upgradeable | 1 + nearx/contract/lib/solidity-bytes-utils | 1 + nearx/src/hint.rs | 6 ++--- 8 files changed, 21 insertions(+), 16 deletions(-) create mode 160000 nearx/contract/lib/forge-std create mode 160000 nearx/contract/lib/foundry-devops create mode 160000 nearx/contract/lib/openzeppelin-contracts create mode 160000 nearx/contract/lib/openzeppelin-contracts-upgradeable create mode 160000 nearx/contract/lib/solidity-bytes-utils diff --git a/.gitmodules b/.gitmodules index 29700af..96bfd38 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,21 @@ -[submodule "circuits/plonky2x/contracts/forge/lib/forge-std"] - path = circuits/plonky2x/contracts/forge/lib/forge-std - url = https://github.com/foundry-rs/forge-std [submodule "vendor/starkyx"] path = vendor/starkyx url = git@github.com:succinctlabs/starkyx.git [submodule "vendor/succinctx"] path = vendor/succinctx url = git@github.com:succinctlabs/succinctx.git -[submodule "circuits/plonky2x/verifier/lib/openzeppelin-contracts-upgradeable"] - path = circuits/plonky2x/verifier/lib/openzeppelin-contracts-upgradeable - url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable -[submodule "circuits/plonky2x/verifier/lib/openzeppelin-contracts"] - path = circuits/plonky2x/verifier/lib/openzeppelin-contracts +[submodule "nearx/contract/lib/openzeppelin-contracts"] + path = nearx/contract/lib/openzeppelin-contracts url = https://github.com/OpenZeppelin/openzeppelin-contracts -[submodule "circuits/plonky2x/verifier/lib/foundry-devops"] - path = circuits/plonky2x/verifier/lib/foundry-devops +[submodule "nearx/contract/lib/openzeppelin-contracts-upgradeable"] + path = nearx/contract/lib/openzeppelin-contracts-upgradeable + url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable +[submodule "nearx/contract/lib/foundry-devops"] + path = nearx/contract/lib/foundry-devops url = https://github.com/chainaccelorg/foundry-devops -[submodule "circuits/plonky2x/contract/lib/solidity-bytes-utils"] - path = circuits/plonky2x/contract/lib/solidity-bytes-utils +[submodule "nearx/contract/lib/solidity-bytes-utils"] + path = nearx/contract/lib/solidity-bytes-utils url = https://github.com/GNSPS/solidity-bytes-utils +[submodule "nearx/contract/lib/forge-std"] + path = nearx/contract/lib/forge-std + url = https://github.com/foundry-rs/forge-std diff --git a/bin/client/src/client/mod.rs b/bin/client/src/client/mod.rs index 1de74d0..497a925 100644 --- a/bin/client/src/client/mod.rs +++ b/bin/client/src/client/mod.rs @@ -113,7 +113,7 @@ impl Handler for LightClient { impl LightClient { pub fn new(config: &Config) -> Result { - let client = rpc::NearRpcClient::new(config.network.clone()); + let client = rpc::NearRpcClient::new(config.network); // TODO: store selector in config let store = store::sled::init(config)?; diff --git a/nearx/contract/lib/forge-std b/nearx/contract/lib/forge-std new file mode 160000 index 0000000..ae570fe --- /dev/null +++ b/nearx/contract/lib/forge-std @@ -0,0 +1 @@ +Subproject commit ae570fec082bfe1c1f45b0acca4a2b4f84d345ce diff --git a/nearx/contract/lib/foundry-devops b/nearx/contract/lib/foundry-devops new file mode 160000 index 0000000..efe8780 --- /dev/null +++ b/nearx/contract/lib/foundry-devops @@ -0,0 +1 @@ +Subproject commit efe8780bb039b6d25642951764aac63fafd8faf1 diff --git a/nearx/contract/lib/openzeppelin-contracts b/nearx/contract/lib/openzeppelin-contracts new file mode 160000 index 0000000..3def8f9 --- /dev/null +++ b/nearx/contract/lib/openzeppelin-contracts @@ -0,0 +1 @@ +Subproject commit 3def8f9d15871160a146353b975ad7adf4c2bf67 diff --git a/nearx/contract/lib/openzeppelin-contracts-upgradeable b/nearx/contract/lib/openzeppelin-contracts-upgradeable new file mode 160000 index 0000000..f0fa8a3 --- /dev/null +++ b/nearx/contract/lib/openzeppelin-contracts-upgradeable @@ -0,0 +1 @@ +Subproject commit f0fa8a3d12015e5fa08efeadd8014d0aa3791ea2 diff --git a/nearx/contract/lib/solidity-bytes-utils b/nearx/contract/lib/solidity-bytes-utils new file mode 160000 index 0000000..e0115c4 --- /dev/null +++ b/nearx/contract/lib/solidity-bytes-utils @@ -0,0 +1 @@ +Subproject commit e0115c4d231910df47ce3b60625ce562fe4af985 diff --git a/nearx/src/hint.rs b/nearx/src/hint.rs index bd6c209..6db6c79 100644 --- a/nearx/src/hint.rs +++ b/nearx/src/hint.rs @@ -21,7 +21,7 @@ impl, const D: usize> AsyncHint for FetchNextHeaderI input_stream: &mut ValueStream, output_stream: &mut ValueStream, ) { - let client = NearRpcClient::new(self.0.clone()); + let client = NearRpcClient::new(self.0); let h = input_stream.read_value::().0; @@ -59,7 +59,7 @@ impl, const D: usize> AsyncHint for FetchHeaderInput input_stream: &mut ValueStream, output_stream: &mut ValueStream, ) { - let client = NearRpcClient::new(self.0.clone()); + let client = NearRpcClient::new(self.0); let h = input_stream.read_value::().0; @@ -102,7 +102,7 @@ impl, const D: usize, const B: usize> AsyncHint input_stream: &mut ValueStream, output_stream: &mut ValueStream, ) { - let client = NearRpcClient::new(self.0.clone()); + let client = NearRpcClient::new(self.0); let block_merkle_root = input_stream.read_value::().0; let last_verified = input_stream.read_value::().0;