diff --git a/Cargo.lock b/Cargo.lock index 1e1b863..bebb836 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1633,7 +1633,7 @@ dependencies = [ "sha2 0.10.8", "sha3", "thiserror", - "uuid", + "uuid 0.8.2", ] [[package]] @@ -2678,7 +2678,7 @@ dependencies = [ "ibc-primitives", "prost 0.12.3", "serde", - "tendermint", + "tendermint 0.34.0", "tendermint-light-client-verifier", ] @@ -2697,9 +2697,9 @@ dependencies = [ "ibc-proto", "prost 0.12.3", "serde", - "tendermint", + "tendermint 0.34.0", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.34.0", ] [[package]] @@ -2762,7 +2762,7 @@ dependencies = [ "serde", "sha2 0.10.8", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -2796,7 +2796,7 @@ dependencies = [ "ibc-primitives", "prost 0.12.3", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -2814,7 +2814,7 @@ dependencies = [ "prost 0.12.3", "serde", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -2863,7 +2863,7 @@ dependencies = [ "prost 0.12.3", "serde", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -2901,7 +2901,7 @@ dependencies = [ "prost 0.12.3", "serde", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -2946,7 +2946,7 @@ dependencies = [ "serde", "sha2 0.10.8", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -2992,7 +2992,7 @@ dependencies = [ "prost 0.12.3", "serde", "subtle-encoding", - "tendermint", + "tendermint 0.34.0", ] [[package]] @@ -3018,7 +3018,7 @@ dependencies = [ "ibc-proto", "prost 0.12.3", "serde", - "tendermint", + "tendermint 0.34.0", "time", ] @@ -3035,7 +3035,7 @@ dependencies = [ "prost 0.12.3", "serde", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.34.0", ] [[package]] @@ -3714,7 +3714,7 @@ dependencies = [ "k256", "masp_primitives", "namada_macros", - "num-derive", + "num-derive 0.3.3", "num-integer", "num-rational 0.4.1", "num-traits", @@ -3729,8 +3729,8 @@ dependencies = [ "serde_json", "sha2 0.9.9", "sparse-merkle-tree", - "tendermint", - "tendermint-proto", + "tendermint 0.34.0", + "tendermint-proto 0.34.0", "thiserror", "tiny-keccak", "tracing", @@ -3760,9 +3760,9 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "tendermint", - "tendermint-proto", - "tendermint-rpc", + "tendermint 0.34.0", + "tendermint-proto 0.34.0", + "tendermint-rpc 0.34.0", "thiserror", "tracing", ] @@ -3921,8 +3921,8 @@ dependencies = [ "serde_json", "sha2 0.9.9", "slip10_ed25519", - "tendermint-config", - "tendermint-rpc", + "tendermint-config 0.34.0", + "tendermint-rpc 0.34.0", "thiserror", "tiny-bip39", "tiny-hderive", @@ -4015,7 +4015,7 @@ dependencies = [ "masp_primitives", "namada_core", "namada_gas", - "num-derive", + "num-derive 0.3.3", "num-traits", "prost 0.12.3", "prost-types 0.12.3", @@ -4068,10 +4068,10 @@ dependencies = [ "serde_derive", "serde_json", "sqlx", - "tendermint", - "tendermint-config", - "tendermint-proto", - "tendermint-rpc", + "tendermint 0.35.0", + "tendermint-config 0.35.0", + "tendermint-proto 0.35.0", + "tendermint-rpc 0.35.0", "thiserror", "time", "tokio", @@ -4212,6 +4212,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -4275,7 +4286,7 @@ checksum = "aa9b5179e82f0867b23e0b9b822493821f9345561f271364f409c8e4a058367d" dependencies = [ "lazy_static", "num 0.4.1", - "num-derive", + "num-derive 0.3.3", "num-traits", "serde", "serde_derive", @@ -4725,8 +4736,18 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07c0b841ea54f523f7aa556956fbd293bcbe06f2e67d2eb732b7278aaf1d166a" dependencies = [ - "peg-macros", - "peg-runtime", + "peg-macros 0.7.0", + "peg-runtime 0.7.0", +] + +[[package]] +name = "peg" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "400bcab7d219c38abf8bd7cc2054eb9bbbd4312d66f6a5557d572a203f646f61" +dependencies = [ + "peg-macros 0.8.2", + "peg-runtime 0.8.2", ] [[package]] @@ -4735,7 +4756,18 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aa52829b8decbef693af90202711348ab001456803ba2a98eb4ec8fb70844c" dependencies = [ - "peg-runtime", + "peg-runtime 0.7.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-macros" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e61cce859b76d19090f62da50a9fe92bab7c2a5f09e183763559a2ac392c90" +dependencies = [ + "peg-runtime 0.8.2", "proc-macro2", "quote", ] @@ -4746,6 +4778,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c719dcf55f09a3a7e764c6649ab594c18a177e3599c467983cdf644bfc0a4088" +[[package]] +name = "peg-runtime" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922" + [[package]] name = "pem" version = "1.1.1" @@ -6418,7 +6456,36 @@ dependencies = [ "signature", "subtle 2.4.1", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.34.0", + "time", + "zeroize", +] + +[[package]] +name = "tendermint" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f8a10105d0a7c4af0a242e23ed5a12519afe5cc0e68419da441bb5981a6802" +dependencies = [ + "bytes", + "digest 0.10.7", + "ed25519", + "ed25519-consensus 2.1.0", + "flex-error", + "futures", + "num-traits", + "once_cell", + "prost 0.12.3", + "prost-types 0.12.3", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "signature", + "subtle 2.4.1", + "subtle-encoding", + "tendermint-proto 0.35.0", "time", "zeroize", ] @@ -6432,11 +6499,25 @@ dependencies = [ "flex-error", "serde", "serde_json", - "tendermint", + "tendermint 0.34.0", "toml 0.5.11", "url", ] +[[package]] +name = "tendermint-config" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac6bf36c613bb113737c333e3c1d6dfd3c99f8ac679e84feb58dd6456d77fb2e" +dependencies = [ + "flex-error", + "serde", + "serde_json", + "tendermint 0.35.0", + "toml 0.8.2", + "url", +] + [[package]] name = "tendermint-light-client-verifier" version = "0.34.0" @@ -6446,7 +6527,7 @@ dependencies = [ "derive_more", "flex-error", "serde", - "tendermint", + "tendermint 0.34.0", "time", ] @@ -6458,7 +6539,25 @@ checksum = "2cc728a4f9e891d71adf66af6ecaece146f9c7a11312288a3107b3e1d6979aaf" dependencies = [ "bytes", "flex-error", - "num-derive", + "num-derive 0.3.3", + "num-traits", + "prost 0.12.3", + "prost-types 0.12.3", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + +[[package]] +name = "tendermint-proto" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff525d5540a9fc535c38dc0d92a98da3ee36fcdfbda99cecb9f3cce5cd4d41d7" +dependencies = [ + "bytes", + "flex-error", + "num-derive 0.4.2", "num-traits", "prost 0.12.3", "prost-types 0.12.3", @@ -6473,14 +6572,43 @@ name = "tendermint-rpc" version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfbf0a4753b46a190f367337e0163d0b552a2674a6bac54e74f9f2cdcde2969b" +dependencies = [ + "async-trait", + "bytes", + "flex-error", + "getrandom 0.2.11", + "peg 0.7.0", + "pin-project", + "semver 1.0.20", + "serde", + "serde_bytes", + "serde_json", + "subtle 2.4.1", + "subtle-encoding", + "tendermint 0.34.0", + "tendermint-config 0.34.0", + "tendermint-proto 0.34.0", + "thiserror", + "time", + "url", + "uuid 0.8.2", + "walkdir", +] + +[[package]] +name = "tendermint-rpc" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d8fe61b1772cd50038bdeeadf53773bb37a09e639dd8e6d996668fd220ddb29" dependencies = [ "async-trait", "bytes", "flex-error", "futures", "getrandom 0.2.11", - "peg", + "peg 0.8.2", "pin-project", + "rand 0.8.5", "reqwest", "semver 1.0.20", "serde", @@ -6488,15 +6616,15 @@ dependencies = [ "serde_json", "subtle 2.4.1", "subtle-encoding", - "tendermint", - "tendermint-config", - "tendermint-proto", + "tendermint 0.35.0", + "tendermint-config 0.35.0", + "tendermint-proto 0.35.0", "thiserror", "time", "tokio", "tracing", "url", - "uuid", + "uuid 1.8.0", "walkdir", ] @@ -7153,6 +7281,12 @@ dependencies = [ "serde", ] +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + [[package]] name = "valuable" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 774daeb..63cad8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,10 +59,10 @@ opentelemetry_api = { version = "0.20.0", features = ["metrics"] } axum-prometheus = { version = "0.4.0", optional = true } metrics = "0.21.1" metrics-exporter-prometheus = { version = "0.12.1", optional = true } -tendermint = "0.34.0" -tendermint-config = "0.34.0" -tendermint-rpc = { version = "0.34.0", features = ["http-client"] } -tendermint-proto = "0.34.0" +tendermint = "0.35.0" +tendermint-config = "0.35.0" +tendermint-rpc = { version = "0.35.0", features = ["http-client"] } +tendermint-proto = "0.35.0" clap = { version = "4.4.2", features = ["derive", "env"] } ureq = "2.9.1" diff --git a/src/database.rs b/src/database.rs index 9fb8486..eef8974 100644 --- a/src/database.rs +++ b/src/database.rs @@ -7,7 +7,6 @@ use namada_sdk::{ account::{InitAccount, UpdateAccount}, borsh::BorshDeserialize, governance::{InitProposalData, VoteProposalData}, - tendermint_proto::types::EvidenceList as RawEvidenceList, tx::{ data::{ pgf::UpdateStewardCommission, @@ -35,6 +34,7 @@ use std::time::Duration; use tendermint::block::Block; use tendermint_proto::types::evidence::Sum; use tendermint_proto::types::CommitSig; +use tendermint_proto::types::EvidenceList as RawEvidenceList; use tendermint_rpc::endpoint::block_results; use tracing::{debug, info, instrument}; diff --git a/src/indexer/mod.rs b/src/indexer/mod.rs index 75aee3b..c615450 100644 --- a/src/indexer/mod.rs +++ b/src/indexer/mod.rs @@ -14,7 +14,6 @@ use tendermint_rpc::{self, Client, HttpClient}; use tokio::sync::mpsc::Receiver; use tokio::sync::mpsc::Sender; use tokio::task::JoinHandle; -use tokio::time::timeout; use tracing::{info, instrument}; pub mod utils; @@ -31,10 +30,6 @@ const WAIT_FOR_BLOCK: u64 = 10; // processes. const MAX_BLOCKS_IN_CHANNEL: usize = 100; -// Timeout duration after triggering an error -// due to block_producer task hanging -const TIMEOUT_DURATION: Duration = Duration::from_secs(30); - // Block info required to be saved type BlockInfo = (Block, block_results::Response); @@ -46,7 +41,7 @@ async fn get_block(block_height: u32, chain_name: &str, client: &HttpClient) -> let instant = tokio::time::Instant::now(); - let response = client.block(height).await; + let response = client.block(block_height).await; let dur = instant.elapsed(); @@ -235,12 +230,7 @@ pub async fn start_indexing( spawn_block_producer(current_height as _, chain_name, client, producer_shutdown); // Block consumer that stores block into the database - // Propagades a Timeout error if producer task hangs which means it stop sending new blocks - // through the channel for longer than 30 seconds - while let Some(block) = timeout(TIMEOUT_DURATION, rx.recv()) - .await - .map_err(Error::Timeout)? - { + while let Some(block) = rx.recv().await { // block is now the block info and the block results if let Err(e) = db.save_block(&block.0, &block.1, &checksums_map).await { // shutdown producer task