From 1b80cfff93e1c1aa0d18b18188a105c57cebbf6c Mon Sep 17 00:00:00 2001 From: brentstone Date: Tue, 23 Apr 2024 22:40:35 -0700 Subject: [PATCH] impl fix from review comment --- crates/apps/src/lib/bench_utils.rs | 1 - .../lib/node/ledger/shell/finalize_block.rs | 2 -- crates/light_sdk/src/transaction/account.rs | 10 +++------ crates/light_sdk/src/transaction/bridge.rs | 4 +--- .../light_sdk/src/transaction/governance.rs | 6 ++--- crates/light_sdk/src/transaction/ibc.rs | 4 +--- crates/light_sdk/src/transaction/mod.rs | 2 -- crates/light_sdk/src/transaction/pgf.rs | 7 ++---- crates/light_sdk/src/transaction/pos.rs | 22 ++++++------------- crates/light_sdk/src/transaction/transfer.rs | 4 +--- crates/namada/src/vm/wasm/run.rs | 1 - 11 files changed, 17 insertions(+), 46 deletions(-) diff --git a/crates/apps/src/lib/bench_utils.rs b/crates/apps/src/lib/bench_utils.rs index 8dbb038312c..b7440f8d647 100644 --- a/crates/apps/src/lib/bench_utils.rs +++ b/crates/apps/src/lib/bench_utils.rs @@ -591,7 +591,6 @@ impl BenchShell { token: self.state.in_mem().native_token.clone(), }, defaults::albert_keypair().ref_to(), - self.state.in_mem().last_epoch, 0.into(), None, ); diff --git a/crates/apps/src/lib/node/ledger/shell/finalize_block.rs b/crates/apps/src/lib/node/ledger/shell/finalize_block.rs index 787dc09a92e..7765332528d 100644 --- a/crates/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/crates/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -2592,7 +2592,6 @@ mod test_finalize_block { token: shell.state.in_mem().native_token.clone(), }, keypair.ref_to(), - Epoch(0), 0.into(), None, )))); @@ -2847,7 +2846,6 @@ mod test_finalize_block { token: shell.state.in_mem().native_token.clone(), }, keypair.ref_to(), - Epoch(0), WRAPPER_GAS_LIMIT.into(), None, )))); diff --git a/crates/light_sdk/src/transaction/account.rs b/crates/light_sdk/src/transaction/account.rs index b037238a2e1..855886dd6c7 100644 --- a/crates/light_sdk/src/transaction/account.rs +++ b/crates/light_sdk/src/transaction/account.rs @@ -1,7 +1,6 @@ use namada_sdk::address::Address; use namada_sdk::hash::Hash; use namada_sdk::key::common; -use namada_sdk::storage::Epoch; use namada_sdk::token::DenominatedAmount; use namada_sdk::tx::data::GasLimit; use namada_sdk::tx::{Authorization, Tx, TxError}; @@ -59,10 +58,9 @@ impl InitAccount { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -131,10 +129,9 @@ impl RevealPk { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -215,10 +212,9 @@ impl UpdateAccount { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/light_sdk/src/transaction/bridge.rs b/crates/light_sdk/src/transaction/bridge.rs index a8fb35c2abd..991b4ee4f5f 100644 --- a/crates/light_sdk/src/transaction/bridge.rs +++ b/crates/light_sdk/src/transaction/bridge.rs @@ -2,7 +2,6 @@ use namada_sdk::address::Address; pub use namada_sdk::eth_bridge_pool::{GasFee, TransferToEthereum}; use namada_sdk::hash::Hash; use namada_sdk::key::common; -use namada_sdk::storage::Epoch; use namada_sdk::token::DenominatedAmount; use namada_sdk::tx::data::GasLimit; use namada_sdk::tx::{Authorization, Tx, TxError}; @@ -54,10 +53,9 @@ impl BridgeTransfer { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/light_sdk/src/transaction/governance.rs b/crates/light_sdk/src/transaction/governance.rs index e23e1e0d0c7..763d6df4df5 100644 --- a/crates/light_sdk/src/transaction/governance.rs +++ b/crates/light_sdk/src/transaction/governance.rs @@ -66,10 +66,9 @@ impl InitProposal { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -145,10 +144,9 @@ impl VoteProposal { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/light_sdk/src/transaction/ibc.rs b/crates/light_sdk/src/transaction/ibc.rs index 32afdb4c309..10715ae2b27 100644 --- a/crates/light_sdk/src/transaction/ibc.rs +++ b/crates/light_sdk/src/transaction/ibc.rs @@ -5,7 +5,6 @@ use namada_sdk::hash::Hash; pub use namada_sdk::ibc::apps::transfer::types::msgs::transfer::MsgTransfer; use namada_sdk::ibc::primitives::ToProto; use namada_sdk::key::common; -use namada_sdk::storage::Epoch; use namada_sdk::time::DateTimeUtc; use namada_sdk::token::DenominatedAmount; use namada_sdk::tx::data::GasLimit; @@ -63,10 +62,9 @@ impl IbcTransfer { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/light_sdk/src/transaction/mod.rs b/crates/light_sdk/src/transaction/mod.rs index 42440f06f41..e7fe8ce6bd7 100644 --- a/crates/light_sdk/src/transaction/mod.rs +++ b/crates/light_sdk/src/transaction/mod.rs @@ -6,7 +6,6 @@ use namada_sdk::address::Address; use namada_sdk::chain::ChainId; use namada_sdk::hash::Hash; use namada_sdk::key::common; -use namada_sdk::storage::Epoch; use namada_sdk::time::DateTimeUtc; use namada_sdk::token::DenominatedAmount; use namada_sdk::tx::data::{Fee, GasLimit}; @@ -80,7 +79,6 @@ pub(in crate::transaction) fn attach_fee( fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - _epoch: Epoch, gas_limit: GasLimit, ) -> Tx { tx.add_wrapper( diff --git a/crates/light_sdk/src/transaction/pgf.rs b/crates/light_sdk/src/transaction/pgf.rs index 1a492b331bf..2b68693f64c 100644 --- a/crates/light_sdk/src/transaction/pgf.rs +++ b/crates/light_sdk/src/transaction/pgf.rs @@ -3,7 +3,6 @@ use namada_sdk::collections::HashMap; use namada_sdk::dec::Dec; use namada_sdk::hash::Hash; use namada_sdk::key::common; -use namada_sdk::storage::Epoch; use namada_sdk::token::DenominatedAmount; use namada_sdk::tx::data::GasLimit; use namada_sdk::tx::{Authorization, Tx, TxError}; @@ -49,10 +48,9 @@ impl ResignSteward { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -131,10 +129,9 @@ impl UpdateStewardCommission { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/light_sdk/src/transaction/pos.rs b/crates/light_sdk/src/transaction/pos.rs index 25b7a19f37c..15f854a86ca 100644 --- a/crates/light_sdk/src/transaction/pos.rs +++ b/crates/light_sdk/src/transaction/pos.rs @@ -2,7 +2,6 @@ use namada_sdk::address::Address; use namada_sdk::dec::Dec; use namada_sdk::hash::Hash; use namada_sdk::key::{common, secp256k1}; -use namada_sdk::storage::Epoch; use namada_sdk::token; use namada_sdk::token::{Amount, DenominatedAmount}; use namada_sdk::tx::data::pos::Redelegation; @@ -337,10 +336,9 @@ impl ReactivateValidator { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -415,10 +413,9 @@ impl ClaimRewards { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -506,10 +503,9 @@ impl ChangeMetaData { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -586,10 +582,9 @@ impl ChangeConsensusKey { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -662,10 +657,9 @@ impl ChangeCommission { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -740,10 +734,9 @@ impl Withdraw { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign @@ -824,10 +817,9 @@ impl Redelegate { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/light_sdk/src/transaction/transfer.rs b/crates/light_sdk/src/transaction/transfer.rs index 3a5d188a215..dd8c6d31bdc 100644 --- a/crates/light_sdk/src/transaction/transfer.rs +++ b/crates/light_sdk/src/transaction/transfer.rs @@ -2,7 +2,6 @@ use borsh_ext::BorshSerializeExt; use namada_sdk::address::Address; use namada_sdk::hash::Hash; use namada_sdk::key::common; -use namada_sdk::storage::Epoch; use namada_sdk::token::DenominatedAmount; use namada_sdk::tx::data::GasLimit; use namada_sdk::tx::{Authorization, Tx, TxError}; @@ -65,10 +64,9 @@ impl Transfer { fee: DenominatedAmount, token: Address, fee_payer: common::PublicKey, - epoch: Epoch, gas_limit: GasLimit, ) -> Self { - Self(attach_fee(self.0, fee, token, fee_payer, epoch, gas_limit)) + Self(attach_fee(self.0, fee, token, fee_payer, gas_limit)) } /// Get the bytes of the fee data to sign diff --git a/crates/namada/src/vm/wasm/run.rs b/crates/namada/src/vm/wasm/run.rs index 1b3d946a8b3..ef0a95086b5 100644 --- a/crates/namada/src/vm/wasm/run.rs +++ b/crates/namada/src/vm/wasm/run.rs @@ -1564,7 +1564,6 @@ mod tests { }, namada_core::key::testing::common_sk_from_simple_seed(0) .to_public(), - namada_state::Epoch(0), 0.into(), None, ),