Skip to content

Commit

Permalink
Merge branch 'james/mainline/fix-abcipp' (#754)
Browse files Browse the repository at this point in the history
- Additionally updated imports in
  - `shared/src/ledger/queries/shell.rs`
  - `apps/src/lib/client/types.rs`

* james/mainline/fix-abcipp:
  Add changelog
  Add check-abcipp command
  Use ferveo-tpke flag to stop tendermint-rpc being pulled into wasm
  First attempt at fixing shared abcipp
  • Loading branch information
tzemanovic committed Nov 17, 2022
2 parents 9a7bed2 + 2604a91 commit 860bb1e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/754-fix-abcipp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix building with the feature again
([#754](https://github.com/anoma/namada/pull/754))
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ check:
make -C $(wasms_for_tests) check && \
$(foreach wasm,$(wasm_templates),$(check-wasm) && ) true

check-abcipp:
$(cargo) check --all-targets --no-default-features --features "abcipp namada/ibc-mocks-abcipp"

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

clippy:
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub async fn query_epoch(args: args::Query) -> Epoch {
/// Query the last committed block
pub async fn query_block(
args: args::Query,
) -> tendermint_rpc::endpoint::block::Response {
) -> crate::facade::tendermint_rpc::endpoint::block::Response {
let client = HttpClient::new(args.ledger_address).unwrap();
let response = client.latest_block().await.unwrap();
println!(
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/client/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use namada::types::masp::{TransferSource, TransferTarget};
use namada::types::storage::Epoch;
use namada::types::transaction::GasLimit;
use namada::types::{key, token};
use tendermint_config::net::Address as TendermintAddress;

use super::rpc;
use crate::cli::{args, Context};
use crate::client::tx::Conversions;
use crate::facade::tendermint_config::net::Address as TendermintAddress;

#[derive(Clone, Debug)]
pub struct ParsedTxArgs {
Expand Down
8 changes: 7 additions & 1 deletion shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ tendermint-rpc = [
"async-client",
"dep:tendermint-rpc",
]
tendermint-rpc-abcipp = [
"async-client",
"dep:tendermint-rpc-abcipp",
]

abcipp = [
"ibc-proto-abcipp",
"ibc-abcipp",
"tendermint-abcipp",
"tendermint-proto-abcipp"
"tendermint-proto-abcipp",
# it's OK to include the tendermint-rpc feature here, as we aren't currently building wasms with `abcipp`
"tendermint-rpc-abcipp",
]

abciplus = [
Expand Down
12 changes: 6 additions & 6 deletions shared/src/ledger/queries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub mod tm {
#[derive(Error, Debug)]
pub enum Error {
#[error("{0}")]
Tendermint(#[from] tendermint_rpc::Error),
Tendermint(#[from] crate::tendermint_rpc::Error),
#[error("Decoding error: {0}")]
Decoding(#[from] std::io::Error),
#[error("Info log: {0}, error code: {1}")]
Expand All @@ -104,7 +104,7 @@ pub mod tm {
}

#[async_trait::async_trait]
impl Client for tendermint_rpc::HttpClient {
impl Client for crate::tendermint_rpc::HttpClient {
type Error = Error;

async fn request(
Expand All @@ -117,11 +117,11 @@ pub mod tm {
let data = data.unwrap_or_default();
let height = height
.map(|height| {
tendermint::block::Height::try_from(height.0)
crate::tendermint::block::Height::try_from(height.0)
.map_err(|_err| Error::InvalidHeight(height))
})
.transpose()?;
let response = tendermint_rpc::Client::abci_query(
let response = crate::tendermint_rpc::Client::abci_query(
self,
// TODO open the private Path constructor in tendermint-rpc
Some(std::str::FromStr::from_str(&path).unwrap()),
Expand All @@ -131,12 +131,12 @@ pub mod tm {
)
.await?;
match response.code {
tendermint::abci::Code::Ok => Ok(EncodedResponseQuery {
crate::tendermint::abci::Code::Ok => Ok(EncodedResponseQuery {
data: response.value,
info: response.info,
proof: response.proof,
}),
tendermint::abci::Code::Err(code) => {
crate::tendermint::abci::Code::Err(code) => {
Err(Error::Query(response.info, code))
}
}
Expand Down
2 changes: 1 addition & 1 deletion shared/src/ledger/queries/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use borsh::{BorshDeserialize, BorshSerialize};
use masp_primitives::asset_type::AssetType;
use masp_primitives::merkle_tree::MerklePath;
use masp_primitives::sapling::Node;
use tendermint::merkle::proof::Proof;

use crate::ledger::queries::types::{RequestCtx, RequestQuery};
use crate::ledger::queries::{require_latest_height, EncodedResponseQuery};
use crate::ledger::storage::{DBIter, StorageHasher, DB};
use crate::ledger::storage_api::{self, ResultExt, StorageRead};
use crate::tendermint::merkle::proof::Proof;
use crate::types::address::Address;
#[cfg(all(feature = "wasm-runtime", feature = "ferveo-tpke"))]
use crate::types::storage::TxIndex;
Expand Down
7 changes: 3 additions & 4 deletions shared/src/ledger/queries/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use tendermint::merkle::proof::Proof;

use crate::ledger::storage::{DBIter, Storage, StorageHasher, DB};
use crate::ledger::storage_api;
use crate::tendermint::merkle::proof::Proof;
use crate::types::storage::BlockHeight;
#[cfg(feature = "wasm-runtime")]
use crate::vm::wasm::{TxCache, VpCache};
Expand Down Expand Up @@ -145,12 +144,12 @@ impl RequestQuery {
/// spec. A negative block height will cause an error.
pub fn try_from_tm<D, H>(
storage: &Storage<D, H>,
tendermint_proto::abci::RequestQuery {
crate::tendermint_proto::abci::RequestQuery {
data,
path,
height,
prove,
}: tendermint_proto::abci::RequestQuery,
}: crate::tendermint_proto::abci::RequestQuery,
) -> Result<Self, String>
where
D: DB + for<'iter> DBIter<'iter>,
Expand Down
4 changes: 4 additions & 0 deletions shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]

#[cfg(all(not(feature = "abcipp"), feature = "ferveo-tpke"))]
pub use tendermint_rpc;
#[cfg(all(feature = "abcipp", feature = "ferveo-tpke"))]
pub use tendermint_rpc_abcipp as tendermint_rpc;
#[cfg(not(feature = "abcipp"))]
pub use {ibc, ibc_proto, tendermint, tendermint_proto};
#[cfg(feature = "abcipp")]
Expand Down
21 changes: 5 additions & 16 deletions shared/src/proto/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,14 @@ use std::hash::{Hash, Hasher};
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use prost::Message;
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "ABCI"))]
#[cfg(feature = "ferveo-tpke")]
use tendermint_proto::abci::Event;
#[cfg(not(feature = "ABCI"))]
#[cfg(feature = "ferveo-tpke")]
use tendermint_proto::abci::EventAttribute;
#[cfg(not(feature = "ABCI"))]
use tendermint_proto::abci::ResponseDeliverTx;
#[cfg(feature = "ABCI")]
#[cfg(feature = "ferveo-tpke")]
use tendermint_proto_abci::abci::Event;
#[cfg(feature = "ABCI")]
#[cfg(feature = "ferveo-tpke")]
use tendermint_proto_abci::abci::EventAttribute;
#[cfg(feature = "ABCI")]
use tendermint_proto_abci::abci::ResponseDeliverTx;
use thiserror::Error;

use super::generated::types;
#[cfg(feature = "ferveo-tpke")]
use crate::tendermint_proto::abci::Event;
#[cfg(feature = "ferveo-tpke")]
use crate::tendermint_proto::abci::EventAttribute;
use crate::tendermint_proto::abci::ResponseDeliverTx;
use crate::types::key::*;
use crate::types::time::DateTimeUtc;
#[cfg(feature = "ferveo-tpke")]
Expand Down

0 comments on commit 860bb1e

Please sign in to comment.