diff --git a/crates/bin/pd/src/consensus.rs b/crates/bin/pd/src/consensus.rs index d5772069ff..130e6f42c4 100644 --- a/crates/bin/pd/src/consensus.rs +++ b/crates/bin/pd/src/consensus.rs @@ -3,7 +3,7 @@ use anyhow::Result; use penumbra_chain::genesis; use penumbra_storage::Storage; use tendermint::abci::Event; -use tendermint::v0_34::abci::{ +use tendermint::v0_37::abci::{ request, response, ConsensusRequest as Request, ConsensusResponse as Response, }; use tokio::sync::mpsc; @@ -81,6 +81,29 @@ impl Consensus { .await .expect("commit must succeed"), ), + // TODO: figure out how to handle these events, otherwise pd panics + Request::PrepareProposal(proposal) => { + tracing::warn!(?proposal, "Encountered PrepareProposal request"); + let mut txs: Vec = Vec::new(); + let num_candidate_txs = proposal.txs.len(); + // Ensure that list of transactions doesn't exceed max tx bytes. + // https://github.com/tendermint/tendermint/blob/v0.37.x/spec/abci/abci%2B%2B_tmint_expected_behavior.md#adapting-existing-applications-that-use-abci + tracing::debug!("Processing PrepareProposal, found {} candidate transactions", proposal.txs.len()); + for tx in proposal.txs { + if (tx.len() + txs.len()) <= proposal.max_tx_bytes.try_into()? { + txs.push(tx); + } else { + break + } + } + tracing::debug!("Finished processing PrepareProposal, including {}/{} candidate transactions", + txs.len(), num_candidate_txs); + Response::PrepareProposal(tendermint::abci::response::PrepareProposal { txs: txs }) + }, + Request::ProcessProposal(proposal) => { + tracing::warn!(?proposal, "Encountered ProcessProposal request"); + Response::ProcessProposal(tendermint::abci::response::ProcessProposal::Accept) + } })); } Ok(()) diff --git a/crates/bin/pd/src/events.rs b/crates/bin/pd/src/events.rs index ee3e9f131c..2ceded6c7b 100644 --- a/crates/bin/pd/src/events.rs +++ b/crates/bin/pd/src/events.rs @@ -4,7 +4,7 @@ use anyhow::Result; use futures::FutureExt; use regex::RegexSet; use tendermint::abci::Event; -use tendermint::v0_34::abci::{ConsensusRequest as Request, ConsensusResponse as Response}; +use tendermint::v0_37::abci::{ConsensusRequest as Request, ConsensusResponse as Response}; use tower::{Layer, Service}; #[derive(Debug, Clone)] @@ -102,6 +102,8 @@ where // No events. Response::InitChain(_) => {} Response::Commit(_) => {} + Response::PrepareProposal(_) => {}, + Response::ProcessProposal(_) => {}, // These responses have events. Response::BeginBlock(ref mut msg) => config.adjust_events(&mut msg.events), Response::DeliverTx(ref mut msg) => config.adjust_events(&mut msg.events), diff --git a/crates/bin/pd/src/info.rs b/crates/bin/pd/src/info.rs index 494288cde8..5e4efd2bf3 100644 --- a/crates/bin/pd/src/info.rs +++ b/crates/bin/pd/src/info.rs @@ -33,7 +33,7 @@ use penumbra_ibc::component::ConnectionStateReadExt as _; use penumbra_storage::Storage; use prost::Message; use std::str::FromStr; -use tendermint::v0_34::abci::{ +use tendermint::v0_37::abci::{ request, response::{self, Echo}, InfoRequest, InfoResponse, @@ -41,7 +41,7 @@ use tendermint::v0_34::abci::{ use tower_abci::BoxError; use tracing::Instrument; -use penumbra_tower_trace::v034::RequestExt; +use penumbra_tower_trace::v037::RequestExt; const ABCI_INFO_VERSION: &str = env!("VERGEN_GIT_SEMVER"); @@ -609,7 +609,6 @@ impl tower_service::Service for Info { InfoRequest::Echo(echo) => Ok(InfoResponse::Echo(Echo { message: echo.message, })), - InfoRequest::SetOption(_) => todo!(), } } .instrument(span) diff --git a/crates/bin/pd/src/main.rs b/crates/bin/pd/src/main.rs index 4fea7ac388..5d6c247578 100644 --- a/crates/bin/pd/src/main.rs +++ b/crates/bin/pd/src/main.rs @@ -33,8 +33,8 @@ use tonic::transport::Server; use tracing_subscriber::{prelude::*, EnvFilter}; use url::Url; -use penumbra_tower_trace::v034::RequestExt; -use tendermint::v0_34::abci::{ConsensusRequest, MempoolRequest}; +use penumbra_tower_trace::v037::RequestExt; +use tendermint::v0_37::abci::{ConsensusRequest, MempoolRequest}; #[derive(Debug, Parser)] #[clap( @@ -318,7 +318,7 @@ async fn main() -> anyhow::Result<()> { let abci_server = tokio::task::Builder::new() .name("abci_server") .spawn( - tower_abci::v034::Server::builder() + tower_abci::v037::Server::builder() .consensus(consensus) .snapshot(snapshot) .mempool(mempool) diff --git a/crates/bin/pd/src/mempool.rs b/crates/bin/pd/src/mempool.rs index 3bb37c2e6f..7716c5af90 100644 --- a/crates/bin/pd/src/mempool.rs +++ b/crates/bin/pd/src/mempool.rs @@ -2,7 +2,7 @@ use anyhow::Result; use penumbra_storage::{Snapshot, Storage}; -use tendermint::v0_34::abci::{ +use tendermint::v0_37::abci::{ request::CheckTx as CheckTxReq, request::CheckTxKind, response::CheckTx as CheckTxRsp, MempoolRequest as Request, MempoolResponse as Response, }; diff --git a/crates/bin/pd/src/snapshot.rs b/crates/bin/pd/src/snapshot.rs index 7147c8fe64..bc297b42f0 100644 --- a/crates/bin/pd/src/snapshot.rs +++ b/crates/bin/pd/src/snapshot.rs @@ -5,7 +5,7 @@ use std::{ }; use futures::FutureExt; -use tendermint::v0_34::abci::{SnapshotRequest, SnapshotResponse}; +use tendermint::v0_37::abci::{SnapshotRequest, SnapshotResponse}; use tower_abci::BoxError; #[derive(Clone, Debug)] diff --git a/crates/core/component/dex/src/component/dex.rs b/crates/core/component/dex/src/component/dex.rs index 6d79cf8554..c25dd77919 100644 --- a/crates/core/component/dex/src/component/dex.rs +++ b/crates/core/component/dex/src/component/dex.rs @@ -7,7 +7,7 @@ use penumbra_chain::component::StateReadExt as _; use penumbra_component::Component; use penumbra_proto::{StateReadProto, StateWriteProto}; use penumbra_storage::{StateRead, StateWrite}; -use tendermint::v0_34::abci; +use tendermint::v0_37::abci; use tracing::instrument; use crate::{ diff --git a/crates/core/component/governance/src/component.rs b/crates/core/component/governance/src/component.rs index 8f2b16fed4..12252eaa2e 100644 --- a/crates/core/component/governance/src/component.rs +++ b/crates/core/component/governance/src/component.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use anyhow::{Context, Result}; use async_trait::async_trait; use penumbra_storage::StateWrite; -use tendermint::v0_34::abci; +use tendermint::v0_37::abci; use tracing::instrument; use penumbra_component::Component; diff --git a/crates/core/component/shielded-pool/src/component/shielded_pool.rs b/crates/core/component/shielded-pool/src/component/shielded_pool.rs index 7876e7f30a..93e5540f21 100644 --- a/crates/core/component/shielded-pool/src/component/shielded_pool.rs +++ b/crates/core/component/shielded-pool/src/component/shielded_pool.rs @@ -9,7 +9,7 @@ use penumbra_proto::StateReadProto; use penumbra_sct::Nullifier; use penumbra_storage::StateRead; use penumbra_storage::StateWrite; -use tendermint::v0_34::abci; +use tendermint::v0_37::abci; use tracing::instrument; use crate::state_key; diff --git a/crates/narsil/narsil/src/bin/narsild.rs b/crates/narsil/narsil/src/bin/narsild.rs index 216b889283..89078ff297 100644 --- a/crates/narsil/narsil/src/bin/narsild.rs +++ b/crates/narsil/narsil/src/bin/narsild.rs @@ -7,8 +7,8 @@ use console_subscriber::ConsoleLayer; use metrics_tracing_context::{MetricsLayer, TracingContextLayer}; use metrics_util::layers::Stack; use penumbra_tendermint_proxy::TendermintProxy; -use penumbra_tower_trace::v034::RequestExt; -use tendermint::v0_34::abci::{ConsensusRequest, MempoolRequest}; +use penumbra_tower_trace::v037::RequestExt; +use tendermint::v0_37::abci::{ConsensusRequest, MempoolRequest}; use narsil::{ ledger::{consensus::Consensus, mempool::Mempool, snapshot::Snapshot, Info}, @@ -159,7 +159,7 @@ async fn main() -> anyhow::Result<()> { let abci_server = tokio::task::Builder::new() .name("abci_server") .spawn( - tower_abci::v034::Server::builder() + tower_abci::v037::Server::builder() .consensus(consensus) .snapshot(snapshot) .mempool(mempool) diff --git a/crates/narsil/narsil/src/ledger/consensus.rs b/crates/narsil/narsil/src/ledger/consensus.rs index 3858fd4651..b48ab8faeb 100644 --- a/crates/narsil/narsil/src/ledger/consensus.rs +++ b/crates/narsil/narsil/src/ledger/consensus.rs @@ -3,7 +3,7 @@ use anyhow::Result; use penumbra_chain::genesis; use penumbra_storage::Storage; use tendermint::abci::Event; -use tendermint::v0_34::abci::{ +use tendermint::v0_37::abci::{ request, response, ConsensusRequest as Request, ConsensusResponse as Response, }; use tokio::sync::mpsc; @@ -81,6 +81,10 @@ impl Consensus { .await .expect("commit must succeed"), ), + // The proposal types were added in CometBFT v0.37.x. + // How should they be handled in narsil? + Request::PrepareProposal(_proposal) => todo!(), + Request::ProcessProposal(_proposal) => todo!(), })); } Ok(()) diff --git a/crates/narsil/narsil/src/ledger/info.rs b/crates/narsil/narsil/src/ledger/info.rs index 1f886ee06e..6e1dba0bc9 100644 --- a/crates/narsil/narsil/src/ledger/info.rs +++ b/crates/narsil/narsil/src/ledger/info.rs @@ -7,8 +7,8 @@ use std::{ use futures::FutureExt; use penumbra_chain::component::{AppHashRead, StateReadExt}; use penumbra_storage::Storage; -use penumbra_tower_trace::v034::RequestExt; -use tendermint::v0_34::abci::{self, response::Echo, InfoRequest, InfoResponse}; +use penumbra_tower_trace::v037::RequestExt; +use tendermint::v0_37::abci::{self, response::Echo, InfoRequest, InfoResponse}; use tower_abci::BoxError; use tracing::Instrument; @@ -78,7 +78,6 @@ impl tower_service::Service for Info { InfoRequest::Echo(echo) => Ok(InfoResponse::Echo(Echo { message: echo.message, })), - InfoRequest::SetOption(_) => todo!(), } } .instrument(span) diff --git a/crates/narsil/narsil/src/ledger/mempool.rs b/crates/narsil/narsil/src/ledger/mempool.rs index b77d35cecd..d03fbc6f22 100644 --- a/crates/narsil/narsil/src/ledger/mempool.rs +++ b/crates/narsil/narsil/src/ledger/mempool.rs @@ -2,9 +2,9 @@ use anyhow::Result; use penumbra_storage::{Snapshot, Storage}; -use tendermint::v0_34::abci::request::{CheckTx as CheckTxReq, CheckTxKind}; -use tendermint::v0_34::abci::response::CheckTx as CheckTxRsp; -use tendermint::v0_34::abci::{MempoolRequest as Request, MempoolResponse as Response}; +use tendermint::v0_37::abci::request::{CheckTx as CheckTxReq, CheckTxKind}; +use tendermint::v0_37::abci::response::CheckTx as CheckTxRsp; +use tendermint::v0_37::abci::{MempoolRequest as Request, MempoolResponse as Response}; use tokio::sync::{mpsc, watch}; use tower_actor::Message; diff --git a/crates/narsil/narsil/src/ledger/snapshot.rs b/crates/narsil/narsil/src/ledger/snapshot.rs index 7147c8fe64..bc297b42f0 100644 --- a/crates/narsil/narsil/src/ledger/snapshot.rs +++ b/crates/narsil/narsil/src/ledger/snapshot.rs @@ -5,7 +5,7 @@ use std::{ }; use futures::FutureExt; -use tendermint::v0_34::abci::{SnapshotRequest, SnapshotResponse}; +use tendermint::v0_37::abci::{SnapshotRequest, SnapshotResponse}; use tower_abci::BoxError; #[derive(Clone, Debug)] diff --git a/crates/proto/src/gen/proto_descriptor.bin.no_lfs b/crates/proto/src/gen/proto_descriptor.bin.no_lfs index 7aa438f4b1..fa7db136d4 100644 Binary files a/crates/proto/src/gen/proto_descriptor.bin.no_lfs and b/crates/proto/src/gen/proto_descriptor.bin.no_lfs differ diff --git a/deployments/scripts/smoke-test.sh b/deployments/scripts/smoke-test.sh index 5033791abc..1f605741f8 100755 --- a/deployments/scripts/smoke-test.sh +++ b/deployments/scripts/smoke-test.sh @@ -34,6 +34,9 @@ TESTNET_RUNTIME="${TESTNET_RUNTIME:-120}" # Duration that the network will run before integration tests are run. TESTNET_BOOTTIME="${TESTNET_BOOTTIME:-20}" +echo "Building latest version of pd from source..." +cargo build --quiet --release --bin pd + echo "Generating testnet config..." EPOCH_DURATION="${EPOCH_DURATION:-100}" cargo run --quiet --release --bin pd -- testnet generate --epoch-duration "$EPOCH_DURATION" --timeout-commit 500ms diff --git a/justfile b/justfile new file mode 100644 index 0000000000..878678ec3e --- /dev/null +++ b/justfile @@ -0,0 +1,5 @@ +devnet: + # removing previous state for penumbra networks + rm -rf ~/.penumbra/testnet_data + # generate local devnet config + cargo run --release --bin pd -- testnet generate