diff --git a/README.md b/README.md index c8d32ee..b3901a1 100644 --- a/README.md +++ b/README.md @@ -2,32 +2,10 @@ [![CI](https://github.com/enviodev/hypersync-client-rust/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/enviodev/hypersync-client-rust/actions/workflows/ci.yaml) - Crates.io version Rust crate for [Envio's](https://envio.dev/) HyperSync client. [Documentation Page](https://docs.envio.dev/docs/hypersync-clients) - -### Dependencies - -Need to install capnproto tool in order to build the library. - -#### Linux - -```bash -apt-get install -y capnproto libcapnp-dev -``` - -#### Windows - -```bash -choco install capnproto -``` - -#### MacOS - -```bash -brew install capnp -``` diff --git a/hypersync-client/Cargo.toml b/hypersync-client/Cargo.toml index e6680eb..2781c0b 100644 --- a/hypersync-client/Cargo.toml +++ b/hypersync-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypersync-client" -version = "0.20.0-rc.1" +version = "0.20.0-rc.2" edition = "2021" description = "client library for hypersync" license = "MPL-2.0" @@ -47,7 +47,7 @@ nohash-hasher = "0.2.0" ethers = { version = "2.0.14", optional = true } alloy-primitives = "1.1" -hypersync-net-types = { path = "../hypersync-net-types", version = "0.11.0-rc.1" } +hypersync-net-types = { path = "../hypersync-net-types", version = "0.11.0-rc.2" } hypersync-format = { path = "../hypersync-format", version = "0.5" } hypersync-schema = { path = "../hypersync-schema", version = "0.3" } diff --git a/hypersync-client/src/config.rs b/hypersync-client/src/config.rs index 8c7f881..341fb61 100644 --- a/hypersync-client/src/config.rs +++ b/hypersync-client/src/config.rs @@ -21,6 +21,25 @@ pub struct ClientConfig { pub retry_base_ms: Option, /// Ceiling time for request backoff. pub retry_ceiling_ms: Option, + /// Query serialization format to use for HTTP requests. + #[serde(default)] + pub serialization_format: SerializationFormat, +} + +/// Determines query serialization format for HTTP requests. +#[derive(Clone, Copy, Debug, Serialize, Deserialize)] +pub enum SerializationFormat { + /// Use JSON serialization (default) + Json, + /// Use Cap'n Proto binary serialization + CapnProto, +} + +impl Default for SerializationFormat { + fn default() -> Self { + // Keep this the default until all hs instances are upgraded to use Cap'n Proto endpoint + Self::Json + } } /// Config for hypersync event streaming. diff --git a/hypersync-client/src/lib.rs b/hypersync-client/src/lib.rs index b28bd57..c436e1c 100644 --- a/hypersync-client/src/lib.rs +++ b/hypersync-client/src/lib.rs @@ -35,7 +35,7 @@ use url::Url; pub use column_mapping::{ColumnMapping, DataType}; pub use config::HexOutput; -pub use config::{ClientConfig, StreamConfig}; +pub use config::{ClientConfig, SerializationFormat, StreamConfig}; pub use decode::Decoder; pub use decode_call::CallDecoder; pub use types::{ArrowBatch, ArrowResponse, ArrowResponseData, QueryResponse}; @@ -61,6 +61,8 @@ pub struct Client { retry_base_ms: u64, /// Ceiling time for request backoff. retry_ceiling_ms: u64, + /// Query serialization format to use for HTTP requests. + serialization_format: SerializationFormat, } impl Client { @@ -86,6 +88,7 @@ impl Client { retry_backoff_ms: cfg.retry_backoff_ms.unwrap_or(500), retry_base_ms: cfg.retry_base_ms.unwrap_or(200), retry_ceiling_ms: cfg.retry_ceiling_ms.unwrap_or(5_000), + serialization_format: cfg.serialization_format, }) } @@ -383,8 +386,8 @@ impl Client { )) } - /// Executes query once and returns the result in (Arrow, size) format. - async fn get_arrow_impl(&self, query: &Query) -> Result<(ArrowResponse, u64)> { + /// Executes query once and returns the result in (Arrow, size) format using JSON serialization. + async fn get_arrow_impl_json(&self, query: &Query) -> Result<(ArrowResponse, u64)> { let mut url = self.url.clone(); let mut segments = url.path_segments_mut().ok().context("get path segments")?; segments.push("query"); @@ -418,6 +421,56 @@ impl Client { Ok((res, bytes.len().try_into().unwrap())) } + /// Executes query once and returns the result in (Arrow, size) format using Cap'n Proto serialization. + async fn get_arrow_impl_capnp(&self, query: &Query) -> Result<(ArrowResponse, u64)> { + let mut url = self.url.clone(); + let mut segments = url.path_segments_mut().ok().context("get path segments")?; + segments.push("query"); + segments.push("arrow-ipc"); + segments.push("capnp"); + std::mem::drop(segments); + let mut req = self.http_client.request(Method::POST, url); + + if let Some(bearer_token) = &self.bearer_token { + req = req.bearer_auth(bearer_token); + } + + let query_bytes = query.to_bytes().context("serialize query to bytes")?; + let res = req + .header("content-type", "application/x-capnp") + .body(query_bytes) + .send() + .await + .context("execute http req")?; + + let status = res.status(); + if !status.is_success() { + let text = res.text().await.context("read text to see error")?; + + return Err(anyhow!( + "http response status code {}, err body: {}", + status, + text + )); + } + + let bytes = res.bytes().await.context("read response body bytes")?; + + let res = tokio::task::block_in_place(|| { + parse_query_response(&bytes).context("parse query response") + })?; + + Ok((res, bytes.len().try_into().unwrap())) + } + + /// Executes query once and returns the result in (Arrow, size) format. + async fn get_arrow_impl(&self, query: &Query) -> Result<(ArrowResponse, u64)> { + match self.serialization_format { + SerializationFormat::Json => self.get_arrow_impl_json(query).await, + SerializationFormat::CapnProto => self.get_arrow_impl_capnp(query).await, + } + } + /// Executes query with retries and returns the response in Arrow format. pub async fn get_arrow(&self, query: &Query) -> Result { self.get_arrow_with_size(query).await.map(|res| res.0) diff --git a/hypersync-client/src/preset_query.rs b/hypersync-client/src/preset_query.rs index 02ece3e..ccef12a 100644 --- a/hypersync-client/src/preset_query.rs +++ b/hypersync-client/src/preset_query.rs @@ -3,6 +3,9 @@ use std::collections::BTreeSet; use arrayvec::ArrayVec; use hypersync_format::{Address, LogArgument}; +use hypersync_net_types::block::BlockField; +use hypersync_net_types::log::LogField; +use hypersync_net_types::transaction::TransactionField; use hypersync_net_types::{ FieldSelection, LogFilter, LogSelection, Query, TransactionFilter, TransactionSelection, }; @@ -12,17 +15,8 @@ use hypersync_net_types::{ /// Note: this is only for quickstart purposes. For the best performance, create a custom query /// that only includes the fields you'll use in `field_selection`. pub fn blocks_and_transactions(from_block: u64, to_block: Option) -> Query { - let all_block_fields: BTreeSet = hypersync_schema::block_header() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); - - let all_tx_fields: BTreeSet = hypersync_schema::transaction() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); + let all_block_fields = BlockField::all(); + let all_tx_fields = TransactionField::all(); Query { from_block, @@ -45,15 +39,11 @@ pub fn blocks_and_transactions(from_block: u64, to_block: Option) -> Query /// that only includes the fields you'll use in `field_selection`. pub fn blocks_and_transaction_hashes(from_block: u64, to_block: Option) -> Query { let mut tx_field_selection = BTreeSet::new(); - tx_field_selection.insert("block_hash".to_owned()); - tx_field_selection.insert("block_number".to_owned()); - tx_field_selection.insert("hash".to_owned()); + tx_field_selection.insert(TransactionField::BlockHash); + tx_field_selection.insert(TransactionField::BlockNumber); + tx_field_selection.insert(TransactionField::Hash); - let all_block_fields: BTreeSet = hypersync_schema::block_header() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); + let all_block_fields = BlockField::all(); Query { from_block, @@ -74,11 +64,7 @@ pub fn blocks_and_transaction_hashes(from_block: u64, to_block: Option) -> /// Note: this is only for quickstart purposes. For the best performance, create a custom query /// that only includes the fields you'll use in `field_selection`. pub fn logs(from_block: u64, to_block: Option, contract_address: Address) -> Query { - let all_log_fields: BTreeSet = hypersync_schema::log() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); + let all_log_fields = LogField::all(); Query { from_block, @@ -109,11 +95,7 @@ pub fn logs_of_event( let mut topics = ArrayVec::, 4>::new(); topics.insert(0, vec![topic0]); - let all_log_fields: BTreeSet = hypersync_schema::log() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); + let all_log_fields = LogField::all(); Query { from_block, @@ -136,11 +118,7 @@ pub fn logs_of_event( /// Note: this is only for quickstart purposes. For the best performance, create a custom query /// that only includes the fields you'll use in `field_selection`. pub fn transactions(from_block: u64, to_block: Option) -> Query { - let all_txn_fields: BTreeSet = hypersync_schema::transaction() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); + let all_txn_fields = TransactionField::all(); Query { from_block, @@ -163,11 +141,7 @@ pub fn transactions_from_address( to_block: Option, address: Address, ) -> Query { - let all_txn_fields: BTreeSet = hypersync_schema::transaction() - .fields - .iter() - .map(|x| x.name.clone()) - .collect(); + let all_txn_fields = TransactionField::all(); Query { from_block, diff --git a/hypersync-client/src/simple_types.rs b/hypersync-client/src/simple_types.rs index 7bcc6a7..05a2f53 100644 --- a/hypersync-client/src/simple_types.rs +++ b/hypersync-client/src/simple_types.rs @@ -6,7 +6,9 @@ use hypersync_format::{ AccessList, Address, Authorization, BlockNumber, BloomFilter, Data, Hash, LogArgument, LogIndex, Nonce, Quantity, TransactionIndex, TransactionStatus, TransactionType, Withdrawal, }; -use hypersync_net_types::FieldSelection; +use hypersync_net_types::{ + block::BlockField, log::LogField, transaction::TransactionField, FieldSelection, +}; use nohash_hasher::IntMap; use serde::{Deserialize, Serialize}; use xxhash_rust::xxh3::Xxh3Builder; @@ -26,10 +28,10 @@ pub struct Event { // Field lists for implementing event based API, these fields are used for joining // so they should always be added to the field selection. -const BLOCK_JOIN_FIELD: &str = "number"; -const TX_JOIN_FIELD: &str = "hash"; -const LOG_JOIN_FIELD_WITH_TX: &str = "transaction_hash"; -const LOG_JOIN_FIELD_WITH_BLOCK: &str = "block_number"; +const BLOCK_JOIN_FIELD: BlockField = BlockField::Number; +const TX_JOIN_FIELD: TransactionField = TransactionField::Hash; +const LOG_JOIN_FIELD_WITH_TX: LogField = LogField::TransactionHash; +const LOG_JOIN_FIELD_WITH_BLOCK: LogField = LogField::BlockNumber; enum InternalJoinStrategy { NotSelected, @@ -51,7 +53,7 @@ impl From<&FieldSelection> for InternalEventJoinStrategy { Self { block: if block_fields_num == 0 { InternalJoinStrategy::NotSelected - } else if block_fields_num == 1 && field_selection.block.contains(BLOCK_JOIN_FIELD) { + } else if block_fields_num == 1 && field_selection.block.contains(&BLOCK_JOIN_FIELD) { InternalJoinStrategy::OnlyLogJoinField } else { InternalJoinStrategy::FullJoin @@ -59,7 +61,7 @@ impl From<&FieldSelection> for InternalEventJoinStrategy { transaction: if transaction_fields_num == 0 { InternalJoinStrategy::NotSelected } else if transaction_fields_num == 1 - && field_selection.transaction.contains(TX_JOIN_FIELD) + && field_selection.transaction.contains(&TX_JOIN_FIELD) { InternalJoinStrategy::OnlyLogJoinField } else { @@ -75,34 +77,24 @@ impl InternalEventJoinStrategy { match self.block { InternalJoinStrategy::NotSelected => (), InternalJoinStrategy::OnlyLogJoinField => { - field_selection - .log - .insert(LOG_JOIN_FIELD_WITH_BLOCK.to_string()); - field_selection.block.remove(BLOCK_JOIN_FIELD); + field_selection.log.insert(LOG_JOIN_FIELD_WITH_BLOCK); + field_selection.block.remove(&BLOCK_JOIN_FIELD); } InternalJoinStrategy::FullJoin => { - field_selection - .log - .insert(LOG_JOIN_FIELD_WITH_BLOCK.to_string()); - field_selection.block.insert(BLOCK_JOIN_FIELD.to_string()); + field_selection.log.insert(LOG_JOIN_FIELD_WITH_BLOCK); + field_selection.block.insert(BLOCK_JOIN_FIELD); } } match self.transaction { InternalJoinStrategy::NotSelected => (), InternalJoinStrategy::OnlyLogJoinField => { - field_selection - .log - .insert(LOG_JOIN_FIELD_WITH_TX.to_string()); - field_selection.transaction.remove(TX_JOIN_FIELD); + field_selection.log.insert(LOG_JOIN_FIELD_WITH_TX); + field_selection.transaction.remove(&TX_JOIN_FIELD); } InternalJoinStrategy::FullJoin => { - field_selection - .log - .insert(LOG_JOIN_FIELD_WITH_TX.to_string()); - field_selection - .transaction - .insert(TX_JOIN_FIELD.to_string()); + field_selection.log.insert(LOG_JOIN_FIELD_WITH_TX); + field_selection.transaction.insert(TX_JOIN_FIELD); } } } diff --git a/hypersync-client/tests/api_test.rs b/hypersync-client/tests/api_test.rs index 9bf5b35..878435f 100644 --- a/hypersync-client/tests/api_test.rs +++ b/hypersync-client/tests/api_test.rs @@ -2,10 +2,14 @@ use std::{collections::BTreeSet, env::temp_dir, sync::Arc}; use alloy_json_abi::JsonAbi; use hypersync_client::{ - preset_query, simple_types::Transaction, Client, ClientConfig, ColumnMapping, StreamConfig, + preset_query, simple_types::Transaction, Client, ClientConfig, ColumnMapping, + SerializationFormat, StreamConfig, }; use hypersync_format::{Address, FilterWrapper, Hex, LogArgument}; -use hypersync_net_types::{FieldSelection, Query, TransactionFilter, TransactionSelection}; +use hypersync_net_types::{ + block::BlockField, log::LogField, transaction::TransactionField, FieldSelection, LogSelection, + Query, TransactionFilter, TransactionSelection, +}; use polars_arrow::array::UInt64Array; #[tokio::test(flavor = "multi_thread")] @@ -14,9 +18,9 @@ async fn test_api_arrow_ipc() { let client = Client::new(ClientConfig::default()).unwrap(); let mut block_field_selection = BTreeSet::new(); - block_field_selection.insert("number".to_owned()); - block_field_selection.insert("timestamp".to_owned()); - block_field_selection.insert("hash".to_owned()); + block_field_selection.insert(BlockField::Number); + block_field_selection.insert(BlockField::Timestamp); + block_field_selection.insert(BlockField::Hash); let res = client .get_arrow(&Query { @@ -446,9 +450,9 @@ async fn test_small_bloom_filter_query() { Address::decode_hex("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045").unwrap(); let mut txn_field_selection = BTreeSet::new(); - txn_field_selection.insert("block_number".to_owned()); - txn_field_selection.insert("from".to_owned()); - txn_field_selection.insert("hash".to_owned()); + txn_field_selection.insert(TransactionField::BlockNumber); + txn_field_selection.insert(TransactionField::From); + txn_field_selection.insert(TransactionField::Hash); let addrs = [vitalik_eth_addr.clone()]; let from_address_filter = @@ -527,3 +531,40 @@ async fn test_decode_string_param_into_arrow() { dbg!(data.data.decoded_logs); } + +#[tokio::test(flavor = "multi_thread")] +#[ignore] +async fn test_api_capnp_client() { + let client = Arc::new( + Client::new(ClientConfig { + url: Some("http://localhost:1131".parse().unwrap()), + serialization_format: SerializationFormat::CapnProto, + + ..Default::default() + }) + .unwrap(), + ); + + let field_selection = FieldSelection { + block: BlockField::all(), + log: LogField::all(), + transaction: TransactionField::all(), + trace: Default::default(), + }; + let query = Query { + from_block: 0, + logs: vec![LogSelection::default()], + transactions: Vec::new(), + include_all_blocks: true, + field_selection, + ..Default::default() + }; + println!("starting stream, query {:?}", &query); + + let mut res = client.stream(query, StreamConfig::default()).await.unwrap(); + + while let Some(res) = res.recv().await { + let res = res.unwrap(); + dbg!(res); + } +} diff --git a/hypersync-format/src/types/bloom_filter_wrapper.rs b/hypersync-format/src/types/bloom_filter_wrapper.rs index fcb8e37..fde23ad 100644 --- a/hypersync-format/src/types/bloom_filter_wrapper.rs +++ b/hypersync-format/src/types/bloom_filter_wrapper.rs @@ -15,6 +15,14 @@ use crate::Data; #[derive(Clone)] pub struct FilterWrapper(pub Filter); +impl PartialEq for FilterWrapper { + fn eq(&self, other: &Self) -> bool { + self.0.as_bytes() == other.0.as_bytes() + } +} + +impl Eq for FilterWrapper {} + impl FilterWrapper { pub fn new(bits_per_key: usize, num_keys: usize) -> Self { Self(Filter::new(bits_per_key, num_keys)) @@ -46,11 +54,11 @@ impl FilterWrapper { Ok(FilterWrapper(filter)) } -} -impl PartialEq for FilterWrapper { - fn eq(&self, other: &Self) -> bool { - self.0.as_bytes() == other.0.as_bytes() + pub fn from_bytes(bytes: &[u8]) -> Result { + Filter::from_bytes(bytes) + .ok_or(Error::BloomFilterFromBytes) + .map(FilterWrapper) } } diff --git a/hypersync-net-types/Cargo.toml b/hypersync-net-types/Cargo.toml index f8571fe..becab6d 100644 --- a/hypersync-net-types/Cargo.toml +++ b/hypersync-net-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hypersync-net-types" -version = "0.11.0-rc.1" +version = "0.11.0-rc.2" edition = "2021" description = "hypersync types for transport over network" license = "MPL-2.0" @@ -11,10 +11,21 @@ serde = { version = "1", features = ["derive"] } arrayvec = { version = "0.7", features = ["serde"] } hypersync-format = { path = "../hypersync-format", version = "0.5" } - -[build-dependencies] -capnpc = "0.19" +schemars = "1.0.4" +strum = "0.27.2" +strum_macros = "0.27.2" +zstd = "0.13.3" +anyhow = "1.0.100" [dev-dependencies] +hypersync-schema = { path = "../hypersync-schema" } serde_json = "1" pretty_assertions = "1" +sha3 = "0.10.8" +flate2 = "1.1.5" +lz4_flex = "0.11.5" +tabled = "0.20.0" + +[[bench]] +name = "compression" +harness = false diff --git a/hypersync-net-types/Makefile b/hypersync-net-types/Makefile new file mode 100644 index 0000000..c9e7ef3 --- /dev/null +++ b/hypersync-net-types/Makefile @@ -0,0 +1,8 @@ +.PHONY: generate_capnp_types clean_generated_capnp_types + +generate_capnp_types: + capnp compile hypersync_net_types.capnp -o rust:./src/__generated__ + rustfmt src/__generated__/hypersync_net_types_capnp.rs + +clean_generated_capnp_types: + rm -f src/__generated__/hypersync_net_types_capnp.rs diff --git a/hypersync-net-types/benches/compression.rs b/hypersync-net-types/benches/compression.rs new file mode 100644 index 0000000..99da1b5 --- /dev/null +++ b/hypersync-net-types/benches/compression.rs @@ -0,0 +1,385 @@ +use arrayvec::ArrayVec; +use hypersync_format::{Address, FixedSizeData}; +use hypersync_net_types::{log::LogField, FieldSelection, LogFilter, LogSelection, Query}; +use pretty_assertions::assert_eq; +use std::{ + collections::HashMap, + io::{Read, Write}, + time::Duration, +}; + +fn main() { + // Collect rankings in each benchmark to find out which is the overall best + let mut bytes_ranks = HashMap::new(); + let mut decode_time_ranks = HashMap::new(); + let mut encode_time_ranks = HashMap::new(); + + let mut add_to_ranks = |mut encodings: Vec| { + // sort by len fist + encodings.sort_by_key(|a| a.bytes.len()); + let mut prev_val = 0; + let mut current_pos = 0; + for encoding in encodings.iter() { + if encoding.bytes.len() > prev_val { + current_pos += 1; + prev_val = encoding.bytes.len(); + } + let current = bytes_ranks.get(&encoding.name).unwrap_or(&0); + bytes_ranks.insert(encoding.name.clone(), current + current_pos); + } + + encodings.sort_by_key(|a| a.decode_time); + let mut prev_val = Duration::from_secs(0); + current_pos = 0; + for encoding in encodings.iter() { + if encoding.decode_time > prev_val { + current_pos += 1; + prev_val = encoding.decode_time; + } + let current = decode_time_ranks.get(&encoding.name).unwrap_or(&0); + decode_time_ranks.insert(encoding.name.clone(), current + current_pos); + } + encodings.sort_by_key(|a| a.encode_time); + prev_val = Duration::from_secs(0); + current_pos = 0; + for encoding in encodings.iter() { + if encoding.encode_time > prev_val { + current_pos += 1; + prev_val = encoding.encode_time; + } + let current = encode_time_ranks.get(&encoding.name).unwrap_or(&0); + encode_time_ranks.insert(encoding.name.clone(), current + current_pos); + } + }; + + // Benchmark different payload sizes of logs queries (similar to an indexer) + let logs = mock_logs_query(build_mock_logs(3, 3, 1)); + let res = benchmark_compression(logs, "small payload"); + add_to_ranks(res); + + let logs = build_mock_logs(5, 6, 3); + let mock_query = mock_logs_query(logs); + let res = benchmark_compression(mock_query, "moderate payload"); + add_to_ranks(res); + + let logs = build_mock_logs(3, 5, 6); + let mock_query = mock_logs_query(logs); + let res = benchmark_compression(mock_query, "moderate payload 2"); + add_to_ranks(res); + + let logs = build_mock_logs(4, 3, 5); + let mock_query = mock_logs_query(logs); + let res = benchmark_compression(mock_query, "moderate payload 3"); + add_to_ranks(res); + + let logs = build_mock_logs(3, 7, 50); + let mock_query = mock_logs_query(logs); + let res = benchmark_compression(mock_query, "medium large payload"); + add_to_ranks(res); + + let logs = build_mock_logs(3, 6, 200); + let mock_query = mock_logs_query(logs); + let res = benchmark_compression(mock_query, "large payload"); + add_to_ranks(res); + + let logs = build_mock_logs(5, 6, 1000); + let mock_query = mock_logs_query(logs); + let res = benchmark_compression(mock_query, "huge payload"); + add_to_ranks(res); + + // let logs = build_mock_logs(1, 3, 10000); + // let res = benchmark_compression(mock_logs_query(logs), "huge payload less contracts"); + // add_to_ranks(res); + + // Print rankings + let mut bytes_ranks = bytes_ranks.into_iter().collect::>(); + bytes_ranks.sort_by_key(|a| a.1); + println!("\nBytes ranks"); + for (name, rank) in bytes_ranks.iter() { + println!("{name}: {rank}"); + } + + let mut decode_time_ranks = decode_time_ranks.into_iter().collect::>(); + decode_time_ranks.sort_by_key(|a| a.1); + println!("\nDecode time ranks"); + for (name, rank) in decode_time_ranks.iter() { + println!("{name}: {rank}"); + } + println!("\nEncode time ranks"); + let mut encode_time_ranks = encode_time_ranks.into_iter().collect::>(); + encode_time_ranks.sort_by_key(|a| a.1); + for (name, rank) in encode_time_ranks.iter() { + println!("{name}: {rank}"); + } +} + +fn build_mock_logs( + num_contracts: usize, + num_topic_0_per_contract: usize, + num_addresses_per_contract: usize, +) -> Vec { + fn mock_topic(input_a: usize, input_b: usize, seed: &str) -> FixedSizeData<32> { + use sha3::{Digest, Sha3_256}; + let mut hasher = Sha3_256::new(); + hasher.update(seed.as_bytes()); + hasher.update((input_a as u64).to_le_bytes()); + hasher.update((input_b as u64).to_le_bytes()); + let result = hasher.finalize(); + let val: [u8; 32] = result.into(); + FixedSizeData::from(val) + } + + fn mock_address(input_a: usize, input_b: usize) -> Address { + let topic = mock_topic(input_a, input_b, "ADDRESS"); + let address: [u8; 20] = topic.as_ref()[0..20].try_into().unwrap(); + Address::from(address) + } + let mut logs: Vec = Vec::new(); + + for contract_idx in 0..num_contracts { + let mut topics = ArrayVec::new(); + topics.push(vec![]); + let mut log_selection = LogFilter { + address: vec![], + address_filter: None, + topics, + }; + + for topic_idx in 0..num_topic_0_per_contract { + log_selection.topics[0].push(mock_topic(contract_idx, topic_idx, "TOPICS")); + } + + for addr_idx in 0..num_addresses_per_contract { + let address = mock_address(contract_idx, addr_idx); + log_selection.address.push(address); + } + logs.push(log_selection.into()); + } + logs +} + +fn mock_logs_query(logs: Vec) -> Query { + Query { + from_block: 50, + to_block: Some(500), + logs, + field_selection: FieldSelection { + log: LogField::all(), + ..Default::default() + }, + ..Default::default() + } +} +#[derive(Debug, Clone)] +struct Encoding { + name: String, + bytes: Vec, + encode_time: std::time::Duration, + decode_time: std::time::Duration, +} + +use tabled::{Table, Tabled}; + +#[derive(Tabled)] +struct EncodingRow { + name: String, + bytes_len: String, + encode_time: String, + decode_time: String, +} + +impl Encoding { + fn to_table(rows: Vec) -> Table { + let smallest_bytes = rows.iter().map(|r| r.bytes.len()).min().unwrap(); + let shortest_encode_time = rows.iter().map(|r| r.encode_time).min().unwrap(); + let shortest_decode_time = rows.iter().map(|r| r.decode_time).min().unwrap(); + + let mut table_rows = Vec::new(); + for encoding in rows { + table_rows.push(encoding.to_encoding_row( + smallest_bytes, + shortest_encode_time, + shortest_decode_time, + )); + } + Table::new(table_rows) + } + fn to_encoding_row( + &self, + smallest_bytes: usize, + shortest_encode_time: Duration, + shortest_decode_time: Duration, + ) -> EncodingRow { + fn percentage_incr(a: f64, b: f64) -> f64 { + ((a - b) / b * 100.0).round() + } + fn add_percentage(val: Duration, lowest: Duration) -> String { + if val == lowest { + format!("{val:?}") + } else { + let percentage = percentage_incr(val.as_micros() as f64, lowest.as_micros() as f64); + format!("{val:?} ({percentage}%)") + } + } + + let bytes_len = if self.bytes.len() == smallest_bytes { + format!("{}", self.bytes.len()) + } else { + let percentage = percentage_incr(self.bytes.len() as f64, smallest_bytes as f64); + format!("{} ({percentage}%)", self.bytes.len()) + }; + + EncodingRow { + name: self.name.clone(), + bytes_len, + encode_time: add_percentage(self.encode_time, shortest_encode_time), + decode_time: add_percentage(self.decode_time, shortest_decode_time), + } + } + fn new( + input: &T, + name: String, + encode: impl FnOnce(&T) -> Vec, + decode: impl FnOnce(&[u8]) -> T, + ) -> Encoding { + let encode_start = std::time::Instant::now(); + let val = encode(input); + let encode_time = encode_start.elapsed(); + + let decode_start = std::time::Instant::now(); + let decoded = decode(&val); + let decode_time = decode_start.elapsed(); + assert_eq!(input, &decoded); + + Encoding { + name, + bytes: val, + encode_time, + decode_time, + } + } + + fn with_compression( + &self, + name: &'static str, + compress: impl FnOnce(&[u8], u32) -> Vec, + decompress: impl FnOnce(&[u8], u32) -> Vec, + level: u32, + ) -> Encoding { + let name = format!("{}-{}{}", self.name, name, level); + let mut compressed_data = Self::new( + &self.bytes, + name, + |bytes| compress(bytes, level), + |bytes| decompress(bytes, level), + ); + + compressed_data.encode_time += self.encode_time; + compressed_data.decode_time += self.decode_time; + + compressed_data + } + + fn add_to_table_with_compressions(self, table_vec: &mut Vec) { + table_vec.push(self.clone()); + + fn zlib_encode(bytes: &[u8], level: u32) -> Vec { + use flate2::{write::ZlibEncoder, Compression}; + let mut enc = ZlibEncoder::new(Vec::new(), Compression::new(level)); + enc.write_all(bytes).unwrap(); + enc.finish().unwrap() + } + fn zlib_decode(bytes: &[u8], _level: u32) -> Vec { + use flate2::read::ZlibDecoder; + let mut dec = ZlibDecoder::new(bytes); + let mut buf = Vec::new(); + dec.read_to_end(&mut buf).unwrap(); + buf + } + + fn zstd_encode(bytes: &[u8], level: u32) -> Vec { + zstd::encode_all(bytes, level as i32).unwrap() + } + fn zstd_decode(bytes: &[u8], _level: u32) -> Vec { + zstd::decode_all(bytes).unwrap() + } + table_vec.push(self.with_compression("zstd", zstd_encode, zstd_decode, 3)); + table_vec.push(self.with_compression("zlib", zlib_encode, zlib_decode, 3)); + table_vec.push(self.with_compression("zstd", zstd_encode, zstd_decode, 9)); + table_vec.push(self.with_compression("zlib", zlib_encode, zlib_decode, 9)); + table_vec.push(self.with_compression("zstd", zstd_encode, zstd_decode, 6)); + table_vec.push(self.with_compression("lz4", lz4_encode, lz4_decode, 0)); + table_vec.push(self.with_compression("zstd", zstd_encode, zstd_decode, 12)); + + fn lz4_encode(bytes: &[u8], _level: u32) -> Vec { + lz4_flex::compress(bytes) + } + fn lz4_decode(bytes: &[u8], _level: u32) -> Vec { + lz4_flex::decompress(bytes, u32::MAX as usize).unwrap() + } + } +} +fn benchmark_compression(query: Query, label: &str) -> Vec { + let capnp_packed = { + fn to_capnp_bytes_packed(query: &Query) -> Vec { + query.to_capnp_bytes_packed().unwrap() + } + + fn from_capnp_bytes_packed(bytes: &[u8]) -> Query { + Query::from_capnp_bytes_packed(bytes).unwrap() + } + + Encoding::new( + &query, + "capnp-packed".to_string(), + to_capnp_bytes_packed, + from_capnp_bytes_packed, + ) + }; + + let capnp = { + fn to_capnp_bytes(query: &Query) -> Vec { + query.to_capnp_bytes().unwrap() + } + + fn from_capnp_bytes(bytes: &[u8]) -> Query { + Query::from_capnp_bytes(bytes).unwrap() + } + + Encoding::new( + &query, + "capnp".to_string(), + to_capnp_bytes, + from_capnp_bytes, + ) + }; + + let json = { + fn to_json(query: &Query) -> Vec { + serde_json::to_vec(query).unwrap() + } + fn from_json(bytes: &[u8]) -> Query { + serde_json::from_slice(bytes).unwrap() + } + Encoding::new(&query, "json".to_string(), to_json, from_json) + }; + Encoding::new( + &query, + "json".to_string(), + |q| serde_json::to_vec(q).unwrap(), + |bytes| serde_json::from_slice(bytes).unwrap(), + ); + + let mut table_rows = Vec::new(); + + for encoding in [capnp, capnp_packed, json] { + encoding.add_to_table_with_compressions(&mut table_rows); + } + + table_rows.sort_by_key(|a| a.bytes.len()); + + let table = Encoding::to_table(table_rows.clone()); + + println!("Benchmark {label}\n{table}\n"); + table_rows +} diff --git a/hypersync-net-types/build.rs b/hypersync-net-types/build.rs deleted file mode 100644 index f8902cb..0000000 --- a/hypersync-net-types/build.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - capnpc::CompilerCommand::new() - .file("hypersync_net_types.capnp") - .run() - .expect("compiling schema"); -} diff --git a/hypersync-net-types/hypersync_net_types.capnp b/hypersync-net-types/hypersync_net_types.capnp index 2ddfeff..4169d1d 100644 --- a/hypersync-net-types/hypersync_net_types.capnp +++ b/hypersync-net-types/hypersync_net_types.capnp @@ -22,3 +22,221 @@ struct QueryResponse { data @3 :QueryResponseData; rollbackGuard @4 :RollbackGuard; } + +struct Selection(T) { + include @0 :T; + exclude @1 :T; +} + + +struct BlockFilter { + hash @0 :List(Data); + miner @1 :List(Data); +} + + +struct LogFilter { + address @0 :List(Data); + addressFilter @1 :Data; + topics @2 :List(List(Data)); +} + +struct AuthorizationSelection { + chainId @0 :List(UInt64); + address @1 :List(Data); +} + +struct TransactionFilter { + from @0 :List(Data); + fromFilter @1 :Data; + to @2 :List(Data); + toFilter @3 :Data; + sighash @4 :List(Data); + status @5 :OptUInt8; + type @6 :List(UInt8); + contractAddress @7 :List(Data); + contractAddressFilter @8 :Data; + hash @9 :List(Data); + authorizationList @10 :List(AuthorizationSelection); +} + +struct TraceFilter { + from @0 :List(Data); + fromFilter @1 :Data; + to @2 :List(Data); + toFilter @3 :Data; + address @4 :List(Data); + addressFilter @5 :Data; + callType @6 :List(Text); + rewardType @7 :List(Text); + type @8 :List(Text); + sighash @9 :List(Data); +} + +struct FieldSelection { + block @0 :List(BlockField); + transaction @1 :List(TransactionField); + log @2 :List(LogField); + trace @3 :List(TraceField); +} + +enum JoinMode { + default @0; + joinAll @1; + joinNothing @2; +} + +enum BlockField { + number @0; + hash @1; + parentHash @2; + sha3Uncles @3; + logsBloom @4; + transactionsRoot @5; + stateRoot @6; + receiptsRoot @7; + miner @8; + extraData @9; + size @10; + gasLimit @11; + gasUsed @12; + timestamp @13; + mixHash @14; + nonce @15; + difficulty @16; + totalDifficulty @17; + uncles @18; + baseFeePerGas @19; + blobGasUsed @20; + excessBlobGas @21; + parentBeaconBlockRoot @22; + withdrawalsRoot @23; + withdrawals @24; + l1BlockNumber @25; + sendCount @26; + sendRoot @27; +} + +enum TransactionField { + blockHash @0; + blockNumber @1; + gas @2; + hash @3; + input @4; + nonce @5; + transactionIndex @6; + value @7; + cumulativeGasUsed @8; + effectiveGasPrice @9; + gasUsed @10; + logsBloom @11; + from @12; + gasPrice @13; + to @14; + v @15; + r @16; + s @17; + maxPriorityFeePerGas @18; + maxFeePerGas @19; + chainId @20; + contractAddress @21; + type @22; + root @23; + status @24; + yParity @25; + accessList @26; + authorizationList @27; + l1Fee @28; + l1GasPrice @29; + l1GasUsed @30; + l1FeeScalar @31; + gasUsedForL1 @32; + maxFeePerBlobGas @33; + blobVersionedHashes @34; + blobGasPrice @35; + blobGasUsed @36; + depositNonce @37; + depositReceiptVersion @38; + l1BaseFeeScalar @39; + l1BlobBaseFee @40; + l1BlobBaseFeeScalar @41; + l1BlockNumber @42; + mint @43; + sighash @44; + sourceHash @45; +} + +enum LogField { + transactionHash @0; + blockHash @1; + blockNumber @2; + transactionIndex @3; + logIndex @4; + address @5; + data @6; + removed @7; + topic0 @8; + topic1 @9; + topic2 @10; + topic3 @11; +} + +enum TraceField { + transactionHash @0; + blockHash @1; + blockNumber @2; + transactionPosition @3; + type @4; + error @5; + from @6; + to @7; + author @8; + gas @9; + gasUsed @10; + actionAddress @11; + address @12; + balance @13; + callType @14; + code @15; + init @16; + input @17; + output @18; + refundAddress @19; + rewardType @20; + sighash @21; + subtraces @22; + traceAddress @23; + value @24; +} + +struct QueryBody { + logs @1 :List(Selection(LogFilter)); + transactions @2 :List(Selection(TransactionFilter)); + traces @3 :List(Selection(TraceFilter)); + blocks @4 :List(Selection(BlockFilter)); + includeAllBlocks @5 :Bool; + fieldSelection @6 :FieldSelection; + maxNumBlocks @7 :OptUInt64; + maxNumTransactions @8 :OptUInt64; + maxNumLogs @9 :OptUInt64; + maxNumTraces @10 :OptUInt64; + joinMode @0 :JoinMode; +} + +struct BlockRange { + fromBlock @0 :UInt64; + toBlock @1 :OptUInt64; +} + +struct Query { + blockRange @0 :BlockRange; + body @1 :QueryBody; +} + +struct OptUInt64 { + value @0 :UInt64; +} + +struct OptUInt8 { + value @0 :UInt8; +} diff --git a/hypersync-net-types/src/__generated__/hypersync_net_types_capnp.rs b/hypersync-net-types/src/__generated__/hypersync_net_types_capnp.rs new file mode 100644 index 0000000..ce2eec0 --- /dev/null +++ b/hypersync-net-types/src/__generated__/hypersync_net_types_capnp.rs @@ -0,0 +1,8619 @@ +// @generated by the capnpc-rust plugin to the Cap'n Proto schema compiler. +// DO NOT EDIT. +// source: hypersync_net_types.capnp + +pub mod query_response_data { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_blocks(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_blocks(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_transactions(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_transactions(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + #[inline] + pub fn get_logs(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_logs(&self) -> bool { + !self.reader.get_pointer_field(2).is_null() + } + #[inline] + pub fn get_traces(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_traces(&self) -> bool { + !self.reader.get_pointer_field(3).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 4, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_blocks(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_blocks(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(0).set_data(value); + } + #[inline] + pub fn init_blocks(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(0).init_data(size) + } + #[inline] + pub fn has_blocks(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_transactions(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_transactions(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(1).set_data(value); + } + #[inline] + pub fn init_transactions(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(1).init_data(size) + } + #[inline] + pub fn has_transactions(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + #[inline] + pub fn get_logs(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_logs(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(2).set_data(value); + } + #[inline] + pub fn init_logs(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(2).init_data(size) + } + #[inline] + pub fn has_logs(&self) -> bool { + !self.builder.is_pointer_field_null(2) + } + #[inline] + pub fn get_traces(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_traces(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(3).set_data(value); + } + #[inline] + pub fn init_traces(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(3).init_data(size) + } + #[inline] + pub fn has_traces(&self) -> bool { + !self.builder.is_pointer_field_null(3) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 81] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(49, 157, 62, 151, 169, 39, 204, 137), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(4, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 98, 1, 0, 0), + ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 0, 0, 0, 231, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 81, 117, 101, 114, 121, 82), + ::capnp::word(101, 115, 112, 111, 110, 115, 101, 68), + ::capnp::word(97, 116, 97, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(92, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(104, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(101, 0, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(100, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(112, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(116, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(113, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(120, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(98, 108, 111, 99, 107, 115, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 115, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 111, 103, 115, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 99, 101, 115, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 2 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 3 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 2, 3, 1]; + pub const TYPE_ID: u64 = 0x89cc_27a9_973e_9d31; + } +} + +pub mod rollback_guard { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_hash(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_hash(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_block_number(self) -> u64 { + self.reader.get_data_field::(0) + } + #[inline] + pub fn get_timestamp(self) -> i64 { + self.reader.get_data_field::(1) + } + #[inline] + pub fn get_first_block_number(self) -> u64 { + self.reader.get_data_field::(2) + } + #[inline] + pub fn get_first_parent_hash(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_first_parent_hash(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 3, + pointers: 2, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_hash(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_hash(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(0).set_data(value); + } + #[inline] + pub fn init_hash(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(0).init_data(size) + } + #[inline] + pub fn has_hash(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_block_number(self) -> u64 { + self.builder.get_data_field::(0) + } + #[inline] + pub fn set_block_number(&mut self, value: u64) { + self.builder.set_data_field::(0, value); + } + #[inline] + pub fn get_timestamp(self) -> i64 { + self.builder.get_data_field::(1) + } + #[inline] + pub fn set_timestamp(&mut self, value: i64) { + self.builder.set_data_field::(1, value); + } + #[inline] + pub fn get_first_block_number(self) -> u64 { + self.builder.get_data_field::(2) + } + #[inline] + pub fn set_first_block_number(&mut self, value: u64) { + self.builder.set_data_field::(2, value); + } + #[inline] + pub fn get_first_parent_hash(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_first_parent_hash(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(1).set_data(value); + } + #[inline] + pub fn init_first_parent_hash(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(1).init_data(size) + } + #[inline] + pub fn has_first_parent_hash(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 99] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(75, 175, 253, 87, 239, 86, 125, 149), + ::capnp::word(26, 0, 0, 0, 1, 0, 3, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 66, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 31, 1, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 82, 111, 108, 108, 98, 97), + ::capnp::word(99, 107, 71, 117, 97, 114, 100, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(20, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(125, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(120, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(132, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(129, 0, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(128, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(140, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(137, 0, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(136, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(148, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 0, 0, 0, 138, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(148, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(160, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(157, 0, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(156, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(168, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(104, 97, 115, 104, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 99, 107, 78, 117, 109), + ::capnp::word(98, 101, 114, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 105, 109, 101, 115, 116, 97, 109), + ::capnp::word(112, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(102, 105, 114, 115, 116, 66, 108, 111), + ::capnp::word(99, 107, 78, 117, 109, 98, 101, 114), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(102, 105, 114, 115, 116, 80, 97, 114), + ::capnp::word(101, 110, 116, 72, 97, 115, 104, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => ::introspect(), + 2 => ::introspect(), + 3 => ::introspect(), + 4 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[1, 3, 4, 0, 2]; + pub const TYPE_ID: u64 = 0x957d_56ef_57fd_af4b; + } +} + +pub mod query_response { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_archive_height(self) -> i64 { + self.reader.get_data_field::(0) + } + #[inline] + pub fn get_next_block(self) -> u64 { + self.reader.get_data_field::(1) + } + #[inline] + pub fn get_total_execution_time(self) -> u64 { + self.reader.get_data_field::(2) + } + #[inline] + pub fn get_data( + self, + ) -> ::capnp::Result> + { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_data(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_rollback_guard( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_rollback_guard(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 3, + pointers: 2, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_archive_height(self) -> i64 { + self.builder.get_data_field::(0) + } + #[inline] + pub fn set_archive_height(&mut self, value: i64) { + self.builder.set_data_field::(0, value); + } + #[inline] + pub fn get_next_block(self) -> u64 { + self.builder.get_data_field::(1) + } + #[inline] + pub fn set_next_block(&mut self, value: u64) { + self.builder.set_data_field::(1, value); + } + #[inline] + pub fn get_total_execution_time(self) -> u64 { + self.builder.get_data_field::(2) + } + #[inline] + pub fn set_total_execution_time(&mut self, value: u64) { + self.builder.set_data_field::(2, value); + } + #[inline] + pub fn get_data( + self, + ) -> ::capnp::Result> + { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_data( + &mut self, + value: crate::hypersync_net_types_capnp::query_response_data::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_data( + self, + ) -> crate::hypersync_net_types_capnp::query_response_data::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) + } + #[inline] + pub fn has_data(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_rollback_guard( + self, + ) -> ::capnp::Result> + { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_rollback_guard( + &mut self, + value: crate::hypersync_net_types_capnp::rollback_guard::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_rollback_guard( + self, + ) -> crate::hypersync_net_types_capnp::rollback_guard::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) + } + #[inline] + pub fn has_rollback_guard(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline { + pub fn get_data(&self) -> crate::hypersync_net_types_capnp::query_response_data::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) + } + pub fn get_rollback_guard( + &self, + ) -> crate::hypersync_net_types_capnp::rollback_guard::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) + } + } + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 99] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(226, 9, 54, 243, 16, 76, 106, 205), + ::capnp::word(26, 0, 0, 0, 1, 0, 3, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 66, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 31, 1, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 81, 117, 101, 114, 121, 82), + ::capnp::word(101, 115, 112, 111, 110, 115, 101, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(20, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(125, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(124, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(136, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(133, 0, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(132, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(144, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(141, 0, 0, 0, 154, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(144, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(156, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(153, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(148, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(160, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(157, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(156, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(168, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(97, 114, 99, 104, 105, 118, 101, 72), + ::capnp::word(101, 105, 103, 104, 116, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(110, 101, 120, 116, 66, 108, 111, 99), + ::capnp::word(107, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 116, 97, 108, 69, 120, 101), + ::capnp::word(99, 117, 116, 105, 111, 110, 84, 105), + ::capnp::word(109, 101, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(100, 97, 116, 97, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(49, 157, 62, 151, 169, 39, 204, 137), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(114, 111, 108, 108, 98, 97, 99, 107), + ::capnp::word(71, 117, 97, 114, 100, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(75, 175, 253, 87, 239, 86, 125, 149), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => ::introspect(), + 1 => ::introspect(), + 2 => ::introspect(), + 3 => ::introspect(), + 4 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 3, 1, 4, 2]; + pub const TYPE_ID: u64 = 0xcd6a_4c10_f336_09e2; + } +} + +pub mod selection { + /* T */ + #[derive(Copy, Clone)] + pub struct Owned { + _phantom: ::core::marker::PhantomData, + } + impl ::capnp::introspect::Introspect for Owned + where + T: ::capnp::traits::Owned, + { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types::, + annotation_types: _private::get_annotation_types::, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned + where + T: ::capnp::traits::Owned, + { + type Reader<'a> = Reader<'a, T>; + type Builder<'a> = Builder<'a, T>; + } + impl ::capnp::traits::OwnedStruct for Owned + where + T: ::capnp::traits::Owned, + { + type Reader<'a> = Reader<'a, T>; + type Builder<'a> = Builder<'a, T>; + } + impl ::capnp::traits::Pipelined for Owned + where + T: ::capnp::traits::Owned, + { + type Pipeline = Pipeline; + } + + pub struct Reader<'a, T> + where + T: ::capnp::traits::Owned, + { + reader: ::capnp::private::layout::StructReader<'a>, + _phantom: ::core::marker::PhantomData, + } + impl ::core::marker::Copy for Reader<'_, T> where T: ::capnp::traits::Owned {} + impl ::core::clone::Clone for Reader<'_, T> + where + T: ::capnp::traits::Owned, + { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_, T> + where + T: ::capnp::traits::Owned, + { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a, T> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a, T> + where + T: ::capnp::traits::Owned, + { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { + reader, + _phantom: ::core::marker::PhantomData, + } + } + } + + impl<'a, T> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> + where + T: ::capnp::traits::Owned, + { + fn from(reader: Reader<'a, T>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types::, + annotation_types: _private::get_annotation_types::, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_, T> + where + T: ::capnp::traits::Owned, + { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a, T> ::capnp::traits::FromPointerReader<'a> for Reader<'a, T> + where + T: ::capnp::traits::Owned, + { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a, T> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a, T> + where + T: ::capnp::traits::Owned, + { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a, T> ::capnp::traits::Imbue<'a> for Reader<'a, T> + where + T: ::capnp::traits::Owned, + { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a, T> Reader<'a, T> + where + T: ::capnp::traits::Owned, + { + pub fn reborrow(&self) -> Reader<'_, T> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_include(self) -> ::capnp::Result<::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_include(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_exclude(self) -> ::capnp::Result<::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_exclude(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + } + + pub struct Builder<'a, T> + where + T: ::capnp::traits::Owned, + { + builder: ::capnp::private::layout::StructBuilder<'a>, + _phantom: ::core::marker::PhantomData, + } + impl ::capnp::traits::HasStructSize for Builder<'_, T> + where + T: ::capnp::traits::Owned, + { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 2, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_, T> + where + T: ::capnp::traits::Owned, + { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a, T> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a, T> + where + T: ::capnp::traits::Owned, + { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { + builder, + _phantom: ::core::marker::PhantomData, + } + } + } + + impl<'a, T> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> + where + T: ::capnp::traits::Owned, + { + fn from(builder: Builder<'a, T>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types::, + annotation_types: _private::get_annotation_types::, + }), + )) + } + } + + impl<'a, T> ::capnp::traits::ImbueMut<'a> for Builder<'a, T> + where + T: ::capnp::traits::Owned, + { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a, T> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a, T> + where + T: ::capnp::traits::Owned, + { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput> for Reader<'_, T> + where + T: ::capnp::traits::Owned, + { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a, T> Builder<'a, T> + where + T: ::capnp::traits::Owned, + { + pub fn into_reader(self) -> Reader<'a, T> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_, T> { + Builder { + builder: self.builder.reborrow(), + ..*self + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_, T> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_include(self) -> ::capnp::Result<::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn initn_include(self, length: u32) -> ::Builder<'a> { + ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).initn_as(length) + } + #[inline] + pub fn set_include( + &mut self, + value: impl ::capnp::traits::SetterInput, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_include(self) -> ::Builder<'a> { + ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(0)).init_as() + } + #[inline] + pub fn has_include(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_exclude(self) -> ::capnp::Result<::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn initn_exclude(self, length: u32) -> ::Builder<'a> { + ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(1)).initn_as(length) + } + #[inline] + pub fn set_exclude( + &mut self, + value: impl ::capnp::traits::SetterInput, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_exclude(self) -> ::Builder<'a> { + ::capnp::any_pointer::Builder::new(self.builder.get_pointer_field(1)).init_as() + } + #[inline] + pub fn has_exclude(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + _phantom: ::core::marker::PhantomData, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + _phantom: ::core::marker::PhantomData, + } + } + } + impl Pipeline + where + T: ::capnp::traits::Pipelined, + ::Pipeline: ::capnp::capability::FromTypelessPipeline, + { + pub fn get_include(&self) -> ::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) + } + pub fn get_exclude(&self) -> ::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) + } + } + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 52] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 34, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 119, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(149, 0, 0, 0, 15, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 83, 101, 108, 101, 99, 116), + ::capnp::word(105, 111, 110, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(45, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(105, 110, 99, 108, 117, 100, 101, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(101, 120, 99, 108, 117, 100, 101, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 0, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 18, 0, 0, 0), + ::capnp::word(84, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type + where + T: ::capnp::traits::Owned, + { + match index { + 0 => ::introspect(), + 1 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type + where + T: ::capnp::traits::Owned, + { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[1, 0]; + pub const TYPE_ID: u64 = 0xc925_9ac7_2d0e_887b; + } +} + +pub mod block_filter { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_hash(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_hash(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_miner(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_miner(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 2, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_hash(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_hash(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_hash(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_hash(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_miner(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_miner(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_miner(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(1), + size, + ) + } + #[inline] + pub fn has_miner(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 57] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(198, 210, 137, 50, 10, 244, 5, 189), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 50, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 119, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 66, 108, 111, 99, 107, 70), + ::capnp::word(105, 108, 116, 101, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(64, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(61, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(56, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(104, 97, 115, 104, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 105, 110, 101, 114, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; + pub const TYPE_ID: u64 = 0xbd05_f40a_3289_d2c6; + } +} + +pub mod log_filter { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_address(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_address(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_address_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_address_filter(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + #[inline] + pub fn get_topics( + self, + ) -> ::capnp::Result<::capnp::list_list::Reader<'a, ::capnp::data_list::Owned>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_topics(&self) -> bool { + !self.reader.get_pointer_field(2).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 3, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_address(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_address( + &mut self, + value: ::capnp::data_list::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_address(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_address(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_address_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_address_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(1).set_data(value); + } + #[inline] + pub fn init_address_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(1).init_data(size) + } + #[inline] + pub fn has_address_filter(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + #[inline] + pub fn get_topics( + self, + ) -> ::capnp::Result<::capnp::list_list::Builder<'a, ::capnp::data_list::Owned>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_topics( + &mut self, + value: ::capnp::list_list::Reader<'_, ::capnp::data_list::Owned>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(2), + value, + false, + ) + } + #[inline] + pub fn init_topics( + self, + size: u32, + ) -> ::capnp::list_list::Builder<'a, ::capnp::data_list::Owned> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(2), + size, + ) + } + #[inline] + pub fn has_topics(&self) -> bool { + !self.builder.is_pointer_field_null(2) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 77] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(179, 254, 244, 73, 117, 248, 19, 160), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(3, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 34, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 175, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 76, 111, 103, 70, 105, 108), + ::capnp::word(116, 101, 114, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(12, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(69, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(64, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(92, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(89, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(88, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(100, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(92, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(136, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 70), + ::capnp::word(105, 108, 116, 101, 114, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 112, 105, 99, 115, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 2 => <::capnp::list_list::Owned<::capnp::data_list::Owned> as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 1, 2]; + pub const TYPE_ID: u64 = 0xa013_f875_49f4_feb3; + } +} + +pub mod authorization_selection { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_chain_id(self) -> ::capnp::Result<::capnp::primitive_list::Reader<'a, u64>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_chain_id(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_address(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_address(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 2, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_chain_id(self) -> ::capnp::Result<::capnp::primitive_list::Builder<'a, u64>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_chain_id( + &mut self, + value: impl ::capnp::traits::SetterInput<::capnp::primitive_list::Owned>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_chain_id(self, size: u32) -> ::capnp::primitive_list::Builder<'a, u64> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_chain_id(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_address(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_address( + &mut self, + value: ::capnp::data_list::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_address(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(1), + size, + ) + } + #[inline] + pub fn has_address(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 59] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(141, 105, 202, 172, 115, 150, 48, 135), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 138, 1, 0, 0), + ::capnp::word(45, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 119, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 65, 117, 116, 104, 111, 114), + ::capnp::word(105, 122, 97, 116, 105, 111, 110, 83), + ::capnp::word(101, 108, 101, 99, 116, 105, 111, 110), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(64, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(61, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(56, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(84, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(99, 104, 97, 105, 110, 73, 100, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::primitive_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[1, 0]; + pub const TYPE_ID: u64 = 0x8730_9673_acca_698d; + } +} + +pub mod transaction_filter { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_from(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_from(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_from_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_from_filter(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + #[inline] + pub fn get_to(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_to(&self) -> bool { + !self.reader.get_pointer_field(2).is_null() + } + #[inline] + pub fn get_to_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_to_filter(&self) -> bool { + !self.reader.get_pointer_field(3).is_null() + } + #[inline] + pub fn get_sighash(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(4), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_sighash(&self) -> bool { + !self.reader.get_pointer_field(4).is_null() + } + #[inline] + pub fn get_status( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(5), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_status(&self) -> bool { + !self.reader.get_pointer_field(5).is_null() + } + #[inline] + pub fn get_type(self) -> ::capnp::Result<::capnp::primitive_list::Reader<'a, u8>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(6), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_type(&self) -> bool { + !self.reader.get_pointer_field(6).is_null() + } + #[inline] + pub fn get_contract_address(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(7), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_contract_address(&self) -> bool { + !self.reader.get_pointer_field(7).is_null() + } + #[inline] + pub fn get_contract_address_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(8), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_contract_address_filter(&self) -> bool { + !self.reader.get_pointer_field(8).is_null() + } + #[inline] + pub fn get_hash(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(9), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_hash(&self) -> bool { + !self.reader.get_pointer_field(9).is_null() + } + #[inline] + pub fn get_authorization_list( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Reader< + 'a, + crate::hypersync_net_types_capnp::authorization_selection::Owned, + >, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(10), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_authorization_list(&self) -> bool { + !self.reader.get_pointer_field(10).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 11, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_from(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_from(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_from(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_from(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_from_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_from_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(1).set_data(value); + } + #[inline] + pub fn init_from_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(1).init_data(size) + } + #[inline] + pub fn has_from_filter(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + #[inline] + pub fn get_to(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_to(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(2), + value, + false, + ) + } + #[inline] + pub fn init_to(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(2), + size, + ) + } + #[inline] + pub fn has_to(&self) -> bool { + !self.builder.is_pointer_field_null(2) + } + #[inline] + pub fn get_to_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_to_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(3).set_data(value); + } + #[inline] + pub fn init_to_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(3).init_data(size) + } + #[inline] + pub fn has_to_filter(&self) -> bool { + !self.builder.is_pointer_field_null(3) + } + #[inline] + pub fn get_sighash(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(4), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_sighash( + &mut self, + value: ::capnp::data_list::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(4), + value, + false, + ) + } + #[inline] + pub fn init_sighash(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(4), + size, + ) + } + #[inline] + pub fn has_sighash(&self) -> bool { + !self.builder.is_pointer_field_null(4) + } + #[inline] + pub fn get_status( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(5), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_status( + &mut self, + value: crate::hypersync_net_types_capnp::opt_u_int8::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(5), + value, + false, + ) + } + #[inline] + pub fn init_status(self) -> crate::hypersync_net_types_capnp::opt_u_int8::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(5), 0) + } + #[inline] + pub fn has_status(&self) -> bool { + !self.builder.is_pointer_field_null(5) + } + #[inline] + pub fn get_type(self) -> ::capnp::Result<::capnp::primitive_list::Builder<'a, u8>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(6), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_type( + &mut self, + value: impl ::capnp::traits::SetterInput<::capnp::primitive_list::Owned>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(6), + value, + false, + ) + } + #[inline] + pub fn init_type(self, size: u32) -> ::capnp::primitive_list::Builder<'a, u8> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(6), + size, + ) + } + #[inline] + pub fn has_type(&self) -> bool { + !self.builder.is_pointer_field_null(6) + } + #[inline] + pub fn get_contract_address(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(7), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_contract_address( + &mut self, + value: ::capnp::data_list::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(7), + value, + false, + ) + } + #[inline] + pub fn init_contract_address(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(7), + size, + ) + } + #[inline] + pub fn has_contract_address(&self) -> bool { + !self.builder.is_pointer_field_null(7) + } + #[inline] + pub fn get_contract_address_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(8), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_contract_address_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(8).set_data(value); + } + #[inline] + pub fn init_contract_address_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(8).init_data(size) + } + #[inline] + pub fn has_contract_address_filter(&self) -> bool { + !self.builder.is_pointer_field_null(8) + } + #[inline] + pub fn get_hash(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(9), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_hash(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(9), + value, + false, + ) + } + #[inline] + pub fn init_hash(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(9), + size, + ) + } + #[inline] + pub fn has_hash(&self) -> bool { + !self.builder.is_pointer_field_null(9) + } + #[inline] + pub fn get_authorization_list( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::authorization_selection::Owned, + >, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(10), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_authorization_list( + &mut self, + value: ::capnp::struct_list::Reader< + '_, + crate::hypersync_net_types_capnp::authorization_selection::Owned, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(10), + value, + false, + ) + } + #[inline] + pub fn init_authorization_list( + self, + size: u32, + ) -> ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::authorization_selection::Owned, + > { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(10), + size, + ) + } + #[inline] + pub fn has_authorization_list(&self) -> bool { + !self.builder.is_pointer_field_null(10) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline { + pub fn get_status(&self) -> crate::hypersync_net_types_capnp::opt_u_int8::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(5)) + } + } + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 220] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(56, 147, 107, 206, 187, 26, 251, 190), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(11, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 98, 1, 0, 0), + ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 0, 0, 0, 111, 2, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 84, 114, 97, 110, 115, 97), + ::capnp::word(99, 116, 105, 111, 110, 70, 105, 108), + ::capnp::word(116, 101, 114, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(44, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(32, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(60, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(57, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(56, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(68, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(65, 1, 0, 0, 26, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(60, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(88, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(85, 1, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(84, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(96, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(93, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(88, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(116, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(5, 0, 0, 0, 5, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(113, 1, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(120, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(6, 0, 0, 0, 6, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(117, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(112, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(140, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(7, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(137, 1, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(136, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(164, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 8, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(161, 1, 0, 0, 178, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(164, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(176, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(9, 0, 0, 0, 9, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 9, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(173, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(168, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(196, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(10, 0, 0, 0, 10, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 10, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(193, 1, 0, 0, 146, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(196, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(224, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(102, 114, 111, 109, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(102, 114, 111, 109, 70, 105, 108, 116), + ::capnp::word(101, 114, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 70, 105, 108, 116, 101, 114), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 105, 103, 104, 97, 115, 104, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 116, 97, 116, 117, 115, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(50, 179, 230, 200, 42, 167, 255, 167), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(99, 111, 110, 116, 114, 97, 99, 116), + ::capnp::word(65, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(99, 111, 110, 116, 114, 97, 99, 116), + ::capnp::word(65, 100, 100, 114, 101, 115, 115, 70), + ::capnp::word(105, 108, 116, 101, 114, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 97, 115, 104, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 117, 116, 104, 111, 114, 105, 122), + ::capnp::word(97, 116, 105, 111, 110, 76, 105, 115), + ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(141, 105, 202, 172, 115, 150, 48, 135), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 2 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 3 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 4 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 5 => ::introspect(), + 6 => <::capnp::primitive_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 7 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 8 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 9 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 10 => <::capnp::struct_list::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[10, 7, 8, 0, 1, 9, 4, 5, 2, 3, 6]; + pub const TYPE_ID: u64 = 0xbefb_1abb_ce6b_9338; + } +} + +pub mod trace_filter { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_from(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_from(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_from_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_from_filter(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + #[inline] + pub fn get_to(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_to(&self) -> bool { + !self.reader.get_pointer_field(2).is_null() + } + #[inline] + pub fn get_to_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_to_filter(&self) -> bool { + !self.reader.get_pointer_field(3).is_null() + } + #[inline] + pub fn get_address(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(4), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_address(&self) -> bool { + !self.reader.get_pointer_field(4).is_null() + } + #[inline] + pub fn get_address_filter(self) -> ::capnp::Result<::capnp::data::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(5), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_address_filter(&self) -> bool { + !self.reader.get_pointer_field(5).is_null() + } + #[inline] + pub fn get_call_type(self) -> ::capnp::Result<::capnp::text_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(6), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_call_type(&self) -> bool { + !self.reader.get_pointer_field(6).is_null() + } + #[inline] + pub fn get_reward_type(self) -> ::capnp::Result<::capnp::text_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(7), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_reward_type(&self) -> bool { + !self.reader.get_pointer_field(7).is_null() + } + #[inline] + pub fn get_type(self) -> ::capnp::Result<::capnp::text_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(8), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_type(&self) -> bool { + !self.reader.get_pointer_field(8).is_null() + } + #[inline] + pub fn get_sighash(self) -> ::capnp::Result<::capnp::data_list::Reader<'a>> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(9), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_sighash(&self) -> bool { + !self.reader.get_pointer_field(9).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 10, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_from(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_from(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_from(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_from(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_from_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_from_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(1).set_data(value); + } + #[inline] + pub fn init_from_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(1).init_data(size) + } + #[inline] + pub fn has_from_filter(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + #[inline] + pub fn get_to(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_to(&mut self, value: ::capnp::data_list::Reader<'_>) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(2), + value, + false, + ) + } + #[inline] + pub fn init_to(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(2), + size, + ) + } + #[inline] + pub fn has_to(&self) -> bool { + !self.builder.is_pointer_field_null(2) + } + #[inline] + pub fn get_to_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_to_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(3).set_data(value); + } + #[inline] + pub fn init_to_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(3).init_data(size) + } + #[inline] + pub fn has_to_filter(&self) -> bool { + !self.builder.is_pointer_field_null(3) + } + #[inline] + pub fn get_address(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(4), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_address( + &mut self, + value: ::capnp::data_list::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(4), + value, + false, + ) + } + #[inline] + pub fn init_address(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(4), + size, + ) + } + #[inline] + pub fn has_address(&self) -> bool { + !self.builder.is_pointer_field_null(4) + } + #[inline] + pub fn get_address_filter(self) -> ::capnp::Result<::capnp::data::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(5), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_address_filter(&mut self, value: ::capnp::data::Reader<'_>) { + self.builder.reborrow().get_pointer_field(5).set_data(value); + } + #[inline] + pub fn init_address_filter(self, size: u32) -> ::capnp::data::Builder<'a> { + self.builder.get_pointer_field(5).init_data(size) + } + #[inline] + pub fn has_address_filter(&self) -> bool { + !self.builder.is_pointer_field_null(5) + } + #[inline] + pub fn get_call_type(self) -> ::capnp::Result<::capnp::text_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(6), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_call_type( + &mut self, + value: impl ::capnp::traits::SetterInput<::capnp::text_list::Owned>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(6), + value, + false, + ) + } + #[inline] + pub fn init_call_type(self, size: u32) -> ::capnp::text_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(6), + size, + ) + } + #[inline] + pub fn has_call_type(&self) -> bool { + !self.builder.is_pointer_field_null(6) + } + #[inline] + pub fn get_reward_type(self) -> ::capnp::Result<::capnp::text_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(7), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_reward_type( + &mut self, + value: impl ::capnp::traits::SetterInput<::capnp::text_list::Owned>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(7), + value, + false, + ) + } + #[inline] + pub fn init_reward_type(self, size: u32) -> ::capnp::text_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(7), + size, + ) + } + #[inline] + pub fn has_reward_type(&self) -> bool { + !self.builder.is_pointer_field_null(7) + } + #[inline] + pub fn get_type(self) -> ::capnp::Result<::capnp::text_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(8), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_type( + &mut self, + value: impl ::capnp::traits::SetterInput<::capnp::text_list::Owned>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(8), + value, + false, + ) + } + #[inline] + pub fn init_type(self, size: u32) -> ::capnp::text_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(8), + size, + ) + } + #[inline] + pub fn has_type(&self) -> bool { + !self.builder.is_pointer_field_null(8) + } + #[inline] + pub fn get_sighash(self) -> ::capnp::Result<::capnp::data_list::Builder<'a>> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(9), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_sighash( + &mut self, + value: ::capnp::data_list::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(9), + value, + false, + ) + } + #[inline] + pub fn init_sighash(self, size: u32) -> ::capnp::data_list::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(9), + size, + ) + } + #[inline] + pub fn has_sighash(&self) -> bool { + !self.builder.is_pointer_field_null(9) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 202] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(197, 194, 61, 54, 113, 80, 134, 163), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(10, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 50, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 55, 2, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 84, 114, 97, 99, 101, 70), + ::capnp::word(105, 108, 116, 101, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(40, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(4, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(32, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(28, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(40, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 1, 0, 0, 26, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(32, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(60, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(57, 1, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(56, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(68, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(65, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(60, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(88, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(5, 0, 0, 0, 5, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(85, 1, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(84, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(96, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(6, 0, 0, 0, 6, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(93, 1, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(92, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(120, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(7, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(117, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(144, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 8, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(141, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(136, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(164, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(9, 0, 0, 0, 9, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 9, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(161, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(156, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(184, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(102, 114, 111, 109, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(102, 114, 111, 109, 70, 105, 108, 116), + ::capnp::word(101, 114, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 70, 105, 108, 116, 101, 114), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 70), + ::capnp::word(105, 108, 116, 101, 114, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(99, 97, 108, 108, 84, 121, 112, 101), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(114, 101, 119, 97, 114, 100, 84, 121), + ::capnp::word(112, 101, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 105, 103, 104, 97, 115, 104, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 2 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 3 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 4 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 5 => <::capnp::data::Owned as ::capnp::introspect::Introspect>::introspect(), + 6 => <::capnp::text_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 7 => <::capnp::text_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 8 => <::capnp::text_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 9 => <::capnp::data_list::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[4, 5, 6, 0, 1, 7, 9, 2, 3, 8]; + pub const TYPE_ID: u64 = 0xa386_5071_363d_c2c5; + } +} + +pub mod field_selection { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_block( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Reader<'a, crate::hypersync_net_types_capnp::BlockField>, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_block(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_transaction( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Reader<'a, crate::hypersync_net_types_capnp::TransactionField>, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_transaction(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + #[inline] + pub fn get_log( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Reader<'a, crate::hypersync_net_types_capnp::LogField>, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_log(&self) -> bool { + !self.reader.get_pointer_field(2).is_null() + } + #[inline] + pub fn get_trace( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Reader<'a, crate::hypersync_net_types_capnp::TraceField>, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_trace(&self) -> bool { + !self.reader.get_pointer_field(3).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 4, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_block( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::BlockField>, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_block( + &mut self, + value: impl ::capnp::traits::SetterInput< + ::capnp::enum_list::Owned, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_block( + self, + size: u32, + ) -> ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::BlockField> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_block(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_transaction( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::TransactionField>, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_transaction( + &mut self, + value: impl ::capnp::traits::SetterInput< + ::capnp::enum_list::Owned, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_transaction( + self, + size: u32, + ) -> ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::TransactionField> + { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(1), + size, + ) + } + #[inline] + pub fn has_transaction(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + #[inline] + pub fn get_log( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::LogField>, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_log( + &mut self, + value: impl ::capnp::traits::SetterInput< + ::capnp::enum_list::Owned, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(2), + value, + false, + ) + } + #[inline] + pub fn init_log( + self, + size: u32, + ) -> ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::LogField> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(2), + size, + ) + } + #[inline] + pub fn has_log(&self) -> bool { + !self.builder.is_pointer_field_null(2) + } + #[inline] + pub fn get_trace( + self, + ) -> ::capnp::Result< + ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::TraceField>, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_trace( + &mut self, + value: impl ::capnp::traits::SetterInput< + ::capnp::enum_list::Owned, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(3), + value, + false, + ) + } + #[inline] + pub fn init_trace( + self, + size: u32, + ) -> ::capnp::enum_list::Builder<'a, crate::hypersync_net_types_capnp::TraceField> { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(3), + size, + ) + } + #[inline] + pub fn has_trace(&self) -> bool { + !self.builder.is_pointer_field_null(3) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 97] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(110, 171, 199, 124, 78, 87, 136, 142), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(4, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 74, 1, 0, 0), + ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 0, 0, 0, 231, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 70, 105, 101, 108, 100, 83), + ::capnp::word(101, 108, 101, 99, 116, 105, 111, 110), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(92, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(120, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(117, 0, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(144, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(141, 0, 0, 0, 34, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(136, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(164, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(161, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(156, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(184, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(98, 108, 111, 99, 107, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(44, 73, 100, 85, 82, 180, 224, 175), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(215, 33, 250, 108, 138, 203, 230, 193), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 111, 103, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(121, 202, 210, 192, 206, 135, 165, 144), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 99, 101, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(209, 77, 68, 9, 111, 56, 227, 220), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => <::capnp::enum_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 1 => <::capnp::enum_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 2 => <::capnp::enum_list::Owned as ::capnp::introspect::Introspect>::introspect(), + 3 => <::capnp::enum_list::Owned as ::capnp::introspect::Introspect>::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 2, 3, 1]; + pub const TYPE_ID: u64 = 0x8e88_574e_7cc7_ab6e; + } +} + +#[repr(u16)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum JoinMode { + Default = 0, + JoinAll = 1, + JoinNothing = 2, +} + +impl ::capnp::introspect::Introspect for JoinMode { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { + encoded_node: &join_mode::ENCODED_NODE, + annotation_types: join_mode::get_annotation_types, + }) + .into() + } +} +impl ::core::convert::From for ::capnp::dynamic_value::Reader<'_> { + fn from(e: JoinMode) -> Self { + ::capnp::dynamic_value::Enum::new( + e.into(), + ::capnp::introspect::RawEnumSchema { + encoded_node: &join_mode::ENCODED_NODE, + annotation_types: join_mode::get_annotation_types, + } + .into(), + ) + .into() + } +} +impl ::core::convert::TryFrom for JoinMode { + type Error = ::capnp::NotInSchema; + fn try_from( + value: u16, + ) -> ::core::result::Result>::Error> { + match value { + 0 => ::core::result::Result::Ok(Self::Default), + 1 => ::core::result::Result::Ok(Self::JoinAll), + 2 => ::core::result::Result::Ok(Self::JoinNothing), + n => ::core::result::Result::Err(::capnp::NotInSchema(n)), + } + } +} +impl From for u16 { + #[inline] + fn from(x: JoinMode) -> u16 { + x as u16 + } +} +impl ::capnp::traits::HasTypeId for JoinMode { + const TYPE_ID: u64 = 0x814f_2ba3_6715_2ce1u64; +} +mod join_mode { + pub static ENCODED_NODE: [::capnp::Word; 32] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(225, 44, 21, 103, 163, 43, 79, 129), + ::capnp::word(26, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 26, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 79, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 74, 111, 105, 110, 77, 111), + ::capnp::word(100, 101, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(12, 0, 0, 0, 1, 0, 2, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(100, 101, 102, 97, 117, 108, 116, 0), + ::capnp::word(106, 111, 105, 110, 65, 108, 108, 0), + ::capnp::word(106, 111, 105, 110, 78, 111, 116, 104), + ::capnp::word(105, 110, 103, 0, 0, 0, 0, 0), + ]; + pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } +} + +#[repr(u16)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum BlockField { + Number = 0, + Hash = 1, + ParentHash = 2, + Sha3Uncles = 3, + LogsBloom = 4, + TransactionsRoot = 5, + StateRoot = 6, + ReceiptsRoot = 7, + Miner = 8, + ExtraData = 9, + Size = 10, + GasLimit = 11, + GasUsed = 12, + Timestamp = 13, + MixHash = 14, + Nonce = 15, + Difficulty = 16, + TotalDifficulty = 17, + Uncles = 18, + BaseFeePerGas = 19, + BlobGasUsed = 20, + ExcessBlobGas = 21, + ParentBeaconBlockRoot = 22, + WithdrawalsRoot = 23, + Withdrawals = 24, + L1BlockNumber = 25, + SendCount = 26, + SendRoot = 27, +} + +impl ::capnp::introspect::Introspect for BlockField { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { + encoded_node: &block_field::ENCODED_NODE, + annotation_types: block_field::get_annotation_types, + }) + .into() + } +} +impl ::core::convert::From for ::capnp::dynamic_value::Reader<'_> { + fn from(e: BlockField) -> Self { + ::capnp::dynamic_value::Enum::new( + e.into(), + ::capnp::introspect::RawEnumSchema { + encoded_node: &block_field::ENCODED_NODE, + annotation_types: block_field::get_annotation_types, + } + .into(), + ) + .into() + } +} +impl ::core::convert::TryFrom for BlockField { + type Error = ::capnp::NotInSchema; + fn try_from( + value: u16, + ) -> ::core::result::Result>::Error> { + match value { + 0 => ::core::result::Result::Ok(Self::Number), + 1 => ::core::result::Result::Ok(Self::Hash), + 2 => ::core::result::Result::Ok(Self::ParentHash), + 3 => ::core::result::Result::Ok(Self::Sha3Uncles), + 4 => ::core::result::Result::Ok(Self::LogsBloom), + 5 => ::core::result::Result::Ok(Self::TransactionsRoot), + 6 => ::core::result::Result::Ok(Self::StateRoot), + 7 => ::core::result::Result::Ok(Self::ReceiptsRoot), + 8 => ::core::result::Result::Ok(Self::Miner), + 9 => ::core::result::Result::Ok(Self::ExtraData), + 10 => ::core::result::Result::Ok(Self::Size), + 11 => ::core::result::Result::Ok(Self::GasLimit), + 12 => ::core::result::Result::Ok(Self::GasUsed), + 13 => ::core::result::Result::Ok(Self::Timestamp), + 14 => ::core::result::Result::Ok(Self::MixHash), + 15 => ::core::result::Result::Ok(Self::Nonce), + 16 => ::core::result::Result::Ok(Self::Difficulty), + 17 => ::core::result::Result::Ok(Self::TotalDifficulty), + 18 => ::core::result::Result::Ok(Self::Uncles), + 19 => ::core::result::Result::Ok(Self::BaseFeePerGas), + 20 => ::core::result::Result::Ok(Self::BlobGasUsed), + 21 => ::core::result::Result::Ok(Self::ExcessBlobGas), + 22 => ::core::result::Result::Ok(Self::ParentBeaconBlockRoot), + 23 => ::core::result::Result::Ok(Self::WithdrawalsRoot), + 24 => ::core::result::Result::Ok(Self::Withdrawals), + 25 => ::core::result::Result::Ok(Self::L1BlockNumber), + 26 => ::core::result::Result::Ok(Self::SendCount), + 27 => ::core::result::Result::Ok(Self::SendRoot), + n => ::core::result::Result::Err(::capnp::NotInSchema(n)), + } + } +} +impl From for u16 { + #[inline] + fn from(x: BlockField) -> u16 { + x as u16 + } +} +impl ::capnp::traits::HasTypeId for BlockField { + const TYPE_ID: u64 = 0xafe0_b452_5564_492cu64; +} +mod block_field { + pub static ENCODED_NODE: [::capnp::Word; 153] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(44, 73, 100, 85, 82, 180, 224, 175), + ::capnp::word(26, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 42, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 167, 2, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 66, 108, 111, 99, 107, 70), + ::capnp::word(105, 101, 108, 100, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(112, 0, 0, 0, 1, 0, 2, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(73, 1, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(65, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(57, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(53, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(49, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(45, 1, 0, 0, 138, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(45, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 1, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 1, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(25, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(11, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(17, 1, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(249, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(241, 0, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(17, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(237, 0, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(233, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(19, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(225, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(20, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(221, 0, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(217, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(22, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(213, 0, 0, 0, 178, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(23, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(213, 0, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(24, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(209, 0, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(25, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(205, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(26, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(201, 0, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(27, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(197, 0, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(110, 117, 109, 98, 101, 114, 0, 0), + ::capnp::word(104, 97, 115, 104, 0, 0, 0, 0), + ::capnp::word(112, 97, 114, 101, 110, 116, 72, 97), + ::capnp::word(115, 104, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 104, 97, 51, 85, 110, 99, 108), + ::capnp::word(101, 115, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 111, 103, 115, 66, 108, 111, 111), + ::capnp::word(109, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 115, 82, 111, 111, 116), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 116, 97, 116, 101, 82, 111, 111), + ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(114, 101, 99, 101, 105, 112, 116, 115), + ::capnp::word(82, 111, 111, 116, 0, 0, 0, 0), + ::capnp::word(109, 105, 110, 101, 114, 0, 0, 0), + ::capnp::word(101, 120, 116, 114, 97, 68, 97, 116), + ::capnp::word(97, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 105, 122, 101, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 76, 105, 109, 105, 116), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 85, 115, 101, 100, 0), + ::capnp::word(116, 105, 109, 101, 115, 116, 97, 109), + ::capnp::word(112, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 105, 120, 72, 97, 115, 104, 0), + ::capnp::word(110, 111, 110, 99, 101, 0, 0, 0), + ::capnp::word(100, 105, 102, 102, 105, 99, 117, 108), + ::capnp::word(116, 121, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 116, 97, 108, 68, 105, 102), + ::capnp::word(102, 105, 99, 117, 108, 116, 121, 0), + ::capnp::word(117, 110, 99, 108, 101, 115, 0, 0), + ::capnp::word(98, 97, 115, 101, 70, 101, 101, 80), + ::capnp::word(101, 114, 71, 97, 115, 0, 0, 0), + ::capnp::word(98, 108, 111, 98, 71, 97, 115, 85), + ::capnp::word(115, 101, 100, 0, 0, 0, 0, 0), + ::capnp::word(101, 120, 99, 101, 115, 115, 66, 108), + ::capnp::word(111, 98, 71, 97, 115, 0, 0, 0), + ::capnp::word(112, 97, 114, 101, 110, 116, 66, 101), + ::capnp::word(97, 99, 111, 110, 66, 108, 111, 99), + ::capnp::word(107, 82, 111, 111, 116, 0, 0, 0), + ::capnp::word(119, 105, 116, 104, 100, 114, 97, 119), + ::capnp::word(97, 108, 115, 82, 111, 111, 116, 0), + ::capnp::word(119, 105, 116, 104, 100, 114, 97, 119), + ::capnp::word(97, 108, 115, 0, 0, 0, 0, 0), + ::capnp::word(108, 49, 66, 108, 111, 99, 107, 78), + ::capnp::word(117, 109, 98, 101, 114, 0, 0, 0), + ::capnp::word(115, 101, 110, 100, 67, 111, 117, 110), + ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 101, 110, 100, 82, 111, 111, 116), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } +} + +#[repr(u16)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TransactionField { + BlockHash = 0, + BlockNumber = 1, + Gas = 2, + Hash = 3, + Input = 4, + Nonce = 5, + TransactionIndex = 6, + Value = 7, + CumulativeGasUsed = 8, + EffectiveGasPrice = 9, + GasUsed = 10, + LogsBloom = 11, + From = 12, + GasPrice = 13, + To = 14, + V = 15, + R = 16, + S = 17, + MaxPriorityFeePerGas = 18, + MaxFeePerGas = 19, + ChainId = 20, + ContractAddress = 21, + Type = 22, + Root = 23, + Status = 24, + YParity = 25, + AccessList = 26, + AuthorizationList = 27, + L1Fee = 28, + L1GasPrice = 29, + L1GasUsed = 30, + L1FeeScalar = 31, + GasUsedForL1 = 32, + MaxFeePerBlobGas = 33, + BlobVersionedHashes = 34, + BlobGasPrice = 35, + BlobGasUsed = 36, + DepositNonce = 37, + DepositReceiptVersion = 38, + L1BaseFeeScalar = 39, + L1BlobBaseFee = 40, + L1BlobBaseFeeScalar = 41, + L1BlockNumber = 42, + Mint = 43, + Sighash = 44, + SourceHash = 45, +} + +impl ::capnp::introspect::Introspect for TransactionField { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { + encoded_node: &transaction_field::ENCODED_NODE, + annotation_types: transaction_field::get_annotation_types, + }) + .into() + } +} +impl ::core::convert::From for ::capnp::dynamic_value::Reader<'_> { + fn from(e: TransactionField) -> Self { + ::capnp::dynamic_value::Enum::new( + e.into(), + ::capnp::introspect::RawEnumSchema { + encoded_node: &transaction_field::ENCODED_NODE, + annotation_types: transaction_field::get_annotation_types, + } + .into(), + ) + .into() + } +} +impl ::core::convert::TryFrom for TransactionField { + type Error = ::capnp::NotInSchema; + fn try_from( + value: u16, + ) -> ::core::result::Result>::Error> + { + match value { + 0 => ::core::result::Result::Ok(Self::BlockHash), + 1 => ::core::result::Result::Ok(Self::BlockNumber), + 2 => ::core::result::Result::Ok(Self::Gas), + 3 => ::core::result::Result::Ok(Self::Hash), + 4 => ::core::result::Result::Ok(Self::Input), + 5 => ::core::result::Result::Ok(Self::Nonce), + 6 => ::core::result::Result::Ok(Self::TransactionIndex), + 7 => ::core::result::Result::Ok(Self::Value), + 8 => ::core::result::Result::Ok(Self::CumulativeGasUsed), + 9 => ::core::result::Result::Ok(Self::EffectiveGasPrice), + 10 => ::core::result::Result::Ok(Self::GasUsed), + 11 => ::core::result::Result::Ok(Self::LogsBloom), + 12 => ::core::result::Result::Ok(Self::From), + 13 => ::core::result::Result::Ok(Self::GasPrice), + 14 => ::core::result::Result::Ok(Self::To), + 15 => ::core::result::Result::Ok(Self::V), + 16 => ::core::result::Result::Ok(Self::R), + 17 => ::core::result::Result::Ok(Self::S), + 18 => ::core::result::Result::Ok(Self::MaxPriorityFeePerGas), + 19 => ::core::result::Result::Ok(Self::MaxFeePerGas), + 20 => ::core::result::Result::Ok(Self::ChainId), + 21 => ::core::result::Result::Ok(Self::ContractAddress), + 22 => ::core::result::Result::Ok(Self::Type), + 23 => ::core::result::Result::Ok(Self::Root), + 24 => ::core::result::Result::Ok(Self::Status), + 25 => ::core::result::Result::Ok(Self::YParity), + 26 => ::core::result::Result::Ok(Self::AccessList), + 27 => ::core::result::Result::Ok(Self::AuthorizationList), + 28 => ::core::result::Result::Ok(Self::L1Fee), + 29 => ::core::result::Result::Ok(Self::L1GasPrice), + 30 => ::core::result::Result::Ok(Self::L1GasUsed), + 31 => ::core::result::Result::Ok(Self::L1FeeScalar), + 32 => ::core::result::Result::Ok(Self::GasUsedForL1), + 33 => ::core::result::Result::Ok(Self::MaxFeePerBlobGas), + 34 => ::core::result::Result::Ok(Self::BlobVersionedHashes), + 35 => ::core::result::Result::Ok(Self::BlobGasPrice), + 36 => ::core::result::Result::Ok(Self::BlobGasUsed), + 37 => ::core::result::Result::Ok(Self::DepositNonce), + 38 => ::core::result::Result::Ok(Self::DepositReceiptVersion), + 39 => ::core::result::Result::Ok(Self::L1BaseFeeScalar), + 40 => ::core::result::Result::Ok(Self::L1BlobBaseFee), + 41 => ::core::result::Result::Ok(Self::L1BlobBaseFeeScalar), + 42 => ::core::result::Result::Ok(Self::L1BlockNumber), + 43 => ::core::result::Result::Ok(Self::Mint), + 44 => ::core::result::Result::Ok(Self::Sighash), + 45 => ::core::result::Result::Ok(Self::SourceHash), + n => ::core::result::Result::Err(::capnp::NotInSchema(n)), + } + } +} +impl From for u16 { + #[inline] + fn from(x: TransactionField) -> u16 { + x as u16 + } +} +impl ::capnp::traits::HasTypeId for TransactionField { + const TYPE_ID: u64 = 0xc1e6_cb8a_6cfa_21d7u64; +} +mod transaction_field { + pub static ENCODED_NODE: [::capnp::Word; 240] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(215, 33, 250, 108, 138, 203, 230, 193), + ::capnp::word(26, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 90, 1, 0, 0), + ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 0, 0, 0, 87, 4, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 84, 114, 97, 110, 115, 97), + ::capnp::word(99, 116, 105, 111, 110, 70, 105, 101), + ::capnp::word(108, 100, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(184, 0, 0, 0, 1, 0, 2, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 2, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 2, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(25, 2, 0, 0, 34, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(17, 2, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 2, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 2, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(249, 1, 0, 0, 138, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(249, 1, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(241, 1, 0, 0, 146, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(241, 1, 0, 0, 146, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(241, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(11, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(233, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(229, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(221, 1, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(217, 1, 0, 0, 26, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(209, 1, 0, 0, 18, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(201, 1, 0, 0, 18, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(17, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(193, 1, 0, 0, 18, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(185, 1, 0, 0, 170, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(19, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(185, 1, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(20, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(181, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(173, 1, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(22, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(169, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(23, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(161, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(24, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(153, 1, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(25, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(26, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(137, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(27, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(133, 1, 0, 0, 146, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(28, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(133, 1, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(125, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(30, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(121, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(31, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(117, 1, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(32, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(113, 1, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 1, 0, 0, 138, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(34, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 1, 0, 0, 162, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(35, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 1, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(36, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(105, 1, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(101, 1, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(38, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 1, 0, 0, 178, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(39, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 1, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(40, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(93, 1, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(89, 1, 0, 0, 162, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(42, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(89, 1, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(43, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(85, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(44, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(77, 1, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(45, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(69, 1, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 99, 107, 72, 97, 115), + ::capnp::word(104, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 99, 107, 78, 117, 109), + ::capnp::word(98, 101, 114, 0, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 0, 0, 0, 0, 0), + ::capnp::word(104, 97, 115, 104, 0, 0, 0, 0), + ::capnp::word(105, 110, 112, 117, 116, 0, 0, 0), + ::capnp::word(110, 111, 110, 99, 101, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 73, 110, 100, 101, 120), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(118, 97, 108, 117, 101, 0, 0, 0), + ::capnp::word(99, 117, 109, 117, 108, 97, 116, 105), + ::capnp::word(118, 101, 71, 97, 115, 85, 115, 101), + ::capnp::word(100, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(101, 102, 102, 101, 99, 116, 105, 118), + ::capnp::word(101, 71, 97, 115, 80, 114, 105, 99), + ::capnp::word(101, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 85, 115, 101, 100, 0), + ::capnp::word(108, 111, 103, 115, 66, 108, 111, 111), + ::capnp::word(109, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(102, 114, 111, 109, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 80, 114, 105, 99, 101), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 0, 0, 0, 0, 0, 0), + ::capnp::word(118, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(114, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 80, 114, 105, 111, 114), + ::capnp::word(105, 116, 121, 70, 101, 101, 80, 101), + ::capnp::word(114, 71, 97, 115, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 70, 101, 101, 80, 101), + ::capnp::word(114, 71, 97, 115, 0, 0, 0, 0), + ::capnp::word(99, 104, 97, 105, 110, 73, 100, 0), + ::capnp::word(99, 111, 110, 116, 114, 97, 99, 116), + ::capnp::word(65, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), + ::capnp::word(114, 111, 111, 116, 0, 0, 0, 0), + ::capnp::word(115, 116, 97, 116, 117, 115, 0, 0), + ::capnp::word(121, 80, 97, 114, 105, 116, 121, 0), + ::capnp::word(97, 99, 99, 101, 115, 115, 76, 105), + ::capnp::word(115, 116, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 117, 116, 104, 111, 114, 105, 122), + ::capnp::word(97, 116, 105, 111, 110, 76, 105, 115), + ::capnp::word(116, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 49, 70, 101, 101, 0, 0, 0), + ::capnp::word(108, 49, 71, 97, 115, 80, 114, 105), + ::capnp::word(99, 101, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 49, 71, 97, 115, 85, 115, 101), + ::capnp::word(100, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 49, 70, 101, 101, 83, 99, 97), + ::capnp::word(108, 97, 114, 0, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 85, 115, 101, 100, 70), + ::capnp::word(111, 114, 76, 49, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 70, 101, 101, 80, 101), + ::capnp::word(114, 66, 108, 111, 98, 71, 97, 115), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 98, 86, 101, 114, 115), + ::capnp::word(105, 111, 110, 101, 100, 72, 97, 115), + ::capnp::word(104, 101, 115, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 98, 71, 97, 115, 80), + ::capnp::word(114, 105, 99, 101, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 98, 71, 97, 115, 85), + ::capnp::word(115, 101, 100, 0, 0, 0, 0, 0), + ::capnp::word(100, 101, 112, 111, 115, 105, 116, 78), + ::capnp::word(111, 110, 99, 101, 0, 0, 0, 0), + ::capnp::word(100, 101, 112, 111, 115, 105, 116, 82), + ::capnp::word(101, 99, 101, 105, 112, 116, 86, 101), + ::capnp::word(114, 115, 105, 111, 110, 0, 0, 0), + ::capnp::word(108, 49, 66, 97, 115, 101, 70, 101), + ::capnp::word(101, 83, 99, 97, 108, 97, 114, 0), + ::capnp::word(108, 49, 66, 108, 111, 98, 66, 97), + ::capnp::word(115, 101, 70, 101, 101, 0, 0, 0), + ::capnp::word(108, 49, 66, 108, 111, 98, 66, 97), + ::capnp::word(115, 101, 70, 101, 101, 83, 99, 97), + ::capnp::word(108, 97, 114, 0, 0, 0, 0, 0), + ::capnp::word(108, 49, 66, 108, 111, 99, 107, 78), + ::capnp::word(117, 109, 98, 101, 114, 0, 0, 0), + ::capnp::word(109, 105, 110, 116, 0, 0, 0, 0), + ::capnp::word(115, 105, 103, 104, 97, 115, 104, 0), + ::capnp::word(115, 111, 117, 114, 99, 101, 72, 97), + ::capnp::word(115, 104, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } +} + +#[repr(u16)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum LogField { + TransactionHash = 0, + BlockHash = 1, + BlockNumber = 2, + TransactionIndex = 3, + LogIndex = 4, + Address = 5, + Data = 6, + Removed = 7, + Topic0 = 8, + Topic1 = 9, + Topic2 = 10, + Topic3 = 11, +} + +impl ::capnp::introspect::Introspect for LogField { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { + encoded_node: &log_field::ENCODED_NODE, + annotation_types: log_field::get_annotation_types, + }) + .into() + } +} +impl ::core::convert::From for ::capnp::dynamic_value::Reader<'_> { + fn from(e: LogField) -> Self { + ::capnp::dynamic_value::Enum::new( + e.into(), + ::capnp::introspect::RawEnumSchema { + encoded_node: &log_field::ENCODED_NODE, + annotation_types: log_field::get_annotation_types, + } + .into(), + ) + .into() + } +} +impl ::core::convert::TryFrom for LogField { + type Error = ::capnp::NotInSchema; + fn try_from( + value: u16, + ) -> ::core::result::Result>::Error> { + match value { + 0 => ::core::result::Result::Ok(Self::TransactionHash), + 1 => ::core::result::Result::Ok(Self::BlockHash), + 2 => ::core::result::Result::Ok(Self::BlockNumber), + 3 => ::core::result::Result::Ok(Self::TransactionIndex), + 4 => ::core::result::Result::Ok(Self::LogIndex), + 5 => ::core::result::Result::Ok(Self::Address), + 6 => ::core::result::Result::Ok(Self::Data), + 7 => ::core::result::Result::Ok(Self::Removed), + 8 => ::core::result::Result::Ok(Self::Topic0), + 9 => ::core::result::Result::Ok(Self::Topic1), + 10 => ::core::result::Result::Ok(Self::Topic2), + 11 => ::core::result::Result::Ok(Self::Topic3), + n => ::core::result::Result::Err(::capnp::NotInSchema(n)), + } + } +} +impl From for u16 { + #[inline] + fn from(x: LogField) -> u16 { + x as u16 + } +} +impl ::capnp::traits::HasTypeId for LogField { + const TYPE_ID: u64 = 0x90a5_87ce_c0d2_ca79u64; +} +mod log_field { + pub static ENCODED_NODE: [::capnp::Word; 73] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(121, 202, 210, 192, 206, 135, 165, 144), + ::capnp::word(26, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 26, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 39, 1, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 76, 111, 103, 70, 105, 101), + ::capnp::word(108, 100, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(48, 0, 0, 0, 1, 0, 2, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(137, 0, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(133, 0, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(129, 0, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(125, 0, 0, 0, 138, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(125, 0, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(121, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(113, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(105, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(89, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(81, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(11, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(73, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 72, 97, 115, 104, 0), + ::capnp::word(98, 108, 111, 99, 107, 72, 97, 115), + ::capnp::word(104, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 99, 107, 78, 117, 109), + ::capnp::word(98, 101, 114, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 73, 110, 100, 101, 120), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 111, 103, 73, 110, 100, 101, 120), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(100, 97, 116, 97, 0, 0, 0, 0), + ::capnp::word(114, 101, 109, 111, 118, 101, 100, 0), + ::capnp::word(116, 111, 112, 105, 99, 48, 0, 0), + ::capnp::word(116, 111, 112, 105, 99, 49, 0, 0), + ::capnp::word(116, 111, 112, 105, 99, 50, 0, 0), + ::capnp::word(116, 111, 112, 105, 99, 51, 0, 0), + ]; + pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } +} + +#[repr(u16)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum TraceField { + TransactionHash = 0, + BlockHash = 1, + BlockNumber = 2, + TransactionPosition = 3, + Type = 4, + Error = 5, + From = 6, + To = 7, + Author = 8, + Gas = 9, + GasUsed = 10, + ActionAddress = 11, + Address = 12, + Balance = 13, + CallType = 14, + Code = 15, + Init = 16, + Input = 17, + Output = 18, + RefundAddress = 19, + RewardType = 20, + Sighash = 21, + Subtraces = 22, + TraceAddress = 23, + Value = 24, +} + +impl ::capnp::introspect::Introspect for TraceField { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Enum(::capnp::introspect::RawEnumSchema { + encoded_node: &trace_field::ENCODED_NODE, + annotation_types: trace_field::get_annotation_types, + }) + .into() + } +} +impl ::core::convert::From for ::capnp::dynamic_value::Reader<'_> { + fn from(e: TraceField) -> Self { + ::capnp::dynamic_value::Enum::new( + e.into(), + ::capnp::introspect::RawEnumSchema { + encoded_node: &trace_field::ENCODED_NODE, + annotation_types: trace_field::get_annotation_types, + } + .into(), + ) + .into() + } +} +impl ::core::convert::TryFrom for TraceField { + type Error = ::capnp::NotInSchema; + fn try_from( + value: u16, + ) -> ::core::result::Result>::Error> { + match value { + 0 => ::core::result::Result::Ok(Self::TransactionHash), + 1 => ::core::result::Result::Ok(Self::BlockHash), + 2 => ::core::result::Result::Ok(Self::BlockNumber), + 3 => ::core::result::Result::Ok(Self::TransactionPosition), + 4 => ::core::result::Result::Ok(Self::Type), + 5 => ::core::result::Result::Ok(Self::Error), + 6 => ::core::result::Result::Ok(Self::From), + 7 => ::core::result::Result::Ok(Self::To), + 8 => ::core::result::Result::Ok(Self::Author), + 9 => ::core::result::Result::Ok(Self::Gas), + 10 => ::core::result::Result::Ok(Self::GasUsed), + 11 => ::core::result::Result::Ok(Self::ActionAddress), + 12 => ::core::result::Result::Ok(Self::Address), + 13 => ::core::result::Result::Ok(Self::Balance), + 14 => ::core::result::Result::Ok(Self::CallType), + 15 => ::core::result::Result::Ok(Self::Code), + 16 => ::core::result::Result::Ok(Self::Init), + 17 => ::core::result::Result::Ok(Self::Input), + 18 => ::core::result::Result::Ok(Self::Output), + 19 => ::core::result::Result::Ok(Self::RefundAddress), + 20 => ::core::result::Result::Ok(Self::RewardType), + 21 => ::core::result::Result::Ok(Self::Sighash), + 22 => ::core::result::Result::Ok(Self::Subtraces), + 23 => ::core::result::Result::Ok(Self::TraceAddress), + 24 => ::core::result::Result::Ok(Self::Value), + n => ::core::result::Result::Err(::capnp::NotInSchema(n)), + } + } +} +impl From for u16 { + #[inline] + fn from(x: TraceField) -> u16 { + x as u16 + } +} +impl ::capnp::traits::HasTypeId for TraceField { + const TYPE_ID: u64 = 0xdce3_386f_0944_4dd1u64; +} +mod trace_field { + pub static ENCODED_NODE: [::capnp::Word; 130] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(209, 77, 68, 9, 111, 56, 227, 220), + ::capnp::word(26, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 42, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 95, 2, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 84, 114, 97, 99, 101, 70), + ::capnp::word(105, 101, 108, 100, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(100, 0, 0, 0, 1, 0, 2, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 1, 0, 0, 130, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 1, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(2, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 1, 0, 0, 98, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(25, 1, 0, 0, 162, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(25, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(5, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(17, 1, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 1, 0, 0, 26, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(249, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(241, 0, 0, 0, 34, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(233, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(11, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(225, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(221, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(213, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(205, 0, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(201, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(193, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(17, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(185, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(18, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(177, 0, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(19, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(169, 0, 0, 0, 114, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(20, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(165, 0, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(161, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(22, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(153, 0, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(23, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(149, 0, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(24, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 72, 97, 115, 104, 0), + ::capnp::word(98, 108, 111, 99, 107, 72, 97, 115), + ::capnp::word(104, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 99, 107, 78, 117, 109), + ::capnp::word(98, 101, 114, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 80, 111, 115, 105, 116), + ::capnp::word(105, 111, 110, 0, 0, 0, 0, 0), + ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), + ::capnp::word(101, 114, 114, 111, 114, 0, 0, 0), + ::capnp::word(102, 114, 111, 109, 0, 0, 0, 0), + ::capnp::word(116, 111, 0, 0, 0, 0, 0, 0), + ::capnp::word(97, 117, 116, 104, 111, 114, 0, 0), + ::capnp::word(103, 97, 115, 0, 0, 0, 0, 0), + ::capnp::word(103, 97, 115, 85, 115, 101, 100, 0), + ::capnp::word(97, 99, 116, 105, 111, 110, 65, 100), + ::capnp::word(100, 114, 101, 115, 115, 0, 0, 0), + ::capnp::word(97, 100, 100, 114, 101, 115, 115, 0), + ::capnp::word(98, 97, 108, 97, 110, 99, 101, 0), + ::capnp::word(99, 97, 108, 108, 84, 121, 112, 101), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(99, 111, 100, 101, 0, 0, 0, 0), + ::capnp::word(105, 110, 105, 116, 0, 0, 0, 0), + ::capnp::word(105, 110, 112, 117, 116, 0, 0, 0), + ::capnp::word(111, 117, 116, 112, 117, 116, 0, 0), + ::capnp::word(114, 101, 102, 117, 110, 100, 65, 100), + ::capnp::word(100, 114, 101, 115, 115, 0, 0, 0), + ::capnp::word(114, 101, 119, 97, 114, 100, 84, 121), + ::capnp::word(112, 101, 0, 0, 0, 0, 0, 0), + ::capnp::word(115, 105, 103, 104, 97, 115, 104, 0), + ::capnp::word(115, 117, 98, 116, 114, 97, 99, 101), + ::capnp::word(115, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 99, 101, 65, 100, 100), + ::capnp::word(114, 101, 115, 115, 0, 0, 0, 0), + ::capnp::word(118, 97, 108, 117, 101, 0, 0, 0), + ]; + pub fn get_annotation_types(child_index: Option, index: u32) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } +} + +pub mod query_body { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_join_mode( + self, + ) -> ::core::result::Result + { + ::core::convert::TryInto::try_into(self.reader.get_data_field::(0)) + } + #[inline] + pub fn get_logs( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Reader< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::log_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_logs(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_transactions( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Reader< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::transaction_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_transactions(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + #[inline] + pub fn get_traces( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Reader< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::trace_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_traces(&self) -> bool { + !self.reader.get_pointer_field(2).is_null() + } + #[inline] + pub fn get_blocks( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Reader< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::block_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_blocks(&self) -> bool { + !self.reader.get_pointer_field(3).is_null() + } + #[inline] + pub fn get_include_all_blocks(self) -> bool { + self.reader.get_bool_field(16) + } + #[inline] + pub fn get_field_selection( + self, + ) -> ::capnp::Result> + { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(4), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_field_selection(&self) -> bool { + !self.reader.get_pointer_field(4).is_null() + } + #[inline] + pub fn get_max_num_blocks( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(5), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_max_num_blocks(&self) -> bool { + !self.reader.get_pointer_field(5).is_null() + } + #[inline] + pub fn get_max_num_transactions( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(6), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_max_num_transactions(&self) -> bool { + !self.reader.get_pointer_field(6).is_null() + } + #[inline] + pub fn get_max_num_logs( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(7), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_max_num_logs(&self) -> bool { + !self.reader.get_pointer_field(7).is_null() + } + #[inline] + pub fn get_max_num_traces( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(8), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_max_num_traces(&self) -> bool { + !self.reader.get_pointer_field(8).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 1, + pointers: 9, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_join_mode( + self, + ) -> ::core::result::Result + { + ::core::convert::TryInto::try_into(self.builder.get_data_field::(0)) + } + #[inline] + pub fn set_join_mode(&mut self, value: crate::hypersync_net_types_capnp::JoinMode) { + self.builder.set_data_field::(0, value as u16); + } + #[inline] + pub fn get_logs( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::log_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_logs( + &mut self, + value: ::capnp::struct_list::Reader< + '_, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::log_filter::Owned, + >, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_logs( + self, + size: u32, + ) -> ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::log_filter::Owned, + >, + > { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(0), + size, + ) + } + #[inline] + pub fn has_logs(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_transactions( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::transaction_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_transactions( + &mut self, + value: ::capnp::struct_list::Reader< + '_, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::transaction_filter::Owned, + >, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_transactions( + self, + size: u32, + ) -> ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::transaction_filter::Owned, + >, + > { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(1), + size, + ) + } + #[inline] + pub fn has_transactions(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + #[inline] + pub fn get_traces( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::trace_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(2), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_traces( + &mut self, + value: ::capnp::struct_list::Reader< + '_, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::trace_filter::Owned, + >, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(2), + value, + false, + ) + } + #[inline] + pub fn init_traces( + self, + size: u32, + ) -> ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::trace_filter::Owned, + >, + > { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(2), + size, + ) + } + #[inline] + pub fn has_traces(&self) -> bool { + !self.builder.is_pointer_field_null(2) + } + #[inline] + pub fn get_blocks( + self, + ) -> ::capnp::Result< + ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::block_filter::Owned, + >, + >, + > { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(3), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_blocks( + &mut self, + value: ::capnp::struct_list::Reader< + '_, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::block_filter::Owned, + >, + >, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(3), + value, + false, + ) + } + #[inline] + pub fn init_blocks( + self, + size: u32, + ) -> ::capnp::struct_list::Builder< + 'a, + crate::hypersync_net_types_capnp::selection::Owned< + crate::hypersync_net_types_capnp::block_filter::Owned, + >, + > { + ::capnp::traits::FromPointerBuilder::init_pointer( + self.builder.get_pointer_field(3), + size, + ) + } + #[inline] + pub fn has_blocks(&self) -> bool { + !self.builder.is_pointer_field_null(3) + } + #[inline] + pub fn get_include_all_blocks(self) -> bool { + self.builder.get_bool_field(16) + } + #[inline] + pub fn set_include_all_blocks(&mut self, value: bool) { + self.builder.set_bool_field(16, value); + } + #[inline] + pub fn get_field_selection( + self, + ) -> ::capnp::Result> + { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(4), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_field_selection( + &mut self, + value: crate::hypersync_net_types_capnp::field_selection::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(4), + value, + false, + ) + } + #[inline] + pub fn init_field_selection( + self, + ) -> crate::hypersync_net_types_capnp::field_selection::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(4), 0) + } + #[inline] + pub fn has_field_selection(&self) -> bool { + !self.builder.is_pointer_field_null(4) + } + #[inline] + pub fn get_max_num_blocks( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(5), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_max_num_blocks( + &mut self, + value: crate::hypersync_net_types_capnp::opt_u_int64::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(5), + value, + false, + ) + } + #[inline] + pub fn init_max_num_blocks( + self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(5), 0) + } + #[inline] + pub fn has_max_num_blocks(&self) -> bool { + !self.builder.is_pointer_field_null(5) + } + #[inline] + pub fn get_max_num_transactions( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(6), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_max_num_transactions( + &mut self, + value: crate::hypersync_net_types_capnp::opt_u_int64::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(6), + value, + false, + ) + } + #[inline] + pub fn init_max_num_transactions( + self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(6), 0) + } + #[inline] + pub fn has_max_num_transactions(&self) -> bool { + !self.builder.is_pointer_field_null(6) + } + #[inline] + pub fn get_max_num_logs( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(7), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_max_num_logs( + &mut self, + value: crate::hypersync_net_types_capnp::opt_u_int64::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(7), + value, + false, + ) + } + #[inline] + pub fn init_max_num_logs( + self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(7), 0) + } + #[inline] + pub fn has_max_num_logs(&self) -> bool { + !self.builder.is_pointer_field_null(7) + } + #[inline] + pub fn get_max_num_traces( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(8), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_max_num_traces( + &mut self, + value: crate::hypersync_net_types_capnp::opt_u_int64::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(8), + value, + false, + ) + } + #[inline] + pub fn init_max_num_traces( + self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(8), 0) + } + #[inline] + pub fn has_max_num_traces(&self) -> bool { + !self.builder.is_pointer_field_null(8) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline { + pub fn get_field_selection( + &self, + ) -> crate::hypersync_net_types_capnp::field_selection::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(4)) + } + pub fn get_max_num_blocks( + &self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(5)) + } + pub fn get_max_num_transactions( + &self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(6)) + } + pub fn get_max_num_logs(&self) -> crate::hypersync_net_types_capnp::opt_u_int64::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(7)) + } + pub fn get_max_num_traces( + &self, + ) -> crate::hypersync_net_types_capnp::opt_u_int64::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(8)) + } + } + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 258] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(237, 135, 130, 51, 42, 10, 136, 130), + ::capnp::word(26, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(9, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 34, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 111, 2, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 81, 117, 101, 114, 121, 66), + ::capnp::word(111, 100, 121, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(44, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(10, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(37, 1, 0, 0, 74, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(36, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(48, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(45, 1, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(40, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(116, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(113, 1, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(112, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(188, 1, 0, 0, 2, 0, 1, 0), + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(185, 1, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(180, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(0, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(253, 1, 0, 0, 58, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(248, 1, 0, 0, 3, 0, 1, 0), + ::capnp::word(68, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 16, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(65, 2, 0, 0, 138, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(68, 2, 0, 0, 3, 0, 1, 0), + ::capnp::word(80, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(5, 0, 0, 0, 4, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(77, 2, 0, 0, 122, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(76, 2, 0, 0, 3, 0, 1, 0), + ::capnp::word(88, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(6, 0, 0, 0, 5, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(85, 2, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(84, 2, 0, 0, 3, 0, 1, 0), + ::capnp::word(96, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(7, 0, 0, 0, 6, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(93, 2, 0, 0, 154, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(96, 2, 0, 0, 3, 0, 1, 0), + ::capnp::word(108, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 9, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(105, 2, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 2, 0, 0, 3, 0, 1, 0), + ::capnp::word(116, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(9, 0, 0, 0, 8, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 10, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(113, 2, 0, 0, 106, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(112, 2, 0, 0, 3, 0, 1, 0), + ::capnp::word(124, 2, 0, 0, 2, 0, 1, 0), + ::capnp::word(106, 111, 105, 110, 77, 111, 100, 101), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(225, 44, 21, 103, 163, 43, 79, 129), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(15, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(108, 111, 103, 115, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 31, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 23, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(179, 254, 244, 73, 117, 248, 19, 160), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 110, 115, 97, 99, 116), + ::capnp::word(105, 111, 110, 115, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 31, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 23, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(56, 147, 107, 206, 187, 26, 251, 190), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 114, 97, 99, 101, 115, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 31, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 23, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(197, 194, 61, 54, 113, 80, 134, 163), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 108, 111, 99, 107, 115, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 31, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(123, 136, 14, 45, 199, 154, 37, 201), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 23, 0, 0, 0), + ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(198, 210, 137, 50, 10, 244, 5, 189), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(105, 110, 99, 108, 117, 100, 101, 65), + ::capnp::word(108, 108, 66, 108, 111, 99, 107, 115), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(102, 105, 101, 108, 100, 83, 101, 108), + ::capnp::word(101, 99, 116, 105, 111, 110, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(110, 171, 199, 124, 78, 87, 136, 142), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 78, 117, 109, 66, 108), + ::capnp::word(111, 99, 107, 115, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 156, 229, 39, 5, 172, 222, 134), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 78, 117, 109, 84, 114), + ::capnp::word(97, 110, 115, 97, 99, 116, 105, 111), + ::capnp::word(110, 115, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 156, 229, 39, 5, 172, 222, 134), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 78, 117, 109, 76, 111), + ::capnp::word(103, 115, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 156, 229, 39, 5, 172, 222, 134), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(109, 97, 120, 78, 117, 109, 84, 114), + ::capnp::word(97, 99, 101, 115, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 156, 229, 39, 5, 172, 222, 134), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => ::introspect(), + 1 => <::capnp::struct_list::Owned> as ::capnp::introspect::Introspect>::introspect(), + 2 => <::capnp::struct_list::Owned> as ::capnp::introspect::Introspect>::introspect(), + 3 => <::capnp::struct_list::Owned> as ::capnp::introspect::Introspect>::introspect(), + 4 => <::capnp::struct_list::Owned> as ::capnp::introspect::Introspect>::introspect(), + 5 => ::introspect(), + 6 => ::introspect(), + 7 => ::introspect(), + 8 => ::introspect(), + 9 => ::introspect(), + 10 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[4, 6, 5, 0, 1, 7, 9, 10, 8, 3, 2]; + pub const TYPE_ID: u64 = 0x8288_0a2a_3382_87ed; + } +} + +pub mod block_range { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_from_block(self) -> u64 { + self.reader.get_data_field::(0) + } + #[inline] + pub fn get_to_block( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_to_block(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 1, + pointers: 1, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_from_block(self) -> u64 { + self.builder.get_data_field::(0) + } + #[inline] + pub fn set_from_block(&mut self, value: u64) { + self.builder.set_data_field::(0, value); + } + #[inline] + pub fn get_to_block( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_to_block( + &mut self, + value: crate::hypersync_net_types_capnp::opt_u_int64::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_to_block(self) -> crate::hypersync_net_types_capnp::opt_u_int64::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) + } + #[inline] + pub fn has_to_block(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline { + pub fn get_to_block(&self) -> crate::hypersync_net_types_capnp::opt_u_int64::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) + } + } + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 50] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(186, 223, 151, 95, 15, 240, 183, 229), + ::capnp::word(26, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 42, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 119, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 66, 108, 111, 99, 107, 82), + ::capnp::word(97, 110, 103, 101, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 82, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(49, 0, 0, 0, 66, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(102, 114, 111, 109, 66, 108, 111, 99), + ::capnp::word(107, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(116, 111, 66, 108, 111, 99, 107, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(145, 156, 229, 39, 5, 172, 222, 134), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => ::introspect(), + 1 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; + pub const TYPE_ID: u64 = 0xe5b7_f00f_5f97_dfba; + } +} + +pub mod query { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl<'a> Reader<'a> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_block_range( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_block_range(&self) -> bool { + !self.reader.get_pointer_field(0).is_null() + } + #[inline] + pub fn get_body( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerReader::get_from_pointer( + &self.reader.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn has_body(&self) -> bool { + !self.reader.get_pointer_field(1).is_null() + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 0, + pointers: 2, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_block_range( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(0), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_block_range( + &mut self, + value: crate::hypersync_net_types_capnp::block_range::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(0), + value, + false, + ) + } + #[inline] + pub fn init_block_range( + self, + ) -> crate::hypersync_net_types_capnp::block_range::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) + } + #[inline] + pub fn has_block_range(&self) -> bool { + !self.builder.is_pointer_field_null(0) + } + #[inline] + pub fn get_body( + self, + ) -> ::capnp::Result> { + ::capnp::traits::FromPointerBuilder::get_from_pointer( + self.builder.get_pointer_field(1), + ::core::option::Option::None, + ) + } + #[inline] + pub fn set_body( + &mut self, + value: crate::hypersync_net_types_capnp::query_body::Reader<'_>, + ) -> ::capnp::Result<()> { + ::capnp::traits::SetterInput::set_pointer_builder( + self.builder.reborrow().get_pointer_field(1), + value, + false, + ) + } + #[inline] + pub fn init_body(self) -> crate::hypersync_net_types_capnp::query_body::Builder<'a> { + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(1), 0) + } + #[inline] + pub fn has_body(&self) -> bool { + !self.builder.is_pointer_field_null(1) + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline { + pub fn get_block_range(&self) -> crate::hypersync_net_types_capnp::block_range::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) + } + pub fn get_body(&self) -> crate::hypersync_net_types_capnp::query_body::Pipeline { + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(1)) + } + } + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 49] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(84, 0, 180, 54, 227, 78, 133, 190), + ::capnp::word(26, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 2, 1, 0, 0), + ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(29, 0, 0, 0, 119, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 81, 117, 101, 114, 121, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(41, 0, 0, 0, 90, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(49, 0, 0, 0, 42, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(44, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(56, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(98, 108, 111, 99, 107, 82, 97, 110), + ::capnp::word(103, 101, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(186, 223, 151, 95, 15, 240, 183, 229), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(98, 111, 100, 121, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(237, 135, 130, 51, 42, 10, 136, 130), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => ::introspect(), + 1 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0, 1]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0, 1]; + pub const TYPE_ID: u64 = 0xbe85_4ee3_36b4_0054; + } +} + +pub mod opt_u_int64 { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl Reader<'_> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_value(self) -> u64 { + self.reader.get_data_field::(0) + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 1, + pointers: 0, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_value(self) -> u64 { + self.builder.get_data_field::(0) + } + #[inline] + pub fn set_value(&mut self, value: u64) { + self.builder.set_data_field::(0, value); + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 34] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(145, 156, 229, 39, 5, 172, 222, 134), + ::capnp::word(26, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 34, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 63, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 79, 112, 116, 85, 73, 110), + ::capnp::word(116, 54, 52, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(20, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(118, 97, 108, 117, 101, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(9, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0]; + pub const TYPE_ID: u64 = 0x86de_ac05_27e5_9c91; + } +} + +pub mod opt_u_int8 { + #[derive(Copy, Clone)] + pub struct Owned(()); + impl ::capnp::introspect::Introspect for Owned { + fn introspect() -> ::capnp::introspect::Type { + ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }) + .into() + } + } + impl ::capnp::traits::Owned for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::OwnedStruct for Owned { + type Reader<'a> = Reader<'a>; + type Builder<'a> = Builder<'a>; + } + impl ::capnp::traits::Pipelined for Owned { + type Pipeline = Pipeline; + } + + pub struct Reader<'a> { + reader: ::capnp::private::layout::StructReader<'a>, + } + impl ::core::marker::Copy for Reader<'_> {} + impl ::core::clone::Clone for Reader<'_> { + fn clone(&self) -> Self { + *self + } + } + + impl ::capnp::traits::HasTypeId for Reader<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a> { + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { + Self { reader } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Reader<'a> { + fn from(reader: Reader<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Reader::new( + reader.reader, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl ::core::fmt::Debug for Reader<'_> { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::result::Result<(), ::core::fmt::Error> { + core::fmt::Debug::fmt( + &::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), + f, + ) + } + } + + impl<'a> ::capnp::traits::FromPointerReader<'a> for Reader<'a> { + fn get_from_pointer( + reader: &::capnp::private::layout::PointerReader<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok(reader.get_struct(default)?.into()) + } + } + + impl<'a> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a> { + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { + self.reader + } + } + + impl<'a> ::capnp::traits::Imbue<'a> for Reader<'a> { + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { + self.reader + .imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) + } + } + + impl Reader<'_> { + pub fn reborrow(&self) -> Reader<'_> { + Self { ..*self } + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.reader.total_size() + } + #[inline] + pub fn get_value(self) -> u8 { + self.reader.get_data_field::(0) + } + } + + pub struct Builder<'a> { + builder: ::capnp::private::layout::StructBuilder<'a>, + } + impl ::capnp::traits::HasStructSize for Builder<'_> { + const STRUCT_SIZE: ::capnp::private::layout::StructSize = + ::capnp::private::layout::StructSize { + data: 1, + pointers: 0, + }; + } + impl ::capnp::traits::HasTypeId for Builder<'_> { + const TYPE_ID: u64 = _private::TYPE_ID; + } + impl<'a> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a> { + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { + Self { builder } + } + } + + impl<'a> ::core::convert::From> for ::capnp::dynamic_value::Builder<'a> { + fn from(builder: Builder<'a>) -> Self { + Self::Struct(::capnp::dynamic_struct::Builder::new( + builder.builder, + ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { + generic: &_private::RAW_SCHEMA, + field_types: _private::get_field_types, + annotation_types: _private::get_annotation_types, + }), + )) + } + } + + impl<'a> ::capnp::traits::ImbueMut<'a> for Builder<'a> { + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { + self.builder + .imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) + } + } + + impl<'a> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a> { + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { + builder + .init_struct(::STRUCT_SIZE) + .into() + } + fn get_from_pointer( + builder: ::capnp::private::layout::PointerBuilder<'a>, + default: ::core::option::Option<&'a [::capnp::Word]>, + ) -> ::capnp::Result { + ::core::result::Result::Ok( + builder + .get_struct( + ::STRUCT_SIZE, + default, + )? + .into(), + ) + } + } + + impl ::capnp::traits::SetterInput for Reader<'_> { + fn set_pointer_builder( + mut pointer: ::capnp::private::layout::PointerBuilder<'_>, + value: Self, + canonicalize: bool, + ) -> ::capnp::Result<()> { + pointer.set_struct(&value.reader, canonicalize) + } + } + + impl<'a> Builder<'a> { + pub fn into_reader(self) -> Reader<'a> { + self.builder.into_reader().into() + } + pub fn reborrow(&mut self) -> Builder<'_> { + Builder { + builder: self.builder.reborrow(), + } + } + pub fn reborrow_as_reader(&self) -> Reader<'_> { + self.builder.as_reader().into() + } + + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { + self.builder.as_reader().total_size() + } + #[inline] + pub fn get_value(self) -> u8 { + self.builder.get_data_field::(0) + } + #[inline] + pub fn set_value(&mut self, value: u8) { + self.builder.set_data_field::(0, value); + } + } + + pub struct Pipeline { + _typeless: ::capnp::any_pointer::Pipeline, + } + impl ::capnp::capability::FromTypelessPipeline for Pipeline { + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { + Self { + _typeless: typeless, + } + } + } + impl Pipeline {} + mod _private { + pub static ENCODED_NODE: [::capnp::Word; 34] = [ + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), + ::capnp::word(50, 179, 230, 200, 42, 167, 255, 167), + ::capnp::word(26, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(197, 128, 248, 24, 106, 165, 137, 146), + ::capnp::word(0, 0, 7, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(21, 0, 0, 0, 26, 1, 0, 0), + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(33, 0, 0, 0, 63, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(104, 121, 112, 101, 114, 115, 121, 110), + ::capnp::word(99, 95, 110, 101, 116, 95, 116, 121), + ::capnp::word(112, 101, 115, 46, 99, 97, 112, 110), + ::capnp::word(112, 58, 79, 112, 116, 85, 73, 110), + ::capnp::word(116, 56, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), + ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(13, 0, 0, 0, 50, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(8, 0, 0, 0, 3, 0, 1, 0), + ::capnp::word(20, 0, 0, 0, 2, 0, 1, 0), + ::capnp::word(118, 97, 108, 117, 101, 0, 0, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(6, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), + ]; + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { + match index { + 0 => ::introspect(), + _ => panic!("invalid field index {}", index), + } + } + pub fn get_annotation_types( + child_index: Option, + index: u32, + ) -> ::capnp::introspect::Type { + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) + } + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = + ::capnp::introspect::RawStructSchema { + encoded_node: &ENCODED_NODE, + nonunion_members: NONUNION_MEMBERS, + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, + members_by_name: MEMBERS_BY_NAME, + }; + pub static NONUNION_MEMBERS: &[u16] = &[0]; + pub static MEMBERS_BY_DISCRIMINANT: &[u16] = &[]; + pub static MEMBERS_BY_NAME: &[u16] = &[0]; + pub const TYPE_ID: u64 = 0xa7ff_a72a_c8e6_b332; + } +} diff --git a/hypersync-net-types/src/__generated__/mod.rs b/hypersync-net-types/src/__generated__/mod.rs new file mode 100644 index 0000000..8a056b7 --- /dev/null +++ b/hypersync-net-types/src/__generated__/mod.rs @@ -0,0 +1,4 @@ +// Capnp code is now generated and commited without the compile time build +// ignore clippy warnings for generated code +#[allow(clippy::all)] +pub mod hypersync_net_types_capnp; diff --git a/hypersync-net-types/src/block.rs b/hypersync-net-types/src/block.rs new file mode 100644 index 0000000..032385a --- /dev/null +++ b/hypersync-net-types/src/block.rs @@ -0,0 +1,308 @@ +use crate::{hypersync_net_types_capnp, BuilderReader, Selection}; +use hypersync_format::{Address, Hash}; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeSet; + +pub type BlockSelection = Selection; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct BlockFilter { + /// Hash of a block, any blocks that have one of these hashes will be returned. + /// Empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hash: Vec, + /// Miner address of a block, any blocks that have one of these miners will be returned. + /// Empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub miner: Vec
, +} + +impl BuilderReader for BlockFilter { + fn populate_builder( + &self, + builder: &mut hypersync_net_types_capnp::block_filter::Builder, + ) -> Result<(), capnp::Error> { + // Set hashes + if !self.hash.is_empty() { + let mut hash_list = builder.reborrow().init_hash(self.hash.len() as u32); + for (i, hash) in self.hash.iter().enumerate() { + hash_list.set(i as u32, hash.as_slice()); + } + } + + // Set miners + if !self.miner.is_empty() { + let mut miner_list = builder.reborrow().init_miner(self.miner.len() as u32); + for (i, miner) in self.miner.iter().enumerate() { + miner_list.set(i as u32, miner.as_slice()); + } + } + + Ok(()) + } + + /// Deserialize BlockSelection from Cap'n Proto reader + fn from_reader( + reader: hypersync_net_types_capnp::block_filter::Reader, + ) -> Result { + let mut hash = Vec::new(); + + // Parse hashes + if reader.has_hash() { + let hash_list = reader.get_hash()?; + for i in 0..hash_list.len() { + let hash_data = hash_list.get(i)?; + if hash_data.len() == 32 { + let mut hash_bytes = [0u8; 32]; + hash_bytes.copy_from_slice(hash_data); + hash.push(Hash::from(hash_bytes)); + } + } + } + + let mut miner = Vec::new(); + + // Parse miners + if reader.has_miner() { + let miner_list = reader.get_miner()?; + for i in 0..miner_list.len() { + let addr_data = miner_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + miner.push(Address::from(addr_bytes)); + } + } + } + + Ok(Self { hash, miner }) + } +} + +#[derive( + Debug, + Clone, + Copy, + Serialize, + Deserialize, + PartialEq, + Eq, + schemars::JsonSchema, + strum_macros::EnumIter, + strum_macros::AsRefStr, + strum_macros::Display, + strum_macros::EnumString, +)] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum BlockField { + // Non-nullable fields (required) + Number, + Hash, + ParentHash, + Sha3Uncles, + LogsBloom, + TransactionsRoot, + StateRoot, + ReceiptsRoot, + Miner, + ExtraData, + Size, + GasLimit, + GasUsed, + Timestamp, + MixHash, + + // Nullable fields (optional) + Nonce, + Difficulty, + TotalDifficulty, + Uncles, + BaseFeePerGas, + BlobGasUsed, + ExcessBlobGas, + ParentBeaconBlockRoot, + WithdrawalsRoot, + Withdrawals, + L1BlockNumber, + SendCount, + SendRoot, +} + +impl Ord for BlockField { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_ref().cmp(other.as_ref()) + } +} + +impl PartialOrd for BlockField { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl BlockField { + pub fn all() -> BTreeSet { + use strum::IntoEnumIterator; + Self::iter().collect() + } + + /// Convert BlockField to Cap'n Proto enum + pub fn to_capnp(&self) -> crate::hypersync_net_types_capnp::BlockField { + match self { + BlockField::Number => crate::hypersync_net_types_capnp::BlockField::Number, + BlockField::Hash => crate::hypersync_net_types_capnp::BlockField::Hash, + BlockField::ParentHash => crate::hypersync_net_types_capnp::BlockField::ParentHash, + BlockField::Sha3Uncles => crate::hypersync_net_types_capnp::BlockField::Sha3Uncles, + BlockField::LogsBloom => crate::hypersync_net_types_capnp::BlockField::LogsBloom, + BlockField::TransactionsRoot => { + crate::hypersync_net_types_capnp::BlockField::TransactionsRoot + } + BlockField::StateRoot => crate::hypersync_net_types_capnp::BlockField::StateRoot, + BlockField::ReceiptsRoot => crate::hypersync_net_types_capnp::BlockField::ReceiptsRoot, + BlockField::Miner => crate::hypersync_net_types_capnp::BlockField::Miner, + BlockField::ExtraData => crate::hypersync_net_types_capnp::BlockField::ExtraData, + BlockField::Size => crate::hypersync_net_types_capnp::BlockField::Size, + BlockField::GasLimit => crate::hypersync_net_types_capnp::BlockField::GasLimit, + BlockField::GasUsed => crate::hypersync_net_types_capnp::BlockField::GasUsed, + BlockField::Timestamp => crate::hypersync_net_types_capnp::BlockField::Timestamp, + BlockField::MixHash => crate::hypersync_net_types_capnp::BlockField::MixHash, + BlockField::Nonce => crate::hypersync_net_types_capnp::BlockField::Nonce, + BlockField::Difficulty => crate::hypersync_net_types_capnp::BlockField::Difficulty, + BlockField::TotalDifficulty => { + crate::hypersync_net_types_capnp::BlockField::TotalDifficulty + } + BlockField::Uncles => crate::hypersync_net_types_capnp::BlockField::Uncles, + BlockField::BaseFeePerGas => { + crate::hypersync_net_types_capnp::BlockField::BaseFeePerGas + } + BlockField::BlobGasUsed => crate::hypersync_net_types_capnp::BlockField::BlobGasUsed, + BlockField::ExcessBlobGas => { + crate::hypersync_net_types_capnp::BlockField::ExcessBlobGas + } + BlockField::ParentBeaconBlockRoot => { + crate::hypersync_net_types_capnp::BlockField::ParentBeaconBlockRoot + } + BlockField::WithdrawalsRoot => { + crate::hypersync_net_types_capnp::BlockField::WithdrawalsRoot + } + BlockField::Withdrawals => crate::hypersync_net_types_capnp::BlockField::Withdrawals, + BlockField::L1BlockNumber => { + crate::hypersync_net_types_capnp::BlockField::L1BlockNumber + } + BlockField::SendCount => crate::hypersync_net_types_capnp::BlockField::SendCount, + BlockField::SendRoot => crate::hypersync_net_types_capnp::BlockField::SendRoot, + } + } + + /// Convert Cap'n Proto enum to BlockField + pub fn from_capnp(field: crate::hypersync_net_types_capnp::BlockField) -> Self { + match field { + crate::hypersync_net_types_capnp::BlockField::Number => BlockField::Number, + crate::hypersync_net_types_capnp::BlockField::Hash => BlockField::Hash, + crate::hypersync_net_types_capnp::BlockField::ParentHash => BlockField::ParentHash, + crate::hypersync_net_types_capnp::BlockField::Sha3Uncles => BlockField::Sha3Uncles, + crate::hypersync_net_types_capnp::BlockField::LogsBloom => BlockField::LogsBloom, + crate::hypersync_net_types_capnp::BlockField::TransactionsRoot => { + BlockField::TransactionsRoot + } + crate::hypersync_net_types_capnp::BlockField::StateRoot => BlockField::StateRoot, + crate::hypersync_net_types_capnp::BlockField::ReceiptsRoot => BlockField::ReceiptsRoot, + crate::hypersync_net_types_capnp::BlockField::Miner => BlockField::Miner, + crate::hypersync_net_types_capnp::BlockField::ExtraData => BlockField::ExtraData, + crate::hypersync_net_types_capnp::BlockField::Size => BlockField::Size, + crate::hypersync_net_types_capnp::BlockField::GasLimit => BlockField::GasLimit, + crate::hypersync_net_types_capnp::BlockField::GasUsed => BlockField::GasUsed, + crate::hypersync_net_types_capnp::BlockField::Timestamp => BlockField::Timestamp, + crate::hypersync_net_types_capnp::BlockField::MixHash => BlockField::MixHash, + crate::hypersync_net_types_capnp::BlockField::Nonce => BlockField::Nonce, + crate::hypersync_net_types_capnp::BlockField::Difficulty => BlockField::Difficulty, + crate::hypersync_net_types_capnp::BlockField::TotalDifficulty => { + BlockField::TotalDifficulty + } + crate::hypersync_net_types_capnp::BlockField::Uncles => BlockField::Uncles, + crate::hypersync_net_types_capnp::BlockField::BaseFeePerGas => { + BlockField::BaseFeePerGas + } + crate::hypersync_net_types_capnp::BlockField::BlobGasUsed => BlockField::BlobGasUsed, + crate::hypersync_net_types_capnp::BlockField::ExcessBlobGas => { + BlockField::ExcessBlobGas + } + crate::hypersync_net_types_capnp::BlockField::ParentBeaconBlockRoot => { + BlockField::ParentBeaconBlockRoot + } + crate::hypersync_net_types_capnp::BlockField::WithdrawalsRoot => { + BlockField::WithdrawalsRoot + } + crate::hypersync_net_types_capnp::BlockField::Withdrawals => BlockField::Withdrawals, + crate::hypersync_net_types_capnp::BlockField::L1BlockNumber => { + BlockField::L1BlockNumber + } + crate::hypersync_net_types_capnp::BlockField::SendCount => BlockField::SendCount, + crate::hypersync_net_types_capnp::BlockField::SendRoot => BlockField::SendRoot, + } + } +} + +#[cfg(test)] +mod tests { + use std::str::FromStr; + + use hypersync_format::Hex; + + use super::*; + use crate::{query::tests::test_query_serde, FieldSelection, Query}; + + #[test] + fn test_all_fields_in_schema() { + let schema = hypersync_schema::block_header(); + let schema_fields = schema + .fields + .iter() + .map(|f| f.name.clone()) + .collect::>(); + let all_fields = BlockField::all() + .into_iter() + .map(|f| f.as_ref().to_string()) + .collect::>(); + assert_eq!(schema_fields, all_fields); + } + + #[test] + fn test_serde_matches_strum() { + for field in BlockField::all() { + let serialized = serde_json::to_string(&field).unwrap(); + let strum = serde_json::to_string(&field.as_ref()).unwrap(); + assert_eq!(serialized, strum, "strum value should be the same as serde"); + } + } + + #[test] + fn test_block_filter_serde_with_values() { + let block_filter = BlockFilter { + hash: vec![Hash::decode_hex( + "0x40d008f2a1653f09b7b028d30c7fd1ba7c84900fcfb032040b3eb3d16f84d294", + ) + .unwrap()], + miner: vec![Address::decode_hex("0xdadB0d80178819F2319190D340ce9A924f783711").unwrap()], + }; + let field_selection = FieldSelection { + block: BlockField::all(), + ..Default::default() + }; + let query = Query { + blocks: vec![block_filter.into()], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "block selection with rest defaults"); + } + + #[test] + fn test_as_str() { + let block_field = BlockField::Number; + let from_str = BlockField::from_str("number").unwrap(); + assert_eq!(block_field, from_str); + } +} diff --git a/hypersync-net-types/src/lib.rs b/hypersync-net-types/src/lib.rs index 0722a42..b3b6305 100644 --- a/hypersync-net-types/src/lib.rs +++ b/hypersync-net-types/src/lib.rs @@ -1,22 +1,32 @@ -use std::collections::BTreeSet; +//! Hypersync network types for transport and queries. +//! +//! This library provides types and serialization capabilities for interacting with hypersync servers. +//! It supports both JSON and Cap'n Proto serialization formats for efficient network communication. + +// Module declarations +pub mod block; +pub mod log; +pub mod query; +pub mod response; +pub mod trace; +pub mod transaction; +pub mod types; + +// Cap'n Proto generated code +mod __generated__; +pub use __generated__::hypersync_net_types_capnp; + +// Re-export types from modules for backward compatibility and convenience +pub use block::{BlockFilter, BlockSelection}; +pub use log::{LogFilter, LogSelection}; +pub use query::{FieldSelection, JoinMode, Query}; +pub use response::{ArchiveHeight, ChainId, RollbackGuard}; +pub use trace::{TraceFilter, TraceSelection}; +pub use transaction::{AuthorizationSelection, TransactionFilter, TransactionSelection}; +pub use types::Sighash; -/// Used to skip serializing a defaulted serde field if -/// the value matches the default value. -fn is_default(t: &T) -> bool { - t == &T::default() -} - -use arrayvec::ArrayVec; -use hypersync_format::{Address, FilterWrapper, FixedSizeData, Hash, LogArgument}; use serde::{Deserialize, Serialize}; -pub type Sighash = FixedSizeData<4>; - -#[allow(clippy::all)] -pub mod hypersync_net_types_capnp { - include!(concat!(env!("OUT_DIR"), "/hypersync_net_types_capnp.rs")); -} - #[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] pub struct Selection { /// Filters where matching values should be included in the response @@ -38,231 +48,45 @@ impl From for Selection { } } -pub type BlockSelection = Selection; +pub(crate) trait BuilderReader { + fn populate_builder<'a>(&self, builder: &mut O::Builder<'a>) -> Result<(), E>; -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct BlockFilter { - /// Hash of a block, any blocks that have one of these hashes will be returned. - /// Empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub hash: Vec, - /// Miner address of a block, any blocks that have one of these miners will be returned. - /// Empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub miner: Vec
, + fn from_reader<'a>(reader: O::Reader<'a>) -> Result + where + Self: Sized; } -pub type LogSelection = Selection; +impl BuilderReader> for Selection +where + O: capnp::traits::Owned, + T: BuilderReader, +{ + fn populate_builder<'a>( + &self, + builder: &mut hypersync_net_types_capnp::selection::Builder<'a, O>, + ) -> Result<(), capnp::Error> { + { + let mut include_builder = builder.reborrow().init_include(); + self.include.populate_builder(&mut include_builder)?; + } // include borrow ends -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct LogFilter { - /// Address of the contract, any logs that has any of these addresses will be returned. - /// Empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub address: Vec
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub address_filter: Option, - /// Topics to match, each member of the top level array is another array, if the nth topic matches any - /// topic specified in nth element of topics, the log will be returned. Empty means match all. - #[serde(default, skip_serializing_if = "ArrayVec::is_empty")] - pub topics: ArrayVec, 4>, -} + if let Some(exclude) = &self.exclude { + let mut exclude_builder = builder.reborrow().init_exclude(); + exclude.populate_builder(&mut exclude_builder)?; + } // exclude borrow ends -pub type TransactionSelection = Selection; - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct TransactionFilter { - /// Address the transaction should originate from. If transaction.from matches any of these, the transaction - /// will be returned. Keep in mind that this has an and relationship with to filter, so each transaction should - /// match both of them. Empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub from: Vec
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub from_filter: Option, - /// Address the transaction should go to. If transaction.to matches any of these, the transaction will - /// be returned. Keep in mind that this has an and relationship with from filter, so each transaction should - /// match both of them. Empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub to: Vec
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub to_filter: Option, - /// If first 4 bytes of transaction input matches any of these, transaction will be returned. Empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub sighash: Vec, - /// If transaction.status matches this value, the transaction will be returned. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// If transaction.type matches any of these values, the transaction will be returned - #[serde(rename = "type")] - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub kind: Vec, - /// If transaction.contract_address matches any of these values, the transaction will be returned. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub contract_address: Vec
, - /// Bloom filter to filter by transaction.contract_address field. If the bloom filter contains the hash - /// of transaction.contract_address then the transaction will be returned. This field doesn't utilize the server side filtering - /// so it should be used alongside some non-probabilistic filters if possible. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub contract_address_filter: Option, - /// If transaction.hash matches any of these values the transaction will be returned. - /// empty means match all. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub hash: Vec, - - /// List of authorizations from eip-7702 transactions, the query will return transactions that match any of these selections - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub authorization_list: Vec, -} - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct AuthorizationSelection { - /// List of chain ids to match in the transaction authorizationList - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub chain_id: Vec, - /// List of addresses to match in the transaction authorizationList - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub address: Vec
, -} - -pub type TraceSelection = Selection; - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct TraceFilter { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub from: Vec
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub from_filter: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub to: Vec
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub to_filter: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub address: Vec
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub address_filter: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub call_type: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub reward_type: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[serde(rename = "type")] - pub kind: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub sighash: Vec, -} - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct Query { - /// The block to start the query from - pub from_block: u64, - /// The block to end the query at. If not specified, the query will go until the - /// end of data. Exclusive, the returned range will be [from_block..to_block). - /// - /// The query will return before it reaches this target block if it hits the time limit - /// configured on the server. The user should continue their query by putting the - /// next_block field in the response into from_block field of their next query. This implements - /// pagination. - #[serde(skip_serializing_if = "Option::is_none")] - pub to_block: Option, - /// List of log selections, these have an OR relationship between them, so the query will return logs - /// that match any of these selections. - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub logs: Vec, - /// List of transaction selections, the query will return transactions that match any of these selections - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub transactions: Vec, - /// List of trace selections, the query will return traces that match any of these selections - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub traces: Vec, - /// List of block selections, the query will return blocks that match any of these selections - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub blocks: Vec, - /// Weather to include all blocks regardless of if they are related to a returned transaction or log. Normally - /// the server will return only the blocks that are related to the transaction or logs in the response. But if this - /// is set to true, the server will return data for all blocks in the requested range [from_block, to_block). - #[serde(default, skip_serializing_if = "is_default")] - pub include_all_blocks: bool, - /// Field selection. The user can select which fields they are interested in, requesting less fields will improve - /// query execution time and reduce the payload size so the user should always use a minimal number of fields. - #[serde(default, skip_serializing_if = "is_default")] - pub field_selection: FieldSelection, - /// Maximum number of blocks that should be returned, the server might return more blocks than this number but - /// it won't overshoot by too much. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub max_num_blocks: Option, - /// Maximum number of transactions that should be returned, the server might return more transactions than this number but - /// it won't overshoot by too much. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub max_num_transactions: Option, - /// Maximum number of logs that should be returned, the server might return more logs than this number but - /// it won't overshoot by too much. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub max_num_logs: Option, - /// Maximum number of traces that should be returned, the server might return more traces than this number but - /// it won't overshoot by too much. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub max_num_traces: Option, - /// Selects join mode for the query, - /// Default: join in this order logs -> transactions -> traces -> blocks - /// JoinAll: join everything to everything. For example if logSelection matches log0, we get the - /// associated transaction of log0 and then we get associated logs of that transaction as well. Applites similarly - /// to blocks, traces. - /// JoinNothing: join nothing. - #[serde(default, skip_serializing_if = "is_default")] - pub join_mode: JoinMode, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Copy)] -pub enum JoinMode { - /// Join in this order logs -> transactions -> traces -> blocks - Default, - /// Join everything to everything. For example if logSelection matches log0, we get the - /// associated transaction of log0 and then we get associated logs of that transaction as well. Applites similarly - /// to blocks, traces. - JoinAll, - /// JoinNothing: join nothing. - JoinNothing, -} - -impl Default for JoinMode { - fn default() -> Self { - Self::Default + Ok(()) } -} - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct FieldSelection { - #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] - pub block: BTreeSet, - #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] - pub transaction: BTreeSet, - #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] - pub log: BTreeSet, - #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] - pub trace: BTreeSet, -} -#[derive(Clone, Copy, Deserialize, Serialize, Debug)] -pub struct ArchiveHeight { - pub height: Option, -} - -#[derive(Clone, Copy, Deserialize, Serialize, Debug)] -pub struct ChainId { - pub chain_id: u64, -} - -/// Guard for detecting rollbacks -#[derive(Debug, Clone, Serialize)] -pub struct RollbackGuard { - /// Block number of last block scanned in memory - pub block_number: u64, - /// Block timestamp of last block scanned in memory - pub timestamp: i64, - /// Block hash of last block scanned in memory - pub hash: Hash, - /// Block number of first block scanned in memory - pub first_block_number: u64, - /// Parent hash of first block scanned in memory - pub first_parent_hash: Hash, + fn from_reader<'a>( + reader: hypersync_net_types_capnp::selection::Reader<'a, O>, + ) -> Result { + let include = T::from_reader(reader.get_include()?)?; + let exclude = if reader.has_exclude() { + Some(T::from_reader(reader.get_exclude()?)?) + } else { + None + }; + Ok(Self { include, exclude }) + } } diff --git a/hypersync-net-types/src/log.rs b/hypersync-net-types/src/log.rs new file mode 100644 index 0000000..d326997 --- /dev/null +++ b/hypersync-net-types/src/log.rs @@ -0,0 +1,295 @@ +use crate::{hypersync_net_types_capnp, BuilderReader, Selection}; +use arrayvec::ArrayVec; +use hypersync_format::{Address, FilterWrapper, LogArgument}; +use serde::{Deserialize, Serialize}; + +pub type LogSelection = Selection; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct LogFilter { + /// Address of the contract, any logs that has any of these addresses will be returned. + /// Empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub address: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address_filter: Option, + /// Topics to match, each member of the top level array is another array, if the nth topic matches any + /// topic specified in nth element of topics, the log will be returned. Empty means match all. + #[serde(default, skip_serializing_if = "ArrayVec::is_empty")] + pub topics: ArrayVec, 4>, +} + +impl BuilderReader for LogFilter { + fn populate_builder( + &self, + builder: &mut hypersync_net_types_capnp::log_filter::Builder, + ) -> Result<(), capnp::Error> { + // Set addresses + if !self.address.is_empty() { + let mut addr_list = builder.reborrow().init_address(self.address.len() as u32); + for (i, addr) in self.address.iter().enumerate() { + addr_list.set(i as u32, addr.as_slice()); + } + } + + // Set address filter + if let Some(filter) = &self.address_filter { + builder.reborrow().set_address_filter(filter.0.as_bytes()); + } + + // Set topics + if !self.topics.is_empty() { + let mut topics_list = builder.reborrow().init_topics(self.topics.len() as u32); + for (i, topic_vec) in self.topics.iter().enumerate() { + let mut topic_list = topics_list + .reborrow() + .init(i as u32, topic_vec.len() as u32); + for (j, topic) in topic_vec.iter().enumerate() { + topic_list.set(j as u32, topic.as_slice()); + } + } + } + + Ok(()) + } + + /// Deserialize LogSelection from Cap'n Proto reader + fn from_reader( + reader: hypersync_net_types_capnp::log_filter::Reader, + ) -> Result { + let mut address = Vec::new(); + + // Parse addresses + if reader.has_address() { + let addr_list = reader.get_address()?; + for i in 0..addr_list.len() { + let addr_data = addr_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + address.push(Address::from(addr_bytes)); + } + } + } + + let mut address_filter = None; + + // Parse address filter + if reader.has_address_filter() { + let filter_data = reader.get_address_filter()?; + // For now, skip filter deserialization - this would need proper Filter construction + // log_selection.address_filter = Some(FilterWrapper::from_keys(std::iter::empty(), None).unwrap()); + + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed("Invalid address filter".to_string())); + }; + address_filter = Some(wrapper); + } + + let mut topics = ArrayVec::new(); + + // Parse topics + if reader.has_topics() { + let topics_list = reader.get_topics()?; + for i in 0..topics_list.len() { + let topic_list = topics_list.get(i)?; + let mut topic_vec = Vec::new(); + for j in 0..topic_list.len() { + let topic_data = topic_list.get(j)?; + if topic_data.len() == 32 { + let mut topic_bytes = [0u8; 32]; + topic_bytes.copy_from_slice(topic_data); + topic_vec.push(LogArgument::from(topic_bytes)); + } + } + if i < 4 && !topic_vec.is_empty() { + topics.push(topic_vec); + } + } + } + + Ok(Self { + address, + address_filter, + topics, + }) + } +} + +#[derive( + Debug, + Clone, + Copy, + Serialize, + Deserialize, + PartialEq, + Eq, + schemars::JsonSchema, + strum_macros::EnumIter, + strum_macros::AsRefStr, + strum_macros::Display, + strum_macros::EnumString, +)] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum LogField { + // Core log fields + TransactionHash, + BlockHash, + BlockNumber, + TransactionIndex, + LogIndex, + Address, + Data, + Removed, + + // Topic fields + Topic0, + Topic1, + Topic2, + Topic3, +} + +impl Ord for LogField { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_ref().cmp(other.as_ref()) + } +} + +impl PartialOrd for LogField { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl LogField { + pub fn all() -> std::collections::BTreeSet { + use strum::IntoEnumIterator; + Self::iter().collect() + } + + /// Convert LogField to Cap'n Proto enum + pub fn to_capnp(&self) -> crate::hypersync_net_types_capnp::LogField { + match self { + LogField::TransactionHash => { + crate::hypersync_net_types_capnp::LogField::TransactionHash + } + LogField::BlockHash => crate::hypersync_net_types_capnp::LogField::BlockHash, + LogField::BlockNumber => crate::hypersync_net_types_capnp::LogField::BlockNumber, + LogField::TransactionIndex => { + crate::hypersync_net_types_capnp::LogField::TransactionIndex + } + LogField::LogIndex => crate::hypersync_net_types_capnp::LogField::LogIndex, + LogField::Address => crate::hypersync_net_types_capnp::LogField::Address, + LogField::Data => crate::hypersync_net_types_capnp::LogField::Data, + LogField::Removed => crate::hypersync_net_types_capnp::LogField::Removed, + LogField::Topic0 => crate::hypersync_net_types_capnp::LogField::Topic0, + LogField::Topic1 => crate::hypersync_net_types_capnp::LogField::Topic1, + LogField::Topic2 => crate::hypersync_net_types_capnp::LogField::Topic2, + LogField::Topic3 => crate::hypersync_net_types_capnp::LogField::Topic3, + } + } + + /// Convert Cap'n Proto enum to LogField + pub fn from_capnp(field: crate::hypersync_net_types_capnp::LogField) -> Self { + match field { + crate::hypersync_net_types_capnp::LogField::TransactionHash => { + LogField::TransactionHash + } + crate::hypersync_net_types_capnp::LogField::BlockHash => LogField::BlockHash, + crate::hypersync_net_types_capnp::LogField::BlockNumber => LogField::BlockNumber, + crate::hypersync_net_types_capnp::LogField::TransactionIndex => { + LogField::TransactionIndex + } + crate::hypersync_net_types_capnp::LogField::LogIndex => LogField::LogIndex, + crate::hypersync_net_types_capnp::LogField::Address => LogField::Address, + crate::hypersync_net_types_capnp::LogField::Data => LogField::Data, + crate::hypersync_net_types_capnp::LogField::Removed => LogField::Removed, + crate::hypersync_net_types_capnp::LogField::Topic0 => LogField::Topic0, + crate::hypersync_net_types_capnp::LogField::Topic1 => LogField::Topic1, + crate::hypersync_net_types_capnp::LogField::Topic2 => LogField::Topic2, + crate::hypersync_net_types_capnp::LogField::Topic3 => LogField::Topic3, + } + } +} + +#[cfg(test)] +mod tests { + use hypersync_format::Hex; + + use super::*; + use crate::{query::tests::test_query_serde, FieldSelection, Query}; + + #[test] + fn test_all_fields_in_schema() { + let schema = hypersync_schema::log(); + let schema_fields = schema + .fields + .iter() + .map(|f| f.name.clone()) + .collect::>(); + let all_fields = LogField::all() + .into_iter() + .map(|f| f.as_ref().to_string()) + .collect::>(); + assert_eq!(schema_fields, all_fields); + } + + #[test] + fn test_serde_matches_strum() { + for field in LogField::all() { + let serialized = serde_json::to_string(&field).unwrap(); + let strum = serde_json::to_string(&field.as_ref()).unwrap(); + assert_eq!(serialized, strum, "strum value should be the same as serde"); + } + } + + #[test] + fn test_log_selection_serde_with_defaults() { + let log_selection = LogSelection::default(); + let field_selection = FieldSelection { + log: LogField::all(), + ..Default::default() + }; + let query = Query { + logs: vec![log_selection], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "log selection with defaults"); + } + + #[test] + fn test_log_selection_serde_with_full_values() { + let log_selection = LogFilter { + address: vec![ + Address::decode_hex("0xdadB0d80178819F2319190D340ce9A924f783711").unwrap(), + ], + address_filter: Some(FilterWrapper::new(16, 1)), + topics: { + let mut topics = ArrayVec::new(); + topics.push(vec![LogArgument::decode_hex( + "0x1234567890123456789012345678901234567890123456789012345678901234", + ) + .unwrap()]); + topics.push(vec![LogArgument::decode_hex( + "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd", + ) + .unwrap()]); + topics + }, + }; + let field_selection = FieldSelection { + log: LogField::all(), + ..Default::default() + }; + let query = Query { + logs: vec![log_selection.into()], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "log selection with full values"); + } +} diff --git a/hypersync-net-types/src/query.rs b/hypersync-net-types/src/query.rs new file mode 100644 index 0000000..5bd97dc --- /dev/null +++ b/hypersync-net-types/src/query.rs @@ -0,0 +1,552 @@ +use crate::block::{BlockField, BlockSelection}; +use crate::log::{LogField, LogSelection}; +use crate::trace::{TraceField, TraceSelection}; +use crate::transaction::{TransactionField, TransactionSelection}; +use crate::{hypersync_net_types_capnp, BuilderReader}; +use anyhow::Context; +use capnp::message::Builder; +use capnp::message::ReaderOptions; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeSet; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct Query { + /// The block to start the query from + pub from_block: u64, + /// The block to end the query at. If not specified, the query will go until the + /// end of data. Exclusive, the returned range will be [from_block..to_block). + /// + /// The query will return before it reaches this target block if it hits the time limit + /// configured on the server. The user should continue their query by putting the + /// next_block field in the response into from_block field of their next query. This implements + /// pagination. + #[serde(skip_serializing_if = "Option::is_none")] + pub to_block: Option, + /// List of log selections, these have an OR relationship between them, so the query will return logs + /// that match any of these selections. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub logs: Vec, + /// List of transaction selections, the query will return transactions that match any of these selections + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub transactions: Vec, + /// List of trace selections, the query will return traces that match any of these selections + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub traces: Vec, + /// List of block selections, the query will return blocks that match any of these selections + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub blocks: Vec, + /// Weather to include all blocks regardless of if they are related to a returned transaction or log. Normally + /// the server will return only the blocks that are related to the transaction or logs in the response. But if this + /// is set to true, the server will return data for all blocks in the requested range [from_block, to_block). + #[serde(default, skip_serializing_if = "is_default")] + pub include_all_blocks: bool, + /// Field selection. The user can select which fields they are interested in, requesting less fields will improve + /// query execution time and reduce the payload size so the user should always use a minimal number of fields. + #[serde(default, skip_serializing_if = "is_default")] + pub field_selection: FieldSelection, + /// Maximum number of blocks that should be returned, the server might return more blocks than this number but + /// it won't overshoot by too much. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max_num_blocks: Option, + /// Maximum number of transactions that should be returned, the server might return more transactions than this number but + /// it won't overshoot by too much. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max_num_transactions: Option, + /// Maximum number of logs that should be returned, the server might return more logs than this number but + /// it won't overshoot by too much. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max_num_logs: Option, + /// Maximum number of traces that should be returned, the server might return more traces than this number but + /// it won't overshoot by too much. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max_num_traces: Option, + /// Selects join mode for the query, + /// Default: join in this order logs -> transactions -> traces -> blocks + /// JoinAll: join everything to everything. For example if logSelection matches log0, we get the + /// associated transaction of log0 and then we get associated logs of that transaction as well. Applies similarly + /// to blocks, traces. + /// JoinNothing: join nothing. + #[serde(default, skip_serializing_if = "is_default")] + pub join_mode: JoinMode, +} + +/// Used to skip serializing a defaulted serde field if +/// the value matches the default value. +fn is_default(t: &T) -> bool { + t == &T::default() +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Copy)] +pub enum JoinMode { + /// Join in this order logs -> transactions -> traces -> blocks + Default, + /// Join everything to everything. For example if logSelection matches log0, we get the + /// associated transaction of log0 and then we get associated logs of that transaction as well. Applies similarly + /// to blocks, traces. + JoinAll, + /// JoinNothing: join nothing. + JoinNothing, +} + +impl Default for JoinMode { + fn default() -> Self { + Self::Default + } +} + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct FieldSelection { + #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] + pub block: BTreeSet, + #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] + pub transaction: BTreeSet, + #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] + pub log: BTreeSet, + #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] + pub trace: BTreeSet, +} + +impl Query { + pub fn to_bytes(&self) -> anyhow::Result> { + // Check compression.rs benchmarks + // regulas capnp bytes compresses better with zstd than + // capnp packed bytes + let capnp_bytes = self + .to_capnp_bytes() + .context("Failed converting query to capnp message")?; + + // ZSTD level 6 seems to have the best tradeoffs in terms of achieving + // a small payload, and being fast to decode once encoded. + let compressed_bytes = zstd::encode_all(capnp_bytes.as_slice(), 6) + .context("Failed compressing capnp message to bytes")?; + Ok(compressed_bytes) + } + + pub fn from_bytes(bytes: &[u8]) -> Result> { + // Check compression.rs benchmarks + let decompressed_bytes = zstd::decode_all(bytes)?; + let query = Query::from_capnp_bytes(&decompressed_bytes)?; + Ok(query) + } + + /// Serialize Query to Cap'n Proto format and return as bytes + pub fn to_capnp_bytes(&self) -> Result, capnp::Error> { + let mut message = Builder::new_default(); + let query = message.init_root::(); + + self.populate_capnp_query(query)?; + + let mut buf = Vec::new(); + capnp::serialize::write_message(&mut buf, &message)?; + Ok(buf) + } + + /// Deserialize Query from Cap'n Proto bytes + pub fn from_capnp_bytes(bytes: &[u8]) -> Result { + let message_reader = + capnp::serialize::read_message(&mut std::io::Cursor::new(bytes), ReaderOptions::new())?; + let query = message_reader.get_root::()?; + + Self::from_capnp_query(query) + } + /// Serialize using packed format (for testing) + pub fn to_capnp_bytes_packed(&self) -> Result, capnp::Error> { + let mut message = Builder::new_default(); + let query = message.init_root::(); + + self.populate_capnp_query(query)?; + + let mut buf = Vec::new(); + capnp::serialize_packed::write_message(&mut buf, &message)?; + Ok(buf) + } + + /// Deserialize using packed format (for testing) + pub fn from_capnp_bytes_packed(bytes: &[u8]) -> Result { + let message_reader = capnp::serialize_packed::read_message( + &mut std::io::Cursor::new(bytes), + ReaderOptions::new(), + )?; + let query = message_reader.get_root::()?; + + Self::from_capnp_query(query) + } + + fn populate_capnp_query( + &self, + mut query: hypersync_net_types_capnp::query::Builder, + ) -> Result<(), capnp::Error> { + let mut block_range_builder = query.reborrow().init_block_range(); + block_range_builder.set_from_block(self.from_block); + + if let Some(to_block) = self.to_block { + let mut to_block_builder = block_range_builder.reborrow().init_to_block(); + to_block_builder.set_value(to_block) + } + + // Hehe + let mut body_builder = query.reborrow().init_body(); + + body_builder + .reborrow() + .set_include_all_blocks(self.include_all_blocks); + + // Set max nums using OptUInt64 + if let Some(max_num_blocks) = self.max_num_blocks { + let mut max_blocks_builder = body_builder.reborrow().init_max_num_blocks(); + max_blocks_builder.set_value(max_num_blocks as u64); + } + if let Some(max_num_transactions) = self.max_num_transactions { + let mut max_tx_builder = body_builder.reborrow().init_max_num_transactions(); + max_tx_builder.set_value(max_num_transactions as u64); + } + if let Some(max_num_logs) = self.max_num_logs { + let mut max_logs_builder = body_builder.reborrow().init_max_num_logs(); + max_logs_builder.set_value(max_num_logs as u64); + } + if let Some(max_num_traces) = self.max_num_traces { + let mut max_traces_builder = body_builder.reborrow().init_max_num_traces(); + max_traces_builder.set_value(max_num_traces as u64); + } + + // Set join mode + let join_mode = match self.join_mode { + JoinMode::Default => hypersync_net_types_capnp::JoinMode::Default, + JoinMode::JoinAll => hypersync_net_types_capnp::JoinMode::JoinAll, + JoinMode::JoinNothing => hypersync_net_types_capnp::JoinMode::JoinNothing, + }; + body_builder.reborrow().set_join_mode(join_mode); + + // Set field selection + { + let mut field_selection = body_builder.reborrow().init_field_selection(); + + // Set block fields + let mut block_list = field_selection + .reborrow() + .init_block(self.field_selection.block.len() as u32); + for (i, field) in self.field_selection.block.iter().enumerate() { + block_list.set(i as u32, field.to_capnp()); + } + + // Set transaction fields + let mut tx_list = field_selection + .reborrow() + .init_transaction(self.field_selection.transaction.len() as u32); + for (i, field) in self.field_selection.transaction.iter().enumerate() { + tx_list.set(i as u32, field.to_capnp()); + } + + // Set log fields + let mut log_list = field_selection + .reborrow() + .init_log(self.field_selection.log.len() as u32); + for (i, field) in self.field_selection.log.iter().enumerate() { + log_list.set(i as u32, field.to_capnp()); + } + + // Set trace fields + let mut trace_list = field_selection + .reborrow() + .init_trace(self.field_selection.trace.len() as u32); + for (i, field) in self.field_selection.trace.iter().enumerate() { + trace_list.set(i as u32, field.to_capnp()); + } + } + + // Set logs + { + let mut logs_list = body_builder.reborrow().init_logs(self.logs.len() as u32); + for (i, log_selection) in self.logs.iter().enumerate() { + let mut log_sel = logs_list.reborrow().get(i as u32); + log_selection.populate_builder(&mut log_sel)?; + } + } + + // Set transactions + { + let mut tx_list = body_builder + .reborrow() + .init_transactions(self.transactions.len() as u32); + for (i, tx_selection) in self.transactions.iter().enumerate() { + let mut tx_sel = tx_list.reborrow().get(i as u32); + tx_selection.populate_builder(&mut tx_sel)?; + } + } + + // Set traces + { + let mut trace_list = body_builder + .reborrow() + .init_traces(self.traces.len() as u32); + for (i, trace_selection) in self.traces.iter().enumerate() { + let mut trace_sel = trace_list.reborrow().get(i as u32); + trace_selection.populate_builder(&mut trace_sel)?; + } + } + + // Set blocks + { + let mut block_list = body_builder + .reborrow() + .init_blocks(self.blocks.len() as u32); + for (i, block_selection) in self.blocks.iter().enumerate() { + let mut block_sel = block_list.reborrow().get(i as u32); + block_selection.populate_builder(&mut block_sel)?; + } + } + + Ok(()) + } + + fn from_capnp_query( + query: hypersync_net_types_capnp::query::Reader, + ) -> Result { + let block_range = query.get_block_range()?; + + let from_block = block_range.get_from_block(); + let to_block = if block_range.has_to_block() { + Some(block_range.get_to_block()?.get_value()) + } else { + None + }; + let body = query.get_body()?; + let include_all_blocks = body.get_include_all_blocks(); + + // Parse field selection + let field_selection = if body.has_field_selection() { + let fs = body.get_field_selection()?; + + let block_fields = if fs.has_block() { + let block_list = fs.get_block()?; + (0..block_list.len()) + .map(|i| block_list.get(i).map(BlockField::from_capnp)) + .collect::, capnp::NotInSchema>>()? + } else { + BTreeSet::new() + }; + + let transaction_fields = if fs.has_transaction() { + let tx_list = fs.get_transaction()?; + (0..tx_list.len()) + .map(|i| tx_list.get(i).map(TransactionField::from_capnp)) + .collect::, capnp::NotInSchema>>()? + } else { + BTreeSet::new() + }; + + let log_fields = if fs.has_log() { + let log_list = fs.get_log()?; + (0..log_list.len()) + .map(|i| log_list.get(i).map(LogField::from_capnp)) + .collect::, capnp::NotInSchema>>()? + } else { + BTreeSet::new() + }; + + let trace_fields = if fs.has_trace() { + let trace_list = fs.get_trace()?; + (0..trace_list.len()) + .map(|i| trace_list.get(i).map(TraceField::from_capnp)) + .collect::, capnp::NotInSchema>>()? + } else { + BTreeSet::new() + }; + + FieldSelection { + block: block_fields, + transaction: transaction_fields, + log: log_fields, + trace: trace_fields, + } + } else { + FieldSelection::default() + }; + + // Parse max values using OptUInt64 + let max_num_blocks = if body.has_max_num_blocks() { + let max_blocks_reader = body.get_max_num_blocks()?; + let value = max_blocks_reader.get_value(); + Some(value as usize) + } else { + None + }; + let max_num_transactions = if body.has_max_num_transactions() { + let max_tx_reader = body.get_max_num_transactions()?; + let value = max_tx_reader.get_value(); + Some(value as usize) + } else { + None + }; + let max_num_logs = if body.has_max_num_logs() { + let max_logs_reader = body.get_max_num_logs()?; + let value = max_logs_reader.get_value(); + Some(value as usize) + } else { + None + }; + let max_num_traces = if body.has_max_num_traces() { + let max_traces_reader = body.get_max_num_traces()?; + let value = max_traces_reader.get_value(); + Some(value as usize) + } else { + None + }; + + // Parse join mode + let join_mode = match body.get_join_mode()? { + hypersync_net_types_capnp::JoinMode::Default => JoinMode::Default, + hypersync_net_types_capnp::JoinMode::JoinAll => JoinMode::JoinAll, + hypersync_net_types_capnp::JoinMode::JoinNothing => JoinMode::JoinNothing, + }; + + // Parse selections + let logs = if body.has_logs() { + let logs_list = body.get_logs()?; + let mut logs = Vec::new(); + for i in 0..logs_list.len() { + let log_reader = logs_list.get(i); + logs.push(LogSelection::from_reader(log_reader)?); + } + logs + } else { + Vec::new() + }; + + let transactions = if body.has_transactions() { + let tx_list = body.get_transactions()?; + let mut transactions = Vec::new(); + for i in 0..tx_list.len() { + let tx_reader = tx_list.get(i); + transactions.push(TransactionSelection::from_reader(tx_reader)?); + } + transactions + } else { + Vec::new() + }; + + let traces = if body.has_traces() { + let traces_list = body.get_traces()?; + let mut traces = Vec::new(); + for i in 0..traces_list.len() { + let trace_reader = traces_list.get(i); + traces.push(TraceSelection::from_reader(trace_reader)?); + } + traces + } else { + Vec::new() + }; + + let blocks = if body.has_blocks() { + let blocks_list = body.get_blocks()?; + let mut blocks = Vec::new(); + for i in 0..blocks_list.len() { + let block_reader = blocks_list.get(i); + blocks.push(BlockSelection::from_reader(block_reader)?); + } + blocks + } else { + Vec::new() + }; + + Ok(Query { + from_block, + to_block, + logs, + transactions, + traces, + blocks, + include_all_blocks, + field_selection, + max_num_blocks, + max_num_transactions, + max_num_logs, + max_num_traces, + join_mode, + }) + } +} + +#[cfg(test)] +pub mod tests { + use super::*; + use pretty_assertions::assert_eq; + + pub fn test_query_serde(query: Query, label: &str) { + fn test_encode_decode( + input: &T, + label: String, + encode: impl FnOnce(&T) -> Vec, + decode: impl FnOnce(&[u8]) -> T, + ) { + let val = encode(input); + let decoded = decode(&val); + assert_eq!(input, &decoded, "{label} does not match"); + } + + test_encode_decode( + &query, + label.to_string() + "-capnp", + |q| q.to_capnp_bytes().unwrap(), + |bytes| Query::from_capnp_bytes(bytes).unwrap(), + ); + test_encode_decode( + &query, + label.to_string() + "-capnp-packed", + |q| q.to_capnp_bytes_packed().unwrap(), + |bytes| Query::from_capnp_bytes_packed(bytes).unwrap(), + ); + test_encode_decode( + &query, + label.to_string() + "-json", + |q| serde_json::to_vec(q).unwrap(), + |bytes| serde_json::from_slice(bytes).unwrap(), + ); + } + + #[test] + pub fn test_query_serde_default() { + let query = Query::default(); + test_query_serde(query, "default"); + } + + #[test] + pub fn test_query_serde_with_non_null_defaults() { + let query = Query { + from_block: u64::default(), + to_block: Some(u64::default()), + logs: Vec::default(), + transactions: Vec::default(), + traces: Vec::default(), + blocks: Vec::default(), + include_all_blocks: bool::default(), + field_selection: FieldSelection::default(), + max_num_blocks: Some(usize::default()), + max_num_transactions: Some(usize::default()), + max_num_logs: Some(usize::default()), + max_num_traces: Some(usize::default()), + join_mode: JoinMode::default(), + }; + test_query_serde(query, "base query with_non_null_defaults"); + } + + #[test] + pub fn test_query_serde_with_non_null_values() { + let query = Query { + from_block: 50, + to_block: Some(500), + logs: Vec::default(), + transactions: Vec::default(), + traces: Vec::default(), + blocks: Vec::default(), + include_all_blocks: true, + field_selection: FieldSelection::default(), + max_num_blocks: Some(50), + max_num_transactions: Some(100), + max_num_logs: Some(150), + max_num_traces: Some(200), + join_mode: JoinMode::JoinAll, + }; + test_query_serde(query, "base query with_non_null_values"); + } +} diff --git a/hypersync-net-types/src/response.rs b/hypersync-net-types/src/response.rs new file mode 100644 index 0000000..4082901 --- /dev/null +++ b/hypersync-net-types/src/response.rs @@ -0,0 +1,27 @@ +use hypersync_format::Hash; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Copy, Deserialize, Serialize, Debug)] +pub struct ArchiveHeight { + pub height: Option, +} + +#[derive(Clone, Copy, Deserialize, Serialize, Debug)] +pub struct ChainId { + pub chain_id: u64, +} + +/// Guard for detecting rollbacks +#[derive(Debug, Clone, Serialize)] +pub struct RollbackGuard { + /// Block number of last block scanned in memory + pub block_number: u64, + /// Block timestamp of last block scanned in memory + pub timestamp: i64, + /// Block hash of last block scanned in memory + pub hash: Hash, + /// Block number of first block scanned in memory + pub first_block_number: u64, + /// Parent hash of first block scanned in memory + pub first_parent_hash: Hash, +} diff --git a/hypersync-net-types/src/trace.rs b/hypersync-net-types/src/trace.rs new file mode 100644 index 0000000..7a579de --- /dev/null +++ b/hypersync-net-types/src/trace.rs @@ -0,0 +1,482 @@ +use crate::{hypersync_net_types_capnp, types::Sighash, BuilderReader, Selection}; +use hypersync_format::{Address, FilterWrapper}; +use serde::{Deserialize, Serialize}; + +pub type TraceSelection = Selection; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct TraceFilter { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub from: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub from_filter: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub to: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub to_filter: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub address: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub address_filter: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub call_type: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub reward_type: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[serde(rename = "type")] + pub type_: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sighash: Vec, +} + +impl BuilderReader for TraceFilter { + fn populate_builder( + &self, + builder: &mut hypersync_net_types_capnp::trace_filter::Builder, + ) -> Result<(), capnp::Error> { + // Set from addresses + if !self.from.is_empty() { + let mut from_list = builder.reborrow().init_from(self.from.len() as u32); + for (i, addr) in self.from.iter().enumerate() { + from_list.set(i as u32, addr.as_slice()); + } + } + + // Set from filter + if let Some(filter) = &self.from_filter { + builder.reborrow().set_from_filter(filter.0.as_bytes()); + } + + // Set to addresses + if !self.to.is_empty() { + let mut to_list = builder.reborrow().init_to(self.to.len() as u32); + for (i, addr) in self.to.iter().enumerate() { + to_list.set(i as u32, addr.as_slice()); + } + } + + // Set to filter + if let Some(filter) = &self.to_filter { + builder.reborrow().set_to_filter(filter.0.as_bytes()); + } + + // Set addresses + if !self.address.is_empty() { + let mut addr_list = builder.reborrow().init_address(self.address.len() as u32); + for (i, addr) in self.address.iter().enumerate() { + addr_list.set(i as u32, addr.as_slice()); + } + } + + // Set address filter + if let Some(filter) = &self.address_filter { + builder.reborrow().set_address_filter(filter.0.as_bytes()); + } + + // Set call types + if !self.call_type.is_empty() { + let mut call_type_list = builder + .reborrow() + .init_call_type(self.call_type.len() as u32); + for (i, call_type) in self.call_type.iter().enumerate() { + call_type_list.set(i as u32, call_type); + } + } + + // Set reward types + if !self.reward_type.is_empty() { + let mut reward_type_list = builder + .reborrow() + .init_reward_type(self.reward_type.len() as u32); + for (i, reward_type) in self.reward_type.iter().enumerate() { + reward_type_list.set(i as u32, reward_type); + } + } + + // Set types + if !self.type_.is_empty() { + let mut type_list = builder.reborrow().init_type(self.type_.len() as u32); + for (i, type_) in self.type_.iter().enumerate() { + type_list.set(i as u32, type_); + } + } + + // Set sighash + if !self.sighash.is_empty() { + let mut sighash_list = builder.reborrow().init_sighash(self.sighash.len() as u32); + for (i, sighash) in self.sighash.iter().enumerate() { + sighash_list.set(i as u32, sighash.as_slice()); + } + } + + Ok(()) + } + + /// Deserialize TraceSelection from Cap'n Proto reader + fn from_reader( + reader: hypersync_net_types_capnp::trace_filter::Reader, + ) -> Result { + let mut from = Vec::new(); + + // Parse from addresses + if reader.has_from() { + let from_list = reader.get_from()?; + for i in 0..from_list.len() { + let addr_data = from_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + from.push(Address::from(addr_bytes)); + } + } + } + + let mut from_filter = None; + + // Parse from filter + if reader.has_from_filter() { + let filter_data = reader.get_from_filter()?; + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed("Invalid from filter".to_string())); + }; + from_filter = Some(wrapper); + } + + let mut to = Vec::new(); + + // Parse to addresses + if reader.has_to() { + let to_list = reader.get_to()?; + for i in 0..to_list.len() { + let addr_data = to_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + to.push(Address::from(addr_bytes)); + } + } + } + + let mut to_filter = None; + + // Parse to filter + if reader.has_to_filter() { + let filter_data = reader.get_to_filter()?; + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed("Invalid to filter".to_string())); + }; + to_filter = Some(wrapper); + } + + let mut address = Vec::new(); + + // Parse addresses + if reader.has_address() { + let addr_list = reader.get_address()?; + for i in 0..addr_list.len() { + let addr_data = addr_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + address.push(Address::from(addr_bytes)); + } + } + } + + let mut address_filter = None; + + // Parse address filter + if reader.has_address_filter() { + let filter_data = reader.get_address_filter()?; + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed("Invalid address filter".to_string())); + }; + address_filter = Some(wrapper); + } + + let mut call_type = Vec::new(); + + // Parse call types + if reader.has_call_type() { + let call_type_list = reader.get_call_type()?; + for i in 0..call_type_list.len() { + let call_type_val = call_type_list.get(i)?; + call_type.push(call_type_val.to_string()?); + } + } + + let mut reward_type = Vec::new(); + // Parse reward types + if reader.has_reward_type() { + let reward_type_list = reader.get_reward_type()?; + for i in 0..reward_type_list.len() { + let reward_type_val = reward_type_list.get(i)?; + reward_type.push(reward_type_val.to_string()?); + } + } + + let mut type_ = Vec::new(); + + // Parse types + if reader.has_type() { + let type_list = reader.get_type()?; + for i in 0..type_list.len() { + let type_val = type_list.get(i)?; + type_.push(type_val.to_string()?); + } + } + + let mut sighash = Vec::new(); + + // Parse sighash + if reader.has_sighash() { + let sighash_list = reader.get_sighash()?; + for i in 0..sighash_list.len() { + let sighash_data = sighash_list.get(i)?; + if sighash_data.len() == 4 { + let mut sighash_bytes = [0u8; 4]; + sighash_bytes.copy_from_slice(sighash_data); + sighash.push(Sighash::from(sighash_bytes)); + } + } + } + + Ok(Self { + from, + from_filter, + to, + to_filter, + address, + address_filter, + call_type, + reward_type, + type_, + sighash, + }) + } +} + +#[derive( + Debug, + Clone, + Copy, + Serialize, + Deserialize, + PartialEq, + Eq, + schemars::JsonSchema, + strum_macros::EnumIter, + strum_macros::AsRefStr, + strum_macros::Display, + strum_macros::EnumString, +)] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum TraceField { + // Core trace fields + TransactionHash, + BlockHash, + BlockNumber, + TransactionPosition, + Type, + Error, + + // Address fields + From, + To, + Author, + + // Gas fields + Gas, + GasUsed, + + // Additional trace fields from Arrow schema + ActionAddress, + Address, + Balance, + CallType, + Code, + Init, + Input, + Output, + RefundAddress, + RewardType, + Sighash, + Subtraces, + TraceAddress, + Value, +} + +impl Ord for TraceField { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_ref().cmp(other.as_ref()) + } +} + +impl PartialOrd for TraceField { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl TraceField { + pub fn all() -> std::collections::BTreeSet { + use strum::IntoEnumIterator; + Self::iter().collect() + } + + /// Convert TraceField to Cap'n Proto enum + pub fn to_capnp(&self) -> crate::hypersync_net_types_capnp::TraceField { + match self { + TraceField::TransactionHash => { + crate::hypersync_net_types_capnp::TraceField::TransactionHash + } + TraceField::BlockHash => crate::hypersync_net_types_capnp::TraceField::BlockHash, + TraceField::BlockNumber => crate::hypersync_net_types_capnp::TraceField::BlockNumber, + TraceField::TransactionPosition => { + crate::hypersync_net_types_capnp::TraceField::TransactionPosition + } + TraceField::Type => crate::hypersync_net_types_capnp::TraceField::Type, + TraceField::Error => crate::hypersync_net_types_capnp::TraceField::Error, + TraceField::From => crate::hypersync_net_types_capnp::TraceField::From, + TraceField::To => crate::hypersync_net_types_capnp::TraceField::To, + TraceField::Author => crate::hypersync_net_types_capnp::TraceField::Author, + TraceField::Gas => crate::hypersync_net_types_capnp::TraceField::Gas, + TraceField::GasUsed => crate::hypersync_net_types_capnp::TraceField::GasUsed, + TraceField::ActionAddress => { + crate::hypersync_net_types_capnp::TraceField::ActionAddress + } + TraceField::Address => crate::hypersync_net_types_capnp::TraceField::Address, + TraceField::Balance => crate::hypersync_net_types_capnp::TraceField::Balance, + TraceField::CallType => crate::hypersync_net_types_capnp::TraceField::CallType, + TraceField::Code => crate::hypersync_net_types_capnp::TraceField::Code, + TraceField::Init => crate::hypersync_net_types_capnp::TraceField::Init, + TraceField::Input => crate::hypersync_net_types_capnp::TraceField::Input, + TraceField::Output => crate::hypersync_net_types_capnp::TraceField::Output, + TraceField::RefundAddress => { + crate::hypersync_net_types_capnp::TraceField::RefundAddress + } + TraceField::RewardType => crate::hypersync_net_types_capnp::TraceField::RewardType, + TraceField::Sighash => crate::hypersync_net_types_capnp::TraceField::Sighash, + TraceField::Subtraces => crate::hypersync_net_types_capnp::TraceField::Subtraces, + TraceField::TraceAddress => crate::hypersync_net_types_capnp::TraceField::TraceAddress, + TraceField::Value => crate::hypersync_net_types_capnp::TraceField::Value, + } + } + + /// Convert Cap'n Proto enum to TraceField + pub fn from_capnp(field: crate::hypersync_net_types_capnp::TraceField) -> Self { + match field { + crate::hypersync_net_types_capnp::TraceField::TransactionHash => { + TraceField::TransactionHash + } + crate::hypersync_net_types_capnp::TraceField::BlockHash => TraceField::BlockHash, + crate::hypersync_net_types_capnp::TraceField::BlockNumber => TraceField::BlockNumber, + crate::hypersync_net_types_capnp::TraceField::TransactionPosition => { + TraceField::TransactionPosition + } + crate::hypersync_net_types_capnp::TraceField::Type => TraceField::Type, + crate::hypersync_net_types_capnp::TraceField::Error => TraceField::Error, + crate::hypersync_net_types_capnp::TraceField::From => TraceField::From, + crate::hypersync_net_types_capnp::TraceField::To => TraceField::To, + crate::hypersync_net_types_capnp::TraceField::Author => TraceField::Author, + crate::hypersync_net_types_capnp::TraceField::Gas => TraceField::Gas, + crate::hypersync_net_types_capnp::TraceField::GasUsed => TraceField::GasUsed, + crate::hypersync_net_types_capnp::TraceField::ActionAddress => { + TraceField::ActionAddress + } + crate::hypersync_net_types_capnp::TraceField::Address => TraceField::Address, + crate::hypersync_net_types_capnp::TraceField::Balance => TraceField::Balance, + crate::hypersync_net_types_capnp::TraceField::CallType => TraceField::CallType, + crate::hypersync_net_types_capnp::TraceField::Code => TraceField::Code, + crate::hypersync_net_types_capnp::TraceField::Init => TraceField::Init, + crate::hypersync_net_types_capnp::TraceField::Input => TraceField::Input, + crate::hypersync_net_types_capnp::TraceField::Output => TraceField::Output, + crate::hypersync_net_types_capnp::TraceField::RefundAddress => { + TraceField::RefundAddress + } + crate::hypersync_net_types_capnp::TraceField::RewardType => TraceField::RewardType, + crate::hypersync_net_types_capnp::TraceField::Sighash => TraceField::Sighash, + crate::hypersync_net_types_capnp::TraceField::Subtraces => TraceField::Subtraces, + crate::hypersync_net_types_capnp::TraceField::TraceAddress => TraceField::TraceAddress, + crate::hypersync_net_types_capnp::TraceField::Value => TraceField::Value, + } + } +} + +#[cfg(test)] +mod tests { + use hypersync_format::Hex; + + use super::*; + use crate::{query::tests::test_query_serde, FieldSelection, Query}; + + #[test] + fn test_all_fields_in_schema() { + let schema = hypersync_schema::trace(); + let schema_fields = schema + .fields + .iter() + .map(|f| f.name.clone()) + .collect::>(); + let all_fields = TraceField::all() + .into_iter() + .map(|f| f.as_ref().to_string()) + .collect::>(); + assert_eq!(schema_fields, all_fields); + } + + #[test] + fn test_serde_matches_strum() { + for field in TraceField::all() { + let serialized = serde_json::to_string(&field).unwrap(); + let strum = serde_json::to_string(&field.as_ref()).unwrap(); + assert_eq!(serialized, strum, "strum value should be the same as serde"); + } + } + + #[test] + fn test_trace_filter_serde_with_defaults() { + let trace_filter = TraceSelection::default(); + let field_selection = FieldSelection { + trace: TraceField::all(), + ..Default::default() + }; + let query = Query { + traces: vec![trace_filter], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "trace selection with defaults"); + } + + #[test] + fn test_trace_filter_serde_with_full_values() { + let trace_filter = TraceFilter { + from: vec![Address::decode_hex("0xdadB0d80178819F2319190D340ce9A924f783711").unwrap()], + from_filter: Some(FilterWrapper::new(16, 1)), + to: vec![Address::decode_hex("0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6").unwrap()], + to_filter: Some(FilterWrapper::new(16, 1)), + address: vec![ + Address::decode_hex("0x1234567890123456789012345678901234567890").unwrap(), + ], + address_filter: Some(FilterWrapper::new(16, 1)), + call_type: vec!["call".to_string(), "create".to_string()], + reward_type: vec!["block".to_string(), "uncle".to_string()], + type_: vec!["call".to_string(), "create".to_string()], + sighash: vec![Sighash::from([0x12, 0x34, 0x56, 0x78])], + }; + let field_selection = FieldSelection { + trace: TraceField::all(), + ..Default::default() + }; + let query = Query { + traces: vec![trace_filter.into()], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "trace selection with full values"); + } +} diff --git a/hypersync-net-types/src/transaction.rs b/hypersync-net-types/src/transaction.rs new file mode 100644 index 0000000..e8ac933 --- /dev/null +++ b/hypersync-net-types/src/transaction.rs @@ -0,0 +1,824 @@ +use crate::{hypersync_net_types_capnp, types::Sighash, BuilderReader, Selection}; +use hypersync_format::{Address, FilterWrapper, Hash}; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct AuthorizationSelection { + /// List of chain ids to match in the transaction authorizationList + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub chain_id: Vec, + /// List of addresses to match in the transaction authorizationList + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub address: Vec
, +} +pub type TransactionSelection = Selection; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] +pub struct TransactionFilter { + /// Address the transaction should originate from. If transaction.from matches any of these, the transaction + /// will be returned. Keep in mind that this has an and relationship with to filter, so each transaction should + /// match both of them. Empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub from: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub from_filter: Option, + /// Address the transaction should go to. If transaction.to matches any of these, the transaction will + /// be returned. Keep in mind that this has an and relationship with from filter, so each transaction should + /// match both of them. Empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub to: Vec
, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub to_filter: Option, + /// If first 4 bytes of transaction input matches any of these, transaction will be returned. Empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub sighash: Vec, + /// If transaction.status matches this value, the transaction will be returned. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// If transaction.type matches any of these values, the transaction will be returned + #[serde(rename = "type")] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub type_: Vec, + /// If transaction.contract_address matches any of these values, the transaction will be returned. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub contract_address: Vec
, + /// Bloom filter to filter by transaction.contract_address field. If the bloom filter contains the hash + /// of transaction.contract_address then the transaction will be returned. This field doesn't utilize the server side filtering + /// so it should be used alongside some non-probabilistic filters if possible. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contract_address_filter: Option, + /// If transaction.hash matches any of these values the transaction will be returned. + /// empty means match all. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub hash: Vec, + + /// List of authorizations from eip-7702 transactions, the query will return transactions that match any of these selections + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub authorization_list: Vec, +} + +impl BuilderReader + for AuthorizationSelection +{ + fn populate_builder( + &self, + builder: &mut hypersync_net_types_capnp::authorization_selection::Builder, + ) -> Result<(), capnp::Error> { + // Set chain ids + if !self.chain_id.is_empty() { + let mut chain_list = builder.reborrow().init_chain_id(self.chain_id.len() as u32); + for (i, chain_id) in self.chain_id.iter().enumerate() { + chain_list.set(i as u32, *chain_id); + } + } + + // Set addresses + if !self.address.is_empty() { + let mut addr_list = builder.reborrow().init_address(self.address.len() as u32); + for (i, addr) in self.address.iter().enumerate() { + addr_list.set(i as u32, addr.as_slice()); + } + } + + Ok(()) + } + + /// Deserialize AuthorizationSelection from Cap'n Proto reader + fn from_reader( + reader: hypersync_net_types_capnp::authorization_selection::Reader, + ) -> Result { + let mut auth_selection = AuthorizationSelection::default(); + + // Parse chain ids + if reader.has_chain_id() { + let chain_list = reader.get_chain_id()?; + for i in 0..chain_list.len() { + auth_selection.chain_id.push(chain_list.get(i)); + } + } + + // Parse addresses + if reader.has_address() { + let addr_list = reader.get_address()?; + for i in 0..addr_list.len() { + let addr_data = addr_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + auth_selection.address.push(Address::from(addr_bytes)); + } + } + } + + Ok(auth_selection) + } +} + +impl BuilderReader for TransactionFilter { + fn populate_builder( + &self, + builder: &mut hypersync_net_types_capnp::transaction_filter::Builder, + ) -> Result<(), capnp::Error> { + // Set from addresses + if !self.from.is_empty() { + let mut from_list = builder.reborrow().init_from(self.from.len() as u32); + for (i, addr) in self.from.iter().enumerate() { + from_list.set(i as u32, addr.as_slice()); + } + } + + // Set from filter + if let Some(filter) = &self.from_filter { + builder.reborrow().set_from_filter(filter.0.as_bytes()); + } + + // Set to addresses + if !self.to.is_empty() { + let mut to_list = builder.reborrow().init_to(self.to.len() as u32); + for (i, addr) in self.to.iter().enumerate() { + to_list.set(i as u32, addr.as_slice()); + } + } + + // Set to filter + if let Some(filter) = &self.to_filter { + builder.reborrow().set_to_filter(filter.0.as_bytes()); + } + + // Set sighash + if !self.sighash.is_empty() { + let mut sighash_list = builder.reborrow().init_sighash(self.sighash.len() as u32); + for (i, sighash) in self.sighash.iter().enumerate() { + sighash_list.set(i as u32, sighash.as_slice()); + } + } + + // Set status + if let Some(status) = self.status { + let mut status_builder = builder.reborrow().init_status(); + status_builder.set_value(status); + } + + // Set type + if !self.type_.is_empty() { + let mut type_list = builder.reborrow().init_type(self.type_.len() as u32); + for (i, type_) in self.type_.iter().enumerate() { + type_list.set(i as u32, *type_); + } + } + + // Set contract addresses + if !self.contract_address.is_empty() { + let mut contract_list = builder + .reborrow() + .init_contract_address(self.contract_address.len() as u32); + for (i, addr) in self.contract_address.iter().enumerate() { + contract_list.set(i as u32, addr.as_slice()); + } + } + + // Set contract address filter + if let Some(filter) = &self.contract_address_filter { + builder + .reborrow() + .set_contract_address_filter(filter.0.as_bytes()); + } + + // Set hashes + if !self.hash.is_empty() { + let mut hash_list = builder.reborrow().init_hash(self.hash.len() as u32); + for (i, hash) in self.hash.iter().enumerate() { + hash_list.set(i as u32, hash.as_slice()); + } + } + + // Set authorization list + if !self.authorization_list.is_empty() { + let mut auth_list = builder + .reborrow() + .init_authorization_list(self.authorization_list.len() as u32); + for (i, auth_sel) in self.authorization_list.iter().enumerate() { + let mut auth_builder = auth_list.reborrow().get(i as u32); + AuthorizationSelection::populate_builder(auth_sel, &mut auth_builder)?; + } + } + + Ok(()) + } + + /// Deserialize TransactionSelection from Cap'n Proto reader + fn from_reader( + reader: hypersync_net_types_capnp::transaction_filter::Reader, + ) -> Result { + let mut from = Vec::new(); + + // Parse from addresses + if reader.has_from() { + let from_list = reader.get_from()?; + for i in 0..from_list.len() { + let addr_data = from_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + from.push(Address::from(addr_bytes)); + } + } + } + + let mut from_filter = None; + + // Parse from filter + if reader.has_from_filter() { + let filter_data = reader.get_from_filter()?; + // For now, skip filter deserialization - this would need proper Filter construction + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed("Invalid from filter".to_string())); + }; + from_filter = Some(wrapper); + } + + let mut to = Vec::new(); + + // Parse to addresses + if reader.has_to() { + let to_list = reader.get_to()?; + for i in 0..to_list.len() { + let addr_data = to_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + to.push(Address::from(addr_bytes)); + } + } + } + + let mut to_filter = None; + + // Parse to filter + if reader.has_to_filter() { + let filter_data = reader.get_to_filter()?; + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed("Invalid to filter".to_string())); + }; + to_filter = Some(wrapper); + } + + let mut sighash = Vec::new(); + + // Parse sighash + if reader.has_sighash() { + let sighash_list = reader.get_sighash()?; + for i in 0..sighash_list.len() { + let sighash_data = sighash_list.get(i)?; + if sighash_data.len() == 4 { + let mut sighash_bytes = [0u8; 4]; + sighash_bytes.copy_from_slice(sighash_data); + sighash.push(Sighash::from(sighash_bytes)); + } + } + } + + // Parse status + let mut status = None; + if reader.has_status() { + let status_reader = reader.get_status()?; + status = Some(status_reader.get_value()); + } + + let mut type_ = Vec::new(); + + // Parse type + if reader.has_type() { + let type_list = reader.get_type()?; + for i in 0..type_list.len() { + type_.push(type_list.get(i)); + } + } + + let mut contract_address = Vec::new(); + // Parse contract addresses + if reader.has_contract_address() { + let contract_list = reader.get_contract_address()?; + for i in 0..contract_list.len() { + let addr_data = contract_list.get(i)?; + if addr_data.len() == 20 { + let mut addr_bytes = [0u8; 20]; + addr_bytes.copy_from_slice(addr_data); + contract_address.push(Address::from(addr_bytes)); + } + } + } + + let mut contract_address_filter = None; + + // Parse contract address filter + if reader.has_contract_address_filter() { + let filter_data = reader.get_contract_address_filter()?; + let Ok(wrapper) = FilterWrapper::from_bytes(filter_data) else { + return Err(capnp::Error::failed( + "Invalid contract address filter".to_string(), + )); + }; + contract_address_filter = Some(wrapper); + } + + let mut hash = Vec::new(); + + // Parse hashes + if reader.has_hash() { + let hash_list = reader.get_hash()?; + for i in 0..hash_list.len() { + let hash_data = hash_list.get(i)?; + if hash_data.len() == 32 { + let mut hash_bytes = [0u8; 32]; + hash_bytes.copy_from_slice(hash_data); + hash.push(Hash::from(hash_bytes)); + } + } + } + + let mut authorization_list = Vec::new(); + + // Parse authorization list + if reader.has_authorization_list() { + let auth_list = reader.get_authorization_list()?; + for i in 0..auth_list.len() { + let auth_reader = auth_list.get(i); + let auth_selection = AuthorizationSelection::from_reader(auth_reader)?; + authorization_list.push(auth_selection); + } + } + + Ok(Self { + from, + from_filter, + to, + to_filter, + sighash, + status, + type_, + contract_address, + contract_address_filter, + hash, + authorization_list, + }) + } +} + +#[derive( + Debug, + Clone, + Copy, + Serialize, + Deserialize, + PartialEq, + Eq, + schemars::JsonSchema, + strum_macros::EnumIter, + strum_macros::AsRefStr, + strum_macros::Display, + strum_macros::EnumString, +)] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum TransactionField { + // Non-nullable fields (required) + BlockHash, + BlockNumber, + Gas, + Hash, + Input, + Nonce, + TransactionIndex, + Value, + CumulativeGasUsed, + EffectiveGasPrice, + GasUsed, + LogsBloom, + + // Nullable fields (optional) + From, + GasPrice, + To, + V, + R, + S, + MaxPriorityFeePerGas, + MaxFeePerGas, + ChainId, + ContractAddress, + Type, + Root, + Status, + YParity, + AccessList, + AuthorizationList, + L1Fee, + L1GasPrice, + L1GasUsed, + L1FeeScalar, + GasUsedForL1, + MaxFeePerBlobGas, + BlobVersionedHashes, + BlobGasPrice, + BlobGasUsed, + DepositNonce, + DepositReceiptVersion, + L1BaseFeeScalar, + L1BlobBaseFee, + L1BlobBaseFeeScalar, + L1BlockNumber, + Mint, + Sighash, + SourceHash, +} + +impl Ord for TransactionField { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_ref().cmp(other.as_ref()) + } +} + +impl PartialOrd for TransactionField { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl TransactionField { + pub fn all() -> std::collections::BTreeSet { + use strum::IntoEnumIterator; + Self::iter().collect() + } + + /// Convert TransactionField to Cap'n Proto enum + pub fn to_capnp(&self) -> crate::hypersync_net_types_capnp::TransactionField { + match self { + TransactionField::BlockHash => { + crate::hypersync_net_types_capnp::TransactionField::BlockHash + } + TransactionField::BlockNumber => { + crate::hypersync_net_types_capnp::TransactionField::BlockNumber + } + TransactionField::Gas => crate::hypersync_net_types_capnp::TransactionField::Gas, + TransactionField::Hash => crate::hypersync_net_types_capnp::TransactionField::Hash, + TransactionField::Input => crate::hypersync_net_types_capnp::TransactionField::Input, + TransactionField::Nonce => crate::hypersync_net_types_capnp::TransactionField::Nonce, + TransactionField::TransactionIndex => { + crate::hypersync_net_types_capnp::TransactionField::TransactionIndex + } + TransactionField::Value => crate::hypersync_net_types_capnp::TransactionField::Value, + TransactionField::CumulativeGasUsed => { + crate::hypersync_net_types_capnp::TransactionField::CumulativeGasUsed + } + TransactionField::EffectiveGasPrice => { + crate::hypersync_net_types_capnp::TransactionField::EffectiveGasPrice + } + TransactionField::GasUsed => { + crate::hypersync_net_types_capnp::TransactionField::GasUsed + } + TransactionField::LogsBloom => { + crate::hypersync_net_types_capnp::TransactionField::LogsBloom + } + TransactionField::From => crate::hypersync_net_types_capnp::TransactionField::From, + TransactionField::GasPrice => { + crate::hypersync_net_types_capnp::TransactionField::GasPrice + } + TransactionField::To => crate::hypersync_net_types_capnp::TransactionField::To, + TransactionField::V => crate::hypersync_net_types_capnp::TransactionField::V, + TransactionField::R => crate::hypersync_net_types_capnp::TransactionField::R, + TransactionField::S => crate::hypersync_net_types_capnp::TransactionField::S, + TransactionField::MaxPriorityFeePerGas => { + crate::hypersync_net_types_capnp::TransactionField::MaxPriorityFeePerGas + } + TransactionField::MaxFeePerGas => { + crate::hypersync_net_types_capnp::TransactionField::MaxFeePerGas + } + TransactionField::ChainId => { + crate::hypersync_net_types_capnp::TransactionField::ChainId + } + TransactionField::ContractAddress => { + crate::hypersync_net_types_capnp::TransactionField::ContractAddress + } + TransactionField::Type => crate::hypersync_net_types_capnp::TransactionField::Type, + TransactionField::Root => crate::hypersync_net_types_capnp::TransactionField::Root, + TransactionField::Status => crate::hypersync_net_types_capnp::TransactionField::Status, + TransactionField::YParity => { + crate::hypersync_net_types_capnp::TransactionField::YParity + } + TransactionField::AccessList => { + crate::hypersync_net_types_capnp::TransactionField::AccessList + } + TransactionField::AuthorizationList => { + crate::hypersync_net_types_capnp::TransactionField::AuthorizationList + } + TransactionField::L1Fee => crate::hypersync_net_types_capnp::TransactionField::L1Fee, + TransactionField::L1GasPrice => { + crate::hypersync_net_types_capnp::TransactionField::L1GasPrice + } + TransactionField::L1GasUsed => { + crate::hypersync_net_types_capnp::TransactionField::L1GasUsed + } + TransactionField::L1FeeScalar => { + crate::hypersync_net_types_capnp::TransactionField::L1FeeScalar + } + TransactionField::GasUsedForL1 => { + crate::hypersync_net_types_capnp::TransactionField::GasUsedForL1 + } + TransactionField::MaxFeePerBlobGas => { + crate::hypersync_net_types_capnp::TransactionField::MaxFeePerBlobGas + } + TransactionField::BlobVersionedHashes => { + crate::hypersync_net_types_capnp::TransactionField::BlobVersionedHashes + } + TransactionField::BlobGasPrice => { + crate::hypersync_net_types_capnp::TransactionField::BlobGasPrice + } + TransactionField::BlobGasUsed => { + crate::hypersync_net_types_capnp::TransactionField::BlobGasUsed + } + TransactionField::DepositNonce => { + crate::hypersync_net_types_capnp::TransactionField::DepositNonce + } + TransactionField::DepositReceiptVersion => { + crate::hypersync_net_types_capnp::TransactionField::DepositReceiptVersion + } + TransactionField::L1BaseFeeScalar => { + crate::hypersync_net_types_capnp::TransactionField::L1BaseFeeScalar + } + TransactionField::L1BlobBaseFee => { + crate::hypersync_net_types_capnp::TransactionField::L1BlobBaseFee + } + TransactionField::L1BlobBaseFeeScalar => { + crate::hypersync_net_types_capnp::TransactionField::L1BlobBaseFeeScalar + } + TransactionField::L1BlockNumber => { + crate::hypersync_net_types_capnp::TransactionField::L1BlockNumber + } + TransactionField::Mint => crate::hypersync_net_types_capnp::TransactionField::Mint, + TransactionField::Sighash => { + crate::hypersync_net_types_capnp::TransactionField::Sighash + } + TransactionField::SourceHash => { + crate::hypersync_net_types_capnp::TransactionField::SourceHash + } + } + } + + /// Convert Cap'n Proto enum to TransactionField + pub fn from_capnp(field: crate::hypersync_net_types_capnp::TransactionField) -> Self { + match field { + crate::hypersync_net_types_capnp::TransactionField::BlockHash => { + TransactionField::BlockHash + } + crate::hypersync_net_types_capnp::TransactionField::BlockNumber => { + TransactionField::BlockNumber + } + crate::hypersync_net_types_capnp::TransactionField::Gas => TransactionField::Gas, + crate::hypersync_net_types_capnp::TransactionField::Hash => TransactionField::Hash, + crate::hypersync_net_types_capnp::TransactionField::Input => TransactionField::Input, + crate::hypersync_net_types_capnp::TransactionField::Nonce => TransactionField::Nonce, + crate::hypersync_net_types_capnp::TransactionField::TransactionIndex => { + TransactionField::TransactionIndex + } + crate::hypersync_net_types_capnp::TransactionField::Value => TransactionField::Value, + crate::hypersync_net_types_capnp::TransactionField::CumulativeGasUsed => { + TransactionField::CumulativeGasUsed + } + crate::hypersync_net_types_capnp::TransactionField::EffectiveGasPrice => { + TransactionField::EffectiveGasPrice + } + crate::hypersync_net_types_capnp::TransactionField::GasUsed => { + TransactionField::GasUsed + } + crate::hypersync_net_types_capnp::TransactionField::LogsBloom => { + TransactionField::LogsBloom + } + crate::hypersync_net_types_capnp::TransactionField::From => TransactionField::From, + crate::hypersync_net_types_capnp::TransactionField::GasPrice => { + TransactionField::GasPrice + } + crate::hypersync_net_types_capnp::TransactionField::To => TransactionField::To, + crate::hypersync_net_types_capnp::TransactionField::V => TransactionField::V, + crate::hypersync_net_types_capnp::TransactionField::R => TransactionField::R, + crate::hypersync_net_types_capnp::TransactionField::S => TransactionField::S, + crate::hypersync_net_types_capnp::TransactionField::MaxPriorityFeePerGas => { + TransactionField::MaxPriorityFeePerGas + } + crate::hypersync_net_types_capnp::TransactionField::MaxFeePerGas => { + TransactionField::MaxFeePerGas + } + crate::hypersync_net_types_capnp::TransactionField::ChainId => { + TransactionField::ChainId + } + crate::hypersync_net_types_capnp::TransactionField::ContractAddress => { + TransactionField::ContractAddress + } + crate::hypersync_net_types_capnp::TransactionField::Type => TransactionField::Type, + crate::hypersync_net_types_capnp::TransactionField::Root => TransactionField::Root, + crate::hypersync_net_types_capnp::TransactionField::Status => TransactionField::Status, + crate::hypersync_net_types_capnp::TransactionField::YParity => { + TransactionField::YParity + } + crate::hypersync_net_types_capnp::TransactionField::AccessList => { + TransactionField::AccessList + } + crate::hypersync_net_types_capnp::TransactionField::AuthorizationList => { + TransactionField::AuthorizationList + } + crate::hypersync_net_types_capnp::TransactionField::L1Fee => TransactionField::L1Fee, + crate::hypersync_net_types_capnp::TransactionField::L1GasPrice => { + TransactionField::L1GasPrice + } + crate::hypersync_net_types_capnp::TransactionField::L1GasUsed => { + TransactionField::L1GasUsed + } + crate::hypersync_net_types_capnp::TransactionField::L1FeeScalar => { + TransactionField::L1FeeScalar + } + crate::hypersync_net_types_capnp::TransactionField::GasUsedForL1 => { + TransactionField::GasUsedForL1 + } + crate::hypersync_net_types_capnp::TransactionField::MaxFeePerBlobGas => { + TransactionField::MaxFeePerBlobGas + } + crate::hypersync_net_types_capnp::TransactionField::BlobVersionedHashes => { + TransactionField::BlobVersionedHashes + } + crate::hypersync_net_types_capnp::TransactionField::BlobGasPrice => { + TransactionField::BlobGasPrice + } + crate::hypersync_net_types_capnp::TransactionField::BlobGasUsed => { + TransactionField::BlobGasUsed + } + crate::hypersync_net_types_capnp::TransactionField::DepositNonce => { + TransactionField::DepositNonce + } + crate::hypersync_net_types_capnp::TransactionField::DepositReceiptVersion => { + TransactionField::DepositReceiptVersion + } + crate::hypersync_net_types_capnp::TransactionField::L1BaseFeeScalar => { + TransactionField::L1BaseFeeScalar + } + crate::hypersync_net_types_capnp::TransactionField::L1BlobBaseFee => { + TransactionField::L1BlobBaseFee + } + crate::hypersync_net_types_capnp::TransactionField::L1BlobBaseFeeScalar => { + TransactionField::L1BlobBaseFeeScalar + } + crate::hypersync_net_types_capnp::TransactionField::L1BlockNumber => { + TransactionField::L1BlockNumber + } + crate::hypersync_net_types_capnp::TransactionField::Mint => TransactionField::Mint, + crate::hypersync_net_types_capnp::TransactionField::Sighash => { + TransactionField::Sighash + } + crate::hypersync_net_types_capnp::TransactionField::SourceHash => { + TransactionField::SourceHash + } + } + } +} + +#[cfg(test)] +mod tests { + use hypersync_format::Hex; + + use super::*; + use crate::{query::tests::test_query_serde, FieldSelection, Query}; + + #[test] + fn test_all_fields_in_schema() { + let schema = hypersync_schema::transaction(); + let schema_fields = schema + .fields + .iter() + .map(|f| f.name.clone()) + .collect::>(); + let all_fields = TransactionField::all() + .into_iter() + .map(|f| f.as_ref().to_string()) + .collect::>(); + assert_eq!(schema_fields, all_fields); + } + + #[test] + fn test_serde_matches_strum() { + for field in TransactionField::all() { + let serialized = serde_json::to_string(&field).unwrap(); + let strum = serde_json::to_string(&field.as_ref()).unwrap(); + assert_eq!(serialized, strum, "strum value should be the same as serde"); + } + } + + #[test] + fn test_transaction_filter_serde_with_defaults() { + let transaction_filter = TransactionSelection::default(); + let field_selection = FieldSelection { + transaction: TransactionField::all(), + ..Default::default() + }; + let query = Query { + transactions: vec![transaction_filter], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "transaction selection with defaults"); + } + #[test] + fn test_transaction_filter_serde_with_explicit_defaults() { + let transaction_filter = TransactionFilter { + from: Vec::default(), + from_filter: Some(FilterWrapper::new(16, 0)), + to: Vec::default(), + to_filter: Some(FilterWrapper::new(16, 0)), + sighash: Vec::default(), + status: Some(u8::default()), + type_: Vec::default(), + contract_address: Vec::default(), + contract_address_filter: Some(FilterWrapper::new(16, 0)), + hash: Vec::default(), + authorization_list: Vec::default(), + }; + let field_selection = FieldSelection { + transaction: TransactionField::all(), + ..Default::default() + }; + let query = Query { + transactions: vec![transaction_filter.into()], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "transaction selection with explicit defaults"); + } + + #[test] + fn test_transaction_filter_serde_with_full_values() { + let transaction_filter = TransactionFilter { + from: vec![Address::decode_hex("0xdadB0d80178819F2319190D340ce9A924f783711").unwrap()], + from_filter: Some(FilterWrapper::new(16, 1)), + to: vec![Address::decode_hex("0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6").unwrap()], + to_filter: Some(FilterWrapper::new(16, 1)), + sighash: vec![Sighash::from([0x12, 0x34, 0x56, 0x78])], + status: Some(1), + type_: vec![2], + contract_address: vec![Address::decode_hex( + "0x1234567890123456789012345678901234567890", + ) + .unwrap()], + contract_address_filter: Some(FilterWrapper::new(16, 1)), + hash: vec![Hash::decode_hex( + "0x40d008f2a1653f09b7b028d30c7fd1ba7c84900fcfb032040b3eb3d16f84d294", + ) + .unwrap()], + authorization_list: Vec::default(), + }; + let field_selection = FieldSelection { + transaction: TransactionField::all(), + ..Default::default() + }; + let query = Query { + transactions: vec![transaction_filter.into()], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "transaction selection with full values"); + } + + #[test] + fn test_authorization_selection_serde_with_values() { + let auth_selection = AuthorizationSelection { + chain_id: vec![1, 137, 42161], + address: vec![ + Address::decode_hex("0xdadB0d80178819F2319190D340ce9A924f783711").unwrap(), + ], + }; + let transaction_filter = TransactionFilter { + from: Vec::default(), + from_filter: Some(FilterWrapper::new(16, 0)), + to: Vec::default(), + to_filter: Some(FilterWrapper::new(16, 0)), + sighash: Vec::default(), + status: Some(u8::default()), + type_: Vec::default(), + contract_address: Vec::default(), + contract_address_filter: Some(FilterWrapper::new(16, 0)), + hash: Vec::default(), + authorization_list: vec![auth_selection], + }; + let field_selection = FieldSelection { + transaction: TransactionField::all(), + ..Default::default() + }; + let query = Query { + transactions: vec![transaction_filter.into()], + field_selection, + ..Default::default() + }; + + test_query_serde(query, "authorization selection with rest defaults"); + } +} diff --git a/hypersync-net-types/src/types.rs b/hypersync-net-types/src/types.rs new file mode 100644 index 0000000..b6116d1 --- /dev/null +++ b/hypersync-net-types/src/types.rs @@ -0,0 +1,3 @@ +use hypersync_format::FixedSizeData; + +pub type Sighash = FixedSizeData<4>;