From 3b530c5ec5e0b27a4cf856c8e82d8692a60f7dc4 Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli <> Date: Tue, 18 Oct 2022 11:26:49 +0200 Subject: [PATCH] feat: change native token to nam --- apps/src/lib/cli.rs | 2 +- apps/src/lib/client/tx.rs | 6 +- .../lib/node/ledger/shell/finalize_block.rs | 12 +-- apps/src/lib/node/ledger/shell/governance.rs | 4 +- apps/src/lib/node/ledger/shell/init_chain.rs | 2 +- apps/src/lib/node/ledger/shell/mod.rs | 4 +- .../lib/node/ledger/shell/prepare_proposal.rs | 6 +- .../lib/node/ledger/shell/process_proposal.rs | 18 ++-- .../dev/src/explore/design/actors.md | 4 +- .../explore/design/ledger/pos-integration.md | 4 +- .../dev/src/explore/design/ledger/vp.md | 4 +- .../src/specs/ledger/default-transactions.md | 4 +- genesis/dev.toml | 6 +- genesis/e2e-tests-single-node.toml | 8 +- proof_of_stake/src/lib.rs | 4 +- shared/src/ledger/governance/mod.rs | 4 +- shared/src/ledger/governance/vp.rs | 6 +- shared/src/ledger/ibc/vp/mod.rs | 4 +- shared/src/ledger/pos/mod.rs | 4 +- shared/src/ledger/slash_fund/mod.rs | 2 +- shared/src/types/address.rs | 4 +- shared/src/types/transaction/mod.rs | 6 +- shared/src/types/transaction/wrapper.rs | 8 +- tests/src/e2e/ledger_tests.rs | 96 +++++++++---------- tests/src/e2e/setup.rs | 2 +- tx_prelude/src/governance.rs | 4 +- wasm/wasm_source/src/vp_testnet_faucet.rs | 6 +- wasm/wasm_source/src/vp_user.rs | 8 +- 28 files changed, 121 insertions(+), 121 deletions(-) diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index 8e4c7f78c94..d64a5fbf8ac 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -1296,7 +1296,7 @@ pub mod args { const FEE_AMOUNT: ArgDefault = arg_default("fee-amount", DefaultFn(|| token::Amount::from(0))); const FEE_TOKEN: ArgDefaultFromCtx = - arg_default_from_ctx("fee-token", DefaultFn(|| "XAN".into())); + arg_default_from_ctx("fee-token", DefaultFn(|| "NAM".into())); const FORCE: ArgFlag = flag("force"); const DONT_PREFETCH_WASM: ArgFlag = flag("dont-prefetch-wasm"); const GAS_LIMIT: ArgDefault = diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index e749a681c6f..ab302fef1be 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -11,7 +11,7 @@ use itertools::Either::*; use namada::ledger::governance::storage as gov_storage; use namada::ledger::pos::{BondId, Bonds, Unbonds}; use namada::proto::Tx; -use namada::types::address::{xan as m1t, Address}; +use namada::types::address::{nam, Address}; use namada::types::governance::{ OfflineProposal, OfflineVote, Proposal, ProposalVote, }; @@ -639,7 +639,7 @@ pub async fn submit_init_proposal(mut ctx: Context, args: args::InitProposal) { safe_exit(1) }; - let balance = rpc::get_token_balance(&client, &m1t(), &proposal.author) + let balance = rpc::get_token_balance(&client, &nam(), &proposal.author) .await .unwrap_or_default(); if balance @@ -911,7 +911,7 @@ pub async fn submit_bond(ctx: Context, args: args::Bond) { // Check bond's source (source for delegation or validator for self-bonds) // balance let bond_source = source.as_ref().unwrap_or(&validator); - let balance_key = token::balance_key(&address::xan(), bond_source); + let balance_key = token::balance_key(&address::nam(), bond_source); let client = HttpClient::new(args.tx.ledger_address.clone()).unwrap(); match rpc::query_storage_value::(&client, &balance_key).await { diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 2080b8d23de..098719dc961 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -321,7 +321,7 @@ where /// are covered by the e2e tests. #[cfg(test)] mod test_finalize_block { - use namada::types::address::xan; + use namada::types::address::nam; use namada::types::storage::Epoch; use namada::types::transaction::{EncryptionKey, Fee}; @@ -349,7 +349,7 @@ mod test_finalize_block { let wrapper = WrapperTx::new( Fee { amount: i.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -420,7 +420,7 @@ mod test_finalize_block { let wrapper = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -472,7 +472,7 @@ mod test_finalize_block { let wrapper = WrapperTx { fee: Fee { amount: 0.into(), - token: xan(), + token: nam(), }, pk: keypair.ref_to(), epoch: Epoch(0), @@ -538,7 +538,7 @@ mod test_finalize_block { let wrapper_tx = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -569,7 +569,7 @@ mod test_finalize_block { let wrapper_tx = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), diff --git a/apps/src/lib/node/ledger/shell/governance.rs b/apps/src/lib/node/ledger/shell/governance.rs index 979c3c0df15..828ff055243 100644 --- a/apps/src/lib/node/ledger/shell/governance.rs +++ b/apps/src/lib/node/ledger/shell/governance.rs @@ -6,7 +6,7 @@ use namada::ledger::governance::vp::ADDRESS as gov_address; use namada::ledger::slash_fund::ADDRESS as slash_fund_address; use namada::ledger::storage::types::encode; use namada::ledger::storage::{DBIter, StorageHasher, DB}; -use namada::types::address::{xan as m1t, Address}; +use namada::types::address::{nam, Address}; use namada::types::governance::TallyResult; use namada::types::storage::Epoch; use namada::types::token; @@ -179,7 +179,7 @@ where // transfer proposal locked funds shell .storage - .transfer(&m1t(), funds, &gov_address, &transfer_address); + .transfer(&nam(), funds, &gov_address, &transfer_address); } Ok(proposals_result) diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index 8cb6842c50f..d556fc1afdd 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -222,7 +222,7 @@ where // Account balance (tokens no staked in PoS) self.storage .write( - &token::balance_key(&address::xan(), addr), + &token::balance_key(&address::nam(), addr), validator .non_staked_balance .try_to_vec() diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index 28167d4ebac..f095d5edb79 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -641,7 +641,7 @@ mod test_utils { use namada::ledger::storage::mockdb::MockDB; use namada::ledger::storage::{BlockStateWrite, MerkleTree, Sha256Hasher}; - use namada::types::address::{xan, EstablishedAddressGen}; + use namada::types::address::{nam, EstablishedAddressGen}; use namada::types::chain::ChainId; use namada::types::hash::Hash; use namada::types::key::*; @@ -861,7 +861,7 @@ mod test_utils { let wrapper = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index c41f2c20837..6251740181a 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -140,7 +140,7 @@ pub(super) mod record { #[cfg(test)] mod test_prepare_proposal { use borsh::BorshSerialize; - use namada::types::address::xan; + use namada::types::address::nam; use namada::types::storage::Epoch; use namada::types::transaction::{Fee, WrapperTx}; @@ -189,7 +189,7 @@ mod test_prepare_proposal { WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -244,7 +244,7 @@ mod test_prepare_proposal { let wrapper_tx = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 5572e00495d..c3938b327cd 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -189,7 +189,7 @@ where mod test_process_proposal { use borsh::BorshDeserialize; use namada::proto::SignedTxData; - use namada::types::address::xan; + use namada::types::address::nam; use namada::types::hash::Hash; use namada::types::key::*; use namada::types::storage::Epoch; @@ -217,7 +217,7 @@ mod test_process_proposal { let wrapper = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -264,7 +264,7 @@ mod test_process_proposal { let mut wrapper = WrapperTx::new( Fee { amount: 100.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -346,7 +346,7 @@ mod test_process_proposal { let wrapper = WrapperTx::new( Fee { amount: 1.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -399,7 +399,7 @@ mod test_process_proposal { let wrapper = WrapperTx::new( Fee { amount: Amount::whole(1_000_100), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -447,7 +447,7 @@ mod test_process_proposal { let wrapper = WrapperTx::new( Fee { amount: i.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -511,7 +511,7 @@ mod test_process_proposal { let wrapper = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -570,7 +570,7 @@ mod test_process_proposal { let mut wrapper = WrapperTx::new( Fee { amount: 0.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -623,7 +623,7 @@ mod test_process_proposal { let wrapper = WrapperTx { fee: Fee { amount: 0.into(), - token: xan(), + token: nam(), }, pk: keypair.ref_to(), epoch: Epoch(0), diff --git a/documentation/dev/src/explore/design/actors.md b/documentation/dev/src/explore/design/actors.md index 88e26f3d640..6172505adb8 100644 --- a/documentation/dev/src/explore/design/actors.md +++ b/documentation/dev/src/explore/design/actors.md @@ -1,6 +1,6 @@ # Actors and Incentives -Namada consists of various actors fulfilling various roles in the network. They are all incentivized to act for the good of the network. The native Namada token `XAN` is used to settle transaction fees and pay for the incentives in Namada. +Namada consists of various actors fulfilling various roles in the network. They are all incentivized to act for the good of the network. The native Namada token `NAM` is used to settle transaction fees and pay for the incentives in Namada. ## Fees associated with a transaction @@ -9,7 +9,7 @@ Users of Namada can - transfer private assets they hold to other users and - barter assets with other users. -Each transaction may be associated with the following fees, paid in `XAN`: +Each transaction may be associated with the following fees, paid in `NAM`: - **Execution fees** to compensate for computing, storage and memory costs, charges at 2 stages: - **initial fee (init_f)**: charged before the transaction is settled diff --git a/documentation/dev/src/explore/design/ledger/pos-integration.md b/documentation/dev/src/explore/design/ledger/pos-integration.md index d441e5ddcac..dda5abc7489 100644 --- a/documentation/dev/src/explore/design/ledger/pos-integration.md +++ b/documentation/dev/src/explore/design/ledger/pos-integration.md @@ -27,7 +27,7 @@ All [the data relevant to the PoS system](https://specs.namada.net/economics/pro - `validator/{validator_address}/address_raw_hash` (required): raw hash of validator's address associated with the address is used for look-up of validator address from a raw hash - TBA (e.g. alias, website, description, delegation commission rate, etc.) -Only XAN tokens can be staked in bonds. The tokens being staked (bonds and unbonds amounts) are kept in the PoS account under `{xan_address}/balance/{pos_address}` until they are withdrawn. +Only NAM tokens can be staked in bonds. The tokens being staked (bonds and unbonds amounts) are kept in the PoS account under `{nam_address}/balance/{pos_address}` until they are withdrawn. ## Initialization @@ -39,7 +39,7 @@ Staking rewards for validators are rewarded in Tendermint's method `BeginBlock` To a validator who proposed a block (`block.header.proposer_address`), the system rewards tokens based on the `block_proposer_reward` PoS parameter and each validator that voted on a block (`block.last_commit_info.validator` who `signed_last_block`) receives `block_vote_reward`. -All the fees that are charged in a transaction execution (DKG transaction wrapper fee and transactions applied in a block) are transferred into a fee pool, which is another special account controlled by the PoS module. Note that the fee pool account may contain tokens other than the staking token XAN. +All the fees that are charged in a transaction execution (DKG transaction wrapper fee and transactions applied in a block) are transferred into a fee pool, which is another special account controlled by the PoS module. Note that the fee pool account may contain tokens other than the staking token NAM. - TODO describe the fee pool, related to , and diff --git a/documentation/dev/src/explore/design/ledger/vp.md b/documentation/dev/src/explore/design/ledger/vp.md index 7cf939f331c..46eb28e5713 100644 --- a/documentation/dev/src/explore/design/ledger/vp.md +++ b/documentation/dev/src/explore/design/ledger/vp.md @@ -39,9 +39,9 @@ The Proof-of-Stake slash pool is a simple account with a native VP which can rec The [fungible token VP](https://github.com/anoma/anoma/tree/master/wasm/wasm_source) allows to associate accounts balances of a specific token under its account. -For illustration, users `Albert` and `Bertha` might hold some amount of token with the address `XAN`. Their balances would be stored in the `XAN`'s storage sub-space under the storage keys `@XAN/balance/@Albert` and `@XAN/balance/@Bertha`, respectively. When `Albert` or `Bertha` attempt to transact with their `XAN` tokens, its validity predicate would be triggered to check: +For illustration, users `Albert` and `Bertha` might hold some amount of token with the address `NAM`. Their balances would be stored in the `NAM`'s storage sub-space under the storage keys `@NAM/balance/@Albert` and `@NAM/balance/@Bertha`, respectively. When `Albert` or `Bertha` attempt to transact with their `NAM` tokens, its validity predicate would be triggered to check: -- the total supply of `XAN` token is preserved (i.e. inputs = outputs) +- the total supply of `NAM` token is preserved (i.e. inputs = outputs) - the senders (users whose balance has been deducted) are checked that their validity predicate has also been triggered Note that the fungible token VP doesn't need to know whether any of involved users accepted or rejected the transaction, because if any of the involved users rejects it, the whole transaction will be rejected. diff --git a/documentation/dev/src/specs/ledger/default-transactions.md b/documentation/dev/src/specs/ledger/default-transactions.md index 78ed5b2098e..fb254f0cd3b 100644 --- a/documentation/dev/src/specs/ledger/default-transactions.md +++ b/documentation/dev/src/specs/ledger/default-transactions.md @@ -36,13 +36,13 @@ Attach [UpdateVp](../encoding.md#updatevp) to the `data`. ### tx_bond -Self-bond `amount` of XAN token from `validator` (without `source`) or delegate to `validator` from `source`. +Self-bond `amount` of NAM token from `validator` (without `source`) or delegate to `validator` from `source`. Attach [Bond](../encoding.md#bond) to the `data`. ### tx_unbond -Unbond self-bonded `amount` of XAN token from the `validator` (without `source`) or unbond delegation from the `source` to the `validator`. +Unbond self-bonded `amount` of NAM token from the `validator` (without `source`) or unbond delegation from the `source` to the `validator`. Attach [Bond](../encoding.md#bond) to the `data`. diff --git a/genesis/dev.toml b/genesis/dev.toml index 29a4b4d7917..fc95244e143 100644 --- a/genesis/dev.toml +++ b/genesis/dev.toml @@ -26,10 +26,10 @@ net_address = "127.0.0.1:26656" # Some tokens present at genesis. -[token.xan] +[token.nam] address = "atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5" vp = "vp_token" -[token.xan.balances] +[token.nam.balances] # In token balances, we can use: # 1. An address any account a1qyqzsqqqqqcyvvf5xcu5vd6rg4z5233hg9pn23pjgdryzdjy8pz52wzxxscnvvjxx3rryvzz8y5p6mtz = 1000000 @@ -168,7 +168,7 @@ light_client_attack_slash_rate = 500 # Governance parameters. [gov_params] -# minimum amount of xan token to lock +# minimum amount of nam token to lock min_proposal_fund = 500 # proposal code size in bytes max_proposal_code_size = 300000 diff --git a/genesis/e2e-tests-single-node.toml b/genesis/e2e-tests-single-node.toml index 0e3a6d3fc86..95e51173c64 100644 --- a/genesis/e2e-tests-single-node.toml +++ b/genesis/e2e-tests-single-node.toml @@ -5,7 +5,7 @@ genesis_time = "2021-09-30T10:00:00Z" [validator.validator-0] -# Validator's staked XAN at genesis. +# Validator's staked NAM at genesis. tokens = 200000 # Amount of the validator's genesis token balance which is not staked. non_staked_balance = 1000000000000 @@ -20,10 +20,10 @@ net_address = "127.0.0.1:27656" # Some tokens present at genesis. -[token.XAN] +[token.NAM] address = "atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5" vp = "vp_token" -[token.XAN.balances] +[token.NAM.balances] Albert = 1000000 "Albert.public_key" = 100 Bertha = 1000000 @@ -168,7 +168,7 @@ light_client_attack_slash_rate = 500 # Governance parameters. [gov_params] -# minimum amount of xan token to lock +# minimum amount of nam token to lock min_proposal_fund = 500 # proposal code size in bytes max_proposal_code_size = 300000 diff --git a/proof_of_stake/src/lib.rs b/proof_of_stake/src/lib.rs index 7676ee7d2e4..6e5f4e21965 100644 --- a/proof_of_stake/src/lib.rs +++ b/proof_of_stake/src/lib.rs @@ -101,7 +101,7 @@ pub trait PosReadOnly { const POS_ADDRESS: Self::Address; /// Address of the staking token - /// TODO: this should be `const`, but in the ledger `address::xan` is not a + /// TODO: this should be `const`, but in the ledger `address::nam` is not a /// `const fn` fn staking_token_address() -> Self::Address; @@ -577,7 +577,7 @@ pub trait PosBase { /// Address of the PoS account const POS_ADDRESS: Self::Address; /// Address of the staking token - /// TODO: this should be `const`, but in the ledger `address::xan` is not a + /// TODO: this should be `const`, but in the ledger `address::nam` is not a /// `const fn` fn staking_token_address() -> Self::Address; /// Address of the slash pool, into which slashed tokens are transferred. diff --git a/shared/src/ledger/governance/mod.rs b/shared/src/ledger/governance/mod.rs index 72aa7fb3ced..a4e0c80211e 100644 --- a/shared/src/ledger/governance/mod.rs +++ b/shared/src/ledger/governance/mod.rs @@ -17,7 +17,7 @@ pub use vp::Result; use self::storage as gov_storage; use crate::ledger::native_vp::{Ctx, NativeVp}; use crate::ledger::storage::{self as ledger_storage, StorageHasher}; -use crate::types::address::{xan as m1t, Address, InternalAddress}; +use crate::types::address::{nam, Address, InternalAddress}; use crate::types::storage::Key; use crate::types::token as token_storage; use crate::vm::WasmCacheAccess; @@ -235,7 +235,7 @@ where KeyType::COUNTER(vp::validate_counter_key) } else if gov_storage::is_parameter_key(value) { KeyType::PARAMETER(vp::validate_parameter_key) - } else if token_storage::is_balance_key(&m1t(), value).is_some() { + } else if token_storage::is_balance_key(&nam(), value).is_some() { KeyType::BALANCE(vp::validate_balance_key) } else if gov_storage::is_governance_key(value) { KeyType::UNKNOWN_GOVERNANCE(vp::validate_unknown_governance_key) diff --git a/shared/src/ledger/governance/vp.rs b/shared/src/ledger/governance/vp.rs index 7537cd5f012..c01e9d56bd2 100644 --- a/shared/src/ledger/governance/vp.rs +++ b/shared/src/ledger/governance/vp.rs @@ -8,7 +8,7 @@ use crate::ledger::native_vp::{self, Ctx}; use crate::ledger::pos::{self as pos_storage, BondId, Bonds}; use crate::ledger::storage::{self as ledger_storage, StorageHasher}; use crate::ledger::vp_env::VpEnv; -use crate::types::address::{xan as m1t, Address, InternalAddress}; +use crate::types::address::{nam, Address, InternalAddress}; use crate::types::storage::{Epoch, Key}; use crate::types::token; use crate::vm::WasmCacheAccess; @@ -53,7 +53,7 @@ where H: 'static + StorageHasher, CA: 'static + WasmCacheAccess, { - let balance_key = token::balance_key(&m1t(), &ADDRESS); + let balance_key = token::balance_key(&nam(), &ADDRESS); let min_funds_parameter_key = gov_storage::get_min_proposal_fund_key(); let min_funds_parameter: Option = read(ctx, &min_funds_parameter_key, ReadType::PRE).ok(); @@ -164,7 +164,7 @@ where CA: 'static + WasmCacheAccess, { let funds_key = gov_storage::get_funds_key(proposal_id); - let balance_key = token::balance_key(&m1t(), &ADDRESS); + let balance_key = token::balance_key(&nam(), &ADDRESS); let min_funds_parameter_key = gov_storage::get_min_proposal_fund_key(); let min_funds_parameter: Option = read(ctx, &min_funds_parameter_key, ReadType::PRE).ok(); diff --git a/shared/src/ledger/ibc/vp/mod.rs b/shared/src/ledger/ibc/vp/mod.rs index b5dec0293c6..6ff04180bba 100644 --- a/shared/src/ledger/ibc/vp/mod.rs +++ b/shared/src/ledger/ibc/vp/mod.rs @@ -1463,7 +1463,7 @@ mod tests { source_port: get_port_id(), source_channel: get_channel_id(), token: Some(Coin { - denom: "XAN".to_string(), + denom: "NAM".to_string(), amount: 100u64.to_string(), }), sender: Signer::new("sender"), @@ -1722,7 +1722,7 @@ mod tests { source_port: get_port_id(), source_channel: get_channel_id(), token: Some(Coin { - denom: "XAN".to_string(), + denom: "NAM".to_string(), amount: 100u64.to_string(), }), sender: Signer::new("sender"), diff --git a/shared/src/ledger/pos/mod.rs b/shared/src/ledger/pos/mod.rs index 3b498727df3..0b1617c7c30 100644 --- a/shared/src/ledger/pos/mod.rs +++ b/shared/src/ledger/pos/mod.rs @@ -26,9 +26,9 @@ pub const ADDRESS: Address = Address::Internal(InternalAddress::PoS); pub const SLASH_POOL_ADDRESS: Address = Address::Internal(InternalAddress::PosSlashPool); -/// Address of the staking token (XAN) +/// Address of the staking token (NAM) pub fn staking_token_address() -> Address { - address::xan() + address::nam() } /// Initialize storage in the genesis block. diff --git a/shared/src/ledger/slash_fund/mod.rs b/shared/src/ledger/slash_fund/mod.rs index 0d452af2e5f..b944dc0bf22 100644 --- a/shared/src/ledger/slash_fund/mod.rs +++ b/shared/src/ledger/slash_fund/mod.rs @@ -12,7 +12,7 @@ use self::storage as slash_fund_storage; use super::governance::vp::is_proposal_accepted; use crate::ledger::native_vp::{self, Ctx, NativeVp}; use crate::ledger::storage::{self as ledger_storage, StorageHasher}; -use crate::types::address::{xan as nam, Address, InternalAddress}; +use crate::types::address::{nam, Address, InternalAddress}; use crate::types::storage::Key; use crate::types::token; use crate::vm::WasmCacheAccess; diff --git a/shared/src/types/address.rs b/shared/src/types/address.rs index 6f047730fed..57a9f299cfa 100644 --- a/shared/src/types/address.rs +++ b/shared/src/types/address.rs @@ -488,7 +488,7 @@ impl Display for InternalAddress { } /// Temporary helper for testing -pub fn xan() -> Address { +pub fn nam() -> Address { Address::decode("atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5").expect("The token address decoding shouldn't fail") } @@ -526,7 +526,7 @@ pub fn kartoffel() -> Address { /// informal currency codes. pub fn tokens() -> HashMap { vec![ - (xan(), "XAN"), + (nam(), "NAM"), (btc(), "BTC"), (eth(), "ETH"), (dot(), "DOT"), diff --git a/shared/src/types/transaction/mod.rs b/shared/src/types/transaction/mod.rs index a7d5ee864bf..508e28db924 100644 --- a/shared/src/types/transaction/mod.rs +++ b/shared/src/types/transaction/mod.rs @@ -343,7 +343,7 @@ pub mod tx_types { #[cfg(test)] mod test_process_tx { use super::*; - use crate::types::address::xan; + use crate::types::address::nam; use crate::types::storage::Epoch; fn gen_keypair() -> common::SecretKey { @@ -427,7 +427,7 @@ pub mod tx_types { let wrapper = WrapperTx::new( Fee { amount: 10.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -462,7 +462,7 @@ pub mod tx_types { let wrapper = WrapperTx::new( Fee { amount: 10.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), diff --git a/shared/src/types/transaction/wrapper.rs b/shared/src/types/transaction/wrapper.rs index ad27b807aae..e0e6dab6be6 100644 --- a/shared/src/types/transaction/wrapper.rs +++ b/shared/src/types/transaction/wrapper.rs @@ -337,7 +337,7 @@ pub mod wrapper_tx { mod test_wrapper_tx { use super::*; use crate::proto::SignedTxData; - use crate::types::address::xan; + use crate::types::address::nam; fn gen_keypair() -> common::SecretKey { use rand::prelude::ThreadRng; @@ -360,7 +360,7 @@ pub mod wrapper_tx { let wrapper = WrapperTx::new( Fee { amount: 10.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), @@ -386,7 +386,7 @@ pub mod wrapper_tx { let mut wrapper = WrapperTx::new( Fee { amount: 10.into(), - token: xan(), + token: nam(), }, &gen_keypair(), Epoch(0), @@ -418,7 +418,7 @@ pub mod wrapper_tx { let mut tx = WrapperTx::new( Fee { amount: 10.into(), - token: xan(), + token: nam(), }, &keypair, Epoch(0), diff --git a/tests/src/e2e/ledger_tests.rs b/tests/src/e2e/ledger_tests.rs index a998844764e..0d210b68757 100644 --- a/tests/src/e2e/ledger_tests.rs +++ b/tests/src/e2e/ledger_tests.rs @@ -95,7 +95,7 @@ fn test_node_connectivity() -> Result<()> { "--target", ALBERT, "--token", - XAN, + NAM, "--amount", "10.1", "--fee-amount", @@ -103,7 +103,7 @@ fn test_node_connectivity() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -129,7 +129,7 @@ fn test_node_connectivity() -> Result<()> { "--owner", ALBERT, "--token", - XAN, + NAM, "--ledger-address", ledger_rpc, ] @@ -283,7 +283,7 @@ fn ledger_txs_and_queries() -> Result<()> { "--target", ALBERT, "--token", - XAN, + NAM, "--amount", "10.1", "--fee-amount", @@ -291,7 +291,7 @@ fn ledger_txs_and_queries() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ], @@ -308,7 +308,7 @@ fn ledger_txs_and_queries() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ], @@ -326,7 +326,7 @@ fn ledger_txs_and_queries() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc ], @@ -347,7 +347,7 @@ fn ledger_txs_and_queries() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ], @@ -379,12 +379,12 @@ fn ledger_txs_and_queries() -> Result<()> { "--owner", BERTHA, "--token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ], // expect a decimal - r"XAN: \d+(\.\d+)?", + r"NAM: \d+(\.\d+)?", ), ]; for (query_args, expected) in &query_args_and_expected_response { @@ -396,8 +396,8 @@ fn ledger_txs_and_queries() -> Result<()> { let christel = find_address(&test, CHRISTEL)?; // as setup in `genesis/e2e-tests-single-node.toml` let christel_balance = token::Amount::whole(1000000); - let xan = find_address(&test, XAN)?; - let storage_key = token::balance_key(&xan, &christel).to_string(); + let nam = find_address(&test, NAM)?; + let storage_key = token::balance_key(&nam, &christel).to_string(); let query_args_and_expected_response = vec![ // 7. Query storage key and get hex-encoded raw bytes ( @@ -447,7 +447,7 @@ fn invalid_transactions() -> Result<()> { let transfer = token::Transfer { source: find_address(&test, DAEWON)?, target: find_address(&test, ALBERT)?, - token: find_address(&test, XAN)?, + token: find_address(&test, NAM)?, sub_prefix: None, amount: token::Amount::whole(1), }; @@ -474,7 +474,7 @@ fn invalid_transactions() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -528,7 +528,7 @@ fn invalid_transactions() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, // Force to ignore client check that fails on the balance check of the // source address "--force", @@ -604,7 +604,7 @@ fn pos_bonds() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -627,7 +627,7 @@ fn pos_bonds() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -647,7 +647,7 @@ fn pos_bonds() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -670,7 +670,7 @@ fn pos_bonds() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -710,7 +710,7 @@ fn pos_bonds() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -731,7 +731,7 @@ fn pos_bonds() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -747,7 +747,7 @@ fn pos_bonds() -> Result<()> { /// 1. Run the ledger node with shorter epochs for faster progression /// 2. Initialize a new validator account /// 3. Submit a delegation to the new validator -/// 4. Transfer some XAN to the new validator +/// 4. Transfer some NAM to the new validator /// 5. Submit a self-bond for the new validator /// 6. Wait for the pipeline epoch /// 7. Check the new validator's voting power @@ -800,7 +800,7 @@ fn pos_init_validator() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -817,7 +817,7 @@ fn pos_init_validator() -> Result<()> { "--target", &new_validator_key, "--token", - XAN, + NAM, "--amount", "0.5", "--fee-amount", @@ -825,7 +825,7 @@ fn pos_init_validator() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -846,7 +846,7 @@ fn pos_init_validator() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -854,7 +854,7 @@ fn pos_init_validator() -> Result<()> { client.exp_string("Transaction is valid.")?; client.assert_success(); - // 4. Transfer some XAN to the new validator + // 4. Transfer some NAM to the new validator let tx_args = vec![ "transfer", "--source", @@ -862,7 +862,7 @@ fn pos_init_validator() -> Result<()> { "--target", new_validator, "--token", - XAN, + NAM, "--amount", "10999.5", "--fee-amount", @@ -870,7 +870,7 @@ fn pos_init_validator() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -890,7 +890,7 @@ fn pos_init_validator() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -958,7 +958,7 @@ fn ledger_many_txs_in_a_block() -> Result<()> { "--target", ALBERT, "--token", - XAN, + NAM, "--amount", "10.1", "--fee-amount", @@ -966,7 +966,7 @@ fn ledger_many_txs_in_a_block() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", ]); @@ -1075,7 +1075,7 @@ fn proposal_submission() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -1146,13 +1146,13 @@ fn proposal_submission() -> Result<()> { "--owner", ALBERT, "--token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; let mut client = run!(test, Bin::Client, query_balance_args, Some(40))?; - client.exp_string("XAN: 999500")?; + client.exp_string("NAM: 999500")?; client.assert_success(); // 5. Query token balance governance @@ -1161,13 +1161,13 @@ fn proposal_submission() -> Result<()> { "--owner", GOVERNANCE_ADDRESS, "--token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; let mut client = run!(test, Bin::Client, query_balance_args, Some(40))?; - client.exp_string("XAN: 500")?; + client.exp_string("NAM: 500")?; client.assert_success(); // 6. Submit an invalid proposal @@ -1248,13 +1248,13 @@ fn proposal_submission() -> Result<()> { "--owner", ALBERT, "--token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; let mut client = run!(test, Bin::Client, query_balance_args, Some(40))?; - client.exp_string("XAN: 999500")?; + client.exp_string("NAM: 999500")?; client.assert_success(); // 9. Send a yay vote from a validator @@ -1353,13 +1353,13 @@ fn proposal_submission() -> Result<()> { "--owner", ALBERT, "--token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; let mut client = run!(test, Bin::Client, query_balance_args, Some(30))?; - client.exp_string("XAN: 1000000")?; + client.exp_string("NAM: 1000000")?; client.assert_success(); // 13. Check if governance funds are 0 @@ -1368,13 +1368,13 @@ fn proposal_submission() -> Result<()> { "--owner", GOVERNANCE_ADDRESS, "--token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; let mut client = run!(test, Bin::Client, query_balance_args, Some(30))?; - client.exp_string("XAN: 0")?; + client.exp_string("NAM: 0")?; client.assert_success(); // // 14. Query parameters @@ -1424,7 +1424,7 @@ fn proposal_offline() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -1859,7 +1859,7 @@ fn test_genesis_validators() -> Result<()> { "--target", validator_1_alias, "--token", - XAN, + NAM, "--amount", "10.1", "--fee-amount", @@ -1867,7 +1867,7 @@ fn test_genesis_validators() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; @@ -2003,7 +2003,7 @@ fn double_signing_gets_slashed() -> Result<()> { "--target", ALBERT, "--token", - XAN, + NAM, "--amount", "10.1", "--fee-amount", @@ -2011,7 +2011,7 @@ fn double_signing_gets_slashed() -> Result<()> { "--gas-limit", "0", "--fee-token", - XAN, + NAM, "--ledger-address", &validator_one_rpc, ]; diff --git a/tests/src/e2e/setup.rs b/tests/src/e2e/setup.rs index b20f14d54f0..3d6ff5e951d 100644 --- a/tests/src/e2e/setup.rs +++ b/tests/src/e2e/setup.rs @@ -766,7 +766,7 @@ pub mod constants { pub const GOVERNANCE_ADDRESS: &str = "governance"; // Fungible token addresses - pub const XAN: &str = "XAN"; + pub const NAM: &str = "NAM"; pub const BTC: &str = "BTC"; pub const ETH: &str = "ETH"; pub const DOT: &str = "DOT"; diff --git a/tx_prelude/src/governance.rs b/tx_prelude/src/governance.rs index 2dbab74a9e5..bb0e6cb6f9e 100644 --- a/tx_prelude/src/governance.rs +++ b/tx_prelude/src/governance.rs @@ -2,7 +2,7 @@ use namada::ledger::governance::storage; use namada::ledger::governance::vp::ADDRESS as governance_address; -use namada::types::address::xan as m1t; +use namada::types::address::nam; use namada::types::token::Amount; use namada::types::transaction::governance::{ InitProposalData, VoteProposalData, @@ -59,7 +59,7 @@ pub fn init_proposal(ctx: &mut Ctx, data: InitProposalData) -> TxResult { ctx, &data.author, &governance_address, - &m1t(), + &nam(), None, min_proposal_funds, ) diff --git a/wasm/wasm_source/src/vp_testnet_faucet.rs b/wasm/wasm_source/src/vp_testnet_faucet.rs index 9582791565a..35e2dd8fbc1 100644 --- a/wasm/wasm_source/src/vp_testnet_faucet.rs +++ b/wasm/wasm_source/src/vp_testnet_faucet.rs @@ -131,7 +131,7 @@ mod tests { let vp_owner = address::testing::established_address_1(); let source = address::testing::established_address_2(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(10_098_123); // Spawn the accounts to be able to modify their storage @@ -267,7 +267,7 @@ mod tests { let vp_owner = address::testing::established_address_1(); let target = address::testing::established_address_2(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(amount); // Spawn the accounts to be able to modify their storage @@ -300,7 +300,7 @@ mod tests { let vp_owner = address::testing::established_address_1(); let target = address::testing::established_address_2(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(amount); // Spawn the accounts to be able to modify their storage diff --git a/wasm/wasm_source/src/vp_user.rs b/wasm/wasm_source/src/vp_user.rs index 256dc6bb17a..078e5280130 100644 --- a/wasm/wasm_source/src/vp_user.rs +++ b/wasm/wasm_source/src/vp_user.rs @@ -231,7 +231,7 @@ mod tests { let vp_owner = address::testing::established_address_1(); let source = address::testing::established_address_2(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(10_098_123); // Spawn the accounts to be able to modify their storage @@ -275,7 +275,7 @@ mod tests { let vp_owner = address::testing::established_address_1(); let target = address::testing::established_address_2(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(10_098_123); // Spawn the accounts to be able to modify their storage @@ -321,7 +321,7 @@ mod tests { let keypair = key::testing::keypair_1(); let public_key = keypair.ref_to(); let target = address::testing::established_address_2(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(10_098_123); // Spawn the accounts to be able to modify their storage @@ -371,7 +371,7 @@ mod tests { let vp_owner = address::testing::established_address_1(); let source = address::testing::established_address_2(); let target = address::testing::established_address_3(); - let token = address::xan(); + let token = address::nam(); let amount = token::Amount::from(10_098_123); // Spawn the accounts to be able to modify their storage