Skip to content

Commit

Permalink
fixup! all compile errors out and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mariari committed Sep 22, 2023
1 parent c176701 commit 762cca8
Show file tree
Hide file tree
Showing 41 changed files with 63 additions and 79 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::collections::{BTreeMap, HashMap};

use borsh::{BorshDeserialize, BorshSerialize};
use borsh_ext::BorshSerializeExt;
use derivative::Derivative;
use namada::core::ledger::governance::parameters::GovernanceParameters;
use namada::core::ledger::pgf::parameters::PgfParameters;
Expand Down Expand Up @@ -750,7 +749,7 @@ pub mod genesis_config {
}

#[derive(Debug, BorshSerialize, BorshDeserialize)]
#[borsh_init(init)]
#[borsh(init=init)]
pub struct Genesis {
pub genesis_time: DateTimeUtc,
pub native_token: Address,
Expand Down Expand Up @@ -1167,7 +1166,7 @@ pub fn genesis(num_validators: u64) -> Genesis {

#[cfg(test)]
pub mod tests {
use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada::types::address::testing::gen_established_address;
use namada::types::key::*;
use rand::prelude::ThreadRng;
Expand Down
1 change: 1 addition & 0 deletions apps/src/lib/node/ledger/shell/init_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::collections::HashMap;
use std::hash::Hash;

use borsh_ext::BorshSerializeExt;
#[cfg(not(feature = "mainnet"))]
use namada::core::ledger::testnet_pow;
use namada::ledger::eth_bridge::EthBridgeStatus;
Expand Down
3 changes: 2 additions & 1 deletion apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ use std::path::{Path, PathBuf};
#[allow(unused_imports)]
use std::rc::Rc;

use borsh::{BorshDeserialize, BorshSerialize};
use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use masp_primitives::transaction::Transaction;
use namada::core::ledger::eth_bridge;
use namada::ledger::eth_bridge::{EthBridgeQueries, EthereumOracleConfig};
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/shell/prepare_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ mod test_prepare_proposal {
#[cfg(feature = "abcipp")]
use std::collections::{BTreeSet, HashMap};

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada::core::ledger::storage_api::collections::lazy_map::{
NestedSubKey, SubKey,
};
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/shell/queries.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Shell methods for querying state

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use ferveo_common::TendermintValidator;
use namada::ledger::pos::into_tm_voting_power;
use namada::ledger::queries::{RequestCtx, ResponseQuery};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ where
mod test_bp_vote_extensions {
#[cfg(feature = "abcipp")]
use borsh::BorshDeserialize;
use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
#[cfg(not(feature = "abcipp"))]
use namada::core::ledger::eth_bridge::storage::bridge_pool::get_key_from_hash;
#[cfg(not(feature = "abcipp"))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ mod test_vote_extensions {

#[cfg(feature = "abcipp")]
use borsh::BorshDeserialize;
use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada::core::ledger::storage_api::collections::lazy_map::{
NestedSubKey, SubKey,
};
Expand Down
3 changes: 2 additions & 1 deletion apps/src/lib/node/ledger/storage/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ use std::str::FromStr;
use std::sync::Mutex;

use ark_serialize::Write;
use borsh::{BorshDeserialize, BorshSerialize};
use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use data_encoding::HEXLOWER;
use namada::core::types::ethereum_structs;
use namada::ledger::storage::types::PrefixIterator;
Expand Down
3 changes: 1 addition & 2 deletions apps/src/lib/node/ledger/tendermint_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use std::process::Stdio;
use std::str::FromStr;

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada::types::chain::ChainId;
use namada::types::key::*;
use namada::types::storage::BlockHeight;
Expand All @@ -24,7 +24,6 @@ use crate::facade::tendermint::{block, Genesis};
use crate::facade::tendermint_config::{
Error as TendermintError, TendermintConfig,
};

/// Env. var to output Tendermint log to stdout
pub const ENV_VAR_TM_STDOUT: &str = "NAMADA_CMT_STDOUT";

Expand Down
1 change: 1 addition & 0 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ path = "host_env.rs"
[dependencies]
async-trait.workspace = true
borsh.workspace = true
borsh-ext.workspace = true
ferveo-common.workspace = true
masp_primitives.workspace = true
masp_proofs.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion benches/host_env.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use criterion::{criterion_group, criterion_main, Criterion};
use namada::core::types::account::AccountPublicKeysMap;
use namada::core::types::address;
Expand Down
3 changes: 2 additions & 1 deletion benches/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::ops::{Deref, DerefMut};
use std::path::PathBuf;

use borsh::{BorshDeserialize, BorshSerialize};
use borsh_ext::BorshSerializeExt;
use masp_primitives::transaction::Transaction;
use masp_primitives::zip32::ExtendedFullViewingKey;
use masp_proofs::prover::LocalTxProver;
Expand Down Expand Up @@ -545,7 +546,7 @@ impl Clone for WrapperTempDir {

#[derive(BorshSerialize, BorshDeserialize, Debug, Clone, Default)]
pub struct BenchShieldedUtils {
#[borsh_skip]
#[borsh(skip)]
context_dir: WrapperTempDir,
}

Expand Down
22 changes: 11 additions & 11 deletions encoding_spec/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]

use std::collections::{BTreeMap, HashMap, HashSet};
use std::collections::{BTreeMap, HashSet};
use std::io::Write;
use std::iter::Extend;

use borsh::{schema, BorshSchema, schema_container_of};
use borsh::schema::{BorshSchemaContainer, Declaration, Definition};
use borsh::{schema, schema_container_of};
use itertools::Itertools;
use lazy_static::lazy_static;
use madato::types::TableRow;
use namada::eth_bridge::ethers::core::k256::elliptic_curve::weierstrass::add;
use namada::eth_bridge::ethers::utils::rlp::decode_list;
use namada::ledger::parameters::Parameters;
use namada::types::address::Address;
use namada::types::key::ed25519::{PublicKey, Signature};
Expand Down Expand Up @@ -61,11 +59,9 @@ lazy_static! {
}

fn btree(b: &BorshSchemaContainer) -> BTreeMap<Declaration, Definition> {
let mut btree = BTreeMap::new();
for (dec, def) in b.definitions() {
btree.insert(dec.clone(), def.clone());
}
btree
b.definitions()
.map(|(x, y)| (x.clone(), y.clone()))
.collect()
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -105,7 +101,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

// Merge type definitions

let mut definitions= btree(&address_schema);
let mut definitions = btree(&address_schema);

// TODO check for conflicts (same name, different declaration)
definitions.extend(btree(&token_amount_schema));
Expand Down Expand Up @@ -360,7 +356,11 @@ fn definition_to_table(name: &Declaration, def: schema::Definition) -> Table {
}
}
};
Table { name: name.to_string(), desc, rows }
Table {
name: name.to_string(),
desc,
rows,
}
}

/// Format a type to markdown. For internal types, adds anchors.
Expand Down
2 changes: 1 addition & 1 deletion ethereum_bridge/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use std::num::NonZeroU64;

use borsh::{BorshDeserialize, BorshSerialize};
use borsh_ext::BorshSerializeExt;
use eyre::{eyre, Result};
use namada_core::ledger::eth_bridge::storage::whitelist;
use namada_core::ledger::storage;
Expand Down Expand Up @@ -379,6 +378,7 @@ where

#[cfg(test)]
mod tests {
use borsh_ext::BorshSerializeExt;
use eyre::Result;
use namada_core::ledger::storage::testing::TestWlStorage;
use namada_core::types::ethereum_events::EthAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::collections::{HashMap, HashSet};

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use eyre::Result;
use namada_core::ledger::eth_bridge::storage::bridge_pool::get_signed_root_key;
Expand Down Expand Up @@ -186,7 +185,7 @@ where
mod test_apply_bp_roots_to_storage {
use std::collections::BTreeSet;

use borsh::{BorshDeserialize, BorshSerialize};
use borsh::BorshDeserialize;
use namada_core::ledger::eth_bridge::storage::bridge_pool::{
get_key_from_hash, get_nonce_key,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::collections::{BTreeSet, HashSet};
use std::str::FromStr;

use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use eyre::{Result, WrapErr};
use namada_core::hints;
use namada_core::ledger::eth_bridge::storage::bridge_pool::{
Expand Down Expand Up @@ -613,7 +612,7 @@ mod tests {
use std::collections::HashMap;

use assert_matches::assert_matches;
use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use eyre::Result;
use namada_core::ledger::eth_bridge::storage::bridge_pool::get_pending_key;
use namada_core::ledger::parameters::{
Expand Down
2 changes: 0 additions & 2 deletions ethereum_bridge/src/protocol/transactions/read.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Helpers for reading from storage
use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use eyre::{eyre, Result};
use namada_core::ledger::storage::traits::StorageHasher;
use namada_core::ledger::storage::{DBIter, WlStorage, DB};
Expand Down Expand Up @@ -56,7 +55,6 @@ where
#[cfg(test)]
mod tests {
use assert_matches::assert_matches;
use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada_core::ledger::storage::testing::TestWlStorage;
use namada_core::ledger::storage_api::StorageWrite;
Expand Down
1 change: 0 additions & 1 deletion ethereum_bridge/src/protocol/transactions/update.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Helpers for writing to storage
use borsh::{BorshDeserialize, BorshSerialize};
use borsh_ext::BorshSerializeExt;
use eyre::Result;
use namada_core::ledger::storage::{DBIter, StorageHasher, WlStorage, DB};
use namada_core::ledger::storage_api::StorageWrite;
Expand Down
1 change: 0 additions & 1 deletion ethereum_bridge/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::collections::HashMap;
use std::num::NonZeroU64;

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada_core::ledger::eth_bridge::storage::bridge_pool::get_key_from_hash;
use namada_core::ledger::eth_bridge::storage::whitelist;
Expand Down
1 change: 0 additions & 1 deletion ethereum_bridge/src/vp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use borsh_ext::BorshSerializeExt;
use namada_core::ledger::storage::{self as ledger_storage, StorageHasher};
use namada_core::ledger::storage_api::StorageWrite;
Expand Down
1 change: 0 additions & 1 deletion shared/src/ledger/eth_bridge/bridge_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::collections::HashMap;
use std::io::Write;
use std::sync::Arc;

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use ethbridge_bridge_contract::Bridge;
use ethers::providers::Middleware;
Expand Down
1 change: 0 additions & 1 deletion shared/src/ledger/ibc/vp/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::collections::{BTreeSet, HashMap, HashSet};

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada_core::ledger::ibc::storage::is_ibc_key;
use namada_core::ledger::ibc::{IbcCommonContext, IbcStorageContext};
Expand Down
3 changes: 1 addition & 2 deletions shared/src/ledger/ibc/vp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::collections::{BTreeSet, HashSet};
use std::rc::Rc;
use std::time::Duration;

use borsh_ext::BorshSerializeExt;
use context::{PseudoExecutionContext, VpValidationContext};
use namada_core::ledger::ibc::{
Error as ActionError, IbcActions, TransferModule, ValidationParams,
Expand Down Expand Up @@ -292,7 +291,7 @@ mod tests {
use std::convert::TryFrom;
use std::str::FromStr;

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use namada_core::ledger::gas::TxGasMeter;
use prost::Message;
use sha2::Digest;
Expand Down
4 changes: 2 additions & 2 deletions shared/src/ledger/native_vp/ethereum_bridge/bridge_pool_vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::collections::BTreeSet;
use std::marker::PhantomData;

use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use eyre::eyre;
use namada_core::hints;
use namada_core::ledger::eth_bridge::storage::bridge_pool::{
Expand Down Expand Up @@ -589,7 +588,8 @@ where
mod test_bridge_pool_vp {
use std::env::temp_dir;

use borsh::BorshSerialize;
use borsh::BorshDeserialize;
use borsh_ext::BorshSerializeExt;
use namada_core::ledger::eth_bridge::storage::bridge_pool::get_signed_root_key;
use namada_core::ledger::gas::TxGasMeter;
use namada_core::types::address;
Expand Down
2 changes: 1 addition & 1 deletion shared/src/ledger/native_vp/ethereum_bridge/nut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ mod test_nuts {
use std::env::temp_dir;

use assert_matches::assert_matches;
use borsh_ext::BorshSerializeExt;
use namada_core::ledger::storage::testing::TestWlStorage;
use namada_core::ledger::storage_api::StorageWrite;
use namada_core::types::address::testing::arb_non_internal_address;
Expand All @@ -135,7 +136,6 @@ mod test_nuts {
use crate::ledger::gas::{TxGasMeter, VpGasMeter};
use crate::vm::wasm::VpCache;
use crate::vm::WasmCacheRwAccess;
use borsh_ext::BorshSerializeExt;

/// Run a VP check on a NUT transfer between the two provided addresses.
fn check_nut_transfer(src: Address, dst: Address) -> Option<bool> {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/ledger/native_vp/ethereum_bridge/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ mod tests {
use std::default::Default;
use std::env::temp_dir;

use borsh_ext::BorshSerializeExt;
use namada_core::ledger::eth_bridge;
use namada_core::ledger::eth_bridge::storage::bridge_pool::BRIDGE_POOL_ADDRESS;
use namada_core::ledger::eth_bridge::storage::wrapped_erc20s;
Expand All @@ -190,7 +191,6 @@ mod tests {
use crate::types::transaction::TxType;
use crate::vm::wasm::VpCache;
use crate::vm::WasmCacheRwAccess;
use borsh_ext::BorshSerializeExt;

const ARBITRARY_OWNER_A_ADDRESS: &str =
"atest1d9khqw36x9zyxwfhgfpygv2pgc65gse4gy6rjs34gfzr2v69gy6y23zpggurjv2yx5m52sesu6r4y4";
Expand Down
2 changes: 1 addition & 1 deletion shared/src/ledger/native_vp/multitoken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ where
mod tests {
use std::collections::BTreeSet;

use borsh_ext::BorshSerializeExt;
use namada_core::ledger::gas::TxGasMeter;

use super::*;
Expand All @@ -158,7 +159,6 @@ mod tests {
};
use crate::types::transaction::TxType;
use crate::vm::wasm::compilation_cache::common::testing::cache as wasm_cache;
use borsh_ext::BorshSerializeExt;

const ADDRESS: Address = Address::Internal(InternalAddress::Multitoken);

Expand Down
1 change: 0 additions & 1 deletion shared/src/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use std::collections::BTreeSet;
use std::panic;

use borsh::BorshSerialize;
use borsh_ext::BorshSerializeExt;
use eyre::{eyre, WrapErr};
use masp_primitives::transaction::Transaction;
Expand Down
Loading

0 comments on commit 762cca8

Please sign in to comment.