Skip to content

Commit

Permalink
Merge branch 'tomas/remove-abci' (#224)
Browse files Browse the repository at this point in the history
* tomas/remove-abci:
  [ci] wasm checksums update
  ledger: debug log some ABCI++ requests
  ledger: make prepare_proposal and process_proposal stateless
  ledger: refactor tx_queue
  scripts/get_tendermint: update for ABCI++ temp fork release
  test/e2e/ledger: enable ignored tests for ABCI++ workaround
  shell: process transaction when `ProcessProposal` hasn't (non-validator)
  make: remove "*-abci-plus-plus"
  all: remove "ABCI" conditional compilation
  deps: remove ABCI dependencies, use ABCI++ as default
  • Loading branch information
tzemanovic committed Aug 1, 2022
2 parents fcacdd3 + fdb12ed commit 95f6f49
Show file tree
Hide file tree
Showing 55 changed files with 747 additions and 2,595 deletions.
285 changes: 24 additions & 261 deletions Cargo.lock

Large diffs are not rendered by default.

93 changes: 2 additions & 91 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,11 @@ audit-ignores += RUSTSEC-2021-0076
build:
$(cargo) build

build-abci-plus-plus:
$(cargo) build --no-default-features --features "ABCI-plus-plus"

build-test:
$(cargo) build --tests

build-test-abci-plus-plus:
$(cargo) build --tests --no-default-features --features "ABCI-plus-plus"

build-release:
ANOMA_DEV=false $(cargo) build --release --package namada_apps --manifest-path Cargo.toml --features "ABCI"

build-release-abci-plus-plus:
ANOMA_DEV=false $(cargo) build --release --package namada_apps --no-default-features --features "ABCI-plus-plus"
ANOMA_DEV=false $(cargo) build --release --package namada_apps --manifest-path Cargo.toml

check-release:
ANOMA_DEV=false $(cargo) check --release --package namada_apps
Expand All @@ -56,43 +47,14 @@ check:
make -C $(wasms_for_tests) check && \
$(foreach wasm,$(wasm_templates),$(check-wasm) && ) true

check-abci-plus-plus:
$(cargo) check --no-default-features --features "ABCI-plus-plus"

clippy-wasm = $(cargo) +$(nightly) clippy --manifest-path $(wasm)/Cargo.toml --all-targets -- -D warnings

clippy-wasm-abci-plus-plus = $(cargo) +$(nightly) clippy --manifest-path $(wasm)/Cargo.toml --all-targets --no-default-features --features "ABCI-plus-plus" -- -D warnings

clippy:
ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets -- -D warnings && \
make -C $(wasms) clippy && \
make -C $(wasms_for_tests) clippy && \
$(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true

clippy-abci-plus-plus:
ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets \
--manifest-path ./apps/Cargo.toml \
--no-default-features \
--features "std testing ABCI-plus-plus" && \
$(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 ABCI-plus-plus ibc-mocks" && \
$(cargo) +$(nightly) clippy --all-targets \
--manifest-path ./tests/Cargo.toml \
--no-default-features \
--features "wasm-runtime ABCI-plus-plus namada_apps/ABCI-plus-plus" && \
$(cargo) +$(nightly) clippy \
--all-targets \
--manifest-path ./vm_env/Cargo.toml \
--no-default-features \
--features "ABCI-plus-plus" && \
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

Expand All @@ -106,10 +68,6 @@ run-ledger:
# runs the node
$(cargo) run --bin namadan -- ledger run

run-ledger-abci-plus-plus:
# runs the node
$(cargo) run --bin namadan --no-default-features --features "ABCI-plus-plus" -- ledger run

run-gossip:
# runs the node gossip node
$(cargo) run --bin namadan -- gossip run
Expand All @@ -118,10 +76,6 @@ reset-ledger:
# runs the node
$(cargo) run --bin namadan -- ledger reset

reset-ledger-abci-plus-plus:
# runs the node
$(cargo) run --bin namadan --no-default-features --features "ABCI-plus-plus" -- ledger reset

audit:
$(cargo) audit $(foreach ignore,$(audit-ignores), --ignore $(ignore))

Expand All @@ -133,51 +87,8 @@ test-e2e:
--test-threads=1 \
-Z unstable-options --report-time

test-e2e-abci-plus-plus:
RUST_BACKTRACE=1 $(cargo) test e2e \
--manifest-path ./tests/Cargo.toml \
--no-default-features \
--features "wasm-runtime ABCI-plus-plus namada_apps/ABCI-plus-plus" \
-- \
--test-threads=1 \
-Z unstable-options --report-time

test-unit-abci-plus-plus:
$(cargo) test \
--manifest-path ./apps/Cargo.toml \
--no-default-features \
--features "testing std ABCI-plus-plus" \
-- \
-Z unstable-options --report-time && \
$(cargo) test \
--manifest-path \
./proof_of_stake/Cargo.toml \
--features "testing" \
-- \
-Z unstable-options --report-time && \
$(cargo) test \
--manifest-path ./shared/Cargo.toml \
--no-default-features \
--features "testing wasm-runtime ABCI-plus-plus ibc-mocks" \
-- \
-Z unstable-options --report-time && \
$(cargo) test \
--manifest-path ./tests/Cargo.toml \
--no-default-features \
--features "wasm-runtime ABCI-plus-plus namada_apps/ABCI-plus-plus" \
-- \
--skip e2e \
-Z unstable-options --report-time && \
$(cargo) test \
--manifest-path ./vm_env/Cargo.toml \
--no-default-features \
--features "ABCI-plus-plus" \
-- \
-Z unstable-options --report-time

test-unit:
$(cargo) test --no-default-features \
--features "wasm-runtime ABCI ibc-mocks-abci" \
$(cargo) test \
-- \
--skip e2e \
-Z unstable-options --report-time
Expand Down
39 changes: 8 additions & 31 deletions apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,14 @@ name = "namadaw"
path = "src/bin/anoma-wallet/main.rs"

[features]
default = ["std", "ABCI"]
default = ["std"]
dev = ["namada/dev"]
std = ["ed25519-consensus/std", "rand/std", "rand_core/std"]
# for integration tests and test utilies
ABCI = [
"tendermint-stable",
"tendermint-config-abci",
"tendermint-proto-abci",
"tendermint-rpc-abci",
"tower-abci-old",
"namada/ABCI",
"namada/ibc-vp-abci",
]
ABCI-plus-plus = [
"tendermint",
"tendermint-config",
"tendermint-proto",
"tendermint-rpc",
"tower-abci",
"namada/ABCI-plus-plus",
"namada/ibc-vp",
]
testing = ["dev"]

[dependencies]
namada = {path = "../shared", default-features = false, features = ["wasm-runtime", "ferveo-tpke", "rand"]}
namada = {path = "../shared", features = ["wasm-runtime", "ferveo-tpke", "rand"]}
ark-serialize = "0.3.0"
ark-std = "0.3.0"
async-std = {version = "1.9.0", features = ["unstable"]}
Expand Down Expand Up @@ -123,31 +105,26 @@ 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", optional = true}
tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true}
tendermint-config-abci = {package = "tendermint-config", git = "https://github.com/heliaxdev/tendermint-rs", branch = "yuji/rebase_v0.23.5", optional = true}
tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true}
tendermint-proto-abci = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", branch = "yuji/rebase_v0.23.5", optional = true}
tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true, features = ["http-client", "websocket-client"]}
tendermint-rpc-abci = {package = "tendermint-rpc", git = "https://github.com/heliaxdev/tendermint-rs", branch = "yuji/rebase_v0.23.5", optional = true, features = ["http-client", "websocket-client"]}
tendermint-stable = {package = "tendermint", git = "https://github.com/heliaxdev/tendermint-rs", branch = "yuji/rebase_v0.23.5", optional = true}
tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"}
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"]}
thiserror = "1.0.30"
tokio = {version = "1.8.2", features = ["full"]}
toml = "0.5.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", optional = true}
tower-abci-old = {package = "tower-abci", git = "https://github.com/heliaxdev/tower-abci", branch = "yuji/rebase_v0.23.5_tracing", optional = true}
tower-abci = {git = "https://github.com/heliaxdev/tower-abci", rev = "f6463388fc319b6e210503b43b3aecf6faf6b200"}
tracing = "0.1.30"
tracing-log = "0.1.2"
tracing-subscriber = {version = "0.3.7", features = ["env-filter"]}
websocket = "0.26.2"
winapi = "0.3.9"

[dev-dependencies]
namada = {path = "../shared", default-features = false, features = ["testing", "wasm-runtime"]}
namada = {path = "../shared", features = ["testing", "wasm-runtime"]}
cargo-watch = "7.5.0"
bit-set = "0.5.2"
# A fork with state machime testing
Expand Down
5 changes: 0 additions & 5 deletions apps/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ const PROTO_SRC: &str = "./proto";
const RUSTFMT_TOOLCHAIN_SRC: &str = "../rust-nightly-version";

fn main() {
#[cfg(all(feature = "ABCI", feature = "ABCI-plus-plus"))]
compile_error!(
"`ABCI` and `ABCI-plus-plus` may not be used at the same time"
);

// Discover the repository version, if it exists
println!("cargo:rerun-if-changed=../.git");
let describe_opts = DescribeOptions::new();
Expand Down
6 changes: 0 additions & 6 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,14 +1372,8 @@ pub mod args {
use namada::types::token;
use namada::types::transaction::GasLimit;
use serde::Deserialize;
#[cfg(not(feature = "ABCI"))]
use tendermint::Timeout;
#[cfg(not(feature = "ABCI"))]
use tendermint_config::net::Address as TendermintAddress;
#[cfg(feature = "ABCI")]
use tendermint_config_abci::net::Address as TendermintAddress;
#[cfg(feature = "ABCI")]
use tendermint_stable::Timeout;

use super::context::{WalletAddress, WalletKeypair, WalletPublicKey};
use super::utils::*;
Expand Down
3 changes: 0 additions & 3 deletions apps/src/lib/client/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use std::io::Write;
use borsh::BorshSerialize;
use namada::proto::Signed;
use namada::types::intent::{Exchange, FungibleTokenIntent};
#[cfg(not(feature = "ABCI"))]
use tendermint_config::net::Address as TendermintAddress;
#[cfg(feature = "ABCI")]
use tendermint_config_abci::net::Address as TendermintAddress;

use super::signing;
use crate::cli::{self, args, Context};
Expand Down
23 changes: 3 additions & 20 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,13 @@ use namada::types::key::*;
use namada::types::storage::{Epoch, PrefixValue};
use namada::types::token::{balance_key, Amount};
use namada::types::{address, storage, token};
#[cfg(not(feature = "ABCI"))]
use tendermint::abci::Code;
#[cfg(not(feature = "ABCI"))]
use tendermint_config::net::Address as TendermintAddress;
#[cfg(feature = "ABCI")]
use tendermint_config_abci::net::Address as TendermintAddress;
#[cfg(not(feature = "ABCI"))]
use tendermint_rpc::error::Error as TError;
#[cfg(not(feature = "ABCI"))]
use tendermint_rpc::query::Query;
#[cfg(not(feature = "ABCI"))]
use tendermint_rpc::{Client, HttpClient};
#[cfg(not(feature = "ABCI"))]
use tendermint_rpc::{Order, SubscriptionClient, WebSocketClient};
#[cfg(feature = "ABCI")]
use tendermint_rpc_abci::error::Error as TError;
#[cfg(feature = "ABCI")]
use tendermint_rpc_abci::query::Query;
#[cfg(feature = "ABCI")]
use tendermint_rpc_abci::{Client, HttpClient};
#[cfg(feature = "ABCI")]
use tendermint_rpc_abci::{Order, SubscriptionClient, WebSocketClient};
#[cfg(feature = "ABCI")]
use tendermint_stable::abci::Code;
use tendermint_rpc::{
Client, HttpClient, Order, SubscriptionClient, WebSocketClient,
};

use crate::cli::{self, args, Context};
use crate::client::tendermint_rpc_types::TxResponse;
Expand Down
15 changes: 2 additions & 13 deletions apps/src/lib/client/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use namada::types::address::{Address, ImplicitAddress};
use namada::types::key::*;
use namada::types::storage::Epoch;
use namada::types::transaction::{hash_tx, Fee, WrapperTx};
#[cfg(not(feature = "ABCI"))]
use tendermint_config::net::Address as TendermintAddress;
#[cfg(feature = "ABCI")]
use tendermint_config_abci::net::Address as TendermintAddress;

use super::rpc;
use crate::cli::context::WalletAddress;
Expand Down Expand Up @@ -139,18 +136,10 @@ pub async fn sign_wrapper(
};

// We use this to determine when the wrapper tx makes it on-chain
let wrapper_hash = if !cfg!(feature = "ABCI") {
hash_tx(&tx.try_to_vec().unwrap()).to_string()
} else {
tx.tx_hash.to_string()
};
let wrapper_hash = hash_tx(&tx.try_to_vec().unwrap()).to_string();
// We use this to determine when the decrypted inner tx makes it
// on-chain
let decrypted_hash = if !cfg!(feature = "ABCI") {
Some(tx.tx_hash.to_string())
} else {
None
};
let decrypted_hash = tx.tx_hash.to_string();
TxBroadcastData::Wrapper {
tx: tx
.sign(keypair)
Expand Down
10 changes: 1 addition & 9 deletions apps/src/lib/client/tendermint_rpc_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use serde::Serialize;
use thiserror::Error;

use crate::cli::safe_exit;
#[cfg(not(feature = "ABCI"))]
use crate::node::ledger::events::Attributes;

/// Errors from interacting with Tendermint's jsonrpc endpoint
Expand All @@ -15,7 +14,6 @@ pub enum Error {
Address(String),
#[error("Error in sending JSON RPC request to Tendermint")]
Send,
#[cfg(not(feature = "ABCI"))]
#[error("Received an error response from Tendermint: {0:?}")]
Rpc(tendermint_rpc::response_error::ResponseError),
#[error("Received malformed JSON response from Tendermint")]
Expand All @@ -40,7 +38,7 @@ pub enum TxBroadcastData {
Wrapper {
tx: Tx,
wrapper_hash: String,
decrypted_hash: Option<String>,
decrypted_hash: String,
},
}

Expand All @@ -63,9 +61,6 @@ impl TxResponse {
let tx_hash_json = serde_json::Value::String(tx_hash.to_string());
let mut selector = jsonpath::selector(&json);
let mut index = 0;
#[cfg(feature = "ABCI")]
let evt_key = "applied";
#[cfg(not(feature = "ABCI"))]
let evt_key = "accepted";
// Find the tx with a matching hash
let hash = loop {
Expand Down Expand Up @@ -134,7 +129,6 @@ impl TxResponse {
}
}

#[cfg(not(feature = "ABCI"))]
mod params {
use std::convert::TryFrom;
use std::time::Duration;
Expand Down Expand Up @@ -259,7 +253,6 @@ mod params {
/// 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.
#[cfg(not(feature = "ABCI"))]
pub fn parse(reply: EventReply, tx_hash: &str) -> Option<TxResponse> {
let mut event = reply
.items
Expand Down Expand Up @@ -339,5 +332,4 @@ mod params {
}
}

#[cfg(not(feature = "ABCI"))]
pub use params::*;
Loading

0 comments on commit 95f6f49

Please sign in to comment.