diff --git a/Cargo.lock b/Cargo.lock index 562dfaa09..4629da16d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1373,6 +1373,12 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + [[package]] name = "flate2" version = "1.0.20" @@ -2589,6 +2595,12 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "native-tls" version = "0.2.7" @@ -3002,6 +3014,16 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "petgraph" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pickledb" version = "0.4.1" @@ -3196,6 +3218,24 @@ dependencies = [ "prost-derive", ] +[[package]] +name = "prost-build" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" +dependencies = [ + "bytes 1.0.1", + "heck", + "itertools 0.10.1", + "log 0.4.14", + "multimap", + "petgraph", + "prost", + "prost-types", + "tempfile", + "which", +] + [[package]] name = "prost-derive" version = "0.8.0" @@ -5585,6 +5625,7 @@ dependencies = [ "solana-account-decoder", "solana-sdk", "solana-transaction-status", + "tonic-build", ] [[package]] @@ -6631,6 +6672,18 @@ dependencies = [ "tracing-futures", ] +[[package]] +name = "tonic-build" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386" +dependencies = [ + "proc-macro2 1.0.24", + "prost-build", + "quote 1.0.6", + "syn 1.0.67", +] + [[package]] name = "tower" version = "0.4.8" @@ -7129,6 +7182,16 @@ dependencies = [ "tokio-tls", ] +[[package]] +name = "which" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" +dependencies = [ + "libc", + "thiserror", +] + [[package]] name = "winapi" version = "0.2.8" diff --git a/storage-bigtable/src/access_token.rs b/storage-bigtable/src/access_token.rs index 60335b802..e73962b2b 100644 --- a/storage-bigtable/src/access_token.rs +++ b/storage-bigtable/src/access_token.rs @@ -1,16 +1,18 @@ /// A module for managing a Google API access token -use goauth::{ - auth::{JwtClaims, Token}, - credentials::Credentials, -}; -use log::*; -use smpl_jwt::Jwt; -use std::{ - sync::{ - atomic::{AtomicBool, Ordering}, - {Arc, RwLock}, +use { + goauth::{ + auth::{JwtClaims, Token}, + credentials::Credentials, + }, + log::*, + smpl_jwt::Jwt, + std::{ + sync::{ + atomic::{AtomicBool, Ordering}, + {Arc, RwLock}, + }, + time::Instant, }, - time::Instant, }; pub use goauth::scopes::Scope; diff --git a/storage-bigtable/src/bigtable.rs b/storage-bigtable/src/bigtable.rs index 3e4e142a6..a3d4b172d 100644 --- a/storage-bigtable/src/bigtable.rs +++ b/storage-bigtable/src/bigtable.rs @@ -1,16 +1,18 @@ // Primitives for reading/writing BigTable tables -use crate::{ - access_token::{AccessToken, Scope}, - compression::{compress_best, decompress}, - root_ca_certificate, -}; -use log::*; -use std::time::{Duration, Instant}; -use thiserror::Error; -use tonic::{ - codegen::InterceptedService, metadata::MetadataValue, transport::ClientTlsConfig, Request, - Status, +use { + crate::{ + access_token::{AccessToken, Scope}, + compression::{compress_best, decompress}, + root_ca_certificate, + }, + log::*, + std::time::{Duration, Instant}, + thiserror::Error, + tonic::{ + codegen::InterceptedService, metadata::MetadataValue, transport::ClientTlsConfig, Request, + Status, + }, }; mod google { diff --git a/storage-bigtable/src/compression.rs b/storage-bigtable/src/compression.rs index adb0afee0..a2e5bda94 100644 --- a/storage-bigtable/src/compression.rs +++ b/storage-bigtable/src/compression.rs @@ -1,5 +1,7 @@ -use enum_iterator::IntoEnumIterator; -use std::io::{self, BufReader, Read, Write}; +use { + enum_iterator::IntoEnumIterator, + std::io::{self, BufReader, Read, Write}, +}; #[derive(Debug, Serialize, Deserialize, IntoEnumIterator)] pub enum CompressionMethod { diff --git a/storage-bigtable/src/lib.rs b/storage-bigtable/src/lib.rs index 254c9406f..fe99b994d 100644 --- a/storage-bigtable/src/lib.rs +++ b/storage-bigtable/src/lib.rs @@ -1,23 +1,24 @@ #![allow(clippy::integer_arithmetic)] -use log::*; -use serde::{Deserialize, Serialize}; -use solana_sdk::{ - clock::{Slot, UnixTimestamp}, - deserialize_utils::default_on_eof, - pubkey::Pubkey, - signature::Signature, - sysvar::is_sysvar_id, - transaction::{Transaction, TransactionError}, +use { + log::*, + serde::{Deserialize, Serialize}, + solana_sdk::{ + clock::{Slot, UnixTimestamp}, + deserialize_utils::default_on_eof, + pubkey::Pubkey, + signature::Signature, + sysvar::is_sysvar_id, + transaction::{Transaction, TransactionError}, + }, + solana_storage_proto::convert::{generated, tx_by_addr}, + solana_transaction_status::{ + ConfirmedBlock, ConfirmedTransaction, ConfirmedTransactionStatusWithSignature, Reward, + TransactionByAddrInfo, TransactionConfirmationStatus, TransactionStatus, + TransactionStatusMeta, TransactionWithStatusMeta, + }, + std::{collections::HashMap, convert::TryInto}, + thiserror::Error, }; -use solana_storage_proto::convert::generated; -use solana_storage_proto::convert::tx_by_addr; -use solana_transaction_status::{ - ConfirmedBlock, ConfirmedTransaction, ConfirmedTransactionStatusWithSignature, Reward, - TransactionByAddrInfo, TransactionConfirmationStatus, TransactionStatus, TransactionStatusMeta, - TransactionWithStatusMeta, -}; -use std::{collections::HashMap, convert::TryInto}; -use thiserror::Error; #[macro_use] extern crate serde_derive; diff --git a/storage-bigtable/src/root_ca_certificate.rs b/storage-bigtable/src/root_ca_certificate.rs index e0d43231d..80147dd3f 100644 --- a/storage-bigtable/src/root_ca_certificate.rs +++ b/storage-bigtable/src/root_ca_certificate.rs @@ -1,5 +1,7 @@ -use std::{fs::File, io::Read}; -use tonic::transport::Certificate; +use { + std::{fs::File, io::Read}, + tonic::transport::Certificate, +}; pub fn load() -> Result { // Respect the standard GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable if present, diff --git a/storage-proto/.gitignore b/storage-proto/.gitignore new file mode 100644 index 000000000..65d7bf492 --- /dev/null +++ b/storage-proto/.gitignore @@ -0,0 +1 @@ +proto/ diff --git a/storage-proto/Cargo.toml b/storage-proto/Cargo.toml index 0f52de8e1..edf418b9a 100644 --- a/storage-proto/Cargo.toml +++ b/storage-proto/Cargo.toml @@ -25,3 +25,6 @@ name = "solana_storage_proto" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[build-dependencies] +tonic-build = "0.5.0" diff --git a/storage-proto/README.md b/storage-proto/README.md new file mode 100644 index 000000000..7dc760e01 --- /dev/null +++ b/storage-proto/README.md @@ -0,0 +1,5 @@ +# Storage Protobufs + +The `solana-storage-proto` structs used in `src/convert.rs` and elsewhere are +auto-generated from protobuf definitions on build. To update these structs, +simply make the desired edits to `src/*.proto` files. diff --git a/storage-proto/build-proto/.gitignore b/storage-proto/build-proto/.gitignore deleted file mode 100644 index 2f7896d1d..000000000 --- a/storage-proto/build-proto/.gitignore +++ /dev/null @@ -1 +0,0 @@ -target/ diff --git a/storage-proto/build-proto/Cargo.lock b/storage-proto/build-proto/Cargo.lock deleted file mode 100644 index 9bc8bd184..000000000 --- a/storage-proto/build-proto/Cargo.lock +++ /dev/null @@ -1,374 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "anyhow" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c" - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bytes" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "fixedbitset" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" - -[[package]] -name = "getrandom" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "indexmap" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "itertools" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" -dependencies = [ - "either", -] - -[[package]] -name = "libc" -version = "0.2.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" - -[[package]] -name = "log" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "multimap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" - -[[package]] -name = "petgraph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" - -[[package]] -name = "proc-macro2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "prost" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" -dependencies = [ - "bytes", - "heck", - "itertools", - "log", - "multimap", - "petgraph", - "prost", - "prost-types", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" -dependencies = [ - "bytes", - "prost", -] - -[[package]] -name = "proto" -version = "1.8.0" -dependencies = [ - "tonic-build", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" -dependencies = [ - "bitflags", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "syn" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "tempfile" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tonic-build" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386" -dependencies = [ - "proc-macro2", - "prost-build", - "quote", - "syn", -] - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "which" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" -dependencies = [ - "libc", - "thiserror", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/storage-proto/build-proto/Cargo.toml b/storage-proto/build-proto/Cargo.toml deleted file mode 100644 index ded5f794e..000000000 --- a/storage-proto/build-proto/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -authors = ["Solana Maintainers "] -description = "Blockchain, Rebuilt for Scale" -edition = "2018" -homepage = "https://solana.com/" -license = "Apache-2.0" -name = "proto" -publish = false -repository = "https://github.com/solana-labs/solana" -version = "1.8.0" - -[workspace] - -[dependencies] -tonic-build = "0.5.0" diff --git a/storage-proto/build-proto/src/main.rs b/storage-proto/build.rs similarity index 80% rename from storage-proto/build-proto/src/main.rs rename to storage-proto/build.rs index 50acaceb7..426813f73 100644 --- a/storage-proto/build-proto/src/main.rs +++ b/storage-proto/build.rs @@ -1,8 +1,10 @@ fn main() -> Result<(), std::io::Error> { let manifest_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let out_dir = manifest_dir.join("../proto"); - let proto_files = manifest_dir.join("../src"); + let out_dir = manifest_dir.join("proto"); + let proto_files = manifest_dir.join("src"); + + std::fs::create_dir_all(out_dir.clone())?; println!("Protobuf directory: {}", proto_files.display()); println!("output directory: {}", out_dir.display()); diff --git a/storage-proto/proto/solana.storage.confirmed_block.rs b/storage-proto/proto/solana.storage.confirmed_block.rs deleted file mode 100644 index d2253b04e..000000000 --- a/storage-proto/proto/solana.storage.confirmed_block.rs +++ /dev/null @@ -1,148 +0,0 @@ -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ConfirmedBlock { - #[prost(string, tag = "1")] - pub previous_blockhash: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub blockhash: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - pub parent_slot: u64, - #[prost(message, repeated, tag = "4")] - pub transactions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub rewards: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "6")] - pub block_time: ::core::option::Option, - #[prost(message, optional, tag = "7")] - pub block_height: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ConfirmedTransaction { - #[prost(message, optional, tag = "1")] - pub transaction: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub meta: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Transaction { - #[prost(bytes = "vec", repeated, tag = "1")] - pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(message, optional, tag = "2")] - pub message: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Message { - #[prost(message, optional, tag = "1")] - pub header: ::core::option::Option, - #[prost(bytes = "vec", repeated, tag = "2")] - pub account_keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bytes = "vec", tag = "3")] - pub recent_blockhash: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub instructions: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MessageHeader { - #[prost(uint32, tag = "1")] - pub num_required_signatures: u32, - #[prost(uint32, tag = "2")] - pub num_readonly_signed_accounts: u32, - #[prost(uint32, tag = "3")] - pub num_readonly_unsigned_accounts: u32, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionStatusMeta { - #[prost(message, optional, tag = "1")] - pub err: ::core::option::Option, - #[prost(uint64, tag = "2")] - pub fee: u64, - #[prost(uint64, repeated, tag = "3")] - pub pre_balances: ::prost::alloc::vec::Vec, - #[prost(uint64, repeated, tag = "4")] - pub post_balances: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub inner_instructions: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag = "6")] - pub log_messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, repeated, tag = "7")] - pub pre_token_balances: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "8")] - pub post_token_balances: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "9")] - pub rewards: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionError { - #[prost(bytes = "vec", tag = "1")] - pub err: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct InnerInstructions { - #[prost(uint32, tag = "1")] - pub index: u32, - #[prost(message, repeated, tag = "2")] - pub instructions: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CompiledInstruction { - #[prost(uint32, tag = "1")] - pub program_id_index: u32, - #[prost(bytes = "vec", tag = "2")] - pub accounts: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - pub data: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TokenBalance { - #[prost(uint32, tag = "1")] - pub account_index: u32, - #[prost(string, tag = "2")] - pub mint: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub ui_token_amount: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UiTokenAmount { - #[prost(double, tag = "1")] - pub ui_amount: f64, - #[prost(uint32, tag = "2")] - pub decimals: u32, - #[prost(string, tag = "3")] - pub amount: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub ui_amount_string: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Reward { - #[prost(string, tag = "1")] - pub pubkey: ::prost::alloc::string::String, - #[prost(int64, tag = "2")] - pub lamports: i64, - #[prost(uint64, tag = "3")] - pub post_balance: u64, - #[prost(enumeration = "RewardType", tag = "4")] - pub reward_type: i32, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Rewards { - #[prost(message, repeated, tag = "1")] - pub rewards: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UnixTimestamp { - #[prost(int64, tag = "1")] - pub timestamp: i64, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct BlockHeight { - #[prost(uint64, tag = "1")] - pub block_height: u64, -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum RewardType { - Unspecified = 0, - Fee = 1, - Rent = 2, - Staking = 3, - Voting = 4, -} diff --git a/storage-proto/proto/solana.storage.transaction_by_addr.rs b/storage-proto/proto/solana.storage.transaction_by_addr.rs deleted file mode 100644 index 5425eaab4..000000000 --- a/storage-proto/proto/solana.storage.transaction_by_addr.rs +++ /dev/null @@ -1,124 +0,0 @@ -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionByAddr { - #[prost(message, repeated, tag = "1")] - pub tx_by_addrs: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionByAddrInfo { - #[prost(bytes = "vec", tag = "1")] - pub signature: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub err: ::core::option::Option, - #[prost(uint32, tag = "3")] - pub index: u32, - #[prost(message, optional, tag = "4")] - pub memo: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub block_time: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Memo { - #[prost(string, tag = "1")] - pub memo: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct TransactionError { - #[prost(enumeration = "TransactionErrorType", tag = "1")] - pub transaction_error: i32, - #[prost(message, optional, tag = "2")] - pub instruction_error: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct InstructionError { - #[prost(uint32, tag = "1")] - pub index: u32, - #[prost(enumeration = "InstructionErrorType", tag = "2")] - pub error: i32, - #[prost(message, optional, tag = "3")] - pub custom: ::core::option::Option, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UnixTimestamp { - #[prost(int64, tag = "1")] - pub timestamp: i64, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CustomError { - #[prost(uint32, tag = "1")] - pub custom: u32, -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum TransactionErrorType { - AccountInUse = 0, - AccountLoadedTwice = 1, - AccountNotFound = 2, - ProgramAccountNotFound = 3, - InsufficientFundsForFee = 4, - InvalidAccountForFee = 5, - AlreadyProcessed = 6, - BlockhashNotFound = 7, - InstructionError = 8, - CallChainTooDeep = 9, - MissingSignatureForFee = 10, - InvalidAccountIndex = 11, - SignatureFailure = 12, - InvalidProgramForExecution = 13, - SanitizeFailure = 14, - ClusterMaintenance = 15, - AccountBorrowOutstandingTx = 16, -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum InstructionErrorType { - GenericError = 0, - InvalidArgument = 1, - InvalidInstructionData = 2, - InvalidAccountData = 3, - AccountDataTooSmall = 4, - InsufficientFunds = 5, - IncorrectProgramId = 6, - MissingRequiredSignature = 7, - AccountAlreadyInitialized = 8, - UninitializedAccount = 9, - UnbalancedInstruction = 10, - ModifiedProgramId = 11, - ExternalAccountLamportSpend = 12, - ExternalAccountDataModified = 13, - ReadonlyLamportChange = 14, - ReadonlyDataModified = 15, - DuplicateAccountIndex = 16, - ExecutableModified = 17, - RentEpochModified = 18, - NotEnoughAccountKeys = 19, - AccountDataSizeChanged = 20, - AccountNotExecutable = 21, - AccountBorrowFailed = 22, - AccountBorrowOutstanding = 23, - DuplicateAccountOutOfSync = 24, - Custom = 25, - InvalidError = 26, - ExecutableDataModified = 27, - ExecutableLamportChange = 28, - ExecutableAccountNotRentExempt = 29, - UnsupportedProgramId = 30, - CallDepth = 31, - MissingAccount = 32, - ReentrancyNotAllowed = 33, - MaxSeedLengthExceeded = 34, - InvalidSeeds = 35, - InvalidRealloc = 36, - ComputationalBudgetExceeded = 37, - PrivilegeEscalation = 38, - ProgramEnvironmentSetupFailure = 39, - ProgramFailedToComplete = 40, - ProgramFailedToCompile = 41, - Immutable = 42, - IncorrectAuthority = 43, - BorshIoError = 44, - AccountNotRentExempt = 45, - InvalidAccountOwner = 46, - ArithmeticOverflow = 47, - UnsupportedSysvar = 48, - IllegalOwner = 49, -} diff --git a/storage-proto/src/convert.rs b/storage-proto/src/convert.rs index 9ad5dd9b5..7460bdf0e 100644 --- a/storage-proto/src/convert.rs +++ b/storage-proto/src/convert.rs @@ -1,22 +1,24 @@ -use crate::{StoredExtendedRewards, StoredTransactionStatusMeta}; -use solana_account_decoder::parse_token::{real_number_string_trimmed, UiTokenAmount}; -use solana_sdk::{ - hash::Hash, - instruction::CompiledInstruction, - instruction::InstructionError, - message::{Message, MessageHeader}, - pubkey::Pubkey, - signature::Signature, - transaction::Transaction, - transaction::TransactionError, -}; -use solana_transaction_status::{ - ConfirmedBlock, InnerInstructions, Reward, RewardType, TransactionByAddrInfo, - TransactionStatusMeta, TransactionTokenBalance, TransactionWithStatusMeta, -}; -use std::{ - convert::{TryFrom, TryInto}, - str::FromStr, +use { + crate::{StoredExtendedRewards, StoredTransactionStatusMeta}, + solana_account_decoder::parse_token::{real_number_string_trimmed, UiTokenAmount}, + solana_sdk::{ + hash::Hash, + instruction::CompiledInstruction, + instruction::InstructionError, + message::{Message, MessageHeader}, + pubkey::Pubkey, + signature::Signature, + transaction::Transaction, + transaction::TransactionError, + }, + solana_transaction_status::{ + ConfirmedBlock, InnerInstructions, Reward, RewardType, TransactionByAddrInfo, + TransactionStatusMeta, TransactionTokenBalance, TransactionWithStatusMeta, + }, + std::{ + convert::{TryFrom, TryInto}, + str::FromStr, + }, }; pub mod generated { diff --git a/storage-proto/src/lib.rs b/storage-proto/src/lib.rs index a132a8797..2a21b6b93 100644 --- a/storage-proto/src/lib.rs +++ b/storage-proto/src/lib.rs @@ -1,13 +1,15 @@ -use serde::{Deserialize, Serialize}; -use solana_account_decoder::{ - parse_token::{real_number_string_trimmed, UiTokenAmount}, - StringAmount, +use { + serde::{Deserialize, Serialize}, + solana_account_decoder::{ + parse_token::{real_number_string_trimmed, UiTokenAmount}, + StringAmount, + }, + solana_sdk::{deserialize_utils::default_on_eof, transaction::Result}, + solana_transaction_status::{ + InnerInstructions, Reward, RewardType, TransactionStatusMeta, TransactionTokenBalance, + }, + std::str::FromStr, }; -use solana_sdk::{deserialize_utils::default_on_eof, transaction::Result}; -use solana_transaction_status::{ - InnerInstructions, Reward, RewardType, TransactionStatusMeta, TransactionTokenBalance, -}; -use std::str::FromStr; pub mod convert;