Skip to content

Commit

Permalink
Merge branch 'yuji/disable-nam-transfer-param' (#2846)
Browse files Browse the repository at this point in the history
* origin/yuji/disable-nam-transfer-param:
  add debug log
  small refactoring
  enable native transfer to PoS or Gov
  fix dev deps
  add param to enable/disable nam transfers

# Conflicts:
#	crates/apps/src/lib/node/ledger/shell/mod.rs
  • Loading branch information
tzemanovic committed Apr 10, 2024
2 parents f475386 + 670fbce commit 00e8ecc
Show file tree
Hide file tree
Showing 17 changed files with 291 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/2842-nam-transferable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add a parameter to enable/disable native token transfers
([\#2842](https://github.com/anoma/namada/issues/2842))
2 changes: 2 additions & 0 deletions crates/apps/src/lib/config/genesis/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ impl Finalized {
max_block_gas,
minimum_gas_price,
max_tx_bytes,
is_native_token_transferable,
..
} = self.parameters.parameters.clone();

Expand Down Expand Up @@ -348,6 +349,7 @@ impl Finalized {
)
})
.collect(),
is_native_token_transferable,
}
}

Expand Down
4 changes: 4 additions & 0 deletions crates/apps/src/lib/config/genesis/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ pub struct ChainParams<T: TemplateValidation> {
/// Name of the native token - this must one of the tokens from
/// `tokens.toml` file
pub native_token: Alias,
/// Enable the native token transfer if it is true
pub is_native_token_transferable: bool,
/// Minimum number of blocks per epoch.
// TODO: u64 only works with values up to i64::MAX with toml-rs!
pub min_num_of_blocks: u64,
Expand Down Expand Up @@ -311,6 +313,7 @@ impl ChainParams<Unvalidated> {
let ChainParams {
max_tx_bytes,
native_token,
is_native_token_transferable,
min_num_of_blocks,
max_expected_time_per_block,
max_proposal_bytes,
Expand Down Expand Up @@ -356,6 +359,7 @@ impl ChainParams<Unvalidated> {
Ok(ChainParams {
max_tx_bytes,
native_token,
is_native_token_transferable,
min_num_of_blocks,
max_expected_time_per_block,
max_proposal_bytes,
Expand Down
1 change: 1 addition & 0 deletions crates/apps/src/lib/node/ledger/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ mod tests {
fee_unshielding_gas_limit: 0,
fee_unshielding_descriptions_limit: 0,
minimum_gas_price: Default::default(),
is_native_token_transferable: true,
};
parameters::init_storage(&params, &mut state).expect("Test failed");
// insert and commit
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ pub struct Parameters {
pub fee_unshielding_descriptions_limit: u64,
/// Map of the cost per gas unit for every token allowed for fee payment
pub minimum_gas_price: BTreeMap<Address, token::Amount>,
/// Enable the native token transfer if it is true
pub is_native_token_transferable: bool,
}

/// Epoch duration. A new epoch begins as soon as both the `min_num_of_blocks`
Expand Down
4 changes: 4 additions & 0 deletions crates/namada/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ http-client = ["tendermint-rpc/http-client"]
testing = [
"namada_core/testing",
"namada_ethereum_bridge/testing",
"namada_parameters/testing",
"namada_proof_of_stake/testing",
"namada_sdk/testing",
"namada_state/testing",
Expand Down Expand Up @@ -165,6 +166,9 @@ wasmtimer = "0.2.0"
namada_core = { path = "../core", default-features = false, features = [
"testing",
] }
namada_parameters = { path = "../parameters", default-features = false, features = [
"testing",
] }
namada_ethereum_bridge = { path = "../ethereum_bridge", default-features = false, features = [
"testing",
] }
Expand Down
Loading

0 comments on commit 00e8ecc

Please sign in to comment.