Skip to content

Commit

Permalink
Merge branch 'mariari/fixed-amounts-history' into mariari/inflation-r…
Browse files Browse the repository at this point in the history
…ewards
  • Loading branch information
mariari committed Jul 3, 2023
2 parents 5fc78f6 + 714d81c commit d92eb8f
Show file tree
Hide file tree
Showing 114 changed files with 7,519 additions and 2,455 deletions.
207 changes: 100 additions & 107 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ libc = "0.2.97"
libloading = "0.7.2"
libsecp256k1 = {git = "https://github.com/heliaxdev/libsecp256k1", rev = "bbb3bd44a49db361f21d9db80f9a087c194c0ae9", default-features = false, features = ["std", "static-context"]}
# branch = "murisi/namada-integration"
masp_primitives = { git = "https://github.com/anoma/masp", rev = "cfea8c95d3f73077ca3e25380fd27e5b46e828fd" }
masp_proofs = { git = "https://github.com/anoma/masp", rev = "cfea8c95d3f73077ca3e25380fd27e5b46e828fd", default-features = false, features = ["local-prover"] }
masp_primitives = { git = "https://github.com/anoma/masp", rev = "9320c6b69b5d2e97134866871e960f0a31703813" }
masp_proofs = { git = "https://github.com/anoma/masp", rev = "9320c6b69b5d2e97134866871e960f0a31703813", default-features = false, features = ["local-prover"] }
num_cpus = "1.13.0"
num-derive = "0.3.3"
num-rational = "0.4.1"
Expand Down
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ wasms_for_tests := wasm_for_tests/wasm_source
# Paths for all the wasm templates
wasm_templates := wasm/tx_template wasm/vp_template

ifdef JOBS
jobs := -j $(JOBS)
else
jobs :=
endif

# TODO upgrade libp2p
audit-ignores += RUSTSEC-2021-0076

Expand All @@ -35,13 +41,13 @@ crates += namada_vm_env
crates += namada_vp_prelude

build:
$(cargo) build
$(cargo) build $(jobs)

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

build-release:
NAMADA_DEV=false $(cargo) build --release --package namada_apps --manifest-path Cargo.toml
NAMADA_DEV=false $(cargo) build $(jobs) --release --package namada_apps --manifest-path Cargo.toml

install-release:
NAMADA_DEV=false $(cargo) install --path ./apps --locked
Expand Down Expand Up @@ -69,7 +75,7 @@ check-crates:
clippy-wasm = $(cargo) +$(nightly) clippy --manifest-path $(wasm)/Cargo.toml --all-targets -- -D warnings

clippy:
NAMADA_DEV=false $(cargo) +$(nightly) clippy --all-targets -- -D warnings && \
NAMADA_DEV=false $(cargo) +$(nightly) clippy $(jobs) --all-targets -- -D warnings && \
make -C $(wasms) clippy && \
make -C $(wasms_for_tests) clippy && \
$(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true
Expand Down Expand Up @@ -129,18 +135,21 @@ test-e2e:
test-unit:
$(cargo) +$(nightly) test \
$(TEST_FILTER) \
$(jobs) \
-- --skip e2e \
-Z unstable-options --report-time

test-unit-mainnet:
$(cargo) +$(nightly) test \
--features "mainnet" \
$(TEST_FILTER) \
$(jobs) \
-- --skip e2e \
-Z unstable-options --report-time

test-unit-debug:
$(debug-cargo) +$(nightly) test \
$(jobs) \
$(TEST_FILTER) -- \
-- --skip e2e \
--nocapture \
Expand Down
2 changes: 0 additions & 2 deletions apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ ripemd.workspace = true
rlimit.workspace = true
rocksdb.workspace = true
rpassword.workspace = true
rust_decimal_macros.workspace = true
rust_decimal.workspace = true
serde_bytes.workspace = true
serde_json = {workspace = true, features = ["raw_value"]}
serde.workspace = true
Expand Down
64 changes: 50 additions & 14 deletions apps/src/lib/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1766,12 +1766,13 @@ pub mod args {
pub use namada::ledger::args::*;
use namada::types::address::Address;
use namada::types::chain::{ChainId, ChainIdPrefix};
use namada::types::dec::Dec;
use namada::types::key::*;
use namada::types::masp::MaspValue;
use namada::types::storage::{self, BlockHeight, Epoch};
use namada::types::time::DateTimeUtc;
use namada::types::token;
use rust_decimal::Decimal;
use namada::types::token::NATIVE_MAX_DECIMAL_PLACES;

use super::context::*;
use super::utils::*;
Expand Down Expand Up @@ -1801,7 +1802,7 @@ pub mod args {
pub const ALIAS: Arg<String> = arg("alias");
pub const ALIAS_FORCE: ArgFlag = flag("alias-force");
pub const ALLOW_DUPLICATE_IP: ArgFlag = flag("allow-duplicate-ip");
pub const AMOUNT: Arg<token::Amount> = arg("amount");
pub const AMOUNT: Arg<token::DenominatedAmount> = arg("amount");
pub const ARCHIVE_DIR: ArgOpt<PathBuf> = arg_opt("archive-dir");
pub const BALANCE_OWNER: ArgOpt<WalletBalanceOwner> = arg_opt("owner");
pub const BASE_DIR: ArgDefault<PathBuf> = arg_default(
Expand All @@ -1820,7 +1821,7 @@ pub mod args {
pub const CHANNEL_ID: Arg<ChannelId> = arg("channel-id");
pub const CODE_PATH: Arg<PathBuf> = arg("code-path");
pub const CODE_PATH_OPT: ArgOpt<PathBuf> = CODE_PATH.opt();
pub const COMMISSION_RATE: Arg<Decimal> = arg("commission-rate");
pub const COMMISSION_RATE: Arg<Dec> = arg("commission-rate");
pub const CONSENSUS_TIMEOUT_COMMIT: ArgDefault<Timeout> = arg_default(
"consensus-timeout-commit",
DefaultFn(|| Timeout::from_str("1s").unwrap()),
Expand All @@ -1835,10 +1836,20 @@ pub mod args {
pub const EXPIRATION_OPT: ArgOpt<DateTimeUtc> = arg_opt("expiration");
pub const FORCE: ArgFlag = flag("force");
pub const DONT_PREFETCH_WASM: ArgFlag = flag("dont-prefetch-wasm");
pub const GAS_AMOUNT: ArgDefault<token::Amount> =
arg_default("gas-amount", DefaultFn(|| token::Amount::from(0)));
pub const GAS_LIMIT: ArgDefault<token::Amount> =
arg_default("gas-limit", DefaultFn(|| token::Amount::from(0)));
pub const GAS_AMOUNT: ArgDefault<token::DenominatedAmount> = arg_default(
"gas-amount",
DefaultFn(|| token::DenominatedAmount {
amount: token::Amount::default(),
denom: NATIVE_MAX_DECIMAL_PLACES.into(),
}),
);
pub const GAS_LIMIT: ArgDefault<token::DenominatedAmount> = arg_default(
"gas-limit",
DefaultFn(|| token::DenominatedAmount {
amount: token::Amount::default(),
denom: NATIVE_MAX_DECIMAL_PLACES.into(),
}),
);
pub const GAS_TOKEN: ArgDefaultFromCtx<WalletAddress> =
arg_default_from_ctx("gas-token", DefaultFn(|| "NAM".parse().unwrap()));
pub const GENESIS_PATH: Arg<PathBuf> = arg("genesis-path");
Expand All @@ -1861,7 +1872,7 @@ pub mod args {
pub const LEDGER_ADDRESS: Arg<TendermintAddress> = arg("node");
pub const LOCALHOST: ArgFlag = flag("localhost");
pub const MASP_VALUE: Arg<MaspValue> = arg("value");
pub const MAX_COMMISSION_RATE_CHANGE: Arg<Decimal> =
pub const MAX_COMMISSION_RATE_CHANGE: Arg<Dec> =
arg("max-commission-rate-change");
pub const NET_ADDRESS: Arg<SocketAddr> = arg("net-address");
pub const NAMADA_START_TIME: ArgOpt<DateTimeUtc> = arg_opt("time");
Expand Down Expand Up @@ -2162,7 +2173,7 @@ pub mod args {
let target = TRANSFER_TARGET.parse(matches);
let token = TOKEN.parse(matches);
let sub_prefix = SUB_PREFIX.parse(matches);
let amount = AMOUNT.parse(matches);
let amount = InputAmount::Unvalidated(AMOUNT.parse(matches));
let tx_code_path = PathBuf::from(TX_TRANSFER_WASM);
Self {
tx,
Expand Down Expand Up @@ -2229,7 +2240,7 @@ pub mod args {
receiver,
token,
sub_prefix,
amount,
amount: amount.amount,
port_id,
channel_id,
timeout_height,
Expand Down Expand Up @@ -2460,6 +2471,14 @@ pub mod args {
let tx = Tx::parse(matches);
let validator = VALIDATOR.parse(matches);
let amount = AMOUNT.parse(matches);
let amount = amount
.canonical()
.increase_precision(NATIVE_MAX_DECIMAL_PLACES.into())
.unwrap_or_else(|e| {
println!("Could not parse bond amount: {:?}", e);
safe_exit(1);
})
.amount;
let source = SOURCE_OPT.parse(matches);
let tx_code_path = PathBuf::from(TX_BOND_WASM);
Self {
Expand Down Expand Up @@ -2500,6 +2519,14 @@ pub mod args {
let tx = Tx::parse(matches);
let validator = VALIDATOR.parse(matches);
let amount = AMOUNT.parse(matches);
let amount = amount
.canonical()
.increase_precision(NATIVE_MAX_DECIMAL_PLACES.into())
.unwrap_or_else(|e| {
println!("Could not parse bond amount: {:?}", e);
safe_exit(1);
})
.amount;
let source = SOURCE_OPT.parse(matches);
let tx_code_path = PathBuf::from(TX_UNBOND_WASM);
Self {
Expand Down Expand Up @@ -2960,6 +2987,7 @@ pub mod args {
query: self.query.to_sdk(ctx),
owner: self.owner.map(|x| ctx.get_cached(&x)),
token: self.token.map(|x| ctx.get(&x)),
sub_prefix: self.sub_prefix,
}
}
}
Expand All @@ -2969,10 +2997,12 @@ pub mod args {
let query = Query::parse(matches);
let owner = BALANCE_OWNER.parse(matches);
let token = TOKEN_OPT.parse(matches);
let sub_prefix = SUB_PREFIX.parse(matches);
Self {
query,
owner,
token,
sub_prefix,
}
}

Expand All @@ -2984,6 +3014,11 @@ pub mod args {
.arg(TOKEN_OPT.def().about(
"The token address that queried transfers must involve.",
))
.arg(
SUB_PREFIX.def().about(
"The token's sub prefix whose balance to query.",
),
)
}
}

Expand Down Expand Up @@ -3381,9 +3416,10 @@ pub mod args {
let ledger_address = LEDGER_ADDRESS_DEFAULT.parse(matches);
let initialized_account_alias = ALIAS_OPT.parse(matches);
let wallet_alias_force = WALLET_ALIAS_FORCE.parse(matches);
let fee_amount = GAS_AMOUNT.parse(matches);
let fee_amount =
InputAmount::Unvalidated(GAS_AMOUNT.parse(matches));
let fee_token = GAS_TOKEN.parse(matches);
let gas_limit = GAS_LIMIT.parse(matches).into();
let gas_limit = GAS_LIMIT.parse(matches).amount.into();
let expiration = EXPIRATION_OPT.parse(matches);
let signing_key = SIGNING_KEY_OPT.parse(matches);
let signer = SIGNER.parse(matches);
Expand Down Expand Up @@ -3964,8 +4000,8 @@ pub mod args {
#[derive(Clone, Debug)]
pub struct InitGenesisValidator {
pub alias: String,
pub commission_rate: Decimal,
pub max_commission_rate_change: Decimal,
pub commission_rate: Dec,
pub max_commission_rate_change: Dec,
pub net_address: SocketAddr,
pub unsafe_dont_encrypt: bool,
pub key_scheme: SchemeType,
Expand Down
Loading

0 comments on commit d92eb8f

Please sign in to comment.