diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 148ba0df491..11976751397 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Install lld - run: sudo apt-get install -y lld + run: sudo apt-get install -y lld protobuf-compiler - name: Run unit tests uses: actions-rs/cargo@v1 @@ -80,7 +80,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Install lld - run: sudo apt-get install -y lld + run: sudo apt-get install -y lld protobuf-compiler - name: Run runner tests id: runner-tests-1 @@ -110,7 +110,7 @@ jobs: cache-dependency-path: "tests/integration-tests/yarn.lock" - name: Install lld and jq - run: sudo apt-get install -y lld jq + run: sudo apt-get install -y lld jq protobuf-compiler - name: Build graph-node uses: actions-rs/cargo@v1 @@ -187,7 +187,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get -y install libpq-dev + sudo apt-get -y install libpq-dev protobuf-compiler - name: Cargo check (release) uses: actions-rs/cargo@v1 with: diff --git a/Cargo.lock b/Cargo.lock index 3e4f16bd3fc..c8244fb157d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,9 +158,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "axum" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4af7447fc1214c1f3a1ace861d0216a6c8bb13965b64bbad9650f375b67689a" +checksum = "08b108ad2665fa3f6e6a517c3d80ec3e77d224c47d605167aefaa5d7ef97fa48" dependencies = [ "async-trait", "axum-core", @@ -176,20 +176,20 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", + "rustversion", "serde", "sync_wrapper", - "tokio", - "tower 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tower 0.4.13", "tower-http", - "tower-layer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.3.2", "tower-service 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "axum-core" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdc19781b16e32f8a7200368a336fa4509d4b72ef15dd4e41df5290855ee1e6" +checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92" dependencies = [ "async-trait", "bytes", @@ -197,6 +197,9 @@ dependencies = [ "http", "http-body", "mime", + "rustversion", + "tower-layer 0.3.2", + "tower-service 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -528,15 +531,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "cmake" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b858541263efe664aead4a5209a4ae5c5d2811167d4ed4ee0944503f8d2089" -dependencies = [ - "cc", -] - [[package]] name = "combine" version = "3.8.1" @@ -1287,12 +1281,12 @@ checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e" [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide 0.5.3", + "miniz_oxide 0.6.2", ] [[package]] @@ -1726,7 +1720,7 @@ dependencies = [ "serde_json", "serde_yaml", "test-store", - "tower 0.4.12 (git+https://github.com/tower-rs/tower.git)", + "tower 0.4.12", "tower-test", "uuid 0.8.2", ] @@ -2129,9 +2123,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", @@ -2657,9 +2651,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "matchit" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" [[package]] name = "maybe-owned" @@ -2742,9 +2736,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -3161,18 +3155,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.8" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -3393,9 +3387,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.10.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" dependencies = [ "bytes", "prost-derive", @@ -3403,31 +3397,31 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.10.1" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120fbe7988713f39d780a58cf1a7ef0d7ef66c6d87e5aa3438940c05357929f4" +checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" dependencies = [ "bytes", - "cfg-if 1.0.0", - "cmake", "heck 0.4.0", "itertools", "lazy_static", "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.10.1" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" dependencies = [ "anyhow", "itertools", @@ -3438,9 +3432,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.10.1" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" dependencies = [ "bytes", "prost", @@ -3766,20 +3760,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" dependencies = [ "openssl-probe", - "rustls-pemfile 1.0.0", + "rustls-pemfile", "schannel", "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" -dependencies = [ - "base64 0.13.1", -] - [[package]] name = "rustls-pemfile" version = "1.0.0" @@ -3791,9 +3776,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.5" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" @@ -4668,9 +4653,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.7.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30fb54bf1e446f44d870d260d99957e7d11fb9d0a0f5bd1a662ad1411cc103f9" +checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" dependencies = [ "async-stream", "async-trait", @@ -4690,13 +4675,13 @@ dependencies = [ "prost", "prost-derive", "rustls-native-certs", - "rustls-pemfile 0.3.0", + "rustls-pemfile", "tokio", "tokio-rustls", "tokio-stream", "tokio-util 0.7.1", - "tower 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tower-layer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tower 0.4.13", + "tower-layer 0.3.2", "tower-service 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", "tracing-futures", @@ -4704,9 +4689,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.7.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9263bf4c9bfaae7317c1c2faf7f18491d2fe476f70c414b73bf5d445b00ffa1" +checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" dependencies = [ "prettyplease", "proc-macro2", @@ -4718,38 +4703,38 @@ dependencies = [ [[package]] name = "tower" version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e" +source = "git+https://github.com/tower-rs/tower.git#c9d84cde0c9a23e1d2d5b5ae7ae432629712658b" dependencies = [ "futures-core", "futures-util", + "hdrhistogram", "indexmap", - "pin-project", "pin-project-lite", - "rand", "slab", "tokio", "tokio-util 0.7.1", - "tower-layer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tower-service 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-layer 0.3.1", + "tower-service 0.3.1 (git+https://github.com/tower-rs/tower.git)", "tracing", ] [[package]] name = "tower" -version = "0.4.12" -source = "git+https://github.com/tower-rs/tower.git#c9d84cde0c9a23e1d2d5b5ae7ae432629712658b" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "hdrhistogram", "indexmap", + "pin-project", "pin-project-lite", + "rand", "slab", "tokio", "tokio-util 0.7.1", - "tower-layer 0.3.1 (git+https://github.com/tower-rs/tower.git)", - "tower-service 0.3.1 (git+https://github.com/tower-rs/tower.git)", + "tower-layer 0.3.2", + "tower-service 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", ] @@ -4767,21 +4752,21 @@ dependencies = [ "http-body", "http-range-header", "pin-project-lite", - "tower 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tower-layer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tower 0.4.13", + "tower-layer 0.3.2", "tower-service 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tower-layer" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" +source = "git+https://github.com/tower-rs/tower.git#c9d84cde0c9a23e1d2d5b5ae7ae432629712658b" [[package]] name = "tower-layer" -version = "0.3.1" -source = "git+https://github.com/tower-rs/tower.git#c9d84cde0c9a23e1d2d5b5ae7ae432629712658b" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] name = "tower-service" @@ -4803,7 +4788,7 @@ dependencies = [ "pin-project-lite", "tokio", "tokio-test", - "tower-layer 0.3.1 (git+https://github.com/tower-rs/tower.git)", + "tower-layer 0.3.1", "tower-service 0.3.1 (git+https://github.com/tower-rs/tower.git)", ] diff --git a/Cargo.toml b/Cargo.toml index 98a51479e62..e3de0e81211 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,12 @@ homepage = "https://thegraph.com" repository = "https://github.com/graphprotocol/graph-node" license = "MIT OR Apache-2.0" +[workspace.dependencies] +prost = "0.11.5" +prost-types = "0.11.5" +tonic = { version = "0.8.3", features = ["tls-roots", "gzip"] } +tonic-build = { version = "0.8.4", features = ["prost"] } + # Incremental compilation on Rust 1.58 causes an ICE on build. As soon as graph node builds again, these can be removed. [profile.test] incremental = false diff --git a/chain/arweave/Cargo.toml b/chain/arweave/Cargo.toml index 127f4943577..c969e0a400a 100644 --- a/chain/arweave/Cargo.toml +++ b/chain/arweave/Cargo.toml @@ -4,13 +4,13 @@ version.workspace = true edition.workspace = true [build-dependencies] -tonic-build = { version = "0.7.1", features = ["prost"] } +tonic-build = { workspace = true } [dependencies] base64-url = "1.4.13" graph = { path = "../../graph" } -prost = "0.10.1" -prost-types = "0.10.1" +prost = { workspace = true } +prost-types = { workspace = true } serde = "1.0" sha2 = "0.10.6" diff --git a/chain/arweave/src/protobuf/sf.arweave.r#type.v1.rs b/chain/arweave/src/protobuf/sf.arweave.r#type.v1.rs index 98a1359305a..fba41614f1b 100644 --- a/chain/arweave/src/protobuf/sf.arweave.r#type.v1.rs +++ b/chain/arweave/src/protobuf/sf.arweave.r#type.v1.rs @@ -1,141 +1,146 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BigInt { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub bytes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { /// Firehose block version (unrelated to Arweave block version) - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub ver: u32, /// The block identifier - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub indep_hash: ::prost::alloc::vec::Vec, /// The nonce chosen to solve the mining problem - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub nonce: ::prost::alloc::vec::Vec, /// `indep_hash` of the previous block in the weave - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub previous_block: ::prost::alloc::vec::Vec, /// POSIX time of block discovery - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub timestamp: u64, /// POSIX time of the last difficulty retarget - #[prost(uint64, tag="6")] + #[prost(uint64, tag = "6")] pub last_retarget: u64, /// Mining difficulty; the number `hash` must be greater than. - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub diff: ::core::option::Option, /// How many blocks have passed since the genesis block - #[prost(uint64, tag="8")] + #[prost(uint64, tag = "8")] pub height: u64, /// Mining solution hash of the block; must satisfy the mining difficulty - #[prost(bytes="vec", tag="9")] + #[prost(bytes = "vec", tag = "9")] pub hash: ::prost::alloc::vec::Vec, /// Merkle root of the tree of Merkle roots of block's transactions' data. - #[prost(bytes="vec", tag="10")] + #[prost(bytes = "vec", tag = "10")] pub tx_root: ::prost::alloc::vec::Vec, /// Transactions contained within this block - #[prost(message, repeated, tag="11")] + #[prost(message, repeated, tag = "11")] pub txs: ::prost::alloc::vec::Vec, /// The root hash of the Merkle Patricia Tree containing /// all wallet (account) balances and the identifiers /// of the last transactions posted by them; if any. - #[prost(bytes="vec", tag="12")] + #[prost(bytes = "vec", tag = "12")] pub wallet_list: ::prost::alloc::vec::Vec, /// (string or) Address of the account to receive the block rewards. Can also be unclaimed which is encoded as a null byte - #[prost(bytes="vec", tag="13")] + #[prost(bytes = "vec", tag = "13")] pub reward_addr: ::prost::alloc::vec::Vec, /// Tags that a block producer can add to a block - #[prost(message, repeated, tag="14")] + #[prost(message, repeated, tag = "14")] pub tags: ::prost::alloc::vec::Vec, /// Size of reward pool - #[prost(message, optional, tag="15")] + #[prost(message, optional, tag = "15")] pub reward_pool: ::core::option::Option, /// Size of the weave in bytes - #[prost(message, optional, tag="16")] + #[prost(message, optional, tag = "16")] pub weave_size: ::core::option::Option, /// Size of this block in bytes - #[prost(message, optional, tag="17")] + #[prost(message, optional, tag = "17")] pub block_size: ::core::option::Option, /// Required after the version 1.8 fork. Zero otherwise. /// The sum of the average number of hashes computed /// by the network to produce the past blocks including this one. - #[prost(message, optional, tag="18")] + #[prost(message, optional, tag = "18")] pub cumulative_diff: ::core::option::Option, /// Required after the version 1.8 fork. Null byte otherwise. /// The Merkle root of the block index - the list of {`indep_hash`; `weave_size`; `tx_root`} triplets - #[prost(bytes="vec", tag="20")] + #[prost(bytes = "vec", tag = "20")] pub hash_list_merkle: ::prost::alloc::vec::Vec, /// The proof of access; Used after v2.4 only; set as defaults otherwise - #[prost(message, optional, tag="21")] + #[prost(message, optional, tag = "21")] pub poa: ::core::option::Option, } /// A succinct proof of access to a recall byte found in a TX +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProofOfAccess { /// The recall byte option chosen; global offset of index byte - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub option: ::prost::alloc::string::String, /// The path through the Merkle tree of transactions' `data_root`s; /// from the `data_root` being proven to the corresponding `tx_root` - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub tx_path: ::prost::alloc::vec::Vec, /// The path through the Merkle tree of identifiers of chunks of the /// corresponding transaction; from the chunk being proven to the /// corresponding `data_root`. - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub data_path: ::prost::alloc::vec::Vec, /// The data chunk. - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub chunk: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Transaction { /// 1 or 2 for v1 or v2 transactions. More allowable in the future - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub format: u32, /// The transaction identifier. - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub id: ::prost::alloc::vec::Vec, /// Either the identifier of the previous transaction from the same /// wallet or the identifier of one of the last ?MAX_TX_ANCHOR_DEPTH blocks. - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub last_tx: ::prost::alloc::vec::Vec, /// The public key the transaction is signed with. - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub owner: ::prost::alloc::vec::Vec, /// A list of arbitrary key-value pairs - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub tags: ::prost::alloc::vec::Vec, /// The address of the recipient; if any. The SHA2-256 hash of the public key. - #[prost(bytes="vec", tag="6")] + #[prost(bytes = "vec", tag = "6")] pub target: ::prost::alloc::vec::Vec, /// The amount of Winstons to send to the recipient; if any. - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub quantity: ::core::option::Option, /// The data to upload; if any. For v2 transactions; the field is optional /// - a fee is charged based on the `data_size` field; - /// data may be uploaded any time later in chunks. - #[prost(bytes="vec", tag="8")] + /// data may be uploaded any time later in chunks. + #[prost(bytes = "vec", tag = "8")] pub data: ::prost::alloc::vec::Vec, /// Size in bytes of the transaction data. - #[prost(message, optional, tag="9")] + #[prost(message, optional, tag = "9")] pub data_size: ::core::option::Option, /// The Merkle root of the Merkle tree of data chunks. - #[prost(bytes="vec", tag="10")] + #[prost(bytes = "vec", tag = "10")] pub data_root: ::prost::alloc::vec::Vec, /// The signature. - #[prost(bytes="vec", tag="11")] + #[prost(bytes = "vec", tag = "11")] pub signature: ::prost::alloc::vec::Vec, /// The fee in Winstons. - #[prost(message, optional, tag="12")] + #[prost(message, optional, tag = "12")] pub reward: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Tag { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub name: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub value: ::prost::alloc::vec::Vec, } diff --git a/chain/cosmos/Cargo.toml b/chain/cosmos/Cargo.toml index 643a57a3b6c..1ff5ebf44d5 100644 --- a/chain/cosmos/Cargo.toml +++ b/chain/cosmos/Cargo.toml @@ -4,13 +4,13 @@ version.workspace = true edition = "2018" [build-dependencies] -tonic-build = { version = "0.7.1", features = ["prost"] } +tonic-build = { workspace = true } graph-chain-common = { path = "../common" } [dependencies] graph = { path = "../../graph" } -prost = "0.10.1" -prost-types = "0.10.1" +prost = { workspace = true } +prost-types = { workspace = true } serde = "1.0" anyhow = "1.0" semver = "1.0.14" diff --git a/chain/cosmos/src/protobuf/sf.cosmos.r#type.v1.rs b/chain/cosmos/src/protobuf/sf.cosmos.r#type.v1.rs index 1f43320e9a9..d60de8086b1 100644 --- a/chain/cosmos/src/protobuf/sf.cosmos.r#type.v1.rs +++ b/chain/cosmos/src/protobuf/sf.cosmos.r#type.v1.rs @@ -1,21 +1,30 @@ -#[graph_runtime_derive::generate_asc_type(__required__{header: Header,result_begin_block: ResponseBeginBlock,result_end_block: ResponseEndBlock})] -#[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{header: Header,result_begin_block: ResponseBeginBlock,result_end_block: ResponseEndBlock})] +#[graph_runtime_derive::generate_asc_type( + __required__{header:Header, + result_begin_block:ResponseBeginBlock, + result_end_block:ResponseEndBlock} +)] +#[graph_runtime_derive::generate_network_type_id(Cosmos)] +#[graph_runtime_derive::generate_from_rust_type( + __required__{header:Header, + result_begin_block:ResponseBeginBlock, + result_end_block:ResponseEndBlock} +)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub header: ::core::option::Option
, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub evidence: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub last_commit: ::core::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub result_begin_block: ::core::option::Option, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub result_end_block: ::core::option::Option, - #[prost(message, repeated, tag="7")] + #[prost(message, repeated, tag = "7")] pub transactions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="8")] + #[prost(message, repeated, tag = "8")] pub validator_updates: ::prost::alloc::vec::Vec, } /// HeaderOnlyBlock is a standard \[Block\] structure where all other fields are @@ -24,625 +33,711 @@ pub struct Block { /// /// This can be used to unpack a \[Block\] when only the \[Header\] information /// is required and greatly reduce required memory. -#[graph_runtime_derive::generate_asc_type(__required__{header: Header})] +#[graph_runtime_derive::generate_asc_type(__required__{header:Header})] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{header: Header})] +#[graph_runtime_derive::generate_from_rust_type(__required__{header:Header})] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HeaderOnlyBlock { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub header: ::core::option::Option
, } -#[graph_runtime_derive::generate_asc_type(__required__{event: Event,block: HeaderOnlyBlock})] +#[graph_runtime_derive::generate_asc_type( + __required__{event:Event, + block:HeaderOnlyBlock} +)] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{event: Event,block: HeaderOnlyBlock})] +#[graph_runtime_derive::generate_from_rust_type( + __required__{event:Event, + block:HeaderOnlyBlock} +)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventData { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub event: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub block: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub tx: ::core::option::Option, } -#[graph_runtime_derive::generate_asc_type(__required__{tx: TxResult,block: HeaderOnlyBlock})] +#[graph_runtime_derive::generate_asc_type( + __required__{tx:TxResult, + block:HeaderOnlyBlock} +)] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{tx: TxResult,block: HeaderOnlyBlock})] +#[graph_runtime_derive::generate_from_rust_type( + __required__{tx:TxResult, + block:HeaderOnlyBlock} +)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionData { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub tx: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub block: ::core::option::Option, } -#[graph_runtime_derive::generate_asc_type(__required__{message: Any,block: HeaderOnlyBlock,tx: TransactionContext})] +#[graph_runtime_derive::generate_asc_type( + __required__{message:Any, + block:HeaderOnlyBlock, + tx:TransactionContext} +)] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{message: Any,block: HeaderOnlyBlock,tx: TransactionContext})] +#[graph_runtime_derive::generate_from_rust_type( + __required__{message:Any, + block:HeaderOnlyBlock, + tx:TransactionContext} +)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MessageData { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub message: ::core::option::Option<::prost_types::Any>, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub block: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub tx: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionContext { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub hash: ::prost::alloc::vec::Vec, - #[prost(uint32, tag="2")] + #[prost(uint32, tag = "2")] pub index: u32, - #[prost(uint32, tag="3")] + #[prost(uint32, tag = "3")] pub code: u32, - #[prost(int64, tag="4")] + #[prost(int64, tag = "4")] pub gas_wanted: i64, - #[prost(int64, tag="5")] + #[prost(int64, tag = "5")] pub gas_used: i64, } -#[graph_runtime_derive::generate_asc_type(__required__{last_block_id: BlockID})] +#[graph_runtime_derive::generate_asc_type(__required__{last_block_id:BlockID})] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{last_block_id: BlockID})] +#[graph_runtime_derive::generate_from_rust_type(__required__{last_block_id:BlockID})] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Header { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub version: ::core::option::Option, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub chain_id: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub height: u64, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub time: ::core::option::Option, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub last_block_id: ::core::option::Option, - #[prost(bytes="vec", tag="6")] + #[prost(bytes = "vec", tag = "6")] pub last_commit_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="7")] + #[prost(bytes = "vec", tag = "7")] pub data_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="8")] + #[prost(bytes = "vec", tag = "8")] pub validators_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="9")] + #[prost(bytes = "vec", tag = "9")] pub next_validators_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="10")] + #[prost(bytes = "vec", tag = "10")] pub consensus_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="11")] + #[prost(bytes = "vec", tag = "11")] pub app_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="12")] + #[prost(bytes = "vec", tag = "12")] pub last_results_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="13")] + #[prost(bytes = "vec", tag = "13")] pub evidence_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="14")] + #[prost(bytes = "vec", tag = "14")] pub proposer_address: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="15")] + #[prost(bytes = "vec", tag = "15")] pub hash: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Consensus { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub block: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub app: u64, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Timestamp { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub seconds: i64, - #[prost(int32, tag="2")] + #[prost(int32, tag = "2")] pub nanos: i32, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockId { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub part_set_header: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PartSetHeader { - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub total: u32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub hash: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EvidenceList { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub evidence: ::prost::alloc::vec::Vec, } -#[graph_runtime_derive::generate_asc_type(sum{duplicate_vote_evidence: DuplicateVoteEvidence,light_client_attack_evidence: LightClientAttackEvidence})] +#[graph_runtime_derive::generate_asc_type( + sum{duplicate_vote_evidence:DuplicateVoteEvidence, + light_client_attack_evidence:LightClientAttackEvidence} +)] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(sum{duplicate_vote_evidence: DuplicateVoteEvidence,light_client_attack_evidence: LightClientAttackEvidence})] +#[graph_runtime_derive::generate_from_rust_type( + sum{duplicate_vote_evidence:DuplicateVoteEvidence, + light_client_attack_evidence:LightClientAttackEvidence} +)] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Evidence { - #[prost(oneof="evidence::Sum", tags="1, 2")] + #[prost(oneof = "evidence::Sum", tags = "1, 2")] pub sum: ::core::option::Option, } /// Nested message and enum types in `Evidence`. pub mod evidence { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] DuplicateVoteEvidence(super::DuplicateVoteEvidence), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] LightClientAttackEvidence(super::LightClientAttackEvidence), } } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DuplicateVoteEvidence { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub vote_a: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub vote_b: ::core::option::Option, - #[prost(int64, tag="3")] + #[prost(int64, tag = "3")] pub total_voting_power: i64, - #[prost(int64, tag="4")] + #[prost(int64, tag = "4")] pub validator_power: i64, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub timestamp: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventVote { - #[prost(enumeration="SignedMsgType", tag="1")] + #[prost(enumeration = "SignedMsgType", tag = "1")] pub event_vote_type: i32, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub height: u64, - #[prost(int32, tag="3")] + #[prost(int32, tag = "3")] pub round: i32, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub block_id: ::core::option::Option, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub timestamp: ::core::option::Option, - #[prost(bytes="vec", tag="6")] + #[prost(bytes = "vec", tag = "6")] pub validator_address: ::prost::alloc::vec::Vec, - #[prost(int32, tag="7")] + #[prost(int32, tag = "7")] pub validator_index: i32, - #[prost(bytes="vec", tag="8")] + #[prost(bytes = "vec", tag = "8")] pub signature: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LightClientAttackEvidence { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub conflicting_block: ::core::option::Option, - #[prost(int64, tag="2")] + #[prost(int64, tag = "2")] pub common_height: i64, - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub byzantine_validators: ::prost::alloc::vec::Vec, - #[prost(int64, tag="4")] + #[prost(int64, tag = "4")] pub total_voting_power: i64, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub timestamp: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LightBlock { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub signed_header: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub validator_set: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignedHeader { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub header: ::core::option::Option
, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub commit: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Commit { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub height: i64, - #[prost(int32, tag="2")] + #[prost(int32, tag = "2")] pub round: i32, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub block_id: ::core::option::Option, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub signatures: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommitSig { - #[prost(enumeration="BlockIdFlag", tag="1")] + #[prost(enumeration = "BlockIdFlag", tag = "1")] pub block_id_flag: i32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub validator_address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub timestamp: ::core::option::Option, - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub signature: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorSet { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub validators: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub proposer: ::core::option::Option, - #[prost(int64, tag="3")] + #[prost(int64, tag = "3")] pub total_voting_power: i64, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Validator { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub pub_key: ::core::option::Option, - #[prost(int64, tag="3")] + #[prost(int64, tag = "3")] pub voting_power: i64, - #[prost(int64, tag="4")] + #[prost(int64, tag = "4")] pub proposer_priority: i64, } -#[graph_runtime_derive::generate_asc_type(sum{ed25519: Vec,secp256k1: Vec})] +#[graph_runtime_derive::generate_asc_type(sum{ed25519:Vec, secp256k1:Vec})] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(sum{ed25519: Vec,secp256k1: Vec})] +#[graph_runtime_derive::generate_from_rust_type(sum{ed25519:Vec, secp256k1:Vec})] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PublicKey { - #[prost(oneof="public_key::Sum", tags="1, 2")] + #[prost(oneof = "public_key::Sum", tags = "1, 2")] pub sum: ::core::option::Option, } /// Nested message and enum types in `PublicKey`. pub mod public_key { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] Ed25519(::prost::alloc::vec::Vec), - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] Secp256k1(::prost::alloc::vec::Vec), } } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseBeginBlock { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub events: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Event { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub event_type: ::prost::alloc::string::String, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub attributes: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventAttribute { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub key: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub value: ::prost::alloc::string::String, - #[prost(bool, tag="3")] + #[prost(bool, tag = "3")] pub index: bool, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseEndBlock { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub validator_updates: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub consensus_param_updates: ::core::option::Option, - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub events: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorUpdate { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub pub_key: ::core::option::Option, - #[prost(int64, tag="3")] + #[prost(int64, tag = "3")] pub power: i64, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConsensusParams { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub block: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub evidence: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub validator: ::core::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub version: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockParams { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub max_bytes: i64, - #[prost(int64, tag="2")] + #[prost(int64, tag = "2")] pub max_gas: i64, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EvidenceParams { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub max_age_num_blocks: i64, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub max_age_duration: ::core::option::Option, - #[prost(int64, tag="3")] + #[prost(int64, tag = "3")] pub max_bytes: i64, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Duration { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub seconds: i64, - #[prost(int32, tag="2")] + #[prost(int32, tag = "2")] pub nanos: i32, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorParams { - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub pub_key_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct VersionParams { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub app_version: u64, } -#[graph_runtime_derive::generate_asc_type(__required__{tx: Tx,result: ResponseDeliverTx})] +#[graph_runtime_derive::generate_asc_type(__required__{tx:Tx, result:ResponseDeliverTx})] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{tx: Tx,result: ResponseDeliverTx})] +#[graph_runtime_derive::generate_from_rust_type( + __required__{tx:Tx, + result:ResponseDeliverTx} +)] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TxResult { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub height: u64, - #[prost(uint32, tag="2")] + #[prost(uint32, tag = "2")] pub index: u32, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub tx: ::core::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub result: ::core::option::Option, - #[prost(bytes="vec", tag="5")] + #[prost(bytes = "vec", tag = "5")] pub hash: ::prost::alloc::vec::Vec, } -#[graph_runtime_derive::generate_asc_type(__required__{body: TxBody})] +#[graph_runtime_derive::generate_asc_type(__required__{body:TxBody})] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(__required__{body: TxBody})] +#[graph_runtime_derive::generate_from_rust_type(__required__{body:TxBody})] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Tx { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub body: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub auth_info: ::core::option::Option, - #[prost(bytes="vec", repeated, tag="3")] + #[prost(bytes = "vec", repeated, tag = "3")] pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TxBody { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub messages: ::prost::alloc::vec::Vec<::prost_types::Any>, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub memo: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub timeout_height: u64, - #[prost(message, repeated, tag="1023")] + #[prost(message, repeated, tag = "1023")] pub extension_options: ::prost::alloc::vec::Vec<::prost_types::Any>, - #[prost(message, repeated, tag="2047")] + #[prost(message, repeated, tag = "2047")] pub non_critical_extension_options: ::prost::alloc::vec::Vec<::prost_types::Any>, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Any { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub type_url: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub value: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AuthInfo { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub signer_infos: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub fee: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub tip: ::core::option::Option, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignerInfo { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub public_key: ::core::option::Option<::prost_types::Any>, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub mode_info: ::core::option::Option, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, } -#[graph_runtime_derive::generate_asc_type(sum{single: ModeInfoSingle,multi: ModeInfoMulti})] +#[graph_runtime_derive::generate_asc_type( + sum{single:ModeInfoSingle, + multi:ModeInfoMulti} +)] #[graph_runtime_derive::generate_network_type_id(Cosmos)] -#[graph_runtime_derive::generate_from_rust_type(sum{single: ModeInfoSingle,multi: ModeInfoMulti})] +#[graph_runtime_derive::generate_from_rust_type( + sum{single:ModeInfoSingle, + multi:ModeInfoMulti} +)] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModeInfo { - #[prost(oneof="mode_info::Sum", tags="1, 2")] + #[prost(oneof = "mode_info::Sum", tags = "1, 2")] pub sum: ::core::option::Option, } /// Nested message and enum types in `ModeInfo`. pub mod mode_info { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Single(super::ModeInfoSingle), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Multi(super::ModeInfoMulti), } } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModeInfoSingle { - #[prost(enumeration="SignMode", tag="1")] + #[prost(enumeration = "SignMode", tag = "1")] pub mode: i32, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModeInfoMulti { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub bitarray: ::core::option::Option, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub mode_infos: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactBitArray { - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub extra_bits_stored: u32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub elems: ::prost::alloc::vec::Vec, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Fee { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub amount: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub gas_limit: u64, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub payer: ::prost::alloc::string::String, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub granter: ::prost::alloc::string::String, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] #[graph_runtime_derive::generate_array_type(Cosmos)] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Coin { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub denom: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub amount: ::prost::alloc::string::String, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Tip { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub amount: ::prost::alloc::vec::Vec, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub tipper: ::prost::alloc::string::String, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseDeliverTx { - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub code: u32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub data: ::prost::alloc::vec::Vec, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub log: ::prost::alloc::string::String, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub info: ::prost::alloc::string::String, - #[prost(int64, tag="5")] + #[prost(int64, tag = "5")] pub gas_wanted: i64, - #[prost(int64, tag="6")] + #[prost(int64, tag = "6")] pub gas_used: i64, - #[prost(message, repeated, tag="7")] + #[prost(message, repeated, tag = "7")] pub events: ::prost::alloc::vec::Vec, - #[prost(string, tag="8")] + #[prost(string, tag = "8")] pub codespace: ::prost::alloc::string::String, } #[graph_runtime_derive::generate_asc_type()] #[graph_runtime_derive::generate_network_type_id(Cosmos)] #[graph_runtime_derive::generate_from_rust_type()] +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorSetUpdates { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub validator_updates: ::prost::alloc::vec::Vec, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] @@ -653,6 +748,30 @@ pub enum SignedMsgType { Precommit = 2, Proposal = 32, } +impl SignedMsgType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SignedMsgType::Unknown => "SIGNED_MSG_TYPE_UNKNOWN", + SignedMsgType::Prevote => "SIGNED_MSG_TYPE_PREVOTE", + SignedMsgType::Precommit => "SIGNED_MSG_TYPE_PRECOMMIT", + SignedMsgType::Proposal => "SIGNED_MSG_TYPE_PROPOSAL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SIGNED_MSG_TYPE_UNKNOWN" => Some(Self::Unknown), + "SIGNED_MSG_TYPE_PREVOTE" => Some(Self::Prevote), + "SIGNED_MSG_TYPE_PRECOMMIT" => Some(Self::Precommit), + "SIGNED_MSG_TYPE_PROPOSAL" => Some(Self::Proposal), + _ => None, + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum BlockIdFlag { @@ -661,6 +780,30 @@ pub enum BlockIdFlag { Commit = 2, Nil = 3, } +impl BlockIdFlag { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BlockIdFlag::Unknown => "BLOCK_ID_FLAG_UNKNOWN", + BlockIdFlag::Absent => "BLOCK_ID_FLAG_ABSENT", + BlockIdFlag::Commit => "BLOCK_ID_FLAG_COMMIT", + BlockIdFlag::Nil => "BLOCK_ID_FLAG_NIL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BLOCK_ID_FLAG_UNKNOWN" => Some(Self::Unknown), + "BLOCK_ID_FLAG_ABSENT" => Some(Self::Absent), + "BLOCK_ID_FLAG_COMMIT" => Some(Self::Commit), + "BLOCK_ID_FLAG_NIL" => Some(Self::Nil), + _ => None, + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum SignMode { @@ -669,3 +812,27 @@ pub enum SignMode { Textual = 2, LegacyAminoJson = 127, } +impl SignMode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SignMode::Unspecified => "SIGN_MODE_UNSPECIFIED", + SignMode::Direct => "SIGN_MODE_DIRECT", + SignMode::Textual => "SIGN_MODE_TEXTUAL", + SignMode::LegacyAminoJson => "SIGN_MODE_LEGACY_AMINO_JSON", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SIGN_MODE_UNSPECIFIED" => Some(Self::Unspecified), + "SIGN_MODE_DIRECT" => Some(Self::Direct), + "SIGN_MODE_TEXTUAL" => Some(Self::Textual), + "SIGN_MODE_LEGACY_AMINO_JSON" => Some(Self::LegacyAminoJson), + _ => None, + } + } +} diff --git a/chain/ethereum/Cargo.toml b/chain/ethereum/Cargo.toml index 4466cd62ba7..61579efcb5c 100644 --- a/chain/ethereum/Cargo.toml +++ b/chain/ethereum/Cargo.toml @@ -11,8 +11,8 @@ jsonrpc-core = "18.0.0" graph = { path = "../../graph" } lazy_static = "1.2.0" serde = "1.0" -prost = "0.10.4" -prost-types = "0.10.1" +prost = { workspace = true } +prost-types = { workspace = true } dirs-next = "2.0" anyhow = "1.0" tiny-keccak = "1.5.0" @@ -29,4 +29,4 @@ test-store = { path = "../../store/test-store" } base64 = "0.20.0" [build-dependencies] -tonic-build = { version = "0.7.2", features = ["prost"] } +tonic-build = { workspace = true } diff --git a/chain/ethereum/src/protobuf/sf.ethereum.r#type.v2.rs b/chain/ethereum/src/protobuf/sf.ethereum.r#type.v2.rs index a4daf1e2498..1e6b7841c8d 100644 --- a/chain/ethereum/src/protobuf/sf.ethereum.r#type.v2.rs +++ b/chain/ethereum/src/protobuf/sf.ethereum.r#type.v2.rs @@ -1,27 +1,28 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { - #[prost(int32, tag="1")] + #[prost(int32, tag = "1")] pub ver: i32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub hash: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub number: u64, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub size: u64, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub header: ::core::option::Option, /// Uncles represents block produced with a valid solution but were not actually choosen /// as the canonical block for the given height so they are mostly "forked" blocks. /// /// If the Block has been produced using the Proof of Stake consensus algorithm, this /// field will actually be always empty. - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub uncles: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="10")] + #[prost(message, repeated, tag = "10")] pub transaction_traces: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="11")] + #[prost(message, repeated, tag = "11")] pub balance_changes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="20")] + #[prost(message, repeated, tag = "20")] pub code_changes: ::prost::alloc::vec::Vec, } /// HeaderOnlyBlock is used to optimally unpack the \[Block\] structure (note the @@ -30,68 +31,74 @@ pub struct Block { /// /// WARN: this is a client-side optimization pattern and should be moved in the /// consuming code. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HeaderOnlyBlock { - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub header: ::core::option::Option, } /// BlockWithRefs is a lightweight block, with traces and transactions /// purged from the `block` within, and only. It is used in transports /// to pass block data around. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockWithRefs { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub block: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub transaction_trace_refs: ::core::option::Option, - #[prost(bool, tag="4")] + #[prost(bool, tag = "4")] pub irreversible: bool, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionRefs { - #[prost(bytes="vec", repeated, tag="1")] + #[prost(bytes = "vec", repeated, tag = "1")] pub hashes: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UnclesHeaders { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub uncles: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockRef { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub hash: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub number: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockHeader { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub parent_hash: ::prost::alloc::vec::Vec, /// Uncle hash of the block, some reference it as `sha3Uncles`, but `sha3`` is badly worded, so we prefer `uncle_hash`, also /// referred as `ommers` in EIP specification. /// /// If the Block containing this `BlockHeader` has been produced using the Proof of Stake /// consensus algorithm, this field will actually be constant and set to `0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347`. - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub uncle_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub coinbase: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub state_root: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="5")] + #[prost(bytes = "vec", tag = "5")] pub transactions_root: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="6")] + #[prost(bytes = "vec", tag = "6")] pub receipt_root: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="7")] + #[prost(bytes = "vec", tag = "7")] pub logs_bloom: ::prost::alloc::vec::Vec, /// Difficulty is the difficulty of the Proof of Work algorithm that was required to compute a solution. /// /// If the Block containing this `BlockHeader` has been produced using the Proof of Stake /// consensus algorithm, this field will actually be constant and set to `0x00`. - #[prost(message, optional, tag="8")] + #[prost(message, optional, tag = "8")] pub difficulty: ::core::option::Option, /// TotalDifficulty is the sum of all previous blocks difficulty including this block difficulty. /// @@ -99,15 +106,15 @@ pub struct BlockHeader { /// consensus algorithm, this field will actually be constant and set to the terminal total difficulty /// that was required to transition to Proof of Stake algorithm, which varies per network. It is set to /// 58 750 000 000 000 000 000 000 on Ethereum Mainnet and to 10 790 000 on Ethereum Testnet Goerli. - #[prost(message, optional, tag="17")] + #[prost(message, optional, tag = "17")] pub total_difficulty: ::core::option::Option, - #[prost(uint64, tag="9")] + #[prost(uint64, tag = "9")] pub number: u64, - #[prost(uint64, tag="10")] + #[prost(uint64, tag = "10")] pub gas_limit: u64, - #[prost(uint64, tag="11")] + #[prost(uint64, tag = "11")] pub gas_used: u64, - #[prost(message, optional, tag="12")] + #[prost(message, optional, tag = "12")] pub timestamp: ::core::option::Option<::prost_types::Timestamp>, /// ExtraData is free-form bytes included in the block by the "miner". While on Yellow paper of /// Ethereum this value is maxed to 32 bytes, other consensus algorithm like Clique and some other @@ -115,57 +122,59 @@ pub struct BlockHeader { /// /// If the Block containing this `BlockHeader` has been produced using the Proof of Stake /// consensus algorithm, this field is strictly enforced to be <= 32 bytes. - #[prost(bytes="vec", tag="13")] + #[prost(bytes = "vec", tag = "13")] pub extra_data: ::prost::alloc::vec::Vec, /// MixHash is used to prove, when combined with the `nonce` that sufficient amount of computation has been /// achieved and that the solution found is valid. - #[prost(bytes="vec", tag="14")] + #[prost(bytes = "vec", tag = "14")] pub mix_hash: ::prost::alloc::vec::Vec, /// Nonce is used to prove, when combined with the `mix_hash` that sufficient amount of computation has been /// achieved and that the solution found is valid. /// /// If the Block containing this `BlockHeader` has been produced using the Proof of Stake /// consensus algorithm, this field will actually be constant and set to `0`. - #[prost(uint64, tag="15")] + #[prost(uint64, tag = "15")] pub nonce: u64, /// Hash is the hash of the block which is actually the computation: /// - /// Keccak256(rlp([ - /// parent_hash, - /// uncle_hash, - /// coinbase, - /// state_root, - /// transactions_root, - /// receipt_root, - /// logs_bloom, - /// difficulty, - /// number, - /// gas_limit, - /// gas_used, - /// timestamp, - /// extra_data, - /// mix_hash, - /// nonce, - /// base_fee_per_gas - /// ])) + /// Keccak256(rlp([ + /// parent_hash, + /// uncle_hash, + /// coinbase, + /// state_root, + /// transactions_root, + /// receipt_root, + /// logs_bloom, + /// difficulty, + /// number, + /// gas_limit, + /// gas_used, + /// timestamp, + /// extra_data, + /// mix_hash, + /// nonce, + /// base_fee_per_gas + /// ])) /// - #[prost(bytes="vec", tag="16")] + #[prost(bytes = "vec", tag = "16")] pub hash: ::prost::alloc::vec::Vec, /// Base fee per gas according to EIP-1559 (e.g. London Fork) rules, only set if London is present/active on the chain. - #[prost(message, optional, tag="18")] + #[prost(message, optional, tag = "18")] pub base_fee_per_gas: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BigInt { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub bytes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionTrace { /// consensus - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub to: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub nonce: u64, /// GasPrice represents the effective price that has been paid for each gas unit of this transaction. Over time, the /// Ethereum rules changes regarding GasPrice field here. Before London fork, the GasPrice was always set to the @@ -176,79 +185,89 @@ pub struct TransactionTrace { /// /// In cases where `TransactionTrace.Type == TRX_TYPE_DYNAMIC_FEE`, then GasPrice is the effective gas price paid /// for the transaction which is equals to `BlockHeader.BaseFeePerGas + TransactionTrace.` - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub gas_price: ::core::option::Option, /// GasLimit is the maximum of gas unit the sender of the transaction is willing to consume when perform the EVM /// execution of the whole transaction - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub gas_limit: u64, /// Value is the amount of Ether transferred as part of this transaction. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub value: ::core::option::Option, /// Input data the transaction will receive for execution of EVM. - #[prost(bytes="vec", tag="6")] + #[prost(bytes = "vec", tag = "6")] pub input: ::prost::alloc::vec::Vec, /// V is the recovery ID value for the signature Y point. - #[prost(bytes="vec", tag="7")] + #[prost(bytes = "vec", tag = "7")] pub v: ::prost::alloc::vec::Vec, /// R is the signature's X point on the elliptic curve (32 bytes). - #[prost(bytes="vec", tag="8")] + #[prost(bytes = "vec", tag = "8")] pub r: ::prost::alloc::vec::Vec, /// S is the signature's Y point on the elliptic curve (32 bytes). - #[prost(bytes="vec", tag="9")] + #[prost(bytes = "vec", tag = "9")] pub s: ::prost::alloc::vec::Vec, /// GasUsed is the total amount of gas unit used for the whole execution of the transaction. - #[prost(uint64, tag="10")] + #[prost(uint64, tag = "10")] pub gas_used: u64, /// Type represents the Ethereum transaction type, available only since EIP-2718 & EIP-2930 activation which happened on Berlin fork. /// The value is always set even for transaction before Berlin fork because those before the fork are still legacy transactions. - #[prost(enumeration="transaction_trace::Type", tag="12")] + #[prost(enumeration = "transaction_trace::Type", tag = "12")] pub r#type: i32, /// AcccessList represents the storage access this transaction has agreed to do in which case those storage /// access cost less gas unit per access. /// /// This will is populated only if `TransactionTrace.Type == TRX_TYPE_ACCESS_LIST || TRX_TYPE_DYNAMIC_FEE` which /// is possible only if Berlin (TRX_TYPE_ACCESS_LIST) nor London (TRX_TYPE_DYNAMIC_FEE) fork are active on the chain. - #[prost(message, repeated, tag="14")] + #[prost(message, repeated, tag = "14")] pub access_list: ::prost::alloc::vec::Vec, /// MaxFeePerGas is the maximum fee per gas the user is willing to pay for the transaction gas used. /// /// This will is populated only if `TransactionTrace.Type == TRX_TYPE_DYNAMIC_FEE` which is possible only /// if London fork is active on the chain. - #[prost(message, optional, tag="11")] + #[prost(message, optional, tag = "11")] pub max_fee_per_gas: ::core::option::Option, /// MaxPriorityFeePerGas is priority fee per gas the user to pay in extra to the miner on top of the block's /// base fee. /// /// This will is populated only if `TransactionTrace.Type == TRX_TYPE_DYNAMIC_FEE` which is possible only /// if London fork is active on the chain. - #[prost(message, optional, tag="13")] + #[prost(message, optional, tag = "13")] pub max_priority_fee_per_gas: ::core::option::Option, /// meta - #[prost(uint32, tag="20")] + #[prost(uint32, tag = "20")] pub index: u32, - #[prost(bytes="vec", tag="21")] + #[prost(bytes = "vec", tag = "21")] pub hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="22")] + #[prost(bytes = "vec", tag = "22")] pub from: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="23")] + #[prost(bytes = "vec", tag = "23")] pub return_data: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="24")] + #[prost(bytes = "vec", tag = "24")] pub public_key: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="25")] + #[prost(uint64, tag = "25")] pub begin_ordinal: u64, - #[prost(uint64, tag="26")] + #[prost(uint64, tag = "26")] pub end_ordinal: u64, - #[prost(enumeration="TransactionTraceStatus", tag="30")] + #[prost(enumeration = "TransactionTraceStatus", tag = "30")] pub status: i32, - #[prost(message, optional, tag="31")] + #[prost(message, optional, tag = "31")] pub receipt: ::core::option::Option, - #[prost(message, repeated, tag="32")] + #[prost(message, repeated, tag = "32")] pub calls: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `TransactionTrace`. pub mod transaction_trace { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Type { /// All transactions that ever existed prior Berlin fork before EIP-2718 was implemented. @@ -263,24 +282,49 @@ pub mod transaction_trace { /// executed against EIP-1559 rules which dictates a dynamic gas cost based on the congestion of the network. TrxTypeDynamicFee = 2, } + impl Type { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Type::TrxTypeLegacy => "TRX_TYPE_LEGACY", + Type::TrxTypeAccessList => "TRX_TYPE_ACCESS_LIST", + Type::TrxTypeDynamicFee => "TRX_TYPE_DYNAMIC_FEE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TRX_TYPE_LEGACY" => Some(Self::TrxTypeLegacy), + "TRX_TYPE_ACCESS_LIST" => Some(Self::TrxTypeAccessList), + "TRX_TYPE_DYNAMIC_FEE" => Some(Self::TrxTypeDynamicFee), + _ => None, + } + } + } } /// AccessTuple represents a list of storage keys for a given contract's address and is used /// for AccessList construction. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccessTuple { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", repeated, tag="2")] + #[prost(bytes = "vec", repeated, tag = "2")] pub storage_keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } /// TransactionTraceWithBlockRef +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionTraceWithBlockRef { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub trace: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub block_ref: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionReceipt { /// State root is an intermediate state_root hash, computed in-between transactions to make @@ -296,27 +340,28 @@ pub struct TransactionReceipt { /// field, following `EIP-658`. /// /// Before Byzantinium hard fork, this field is always empty. - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub state_root: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub cumulative_gas_used: u64, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub logs_bloom: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub logs: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Log { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", repeated, tag="2")] + #[prost(bytes = "vec", repeated, tag = "2")] pub topics: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub data: ::prost::alloc::vec::Vec, /// Index is the index of the log relative to the transaction. This index /// is always populated regardless of the state revertion of the the call /// that emitted this log. - #[prost(uint32, tag="4")] + #[prost(uint32, tag = "4")] pub index: u32, /// BlockIndex represents the index of the log relative to the Block. /// @@ -333,53 +378,57 @@ pub struct Log { /// /// In the case of `calls` case, for `call` where `stateReverted == true`, /// the `blockIndex` value will always be 0. - #[prost(uint32, tag="6")] + #[prost(uint32, tag = "6")] pub block_index: u32, - #[prost(uint64, tag="7")] + #[prost(uint64, tag = "7")] pub ordinal: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Call { - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub index: u32, - #[prost(uint32, tag="2")] + #[prost(uint32, tag = "2")] pub parent_index: u32, - #[prost(uint32, tag="3")] + #[prost(uint32, tag = "3")] pub depth: u32, - #[prost(enumeration="CallType", tag="4")] + #[prost(enumeration = "CallType", tag = "4")] pub call_type: i32, - #[prost(bytes="vec", tag="5")] + #[prost(bytes = "vec", tag = "5")] pub caller: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="6")] + #[prost(bytes = "vec", tag = "6")] pub address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub value: ::core::option::Option, - #[prost(uint64, tag="8")] + #[prost(uint64, tag = "8")] pub gas_limit: u64, - #[prost(uint64, tag="9")] + #[prost(uint64, tag = "9")] pub gas_consumed: u64, - #[prost(bytes="vec", tag="13")] + #[prost(bytes = "vec", tag = "13")] pub return_data: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="14")] + #[prost(bytes = "vec", tag = "14")] pub input: ::prost::alloc::vec::Vec, - #[prost(bool, tag="15")] + #[prost(bool, tag = "15")] pub executed_code: bool, - #[prost(bool, tag="16")] + #[prost(bool, tag = "16")] pub suicide: bool, - /// hex representation of the hash -> preimage - #[prost(map="string, string", tag="20")] - pub keccak_preimages: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, - #[prost(message, repeated, tag="21")] + /// hex representation of the hash -> preimage + #[prost(map = "string, string", tag = "20")] + pub keccak_preimages: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + #[prost(message, repeated, tag = "21")] pub storage_changes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="22")] + #[prost(message, repeated, tag = "22")] pub balance_changes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="24")] + #[prost(message, repeated, tag = "24")] pub nonce_changes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="25")] + #[prost(message, repeated, tag = "25")] pub logs: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="26")] + #[prost(message, repeated, tag = "26")] pub code_changes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="28")] + #[prost(message, repeated, tag = "28")] pub gas_changes: ::prost::alloc::vec::Vec, /// In Ethereum, a call can be either: /// - Successfull, execution passes without any problem encountered @@ -389,13 +438,13 @@ pub struct Call { /// When a call is either `failed` or `reverted`, the `status_failed` field /// below is set to `true`. If the status is `reverted`, then both `status_failed` /// and `status_reverted` are going to be set to `true`. - #[prost(bool, tag="10")] + #[prost(bool, tag = "10")] pub status_failed: bool, - #[prost(bool, tag="12")] + #[prost(bool, tag = "12")] pub status_reverted: bool, /// Populated when a call either failed or reverted, so when `status_failed == true`, /// see above for details about those flags. - #[prost(string, tag="11")] + #[prost(string, tag = "11")] pub failure_reason: ::prost::alloc::string::String, /// This field represents wheter or not the state changes performed /// by this call were correctly recorded by the blockchain. @@ -408,49 +457,51 @@ pub struct Call { /// changes it performed. /// /// ```text - /// Trx 1 - /// Call #1 - /// Call #2 - /// Call #3 - /// |--- Failure here - /// Call #4 + /// Trx 1 + /// Call #1 + /// Call #2 + /// Call #3 + /// |--- Failure here + /// Call #4 /// ``` /// /// In the transaction above, while Call #2 and Call #3 would have the /// status `EXECUTED` - #[prost(bool, tag="30")] + #[prost(bool, tag = "30")] pub state_reverted: bool, - #[prost(uint64, tag="31")] + #[prost(uint64, tag = "31")] pub begin_ordinal: u64, - #[prost(uint64, tag="32")] + #[prost(uint64, tag = "32")] pub end_ordinal: u64, - #[prost(message, repeated, tag="33")] + #[prost(message, repeated, tag = "33")] pub account_creations: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StorageChange { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub key: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub old_value: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub new_value: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub ordinal: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BalanceChange { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub old_value: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub new_value: ::core::option::Option, - #[prost(enumeration="balance_change::Reason", tag="4")] + #[prost(enumeration = "balance_change::Reason", tag = "4")] pub reason: i32, - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub ordinal: u64, } /// Nested message and enum types in `BalanceChange`. @@ -460,7 +511,17 @@ pub mod balance_change { /// ```shell /// ack -ho 'BalanceChangeReason\(".*"\)' | grep -Eo '".*"' | sort | uniq /// ``` - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Reason { Unknown = 0, @@ -481,38 +542,89 @@ pub mod balance_change { /// Used on chain(s) where some Ether burning happens Burn = 15, } + impl Reason { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Reason::Unknown => "REASON_UNKNOWN", + Reason::RewardMineUncle => "REASON_REWARD_MINE_UNCLE", + Reason::RewardMineBlock => "REASON_REWARD_MINE_BLOCK", + Reason::DaoRefundContract => "REASON_DAO_REFUND_CONTRACT", + Reason::DaoAdjustBalance => "REASON_DAO_ADJUST_BALANCE", + Reason::Transfer => "REASON_TRANSFER", + Reason::GenesisBalance => "REASON_GENESIS_BALANCE", + Reason::GasBuy => "REASON_GAS_BUY", + Reason::RewardTransactionFee => "REASON_REWARD_TRANSACTION_FEE", + Reason::RewardFeeReset => "REASON_REWARD_FEE_RESET", + Reason::GasRefund => "REASON_GAS_REFUND", + Reason::TouchAccount => "REASON_TOUCH_ACCOUNT", + Reason::SuicideRefund => "REASON_SUICIDE_REFUND", + Reason::SuicideWithdraw => "REASON_SUICIDE_WITHDRAW", + Reason::CallBalanceOverride => "REASON_CALL_BALANCE_OVERRIDE", + Reason::Burn => "REASON_BURN", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REASON_UNKNOWN" => Some(Self::Unknown), + "REASON_REWARD_MINE_UNCLE" => Some(Self::RewardMineUncle), + "REASON_REWARD_MINE_BLOCK" => Some(Self::RewardMineBlock), + "REASON_DAO_REFUND_CONTRACT" => Some(Self::DaoRefundContract), + "REASON_DAO_ADJUST_BALANCE" => Some(Self::DaoAdjustBalance), + "REASON_TRANSFER" => Some(Self::Transfer), + "REASON_GENESIS_BALANCE" => Some(Self::GenesisBalance), + "REASON_GAS_BUY" => Some(Self::GasBuy), + "REASON_REWARD_TRANSACTION_FEE" => Some(Self::RewardTransactionFee), + "REASON_REWARD_FEE_RESET" => Some(Self::RewardFeeReset), + "REASON_GAS_REFUND" => Some(Self::GasRefund), + "REASON_TOUCH_ACCOUNT" => Some(Self::TouchAccount), + "REASON_SUICIDE_REFUND" => Some(Self::SuicideRefund), + "REASON_SUICIDE_WITHDRAW" => Some(Self::SuicideWithdraw), + "REASON_CALL_BALANCE_OVERRIDE" => Some(Self::CallBalanceOverride), + "REASON_BURN" => Some(Self::Burn), + _ => None, + } + } + } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct NonceChange { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub old_value: u64, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub new_value: u64, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub ordinal: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountCreation { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub account: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub ordinal: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CodeChange { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub address: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub old_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub old_code: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub new_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="5")] + #[prost(bytes = "vec", tag = "5")] pub new_code: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="6")] + #[prost(uint64, tag = "6")] pub ordinal: u64, } /// The gas change model represents the reason why some gas cost has occurred. @@ -521,15 +633,16 @@ pub struct CodeChange { /// /// Hence, we only index some of them, those that are costy like all the calls /// one, log events, return data, etc. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GasChange { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub old_value: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub new_value: u64, - #[prost(enumeration="gas_change::Reason", tag="3")] + #[prost(enumeration = "gas_change::Reason", tag = "3")] pub reason: i32, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub ordinal: u64, } /// Nested message and enum types in `GasChange`. @@ -539,7 +652,17 @@ pub mod gas_change { /// ```shell /// ack -ho 'GasChangeReason\(".*"\)' | grep -Eo '".*"' | sort | uniq /// ``` - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Reason { Unknown = 0, @@ -565,6 +688,64 @@ pub mod gas_change { /// Added in Berlin fork (Geth 1.10+) StateColdAccess = 20, } + impl Reason { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Reason::Unknown => "REASON_UNKNOWN", + Reason::Call => "REASON_CALL", + Reason::CallCode => "REASON_CALL_CODE", + Reason::CallDataCopy => "REASON_CALL_DATA_COPY", + Reason::CodeCopy => "REASON_CODE_COPY", + Reason::CodeStorage => "REASON_CODE_STORAGE", + Reason::ContractCreation => "REASON_CONTRACT_CREATION", + Reason::ContractCreation2 => "REASON_CONTRACT_CREATION2", + Reason::DelegateCall => "REASON_DELEGATE_CALL", + Reason::EventLog => "REASON_EVENT_LOG", + Reason::ExtCodeCopy => "REASON_EXT_CODE_COPY", + Reason::FailedExecution => "REASON_FAILED_EXECUTION", + Reason::IntrinsicGas => "REASON_INTRINSIC_GAS", + Reason::PrecompiledContract => "REASON_PRECOMPILED_CONTRACT", + Reason::RefundAfterExecution => "REASON_REFUND_AFTER_EXECUTION", + Reason::Return => "REASON_RETURN", + Reason::ReturnDataCopy => "REASON_RETURN_DATA_COPY", + Reason::Revert => "REASON_REVERT", + Reason::SelfDestruct => "REASON_SELF_DESTRUCT", + Reason::StaticCall => "REASON_STATIC_CALL", + Reason::StateColdAccess => "REASON_STATE_COLD_ACCESS", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REASON_UNKNOWN" => Some(Self::Unknown), + "REASON_CALL" => Some(Self::Call), + "REASON_CALL_CODE" => Some(Self::CallCode), + "REASON_CALL_DATA_COPY" => Some(Self::CallDataCopy), + "REASON_CODE_COPY" => Some(Self::CodeCopy), + "REASON_CODE_STORAGE" => Some(Self::CodeStorage), + "REASON_CONTRACT_CREATION" => Some(Self::ContractCreation), + "REASON_CONTRACT_CREATION2" => Some(Self::ContractCreation2), + "REASON_DELEGATE_CALL" => Some(Self::DelegateCall), + "REASON_EVENT_LOG" => Some(Self::EventLog), + "REASON_EXT_CODE_COPY" => Some(Self::ExtCodeCopy), + "REASON_FAILED_EXECUTION" => Some(Self::FailedExecution), + "REASON_INTRINSIC_GAS" => Some(Self::IntrinsicGas), + "REASON_PRECOMPILED_CONTRACT" => Some(Self::PrecompiledContract), + "REASON_REFUND_AFTER_EXECUTION" => Some(Self::RefundAfterExecution), + "REASON_RETURN" => Some(Self::Return), + "REASON_RETURN_DATA_COPY" => Some(Self::ReturnDataCopy), + "REASON_REVERT" => Some(Self::Revert), + "REASON_SELF_DESTRUCT" => Some(Self::SelfDestruct), + "REASON_STATIC_CALL" => Some(Self::StaticCall), + "REASON_STATE_COLD_ACCESS" => Some(Self::StateColdAccess), + _ => None, + } + } + } } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -574,6 +755,30 @@ pub enum TransactionTraceStatus { Failed = 2, Reverted = 3, } +impl TransactionTraceStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + TransactionTraceStatus::Unknown => "UNKNOWN", + TransactionTraceStatus::Succeeded => "SUCCEEDED", + TransactionTraceStatus::Failed => "FAILED", + TransactionTraceStatus::Reverted => "REVERTED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "SUCCEEDED" => Some(Self::Succeeded), + "FAILED" => Some(Self::Failed), + "REVERTED" => Some(Self::Reverted), + _ => None, + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CallType { @@ -586,3 +791,31 @@ pub enum CallType { /// create2 ? any other form of calls? Create = 5, } +impl CallType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + CallType::Unspecified => "UNSPECIFIED", + CallType::Call => "CALL", + CallType::Callcode => "CALLCODE", + CallType::Delegate => "DELEGATE", + CallType::Static => "STATIC", + CallType::Create => "CREATE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED" => Some(Self::Unspecified), + "CALL" => Some(Self::Call), + "CALLCODE" => Some(Self::Callcode), + "DELEGATE" => Some(Self::Delegate), + "STATIC" => Some(Self::Static), + "CREATE" => Some(Self::Create), + _ => None, + } + } +} diff --git a/chain/near/Cargo.toml b/chain/near/Cargo.toml index 470231cf93c..d41b901159e 100644 --- a/chain/near/Cargo.toml +++ b/chain/near/Cargo.toml @@ -4,13 +4,13 @@ version.workspace = true edition.workspace = true [build-dependencies] -tonic-build = { version = "0.7.1", features = ["prost"] } +tonic-build = { workspace = true } [dependencies] base64 = "0.20" graph = { path = "../../graph" } -prost = "0.10.1" -prost-types = "0.10.1" +prost = { workspace = true } +prost-types = { workspace = true } serde = "1.0" graph-runtime-wasm = { path = "../../runtime/wasm" } diff --git a/chain/near/src/protobuf/sf.near.codec.v1.rs b/chain/near/src/protobuf/sf.near.codec.v1.rs index 4a58d01d0c7..a89d63ae341 100644 --- a/chain/near/src/protobuf/sf.near.codec.v1.rs +++ b/chain/near/src/protobuf/sf.near.codec.v1.rs @@ -1,14 +1,15 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub author: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub header: ::core::option::Option, - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub chunk_headers: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub shards: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub state_changes: ::prost::alloc::vec::Vec, } /// HeaderOnlyBlock is a standard \[Block\] structure where all other fields are @@ -17,788 +18,912 @@ pub struct Block { /// /// This can be used to unpack a \[Block\] when only the \[BlockHeader\] information /// is required and greatly reduced required memory. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HeaderOnlyBlock { - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub header: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StateChangeWithCause { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub value: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub cause: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StateChangeCause { - #[prost(oneof="state_change_cause::Cause", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10")] + #[prost(oneof = "state_change_cause::Cause", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10")] pub cause: ::core::option::Option, } /// Nested message and enum types in `StateChangeCause`. pub mod state_change_cause { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] - pub struct NotWritableToDisk { - } + pub struct NotWritableToDisk {} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] - pub struct InitialState { - } + pub struct InitialState {} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransactionProcessing { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub tx_hash: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionReceiptProcessingStarted { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub receipt_hash: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionReceiptGasReward { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub tx_hash: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReceiptProcessing { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub tx_hash: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PostponedReceipt { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub tx_hash: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] - pub struct UpdatedDelayedReceipts { - } + pub struct UpdatedDelayedReceipts {} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ValidatorAccountsUpdate { - } + pub struct ValidatorAccountsUpdate {} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Migration { - } + pub struct Migration {} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Cause { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] NotWritableToDisk(NotWritableToDisk), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] InitialState(InitialState), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] TransactionProcessing(TransactionProcessing), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] ActionReceiptProcessingStarted(ActionReceiptProcessingStarted), - #[prost(message, tag="5")] + #[prost(message, tag = "5")] ActionReceiptGasReward(ActionReceiptGasReward), - #[prost(message, tag="6")] + #[prost(message, tag = "6")] ReceiptProcessing(ReceiptProcessing), - #[prost(message, tag="7")] + #[prost(message, tag = "7")] PostponedReceipt(PostponedReceipt), - #[prost(message, tag="8")] + #[prost(message, tag = "8")] UpdatedDelayedReceipts(UpdatedDelayedReceipts), - #[prost(message, tag="9")] + #[prost(message, tag = "9")] ValidatorAccountsUpdate(ValidatorAccountsUpdate), - #[prost(message, tag="10")] + #[prost(message, tag = "10")] Migration(Migration), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StateChangeValue { - #[prost(oneof="state_change_value::Value", tags="1, 2, 3, 4, 5, 6, 7, 8")] + #[prost(oneof = "state_change_value::Value", tags = "1, 2, 3, 4, 5, 6, 7, 8")] pub value: ::core::option::Option, } /// Nested message and enum types in `StateChangeValue`. pub mod state_change_value { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountUpdate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub account: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountDeletion { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccessKeyUpdate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub access_key: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccessKeyDeletion { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DataUpdate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub key: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub value: ::prost::alloc::vec::Vec, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DataDeletion { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub key: ::prost::alloc::vec::Vec, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ContractCodeUpdate { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub code: ::prost::alloc::vec::Vec, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ContractCodeDeletion { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Value { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] AccountUpdate(AccountUpdate), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] AccountDeletion(AccountDeletion), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] AccessKeyUpdate(AccessKeyUpdate), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] AccessKeyDeletion(AccessKeyDeletion), - #[prost(message, tag="5")] + #[prost(message, tag = "5")] DataUpdate(DataUpdate), - #[prost(message, tag="6")] + #[prost(message, tag = "6")] DataDeletion(DataDeletion), - #[prost(message, tag="7")] + #[prost(message, tag = "7")] ContractCodeUpdate(ContractCodeUpdate), - #[prost(message, tag="8")] + #[prost(message, tag = "8")] ContractDeletion(ContractCodeDeletion), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Account { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub amount: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub locked: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub code_hash: ::core::option::Option, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub storage_usage: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockHeader { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub height: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub prev_height: u64, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub epoch_id: ::core::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub next_epoch_id: ::core::option::Option, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub hash: ::core::option::Option, - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub prev_hash: ::core::option::Option, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub prev_state_root: ::core::option::Option, - #[prost(message, optional, tag="8")] + #[prost(message, optional, tag = "8")] pub chunk_receipts_root: ::core::option::Option, - #[prost(message, optional, tag="9")] + #[prost(message, optional, tag = "9")] pub chunk_headers_root: ::core::option::Option, - #[prost(message, optional, tag="10")] + #[prost(message, optional, tag = "10")] pub chunk_tx_root: ::core::option::Option, - #[prost(message, optional, tag="11")] + #[prost(message, optional, tag = "11")] pub outcome_root: ::core::option::Option, - #[prost(uint64, tag="12")] + #[prost(uint64, tag = "12")] pub chunks_included: u64, - #[prost(message, optional, tag="13")] + #[prost(message, optional, tag = "13")] pub challenges_root: ::core::option::Option, - #[prost(uint64, tag="14")] + #[prost(uint64, tag = "14")] pub timestamp: u64, - #[prost(uint64, tag="15")] + #[prost(uint64, tag = "15")] pub timestamp_nanosec: u64, - #[prost(message, optional, tag="16")] + #[prost(message, optional, tag = "16")] pub random_value: ::core::option::Option, - #[prost(message, repeated, tag="17")] + #[prost(message, repeated, tag = "17")] pub validator_proposals: ::prost::alloc::vec::Vec, - #[prost(bool, repeated, tag="18")] + #[prost(bool, repeated, tag = "18")] pub chunk_mask: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="19")] + #[prost(message, optional, tag = "19")] pub gas_price: ::core::option::Option, - #[prost(uint64, tag="20")] + #[prost(uint64, tag = "20")] pub block_ordinal: u64, - #[prost(message, optional, tag="21")] + #[prost(message, optional, tag = "21")] pub total_supply: ::core::option::Option, - #[prost(message, repeated, tag="22")] + #[prost(message, repeated, tag = "22")] pub challenges_result: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="23")] + #[prost(uint64, tag = "23")] pub last_final_block_height: u64, - #[prost(message, optional, tag="24")] + #[prost(message, optional, tag = "24")] pub last_final_block: ::core::option::Option, - #[prost(uint64, tag="25")] + #[prost(uint64, tag = "25")] pub last_ds_final_block_height: u64, - #[prost(message, optional, tag="26")] + #[prost(message, optional, tag = "26")] pub last_ds_final_block: ::core::option::Option, - #[prost(message, optional, tag="27")] + #[prost(message, optional, tag = "27")] pub next_bp_hash: ::core::option::Option, - #[prost(message, optional, tag="28")] + #[prost(message, optional, tag = "28")] pub block_merkle_root: ::core::option::Option, - #[prost(bytes="vec", tag="29")] + #[prost(bytes = "vec", tag = "29")] pub epoch_sync_data_hash: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="30")] + #[prost(message, repeated, tag = "30")] pub approvals: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="31")] + #[prost(message, optional, tag = "31")] pub signature: ::core::option::Option, - #[prost(uint32, tag="32")] + #[prost(uint32, tag = "32")] pub latest_protocol_version: u32, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BigInt { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub bytes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CryptoHash { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub bytes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Signature { - #[prost(enumeration="CurveKind", tag="1")] + #[prost(enumeration = "CurveKind", tag = "1")] pub r#type: i32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub bytes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PublicKey { - #[prost(enumeration="CurveKind", tag="1")] + #[prost(enumeration = "CurveKind", tag = "1")] pub r#type: i32, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub bytes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorStake { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub stake: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SlashedValidator { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(bool, tag="2")] + #[prost(bool, tag = "2")] pub is_double_sign: bool, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ChunkHeader { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub chunk_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub prev_block_hash: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="3")] + #[prost(bytes = "vec", tag = "3")] pub outcome_root: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub prev_state_root: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="5")] + #[prost(bytes = "vec", tag = "5")] pub encoded_merkle_root: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="6")] + #[prost(uint64, tag = "6")] pub encoded_length: u64, - #[prost(uint64, tag="7")] + #[prost(uint64, tag = "7")] pub height_created: u64, - #[prost(uint64, tag="8")] + #[prost(uint64, tag = "8")] pub height_included: u64, - #[prost(uint64, tag="9")] + #[prost(uint64, tag = "9")] pub shard_id: u64, - #[prost(uint64, tag="10")] + #[prost(uint64, tag = "10")] pub gas_used: u64, - #[prost(uint64, tag="11")] + #[prost(uint64, tag = "11")] pub gas_limit: u64, - #[prost(message, optional, tag="12")] + #[prost(message, optional, tag = "12")] pub validator_reward: ::core::option::Option, - #[prost(message, optional, tag="13")] + #[prost(message, optional, tag = "13")] pub balance_burnt: ::core::option::Option, - #[prost(bytes="vec", tag="14")] + #[prost(bytes = "vec", tag = "14")] pub outgoing_receipts_root: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="15")] + #[prost(bytes = "vec", tag = "15")] pub tx_root: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="16")] + #[prost(message, repeated, tag = "16")] pub validator_proposals: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="17")] + #[prost(message, optional, tag = "17")] pub signature: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexerShard { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub shard_id: u64, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub chunk: ::core::option::Option, - #[prost(message, repeated, tag="3")] - pub receipt_execution_outcomes: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "3")] + pub receipt_execution_outcomes: ::prost::alloc::vec::Vec< + IndexerExecutionOutcomeWithReceipt, + >, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexerExecutionOutcomeWithReceipt { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub execution_outcome: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub receipt: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexerChunk { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub author: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub header: ::core::option::Option, - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub transactions: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub receipts: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexerTransactionWithOutcome { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub transaction: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub outcome: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignedTransaction { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub signer_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub nonce: u64, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub receiver_id: ::prost::alloc::string::String, - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub actions: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub signature: ::core::option::Option, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub hash: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IndexerExecutionOutcomeWithOptionalReceipt { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub execution_outcome: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub receipt: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Receipt { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub predecessor_id: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub receiver_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub receipt_id: ::core::option::Option, - #[prost(oneof="receipt::Receipt", tags="10, 11")] + #[prost(oneof = "receipt::Receipt", tags = "10, 11")] pub receipt: ::core::option::Option, } /// Nested message and enum types in `Receipt`. pub mod receipt { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Receipt { - #[prost(message, tag="10")] + #[prost(message, tag = "10")] Action(super::ReceiptAction), - #[prost(message, tag="11")] + #[prost(message, tag = "11")] Data(super::ReceiptData), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReceiptData { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub data_id: ::core::option::Option, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub data: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReceiptAction { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub signer_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub signer_public_key: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub gas_price: ::core::option::Option, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub output_data_receivers: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub input_data_ids: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub actions: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DataReceiver { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub data_id: ::core::option::Option, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub receiver_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExecutionOutcomeWithId { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub proof: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub block_hash: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub id: ::core::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub outcome: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExecutionOutcome { - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub logs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub receipt_ids: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub gas_burnt: u64, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub tokens_burnt: ::core::option::Option, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub executor_id: ::prost::alloc::string::String, - #[prost(enumeration="ExecutionMetadata", tag="6")] + #[prost(enumeration = "ExecutionMetadata", tag = "6")] pub metadata: i32, - #[prost(oneof="execution_outcome::Status", tags="20, 21, 22, 23")] + #[prost(oneof = "execution_outcome::Status", tags = "20, 21, 22, 23")] pub status: ::core::option::Option, } /// Nested message and enum types in `ExecutionOutcome`. pub mod execution_outcome { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Status { - #[prost(message, tag="20")] + #[prost(message, tag = "20")] Unknown(super::UnknownExecutionStatus), - #[prost(message, tag="21")] + #[prost(message, tag = "21")] Failure(super::FailureExecutionStatus), - #[prost(message, tag="22")] + #[prost(message, tag = "22")] SuccessValue(super::SuccessValueExecutionStatus), - #[prost(message, tag="23")] + #[prost(message, tag = "23")] SuccessReceiptId(super::SuccessReceiptIdExecutionStatus), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SuccessValueExecutionStatus { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub value: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SuccessReceiptIdExecutionStatus { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct UnknownExecutionStatus { -} +pub struct UnknownExecutionStatus {} +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FailureExecutionStatus { - #[prost(oneof="failure_execution_status::Failure", tags="1, 2")] + #[prost(oneof = "failure_execution_status::Failure", tags = "1, 2")] pub failure: ::core::option::Option, } /// Nested message and enum types in `FailureExecutionStatus`. pub mod failure_execution_status { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Failure { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] ActionError(super::ActionError), - #[prost(enumeration="super::InvalidTxError", tag="2")] + #[prost(enumeration = "super::InvalidTxError", tag = "2")] InvalidTxError(i32), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionError { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub index: u64, - #[prost(oneof="action_error::Kind", tags="21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36")] + #[prost( + oneof = "action_error::Kind", + tags = "21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36" + )] pub kind: ::core::option::Option, } /// Nested message and enum types in `ActionError`. pub mod action_error { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Kind { - #[prost(message, tag="21")] + #[prost(message, tag = "21")] AccountAlreadyExist(super::AccountAlreadyExistsErrorKind), - #[prost(message, tag="22")] + #[prost(message, tag = "22")] AccountDoesNotExist(super::AccountDoesNotExistErrorKind), - #[prost(message, tag="23")] + #[prost(message, tag = "23")] CreateAccountOnlyByRegistrar(super::CreateAccountOnlyByRegistrarErrorKind), - #[prost(message, tag="24")] + #[prost(message, tag = "24")] CreateAccountNotAllowed(super::CreateAccountNotAllowedErrorKind), - #[prost(message, tag="25")] + #[prost(message, tag = "25")] ActorNoPermission(super::ActorNoPermissionErrorKind), - #[prost(message, tag="26")] + #[prost(message, tag = "26")] DeleteKeyDoesNotExist(super::DeleteKeyDoesNotExistErrorKind), - #[prost(message, tag="27")] + #[prost(message, tag = "27")] AddKeyAlreadyExists(super::AddKeyAlreadyExistsErrorKind), - #[prost(message, tag="28")] + #[prost(message, tag = "28")] DeleteAccountStaking(super::DeleteAccountStakingErrorKind), - #[prost(message, tag="29")] + #[prost(message, tag = "29")] LackBalanceForState(super::LackBalanceForStateErrorKind), - #[prost(message, tag="30")] + #[prost(message, tag = "30")] TriesToUnstake(super::TriesToUnstakeErrorKind), - #[prost(message, tag="31")] + #[prost(message, tag = "31")] TriesToStake(super::TriesToStakeErrorKind), - #[prost(message, tag="32")] + #[prost(message, tag = "32")] InsufficientStake(super::InsufficientStakeErrorKind), - #[prost(message, tag="33")] + #[prost(message, tag = "33")] FunctionCall(super::FunctionCallErrorKind), - #[prost(message, tag="34")] + #[prost(message, tag = "34")] NewReceiptValidation(super::NewReceiptValidationErrorKind), - #[prost(message, tag="35")] - OnlyImplicitAccountCreationAllowed(super::OnlyImplicitAccountCreationAllowedErrorKind), - #[prost(message, tag="36")] + #[prost(message, tag = "35")] + OnlyImplicitAccountCreationAllowed( + super::OnlyImplicitAccountCreationAllowedErrorKind, + ), + #[prost(message, tag = "36")] DeleteAccountWithLargeState(super::DeleteAccountWithLargeStateErrorKind), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountAlreadyExistsErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccountDoesNotExistErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } -//// A top-level account ID can only be created by registrar. +/// / A top-level account ID can only be created by registrar. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateAccountOnlyByRegistrarErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub registrar_account_id: ::prost::alloc::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub predecessor_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateAccountNotAllowedErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub predecessor_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActorNoPermissionErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub actor_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteKeyDoesNotExistErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AddKeyAlreadyExistsErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteAccountStakingErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LackBalanceForStateErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub balance: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TriesToUnstakeErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TriesToStakeErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub stake: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub locked: ::core::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub balance: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InsufficientStakeErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub stake: ::core::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub minimum_stake: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FunctionCallErrorKind { - #[prost(enumeration="FunctionCallErrorSer", tag="1")] + #[prost(enumeration = "FunctionCallErrorSer", tag = "1")] pub error: i32, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct NewReceiptValidationErrorKind { - #[prost(enumeration="ReceiptValidationError", tag="1")] + #[prost(enumeration = "ReceiptValidationError", tag = "1")] pub error: i32, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct OnlyImplicitAccountCreationAllowedErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteAccountWithLargeStateErrorKind { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub account_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MerklePath { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub path: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MerklePathItem { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub hash: ::core::option::Option, - #[prost(enumeration="Direction", tag="2")] + #[prost(enumeration = "Direction", tag = "2")] pub direction: i32, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Action { - #[prost(oneof="action::Action", tags="1, 2, 3, 4, 5, 6, 7, 8")] + #[prost(oneof = "action::Action", tags = "1, 2, 3, 4, 5, 6, 7, 8")] pub action: ::core::option::Option, } /// Nested message and enum types in `Action`. pub mod action { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Action { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] CreateAccount(super::CreateAccountAction), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] DeployContract(super::DeployContractAction), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] FunctionCall(super::FunctionCallAction), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] Transfer(super::TransferAction), - #[prost(message, tag="5")] + #[prost(message, tag = "5")] Stake(super::StakeAction), - #[prost(message, tag="6")] + #[prost(message, tag = "6")] AddKey(super::AddKeyAction), - #[prost(message, tag="7")] + #[prost(message, tag = "7")] DeleteKey(super::DeleteKeyAction), - #[prost(message, tag="8")] + #[prost(message, tag = "8")] DeleteAccount(super::DeleteAccountAction), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct CreateAccountAction { -} +pub struct CreateAccountAction {} +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeployContractAction { - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub code: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FunctionCallAction { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub method_name: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub args: ::prost::alloc::vec::Vec, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub gas: u64, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub deposit: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransferAction { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub deposit: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StakeAction { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub stake: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub public_key: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AddKeyAction { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub public_key: ::core::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub access_key: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteKeyAction { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub public_key: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteAccountAction { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub beneficiary_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccessKey { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub nonce: u64, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub permission: ::core::option::Option, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AccessKeyPermission { - #[prost(oneof="access_key_permission::Permission", tags="1, 2")] + #[prost(oneof = "access_key_permission::Permission", tags = "1, 2")] pub permission: ::core::option::Option, } /// Nested message and enum types in `AccessKeyPermission`. pub mod access_key_permission { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Permission { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] FunctionCall(super::FunctionCallPermission), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] FullAccess(super::FullAccessPermission), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FunctionCallPermission { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub allowance: ::core::option::Option, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub receiver_id: ::prost::alloc::string::String, - #[prost(string, repeated, tag="3")] + #[prost(string, repeated, tag = "3")] pub method_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct FullAccessPermission { -} +pub struct FullAccessPermission {} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CurveKind { Ed25519 = 0, Secp256k1 = 1, } +impl CurveKind { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + CurveKind::Ed25519 => "ED25519", + CurveKind::Secp256k1 => "SECP256K1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ED25519" => Some(Self::Ed25519), + "SECP256K1" => Some(Self::Secp256k1), + _ => None, + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum ExecutionMetadata { V1 = 0, } -///todo: add more detail? +impl ExecutionMetadata { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ExecutionMetadata::V1 => "ExecutionMetadataV1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ExecutionMetadataV1" => Some(Self::V1), + _ => None, + } + } +} +/// todo: add more detail? #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum FunctionCallErrorSer { @@ -811,7 +936,39 @@ pub enum FunctionCallErrorSer { EvmError = 6, ExecutionError = 7, } -///todo: add more detail? +impl FunctionCallErrorSer { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + FunctionCallErrorSer::CompilationError => "CompilationError", + FunctionCallErrorSer::LinkError => "LinkError", + FunctionCallErrorSer::MethodResolveError => "MethodResolveError", + FunctionCallErrorSer::WasmTrap => "WasmTrap", + FunctionCallErrorSer::WasmUnknownError => "WasmUnknownError", + FunctionCallErrorSer::HostError => "HostError", + FunctionCallErrorSer::EvmError => "_EVMError", + FunctionCallErrorSer::ExecutionError => "ExecutionError", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "CompilationError" => Some(Self::CompilationError), + "LinkError" => Some(Self::LinkError), + "MethodResolveError" => Some(Self::MethodResolveError), + "WasmTrap" => Some(Self::WasmTrap), + "WasmUnknownError" => Some(Self::WasmUnknownError), + "HostError" => Some(Self::HostError), + "_EVMError" => Some(Self::EvmError), + "ExecutionError" => Some(Self::ExecutionError), + _ => None, + } + } +} +/// todo: add more detail? #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum ReceiptValidationError { @@ -823,7 +980,45 @@ pub enum ReceiptValidationError { NumberInputDataDependenciesExceeded = 5, ActionsValidationError = 6, } -///todo: add more detail? +impl ReceiptValidationError { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ReceiptValidationError::InvalidPredecessorId => "InvalidPredecessorId", + ReceiptValidationError::InvalidReceiverAccountId => { + "InvalidReceiverAccountId" + } + ReceiptValidationError::InvalidSignerAccountId => "InvalidSignerAccountId", + ReceiptValidationError::InvalidDataReceiverId => "InvalidDataReceiverId", + ReceiptValidationError::ReturnedValueLengthExceeded => { + "ReturnedValueLengthExceeded" + } + ReceiptValidationError::NumberInputDataDependenciesExceeded => { + "NumberInputDataDependenciesExceeded" + } + ReceiptValidationError::ActionsValidationError => "ActionsValidationError", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "InvalidPredecessorId" => Some(Self::InvalidPredecessorId), + "InvalidReceiverAccountId" => Some(Self::InvalidReceiverAccountId), + "InvalidSignerAccountId" => Some(Self::InvalidSignerAccountId), + "InvalidDataReceiverId" => Some(Self::InvalidDataReceiverId), + "ReturnedValueLengthExceeded" => Some(Self::ReturnedValueLengthExceeded), + "NumberInputDataDependenciesExceeded" => { + Some(Self::NumberInputDataDependenciesExceeded) + } + "ActionsValidationError" => Some(Self::ActionsValidationError), + _ => None, + } + } +} +/// todo: add more detail? #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum InvalidTxError { @@ -842,9 +1037,73 @@ pub enum InvalidTxError { ActionsValidation = 12, TransactionSizeExceeded = 13, } +impl InvalidTxError { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + InvalidTxError::InvalidAccessKeyError => "InvalidAccessKeyError", + InvalidTxError::InvalidSignerId => "InvalidSignerId", + InvalidTxError::SignerDoesNotExist => "SignerDoesNotExist", + InvalidTxError::InvalidNonce => "InvalidNonce", + InvalidTxError::NonceTooLarge => "NonceTooLarge", + InvalidTxError::InvalidReceiverId => "InvalidReceiverId", + InvalidTxError::InvalidSignature => "InvalidSignature", + InvalidTxError::NotEnoughBalance => "NotEnoughBalance", + InvalidTxError::LackBalanceForState => "LackBalanceForState", + InvalidTxError::CostOverflow => "CostOverflow", + InvalidTxError::InvalidChain => "InvalidChain", + InvalidTxError::Expired => "Expired", + InvalidTxError::ActionsValidation => "ActionsValidation", + InvalidTxError::TransactionSizeExceeded => "TransactionSizeExceeded", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "InvalidAccessKeyError" => Some(Self::InvalidAccessKeyError), + "InvalidSignerId" => Some(Self::InvalidSignerId), + "SignerDoesNotExist" => Some(Self::SignerDoesNotExist), + "InvalidNonce" => Some(Self::InvalidNonce), + "NonceTooLarge" => Some(Self::NonceTooLarge), + "InvalidReceiverId" => Some(Self::InvalidReceiverId), + "InvalidSignature" => Some(Self::InvalidSignature), + "NotEnoughBalance" => Some(Self::NotEnoughBalance), + "LackBalanceForState" => Some(Self::LackBalanceForState), + "CostOverflow" => Some(Self::CostOverflow), + "InvalidChain" => Some(Self::InvalidChain), + "Expired" => Some(Self::Expired), + "ActionsValidation" => Some(Self::ActionsValidation), + "TransactionSizeExceeded" => Some(Self::TransactionSizeExceeded), + _ => None, + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Direction { Left = 0, Right = 1, } +impl Direction { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Direction::Left => "left", + Direction::Right => "right", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "left" => Some(Self::Left), + "right" => Some(Self::Right), + _ => None, + } + } +} diff --git a/chain/substreams/Cargo.toml b/chain/substreams/Cargo.toml index e2eeb3c662e..cddfaae4ba9 100644 --- a/chain/substreams/Cargo.toml +++ b/chain/substreams/Cargo.toml @@ -4,7 +4,7 @@ version.workspace = true edition.workspace = true [build-dependencies] -tonic-build = { version = "0.7.2", features = ["prost"] } +tonic-build = { workspace = true } [dependencies] async-stream = "0.3" @@ -16,8 +16,8 @@ graph = { path = "../../graph" } graph-runtime-wasm = { path = "../../runtime/wasm" } lazy_static = "1.2.0" serde = "1.0" -prost = "0.10.4" -prost-types = "0.10.1" +prost = { workspace = true } +prost-types = { workspace = true } dirs-next = "2.0" anyhow = "1.0" tiny-keccak = "1.5.0" diff --git a/chain/substreams/build.rs b/chain/substreams/build.rs index 8998174122b..74a26348b7f 100644 --- a/chain/substreams/build.rs +++ b/chain/substreams/build.rs @@ -1,6 +1,7 @@ fn main() { println!("cargo:rerun-if-changed=proto"); tonic_build::configure() + .protoc_arg("--experimental_allow_proto3_optional") .out_dir("src/protobuf") .compile(&["codec.proto"], &["proto"]) .expect("Failed to compile Substreams entity proto(s)"); diff --git a/chain/substreams/src/protobuf/substreams.entity.v1.rs b/chain/substreams/src/protobuf/substreams.entity.v1.rs index de1dd2f173d..47368e25fba 100644 --- a/chain/substreams/src/protobuf/substreams.entity.v1.rs +++ b/chain/substreams/src/protobuf/substreams.entity.v1.rs @@ -1,24 +1,36 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EntityChanges { - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub entity_changes: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EntityChange { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub entity: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub id: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub ordinal: u64, - #[prost(enumeration="entity_change::Operation", tag="4")] + #[prost(enumeration = "entity_change::Operation", tag = "4")] pub operation: i32, - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub fields: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `EntityChange`. pub mod entity_change { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Operation { /// Protobuf default should not be used, this is used so that the consume can ensure that the value was actually specified @@ -27,45 +39,71 @@ pub mod entity_change { Update = 2, Delete = 3, } + impl Operation { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Operation::Unset => "UNSET", + Operation::Create => "CREATE", + Operation::Update => "UPDATE", + Operation::Delete => "DELETE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSET" => Some(Self::Unset), + "CREATE" => Some(Self::Create), + "UPDATE" => Some(Self::Update), + "DELETE" => Some(Self::Delete), + _ => None, + } + } + } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Value { - #[prost(oneof="value::Typed", tags="1, 2, 3, 4, 5, 6, 10")] + #[prost(oneof = "value::Typed", tags = "1, 2, 3, 4, 5, 6, 10")] pub typed: ::core::option::Option, } /// Nested message and enum types in `Value`. pub mod value { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Typed { - #[prost(int32, tag="1")] + #[prost(int32, tag = "1")] Int32(i32), - #[prost(string, tag="2")] + #[prost(string, tag = "2")] Bigdecimal(::prost::alloc::string::String), - #[prost(string, tag="3")] + #[prost(string, tag = "3")] Bigint(::prost::alloc::string::String), - #[prost(string, tag="4")] + #[prost(string, tag = "4")] String(::prost::alloc::string::String), - #[prost(bytes, tag="5")] + #[prost(bytes, tag = "5")] Bytes(::prost::alloc::vec::Vec), - #[prost(bool, tag="6")] + #[prost(bool, tag = "6")] Bool(bool), - //reserved 7 to 9; // For future types - - #[prost(message, tag="10")] + #[prost(message, tag = "10")] Array(super::Array), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Array { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub value: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Field { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub new_value: ::core::option::Option, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub old_value: ::core::option::Option, } diff --git a/graph/Cargo.toml b/graph/Cargo.toml index e7bf6ca0294..a92063950e0 100644 --- a/graph/Cargo.toml +++ b/graph/Cargo.toml @@ -50,9 +50,9 @@ tokio-retry = "0.3.0" url = "2.3.1" prometheus = "0.13.3" priority-queue = "0.7.0" -tonic = { version = "0.7.1", features = ["tls-roots", "compression"] } -prost = "0.10.4" -prost-types = "0.10.1" +tonic = { workspace = true } +prost = { workspace = true } +prost-types = { workspace = true } futures03 = { version = "0.3.1", package = "futures", features = ["compat"] } wasmparser = "0.78.2" @@ -71,4 +71,4 @@ clap = { version = "3.2.23", features = ["derive", "env"] } maplit = "1.0.2" [build-dependencies] -tonic-build = { version = "0.7.2", features = ["prost", "compression"] } +tonic-build = { workspace = true } diff --git a/graph/build.rs b/graph/build.rs index 67e99207ea1..14399c784c1 100644 --- a/graph/build.rs +++ b/graph/build.rs @@ -14,6 +14,7 @@ fn main() { .expect("Failed to compile Firehose proto(s)"); tonic_build::configure() + .protoc_arg("--experimental_allow_proto3_optional") .out_dir("src/substreams") .compile(&["proto/substreams.proto"], &["proto"]) .expect("Failed to compile Substreams proto(s)"); diff --git a/graph/src/firehose/endpoints.rs b/graph/src/firehose/endpoints.rs index 0bea487f81c..93b07679ed2 100644 --- a/graph/src/firehose/endpoints.rs +++ b/graph/src/firehose/endpoints.rs @@ -14,6 +14,7 @@ use http::uri::{Scheme, Uri}; use slog::Logger; use std::{collections::BTreeMap, fmt::Display, sync::Arc, time::Duration}; use tonic::{ + codegen::CompressionEncoding, metadata::MetadataValue, transport::{Channel, ClientTlsConfig}, Request, @@ -95,7 +96,7 @@ impl FirehoseEndpoint { M: prost::Message + BlockchainBlock + Default + 'static, { let token_metadata = match self.token.clone() { - Some(token) => Some(MetadataValue::from_str(token.as_str())?), + Some(token) => Some(MetadataValue::try_from(token.as_str())?), None => None, }; @@ -109,10 +110,10 @@ impl FirehoseEndpoint { Ok(r) }, ) - .accept_gzip(); + .accept_compressed(CompressionEncoding::Gzip); if self.compression_enabled { - client = client.send_gzip(); + client = client.send_compressed(CompressionEncoding::Gzip); } debug!( @@ -160,7 +161,7 @@ impl FirehoseEndpoint { M: prost::Message + BlockchainBlock + Default + 'static, { let token_metadata = match self.token.clone() { - Some(token) => Some(MetadataValue::from_str(token.as_str())?), + Some(token) => Some(MetadataValue::try_from(token.as_str())?), None => None, }; @@ -174,10 +175,10 @@ impl FirehoseEndpoint { Ok(r) }, ) - .accept_gzip(); + .accept_compressed(CompressionEncoding::Gzip); if self.compression_enabled { - client = client.send_gzip(); + client = client.send_compressed(CompressionEncoding::Gzip); } debug!( @@ -254,7 +255,7 @@ impl FirehoseEndpoint { request: firehose::Request, ) -> Result, anyhow::Error> { let token_metadata = match self.token.clone() { - Some(token) => Some(MetadataValue::from_str(token.as_str())?), + Some(token) => Some(MetadataValue::try_from(token.as_str())?), None => None, }; @@ -268,9 +269,9 @@ impl FirehoseEndpoint { Ok(r) }, ) - .accept_gzip(); + .accept_compressed(CompressionEncoding::Gzip); if self.compression_enabled { - client = client.send_gzip(); + client = client.send_compressed(CompressionEncoding::Gzip); } let response_stream = client.blocks(request).await?; @@ -284,7 +285,7 @@ impl FirehoseEndpoint { request: substreams::Request, ) -> Result, anyhow::Error> { let token_metadata = match self.token.clone() { - Some(token) => Some(MetadataValue::from_str(token.as_str())?), + Some(token) => Some(MetadataValue::try_from(token.as_str())?), None => None, }; diff --git a/graph/src/firehose/sf.cosmos.transform.v1.rs b/graph/src/firehose/sf.cosmos.transform.v1.rs index f93fef1810f..2a8f1251991 100644 --- a/graph/src/firehose/sf.cosmos.transform.v1.rs +++ b/graph/src/firehose/sf.cosmos.transform.v1.rs @@ -1,5 +1,6 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventTypeFilter { - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub event_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } diff --git a/graph/src/firehose/sf.ethereum.transform.v1.rs b/graph/src/firehose/sf.ethereum.transform.v1.rs index 62a07b9a10d..19e07c08537 100644 --- a/graph/src/firehose/sf.ethereum.transform.v1.rs +++ b/graph/src/firehose/sf.ethereum.transform.v1.rs @@ -1,36 +1,38 @@ /// CombinedFilter is a combination of "LogFilters" and "CallToFilters" /// /// It transforms the requested stream in two ways: -/// 1. STRIPPING -/// The block data is stripped from all transactions that don't -/// match any of the filters. +/// 1. STRIPPING +/// The block data is stripped from all transactions that don't +/// match any of the filters. /// -/// 2. SKIPPING -/// If an "block index" covers a range containing a -/// block that does NOT match any of the filters, the block will be -/// skipped altogether, UNLESS send_all_block_headers is enabled -/// In that case, the block would still be sent, but without any -/// transactionTrace +/// 2. SKIPPING +/// If an "block index" covers a range containing a +/// block that does NOT match any of the filters, the block will be +/// skipped altogether, UNLESS send_all_block_headers is enabled +/// In that case, the block would still be sent, but without any +/// transactionTrace /// /// The SKIPPING feature only applies to historical blocks, because /// the "block index" is always produced after the merged-blocks files /// are produced. Therefore, the "live" blocks are never filtered out. /// +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CombinedFilter { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub log_filters: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub call_filters: ::prost::alloc::vec::Vec, /// Always send all blocks. if they don't match any log_filters or call_filters, /// all the transactions will be filtered out, sending only the header. - #[prost(bool, tag="3")] + #[prost(bool, tag = "3")] pub send_all_block_headers: bool, } /// MultiLogFilter concatenates the results of each LogFilter (inclusive OR) +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultiLogFilter { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub log_filters: ::prost::alloc::vec::Vec, } /// LogFilter will match calls where *BOTH* @@ -38,18 +40,20 @@ pub struct MultiLogFilter { /// * the event signature (topic.0) is one of the provided event_signatures -- OR event_signatures is empty -- /// /// a LogFilter with both empty addresses and event_signatures lists is invalid and will fail. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LogFilter { - #[prost(bytes="vec", repeated, tag="1")] + #[prost(bytes = "vec", repeated, tag = "1")] pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, /// corresponds to the keccak of the event signature which is stores in topic.0 - #[prost(bytes="vec", repeated, tag="2")] + #[prost(bytes = "vec", repeated, tag = "2")] pub event_signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } /// MultiCallToFilter concatenates the results of each CallToFilter (inclusive OR) +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultiCallToFilter { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub call_filters: ::prost::alloc::vec::Vec, } /// CallToFilter will match calls where *BOTH* @@ -57,18 +61,19 @@ pub struct MultiCallToFilter { /// * the method signature (in 4-bytes format) is one of the provided signatures -- OR signatures is empty -- /// /// a CallToFilter with both empty addresses and signatures lists is invalid and will fail. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CallToFilter { - #[prost(bytes="vec", repeated, tag="1")] + #[prost(bytes = "vec", repeated, tag = "1")] pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(bytes="vec", repeated, tag="2")] + #[prost(bytes = "vec", repeated, tag = "2")] pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } /// Deprecated: LightBlock is deprecated, replaced by HeaderOnly, note however that the new transform /// does not have any transactions traces returned, so it's not a direct replacement. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct LightBlock { -} +pub struct LightBlock {} /// HeaderOnly returns only the block's header and few top-level core information for the block. Useful /// for cases where no transactions information is required at all. /// @@ -76,15 +81,15 @@ pub struct LightBlock { /// /// ```ignore /// Block { -/// int32 ver = 1; -/// bytes hash = 2; -/// uint64 number = 3; -/// uint64 size = 4; -/// BlockHeader header = 5; +/// int32 ver = 1; +/// bytes hash = 2; +/// uint64 number = 3; +/// uint64 size = 4; +/// BlockHeader header = 5; /// } /// ``` /// /// Everything else will be empty. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct HeaderOnly { -} +pub struct HeaderOnly {} diff --git a/graph/src/firehose/sf.firehose.v2.rs b/graph/src/firehose/sf.firehose.v2.rs index 398ae003e6a..6a5b9d35204 100644 --- a/graph/src/firehose/sf.firehose.v2.rs +++ b/graph/src/firehose/sf.firehose.v2.rs @@ -1,47 +1,54 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SingleBlockRequest { - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub transforms: ::prost::alloc::vec::Vec<::prost_types::Any>, - #[prost(oneof="single_block_request::Reference", tags="3, 4, 5")] + #[prost(oneof = "single_block_request::Reference", tags = "3, 4, 5")] pub reference: ::core::option::Option, } /// Nested message and enum types in `SingleBlockRequest`. pub mod single_block_request { /// Get the current known canonical version of a block at with this number + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockNumber { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub num: u64, } /// Get the current block with specific hash and number + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockHashAndNumber { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub num: u64, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub hash: ::prost::alloc::string::String, } /// Get the block that generated a specific cursor + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Cursor { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub cursor: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Reference { - #[prost(message, tag="3")] + #[prost(message, tag = "3")] BlockNumber(BlockNumber), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] BlockHashAndNumber(BlockHashAndNumber), - #[prost(message, tag="5")] + #[prost(message, tag = "5")] Cursor(Cursor), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SingleBlockResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub block: ::core::option::Option<::prost_types::Any>, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Request { /// Controls where the stream of blocks will start. @@ -59,7 +66,7 @@ pub struct Request { /// /// If `start_cursor` is given, this value is ignored and the stream instead starts /// immediately after the Block pointed by the opaque `start_cursor` value. - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub start_block_num: i64, /// Controls where the stream of blocks will start which will be immediately after /// the Block pointed by this opaque cursor. @@ -67,32 +74,33 @@ pub struct Request { /// Obtain this value from a previously received `Response.cursor`. /// /// This value takes precedence over `start_block_num`. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub cursor: ::prost::alloc::string::String, /// When non-zero, controls where the stream of blocks will stop. /// /// The stream will close **after** that block has passed so the boundary is /// **inclusive**. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub stop_block_num: u64, /// With final_block_only, you only receive blocks with STEP_FINAL /// Default behavior will send blocks as STEP_NEW, with occasional STEP_UNDO - #[prost(bool, tag="4")] + #[prost(bool, tag = "4")] pub final_blocks_only: bool, - #[prost(message, repeated, tag="10")] + #[prost(message, repeated, tag = "10")] pub transforms: ::prost::alloc::vec::Vec<::prost_types::Any>, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Response { /// Chain specific block payload, ex: - /// - sf.eosio.type.v1.Block - /// - sf.ethereum.type.v1.Block - /// - sf.near.type.v1.Block - #[prost(message, optional, tag="1")] + /// - sf.eosio.type.v1.Block + /// - sf.ethereum.type.v1.Block + /// - sf.near.type.v1.Block + #[prost(message, optional, tag = "1")] pub block: ::core::option::Option<::prost_types::Any>, - #[prost(enumeration="ForkStep", tag="6")] + #[prost(enumeration = "ForkStep", tag = "6")] pub step: i32, - #[prost(string, tag="10")] + #[prost(string, tag = "10")] pub cursor: ::prost::alloc::string::String, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] @@ -107,10 +115,35 @@ pub enum ForkStep { /// see chain documentation for more details) StepFinal = 3, } +impl ForkStep { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ForkStep::StepUnset => "STEP_UNSET", + ForkStep::StepNew => "STEP_NEW", + ForkStep::StepUndo => "STEP_UNDO", + ForkStep::StepFinal => "STEP_FINAL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "STEP_UNSET" => Some(Self::StepUnset), + "STEP_NEW" => Some(Self::StepNew), + "STEP_UNDO" => Some(Self::StepUndo), + "STEP_FINAL" => Some(Self::StepFinal), + _ => None, + } + } +} /// Generated client implementations. pub mod stream_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct StreamClient { inner: tonic::client::Grpc, @@ -137,6 +170,10 @@ pub mod stream_client { let inner = tonic::client::Grpc::new(inner); Self { inner } } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } pub fn with_interceptor( inner: T, interceptor: F, @@ -156,19 +193,19 @@ pub mod stream_client { { StreamClient::new(InterceptedService::new(inner, interceptor)) } - /// Compress requests with `gzip`. + /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] - pub fn send_gzip(mut self) -> Self { - self.inner = self.inner.send_gzip(); + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); self } - /// Enable decompressing responses with `gzip`. + /// Enable decompressing responses. #[must_use] - pub fn accept_gzip(mut self) -> Self { - self.inner = self.inner.accept_gzip(); + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); self } pub async fn blocks( @@ -199,6 +236,7 @@ pub mod stream_client { pub mod fetch_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct FetchClient { inner: tonic::client::Grpc, @@ -225,6 +263,10 @@ pub mod fetch_client { let inner = tonic::client::Grpc::new(inner); Self { inner } } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } pub fn with_interceptor( inner: T, interceptor: F, @@ -244,19 +286,19 @@ pub mod fetch_client { { FetchClient::new(InterceptedService::new(inner, interceptor)) } - /// Compress requests with `gzip`. + /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] - pub fn send_gzip(mut self) -> Self { - self.inner = self.inner.send_gzip(); + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); self } - /// Enable decompressing responses with `gzip`. + /// Enable decompressing responses. #[must_use] - pub fn accept_gzip(mut self) -> Self { - self.inner = self.inner.accept_gzip(); + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); self } pub async fn block( @@ -284,10 +326,10 @@ pub mod fetch_client { pub mod stream_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; - ///Generated trait containing gRPC methods that should be implemented for use with StreamServer. + /// Generated trait containing gRPC methods that should be implemented for use with StreamServer. #[async_trait] pub trait Stream: Send + Sync + 'static { - ///Server streaming response type for the Blocks method. + /// Server streaming response type for the Blocks method. type BlocksStream: futures_core::Stream< Item = Result, > @@ -326,16 +368,16 @@ pub mod stream_server { { InterceptedService::new(Self::new(inner), interceptor) } - /// Enable decompressing requests with `gzip`. + /// Enable decompressing requests with the given encoding. #[must_use] - pub fn accept_gzip(mut self) -> Self { - self.accept_compression_encodings.enable_gzip(); + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); self } - /// Compress responses with `gzip`, if the client supports it. + /// Compress responses with the given encoding, if the client supports it. #[must_use] - pub fn send_gzip(mut self) -> Self { - self.send_compression_encodings.enable_gzip(); + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); self } } @@ -429,7 +471,7 @@ pub mod stream_server { write!(f, "{:?}", self.0) } } - impl tonic::transport::NamedService for StreamServer { + impl tonic::server::NamedService for StreamServer { const NAME: &'static str = "sf.firehose.v2.Stream"; } } @@ -437,7 +479,7 @@ pub mod stream_server { pub mod fetch_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; - ///Generated trait containing gRPC methods that should be implemented for use with FetchServer. + /// Generated trait containing gRPC methods that should be implemented for use with FetchServer. #[async_trait] pub trait Fetch: Send + Sync + 'static { async fn block( @@ -473,16 +515,16 @@ pub mod fetch_server { { InterceptedService::new(Self::new(inner), interceptor) } - /// Enable decompressing requests with `gzip`. + /// Enable decompressing requests with the given encoding. #[must_use] - pub fn accept_gzip(mut self) -> Self { - self.accept_compression_encodings.enable_gzip(); + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); self } - /// Compress responses with `gzip`, if the client supports it. + /// Compress responses with the given encoding, if the client supports it. #[must_use] - pub fn send_gzip(mut self) -> Self { - self.send_compression_encodings.enable_gzip(); + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); self } } @@ -575,7 +617,7 @@ pub mod fetch_server { write!(f, "{:?}", self.0) } } - impl tonic::transport::NamedService for FetchServer { + impl tonic::server::NamedService for FetchServer { const NAME: &'static str = "sf.firehose.v2.Fetch"; } } diff --git a/graph/src/firehose/sf.near.transform.v1.rs b/graph/src/firehose/sf.near.transform.v1.rs index 86972b6cc54..1b02d2b415e 100644 --- a/graph/src/firehose/sf.near.transform.v1.rs +++ b/graph/src/firehose/sf.near.transform.v1.rs @@ -1,8 +1,9 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BasicReceiptFilter { - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub accounts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub prefix_and_suffix_pairs: ::prost::alloc::vec::Vec, } /// PrefixSuffixPair applies a logical AND to prefix and suffix when both fields are non-empty. @@ -12,10 +13,11 @@ pub struct BasicReceiptFilter { /// * {prefix="",suffix=""} is invalid /// /// Note that the suffix will usually have a TLD, ex: "mydomain.near" or "mydomain.testnet" +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PrefixSuffixPair { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub prefix: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub suffix: ::prost::alloc::string::String, } diff --git a/graph/src/substreams/sf.substreams.v1.rs b/graph/src/substreams/sf.substreams.v1.rs index 70567e6b3bf..99ab0c0cf58 100644 --- a/graph/src/substreams/sf.substreams.v1.rs +++ b/graph/src/substreams/sf.substreams.v1.rs @@ -1,14 +1,15 @@ +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Request { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub start_block_num: i64, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub start_cursor: ::prost::alloc::string::String, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub stop_block_num: u64, - #[prost(enumeration="ForkStep", repeated, tag="4")] + #[prost(enumeration = "ForkStep", repeated, tag = "4")] pub fork_steps: ::prost::alloc::vec::Vec, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub irreversibility_condition: ::prost::alloc::string::String, /// By default, the engine runs in developer mode, with richer and deeper output, /// * support for multiple `output_modules`, of `store` and `map` kinds @@ -20,193 +21,211 @@ pub struct Request { /// * turns off support for `initial_store_snapshot_for_modules`, /// * still streams output linearly, with a cursor, but at higher speeds /// * and purges log outputs from responses. - #[prost(bool, tag="9")] + #[prost(bool, tag = "9")] pub production_mode: bool, - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub modules: ::core::option::Option, - #[prost(string, repeated, tag="7")] + #[prost(string, repeated, tag = "7")] pub output_modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(string, repeated, tag="8")] - pub initial_store_snapshot_for_modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "8")] + pub initial_store_snapshot_for_modules: ::prost::alloc::vec::Vec< + ::prost::alloc::string::String, + >, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Response { - #[prost(oneof="response::Message", tags="5, 1, 2, 3, 4")] + #[prost(oneof = "response::Message", tags = "5, 1, 2, 3, 4")] pub message: ::core::option::Option, } /// Nested message and enum types in `Response`. pub mod response { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Message { /// Always sent first - #[prost(message, tag="5")] + #[prost(message, tag = "5")] Session(super::SessionInit), /// Progress of data preparation, before sending in the stream of `data` events. - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Progress(super::ModulesProgress), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] SnapshotData(super::InitialSnapshotData), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] SnapshotComplete(super::InitialSnapshotComplete), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] Data(super::BlockScopedData), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SessionInit { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub trace_id: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InitialSnapshotComplete { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub cursor: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InitialSnapshotData { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub module_name: ::prost::alloc::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub deltas: ::core::option::Option, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub sent_keys: u64, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub total_keys: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockScopedData { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub outputs: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub clock: ::core::option::Option, - #[prost(enumeration="ForkStep", tag="6")] + #[prost(enumeration = "ForkStep", tag = "6")] pub step: i32, - #[prost(string, tag="10")] + #[prost(string, tag = "10")] pub cursor: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModuleOutput { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, - #[prost(string, repeated, tag="4")] + #[prost(string, repeated, tag = "4")] pub debug_logs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// LogsTruncated is a flag that tells you if you received all the logs or if they /// were truncated because you logged too much (fixed limit currently is set to 128 KiB). - #[prost(bool, tag="5")] + #[prost(bool, tag = "5")] pub debug_logs_truncated: bool, - #[prost(bool, tag="6")] + #[prost(bool, tag = "6")] pub cached: bool, - #[prost(oneof="module_output::Data", tags="2, 3")] + #[prost(oneof = "module_output::Data", tags = "2, 3")] pub data: ::core::option::Option, } /// Nested message and enum types in `ModuleOutput`. pub mod module_output { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Data { - #[prost(message, tag="2")] + #[prost(message, tag = "2")] MapOutput(::prost_types::Any), /// StoreDeltas are produced for store modules in development mode. /// It is not possible to retrieve store models in production, with parallelization /// enabled. If you need the deltas directly, write a pass through mapper module /// that will get them down to you. - #[prost(message, tag="3")] + #[prost(message, tag = "3")] DebugStoreDeltas(super::StoreDeltas), } } -// think about: -// message ModuleOutput { ... -// ModuleOutputDebug debug_info = 6; -// ...} -//message ModuleOutputDebug { -// StoreDeltas store_deltas = 3; -// repeated string logs = 4; -// // LogsTruncated is a flag that tells you if you received all the logs or if they -// // were truncated because you logged too much (fixed limit currently is set to 128 KiB). -// bool logs_truncated = 5; -//} - +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModulesProgress { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub modules: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModuleProgress { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, - #[prost(oneof="module_progress::Type", tags="2, 3, 4, 5")] + #[prost(oneof = "module_progress::Type", tags = "2, 3, 4, 5")] pub r#type: ::core::option::Option, } /// Nested message and enum types in `ModuleProgress`. pub mod module_progress { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProcessedRange { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub processed_ranges: ::prost::alloc::vec::Vec, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InitialState { - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub available_up_to_block: u64, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProcessedBytes { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub total_bytes_read: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub total_bytes_written: u64, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Failed { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub reason: ::prost::alloc::string::String, - #[prost(string, repeated, tag="2")] + #[prost(string, repeated, tag = "2")] pub logs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// FailureLogsTruncated is a flag that tells you if you received all the logs or if they /// were truncated because you logged too much (fixed limit currently is set to 128 KiB). - #[prost(bool, tag="3")] + #[prost(bool, tag = "3")] pub logs_truncated: bool, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Type { - #[prost(message, tag="2")] + #[prost(message, tag = "2")] ProcessedRanges(ProcessedRange), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] InitialState(InitialState), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] ProcessedBytes(ProcessedBytes), - #[prost(message, tag="5")] + #[prost(message, tag = "5")] Failed(Failed), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockRange { - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub start_block: u64, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub end_block: u64, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StoreDeltas { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub deltas: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StoreDelta { - #[prost(enumeration="store_delta::Operation", tag="1")] + #[prost(enumeration = "store_delta::Operation", tag = "1")] pub operation: i32, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub ordinal: u64, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub key: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="4")] + #[prost(bytes = "vec", tag = "4")] pub old_value: ::prost::alloc::vec::Vec, - #[prost(bytes="vec", tag="5")] + #[prost(bytes = "vec", tag = "5")] pub new_value: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `StoreDelta`. pub mod store_delta { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Operation { Unset = 0, @@ -214,57 +233,87 @@ pub mod store_delta { Update = 2, Delete = 3, } + impl Operation { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Operation::Unset => "UNSET", + Operation::Create => "CREATE", + Operation::Update => "UPDATE", + Operation::Delete => "DELETE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSET" => Some(Self::Unset), + "CREATE" => Some(Self::Create), + "UPDATE" => Some(Self::Update), + "DELETE" => Some(Self::Delete), + _ => None, + } + } + } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Output { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub block_num: u64, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub block_id: ::prost::alloc::string::String, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub timestamp: ::core::option::Option<::prost_types::Timestamp>, - #[prost(message, optional, tag="10")] + #[prost(message, optional, tag = "10")] pub value: ::core::option::Option<::prost_types::Any>, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Modules { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub modules: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub binaries: ::prost::alloc::vec::Vec, } /// Binary represents some code compiled to its binary form. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Binary { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub r#type: ::prost::alloc::string::String, - #[prost(bytes="vec", tag="2")] + #[prost(bytes = "vec", tag = "2")] pub content: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Module { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, - #[prost(uint32, tag="4")] + #[prost(uint32, tag = "4")] pub binary_index: u32, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub binary_entrypoint: ::prost::alloc::string::String, - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub inputs: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub output: ::core::option::Option, - #[prost(uint64, tag="8")] + #[prost(uint64, tag = "8")] pub initial_block: u64, - #[prost(oneof="module::Kind", tags="2, 3")] + #[prost(oneof = "module::Kind", tags = "2, 3")] pub kind: ::core::option::Option, } /// Nested message and enum types in `Module`. pub mod module { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KindMap { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub output_type: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KindStore { /// The `update_policy` determines the functions available to mutate the store @@ -275,14 +324,24 @@ pub mod module { /// cumulates keys from block 1M to 2M. When we want to use this /// store as a dependency for a downstream module, we will merge the /// two stores according to this policy. - #[prost(enumeration="kind_store::UpdatePolicy", tag="1")] + #[prost(enumeration = "kind_store::UpdatePolicy", tag = "1")] pub update_policy: i32, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub value_type: ::prost::alloc::string::String, } /// Nested message and enum types in `KindStore`. pub mod kind_store { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum UpdatePolicy { Unset = 0, @@ -299,107 +358,180 @@ pub mod module { /// Provides a store where you can `append()` keys, where two stores merge by concatenating the bytes in order. Append = 6, } + impl UpdatePolicy { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + UpdatePolicy::Unset => "UPDATE_POLICY_UNSET", + UpdatePolicy::Set => "UPDATE_POLICY_SET", + UpdatePolicy::SetIfNotExists => "UPDATE_POLICY_SET_IF_NOT_EXISTS", + UpdatePolicy::Add => "UPDATE_POLICY_ADD", + UpdatePolicy::Min => "UPDATE_POLICY_MIN", + UpdatePolicy::Max => "UPDATE_POLICY_MAX", + UpdatePolicy::Append => "UPDATE_POLICY_APPEND", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UPDATE_POLICY_UNSET" => Some(Self::Unset), + "UPDATE_POLICY_SET" => Some(Self::Set), + "UPDATE_POLICY_SET_IF_NOT_EXISTS" => Some(Self::SetIfNotExists), + "UPDATE_POLICY_ADD" => Some(Self::Add), + "UPDATE_POLICY_MIN" => Some(Self::Min), + "UPDATE_POLICY_MAX" => Some(Self::Max), + "UPDATE_POLICY_APPEND" => Some(Self::Append), + _ => None, + } + } + } } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Input { - #[prost(oneof="input::Input", tags="1, 2, 3")] + #[prost(oneof = "input::Input", tags = "1, 2, 3")] pub input: ::core::option::Option, } /// Nested message and enum types in `Input`. pub mod input { + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Source { /// ex: "sf.ethereum.type.v1.Block" - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub r#type: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Map { /// ex: "block_to_pairs" - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub module_name: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Store { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub module_name: ::prost::alloc::string::String, - #[prost(enumeration="store::Mode", tag="2")] + #[prost(enumeration = "store::Mode", tag = "2")] pub mode: i32, } /// Nested message and enum types in `Store`. pub mod store { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Mode { Unset = 0, Get = 1, Deltas = 2, } + impl Mode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Mode::Unset => "UNSET", + Mode::Get => "GET", + Mode::Deltas => "DELTAS", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSET" => Some(Self::Unset), + "GET" => Some(Self::Get), + "DELTAS" => Some(Self::Deltas), + _ => None, + } + } + } } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Input { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Source(Source), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Map(Map), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] Store(Store), } } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Output { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub r#type: ::prost::alloc::string::String, } + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Kind { - #[prost(message, tag="2")] + #[prost(message, tag = "2")] KindMap(KindMap), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] KindStore(KindStore), } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Package { /// Needs to be one so this file can be used _directly_ as a /// buf `Image` andor a ProtoSet for grpcurl and other tools - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub proto_files: ::prost::alloc::vec::Vec<::prost_types::FileDescriptorProto>, - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub version: u64, - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub modules: ::core::option::Option, - #[prost(message, repeated, tag="7")] + #[prost(message, repeated, tag = "7")] pub module_meta: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag="8")] + #[prost(message, repeated, tag = "8")] pub package_meta: ::prost::alloc::vec::Vec, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PackageMetadata { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub version: ::prost::alloc::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub url: ::prost::alloc::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub name: ::prost::alloc::string::String, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub doc: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModuleMetadata { /// Corresponds to the index in `Package.metadata.package_meta` - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub package_index: u64, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub doc: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Clock { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub number: u64, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub timestamp: ::core::option::Option<::prost_types::Timestamp>, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] @@ -413,10 +545,35 @@ pub enum ForkStep { /// Block is now irreversible and can be committed to (finality is chain specific, see chain documentation for more details) StepIrreversible = 4, } +impl ForkStep { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ForkStep::StepUnknown => "STEP_UNKNOWN", + ForkStep::StepNew => "STEP_NEW", + ForkStep::StepUndo => "STEP_UNDO", + ForkStep::StepIrreversible => "STEP_IRREVERSIBLE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "STEP_UNKNOWN" => Some(Self::StepUnknown), + "STEP_NEW" => Some(Self::StepNew), + "STEP_UNDO" => Some(Self::StepUndo), + "STEP_IRREVERSIBLE" => Some(Self::StepIrreversible), + _ => None, + } + } +} /// Generated client implementations. pub mod stream_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; + use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct StreamClient { inner: tonic::client::Grpc, @@ -443,6 +600,10 @@ pub mod stream_client { let inner = tonic::client::Grpc::new(inner); Self { inner } } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } pub fn with_interceptor( inner: T, interceptor: F, @@ -462,19 +623,19 @@ pub mod stream_client { { StreamClient::new(InterceptedService::new(inner, interceptor)) } - /// Compress requests with `gzip`. + /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] - pub fn send_gzip(mut self) -> Self { - self.inner = self.inner.send_gzip(); + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); self } - /// Enable decompressing responses with `gzip`. + /// Enable decompressing responses. #[must_use] - pub fn accept_gzip(mut self) -> Self { - self.inner = self.inner.accept_gzip(); + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); self } pub async fn blocks( @@ -505,10 +666,10 @@ pub mod stream_client { pub mod stream_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; - ///Generated trait containing gRPC methods that should be implemented for use with StreamServer. + /// Generated trait containing gRPC methods that should be implemented for use with StreamServer. #[async_trait] pub trait Stream: Send + Sync + 'static { - ///Server streaming response type for the Blocks method. + /// Server streaming response type for the Blocks method. type BlocksStream: futures_core::Stream< Item = Result, > @@ -547,16 +708,16 @@ pub mod stream_server { { InterceptedService::new(Self::new(inner), interceptor) } - /// Enable decompressing requests with `gzip`. + /// Enable decompressing requests with the given encoding. #[must_use] - pub fn accept_gzip(mut self) -> Self { - self.accept_compression_encodings.enable_gzip(); + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); self } - /// Compress responses with `gzip`, if the client supports it. + /// Compress responses with the given encoding, if the client supports it. #[must_use] - pub fn send_gzip(mut self) -> Self { - self.send_compression_encodings.enable_gzip(); + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); self } } @@ -650,7 +811,7 @@ pub mod stream_server { write!(f, "{:?}", self.0) } } - impl tonic::transport::NamedService for StreamServer { + impl tonic::server::NamedService for StreamServer { const NAME: &'static str = "sf.substreams.v1.Stream"; } } diff --git a/store/test-store/Cargo.toml b/store/test-store/Cargo.toml index c17cf692e75..0c7c55bc662 100644 --- a/store/test-store/Cargo.toml +++ b/store/test-store/Cargo.toml @@ -17,4 +17,4 @@ lazy_static = "1.1" hex-literal = "0.3" diesel = { version = "1.4.8", features = ["postgres", "serde_json", "numeric", "r2d2"] } serde = "1.0" -prost-types = "0.10.1" +prost-types = { workspace = true }