From 5596b5e99b7ed7a4aa59d32658d688664419a378 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 12:48:33 +0100 Subject: [PATCH 01/26] WIP: Shimming main --- Makefile | 24 ++++ apps/Cargo.toml | 37 ++++-- apps/src/lib/node/ledger/shims/abcipp_shim.rs | 118 ++++++++++++------ .../node/ledger/shims/abcipp_shim_types.rs | 118 +++++++++++++++++- shared/Cargo.toml | 31 ++++- 5 files changed, 271 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index 3474f6c8e6..48265102ae 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,30 @@ clippy: make -C $(wasms_for_tests) clippy && \ $(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true +clippy-abcipp: + ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./apps/Cargo.toml \ + --no-default-features \ + --features "std testing abcipp eth-fullnode" && \ + $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./proof_of_stake/Cargo.toml \ + --features "testing" && \ + $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./shared/Cargo.toml \ + --no-default-features \ + --features "testing wasm-runtime abcipp ibc-mocks-abcipp" && \ + $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./tests/Cargo.toml \ + --no-default-features \ + --features "wasm-runtime abcipp namada_apps/abcipp namada_apps/eth-fullnode" && \ + $(cargo) +$(nightly) clippy \ + --all-targets \ + --manifest-path ./vm_env/Cargo.toml \ + --no-default-features \ + --features "abcipp" && \ + make -C $(wasms) clippy && \ + $(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true + clippy-fix: $(cargo) +$(nightly) clippy --fix -Z unstable-options --all-targets --allow-dirty --allow-staged diff --git a/apps/Cargo.toml b/apps/Cargo.toml index 65d7d84eed..0d7f52da18 100644 --- a/apps/Cargo.toml +++ b/apps/Cargo.toml @@ -39,17 +39,35 @@ name = "namadaw" path = "src/bin/anoma-wallet/main.rs" [features] -default = ["std"] +default = ["std", "abciplus"] dev = ["namada/dev"] std = ["ed25519-consensus/std", "rand/std", "rand_core/std"] # for integration tests and test utilies testing = ["dev"] +abcipp = [ + "tendermint-abcipp", + "tendermint-config-abcipp", + "tendermint-proto-abcipp", + "tendermint-rpc-abcipp", + "tower-abci-abcipp", + "namada/abcipp" +] + +abciplus = [ + "tendermint", + "tendermint-config", + "tendermint-rpc", + "tendermint-proto", + "tower-abci", + "namada/abciplus" +] + [dependencies] namada = {path = "../shared", features = ["wasm-runtime", "ferveo-tpke", "rand", "secp256k1-sign-verify"]} ark-serialize = "0.3.0" ark-std = "0.3.0" -async-std = {version = "1.9.0", features = ["unstable"]} +async-std = {version = "=1.11.0", features = ["unstable"]} async-trait = "0.1.51" base64 = "0.13.0" bech32 = "0.8.0" @@ -105,10 +123,14 @@ sparse-merkle-tree = {git = "https://github.com/heliaxdev/sparse-merkle-tree", b sysinfo = {version = "=0.21.1", default-features = false} tar = "0.4.37" # temporarily using fork work-around -tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["secp256k1"]} -tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"} -tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"} -tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["http-client", "websocket-client"]} +tendermint-abcipp = {package = "tendermint", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-config-abcipp = {package = "tendermint-config", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-proto-abcipp = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-rpc-abcipp = {package = "tendermint-rpc", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["http-client", "websocket-client"], optional = true} +tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} +tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} +tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} +tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", features = ["http-client", "websocket-client"], optional = true} thiserror = "1.0.30" tokio = {version = "1.8.2", features = ["full"]} toml = "0.5.8" @@ -116,7 +138,8 @@ tonic = "0.6.1" tower = "0.4" # Also, using the same version of tendermint-rs as we do here. # with a patch for https://github.com/penumbra-zone/tower-abci/issues/7. -tower-abci = {git = "https://github.com/heliaxdev/tower-abci", rev = "f6463388fc319b6e210503b43b3aecf6faf6b200"} +tower-abci-abcipp = {package = "tower-abci", git = "https://github.com/heliaxdev/tower-abci", rev = "f6463388fc319b6e210503b43b3aecf6faf6b200", optional = true} +tower-abci = {git = "https://github.com/heliaxdev/tower-abci", branch = "bat/abciplus", optional = true} tracing = "0.1.30" tracing-log = "0.1.2" tracing-subscriber = {version = "0.3.7", features = ["env-filter"]} diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim.rs b/apps/src/lib/node/ledger/shims/abcipp_shim.rs index ffe90c1d61..3c32454b3d 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim.rs @@ -8,11 +8,16 @@ use futures::future::FutureExt; use tendermint_proto::abci::ResponseFinalizeBlock; use tokio::sync::mpsc::UnboundedSender; use tower::Service; +#[cfg(not(feature = "abcipp"))] use tower_abci::{BoxError, Request as Req, Response as Resp}; +#[cfg(feature = "abcipp")] +use tower_abci_abcipp::{BoxError, Request as Req, Response as Resp}; use super::super::Shell; +#[cfg(not(feature = "abcipp"))] +use super::abcipp_shim_types::shim::request::{FinalizeBlock, ProcessedTx}; +#[cfg(feature = "abcipp")] use super::abcipp_shim_types::shim::request::{FinalizeBlock, ProcessedTx}; -use super::abcipp_shim_types::shim::response::TxResult; use super::abcipp_shim_types::shim::{Error, Request, Response}; use crate::config; @@ -22,6 +27,9 @@ use crate::config; #[derive(Debug)] pub struct AbcippShim { service: Shell, + #[cfg(not(feature = "abcipp"))] + begin_block_request: Option, + processed_txs: Vec, shell_recv: std::sync::mpsc::Receiver<( Req, tokio::sync::oneshot::Sender>, @@ -52,65 +60,93 @@ impl AbcippShim { vp_wasm_compilation_cache, tx_wasm_compilation_cache, ), + #[cfg(not(feature = "abcipp"))] + begin_block_request: None, + processed_txs: vec![], shell_recv, }, AbciService { shell_send }, ) } + #[cfg(not(feature = "abcipp"))] + /// Get the hash of the txs in the block + pub fn get_hash(&self) -> Hash { + let bytes: Vec = self + .processed_txs + .iter() + .flat_map(|processed| processed.tx.clone()) + .collect(); + hash_tx(bytes.as_slice()) + } + /// Run the shell's blocking loop that receives messages from the /// [`AbciService`]. pub fn run(mut self) { while let Ok((req, resp_sender)) = self.shell_recv.recv() { let resp = match req { - Req::ProcessProposal(proposal) => self - .service - .call(Request::ProcessProposal(proposal)) - .map_err(Error::from) - .and_then(|res| match res { - Response::ProcessProposal(resp) => { - Ok(Resp::ProcessProposal(resp)) - } - _ => unreachable!(), - }), + Req::ProcessProposal(proposal) => { + let txs = proposal.txs.clone(); + self.service + .call(Request::ProcessProposal(proposal)) + .map_err(Error::from) + .and_then(|res| match res { + Response::ProcessProposal(resp) => { + let response = + Ok(Resp::ProcessProposal((&resp).into())); + for (result, tx) in resp + .tx_results + .into_iter() + .zip(txs.into_iter()) + { + self.processed_txs + .push(ProcessedTx { tx, result }); + } + response + } + _ => unreachable!(), + }) + } + #[cfg(feature = "abcipp")] Req::FinalizeBlock(block) => { - // Process transactions first in the same way as - // `ProcessProposal`. - let unprocessed_txs = block.txs.clone(); - let processing_results = - self.service.process_txs(&block.txs); - let mut txs = Vec::with_capacity(unprocessed_txs.len()); - for (result, tx) in processing_results - .iter() - .map(TxResult::from) - .zip(unprocessed_txs.into_iter()) - { - txs.push(ProcessedTx { tx, result }); - } - + let mut txs = vec![]; + std::mem::swap(&mut txs, &mut self.processed_txs); let mut finalize_req: FinalizeBlock = block.into(); finalize_req.txs = txs; - self.service .call(Request::FinalizeBlock(finalize_req)) .map_err(Error::from) .and_then(|res| match res { Response::FinalizeBlock(resp) => { - let mut resp: ResponseFinalizeBlock = - resp.into(); - - // Add processing results - for (tx_result, processing_result) in resp - .tx_results - .iter_mut() - .zip(processing_results) - { - tx_result - .events - .extend(processing_result.events); - } - - Ok(Resp::FinalizeBlock(resp)) + Ok(Resp::FinalizeBlock(resp.into())) + } + _ => Err(Error::ConvertResp(res)), + }) + } + #[cfg(not(feature = "abcipp"))] + Req::BeginBlock(block) => { + // we save this data to be forwarded to finalize later + self.begin_block_request = Some(block); + Ok(Resp::BeginBlock(Default::default())) + } + #[cfg(not(feature = "abcipp"))] + Req::DeliverTx(_) => Ok(Resp::DeliverTx(Default::default())), + #[cfg(not(feature = "abcipp"))] + Req::EndBlock(_) => { + let mut txs = vec![]; + std::mem::swap(&mut txs, &mut self.processed_txs); + let mut end_block_request: FinalizeBlock = + self.begin_block_request.take().unwrap().into(); + let hash = self.get_hash(); + end_block_request.hash = BlockHash::from(hash.clone()); + end_block_request.header.hash = hash; + end_block_request.txs = txs; + self.service + .call(Request::FinalizeBlock(end_block_request)) + .map_err(Error::from) + .and_then(|res| match res { + Response::FinalizeBlock(resp) => { + Ok(Resp::EndBlock(resp.into())) } _ => Err(Error::ConvertResp(res)), }) diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs index bea7ba56af..b9b265e559 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs @@ -1,9 +1,24 @@ +#[cfg(not(feature = "abcipp"))] use tower_abci::{Request, Response}; +#[cfg(feature = "abcipp")] +use tower_abci_abcipp::{Request, Response}; pub mod shim { use std::convert::TryFrom; + #[cfg(not(feature = "abcipp"))] use tendermint_proto::abci::{ + RequestApplySnapshotChunk, RequestCheckTx, RequestCommit, RequestEcho, + RequestFlush, RequestInfo, RequestInitChain, RequestListSnapshots, + RequestLoadSnapshotChunk, RequestOfferSnapshot, RequestPrepareProposal, + RequestProcessProposal, RequestQuery, ResponseApplySnapshotChunk, + ResponseCheckTx, ResponseCommit, ResponseEcho, ResponseEndBlock, + ResponseFlush, ResponseInfo, ResponseInitChain, ResponseListSnapshots, + ResponseLoadSnapshotChunk, ResponseOfferSnapshot, + ResponsePrepareProposal, ResponseQuery, + }; + #[cfg(feature = "abcipp")] + use tendermint_proto_abcipp::abci::{ RequestApplySnapshotChunk, RequestCheckTx, RequestCommit, RequestEcho, RequestExtendVote, RequestFlush, RequestInfo, RequestInitChain, RequestListSnapshots, RequestLoadSnapshotChunk, RequestOfferSnapshot, @@ -57,7 +72,9 @@ pub mod shim { ProcessProposal(RequestProcessProposal), #[allow(dead_code)] RevertProposal(request::RevertProposal), + #[cfg(feature = "abcipp")] ExtendVote(RequestExtendVote), + #[cfg(feature = "abcipp")] VerifyVoteExtension(RequestVerifyVoteExtension), FinalizeBlock(request::FinalizeBlock), Commit(RequestCommit), @@ -82,7 +99,9 @@ pub mod shim { Req::Commit(inner) => Ok(Request::Commit(inner)), Req::Flush(inner) => Ok(Request::Flush(inner)), Req::Echo(inner) => Ok(Request::Echo(inner)), + #[cfg(feature = "abcipp")] Req::ExtendVote(inner) => Ok(Request::ExtendVote(inner)), + #[cfg(feature = "abcipp")] Req::VerifyVoteExtension(inner) => { Ok(Request::VerifyVoteExtension(inner)) } @@ -113,11 +132,15 @@ pub mod shim { Query(ResponseQuery), PrepareProposal(ResponsePrepareProposal), VerifyHeader(response::VerifyHeader), - ProcessProposal(ResponseProcessProposal), + ProcessProposal(response::ProcessProposal), RevertProposal(response::RevertProposal), + #[cfg(feature = "abcipp")] ExtendVote(ResponseExtendVote), + #[cfg(feature = "abcipp")] VerifyVoteExtension(ResponseVerifyVoteExtension), FinalizeBlock(response::FinalizeBlock), + #[cfg(not(feature = "abcipp"))] + EndBlock(ResponseEndBlock), Commit(ResponseCommit), Flush(ResponseFlush), Echo(ResponseEcho), @@ -156,7 +179,9 @@ pub mod shim { Response::PrepareProposal(inner) => { Ok(Resp::PrepareProposal(inner)) } + #[cfg(feature = "abcipp")] Response::ExtendVote(inner) => Ok(Resp::ExtendVote(inner)), + #[cfg(feature = "abcipp")] Response::VerifyVoteExtension(inner) => { Ok(Resp::VerifyVoteExtension(inner)) } @@ -169,10 +194,15 @@ pub mod shim { pub mod request { use std::convert::TryFrom; + #[cfg(not(feature = "abcipp"))] + use namada::tendermint_proto::abci::RequestBeginBlock; use namada::types::hash::Hash; use namada::types::storage::{BlockHash, Header}; use namada::types::time::DateTimeUtc; - use tendermint_proto::abci::{ + #[cfg(not(feature = "abcipp"))] + use tendermint_proto::abci::Misbehavior as Evidence; + #[cfg(feature = "abcipp")] + use tendermint_proto_abcipp::abci::{ Misbehavior as Evidence, RequestFinalizeBlock, }; @@ -194,6 +224,7 @@ pub mod shim { pub txs: Vec, } + #[cfg(feature = "abcipp")] impl From for FinalizeBlock { fn from(req: RequestFinalizeBlock) -> FinalizeBlock { FinalizeBlock { @@ -211,17 +242,48 @@ pub mod shim { } } } + + #[cfg(not(feature = "abcipp"))] + impl From for FinalizeBlock { + fn from(req: RequestBeginBlock) -> FinalizeBlock { + let header = req.header.unwrap(); + FinalizeBlock { + hash: BlockHash::default(), + header: Header { + hash: Hash::default(), + time: DateTimeUtc::try_from(header.time.unwrap()) + .unwrap(), + next_validators_hash: Hash::try_from( + header.next_validators_hash.as_slice(), + ) + .unwrap(), + }, + byzantine_validators: req.byzantine_validators, + txs: vec![], + } + } + } } /// Custom types for response payloads pub mod response { + #[cfg(not(feature = "abcipp"))] use tendermint_proto::abci::{ + ConsensusParams, Event as TmEvent, ResponseProcessProposal, + ValidatorUpdate, + }; + #[cfg(feature = "abcipp")] + use tendermint_proto_abcipp::abci::{ Event as TmEvent, ExecTxResult, ResponseFinalizeBlock, ValidatorUpdate, }; - use tendermint_proto::types::ConsensusParams; + #[cfg(feature = "abcipp")] + use tendermint_proto_abcipp::types::ConsensusParams; - use crate::node::ledger::events::{Event, EventLevel}; + use super::*; + use crate::node::ledger::events::Event; + #[cfg(feature = "abcipp")] + use crate::node::ledger::events::EventLevel; #[derive(Debug, Default)] pub struct VerifyHeader; @@ -232,6 +294,7 @@ pub mod shim { pub info: String, } + #[cfg(feature = "abcipp")] impl From for ExecTxResult { fn from(TxResult { code, info }: TxResult) -> Self { ExecTxResult { @@ -242,6 +305,7 @@ pub mod shim { } } + #[cfg(feature = "abcipp")] impl From<&ExecTxResult> for TxResult { fn from(ExecTxResult { code, info, .. }: &ExecTxResult) -> Self { TxResult { @@ -251,6 +315,36 @@ pub mod shim { } } + #[derive(Debug, Default)] + pub struct ProcessProposal { + pub status: i32, + pub tx_results: Vec, + } + + #[cfg(feature = "abcipp")] + impl From<&ProcessProposal> for ResponseProcessProposal { + fn from(resp: &ProcessProposal) -> Self { + Self { + status: resp.status, + tx_results: resp + .tx_results + .iter() + .map(|res| ExecTxResult::from(res.clone())) + .collect(), + ..Default::default() + } + } + } + + #[cfg(not(feature = "abcipp"))] + impl From<&ProcessProposal> for ResponseProcessProposal { + fn from(resp: &ProcessProposal) -> Self { + Self { + status: resp.status, + } + } + } + #[derive(Debug, Default)] pub struct RevertProposal; @@ -261,6 +355,7 @@ pub mod shim { pub consensus_param_updates: Option, } + #[cfg(feature = "abcipp")] impl From for ResponseFinalizeBlock { fn from(resp: FinalizeBlock) -> Self { ResponseFinalizeBlock { @@ -299,5 +394,20 @@ pub mod shim { } } } + + #[cfg(not(feature = "abcipp"))] + impl From for tendermint_proto::abci::ResponseEndBlock { + fn from(resp: FinalizeBlock) -> Self { + Self { + events: resp + .events + .into_iter() + .map(TmEvent::from) + .collect(), + validator_updates: resp.validator_updates, + consensus_param_updates: resp.consensus_param_updates, + } + } + } } } diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 53ab95f15c..bbfb51171b 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -9,7 +9,7 @@ version = "0.7.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = [] +default = ["abciplus"] # NOTE "dev" features that shouldn't be used in live networks are enabled by default for now dev = [] ferveo-tpke = [ @@ -22,6 +22,9 @@ ferveo-tpke = [ ibc-mocks = [ "ibc/mocks", ] +ibc-mocks-abcipp = [ + "ibc-abcipp/mocks", +] # for integration tests and test utilies testing = [ "proptest", @@ -47,6 +50,20 @@ secp256k1-sign-verify = [ "libsecp256k1/hmac", ] +abcipp = [ + "ibc-proto-abcipp", + "ibc-abcipp", + "tendermint-abcipp", + "tendermint-proto-abcipp" +] + +abciplus = [ + "ibc", + "ibc-proto", + "tendermint", + "tendermint-proto", +] + [dependencies] namada_proof_of_stake = {path = "../proof_of_stake"} ark-bls12-381 = {version = "0.3"} @@ -64,8 +81,10 @@ ferveo-common = {git = "https://github.com/anoma/ferveo"} hex = "0.4.3" tpke = {package = "group-threshold-cryptography", optional = true, git = "https://github.com/anoma/ferveo"} # TODO using the same version of tendermint-rs as we do here. -ibc = {git = "https://github.com/heliaxdev/ibc-rs", rev = "30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc", default-features = false} -ibc-proto = {git = "https://github.com/heliaxdev/ibc-rs", rev = "30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc", default-features = false} +ibc-abcipp = {package = "ibc", git = "https://github.com/heliaxdev/ibc-rs", rev = "30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc", default-features = false, optional = true} +ibc-proto-abcipp = {package = "ibc-proto", git = "https://github.com/heliaxdev/ibc-rs", rev = "30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc", default-features = false, optional = true} +ibc = {git = "https://github.com/heliaxdev/ibc-rs", branch = "bat/abciplus", default-features = false, optional = true} +ibc-proto = {git = "https://github.com/heliaxdev/ibc-rs", branch = "bat/abciplus", default-features = false, optional = true} ics23 = "0.6.7" itertools = "0.10.0" loupe = {version = "0.1.3", optional = true} @@ -87,8 +106,10 @@ sha2 = "0.9.3" sparse-merkle-tree = {git = "https://github.com/heliaxdev/sparse-merkle-tree", branch = "yuji/prost-0.9", default-features = false, features = ["std", "borsh"]} tempfile = {version = "3.2.0", optional = true} # temporarily using fork work-around for https://github.com/informalsystems/tendermint-rs/issues/971 -tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["secp256k1"]} -tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"} +tendermint-abcipp = {package = "tendermint", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-proto-abcipp = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} +tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} thiserror = "1.0.30" tracing = "0.1.30" wasmer = {version = "=2.2.0", optional = true} From e9cffb7b0020c6c526e23ef5530690945ad66fa7 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Mon, 5 Sep 2022 10:49:51 +0100 Subject: [PATCH 02/26] Add unit test filter to makefile targets --- Makefile | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 48265102ae..f8e7d1a58d 100644 --- a/Makefile +++ b/Makefile @@ -67,10 +67,6 @@ clippy-abcipp: --manifest-path ./shared/Cargo.toml \ --no-default-features \ --features "testing wasm-runtime abcipp ibc-mocks-abcipp" && \ - $(cargo) +$(nightly) clippy --all-targets \ - --manifest-path ./tests/Cargo.toml \ - --no-default-features \ - --features "wasm-runtime abcipp namada_apps/abcipp namada_apps/eth-fullnode" && \ $(cargo) +$(nightly) clippy \ --all-targets \ --manifest-path ./vm_env/Cargo.toml \ @@ -111,9 +107,35 @@ test-e2e: --test-threads=1 \ -Z unstable-options --report-time +test-unit-abcipp: + $(cargo) test \ + --manifest-path ./apps/Cargo.toml \ + --no-default-features \ + --features "testing std abcipp" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time && \ + $(cargo) test \ + --manifest-path \ + ./proof_of_stake/Cargo.toml \ + --features "testing" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time && \ + $(cargo) test \ + --manifest-path ./shared/Cargo.toml \ + --no-default-features \ + --features "testing wasm-runtime abcipp ibc-mocks-abcipp" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time && \ + $(cargo) test \ + --manifest-path ./vm_env/Cargo.toml \ + --no-default-features \ + --features "abcipp" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time + test-unit: $(cargo) test \ - -- \ + $(TEST_FILTER) -- \ --skip e2e \ -Z unstable-options --report-time @@ -195,4 +217,4 @@ test-miri: MIRIFLAGS="-Zmiri-disable-isolation" $(cargo) +$(nightly) miri test -.PHONY : build check build-release clippy install run-ledger run-gossip reset-ledger test test-debug fmt watch clean build-doc doc build-wasm-scripts-docker build-wasm-scripts clean-wasm-scripts dev-deps test-miri +.PHONY : build check build-release clippy install run-ledger run-gossip reset-ledger test test-debug fmt watch clean build-doc doc build-wasm-scripts-docker build-wasm-scripts clean-wasm-scripts dev-deps test-miri test-unit test-unit-abcipp clippy-abcipp From 69d752a1812abbbaa5b5a5fba0cc1562b18c486a Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 14:13:32 +0100 Subject: [PATCH 03/26] WIP: Shimming main --- apps/src/lib/mod.rs | 18 ++++++ .../lib/node/ledger/shell/finalize_block.rs | 5 +- apps/src/lib/node/ledger/shell/init_chain.rs | 6 +- apps/src/lib/node/ledger/shell/mod.rs | 64 +++++++------------ 4 files changed, 46 insertions(+), 47 deletions(-) diff --git a/apps/src/lib/mod.rs b/apps/src/lib/mod.rs index eca89896eb..8ba2e59855 100644 --- a/apps/src/lib/mod.rs +++ b/apps/src/lib/mod.rs @@ -18,3 +18,21 @@ pub mod wasm_loader; // Taken from . #[doc(inline)] pub use std; + +pub mod facade { + //! Facade module to reason about `abcipp` feature flag logic. + + #[cfg(not(feature = "abcipp"))] + pub use { + tendermint, tendermint_config, tendermint_proto, tendermint_rpc, + tower_abci, + }; + #[cfg(feature = "abcipp")] + pub use { + tendermint_abcipp as tendermint, + tendermint_config_abcipp as tendermint_config, + tendermint_proto_abcipp as tendermint_proto, + tendermint_rpc_abcipp as tendermint_rpc, + tower_abci_abcipp as tower_abci, + }; +} diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 1f758a2f2e..d90aa2b9d4 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -10,10 +10,11 @@ use namada::ledger::treasury::ADDRESS as treasury_address; use namada::types::address::{xan as m1t, Address}; use namada::types::governance::TallyResult; use namada::types::storage::{BlockHash, Epoch, Header}; -use tendermint_proto::abci::Misbehavior as Evidence; -use tendermint_proto::crypto::PublicKey as TendermintPublicKey; +use namada::types::transaction::protocol::ProtocolTxType; use super::*; +use crate::facade::tendermint_proto::abci::Misbehavior as Evidence; +use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; use crate::node::ledger::events::EventType; impl Shell diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index a989338751..aeaacaf307 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -5,11 +5,11 @@ use std::hash::Hash; use namada::types::key::*; #[cfg(not(feature = "dev"))] use sha2::{Digest, Sha256}; -use tendermint_proto::abci; -use tendermint_proto::crypto::PublicKey as TendermintPublicKey; -use tendermint_proto::google::protobuf; use super::*; +use crate::facade::tendermint_proto::abci; +use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; +use crate::facade::tendermint_proto::google::protobuf; use crate::wasm_loader; impl Shell diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index eb47160f9c..472d2f950a 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -1,10 +1,9 @@ //! The ledger shell connects the ABCI++ interface with the Anoma ledger app. //! //! Any changes applied before [`Shell::finalize_block`] might have to be -//! reverted, so any changes applied in the methods `Shell::prepare_proposal` -//! (ABCI++), [`Shell::process_and_decode_proposal`] must be also reverted -//! (unless we can simply overwrite them in the next block). -//! More info in . +//! reverted, so any changes applied in the methods [`Shell::prepare_proposal`] +//! must be also reverted (unless we can simply overwrite them in the next +//! block). More info in . mod finalize_block; mod init_chain; mod prepare_proposal; @@ -44,19 +43,21 @@ use namada::vm::wasm::{TxCache, VpCache}; use namada::vm::WasmCacheRwAccess; use num_derive::{FromPrimitive, ToPrimitive}; use num_traits::{FromPrimitive, ToPrimitive}; -use tendermint_proto::abci::response_verify_vote_extension::VerifyStatus; -use tendermint_proto::abci::{ - Misbehavior as Evidence, MisbehaviorType as EvidenceType, - RequestPrepareProposal, ValidatorUpdate, -}; -use tendermint_proto::crypto::public_key; -use tendermint_proto::types::ConsensusParams; use thiserror::Error; -use tokio::sync::mpsc::UnboundedSender; -use tower_abci::{request, response}; +use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; +use super::protocol::ShellParams; use super::rpc; use crate::config::{genesis, TendermintMode}; +#[cfg(not(feature = "abcipp"))] +use crate::facade::tendermint_proto::abci::ConsensusParams; +use crate::facade::tendermint_proto::abci::{ + Misbehavior as Evidence, MisbehaviorType as EvidenceType, ValidatorUpdate, +}; +use crate::facade::tendermint_proto::crypto::public_key; +#[cfg(feature = "abcipp")] +use crate::facade::tendermint_proto::types::ConsensusParams; +use crate::facade::tower_abci::{request, response}; use crate::node::ledger::events::Event; use crate::node::ledger::shims::abcipp_shim_types::shim; use crate::node::ledger::shims::abcipp_shim_types::shim::response::TxResult; @@ -68,15 +69,10 @@ use crate::{config, wallet}; fn key_to_tendermint( pk: &common::PublicKey, ) -> std::result::Result { - println!("\nKEY TO TENDERMINT\n"); match pk { - common::PublicKey::Ed25519(_) => { - println!("\nEd25519\n"); - ed25519::PublicKey::try_from_pk(pk) - .map(|pk| public_key::Sum::Ed25519(pk.try_to_vec().unwrap())) - } + common::PublicKey::Ed25519(_) => ed25519::PublicKey::try_from_pk(pk) + .map(|pk| public_key::Sum::Ed25519(pk.try_to_vec().unwrap())), common::PublicKey::Secp256k1(_) => { - println!("\nSecp256k1\n"); secp256k1::PublicKey::try_from_pk(pk) .map(|pk| public_key::Sum::Secp256k1(pk.try_to_vec().unwrap())) } @@ -502,24 +498,6 @@ where } } - /// INVARIANT: This method must be stateless. - pub fn extend_vote( - &self, - _req: request::ExtendVote, - ) -> response::ExtendVote { - Default::default() - } - - /// INVARIANT: This method must be stateless. - pub fn verify_vote_extension( - &self, - _req: request::VerifyVoteExtension, - ) -> response::VerifyVoteExtension { - response::VerifyVoteExtension { - status: VerifyStatus::Accept as i32, - } - } - /// Commit a block. Persist the application state and return the Merkle root /// hash. pub fn commit(&mut self) -> response::Commit { @@ -654,11 +632,13 @@ mod test_utils { use namada::types::storage::{BlockHash, Epoch, Header}; use namada::types::transaction::Fee; use tempfile::tempdir; - use tendermint_proto::abci::{RequestInitChain, RequestProcessProposal}; - use tendermint_proto::google::protobuf::Timestamp; use tokio::sync::mpsc::UnboundedReceiver; use super::*; + use crate::facade::tendermint_proto::abci::{ + RequestInitChain, RequestProcessProposal, + }; + use crate::facade::tendermint_proto::google::protobuf::Timestamp; use crate::node::ledger::shims::abcipp_shim_types::shim::request::{ FinalizeBlock, ProcessedTx, }; @@ -768,10 +748,10 @@ mod test_utils { }); let results = resp .tx_results - .iter() + .into_iter() .zip(req.txs.into_iter()) .map(|(res, tx_bytes)| ProcessedTx { - result: res.into(), + result: res, tx: tx_bytes, }) .collect(); From 84a647923389f0296cf84f9867da9534b4b5186f Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 14:13:44 +0100 Subject: [PATCH 04/26] Shim PrepareProposal --- .../lib/node/ledger/shell/prepare_proposal.rs | 118 ++++++++++++------ 1 file changed, 81 insertions(+), 37 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index 7c15180d2c..41ccb7fe2c 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -1,8 +1,19 @@ -//! Implementation of the [`PrepareProposal`] ABCI++ method for the Shell +//! Implementation of the `PrepareProposal` ABCI++ method for the Shell -use tendermint_proto::abci::TxRecord; +use namada::ledger::storage::{DBIter, StorageHasher, DB}; +use namada::proto::Tx; +use namada::types::storage::BlockHeight; +use namada::types::transaction::tx_types::TxType; +use namada::types::transaction::wrapper::wrapper_tx::PairingEngine; +use namada::types::transaction::{AffineCurve, DecryptedTx, EllipticCurve}; -use super::*; +use super::super::*; +use crate::facade::tendermint_proto::abci::RequestPrepareProposal; +#[cfg(feature = "abcipp")] +use crate::facade::tendermint_proto::abci::{ + tx_record::TxAction, TxRecord, +}; +use crate::node::ledger::shell::{process_tx, ShellMode}; use crate::node::ledger::shims::abcipp_shim_types::shim::TxBytes; impl Shell @@ -58,8 +69,11 @@ where }) .to_bytes() }) - .map(record::add) .collect(); + #[cfg(feature = "abcipp")] + let decrypted_txs: Vec = + decrypted_txs.into_iter().map(record::add).collect(); + let mut decrypted_txs = decrypted_txs; txs.append(&mut decrypted_txs); txs @@ -67,18 +81,24 @@ where vec![] }; - response::PrepareProposal { - tx_records: txs, - ..Default::default() + #[cfg(feature = "abcipp")] + { + response::PrepareProposal { + tx_records: txs, + ..Default::default() + } + } + #[cfg(not(feature = "abcipp"))] + { + response::PrepareProposal { txs } } } } /// Functions for creating the appropriate TxRecord given the /// numeric code +#[cfg(feature = "abcipp")] pub(super) mod record { - use tendermint_proto::abci::tx_record::TxAction; - use super::*; /// Keep this transaction in the proposal @@ -113,7 +133,6 @@ mod test_prepare_proposal { use namada::types::address::xan; use namada::types::storage::Epoch; use namada::types::transaction::Fee; - use tendermint_proto::abci::tx_record::TxAction; use super::*; use crate::node::ledger::shell::test_utils::{gen_keypair, TestShell}; @@ -133,10 +152,13 @@ mod test_prepare_proposal { max_tx_bytes: 0, ..Default::default() }; + #[cfg(feature = "abcipp")] assert_eq!( shell.prepare_proposal(req).tx_records, vec![record::remove(tx.to_bytes())] ); + #[cfg(not(feature = "abcipp"))] + assert!(shell.prepare_proposal(req).txs.is_empty()); } /// Test that if an error is encountered while @@ -170,15 +192,19 @@ mod test_prepare_proposal { ), ) .to_bytes(); + #[allow(clippy::redundant_clone)] let req = RequestPrepareProposal { txs: vec![wrapper.clone()], max_tx_bytes: 0, ..Default::default() }; + #[cfg(feature = "abcipp")] assert_eq!( shell.prepare_proposal(req).tx_records, vec![record::remove(wrapper)] ); + #[cfg(not(feature = "abcipp"))] + assert!(shell.prepare_proposal(req).txs.is_empty()); } /// Test that the decrypted txs are included @@ -229,32 +255,50 @@ mod test_prepare_proposal { .iter() .map(|tx| tx.data.clone().expect("Test failed")) .collect(); - - let received: Vec> = shell - .prepare_proposal(req) - .tx_records - .iter() - .filter_map( - |TxRecord { - tx: tx_bytes, - action, - }| { - if *action == (TxAction::Unmodified as i32) - || *action == (TxAction::Added as i32) - { - Some( - Tx::try_from(tx_bytes.as_slice()) - .expect("Test failed") - .data - .expect("Test failed"), - ) - } else { - None - } - }, - ) - .collect(); - // check that the order of the txs is correct - assert_eq!(received, expected_txs); + #[cfg(feature = "abcipp")] + { + let received: Vec> = shell + .prepare_proposal(req) + .tx_records + .iter() + .filter_map( + |TxRecord { + tx: tx_bytes, + action, + }| { + if *action == (TxAction::Unmodified as i32) + || *action == (TxAction::Added as i32) + { + Some( + Tx::try_from(tx_bytes.as_slice()) + .expect("Test failed") + .data + .expect("Test failed"), + ) + } else { + None + } + }, + ) + .collect(); + // check that the order of the txs is correct + assert_eq!(received, expected_txs); + } + #[cfg(not(feature = "abcipp"))] + { + let received: Vec> = shell + .prepare_proposal(req) + .txs + .into_iter() + .map(|tx_bytes| { + Tx::try_from(tx_bytes.as_slice()) + .expect("Test failed") + .data + .expect("Test failed") + }) + .collect(); + // check that the order of the txs is correct + assert_eq!(received, expected_txs); + } } } From 6d622898d6cb5efdb7862808bd6d79b923d3226d Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 15:13:57 +0100 Subject: [PATCH 05/26] Shim ProcessProposal --- apps/src/lib/node/ledger/shell/process_proposal.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 25375244ba..22bd100342 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -1,11 +1,10 @@ //! Implementation of the ['VerifyHeader`], [`ProcessProposal`], //! and [`RevertProposal`] ABCI++ methods for the Shell -use tendermint_proto::abci::response_process_proposal::ProposalStatus; -use tendermint_proto::abci::{ - ExecTxResult, RequestProcessProposal, ResponseProcessProposal, -}; use super::*; +use crate::facade::tendermint_proto::abci::response_process_proposal::ProposalStatus; +use crate::facade::tendermint_proto::abci::{ExecTxResult, RequestProcessProposal}; +use crate::node::ledger::shims::abcipp_shim_types::shim::response::ProcessProposal; impl Shell where @@ -30,14 +29,13 @@ where ) -> ResponseProcessProposal { let tx_results = self.process_txs(&req.txs); - ResponseProcessProposal { + ProcessProposal { status: if tx_results.iter().any(|res| res.code > 3) { ProposalStatus::Reject as i32 } else { ProposalStatus::Accept as i32 }, tx_results, - ..Default::default() } } @@ -200,8 +198,6 @@ mod test_process_proposal { use namada::types::token::Amount; use namada::types::transaction::encrypted::EncryptedTx; use namada::types::transaction::{EncryptionKey, Fee}; - use tendermint_proto::abci::RequestInitChain; - use tendermint_proto::google::protobuf::Timestamp; use super::*; use crate::node::ledger::shell::test_utils::{ From c05d3202e601a8040297300f5abf1463594f1e3f Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 15:18:38 +0100 Subject: [PATCH 06/26] Shim queries --- apps/src/lib/node/ledger/shell/queries.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/queries.rs b/apps/src/lib/node/ledger/shell/queries.rs index a643501d9e..8d779acff4 100644 --- a/apps/src/lib/node/ledger/shell/queries.rs +++ b/apps/src/lib/node/ledger/shell/queries.rs @@ -10,11 +10,11 @@ use namada::types::key; use namada::types::key::dkg_session_keys::DkgPublicKey; use namada::types::storage::{Key, PrefixValue}; use namada::types::token::{self, Amount}; -use tendermint_proto::crypto::{ProofOp, ProofOps}; -use tendermint_proto::google::protobuf; -use tendermint_proto::types::EvidenceParams; use super::*; +use crate::facade::tendermint_proto::crypto::{ProofOp, ProofOps}; +use crate::facade::tendermint_proto::google::protobuf; +use crate::facade::tendermint_proto::types::EvidenceParams; use crate::node::ledger::response; impl Shell @@ -211,7 +211,20 @@ where let mut cur_ops: Vec = p .ops .into_iter() - .map(|op| op.into()) + .map(|op| { + #[cfg(feature = "abcipp")] + { + ProofOp { + r#type: op.field_type, + key: op.key, + data: op.data, + } + } + #[cfg(not(feature = "abcipp"))] + { + op.into() + } + }) .collect(); ops.append(&mut cur_ops); } From 1f0a56fdd47695ba348c6e0a9e0e34b84c7581bf Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 15:25:12 +0100 Subject: [PATCH 07/26] WIP: Shimming main --- apps/src/lib/node/ledger/events.rs | 11 ++++++++-- .../lib/node/ledger/shell/prepare_proposal.rs | 4 +--- .../lib/node/ledger/shell/process_proposal.rs | 4 +++- apps/src/lib/node/ledger/tendermint_node.rs | 20 +++++++++++++------ shared/src/lib.rs | 7 +++++++ 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/apps/src/lib/node/ledger/events.rs b/apps/src/lib/node/ledger/events.rs index 493c4855da..486bf485d9 100644 --- a/apps/src/lib/node/ledger/events.rs +++ b/apps/src/lib/node/ledger/events.rs @@ -7,9 +7,10 @@ use borsh::BorshSerialize; use namada::ledger::governance::utils::ProposalEvent; use namada::types::ibc::IbcEvent; use namada::types::transaction::{hash_tx, TxType}; -use tendermint_proto::abci::EventAttribute; use thiserror::Error; +use crate::facade::tendermint_proto::abci::EventAttribute; + /// Indicates if an event is emitted do to /// an individual Tx or the nature of a finalized block #[derive(Clone, Debug)] @@ -150,7 +151,7 @@ impl From for Event { } /// Convert our custom event into the necessary tendermint proto type -impl From for tendermint_proto::abci::Event { +impl From for crate::facade::tendermint_proto::abci::Event { fn from(event: Event) -> Self { Self { r#type: event.event_type.to_string(), @@ -158,8 +159,14 @@ impl From for tendermint_proto::abci::Event { .attributes .into_iter() .map(|(key, value)| EventAttribute { + #[cfg(feature = "abcipp")] key, + #[cfg(not(feature = "abcipp"))] + key: key.into_bytes(), + #[cfg(feature = "abcipp")] value, + #[cfg(not(feature = "abcipp"))] + value: value.into_bytes(), index: true, }) .collect(), diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index 41ccb7fe2c..a35e8d6122 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -10,9 +10,7 @@ use namada::types::transaction::{AffineCurve, DecryptedTx, EllipticCurve}; use super::super::*; use crate::facade::tendermint_proto::abci::RequestPrepareProposal; #[cfg(feature = "abcipp")] -use crate::facade::tendermint_proto::abci::{ - tx_record::TxAction, TxRecord, -}; +use crate::facade::tendermint_proto::abci::{tx_record::TxAction, TxRecord}; use crate::node::ledger::shell::{process_tx, ShellMode}; use crate::node::ledger::shims::abcipp_shim_types::shim::TxBytes; diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 22bd100342..af8f2a37b1 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -3,7 +3,9 @@ use super::*; use crate::facade::tendermint_proto::abci::response_process_proposal::ProposalStatus; -use crate::facade::tendermint_proto::abci::{ExecTxResult, RequestProcessProposal}; +use crate::facade::tendermint_proto::abci::{ + ExecTxResult, RequestProcessProposal, +}; use crate::node::ledger::shims::abcipp_shim_types::shim::response::ProcessProposal; impl Shell diff --git a/apps/src/lib/node/ledger/tendermint_node.rs b/apps/src/lib/node/ledger/tendermint_node.rs index 25dd49ba63..5918ab814f 100644 --- a/apps/src/lib/node/ledger/tendermint_node.rs +++ b/apps/src/lib/node/ledger/tendermint_node.rs @@ -9,15 +9,17 @@ use namada::types::chain::ChainId; use namada::types::key::*; use namada::types::time::DateTimeUtc; use serde_json::json; -use tendermint::Genesis; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_config::{Error as TendermintError, TendermintConfig}; use thiserror::Error; use tokio::fs::{self, File, OpenOptions}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::process::Command; use crate::config; +use crate::facade::tendermint::Genesis; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_config::{ + Error as TendermintError, TendermintConfig, +}; /// Env. var to output Tendermint log to stdout pub const ENV_VAR_TM_STDOUT: &str = "ANOMA_TM_STDOUT"; @@ -114,7 +116,10 @@ pub async fn run( .await; } } + #[cfg(feature = "abcipp")] write_tm_genesis(&home_dir, chain_id, genesis_time, &config).await; + #[cfg(not(feature = "abcipp"))] + write_tm_genesis(&home_dir, chain_id, genesis_time).await; update_tendermint_config(&home_dir, config).await?; @@ -377,7 +382,7 @@ async fn write_tm_genesis( home_dir: impl AsRef, chain_id: ChainId, genesis_time: DateTimeUtc, - config: &config::Tendermint, + #[cfg(feature = "abcipp")] config: &config::Tendermint, ) { let home_dir = home_dir.as_ref(); let path = home_dir.join("config").join("genesis.json"); @@ -398,8 +403,11 @@ async fn write_tm_genesis( genesis.genesis_time = genesis_time .try_into() .expect("Couldn't convert DateTimeUtc to Tendermint Time"); - genesis.consensus_params.timeout.commit = - config.consensus_timeout_commit.into(); + #[cfg(feature = "abcipp")] + { + genesis.consensus_params.timeout.commit = + config.consensus_timeout_commit.into(); + } let mut file = OpenOptions::new() .write(true) diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 5c2d2fe4d7..6faaf2ff36 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -6,7 +6,14 @@ #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] +#[cfg(not(feature = "abcipp"))] pub use {ibc, ibc_proto, tendermint, tendermint_proto}; +#[cfg(feature = "abcipp")] +pub use { + ibc_abcipp as ibc, ibc_proto_abcipp as ibc_proto, + tendermint_abcipp as tendermint, + tendermint_proto_abcipp as tendermint_proto, +}; pub mod bytes; pub mod ledger; From 7b8260be43c20ef088845ec3085df0a347348f1a Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 15:34:22 +0100 Subject: [PATCH 08/26] Remove unused feature flag from Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f8e7d1a58d..d4b1afc951 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ clippy-abcipp: ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets \ --manifest-path ./apps/Cargo.toml \ --no-default-features \ - --features "std testing abcipp eth-fullnode" && \ + --features "std testing abcipp" && \ $(cargo) +$(nightly) clippy --all-targets \ --manifest-path ./proof_of_stake/Cargo.toml \ --features "testing" && \ From 586f3e940175b838cdaa83f3396d7da64640ab03 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 15:34:30 +0100 Subject: [PATCH 09/26] Cargo lock nonsense --- Cargo.lock | 380 +++++++++++++++++++++++++++++------------------------ 1 file changed, 210 insertions(+), 170 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eafd05b2ff..adc7cad4f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -519,12 +519,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.9.3" @@ -1107,12 +1101,6 @@ dependencies = [ "windows", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -1284,18 +1272,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array 0.14.5", - "rand_core 0.6.3", - "subtle 2.4.1", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.3" @@ -1326,16 +1302,6 @@ dependencies = [ "subtle 2.4.1", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.5", - "subtle 2.4.1", -] - [[package]] name = "ct-codecs" version = "1.1.1" @@ -1518,15 +1484,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1689,18 +1646,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.5.2" @@ -1748,24 +1693,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array 0.14.5", - "group", - "rand_core 0.6.3", - "sec1", - "subtle 2.4.1", - "zeroize", -] - [[package]] name = "embed-resource" version = "1.7.2" @@ -1961,16 +1888,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.3", - "subtle 2.4.1", -] - [[package]] name = "file-lock" version = "2.1.4" @@ -2359,17 +2276,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.3", - "subtle 2.4.1", -] - [[package]] name = "group-threshold-cryptography" version = "0.1.0" @@ -2546,16 +2452,6 @@ dependencies = [ "digest 0.9.0", ] -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - [[package]] name = "hmac-drbg" version = "0.2.0" @@ -2728,6 +2624,33 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "ibc" +version = "0.12.0" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" +dependencies = [ + "bytes 1.1.0", + "derive_more", + "flex-error", + "ibc-proto 0.16.0 (git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus)", + "ics23", + "num-traits 0.2.15", + "prost 0.9.0", + "prost-types 0.9.0", + "safe-regex", + "serde 1.0.137", + "serde_derive", + "serde_json", + "sha2 0.10.2", + "subtle-encoding", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-light-client-verifier 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-testgen 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.9", + "tracing 0.1.35", +] + [[package]] name = "ibc" version = "0.12.0" @@ -2736,7 +2659,7 @@ dependencies = [ "bytes 1.1.0", "derive_more", "flex-error", - "ibc-proto", + "ibc-proto 0.16.0 (git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc)", "ics23", "num-traits 0.2.15", "prost 0.9.0", @@ -2747,14 +2670,27 @@ dependencies = [ "serde_json", "sha2 0.10.2", "subtle-encoding", - "tendermint", - "tendermint-light-client-verifier", - "tendermint-proto", - "tendermint-testgen", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-light-client-verifier 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-testgen 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "time 0.3.9", "tracing 0.1.35", ] +[[package]] +name = "ibc-proto" +version = "0.16.0" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" +dependencies = [ + "bytes 1.1.0", + "prost 0.9.0", + "prost-types 0.9.0", + "serde 1.0.137", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tonic", +] + [[package]] name = "ibc-proto" version = "0.16.0" @@ -2764,7 +2700,7 @@ dependencies = [ "prost 0.9.0", "prost-types 0.9.0", "serde 1.0.137", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "tonic", ] @@ -2993,19 +2929,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.2" @@ -4040,8 +3963,10 @@ dependencies = [ "ferveo-common", "group-threshold-cryptography", "hex", - "ibc", - "ibc-proto", + "ibc 0.12.0 (git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus)", + "ibc 0.12.0 (git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc)", + "ibc-proto 0.16.0 (git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus)", + "ibc-proto 0.16.0 (git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc)", "ics23", "itertools 0.10.3", "libsecp256k1 0.7.0", @@ -4061,8 +3986,10 @@ dependencies = [ "sha2 0.9.9", "sparse-merkle-tree", "tempfile", - "tendermint", - "tendermint-proto", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "test-log", "thiserror", "tonic-build", @@ -4143,10 +4070,14 @@ dependencies = [ "sysinfo", "tar", "tempfile", - "tendermint", - "tendermint-config", - "tendermint-proto", - "tendermint-rpc", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "test-log", "thiserror", "tokio", @@ -4155,7 +4086,8 @@ dependencies = [ "tonic", "tonic-build", "tower", - "tower-abci", + "tower-abci 0.1.0 (git+https://github.com/heliaxdev/tower-abci?branch=bat/abciplus)", + "tower-abci 0.1.0 (git+https://github.com/heliaxdev/tower-abci?rev=f6463388fc319b6e210503b43b3aecf6faf6b200)", "tracing 0.1.35", "tracing-log", "tracing-subscriber 0.3.11", @@ -5567,17 +5499,6 @@ dependencies = [ "quick-error 1.2.3", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac 0.11.0", - "zeroize", -] - [[package]] name = "ring" version = "0.16.20" @@ -5877,18 +5798,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array 0.14.5", - "subtle 2.4.1", - "zeroize", -] - [[package]] name = "security-framework" version = "2.3.1" @@ -6193,10 +6102,6 @@ name = "signature" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.3", -] [[package]] name = "simple-error" @@ -6471,6 +6376,34 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "tendermint" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" +dependencies = [ + "async-trait", + "bytes 1.1.0", + "ed25519", + "ed25519-dalek", + "flex-error", + "futures 0.3.21", + "num-traits 0.2.15", + "once_cell", + "prost 0.9.0", + "prost-types 0.9.0", + "serde 1.0.137", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "signature", + "subtle 2.4.1", + "subtle-encoding", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.9", + "zeroize", +] + [[package]] name = "tendermint" version = "0.23.5" @@ -6482,12 +6415,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures 0.3.21", - "k256", "num-traits 0.2.15", "once_cell", "prost 0.9.0", "prost-types 0.9.0", - "ripemd160", "serde 1.0.137", "serde_bytes", "serde_json", @@ -6496,11 +6427,24 @@ dependencies = [ "signature", "subtle 2.4.1", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "time 0.3.9", "zeroize", ] +[[package]] +name = "tendermint-config" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" +dependencies = [ + "flex-error", + "serde 1.0.137", + "serde_json", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "toml", + "url 2.2.2", +] + [[package]] name = "tendermint-config" version = "0.23.5" @@ -6509,11 +6453,24 @@ dependencies = [ "flex-error", "serde 1.0.137", "serde_json", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "toml", "url 2.2.2", ] +[[package]] +name = "tendermint-light-client-verifier" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" +dependencies = [ + "derive_more", + "flex-error", + "serde 1.0.137", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.9", +] + [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" @@ -6522,8 +6479,25 @@ dependencies = [ "derive_more", "flex-error", "serde 1.0.137", - "tendermint", - "tendermint-rpc", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "time 0.3.9", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" +dependencies = [ + "bytes 1.1.0", + "flex-error", + "num-derive", + "num-traits 0.2.15", + "prost 0.9.0", + "prost-types 0.9.0", + "serde 1.0.137", + "serde_bytes", + "subtle-encoding", "time 0.3.9", ] @@ -6544,6 +6518,39 @@ dependencies = [ "time 0.3.9", ] +[[package]] +name = "tendermint-rpc" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" +dependencies = [ + "async-trait", + "async-tungstenite", + "bytes 1.1.0", + "flex-error", + "futures 0.3.21", + "getrandom 0.2.6", + "http", + "hyper 0.14.19", + "hyper-proxy", + "hyper-rustls", + "peg", + "pin-project 1.0.10", + "serde 1.0.137", + "serde_bytes", + "serde_json", + "subtle-encoding", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "thiserror", + "time 0.3.9", + "tokio", + "tracing 0.1.35", + "url 2.2.2", + "uuid", + "walkdir", +] + [[package]] name = "tendermint-rpc" version = "0.23.5" @@ -6565,9 +6572,9 @@ dependencies = [ "serde_bytes", "serde_json", "subtle-encoding", - "tendermint", - "tendermint-config", - "tendermint-proto", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "thiserror", "time 0.3.9", "tokio", @@ -6577,6 +6584,21 @@ dependencies = [ "walkdir", ] +[[package]] +name = "tendermint-testgen" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" +dependencies = [ + "ed25519-dalek", + "gumdrop", + "serde 1.0.137", + "serde_json", + "simple-error", + "tempfile", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.9", +] + [[package]] name = "tendermint-testgen" version = "0.23.5" @@ -6588,7 +6610,7 @@ dependencies = [ "serde_json", "simple-error", "tempfile", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "time 0.3.9", ] @@ -7028,6 +7050,24 @@ dependencies = [ "tracing 0.1.35", ] +[[package]] +name = "tower-abci" +version = "0.1.0" +source = "git+https://github.com/heliaxdev/tower-abci?branch=bat/abciplus#21623a99bdca5b006d53752a1967849bef3b89ea" +dependencies = [ + "bytes 1.1.0", + "futures 0.3.21", + "pin-project 1.0.10", + "prost 0.9.0", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tracing 0.1.30", + "tracing-tower", +] + [[package]] name = "tower-abci" version = "0.1.0" @@ -7037,7 +7077,7 @@ dependencies = [ "futures 0.3.21", "pin-project 1.0.10", "prost 0.9.0", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "tokio", "tokio-stream", "tokio-util 0.6.10", From 6eafbb083297204374dde208d4e3ef3db0560bf7 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 16:20:20 +0100 Subject: [PATCH 10/26] WIP: Shimming main --- apps/src/lib/node/ledger/shell/mod.rs | 5 ----- .../lib/node/ledger/shell/process_proposal.rs | 12 ++++-------- apps/src/lib/node/ledger/shims/abcipp_shim.rs | 1 - .../lib/node/ledger/shims/abcipp_shim_types.rs | 18 +++++++----------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index 472d2f950a..2e5d3d81fd 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -46,17 +46,12 @@ use num_traits::{FromPrimitive, ToPrimitive}; use thiserror::Error; use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; -use super::protocol::ShellParams; use super::rpc; use crate::config::{genesis, TendermintMode}; -#[cfg(not(feature = "abcipp"))] -use crate::facade::tendermint_proto::abci::ConsensusParams; use crate::facade::tendermint_proto::abci::{ Misbehavior as Evidence, MisbehaviorType as EvidenceType, ValidatorUpdate, }; use crate::facade::tendermint_proto::crypto::public_key; -#[cfg(feature = "abcipp")] -use crate::facade::tendermint_proto::types::ConsensusParams; use crate::facade::tower_abci::{request, response}; use crate::node::ledger::events::Event; use crate::node::ledger::shims::abcipp_shim_types::shim; diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index af8f2a37b1..3414e4ce79 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -3,9 +3,7 @@ use super::*; use crate::facade::tendermint_proto::abci::response_process_proposal::ProposalStatus; -use crate::facade::tendermint_proto::abci::{ - ExecTxResult, RequestProcessProposal, -}; +use crate::facade::tendermint_proto::abci::RequestProcessProposal; use crate::node::ledger::shims::abcipp_shim_types::shim::response::ProcessProposal; impl Shell @@ -28,7 +26,7 @@ where pub fn process_proposal( &self, req: RequestProcessProposal, - ) -> ResponseProcessProposal { + ) -> ProcessProposal { let tx_results = self.process_txs(&req.txs); ProcessProposal { @@ -42,13 +40,11 @@ where } /// Check all the given txs. - pub fn process_txs(&self, txs: &[Vec]) -> Vec { + pub fn process_txs(&self, txs: &[Vec]) -> Vec { let mut tx_queue_iter = self.storage.tx_queue.iter(); txs.iter() .map(|tx_bytes| { - ExecTxResult::from( - self.process_single_tx(tx_bytes, &mut tx_queue_iter), - ) + self.process_single_tx(tx_bytes, &mut tx_queue_iter) }) .collect() } diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim.rs b/apps/src/lib/node/ledger/shims/abcipp_shim.rs index 3c32454b3d..9b5ade1604 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim.rs @@ -5,7 +5,6 @@ use std::pin::Pin; use std::task::{Context, Poll}; use futures::future::FutureExt; -use tendermint_proto::abci::ResponseFinalizeBlock; use tokio::sync::mpsc::UnboundedSender; use tower::Service; #[cfg(not(feature = "abcipp"))] diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs index b9b265e559..c1370fcf8d 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs @@ -267,20 +267,16 @@ pub mod shim { /// Custom types for response payloads pub mod response { - #[cfg(not(feature = "abcipp"))] - use tendermint_proto::abci::{ - ConsensusParams, Event as TmEvent, ResponseProcessProposal, - ValidatorUpdate, + use crate::facade::tendermint_proto::abci::{ + Event as TmEvent, ResponseProcessProposal, ValidatorUpdate, }; + #[cfg(not(feature = "abcipp"))] + use crate::facade::tendermint_proto::types::ConsensusParams; #[cfg(feature = "abcipp")] - use tendermint_proto_abcipp::abci::{ - Event as TmEvent, ExecTxResult, ResponseFinalizeBlock, - ValidatorUpdate, + use crate::facade::tendermint_proto::{ + abci::{ExecTxResult, ResponseFinalizeBlock}, + types::ConsensusParams, }; - #[cfg(feature = "abcipp")] - use tendermint_proto_abcipp::types::ConsensusParams; - - use super::*; use crate::node::ledger::events::Event; #[cfg(feature = "abcipp")] use crate::node::ledger::events::EventLevel; From a0e4df89f69a21abba9e6a0a68d0b16e074b7133 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Tue, 6 Sep 2022 16:33:44 +0100 Subject: [PATCH 11/26] More fixes --- .../lib/node/ledger/shell/prepare_proposal.rs | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index a35e8d6122..157aee3c45 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -40,6 +40,7 @@ where // filter in half of the new txs from Tendermint, only keeping // wrappers let number_of_new_txs = 1 + req.txs.len() / 2; + #[cfg(feature = "abcipp")] let mut txs: Vec = req .txs .into_iter() @@ -54,24 +55,35 @@ where } }) .collect(); + #[cfg(not(feature = "abcipp"))] + let mut txs: Vec = req + .txs + .into_iter() + .take(number_of_new_txs) + .filter_map(|tx_bytes| { + if let Ok(Ok(TxType::Wrapper(_))) = + Tx::try_from(tx_bytes.as_slice()).map(process_tx) + { + Some(tx_bytes) + } else { + None + } + }) + .collect(); // decrypt the wrapper txs included in the previous block - let mut decrypted_txs = self - .storage - .tx_queue - .iter() - .map(|tx| { - Tx::from(match tx.decrypt(privkey) { - Ok(tx) => DecryptedTx::Decrypted(tx), - _ => DecryptedTx::Undecryptable(tx.clone()), - }) - .to_bytes() + let decrypted_txs = self.storage.tx_queue.iter().map(|tx| { + Tx::from(match tx.decrypt(privkey) { + Ok(tx) => DecryptedTx::Decrypted(tx), + _ => DecryptedTx::Undecryptable(tx.clone()), }) - .collect(); + .to_bytes() + }); #[cfg(feature = "abcipp")] - let decrypted_txs: Vec = - decrypted_txs.into_iter().map(record::add).collect(); - let mut decrypted_txs = decrypted_txs; + let mut decrypted_txs: Vec<_> = + decrypted_txs.map(record::add).collect(); + #[cfg(not(feature = "abcipp"))] + let mut decrypted_txs: Vec<_> = decrypted_txs.collect(); txs.append(&mut decrypted_txs); txs From aeeb94e730db194eb325301eb94488a87ddc7734 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 09:35:46 +0100 Subject: [PATCH 12/26] Add ConsensusParams import --- apps/src/lib/node/ledger/shell/finalize_block.rs | 1 + apps/src/lib/node/ledger/shell/init_chain.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index d90aa2b9d4..1938802e66 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -15,6 +15,7 @@ use namada::types::transaction::protocol::ProtocolTxType; use super::*; use crate::facade::tendermint_proto::abci::Misbehavior as Evidence; use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; +use crate::facade::tendermint_proto::types::ConsensusParams; use crate::node::ledger::events::EventType; impl Shell diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index aeaacaf307..cf7236e5e0 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -9,6 +9,7 @@ use sha2::{Digest, Sha256}; use super::*; use crate::facade::tendermint_proto::abci; use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; +use crate::facade::tendermint_proto::types::ConsensusParams; use crate::facade::tendermint_proto::google::protobuf; use crate::wasm_loader; From 9df7ab5583bbc7dc7aa1c69f1a73b5bdf498b03b Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 09:37:39 +0100 Subject: [PATCH 13/26] Find and replace Tendermint imports --- apps/src/lib/client/gossip.rs | 2 +- apps/src/lib/client/rpc.rs | 14 +++++++------- apps/src/lib/client/signing.rs | 2 +- apps/src/lib/client/tendermint_websocket_client.rs | 9 +++++---- apps/src/lib/client/tm_jsonrpc_client.rs | 4 ++-- apps/src/lib/client/tx.rs | 8 ++++---- apps/src/lib/client/utils.rs | 4 ++-- apps/src/lib/config/mod.rs | 4 ++-- apps/src/lib/node/ledger/broadcaster.rs | 3 ++- apps/src/lib/node/ledger/mod.rs | 2 +- apps/src/lib/node/ledger/rpc.rs | 3 ++- apps/src/lib/node/ledger/shell/init_chain.rs | 2 +- apps/src/lib/node/matchmaker.rs | 4 ++-- shared/src/ledger/storage/merkle_tree.rs | 2 +- shared/src/ledger/storage/mod.rs | 2 +- shared/src/types/hash.rs | 5 +++-- shared/src/types/time.rs | 2 +- 17 files changed, 38 insertions(+), 34 deletions(-) diff --git a/apps/src/lib/client/gossip.rs b/apps/src/lib/client/gossip.rs index 2225898ff4..80444d942c 100644 --- a/apps/src/lib/client/gossip.rs +++ b/apps/src/lib/client/gossip.rs @@ -4,10 +4,10 @@ use std::io::Write; use borsh::BorshSerialize; use namada::proto::Signed; use namada::types::intent::{Exchange, FungibleTokenIntent}; -use tendermint_config::net::Address as TendermintAddress; use super::signing; use crate::cli::{self, args, Context}; +use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::proto::services::rpc_service_client::RpcServiceClient; use crate::proto::{services, RpcMessage}; use crate::wallet::Wallet; diff --git a/apps/src/lib/client/rpc.rs b/apps/src/lib/client/rpc.rs index 34652ac825..ea361ed2f1 100644 --- a/apps/src/lib/client/rpc.rs +++ b/apps/src/lib/client/rpc.rs @@ -30,16 +30,16 @@ use namada::types::key::*; use namada::types::storage::{Epoch, PrefixValue}; use namada::types::token::{balance_key, Amount}; use namada::types::{address, storage, token}; -use tendermint::abci::Code; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_rpc::error::Error as TError; -use tendermint_rpc::query::Query; -use tendermint_rpc::{ - Client, HttpClient, Order, SubscriptionClient, WebSocketClient, -}; use crate::cli::{self, args, Context}; use crate::client::tendermint_rpc_types::TxResponse; +use crate::facade::tendermint::abci::Code; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_rpc::error::Error as TError; +use crate::facade::tendermint_rpc::query::Query; +use crate::facade::tendermint_rpc::{ + Client, HttpClient, Order, SubscriptionClient, WebSocketClient, +}; use crate::node::ledger::rpc::Path; /// Query the epoch of the last committed block diff --git a/apps/src/lib/client/signing.rs b/apps/src/lib/client/signing.rs index dd86470403..fb87151c82 100644 --- a/apps/src/lib/client/signing.rs +++ b/apps/src/lib/client/signing.rs @@ -9,12 +9,12 @@ use namada::types::address::{Address, ImplicitAddress}; use namada::types::key::*; use namada::types::storage::Epoch; use namada::types::transaction::{hash_tx, Fee, WrapperTx}; -use tendermint_config::net::Address as TendermintAddress; use super::rpc; use crate::cli::context::WalletAddress; use crate::cli::{self, args, Context}; use crate::client::tendermint_rpc_types::TxBroadcastData; +use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::wallet::Wallet; /// Find the public key for the given address and try to load the keypair diff --git a/apps/src/lib/client/tendermint_websocket_client.rs b/apps/src/lib/client/tendermint_websocket_client.rs index d5af3bcee1..02b357bc01 100644 --- a/apps/src/lib/client/tendermint_websocket_client.rs +++ b/apps/src/lib/client/tendermint_websocket_client.rs @@ -6,15 +6,16 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; use async_trait::async_trait; -use tendermint_config::net::Address; -use tendermint_rpc::{ - Client, Error as RpcError, Request, Response, SimpleRequest, -}; use thiserror::Error; use tokio::time::Instant; use websocket::result::WebSocketError; use websocket::{ClientBuilder, Message, OwnedMessage}; +use crate::facade::tendermint_config::net::Address; +use crate::facade::tendermint_rpc::{ + Client, Error as RpcError, Request, Response, SimpleRequest, +}; + #[derive(Error, Debug)] pub enum Error { #[error("Could not convert into websocket address: {0:?}")] diff --git a/apps/src/lib/client/tm_jsonrpc_client.rs b/apps/src/lib/client/tm_jsonrpc_client.rs index 7372012ff5..88ec006be2 100644 --- a/apps/src/lib/client/tm_jsonrpc_client.rs +++ b/apps/src/lib/client/tm_jsonrpc_client.rs @@ -4,12 +4,12 @@ use std::ops::{Deref, DerefMut}; use curl::easy::{Easy2, Handler, WriteError}; use serde::{Deserialize, Serialize}; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_rpc::query::Query; use crate::client::tendermint_rpc_types::{ parse, Error, EventParams, EventReply, TxResponse, }; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_rpc::query::Query; /// Maximum number of times we try to send a curl request const MAX_SEND_ATTEMPTS: u8 = 10; diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index 1d41ebbc77..b3a6141ee6 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -25,10 +25,6 @@ use namada::types::transaction::nft::{CreateNft, MintNft}; use namada::types::transaction::{pos, InitAccount, InitValidator, UpdateVp}; use namada::types::{address, token}; use namada::{ledger, vm}; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_rpc::endpoint::broadcast::tx_sync::Response; -use tendermint_rpc::query::{EventType, Query}; -use tendermint_rpc::{Client, HttpClient}; use super::rpc; use crate::cli::context::WalletAddress; @@ -39,6 +35,10 @@ use crate::client::tendermint_websocket_client::{ Error as WsError, TendermintWebsocketClient, WebSocketAddress, }; use crate::client::tm_jsonrpc_client::{fetch_event, JsonRpcAddress}; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_rpc::endpoint::broadcast::tx_sync::Response; +use crate::facade::tendermint_rpc::query::{EventType, Query}; +use crate::facade::tendermint_rpc::{Client, HttpClient}; use crate::node::ledger::tendermint_node; const ACCEPTED_QUERY_KEY: &str = "accepted.hash"; diff --git a/apps/src/lib/client/utils.rs b/apps/src/lib/client/utils.rs index 9043a14db7..8f56b1b87c 100644 --- a/apps/src/lib/client/utils.rs +++ b/apps/src/lib/client/utils.rs @@ -18,8 +18,6 @@ use rand::prelude::ThreadRng; use rand::thread_rng; use serde_json::json; use sha2::{Digest, Sha256}; -use tendermint::node::Id as TendermintNodeId; -use tendermint_config::net::Address as TendermintAddress; use crate::cli::context::ENV_VAR_WASM_DIR; use crate::cli::{self, args}; @@ -30,6 +28,8 @@ use crate::config::global::GlobalConfig; use crate::config::{ self, Config, IntentGossiper, PeerAddress, TendermintMode, }; +use crate::facade::tendermint::node::Id as TendermintNodeId; +use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::node::gossip; use crate::node::ledger::tendermint_node; use crate::wallet::{pre_genesis, Wallet}; diff --git a/apps/src/lib/config/mod.rs b/apps/src/lib/config/mod.rs index 987077d5cd..e4788b4ae6 100644 --- a/apps/src/lib/config/mod.rs +++ b/apps/src/lib/config/mod.rs @@ -19,11 +19,11 @@ use namada::types::chain::ChainId; use namada::types::time::Rfc3339String; use regex::Regex; use serde::{de, Deserialize, Serialize}; -use tendermint::Timeout; -use tendermint_config::net::Address as TendermintAddress; use thiserror::Error; use crate::cli; +use crate::facade::tendermint::Timeout; +use crate::facade::tendermint_config::net::Address as TendermintAddress; /// Base directory contains global config and chain directories. pub const DEFAULT_BASE_DIR: &str = ".anoma"; diff --git a/apps/src/lib/node/ledger/broadcaster.rs b/apps/src/lib/node/ledger/broadcaster.rs index 94aec1a00c..199ab953c1 100644 --- a/apps/src/lib/node/ledger/broadcaster.rs +++ b/apps/src/lib/node/ledger/broadcaster.rs @@ -1,6 +1,7 @@ -use tendermint_rpc::{Client, HttpClient}; use tokio::sync::mpsc::UnboundedReceiver; +use crate::facade::tendermint_rpc::{Client, HttpClient}; + /// A service for broadcasting txs via an HTTP client. /// The receiver is for receiving message payloads for other services /// to be broadcast. diff --git a/apps/src/lib/node/ledger/mod.rs b/apps/src/lib/node/ledger/mod.rs index f71e73ea74..ce3b96485a 100644 --- a/apps/src/lib/node/ledger/mod.rs +++ b/apps/src/lib/node/ledger/mod.rs @@ -18,13 +18,13 @@ use namada::ledger::governance::storage as gov_storage; use namada::types::storage::Key; use once_cell::unsync::Lazy; use sysinfo::{RefreshKind, System, SystemExt}; -use tendermint_proto::abci::CheckTxType; use tower::ServiceBuilder; use tower_abci::{response, split, Server}; use self::shims::abcipp_shim::AbciService; use crate::config::utils::num_of_threads; use crate::config::TendermintMode; +use crate::facade::tendermint_proto::abci::CheckTxType; use crate::node::ledger::broadcaster::Broadcaster; use crate::node::ledger::shell::{Error, MempoolTxType, Shell}; use crate::node::ledger::shims::abcipp_shim::AbcippShim; diff --git a/apps/src/lib/node/ledger/rpc.rs b/apps/src/lib/node/ledger/rpc.rs index ce3cbd592d..ad3d2f5fcb 100644 --- a/apps/src/lib/node/ledger/rpc.rs +++ b/apps/src/lib/node/ledger/rpc.rs @@ -5,9 +5,10 @@ use std::str::FromStr; use namada::types::address::Address; use namada::types::storage; -use tendermint::abci::Path as AbciPath; use thiserror::Error; +use crate::facade::tendermint::abci::Path as AbciPath; + /// RPC query path #[derive(Debug, Clone)] pub enum Path { diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index cf7236e5e0..66d47c856b 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -9,8 +9,8 @@ use sha2::{Digest, Sha256}; use super::*; use crate::facade::tendermint_proto::abci; use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; -use crate::facade::tendermint_proto::types::ConsensusParams; use crate::facade::tendermint_proto::google::protobuf; +use crate::facade::tendermint_proto::types::ConsensusParams; use crate::wasm_loader; impl Shell diff --git a/apps/src/lib/node/matchmaker.rs b/apps/src/lib/node/matchmaker.rs index 0a01528b00..edd7a1ac32 100644 --- a/apps/src/lib/node/matchmaker.rs +++ b/apps/src/lib/node/matchmaker.rs @@ -14,8 +14,6 @@ use namada::types::intent::{IntentTransfers, MatchedExchanges}; use namada::types::key::*; use namada::types::matchmaker::AddIntentResult; use namada::types::transaction::{hash_tx, Fee, WrapperTx}; -use tendermint_config::net; -use tendermint_config::net::Address as TendermintAddress; use super::gossip::rpc::matchmakers::{ ClientDialer, ClientListener, MsgFromClient, MsgFromServer, @@ -24,6 +22,8 @@ use crate::cli::args; use crate::client::rpc; use crate::client::tendermint_rpc_types::TxBroadcastData; use crate::client::tx::broadcast_tx; +use crate::facade::tendermint_config::net; +use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::{cli, config, wasm_loader}; /// Run a matchmaker diff --git a/shared/src/ledger/storage/merkle_tree.rs b/shared/src/ledger/storage/merkle_tree.rs index fa0f4a011f..ea0710dd4f 100644 --- a/shared/src/ledger/storage/merkle_tree.rs +++ b/shared/src/ledger/storage/merkle_tree.rs @@ -16,10 +16,10 @@ use sparse_merkle_tree::default_store::DefaultStore; use sparse_merkle_tree::error::Error as SmtError; use sparse_merkle_tree::traits::Hasher; use sparse_merkle_tree::{SparseMerkleTree, H256}; -use tendermint::merkle::proof::{Proof, ProofOp}; use thiserror::Error; use crate::bytes::ByteBuf; +use crate::tendermint::merkle::proof::{Proof, ProofOp}; use crate::types::address::{Address, InternalAddress}; use crate::types::storage::{DbKeySeg, Error as StorageError, Key}; diff --git a/shared/src/ledger/storage/mod.rs b/shared/src/ledger/storage/mod.rs index 0b3d19a742..d60602df9e 100644 --- a/shared/src/ledger/storage/mod.rs +++ b/shared/src/ledger/storage/mod.rs @@ -8,7 +8,6 @@ pub mod write_log; use core::fmt::Debug; -use tendermint::merkle::proof::Proof; use thiserror::Error; use super::parameters; @@ -22,6 +21,7 @@ pub use crate::ledger::storage::merkle_tree::{ MerkleTree, MerkleTreeStoresRead, MerkleTreeStoresWrite, Sha256Hasher, StorageHasher, StoreType, }; +use crate::tendermint::merkle::proof::Proof; use crate::types::address::{Address, EstablishedAddressGen, InternalAddress}; use crate::types::chain::{ChainId, CHAIN_ID_LENGTH}; #[cfg(feature = "ferveo-tpke")] diff --git a/shared/src/types/hash.rs b/shared/src/types/hash.rs index e2fed30379..718cecee83 100644 --- a/shared/src/types/hash.rs +++ b/shared/src/types/hash.rs @@ -6,10 +6,11 @@ use std::ops::Deref; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; -use tendermint::abci::transaction; -use tendermint::Hash as TmHash; use thiserror::Error; +use crate::tendermint::abci::transaction; +use crate::tendermint::Hash as TmHash; + /// The length of the transaction hash string pub const HASH_LENGTH: usize = 32; diff --git a/shared/src/types/time.rs b/shared/src/types/time.rs index ec91ff5b14..dfca614c82 100644 --- a/shared/src/types/time.rs +++ b/shared/src/types/time.rs @@ -6,10 +6,10 @@ use std::ops::{Add, Sub}; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; pub use chrono::{DateTime, Duration, TimeZone, Utc}; -use tendermint_proto::google::protobuf; use crate::tendermint::time::Time; use crate::tendermint::Error as TendermintError; +use crate::tendermint_proto::google::protobuf; /// Check if the given `duration` has passed since the given `start. pub fn duration_passed( From 6724815d62db37cb4945e5a718eeba8590b79829 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 10:17:45 +0100 Subject: [PATCH 14/26] Add Cargo.lock file diffs --- wasm/tx_template/Cargo.lock | 162 ++-------------------- wasm/vp_template/Cargo.lock | 162 ++-------------------- wasm/wasm_source/Cargo.lock | 162 ++-------------------- wasm_for_tests/wasm_source/Cargo.lock | 186 +++----------------------- 4 files changed, 44 insertions(+), 628 deletions(-) diff --git a/wasm/tx_template/Cargo.lock b/wasm/tx_template/Cargo.lock index 4e85d68f2c..b929dda16f 100644 --- a/wasm/tx_template/Cargo.lock +++ b/wasm/tx_template/Cargo.lock @@ -205,12 +205,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.0" @@ -409,12 +403,6 @@ dependencies = [ "syn", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -549,18 +537,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.3" @@ -571,16 +547,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -642,15 +608,6 @@ dependencies = [ "syn", ] -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -719,18 +676,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.4.0" @@ -773,24 +718,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array", - "group", - "rand_core 0.6.3", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -870,16 +797,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "fixedbitset" version = "0.4.1" @@ -1011,17 +928,6 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "gumdrop" version = "0.8.0" @@ -1094,16 +1000,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "http" version = "0.2.6" @@ -1177,7 +1073,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.12.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "derive_more", @@ -1204,7 +1100,7 @@ dependencies = [ [[package]] name = "ibc-proto" version = "0.16.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "prost", @@ -1297,19 +1193,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.0" @@ -2132,17 +2015,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac", - "zeroize", -] - [[package]] name = "ripemd160" version = "0.9.1" @@ -2303,18 +2175,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -2434,10 +2294,6 @@ name = "signature" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.3", -] [[package]] name = "simple-error" @@ -2563,7 +2419,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "async-trait", "bytes", @@ -2571,12 +2427,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures", - "k256", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", "serde", "serde_bytes", "serde_json", @@ -2593,7 +2447,7 @@ dependencies = [ [[package]] name = "tendermint-config" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "flex-error", "serde", @@ -2606,7 +2460,7 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "derive_more", "flex-error", @@ -2619,7 +2473,7 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2636,7 +2490,7 @@ dependencies = [ [[package]] name = "tendermint-rpc" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2660,7 +2514,7 @@ dependencies = [ [[package]] name = "tendermint-testgen" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "ed25519-dalek", "gumdrop", diff --git a/wasm/vp_template/Cargo.lock b/wasm/vp_template/Cargo.lock index 25070a9319..17f07177d3 100644 --- a/wasm/vp_template/Cargo.lock +++ b/wasm/vp_template/Cargo.lock @@ -205,12 +205,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.0" @@ -409,12 +403,6 @@ dependencies = [ "syn", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -549,18 +537,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.3" @@ -571,16 +547,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -642,15 +608,6 @@ dependencies = [ "syn", ] -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -719,18 +676,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.4.0" @@ -773,24 +718,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array", - "group", - "rand_core 0.6.3", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -870,16 +797,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "fixedbitset" version = "0.4.1" @@ -1011,17 +928,6 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "gumdrop" version = "0.8.0" @@ -1094,16 +1000,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "http" version = "0.2.6" @@ -1177,7 +1073,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.12.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "derive_more", @@ -1204,7 +1100,7 @@ dependencies = [ [[package]] name = "ibc-proto" version = "0.16.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "prost", @@ -1297,19 +1193,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.0" @@ -2132,17 +2015,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac", - "zeroize", -] - [[package]] name = "ripemd160" version = "0.9.1" @@ -2303,18 +2175,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -2434,10 +2294,6 @@ name = "signature" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.3", -] [[package]] name = "simple-error" @@ -2563,7 +2419,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "async-trait", "bytes", @@ -2571,12 +2427,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures", - "k256", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", "serde", "serde_bytes", "serde_json", @@ -2593,7 +2447,7 @@ dependencies = [ [[package]] name = "tendermint-config" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "flex-error", "serde", @@ -2606,7 +2460,7 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "derive_more", "flex-error", @@ -2619,7 +2473,7 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2636,7 +2490,7 @@ dependencies = [ [[package]] name = "tendermint-rpc" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2660,7 +2514,7 @@ dependencies = [ [[package]] name = "tendermint-testgen" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "ed25519-dalek", "gumdrop", diff --git a/wasm/wasm_source/Cargo.lock b/wasm/wasm_source/Cargo.lock index 269535735e..654f177a08 100644 --- a/wasm/wasm_source/Cargo.lock +++ b/wasm/wasm_source/Cargo.lock @@ -205,12 +205,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.0" @@ -409,12 +403,6 @@ dependencies = [ "syn", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -549,18 +537,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.3" @@ -571,16 +547,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -642,15 +608,6 @@ dependencies = [ "syn", ] -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -719,18 +676,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.4.0" @@ -773,24 +718,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array", - "group", - "rand_core 0.6.3", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -870,16 +797,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "fixedbitset" version = "0.4.1" @@ -1011,17 +928,6 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "gumdrop" version = "0.8.0" @@ -1094,16 +1000,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "http" version = "0.2.6" @@ -1177,7 +1073,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.12.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "derive_more", @@ -1204,7 +1100,7 @@ dependencies = [ [[package]] name = "ibc-proto" version = "0.16.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "prost", @@ -1297,19 +1193,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.0" @@ -2158,17 +2041,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac", - "zeroize", -] - [[package]] name = "ripemd160" version = "0.9.1" @@ -2329,18 +2201,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -2460,10 +2320,6 @@ name = "signature" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.3", -] [[package]] name = "simple-error" @@ -2589,7 +2445,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "async-trait", "bytes", @@ -2597,12 +2453,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures", - "k256", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", "serde", "serde_bytes", "serde_json", @@ -2619,7 +2473,7 @@ dependencies = [ [[package]] name = "tendermint-config" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "flex-error", "serde", @@ -2632,7 +2486,7 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "derive_more", "flex-error", @@ -2645,7 +2499,7 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2662,7 +2516,7 @@ dependencies = [ [[package]] name = "tendermint-rpc" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2686,7 +2540,7 @@ dependencies = [ [[package]] name = "tendermint-testgen" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "ed25519-dalek", "gumdrop", diff --git a/wasm_for_tests/wasm_source/Cargo.lock b/wasm_for_tests/wasm_source/Cargo.lock index 9df5195b2f..a3a1b85460 100644 --- a/wasm_for_tests/wasm_source/Cargo.lock +++ b/wasm_for_tests/wasm_source/Cargo.lock @@ -205,12 +205,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.0" @@ -409,12 +403,6 @@ dependencies = [ "syn", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -550,18 +538,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.3" @@ -572,16 +548,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -643,15 +609,6 @@ dependencies = [ "syn", ] -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -720,18 +677,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.4.1" @@ -774,24 +719,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array", - "group", - "rand_core 0.6.3", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -871,16 +798,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "fixedbitset" version = "0.4.1" @@ -1012,17 +929,6 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.3", - "subtle", -] - [[package]] name = "gumdrop" version = "0.8.1" @@ -1104,16 +1010,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "http" version = "0.2.6" @@ -1187,7 +1083,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.12.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "derive_more", @@ -1214,7 +1110,7 @@ dependencies = [ [[package]] name = "ibc-proto" version = "0.16.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc#30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc" +source = "git+https://github.com/heliaxdev/ibc-rs?branch=bat/abciplus#99a761657a51f6e5f074f3217426903e53632934" dependencies = [ "bytes", "prost", @@ -1307,19 +1203,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.0" @@ -1357,7 +1240,7 @@ dependencies = [ [[package]] name = "libsecp256k1" version = "0.7.0" -source = "git+https://github.com/brentstone/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" +source = "git+https://github.com/heliaxdev/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" dependencies = [ "arrayref", "base64", @@ -1373,7 +1256,7 @@ dependencies = [ [[package]] name = "libsecp256k1-core" version = "0.3.0" -source = "git+https://github.com/brentstone/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" +source = "git+https://github.com/heliaxdev/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" dependencies = [ "crunchy", "digest 0.9.0", @@ -1383,7 +1266,7 @@ dependencies = [ [[package]] name = "libsecp256k1-gen-ecmult" version = "0.3.0" -source = "git+https://github.com/brentstone/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" +source = "git+https://github.com/heliaxdev/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" dependencies = [ "libsecp256k1-core", ] @@ -1391,7 +1274,7 @@ dependencies = [ [[package]] name = "libsecp256k1-gen-genmult" version = "0.3.0" -source = "git+https://github.com/brentstone/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" +source = "git+https://github.com/heliaxdev/libsecp256k1?rev=bbb3bd44a49db361f21d9db80f9a087c194c0ae9#bbb3bd44a49db361f21d9db80f9a087c194c0ae9" dependencies = [ "libsecp256k1-core", ] @@ -1527,7 +1410,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "namada" -version = "0.7.0" +version = "0.7.1" dependencies = [ "ark-bls12-381", "ark-serialize", @@ -1576,7 +1459,7 @@ dependencies = [ [[package]] name = "namada_macros" -version = "0.7.0" +version = "0.7.1" dependencies = [ "quote", "syn", @@ -1584,7 +1467,7 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" -version = "0.7.0" +version = "0.7.1" dependencies = [ "borsh", "proptest", @@ -1593,7 +1476,7 @@ dependencies = [ [[package]] name = "namada_tests" -version = "0.7.0" +version = "0.7.1" dependencies = [ "chrono", "concat-idents", @@ -1611,7 +1494,7 @@ dependencies = [ [[package]] name = "namada_tx_prelude" -version = "0.7.0" +version = "0.7.1" dependencies = [ "namada_vm_env", "sha2 0.10.2", @@ -1619,7 +1502,7 @@ dependencies = [ [[package]] name = "namada_vm_env" -version = "0.7.0" +version = "0.7.1" dependencies = [ "borsh", "hex", @@ -1629,7 +1512,7 @@ dependencies = [ [[package]] name = "namada_vp_prelude" -version = "0.7.0" +version = "0.7.1" dependencies = [ "namada_vm_env", "sha2 0.10.2", @@ -1637,7 +1520,7 @@ dependencies = [ [[package]] name = "namada_wasm_for_tests" -version = "0.7.0" +version = "0.7.1" dependencies = [ "borsh", "getrandom", @@ -2164,17 +2047,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac", - "zeroize", -] - [[package]] name = "ripemd160" version = "0.9.1" @@ -2335,18 +2207,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -2466,10 +2326,6 @@ name = "signature" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.3", -] [[package]] name = "simple-error" @@ -2595,7 +2451,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "async-trait", "bytes", @@ -2603,12 +2459,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures", - "k256", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", "serde", "serde_bytes", "serde_json", @@ -2625,7 +2479,7 @@ dependencies = [ [[package]] name = "tendermint-config" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "flex-error", "serde", @@ -2638,7 +2492,7 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "derive_more", "flex-error", @@ -2651,7 +2505,7 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2668,7 +2522,7 @@ dependencies = [ [[package]] name = "tendermint-rpc" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "bytes", "flex-error", @@ -2692,7 +2546,7 @@ dependencies = [ [[package]] name = "tendermint-testgen" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#8cca4e1cb2824fedb5dff02e2734bf2e81a02a02" dependencies = [ "ed25519-dalek", "gumdrop", From 44d52dd9efc0b3126eb65227fc015aaa199bdb23 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 10:17:57 +0100 Subject: [PATCH 15/26] Fix abciplus --- apps/src/lib/cli.rs | 4 ++-- apps/src/lib/client/tendermint_rpc_types.rs | 5 ++--- apps/src/lib/client/tendermint_websocket_client.rs | 6 +++--- apps/src/lib/node/ledger/events.rs | 6 ------ apps/src/lib/node/ledger/mod.rs | 4 +++- apps/src/lib/node/ledger/shell/finalize_block.rs | 1 - apps/src/lib/node/ledger/shell/mod.rs | 2 +- apps/src/lib/node/ledger/shell/prepare_proposal.rs | 4 ++-- apps/src/lib/node/ledger/shell/process_proposal.rs | 2 ++ apps/src/lib/node/ledger/shims/abcipp_shim.rs | 14 +++++++------- 10 files changed, 22 insertions(+), 26 deletions(-) diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index f546860cfd..d5626a21d0 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -1372,14 +1372,14 @@ pub mod args { use namada::types::token; use namada::types::transaction::GasLimit; use serde::Deserialize; - use tendermint::Timeout; - use tendermint_config::net::Address as TendermintAddress; use super::context::{WalletAddress, WalletKeypair, WalletPublicKey}; use super::utils::*; use super::ArgMatches; use crate::config; use crate::config::TendermintMode; + use crate::facade::tendermint::Timeout; + use crate::facade::tendermint_config::net::Address as TendermintAddress; const ADDRESS: Arg = arg("address"); const ALIAS_OPT: ArgOpt = ALIAS.opt(); diff --git a/apps/src/lib/client/tendermint_rpc_types.rs b/apps/src/lib/client/tendermint_rpc_types.rs index 6575c74082..0a7406aed0 100644 --- a/apps/src/lib/client/tendermint_rpc_types.rs +++ b/apps/src/lib/client/tendermint_rpc_types.rs @@ -135,9 +135,9 @@ mod params { use serde::ser::SerializeTuple; use serde::{Deserialize, Serializer}; - use tendermint_rpc::query::Query; use super::*; + use crate::facade::tendermint_rpc::query::Query; /// Opaque type for ordering events. Set by Tendermint #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] @@ -310,9 +310,8 @@ mod params { #[cfg(test)] mod test_rpc_types { - use tendermint_rpc::query::EventType; - use super::*; + use crate::facade::tendermint_rpc::query::EventType; /// Test that [`EventParams`] is serialized correctly #[test] diff --git a/apps/src/lib/client/tendermint_websocket_client.rs b/apps/src/lib/client/tendermint_websocket_client.rs index 02b357bc01..6f70464e58 100644 --- a/apps/src/lib/client/tendermint_websocket_client.rs +++ b/apps/src/lib/client/tendermint_websocket_client.rs @@ -50,11 +50,11 @@ mod rpc_types { use std::str::FromStr; use serde::{de, Deserialize, Serialize, Serializer}; - use tendermint_rpc::method::Method; - use tendermint_rpc::query::{EventType, Query}; - use tendermint_rpc::{request, response}; use super::Json; + use crate::facade::tendermint_rpc::method::Method; + use crate::facade::tendermint_rpc::query::{EventType, Query}; + use crate::facade::tendermint_rpc::{request, response}; #[derive(Debug, Deserialize, Serialize)] pub struct RpcRequest { diff --git a/apps/src/lib/node/ledger/events.rs b/apps/src/lib/node/ledger/events.rs index 486bf485d9..3adefc59d7 100644 --- a/apps/src/lib/node/ledger/events.rs +++ b/apps/src/lib/node/ledger/events.rs @@ -159,14 +159,8 @@ impl From for crate::facade::tendermint_proto::abci::Event { .attributes .into_iter() .map(|(key, value)| EventAttribute { - #[cfg(feature = "abcipp")] key, - #[cfg(not(feature = "abcipp"))] - key: key.into_bytes(), - #[cfg(feature = "abcipp")] value, - #[cfg(not(feature = "abcipp"))] - value: value.into_bytes(), index: true, }) .collect(), diff --git a/apps/src/lib/node/ledger/mod.rs b/apps/src/lib/node/ledger/mod.rs index ce3b96485a..58a25202f3 100644 --- a/apps/src/lib/node/ledger/mod.rs +++ b/apps/src/lib/node/ledger/mod.rs @@ -19,12 +19,12 @@ use namada::types::storage::Key; use once_cell::unsync::Lazy; use sysinfo::{RefreshKind, System, SystemExt}; use tower::ServiceBuilder; -use tower_abci::{response, split, Server}; use self::shims::abcipp_shim::AbciService; use crate::config::utils::num_of_threads; use crate::config::TendermintMode; use crate::facade::tendermint_proto::abci::CheckTxType; +use crate::facade::tower_abci::{response, split, Server}; use crate::node::ledger::broadcaster::Broadcaster; use crate::node::ledger::shell::{Error, MempoolTxType, Shell}; use crate::node::ledger::shims::abcipp_shim::AbcippShim; @@ -105,9 +105,11 @@ impl Shell { Request::RevertProposal(_req) => { Ok(Response::RevertProposal(self.revert_proposal(_req))) } + #[cfg(feature = "abcipp")] Request::ExtendVote(_req) => { Ok(Response::ExtendVote(self.extend_vote(_req))) } + #[cfg(feature = "abcipp")] Request::VerifyVoteExtension(_req) => { tracing::debug!("Request VerifyVoteExtension"); Ok(Response::VerifyVoteExtension( diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 1938802e66..2e8f02a76c 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -10,7 +10,6 @@ use namada::ledger::treasury::ADDRESS as treasury_address; use namada::types::address::{xan as m1t, Address}; use namada::types::governance::TallyResult; use namada::types::storage::{BlockHash, Epoch, Header}; -use namada::types::transaction::protocol::ProtocolTxType; use super::*; use crate::facade::tendermint_proto::abci::Misbehavior as Evidence; diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index 2e5d3d81fd..a89d0090ea 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -44,7 +44,7 @@ use namada::vm::WasmCacheRwAccess; use num_derive::{FromPrimitive, ToPrimitive}; use num_traits::{FromPrimitive, ToPrimitive}; use thiserror::Error; -use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; +use tokio::sync::mpsc::UnboundedSender; use super::rpc; use crate::config::{genesis, TendermintMode}; diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index 157aee3c45..c8bf0b654a 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -2,7 +2,6 @@ use namada::ledger::storage::{DBIter, StorageHasher, DB}; use namada::proto::Tx; -use namada::types::storage::BlockHeight; use namada::types::transaction::tx_types::TxType; use namada::types::transaction::wrapper::wrapper_tx::PairingEngine; use namada::types::transaction::{AffineCurve, DecryptedTx, EllipticCurve}; @@ -140,9 +139,10 @@ pub(super) mod record { #[cfg(test)] mod test_prepare_proposal { + use borsh::BorshSerialize; use namada::types::address::xan; use namada::types::storage::Epoch; - use namada::types::transaction::Fee; + use namada::types::transaction::{Fee, WrapperTx}; use super::*; use crate::node::ledger::shell::test_utils::{gen_keypair, TestShell}; diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 3414e4ce79..5572e00495 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -198,6 +198,8 @@ mod test_process_proposal { use namada::types::transaction::{EncryptionKey, Fee}; use super::*; + use crate::facade::tendermint_proto::abci::RequestInitChain; + use crate::facade::tendermint_proto::google::protobuf::Timestamp; use crate::node::ledger::shell::test_utils::{ gen_keypair, ProcessProposal, TestError, TestShell, }; diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim.rs b/apps/src/lib/node/ledger/shims/abcipp_shim.rs index 9b5ade1604..a2492e0f65 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim.rs @@ -5,20 +5,20 @@ use std::pin::Pin; use std::task::{Context, Poll}; use futures::future::FutureExt; +#[cfg(not(feature = "abcipp"))] +use namada::types::hash::Hash; +use namada::types::storage::BlockHash; +use namada::types::transaction::hash_tx; use tokio::sync::mpsc::UnboundedSender; use tower::Service; -#[cfg(not(feature = "abcipp"))] -use tower_abci::{BoxError, Request as Req, Response as Resp}; -#[cfg(feature = "abcipp")] -use tower_abci_abcipp::{BoxError, Request as Req, Response as Resp}; use super::super::Shell; -#[cfg(not(feature = "abcipp"))] -use super::abcipp_shim_types::shim::request::{FinalizeBlock, ProcessedTx}; -#[cfg(feature = "abcipp")] use super::abcipp_shim_types::shim::request::{FinalizeBlock, ProcessedTx}; use super::abcipp_shim_types::shim::{Error, Request, Response}; use crate::config; +#[cfg(not(feature = "abcipp"))] +use crate::facade::tendermint_proto::abci::RequestBeginBlock; +use crate::facade::tower_abci::{BoxError, Request as Req, Response as Resp}; /// The shim wraps the shell, which implements ABCI++. /// The shim makes a crude translation between the ABCI interface currently used From 6b5311342a86a57a13a37edb7218ac949d80bdc3 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 10:23:04 +0100 Subject: [PATCH 16/26] Add missing shell methods --- apps/src/lib/node/ledger/shell/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index a89d0090ea..016b65d3c9 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -493,6 +493,24 @@ where } } + /// INVARIANT: This method must be stateless. + pub fn extend_vote( + &self, + _req: request::ExtendVote, + ) -> response::ExtendVote { + Default::default() + } + + /// INVARIANT: This method must be stateless. + pub fn verify_vote_extension( + &self, + _req: request::VerifyVoteExtension, + ) -> response::VerifyVoteExtension { + response::VerifyVoteExtension { + status: VerifyStatus::Accept as i32, + } + } + /// Commit a block. Persist the application state and return the Merkle root /// hash. pub fn commit(&mut self) -> response::Commit { From 26154f1e35de4fe31833020e2bcbe56b85e15348 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 10:31:37 +0100 Subject: [PATCH 17/26] Fix abcipp --- apps/src/lib/client/tendermint_rpc_types.rs | 2 +- apps/src/lib/client/tm_jsonrpc_client.rs | 2 +- apps/src/lib/node/ledger/shell/mod.rs | 4 ++++ shared/src/ledger/ibc/handler.rs | 6 +++--- vm_env/Cargo.toml | 12 ++++++++++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/src/lib/client/tendermint_rpc_types.rs b/apps/src/lib/client/tendermint_rpc_types.rs index 0a7406aed0..ff185d2718 100644 --- a/apps/src/lib/client/tendermint_rpc_types.rs +++ b/apps/src/lib/client/tendermint_rpc_types.rs @@ -15,7 +15,7 @@ pub enum Error { #[error("Error in sending JSON RPC request to Tendermint")] Send, #[error("Received an error response from Tendermint: {0:?}")] - Rpc(tendermint_rpc::response_error::ResponseError), + Rpc(crate::facade::tendermint_rpc::response_error::ResponseError), #[error("Received malformed JSON response from Tendermint")] MalformedJson, #[error("Received an empty response from Tendermint")] diff --git a/apps/src/lib/client/tm_jsonrpc_client.rs b/apps/src/lib/client/tm_jsonrpc_client.rs index 88ec006be2..ccdf402577 100644 --- a/apps/src/lib/client/tm_jsonrpc_client.rs +++ b/apps/src/lib/client/tm_jsonrpc_client.rs @@ -72,7 +72,7 @@ pub struct Response { /// Results of request (if successful) result: Option, /// Error message if unsuccessful - error: Option, + error: Option, } impl Response { diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index 016b65d3c9..29d6cc7d39 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -48,6 +48,8 @@ use tokio::sync::mpsc::UnboundedSender; use super::rpc; use crate::config::{genesis, TendermintMode}; +#[cfg(feature = "abcipp")] +use crate::facade::tendermint_proto::abci::response_verify_vote_extension::VerifyStatus; use crate::facade::tendermint_proto::abci::{ Misbehavior as Evidence, MisbehaviorType as EvidenceType, ValidatorUpdate, }; @@ -494,6 +496,7 @@ where } /// INVARIANT: This method must be stateless. + #[cfg(feature = "abcipp")] pub fn extend_vote( &self, _req: request::ExtendVote, @@ -502,6 +505,7 @@ where } /// INVARIANT: This method must be stateless. + #[cfg(feature = "abcipp")] pub fn verify_vote_extension( &self, _req: request::VerifyVoteExtension, diff --git a/shared/src/ledger/ibc/handler.rs b/shared/src/ledger/ibc/handler.rs index bf45759535..1d72b99b7b 100644 --- a/shared/src/ledger/ibc/handler.rs +++ b/shared/src/ledger/ibc/handler.rs @@ -66,7 +66,7 @@ use crate::ibc::core::ics24_host::identifier::{ }; use crate::ibc::core::ics26_routing::msgs::Ics26Envelope; use crate::ibc::events::IbcEvent; -#[cfg(any(feature = "ibc-mocks-abci", feature = "ibc-mocks"))] +#[cfg(any(feature = "ibc-mocks-abcipp", feature = "ibc-mocks"))] use crate::ibc::mock::client_state::{MockClientState, MockConsensusState}; use crate::ibc::timestamp::Timestamp; use crate::ledger::ibc::storage; @@ -997,12 +997,12 @@ pub fn update_client( let new_consensus_state = TmConsensusState::from(h).wrap_any(); Ok((new_client_state, new_consensus_state)) } - #[cfg(any(feature = "ibc-mocks-abci", feature = "ibc-mocks"))] + #[cfg(any(feature = "ibc-mocks-abcipp", feature = "ibc-mocks"))] _ => Err(Error::ClientUpdate( "The header type is mismatched".to_owned(), )), }, - #[cfg(any(feature = "ibc-mocks-abci", feature = "ibc-mocks"))] + #[cfg(any(feature = "ibc-mocks-abcipp", feature = "ibc-mocks"))] AnyClientState::Mock(_) => match header { AnyHeader::Mock(h) => Ok(( MockClientState::new(h).wrap_any(), diff --git a/vm_env/Cargo.toml b/vm_env/Cargo.toml index cebcd4c0ca..672f013be6 100644 --- a/vm_env/Cargo.toml +++ b/vm_env/Cargo.toml @@ -7,10 +7,18 @@ resolver = "2" version = "0.7.1" [features] -default = [] +default = ["abciplus"] + +abciplus = [ + "namada/abciplus", +] + +abcipp = [ + "namada/abcipp", +] [dependencies] -namada = {path = "../shared"} +namada = {path = "../shared", default-features = false} namada_macros = {path = "../macros"} borsh = "0.9.0" hex = "0.4.3" From a828214802595a18fed96584ef5897ce48567ba9 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 10:34:06 +0100 Subject: [PATCH 18/26] Remaining fixes --- apps/src/lib/node/ledger/shims/abcipp_shim.rs | 2 ++ apps/src/lib/node/ledger/shims/abcipp_shim_types.rs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim.rs b/apps/src/lib/node/ledger/shims/abcipp_shim.rs index a2492e0f65..a5bd420bec 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim.rs @@ -7,7 +7,9 @@ use std::task::{Context, Poll}; use futures::future::FutureExt; #[cfg(not(feature = "abcipp"))] use namada::types::hash::Hash; +#[cfg(not(feature = "abcipp"))] use namada::types::storage::BlockHash; +#[cfg(not(feature = "abcipp"))] use namada::types::transaction::hash_tx; use tokio::sync::mpsc::UnboundedSender; use tower::Service; diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs index c1370fcf8d..5d9f2c420c 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs @@ -27,8 +27,7 @@ pub mod shim { ResponseCheckTx, ResponseCommit, ResponseEcho, ResponseExtendVote, ResponseFlush, ResponseInfo, ResponseInitChain, ResponseListSnapshots, ResponseLoadSnapshotChunk, ResponseOfferSnapshot, - ResponsePrepareProposal, ResponseProcessProposal, ResponseQuery, - ResponseVerifyVoteExtension, + ResponsePrepareProposal, ResponseQuery, ResponseVerifyVoteExtension, }; use thiserror::Error; From 3e5673ac2cca99ef7e91f90d125fc4db3549e737 Mon Sep 17 00:00:00 2001 From: R2D2 Date: Tue, 6 Sep 2022 14:28:05 +0200 Subject: [PATCH 19/26] Removed tm events log, put websocket back everywhere in client --- apps/Cargo.toml | 1 - apps/src/lib/client/mod.rs | 1 - apps/src/lib/client/tendermint_rpc_types.rs | 278 +++--------- .../lib/client/tendermint_websocket_client.rs | 412 ++++++++++++++++++ apps/src/lib/client/tm_jsonrpc_client.rs | 261 ----------- apps/src/lib/client/tx.rs | 110 +++-- apps/src/lib/node/ledger/tendermint_node.rs | 8 - 7 files changed, 532 insertions(+), 539 deletions(-) delete mode 100644 apps/src/lib/client/tm_jsonrpc_client.rs diff --git a/apps/Cargo.toml b/apps/Cargo.toml index 0d7f52da18..f128d58667 100644 --- a/apps/Cargo.toml +++ b/apps/Cargo.toml @@ -79,7 +79,6 @@ byteorder = "1.4.2" clap = {git = "https://github.com/clap-rs/clap/", tag = "v3.0.0-beta.2", default-features = false, features = ["std", "suggestions", "color", "cargo"]} color-eyre = "0.5.10" config = "0.11.0" -curl = "0.4.43" derivative = "2.2.0" directories = "4.0.1" ed25519-consensus = "1.2.0" diff --git a/apps/src/lib/client/mod.rs b/apps/src/lib/client/mod.rs index a3d2ddece9..3fff8d94ec 100644 --- a/apps/src/lib/client/mod.rs +++ b/apps/src/lib/client/mod.rs @@ -3,6 +3,5 @@ pub mod rpc; pub mod signing; pub mod tendermint_rpc_types; mod tendermint_websocket_client; -mod tm_jsonrpc_client; pub mod tx; pub mod utils; diff --git a/apps/src/lib/client/tendermint_rpc_types.rs b/apps/src/lib/client/tendermint_rpc_types.rs index ff185d2718..c8bca25cb5 100644 --- a/apps/src/lib/client/tendermint_rpc_types.rs +++ b/apps/src/lib/client/tendermint_rpc_types.rs @@ -1,30 +1,14 @@ +use std::convert::TryFrom; + use jsonpath_lib as jsonpath; use namada::proto::Tx; use namada::types::address::Address; use serde::Serialize; -use thiserror::Error; use crate::cli::safe_exit; -use crate::node::ledger::events::Attributes; - -/// Errors from interacting with Tendermint's jsonrpc endpoint -#[derive(Error, Debug)] -pub enum Error { - #[error("Invalid address given to JSON RPC client: {0}")] - Address(String), - #[error("Error in sending JSON RPC request to Tendermint")] - Send, - #[error("Received an error response from Tendermint: {0:?}")] - Rpc(crate::facade::tendermint_rpc::response_error::ResponseError), - #[error("Received malformed JSON response from Tendermint")] - MalformedJson, - #[error("Received an empty response from Tendermint")] - EmptyResponse, - #[error("Could not deserialize JSON response: {0}")] - Deserialize(serde_json::Error), - #[error("Could not find event for the given hash: {0}")] - NotFound(String), -} +use crate::node::ledger::events::{ + Attributes, Error, EventType as NamadaEventType, +}; /// Data needed for broadcasting a tx and /// monitoring its progress on chain @@ -55,6 +39,54 @@ pub struct TxResponse { } impl TxResponse { + /// Parse the JSON payload received from a subscription + /// + /// Searches for custom events emitted from the ledger and converts + /// them back to thin wrapper around a hashmap for further parsing. + pub fn parse( + json: serde_json::Value, + event_type: NamadaEventType, + tx_hash: &str, + ) -> Result, Error> { + let mut selector = jsonpath::selector(&json); + let mut event = { + match selector(&format!("$.events.[?(@.type=='{}')]", event_type)) + .unwrap() + .pop() + { + Some(event) => { + let attrs = Attributes::try_from(event)?; + match attrs.get("hash") { + Some(hash) if hash == tx_hash => attrs, + _ => return Ok(None), + } + } + _ => return Ok(None), + } + }; + let info = event.take("info").unwrap(); + let log = event.take("log").unwrap(); + let height = event.take("height").unwrap(); + let hash = event.take("hash").unwrap(); + let code = event.take("code").unwrap(); + let gas_used = + event.take("gas_used").unwrap_or_else(|| String::from("0")); + let initialized_accounts = event.take("initialized_accounts"); + let initialized_accounts = match initialized_accounts { + Some(values) => serde_json::from_str(&values).unwrap(), + _ => vec![], + }; + Ok(Some(TxResponse { + info, + log, + height, + hash, + code, + gas_used, + initialized_accounts, + })) + } + /// Find a tx with a given hash from the the websocket subscription /// to Tendermint events. pub fn find_tx(json: serde_json::Value, tx_hash: &str) -> Self { @@ -128,207 +160,3 @@ impl TxResponse { } } } - -mod params { - use std::convert::TryFrom; - use std::time::Duration; - - use serde::ser::SerializeTuple; - use serde::{Deserialize, Serializer}; - - use super::*; - use crate::facade::tendermint_rpc::query::Query; - - /// Opaque type for ordering events. Set by Tendermint - #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] - #[serde(transparent)] - pub struct Cursor(String); - - impl From for Cursor { - fn from(cursor: String) -> Self { - Cursor(cursor) - } - } - - /// Struct used for querying Tendermint's event logs - #[derive(Debug)] - pub struct EventParams { - /// The filter an event must satisfy in order to - /// be returned - pub filter: Query, - /// The maximum number of eligible results to return. - /// If zero or negative, the server will report a default number. - pub max_results: u64, - /// Return only items after this cursor. If empty, the limit is just - /// before the the beginning of the event log - pub after: Cursor, - /// Return only items before this cursor. If empty, the limit is just - /// after the head of the event log. - before: Cursor, - /// Wait for up to this long for events to be available. - pub wait_time: Duration, - } - - /// Struct to help serialize [`EventParams`] - #[derive(Serialize)] - struct Filter { - query: String, - } - - impl Serialize for EventParams { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let mut ser = serializer.serialize_tuple(5)?; - ser.serialize_element(&Filter { - query: self.filter.to_string(), - })?; - ser.serialize_element(&self.max_results)?; - ser.serialize_element(self.after.0.as_str())?; - ser.serialize_element(self.before.0.as_str())?; - ser.serialize_element(&self.wait_time.as_nanos())?; - ser.end() - } - } - - impl EventParams { - /// Initialize a new set of [`EventParams`] - pub fn new( - filter: Query, - max_results: u64, - wait_time: Duration, - ) -> Self { - Self { - filter, - max_results, - after: Default::default(), - before: Default::default(), - wait_time, - } - } - } - - /// A reply from Tendermint for events matching the given [`EventParams`] - #[derive(Serialize, Deserialize)] - pub struct EventReply { - /// The items matching the request parameters, from newest - /// to oldest, if any were available within the timeout. - pub items: Vec, - /// This is true if there is at least one older matching item - /// available in the log that was not returned. - #[allow(dead_code)] - more: bool, - /// The cursor of the oldest item in the log at the time of this reply, - /// or "" if the log is empty. - #[allow(dead_code)] - oldest: Cursor, - /// The cursor of the newest item in the log at the time of this reply, - /// or "" if the log is empty. - pub newest: Cursor, - } - - /// An event returned from Tendermint - #[derive(Debug, PartialEq, Serialize, Deserialize)] - pub struct EventItem { - /// this specifies where in the event log this event is - #[allow(dead_code)] - pub cursor: Cursor, - /// The event type - pub event: String, - /// The raw event value - pub data: EventData, - } - - /// Raw data of an event returned from Tendermint - #[derive(Debug, PartialEq, Serialize, Deserialize)] - pub struct EventData { - pub r#type: String, - pub value: serde_json::Value, - } - - /// Parse the JSON payload received from the `events` JSON-RPC - /// endpoint of Tendermint. - /// - /// Searches for custom events emitted from the ledger and converts - /// them back to thin wrapper around a hashmap for further parsing. - /// Returns none if the event is not found. - pub fn parse(reply: EventReply, tx_hash: &str) -> Option { - let mut event = reply - .items - .iter() - .filter_map(|event| { - if event.event == *"NewBlockHeader" { - let events: Option> = - event.data.value.get("result_finalize_block").map( - |res| match res.get("events") { - Some(v) => serde_json::from_value(v.clone()) - .unwrap_or_default(), - None => vec![], - }, - ); - events - } else { - None - } - }) - .flatten() - .find_map(|attr| { - if let Ok(attrs) = Attributes::try_from(&attr) { - match attrs.get("hash") { - Some(hash) if hash == tx_hash => Some(attrs), - _ => None, - } - } else { - None - } - })?; - - let info = event.take("info").unwrap(); - let log = event.take("log").unwrap(); - let height = event.take("height").unwrap(); - let hash = event.take("hash").unwrap(); - let code = event.take("code").unwrap(); - let gas_used = - event.take("gas_used").unwrap_or_else(|| String::from("0")); - let initialized_accounts = event.take("initialized_accounts"); - let initialized_accounts = match initialized_accounts { - Some(values) => serde_json::from_str(&values).unwrap(), - _ => vec![], - }; - - Some(TxResponse { - info, - log, - height, - hash, - code, - gas_used, - initialized_accounts, - }) - } - - #[cfg(test)] - mod test_rpc_types { - use super::*; - use crate::facade::tendermint_rpc::query::EventType; - - /// Test that [`EventParams`] is serialized correctly - #[test] - fn test_serialize_event_params() { - let params = EventParams { - filter: Query::from(EventType::NewBlockHeader), - max_results: 5, - after: Cursor("16CCC798FB5F4670-0123".into()), - before: Default::default(), - wait_time: Duration::from_secs(59), - }; - assert_eq!( - serde_json::to_string(¶ms).expect("Test failed"), - r#"[{"query":"tm.event = 'NewBlockHeader'"},5,"16CCC798FB5F4670-0123","",59000000000]"# - ) - } - } -} - -pub use params::*; diff --git a/apps/src/lib/client/tendermint_websocket_client.rs b/apps/src/lib/client/tendermint_websocket_client.rs index 6f70464e58..61bea1d990 100644 --- a/apps/src/lib/client/tendermint_websocket_client.rs +++ b/apps/src/lib/client/tendermint_websocket_client.rs @@ -12,6 +12,7 @@ use websocket::result::WebSocketError; use websocket::{ClientBuilder, Message, OwnedMessage}; use crate::facade::tendermint_config::net::Address; +use crate::facade::tendermint_rpc::query::Query; use crate::facade::tendermint_rpc::{ Client, Error as RpcError, Request, Response, SimpleRequest, }; @@ -38,6 +39,10 @@ pub enum Error { MissingId, #[error("Connection timed out")] ConnectionTimeout, + #[error("Received malformed JSON from websocket: {0:?}")] + MalformedJson(crate::node::ledger::events::Error), + #[error("Event for transaction {0} was not received")] + MissingEvent(String), } type Json = serde_json::Value; @@ -170,6 +175,8 @@ impl Display for WebSocketAddress { } } +use rpc_types::{RpcResponse, RpcSubscription, SubscribeType}; + /// We need interior mutability since the `perform` method of the `Client` /// trait from `tendermint_rpc` only takes `&self` as an argument /// Furthermore, TendermintWebsocketClient must be `Send` since it will be @@ -177,8 +184,14 @@ impl Display for WebSocketAddress { type Websocket = Arc>>; type ResponseQueue = Arc>>; +struct Subscription { + id: String, + query: Query, +} + pub struct TendermintWebsocketClient { websocket: Websocket, + subscribed: Option, received_responses: ResponseQueue, connection_timeout: Duration, } @@ -196,6 +209,7 @@ impl TendermintWebsocketClient { { Ok(websocket) => Ok(Self { websocket: Arc::new(Mutex::new(websocket)), + subscribed: None, received_responses: Arc::new(Mutex::new(HashMap::new())), connection_timeout: connection_timeout .unwrap_or_else(|| Duration::new(300, 0)), @@ -208,8 +222,142 @@ impl TendermintWebsocketClient { pub fn close(&mut self) { // Even in the case of errors, this will be shutdown let _ = self.websocket.lock().unwrap().shutdown(); + self.subscribed = None; self.received_responses.lock().unwrap().clear(); } + + /// Subscribes to an event specified by the query argument. + pub fn subscribe(&mut self, query: Query) -> Result<(), Error> { + // We do not support more than one subscription currently + // This can be fixed by correlating on ids later + if self.subscribed.is_some() { + return Err(Error::AlreadySubscribed); + } + // send the subscription request + let message = RpcSubscription(SubscribeType::Subscribe, query.clone()) + .into_json(); + let msg_id = get_id(&message).unwrap(); + + self.websocket + .lock() + .unwrap() + .send_message(&Message::text(&message)) + .map_err(Error::Websocket)?; + + // check that the request was received and a success message returned + match self.process_response(|_| Error::Subscribe(message), None) { + Ok(_) => { + self.subscribed = Some(Subscription { id: msg_id, query }); + Ok(()) + } + Err(err) => Err(err), + } + } + + /// Receive a response from the subscribed event or + /// process the response if it has already been received + pub fn receive_response(&self) -> Result { + if let Some(Subscription { id, .. }) = &self.subscribed { + let response = self.process_response( + Error::Response, + self.received_responses.lock().unwrap().remove(id), + )?; + Ok(response) + } else { + Err(Error::NotSubscribed) + } + } + + /// Unsubscribe from the currently subscribed event + /// Note that even if an error is returned, the client + /// will return to an unsubscribed state + pub fn unsubscribe(&mut self) -> Result<(), Error> { + match self.subscribed.take() { + Some(Subscription { query, .. }) => { + // send the subscription request + let message = + RpcSubscription(SubscribeType::Unsubscribe, query) + .into_json(); + + self.websocket + .lock() + .unwrap() + .send_message(&Message::text(&message)) + .map_err(Error::Websocket)?; + // empty out the message queue. Should be empty already + self.received_responses.lock().unwrap().clear(); + // check that the request was received and a success message + // returned + match self + .process_response(|_| Error::Unsubscribe(message), None) + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + _ => Err(Error::NotSubscribed), + } + } + + /// Process the next response received and handle any exceptions that + /// may have occurred. Takes a function to map response to an error + /// as a parameter. + /// + /// Optionally, the response may have been received earlier while + /// handling a different request. In that case, we process it + /// now. + fn process_response( + &self, + f: F, + received: Option, + ) -> Result + where + F: FnOnce(String) -> Error, + { + let resp = match received { + Some(resp) => OwnedMessage::Text(resp), + None => { + let mut websocket = self.websocket.lock().unwrap(); + let start = Instant::now(); + loop { + if Instant::now().duration_since(start) + > self.connection_timeout + { + tracing::error!( + "Websocket connection timed out while waiting for \ + response" + ); + return Err(Error::ConnectionTimeout); + } + match websocket.recv_message().map_err(Error::Websocket)? { + text @ OwnedMessage::Text(_) => break text, + OwnedMessage::Ping(data) => { + tracing::debug!( + "Received websocket Ping, sending Pong" + ); + websocket + .send_message(&OwnedMessage::Pong(data)) + .unwrap(); + continue; + } + OwnedMessage::Pong(_) => { + tracing::debug!( + "Received websocket Pong, ignoring" + ); + continue; + } + other => return Err(Error::UnexpectedResponse(other)), + } + } + } + }; + match resp { + OwnedMessage::Text(raw) => RpcResponse::from_string(raw) + .map(|v| v.0) + .map_err(|e| f(e.to_string())), + other => Err(Error::UnexpectedResponse(other)), + } + } } #[async_trait] @@ -298,3 +446,267 @@ fn get_id(req_json: &str) -> Result { Err(Error::MissingId) } } + +/// The TendermintWebsocketClient has a basic state machine for ensuring +/// at most one subscription at a time. These tests cover that it +/// works as intended. +/// +/// Furthermore, since a client can handle a subscription and a +/// simple request simultaneously, we must test that the correct +/// responses are give for each of the corresponding requests +#[cfg(test)] +mod test_tendermint_websocket_client { + use std::time::Duration; + + use namada::types::transaction::hash_tx as hash_tx_bytes; + use serde::{Deserialize, Serialize}; + use websocket::sync::Server; + use websocket::{Message, OwnedMessage}; + + use crate::client::tendermint_websocket_client::{ + TendermintWebsocketClient, WebSocketAddress, + }; + use crate::facade::tendermint::abci::transaction; + use crate::facade::tendermint_rpc::endpoint::abci_info::AbciInfo; + use crate::facade::tendermint_rpc::query::{EventType, Query}; + use crate::facade::tendermint_rpc::Client; + + #[derive(Debug, Deserialize, Serialize)] + #[serde(rename_all = "snake_case")] + pub enum ReqType { + Subscribe, + Unsubscribe, + AbciInfo, + } + + #[derive(Debug, Deserialize, Serialize)] + pub struct RpcRequest { + pub jsonrpc: String, + pub id: String, + pub method: ReqType, + pub params: Option>, + } + + fn address() -> WebSocketAddress { + WebSocketAddress { + host: "localhost".into(), + port: 26657, + } + } + + #[derive(Default)] + struct Handle { + subscription_id: Option, + } + + impl Handle { + /// Mocks responses to queries. Fairly arbitrary with just enough + /// variety to test the TendermintWebsocketClient state machine and + /// message synchronization + fn handle(&mut self, msg: String) -> Vec { + let id = super::get_id(&msg).unwrap(); + let request: RpcRequest = serde_json::from_str(&msg).unwrap(); + match request.method { + ReqType::Unsubscribe => { + self.subscription_id = None; + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "error": "error"}}"#, + id + )] + } + ReqType::Subscribe => { + self.subscription_id = Some(id); + let id = self.subscription_id.as_ref().unwrap(); + if request.params.unwrap()[0] + == Query::from(EventType::NewBlock).to_string() + { + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "error": "error"}}"#, + id + )] + } else { + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{}}}}"#, + id + )] + } + } + ReqType::AbciInfo => { + // Mock a subscription result returning on the wire before + // the simple request result + let info = AbciInfo { + last_block_app_hash: transaction::Hash::new( + hash_tx_bytes("Testing".as_bytes()).0, + ) + .as_ref() + .into(), + ..AbciInfo::default() + }; + let resp = serde_json::to_string(&info).unwrap(); + if let Some(prev_id) = self.subscription_id.take() { + vec![ + format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{"subscription": "result!"}}}}"#, + prev_id + ), + format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{"response": {}}}}}"#, + id, resp + ), + ] + } else { + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{"response": {}}}}}"#, + id, resp + )] + } + } + } + } + } + + /// A mock tendermint node. This is just a basic websocket server + /// TODO: When the thread drops from scope, we may get an ignorable + /// panic as we did not shut the loop down. But we should. + fn start() { + let node = Server::bind("localhost:26657").unwrap(); + for connection in node.filter_map(Result::ok) { + std::thread::spawn(move || { + let mut handler = Handle::default(); + let mut client = connection.accept().unwrap(); + loop { + for resp in match client.recv_message().unwrap() { + OwnedMessage::Text(msg) => handler.handle(msg), + _ => panic!("Unexpected request"), + } { + let msg = Message::text(resp); + let _ = client.send_message(&msg); + } + } + }); + } + } + + /// Test that we cannot subscribe to a new event + /// if we have an active subscription + #[test] + fn test_subscribe_twice() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that we cannot subscribe while we still have an active + // subscription + assert!(rpc_client.subscribe(Query::from(EventType::Tx)).is_err()); + } + + /// Test that even if there is an error on the protocol layer, + /// the client still unsubscribes and returns control + #[test] + fn test_unsubscribe_even_on_protocol_error() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that unsubscribe was successful even though it returned an + // error + assert!(rpc_client.unsubscribe().is_err()); + assert!(rpc_client.subscribed.is_none()); + } + + /// Test that if we unsubscribe from an event, we can + /// reuse the client to subscribe to a new event + #[test] + fn test_subscribe_after_unsubscribe() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that unsubscribe was successful + let _ = rpc_client.unsubscribe(); + assert!(rpc_client.subscribed.as_ref().is_none()); + // Check that we can now subscribe to new event + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.expect("Test failed").query, + Query::from(EventType::Tx) + ); + } + + /// In this test we first subscribe to an event and then + /// make a simple request. + /// + /// The mock node is set up so that while the request is waiting + /// for its response, it receives the response for the subscription. + /// + /// This test checks that methods correctly return the correct + /// responses. + #[test] + fn test_subscription_returns_before_request_handled() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that there are no pending subscription responses + assert!(rpc_client.received_responses.lock().unwrap().is_empty()); + // If the wrong response is returned, json deserialization will fail the + // test + let _ = + tokio_test::block_on(rpc_client.abci_info()).expect("Test failed"); + // Check that we received the subscription response and it has been + // stored + assert!( + rpc_client + .received_responses + .lock() + .unwrap() + .contains_key(&rpc_client.subscribed.as_ref().unwrap().id) + ); + + // check that we receive the expected response to the subscription + let response = rpc_client.receive_response().expect("Test failed"); + assert_eq!(response.to_string(), r#"{"subscription":"result!"}"#); + // Check that there are no pending subscription responses + assert!(rpc_client.received_responses.lock().unwrap().is_empty()); + } +} diff --git a/apps/src/lib/client/tm_jsonrpc_client.rs b/apps/src/lib/client/tm_jsonrpc_client.rs deleted file mode 100644 index ccdf402577..0000000000 --- a/apps/src/lib/client/tm_jsonrpc_client.rs +++ /dev/null @@ -1,261 +0,0 @@ -use std::convert::TryFrom; -use std::fmt::{Display, Formatter}; -use std::ops::{Deref, DerefMut}; - -use curl::easy::{Easy2, Handler, WriteError}; -use serde::{Deserialize, Serialize}; - -use crate::client::tendermint_rpc_types::{ - parse, Error, EventParams, EventReply, TxResponse, -}; -use crate::facade::tendermint_config::net::Address as TendermintAddress; -use crate::facade::tendermint_rpc::query::Query; - -/// Maximum number of times we try to send a curl request -const MAX_SEND_ATTEMPTS: u8 = 10; -/// Number of events we request from the events log -const NUM_EVENTS: u64 = 10; - -pub struct JsonRpcAddress<'a> { - host: &'a str, - port: u16, -} - -impl<'a> TryFrom<&'a TendermintAddress> for JsonRpcAddress<'a> { - type Error = Error; - - fn try_from(value: &'a TendermintAddress) -> Result { - match value { - TendermintAddress::Tcp { host, port, .. } => Ok(Self { - host: host.as_str(), - port: *port, - }), - _ => Err(Error::Address(value.to_string())), - } - } -} - -impl<'a> Display for JsonRpcAddress<'a> { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}:{}", self.host, self.port) - } -} - -/// The body of a json rpc request -#[derive(Serialize)] -pub struct Request { - /// Method name - pub method: String, - /// parameters to give the method - params: EventParams, - /// ID of the request - id: u8, -} - -impl From for Request { - fn from(params: EventParams) -> Self { - Request { - method: "events".into(), - params, - id: 1, - } - } -} - -/// The response we get back from Tendermint -#[derive(Serialize, Deserialize)] -pub struct Response { - /// JSON-RPC version - jsonrpc: String, - /// Identifier included in request - id: u8, - /// Results of request (if successful) - result: Option, - /// Error message if unsuccessful - error: Option, -} - -impl Response { - /// Convert the response into a result type - pub fn into_result(self) -> Result { - if let Some(e) = self.error { - Err(Error::Rpc(e)) - } else if let Some(result) = self.result { - Ok(result) - } else { - Err(Error::MalformedJson) - } - } -} - -/// Holds bytes returned in response to curl request -#[derive(Default)] -pub struct Collector(Vec); - -impl Handler for Collector { - fn write(&mut self, data: &[u8]) -> Result { - self.0.extend_from_slice(data); - Ok(data.len()) - } -} - -/// The RPC client -pub struct Client<'a> { - /// The actual curl client - inner: Easy2, - /// Url to send requests to - url: &'a str, - /// The request body - request: Request, - /// The hash of the tx whose corresponding event is being searched for. - hash: &'a str, -} - -impl<'a> Deref for Client<'a> { - type Target = Easy2; - - fn deref(&self) -> &Self::Target { - &self.inner - } -} - -impl<'a> DerefMut for Client<'a> { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.inner - } -} - -impl<'a> Client<'a> { - /// Create a new client - pub fn new(url: &'a str, request: Request, hash: &'a str) -> Self { - let mut client = Self { - inner: Easy2::new(Collector::default()), - url, - request, - hash, - }; - client.initialize(); - client - } - - /// Send a request to Tendermint - /// - /// Takes the 10 newest block header events and searches for - /// the relevant event among them. - pub fn send(&mut self) -> Result { - // send off the request - // this loop is here because if commit timeouts - // become too long, sometimes we get back empty responses. - for attempt in 0..MAX_SEND_ATTEMPTS { - match self.perform() { - Ok(()) => break, - Err(err) => { - tracing::debug!(?attempt, response = ?err, "attempting request") - } - } - } - if self.get_ref().0.is_empty() { - return Err(Error::Send); - } - - // deserialize response - let response: Response = - serde_json::from_slice(self.get_ref().0.as_slice()) - .map_err(Error::Deserialize)?; - let response = response.into_result()?; - // search for the event in the response and return - // it if found. Else request the next chunk of results - parse(response, self.hash) - .ok_or_else(|| Error::NotFound(self.hash.to_string())) - } - - /// Initialize the curl client from the fields of `Client` - fn initialize(&mut self) { - self.inner.reset(); - let url = self.url; - self.url(url).unwrap(); - self.post(true).unwrap(); - - // craft the body of the request - let request_body = serde_json::to_string(&self.request).unwrap(); - self.post_field_size(request_body.as_bytes().len() as u64) - .unwrap(); - // update the request and serialize to bytes - let data = serde_json::to_string(&self.request).unwrap(); - let data = data.as_bytes(); - self.post_fields_copy(data).unwrap(); - } -} - -/// Given a query looking for a particular Anoma event, -/// query the Tendermint's jsonrpc endpoint for the events -/// log. Returns the appropriate event if found in the log. -pub async fn fetch_event( - address: &str, - filter: Query, - tx_hash: &str, -) -> Result { - // craft the body of the request - let request = Request::from(EventParams::new( - filter, - NUM_EVENTS, - std::time::Duration::from_secs(60), - )); - // construct a curl client - let mut client = Client::new(address, request, tx_hash); - // perform the request - client.send() -} - -#[cfg(test)] -mod test_rpc_types { - use serde_json::json; - - use super::*; - use crate::client::tendermint_rpc_types::{EventData, EventItem}; - - /// Test that we correctly parse the response from Tendermint - #[test] - fn test_parse_response() { - let resp = r#" - { - "jsonrpc":"2.0", - "id":1, - "result":{ - "items": [{ - "cursor":"16f1b066717b4261-0060", - "event":"NewRoundStep", - "data":{ - "type":"tendermint/event/RoundState", - "value":{ - "height":"17416", - "round":0, - "step":"RoundStepCommit" - } - } - }], - "more":true, - "oldest":"16f1b065029b23d0-0001", - "newest":"16f1b066717b4261-0060" - } - }"#; - let response: Response = - serde_json::from_str(resp).expect("Test failed"); - let items = response.into_result().expect("Test failed").items; - assert_eq!( - items, - vec![EventItem { - cursor: String::from("16f1b066717b4261-0060").into(), - event: "NewRoundStep".to_string(), - data: EventData { - r#type: "tendermint/event/RoundState".to_string(), - value: json!({ - "height":"17416", - "round":0, - "step":"RoundStepCommit" - }), - } - }] - ) - } -} diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index b3a6141ee6..92f801fe06 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -30,15 +30,15 @@ use super::rpc; use crate::cli::context::WalletAddress; use crate::cli::{args, safe_exit, Context}; use crate::client::signing::{find_keypair, sign_tx}; -use crate::client::tendermint_rpc_types::{Error, TxBroadcastData, TxResponse}; +use crate::client::tendermint_rpc_types::{TxBroadcastData, TxResponse}; use crate::client::tendermint_websocket_client::{ Error as WsError, TendermintWebsocketClient, WebSocketAddress, }; -use crate::client::tm_jsonrpc_client::{fetch_event, JsonRpcAddress}; use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::facade::tendermint_rpc::endpoint::broadcast::tx_sync::Response; use crate::facade::tendermint_rpc::query::{EventType, Query}; use crate::facade::tendermint_rpc::{Client, HttpClient}; +use crate::node::ledger::events::EventType as NamadaEventType; use crate::node::ledger::tendermint_node; const ACCEPTED_QUERY_KEY: &str = "accepted.hash"; @@ -1120,7 +1120,7 @@ pub async fn broadcast_tx( address: TendermintAddress, to_broadcast: &TxBroadcastData, ) -> Result { - let (tx, wrapper_tx_hash, _decrypted_tx_hash) = match to_broadcast { + let (tx, wrapper_tx_hash, decrypted_tx_hash) = match to_broadcast { TxBroadcastData::Wrapper { tx, wrapper_hash, @@ -1158,7 +1158,7 @@ pub async fn broadcast_tx( // acceptance/application results later { println!("Wrapper transaction hash: {:?}", wrapper_tx_hash); - println!("Inner transaction hash: {:?}", _decrypted_tx_hash); + println!("Inner transaction hash: {:?}", decrypted_tx_hash); } Ok(response) } else { @@ -1177,56 +1177,80 @@ pub async fn broadcast_tx( pub async fn submit_tx( address: TendermintAddress, to_broadcast: TxBroadcastData, -) -> Result { - // the data for finding the relevant events +) -> Result { let (_, wrapper_hash, decrypted_hash) = match &to_broadcast { TxBroadcastData::Wrapper { tx, wrapper_hash, decrypted_hash, } => (tx, wrapper_hash, decrypted_hash), - TxBroadcastData::DryRun(_) => { - panic!("Cannot broadcast a dry-run transaction") - } + _ => panic!("Cannot broadcast a dry-run transaction"), }; - let url = JsonRpcAddress::try_from(&address)?.to_string(); + let mut wrapper_tx_subscription = TendermintWebsocketClient::open( + WebSocketAddress::try_from(address.clone())?, + None, + )?; - // the filters for finding the relevant events - let wrapper_query = Query::from(EventType::NewBlockHeader) - .and_eq(ACCEPTED_QUERY_KEY, wrapper_hash.as_str()); - let tx_query = Query::from(EventType::NewBlockHeader) - .and_eq(APPLIED_QUERY_KEY, decrypted_hash.as_str()); + // It is better to subscribe to the transaction before it is broadcast + // + // Note that the `APPLIED_QUERY_KEY` key comes from a custom event + // created by the shell + let query = Query::from(EventType::NewBlock) + .and_eq(APPLIED_QUERY_KEY, wrapper_hash.as_str()); + wrapper_tx_subscription.subscribe(query)?; + + // We also subscribe to the event emitted when the encrypted + // payload makes its way onto the blockchain + let mut decrypted_tx_subscription = { + let mut decrypted_tx_subscription = TendermintWebsocketClient::open( + WebSocketAddress::try_from(address.clone())?, + None, + )?; + let query = Query::from(EventType::NewBlock) + .and_eq(ACCEPTED_QUERY_KEY, decrypted_hash.as_str()); + decrypted_tx_subscription.subscribe(query)?; + decrypted_tx_subscription + }; - // broadcast the tx - if let Err(err) = broadcast_tx(address, &to_broadcast).await { - eprintln!("Encountered error while broadcasting transaction: {}", err); - safe_exit(1) - } + // Broadcast the supplied transaction + broadcast_tx(address, &to_broadcast).await?; - // get the event for the wrapper tx - let response = - fetch_event(&url, wrapper_query, wrapper_hash.as_str()).await?; - println!( - "Transaction accepted with result: {}", - serde_json::to_string_pretty(&response).unwrap() - ); + let parsed = { + let parsed = TxResponse::parse( + wrapper_tx_subscription.receive_response()?, + NamadaEventType::Accepted, + wrapper_hash, + ) + .map_err(WsError::MalformedJson)? + .ok_or_else(|| WsError::MissingEvent(wrapper_hash.clone()))?; - // The transaction is now on chain. We wait for it to be decrypted - // and applied - if response.code == 0.to_string() { - // get the event for the inner tx - let response = - fetch_event(&url, tx_query, decrypted_hash.as_str()).await?; println!( - "Transaction applied with result: {}", - serde_json::to_string_pretty(&response).unwrap() + "Transaction accepted with result: {}", + serde_json::to_string_pretty(&parsed).unwrap() ); - Ok(response) - } else { - tracing::warn!( - "Received an error from the associated wrapper tx: {}", - response.code - ); - Ok(response) - } + // The transaction is now on chain. We wait for it to be decrypted + // and applied + if parsed.code == 0.to_string() { + let parsed = TxResponse::parse( + decrypted_tx_subscription.receive_response()?, + NamadaEventType::Applied, + decrypted_hash.as_str(), + ) + .map_err(WsError::MalformedJson)? + .ok_or_else(|| WsError::MissingEvent(decrypted_hash.clone()))?; + println!( + "Transaction applied with result: {}", + serde_json::to_string_pretty(&parsed).unwrap() + ); + Ok(parsed) + } else { + Ok(parsed) + } + }; + + wrapper_tx_subscription.unsubscribe()?; + wrapper_tx_subscription.close(); + decrypted_tx_subscription.unsubscribe()?; + decrypted_tx_subscription.close(); + parsed } diff --git a/apps/src/lib/node/ledger/tendermint_node.rs b/apps/src/lib/node/ledger/tendermint_node.rs index 5918ab814f..80a532597a 100644 --- a/apps/src/lib/node/ledger/tendermint_node.rs +++ b/apps/src/lib/node/ledger/tendermint_node.rs @@ -356,14 +356,6 @@ async fn update_tendermint_config( config.instrumentation.namespace = tendermint_config.instrumentation_namespace; - // setup the events log - { - // keep events for one minute - config.rpc.event_log_window_size = - std::time::Duration::from_secs(59).into(); - // we do not limit the size of the events log - config.rpc.event_log_max_items = 0; - } let mut file = OpenOptions::new() .write(true) From 00fc54154eca89f352e73cdeecb814c6aaf67404 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Wed, 7 Sep 2022 11:00:25 +0100 Subject: [PATCH 20/26] Add Cargo.lock changes --- Cargo.lock | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index adc7cad4f8..af1eb8ab56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1353,36 +1353,6 @@ dependencies = [ "rand 0.7.3", ] -[[package]] -name = "curl" -version = "0.4.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d855aeef205b43f65a5001e0997d81f8efca7badad4fad7d897aa7f0d0651f" -dependencies = [ - "curl-sys", - "libc", - "openssl-probe", - "openssl-sys", - "schannel", - "socket2 0.4.4", - "winapi 0.3.9", -] - -[[package]] -name = "curl-sys" -version = "0.4.55+curl-7.83.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23734ec77368ec583c2e61dd3f0b0e5c98b93abe6d2a004ca06b91dd7e3e2762" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", - "winapi 0.3.9", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -4024,7 +3994,6 @@ dependencies = [ "clap 3.0.0-beta.2", "color-eyre", "config", - "curl", "derivative", "directories", "ed25519-consensus", From 74d83f247ee2082c51798fbe9b487e9850720c19 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Fri, 9 Sep 2022 08:58:00 +0100 Subject: [PATCH 21/26] Change the way we call Tendermint --- apps/src/lib/node/ledger/tendermint_node.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/src/lib/node/ledger/tendermint_node.rs b/apps/src/lib/node/ledger/tendermint_node.rs index 80a532597a..407226fe37 100644 --- a/apps/src/lib/node/ledger/tendermint_node.rs +++ b/apps/src/lib/node/ledger/tendermint_node.rs @@ -187,7 +187,7 @@ pub fn reset(tendermint_dir: impl AsRef) -> Result<()> { // reset all the Tendermint state, if any std::process::Command::new(tendermint_path) .args(&[ - "reset", + "reset-state", "unsafe-all", // NOTE: log config: https://docs.tendermint.com/master/nodes/logging.html#configuring-log-levels // "--log-level=\"*debug\"", @@ -356,7 +356,6 @@ async fn update_tendermint_config( config.instrumentation.namespace = tendermint_config.instrumentation_namespace; - let mut file = OpenOptions::new() .write(true) .truncate(true) From 6f5cd41b0f36301df24c0cecf4a220d365e2a079 Mon Sep 17 00:00:00 2001 From: R2D2 Date: Tue, 6 Sep 2022 16:44:08 +0200 Subject: [PATCH 22/26] Updated the lock file and fixed resulting issues. Tendermint currently won't start however --- apps/src/lib/client/tx.rs | 15 +++++++++++++-- apps/src/lib/node/ledger/tendermint_node.rs | 4 +--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index 92f801fe06..240ba69e0f 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -1186,9 +1186,20 @@ pub async fn submit_tx( } => (tx, wrapper_hash, decrypted_hash), _ => panic!("Cannot broadcast a dry-run transaction"), }; + + let websocket_timeout = + if let Ok(val) = env::var(ENV_VAR_ANOMA_TENDERMINT_WEBSOCKET_TIMEOUT) { + if let Ok(timeout) = val.parse::() { + Duration::new(timeout, 0) + } else { + Duration::new(300, 0) + } + } else { + Duration::new(300, 0) + }; let mut wrapper_tx_subscription = TendermintWebsocketClient::open( WebSocketAddress::try_from(address.clone())?, - None, + Some(websocket_timeout), )?; // It is better to subscribe to the transaction before it is broadcast @@ -1204,7 +1215,7 @@ pub async fn submit_tx( let mut decrypted_tx_subscription = { let mut decrypted_tx_subscription = TendermintWebsocketClient::open( WebSocketAddress::try_from(address.clone())?, - None, + Some(websocket_timeout), )?; let query = Query::from(EventType::NewBlock) .and_eq(ACCEPTED_QUERY_KEY, decrypted_hash.as_str()); diff --git a/apps/src/lib/node/ledger/tendermint_node.rs b/apps/src/lib/node/ledger/tendermint_node.rs index 407226fe37..d30eaa4043 100644 --- a/apps/src/lib/node/ledger/tendermint_node.rs +++ b/apps/src/lib/node/ledger/tendermint_node.rs @@ -126,9 +126,7 @@ pub async fn run( let mut tendermint_node = Command::new(&tendermint_path); tendermint_node.args(&[ "start", - "--mode", - &mode, - "--proxy-app", + "--proxy_app", &ledger_address, "--home", &home_dir_string, From 0f75154b12f5a83f9279654c904a4da6f9fbbc26 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Fri, 9 Sep 2022 09:15:23 +0100 Subject: [PATCH 23/26] Fix websockets and parsing of events returned from Tm --- apps/src/lib/client/tendermint_rpc_types.rs | 52 ++------------------- apps/src/lib/client/tx.rs | 13 ++---- 2 files changed, 8 insertions(+), 57 deletions(-) diff --git a/apps/src/lib/client/tendermint_rpc_types.rs b/apps/src/lib/client/tendermint_rpc_types.rs index c8bca25cb5..32454c0440 100644 --- a/apps/src/lib/client/tendermint_rpc_types.rs +++ b/apps/src/lib/client/tendermint_rpc_types.rs @@ -1,14 +1,10 @@ -use std::convert::TryFrom; - use jsonpath_lib as jsonpath; use namada::proto::Tx; use namada::types::address::Address; use serde::Serialize; use crate::cli::safe_exit; -use crate::node::ledger::events::{ - Attributes, Error, EventType as NamadaEventType, -}; +use crate::node::ledger::events::EventType as NamadaEventType; /// Data needed for broadcasting a tx and /// monitoring its progress on chain @@ -47,53 +43,11 @@ impl TxResponse { json: serde_json::Value, event_type: NamadaEventType, tx_hash: &str, - ) -> Result, Error> { - let mut selector = jsonpath::selector(&json); - let mut event = { - match selector(&format!("$.events.[?(@.type=='{}')]", event_type)) - .unwrap() - .pop() - { - Some(event) => { - let attrs = Attributes::try_from(event)?; - match attrs.get("hash") { - Some(hash) if hash == tx_hash => attrs, - _ => return Ok(None), - } - } - _ => return Ok(None), - } - }; - let info = event.take("info").unwrap(); - let log = event.take("log").unwrap(); - let height = event.take("height").unwrap(); - let hash = event.take("hash").unwrap(); - let code = event.take("code").unwrap(); - let gas_used = - event.take("gas_used").unwrap_or_else(|| String::from("0")); - let initialized_accounts = event.take("initialized_accounts"); - let initialized_accounts = match initialized_accounts { - Some(values) => serde_json::from_str(&values).unwrap(), - _ => vec![], - }; - Ok(Some(TxResponse { - info, - log, - height, - hash, - code, - gas_used, - initialized_accounts, - })) - } - - /// Find a tx with a given hash from the the websocket subscription - /// to Tendermint events. - pub fn find_tx(json: serde_json::Value, tx_hash: &str) -> Self { + ) -> Self { let tx_hash_json = serde_json::Value::String(tx_hash.to_string()); let mut selector = jsonpath::selector(&json); let mut index = 0; - let evt_key = "accepted"; + let evt_key = event_type.to_string(); // Find the tx with a matching hash let hash = loop { if let Ok(hash) = diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index 240ba69e0f..7574054e09 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -1197,6 +1197,7 @@ pub async fn submit_tx( } else { Duration::new(300, 0) }; + tracing::debug!("Tenderming address: {:?}", address); let mut wrapper_tx_subscription = TendermintWebsocketClient::open( WebSocketAddress::try_from(address.clone())?, Some(websocket_timeout), @@ -1207,7 +1208,7 @@ pub async fn submit_tx( // Note that the `APPLIED_QUERY_KEY` key comes from a custom event // created by the shell let query = Query::from(EventType::NewBlock) - .and_eq(APPLIED_QUERY_KEY, wrapper_hash.as_str()); + .and_eq(ACCEPTED_QUERY_KEY, wrapper_hash.as_str()); wrapper_tx_subscription.subscribe(query)?; // We also subscribe to the event emitted when the encrypted @@ -1218,7 +1219,7 @@ pub async fn submit_tx( Some(websocket_timeout), )?; let query = Query::from(EventType::NewBlock) - .and_eq(ACCEPTED_QUERY_KEY, decrypted_hash.as_str()); + .and_eq(APPLIED_QUERY_KEY, decrypted_hash.as_str()); decrypted_tx_subscription.subscribe(query)?; decrypted_tx_subscription }; @@ -1231,9 +1232,7 @@ pub async fn submit_tx( wrapper_tx_subscription.receive_response()?, NamadaEventType::Accepted, wrapper_hash, - ) - .map_err(WsError::MalformedJson)? - .ok_or_else(|| WsError::MissingEvent(wrapper_hash.clone()))?; + ); println!( "Transaction accepted with result: {}", @@ -1246,9 +1245,7 @@ pub async fn submit_tx( decrypted_tx_subscription.receive_response()?, NamadaEventType::Applied, decrypted_hash.as_str(), - ) - .map_err(WsError::MalformedJson)? - .ok_or_else(|| WsError::MissingEvent(decrypted_hash.clone()))?; + ); println!( "Transaction applied with result: {}", serde_json::to_string_pretty(&parsed).unwrap() From 9a830c00650e8643b540c55a5940606e1f46f24b Mon Sep 17 00:00:00 2001 From: "Raymond E. Pasco" Date: Sat, 15 Oct 2022 16:27:03 -0400 Subject: [PATCH 24/26] ci: standardize on one tendermint hash With the shims, we will use only tendermint hash ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 for the time being. --- .github/workflows/build-and-test.yml | 2 +- .github/workflows/build-tendermint.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0d0112924e..1c4cbd3412 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -117,7 +117,7 @@ jobs: cache_key: anoma cache_version: v1 wait_for: anoma-release (ubuntu-latest, ABCI Release build, anoma-e2e-release, v1) - tendermint_artifact: tendermint-unreleased-559fb33ff9b27503ce7ac1c7d8589fe1d8b3e900 + tendermint_artifact: tendermint-unreleased-ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 env: CARGO_INCREMENTAL: 0 diff --git a/.github/workflows/build-tendermint.yml b/.github/workflows/build-tendermint.yml index 91a5259dac..7914a39a49 100644 --- a/.github/workflows/build-tendermint.yml +++ b/.github/workflows/build-tendermint.yml @@ -21,9 +21,6 @@ jobs: matrix: os: [ubuntu-latest] make: - - name: tendermint-unreleased - repository: heliaxdev/tendermint - tendermint_version: 559fb33ff9b27503ce7ac1c7d8589fe1d8b3e900 - name: tendermint-unreleased repository: heliaxdev/tendermint tendermint_version: ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 From 5f544763772795d9570383a30ffe39a14b08f772 Mon Sep 17 00:00:00 2001 From: "Raymond E. Pasco" Date: Mon, 17 Oct 2022 04:31:43 -0400 Subject: [PATCH 25/26] wasm: update checksums.json --- wasm/checksums.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/wasm/checksums.json b/wasm/checksums.json index 898f6e9763..f2bdcdd57f 100644 --- a/wasm/checksums.json +++ b/wasm/checksums.json @@ -1,19 +1,19 @@ { - "tx_bond.wasm": "tx_bond.16097490afa7378c79e6216751b20796cde3a9026c34255c3f1e5ec5a4c9482e.wasm", - "tx_from_intent.wasm": "tx_from_intent.f8d1937b17a3abaf7ea595526c870b3d57ddef8e0c1bc96f8e0a448864b186c7.wasm", - "tx_ibc.wasm": "tx_ibc.378b10551c0b22c2c892d24e2676ee5160d654e2e53a50e7925e0f2c6321497b.wasm", - "tx_init_account.wasm": "tx_init_account.adab66c2b4d635e9c42133936aafb143363f91dddff2a60f94df504ffec951a6.wasm", - "tx_init_nft.wasm": "tx_init_nft.d1065ebd80ba6ea97f29bc2268becf9ba3ba2952641992464f3e9e868df17447.wasm", - "tx_init_proposal.wasm": "tx_init_proposal.184131576a579f9ece96460d1eb20e5970fcd149b0527c8e56b711e5c535aa5f.wasm", - "tx_init_validator.wasm": "tx_init_validator.2990747d24d467b56e19724c5d13df826a3aab83f7e1bf26558dbdf44e260f8a.wasm", - "tx_mint_nft.wasm": "tx_mint_nft.33db14dea4a03ff7508ca44f3ae956d83c0abceb3dae5be844668e54ac22b273.wasm", - "tx_transfer.wasm": "tx_transfer.a601d62296f56f6b4dabb0a2ad082478d195e667c7469f363bdfd5fe41349bd8.wasm", - "tx_unbond.wasm": "tx_unbond.014cbf5b0aa3ac592c0a6940dd502ec8569a3af4d12782e3a5931c15dc13042f.wasm", - "tx_update_vp.wasm": "tx_update_vp.83d4caeb5a9ca3009cd899810493a6b87b4c07fa9ed36f297db99dc881fb9a1c.wasm", - "tx_vote_proposal.wasm": "tx_vote_proposal.bcb5280be9dfeed0a7650ba5e4a3cebc2c19b76780fd74dcb345be3da766b64a.wasm", - "tx_withdraw.wasm": "tx_withdraw.8fc0a3439ee9ae66047c520519877bc1f540e0cb02abfa31afa8cce8cd069b6f.wasm", - "vp_nft.wasm": "vp_nft.2c820c728d241b82bf0ed3c552ee9e7c046bceaa4f7b6f12d3236a1a3d7c1589.wasm", - "vp_testnet_faucet.wasm": "vp_testnet_faucet.6e762f3fda8aa7a252e2b29a4a312db91ded062d6c18b8b489883733c89dc227.wasm", - "vp_token.wasm": "vp_token.c45cc3848f12fc47713702dc206d1312ad740a6bbee7f141556714f6f89d4985.wasm", - "vp_user.wasm": "vp_user.d6cd2f4b5bc26f96df6aa300fddf4d25e1656920d59896209bd54ae8d407ecde.wasm" + "tx_bond.wasm": "tx_bond.82d69c1cdf57188270f50807fa212e6d709e74e853b6c61c026ba29c0161f1b2.wasm", + "tx_from_intent.wasm": "tx_from_intent.7405a87fa5dadbce24ad572b4c0bcc325d123be6a820c86e798e5999d13f01e7.wasm", + "tx_ibc.wasm": "tx_ibc.780cc2e3e9066908d77fcd913289075212f6a55a7fc23ada00a274acd4dad0f3.wasm", + "tx_init_account.wasm": "tx_init_account.42f987c32d5137a16e7ecf13a4b224e6db1108d7de35a507f3c248a227a0c2e4.wasm", + "tx_init_nft.wasm": "tx_init_nft.753ea9cba369f3d253f7a7b207019545136cd4f1044664264360de37f00907d7.wasm", + "tx_init_proposal.wasm": "tx_init_proposal.7367721c814eda33d23eba40a26abce81143ee1402e92955de0fa5556367dce6.wasm", + "tx_init_validator.wasm": "tx_init_validator.10efd51df16e758a35e84992f46d510c3a17e8eeed6113dcbb99cf951f93b4d0.wasm", + "tx_mint_nft.wasm": "tx_mint_nft.419e1061a60ce50bafe9ec86f771f26d81e110eb3c9f64b4db68200a9a65eff8.wasm", + "tx_transfer.wasm": "tx_transfer.15525bdf61259b40c751ae37ad9ed9890b8a23d93bd0aec7de580b96d433b6c9.wasm", + "tx_unbond.wasm": "tx_unbond.cf48deaa9c0e23cd1486e4c693f1e7d9464d41fde6ef5037e22fa8c0526f586b.wasm", + "tx_update_vp.wasm": "tx_update_vp.9dc45326a8b485b4f40d2c35ef9f75f423e28b87c09cee9993002c0dd19312eb.wasm", + "tx_vote_proposal.wasm": "tx_vote_proposal.e46c995d77207dfd8c9349608ddac950ddcceac37e4ca44dcac93378e7638820.wasm", + "tx_withdraw.wasm": "tx_withdraw.4533a099547e1f7334569b576314bbaeea96fdc2d709996eabe599a3fa543e24.wasm", + "vp_nft.wasm": "vp_nft.e9b5369861c06fb8d1a292d8695ccd888f52f6eb94fcb951cb3821348c93c4b7.wasm", + "vp_testnet_faucet.wasm": "vp_testnet_faucet.afb4267fc678f5ccbfc1457147670d7f7c41a9ac8578a72c68e9656325c8345b.wasm", + "vp_token.wasm": "vp_token.481e716492b7b98821f87c4c6898aea9a257b6b80a5959715f8240185adaa91d.wasm", + "vp_user.wasm": "vp_user.68584fc8d1de345d12fb2d2f5f965ab4e5e5944cb8a40a2d1488bc35172adc1f.wasm" } \ No newline at end of file From 23275d908ba46c2f662081471e7c622b2f674fe9 Mon Sep 17 00:00:00 2001 From: "Raymond E. Pasco" Date: Mon, 17 Oct 2022 05:11:50 -0400 Subject: [PATCH 26/26] build: pin abciplus library revisions --- apps/Cargo.toml | 12 +++++++----- shared/Cargo.toml | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/Cargo.toml b/apps/Cargo.toml index f128d58667..ec206815f9 100644 --- a/apps/Cargo.toml +++ b/apps/Cargo.toml @@ -126,10 +126,11 @@ tendermint-abcipp = {package = "tendermint", git = "https://github.com/heliaxdev tendermint-config-abcipp = {package = "tendermint-config", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} tendermint-proto-abcipp = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} tendermint-rpc-abcipp = {package = "tendermint-rpc", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["http-client", "websocket-client"], optional = true} -tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} -tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} -tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} -tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", features = ["http-client", "websocket-client"], optional = true} +# branch bat/abciplus +tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", features = ["http-client", "websocket-client"], optional = true} thiserror = "1.0.30" tokio = {version = "1.8.2", features = ["full"]} toml = "0.5.8" @@ -138,7 +139,8 @@ tower = "0.4" # Also, using the same version of tendermint-rs as we do here. # with a patch for https://github.com/penumbra-zone/tower-abci/issues/7. tower-abci-abcipp = {package = "tower-abci", git = "https://github.com/heliaxdev/tower-abci", rev = "f6463388fc319b6e210503b43b3aecf6faf6b200", optional = true} -tower-abci = {git = "https://github.com/heliaxdev/tower-abci", branch = "bat/abciplus", optional = true} +# branch bat/abciplus +tower-abci = {git = "https://github.com/heliaxdev/tower-abci", rev = "21623a99bdca5b006d53752a1967849bef3b89ea", optional = true} tracing = "0.1.30" tracing-log = "0.1.2" tracing-subscriber = {version = "0.3.7", features = ["env-filter"]} diff --git a/shared/Cargo.toml b/shared/Cargo.toml index bbfb51171b..a047b8a263 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -83,8 +83,9 @@ tpke = {package = "group-threshold-cryptography", optional = true, git = "https: # TODO using the same version of tendermint-rs as we do here. ibc-abcipp = {package = "ibc", git = "https://github.com/heliaxdev/ibc-rs", rev = "30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc", default-features = false, optional = true} ibc-proto-abcipp = {package = "ibc-proto", git = "https://github.com/heliaxdev/ibc-rs", rev = "30b3495ac56c6c37c99bc69ef9f2e84c3309c6cc", default-features = false, optional = true} -ibc = {git = "https://github.com/heliaxdev/ibc-rs", branch = "bat/abciplus", default-features = false, optional = true} -ibc-proto = {git = "https://github.com/heliaxdev/ibc-rs", branch = "bat/abciplus", default-features = false, optional = true} +# branch bat/abciplus +ibc = {git = "https://github.com/heliaxdev/ibc-rs", rev = "99a761657a51f6e5f074f3217426903e53632934", default-features = false, optional = true} +ibc-proto = {git = "https://github.com/heliaxdev/ibc-rs", rev = "99a761657a51f6e5f074f3217426903e53632934", default-features = false, optional = true} ics23 = "0.6.7" itertools = "0.10.0" loupe = {version = "0.1.3", optional = true} @@ -108,8 +109,9 @@ tempfile = {version = "3.2.0", optional = true} # temporarily using fork work-around for https://github.com/informalsystems/tendermint-rs/issues/971 tendermint-abcipp = {package = "tendermint", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} tendermint-proto-abcipp = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} -tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} -tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", branch = "bat/abciplus", optional = true} +# branch bat/abciplus +tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} thiserror = "1.0.30" tracing = "0.1.30" wasmer = {version = "=2.2.0", optional = true}