From b0ba052fac97e93b2771e575f0b5de4ed6408d8b Mon Sep 17 00:00:00 2001 From: satan Date: Fri, 16 Feb 2024 12:53:12 +0100 Subject: [PATCH] Fixing e2e tests --- .../src/lib/node/ledger/shell/block_alloc.rs | 7 +- .../node/ledger/shell/block_alloc/states.rs | 12 +- .../lib/node/ledger/shell/finalize_block.rs | 236 +++++++++--------- .../lib/node/ledger/shell/process_proposal.rs | 10 +- .../src/lib/node/ledger/shell/testing/node.rs | 1 - .../src/lib/node/ledger/storage/rocksdb.rs | 7 +- crates/namada/src/ledger/protocol/mod.rs | 7 +- crates/sdk/src/masp.rs | 48 ++-- crates/state/src/write_log.rs | 9 +- crates/tests/src/e2e/eth_bridge_tests.rs | 5 +- crates/tests/src/e2e/helpers.rs | 3 +- crates/tests/src/e2e/ibc_tests.rs | 9 +- crates/tests/src/e2e/ledger_tests.rs | 21 +- crates/tests/src/strings.rs | 3 - 14 files changed, 186 insertions(+), 192 deletions(-) diff --git a/crates/apps/src/lib/node/ledger/shell/block_alloc.rs b/crates/apps/src/lib/node/ledger/shell/block_alloc.rs index 14fe4ee72b7..e33cdb00ead 100644 --- a/crates/apps/src/lib/node/ledger/shell/block_alloc.rs +++ b/crates/apps/src/lib/node/ledger/shell/block_alloc.rs @@ -180,7 +180,7 @@ impl BlockAllocator { _state: PhantomData, block: TxBin::init(max), protocol_txs: TxBin::default(), - normal_txs: NormalTxsBins{ + normal_txs: NormalTxsBins { space: TxBin::init(tendermint_max_block_space_in_bytes), gas: TxBin::init(max_block_gas), }, @@ -496,7 +496,10 @@ mod tests { 1_000, ); let expected = tendermint_max_block_space_in_bytes; - assert_eq!(bins.protocol_txs.allotted, threshold::ONE_HALF.over(tendermint_max_block_space_in_bytes)); + assert_eq!( + bins.protocol_txs.allotted, + threshold::ONE_HALF.over(tendermint_max_block_space_in_bytes) + ); assert_eq!(expected, bins.unoccupied_space_in_bytes()); } diff --git a/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs b/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs index 94ba14f574e..64587d54648 100644 --- a/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs +++ b/crates/apps/src/lib/node/ledger/shell/block_alloc/states.rs @@ -1,4 +1,4 @@ -//! All the states of the [`BlockAllocator`] state machine, +//! All the states of the `BlockAllocator` state machine, //! over the extent of a Tendermint consensus round //! block proposal. //! @@ -51,7 +51,7 @@ pub enum WithoutNormalTxs {} /// [`crate::node::ledger::shell::block_alloc::states`]. pub struct BuildingTxBatch {} -/// Try to allocate a new transaction on a [`BlockAllocator`] state. +/// Try to allocate a new transaction on a `BlockAllocator` state. /// /// For more info, read the module docs of /// [`crate::node::ledger::shell::block_alloc::states`]. @@ -65,7 +65,7 @@ pub trait TryAlloc { ) -> Result<(), AllocFailure>; } -/// Represents a state transition in the [`BlockAllocator`] state machine. +/// Represents a state transition in the `BlockAllocator` state machine. /// /// This trait should not be used directly. Instead, consider using /// [`NextState`]. @@ -73,10 +73,10 @@ pub trait TryAlloc { /// For more info, read the module docs of /// [`crate::node::ledger::shell::block_alloc::states`]. pub trait NextStateImpl { - /// The next state in the [`BlockAllocator`] state machine. + /// The next state in the `BlockAllocator` state machine. type Next; - /// Transition to the next state in the [`BlockAllocator`] state + /// Transition to the next state in the `BlockAllocator`] state /// machine. fn next_state_impl(self) -> Self::Next; } @@ -87,7 +87,7 @@ pub trait NextStateImpl { /// For more info, read the module docs of /// [`crate::node::ledger::shell::block_alloc::states`]. pub trait NextState: NextStateImpl { - /// Transition to the next state in the [`BlockAllocator`] state, + /// Transition to the next state in the `BlockAllocator` state, /// using a null transiiton function. #[inline] fn next_state(self) -> Self::Next 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 232c84e6f2f..449539abddd 100644 --- a/crates/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/crates/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -258,109 +258,109 @@ where continue; } - let ( - mut tx_event, - mut tx_gas_meter, - mut wrapper_args, - ) = match &tx_header.tx_type { - TxType::Wrapper(wrapper) => { - stats.increment_wrapper_txs(); - let tx_event = Event::new_tx_event(&tx, height.0); - let gas_meter = TxGasMeter::new(wrapper.gas_limit); - if let Some(code_sec) = tx - .get_section(tx.code_sechash()) - .and_then(|x| Section::code_sec(x.as_ref())) - { - stats.increment_tx_type( - code_sec.code.hash().to_string(), + let (mut tx_event, mut tx_gas_meter, mut wrapper_args) = + match &tx_header.tx_type { + TxType::Wrapper(wrapper) => { + stats.increment_wrapper_txs(); + let tx_event = Event::new_tx_event(&tx, height.0); + let gas_meter = TxGasMeter::new(wrapper.gas_limit); + if let Some(code_sec) = tx + .get_section(tx.code_sechash()) + .and_then(|x| Section::code_sec(x.as_ref())) + { + stats.increment_tx_type( + code_sec.code.hash().to_string(), + ); + } + ( + tx_event, + gas_meter, + Some(WrapperArgs { + block_proposer: &native_block_proposer_address, + is_committed_fee_unshield: false, + }), + ) + } + TxType::Decrypted(_) => unreachable!(), + TxType::Raw => { + tracing::error!( + "Internal logic error: FinalizeBlock received a \ + TxType::Raw transaction" ); + continue; } - ( - tx_event, - gas_meter, - Some(WrapperArgs { - block_proposer: &native_block_proposer_address, - is_committed_fee_unshield: false, - }), - ) - } - TxType::Decrypted(_) => unreachable!(), - TxType::Raw => { - tracing::error!( - "Internal logic error: FinalizeBlock received a \ - TxType::Raw transaction" - ); - continue; - } - TxType::Protocol(protocol_tx) => match protocol_tx.tx { - ProtocolTxType::BridgePoolVext - | ProtocolTxType::BridgePool - | ProtocolTxType::ValSetUpdateVext - | ProtocolTxType::ValidatorSetUpdate => ( - Event::new_tx_event(&tx, height.0), - TxGasMeter::new_from_sub_limit(0.into()), - None, - ), - ProtocolTxType::EthEventsVext => { - let ext = + TxType::Protocol(protocol_tx) => match protocol_tx.tx { + ProtocolTxType::BridgePoolVext + | ProtocolTxType::BridgePool + | ProtocolTxType::ValSetUpdateVext + | ProtocolTxType::ValidatorSetUpdate => ( + Event::new_tx_event(&tx, height.0), + TxGasMeter::new_from_sub_limit(0.into()), + None, + ), + ProtocolTxType::EthEventsVext => { + let ext = ethereum_tx_data_variants::EthEventsVext::try_from( &tx, ) .unwrap(); - if self - .mode - .get_validator_address() - .map(|validator| { - validator == &ext.data.validator_addr - }) - .unwrap_or(false) - { - for event in ext.data.ethereum_events.iter() { - self.mode.dequeue_eth_event(event); + if self + .mode + .get_validator_address() + .map(|validator| { + validator == &ext.data.validator_addr + }) + .unwrap_or(false) + { + for event in ext.data.ethereum_events.iter() { + self.mode.dequeue_eth_event(event); + } } + ( + Event::new_tx_event(&tx, height.0), + TxGasMeter::new_from_sub_limit(0.into()), + None, + ) } - ( - Event::new_tx_event(&tx, height.0), - TxGasMeter::new_from_sub_limit(0.into()), - None, - ) - } - ProtocolTxType::EthereumEvents => { - let digest = + ProtocolTxType::EthereumEvents => { + let digest = ethereum_tx_data_variants::EthereumEvents::try_from( &tx, ).unwrap(); - if let Some(address) = - self.mode.get_validator_address().cloned() - { - let this_signer = &( - address, - self.wl_storage.storage.get_last_block_height(), - ); - for MultiSignedEthEvent { event, signers } in - &digest.events + if let Some(address) = + self.mode.get_validator_address().cloned() { - if signers.contains(this_signer) { - self.mode.dequeue_eth_event(event); + let this_signer = &( + address, + self.wl_storage + .storage + .get_last_block_height(), + ); + for MultiSignedEthEvent { event, signers } in + &digest.events + { + if signers.contains(this_signer) { + self.mode.dequeue_eth_event(event); + } } } + ( + Event::new_tx_event(&tx, height.0), + TxGasMeter::new_from_sub_limit(0.into()), + None, + ) } - ( - Event::new_tx_event(&tx, height.0), - TxGasMeter::new_from_sub_limit(0.into()), - None, - ) - } - }, - }; - let replay_protection_hashes = if matches!(tx_header.tx_type, TxType::Wrapper(_)) { - Some(ReplayProtectionHashes { - raw_header_hash: tx.raw_header_hash(), - header_hash: tx.header_hash(), - }) - } else { - None - }; + }, + }; + let replay_protection_hashes = + if matches!(tx_header.tx_type, TxType::Wrapper(_)) { + Some(ReplayProtectionHashes { + raw_header_hash: tx.raw_header_hash(), + header_hash: tx.header_hash(), + }) + } else { + None + }; let tx_result = protocol::check_tx_allowed(&tx, &self.wl_storage) .and_then(|()| { protocol::dispatch_tx( @@ -463,13 +463,16 @@ where tx_event["info"] = "Check inner_tx for result.".to_string(); tx_event["inner_tx"] = result.to_string(); } - Err(Error::TxApply(protocol::Error::WrapperRunnerError(msg))) => { + Err(Error::TxApply(protocol::Error::WrapperRunnerError( + msg, + ))) => { tracing::info!( "Wrapper transaction {} failed with: {}", tx_event["hash"], msg, ); - tx_event["gas_used"] = tx_gas_meter.get_tx_consumed_gas().to_string(); + tx_event["gas_used"] = + tx_gas_meter.get_tx_consumed_gas().to_string(); tx_event["info"] = msg.to_string(); tx_event["code"] = ResultCode::InvalidTx.into(); } @@ -487,12 +490,12 @@ where if !matches!( msg, Error::TxApply(protocol::Error::GasError(_)) - | Error::TxApply( - protocol::Error::MissingSection(_) - ) - | Error::TxApply( - protocol::Error::ReplayAttempt(_) - ) + | Error::TxApply( + protocol::Error::MissingSection(_) + ) + | Error::TxApply( + protocol::Error::ReplayAttempt(_) + ) ) { self.commit_inner_tx_hash(replay_protection_hashes); } else if let Error::TxApply( @@ -506,8 +509,7 @@ where let header_hash = replay_protection_hashes .expect("This cannot fail") .header_hash; - self.wl_storage - .delete_tx_hash(header_hash); + self.wl_storage.delete_tx_hash(header_hash); } } @@ -522,9 +524,10 @@ where tx_event["code"] = ResultCode::InvalidTx.into(); // The fee unshield operation could still have been // committed - if wrapper_args - .expect("Missing required wrapper arguments") - .is_committed_fee_unshield + if let Some(WrapperArgs { + is_committed_fee_unshield: true, + .. + }) = wrapper_args { tx_event["is_valid_masp_tx"] = format!("{}", tx_index); } @@ -720,13 +723,16 @@ where // the wrapper). Requires the wrapper transaction as argument to recover // both the hashes. fn commit_inner_tx_hash(&mut self, hashes: Option) { - if let Some(ReplayProtectionHashes {raw_header_hash, header_hash}) = hashes { + if let Some(ReplayProtectionHashes { + raw_header_hash, + header_hash, + }) = hashes + { self.wl_storage .write_tx_hash(raw_header_hash) .expect("Error while writing tx hash to storage"); - self.wl_storage - .delete_tx_hash(header_hash); + self.wl_storage.delete_tx_hash(header_hash); } } } @@ -2565,11 +2571,7 @@ mod test_finalize_block { }) .expect("Test failed")[0]; assert_eq!(event.event_type.to_string(), String::from("applied")); - let code = event - .attributes - .get("code") - .expect("Test failed") - .as_str(); + let code = event.attributes.get("code").expect("Test failed").as_str(); assert_eq!(code, String::from(ResultCode::Ok).as_str()); // the merkle tree root should not change after finalize_block @@ -2604,7 +2606,7 @@ mod test_finalize_block { fn test_duplicated_tx_same_block() { let (mut shell, _, _, _) = setup(); let keypair = crate::wallet::defaults::albert_keypair(); - let keypair_2 = crate::wallet::defaults::bertha_keypair(); + let keypair_2 = crate::wallet::defaults::bertha_keypair(); let tx_code = TestWasms::TxNoOp.read_bytes(); let mut wrapper = @@ -2707,7 +2709,9 @@ mod test_finalize_block { let mut wrapper_tx = Tx::from_type(TxType::Wrapper(Box::new(WrapperTx::new( Fee { - amount_per_gas_unit: DenominatedAmount::native(1.into()), + amount_per_gas_unit: DenominatedAmount::native( + 1.into(), + ), token: shell.wl_storage.storage.native_token.clone(), }, keypair.ref_to(), @@ -2775,7 +2779,9 @@ mod test_finalize_block { let mut wrong_commitment_wrapper = failing_wrapper.clone(); let tx_code = TestWasms::TxInvalidData.read_bytes(); wrong_commitment_wrapper.set_code(Code::new(tx_code, None)); - wrong_commitment_wrapper.sections.retain(|sec| !matches!(sec, Section::Data(_))); + wrong_commitment_wrapper + .sections + .retain(|sec| !matches!(sec, Section::Data(_))); // Add some extra data to avoid having the same Tx hash as the // `failing_wrapper` wrong_commitment_wrapper.add_memo(&[0_u8]); @@ -2786,7 +2792,11 @@ mod test_finalize_block { &mut wrong_commitment_wrapper, &mut failing_wrapper, ] { - tx.sign_raw(vec![keypair.clone()], vec![keypair.ref_to()].into_iter().collect(), None); + tx.sign_raw( + vec![keypair.clone()], + vec![keypair.ref_to()].into_iter().collect(), + None, + ); } for tx in [ &mut out_of_gas_wrapper, diff --git a/crates/apps/src/lib/node/ledger/shell/process_proposal.rs b/crates/apps/src/lib/node/ledger/shell/process_proposal.rs index bfb1b2d90e7..05e43ee154e 100644 --- a/crates/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/crates/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -422,12 +422,12 @@ where // resources (ABCI only) // Account for the tx's resources even in case of an error. - let allocated_gas = metadata - .user_gas - .try_dump(u64::from(wrapper.gas_limit)); + let allocated_gas = + metadata.user_gas.try_dump(u64::from(wrapper.gas_limit)); let mut tx_gas_meter = TxGasMeter::new(wrapper.gas_limit); - if tx_gas_meter.add_wrapper_gas(tx_bytes).is_err() || allocated_gas.is_err() { - + if tx_gas_meter.add_wrapper_gas(tx_bytes).is_err() + || allocated_gas.is_err() + { return TxResult { code: ResultCode::TxGasLimit.into(), info: "Wrapper transactions exceeds its gas limit" diff --git a/crates/apps/src/lib/node/ledger/shell/testing/node.rs b/crates/apps/src/lib/node/ledger/shell/testing/node.rs index b7c7bf10151..d68b6ad9dae 100644 --- a/crates/apps/src/lib/node/ledger/shell/testing/node.rs +++ b/crates/apps/src/lib/node/ledger/shell/testing/node.rs @@ -488,7 +488,6 @@ impl MockNode { /// Send a tx through Process Proposal and Finalize Block /// and register the results. fn submit_txs(&self, txs: Vec>) { - self.finalize_and_commit(); let (proposer_address, votes) = self.prepare_request(); diff --git a/crates/apps/src/lib/node/ledger/storage/rocksdb.rs b/crates/apps/src/lib/node/ledger/storage/rocksdb.rs index 545d7030183..f8b6e712704 100644 --- a/crates/apps/src/lib/node/ledger/storage/rocksdb.rs +++ b/crates/apps/src/lib/node/ledger/storage/rocksdb.rs @@ -511,10 +511,9 @@ impl RocksDB { // restarting the chain tracing::info!("Reverting non-height-prepended metadata keys"); batch.put_cf(state_cf, "height", types::encode(&previous_height)); - for metadata_key in [ - "next_epoch_min_start_height", - "next_epoch_min_start_time", - ] { + for metadata_key in + ["next_epoch_min_start_height", "next_epoch_min_start_time"] + { let previous_key = format!("pred/{}", metadata_key); let previous_value = self .0 diff --git a/crates/namada/src/ledger/protocol/mod.rs b/crates/namada/src/ledger/protocol/mod.rs index 5d43c382dd9..c98837890bd 100644 --- a/crates/namada/src/ledger/protocol/mod.rs +++ b/crates/namada/src/ledger/protocol/mod.rs @@ -196,7 +196,8 @@ where tx_wasm_cache, }, wrapper_args, - ).map_err(|e| Error::WrapperRunnerError(e.to_string()))?; + ) + .map_err(|e| Error::WrapperRunnerError(e.to_string()))?; let mut inner_res = apply_wasm_tx( tx, &tx_index, @@ -1312,15 +1313,15 @@ mod tests { #[test] fn test_apply_wasm_tx_allowlist() { + use namada_core::types::address::nam; use namada_core::types::key::{common, RefTo}; use namada_core::types::storage::Epoch; - use namada_core::types::address::nam; use namada_core::types::token::DenominatedAmount; use namada_tx::data::Fee; let (mut wl_storage, _validators) = test_utils::setup_default_storage(); let keypair: common::SecretKey = { - use namada_core::types::key::{ed25519, SigScheme, SecretKey}; + use namada_core::types::key::{ed25519, SecretKey, SigScheme}; use rand::prelude::ThreadRng; use rand::thread_rng; diff --git a/crates/sdk/src/masp.rs b/crates/sdk/src/masp.rs index 18d9d6a49e3..e0e9e0d1a38 100644 --- a/crates/sdk/src/masp.rs +++ b/crates/sdk/src/masp.rs @@ -816,31 +816,29 @@ impl ShieldedContext { ) -> Result { // We use the changed keys instead of the Transfer object // because those are what the masp validity predicate works on - let ( - wrapper_changed_keys, - changed_keys, - ) = if let ExtractShieldedActionArg::Event(tx_event) = action_arg { - let tx_result_str = tx_event - .attributes - .iter() - .find_map(|attr| { - if attr.key == "inner_tx" { - Some(&attr.value) - } else { - None - } - }) - .ok_or_else(|| { - Error::Other( - "Missing required tx result in event".to_string(), - ) - })?; - let result = TxResult::from_str(tx_result_str) - .map_err(|e| Error::Other(e.to_string()))?; - (result.wrapper_changed_keys, result.changed_keys) - } else { - (Default::default(), Default::default()) - }; + let (wrapper_changed_keys, changed_keys) = + if let ExtractShieldedActionArg::Event(tx_event) = action_arg { + let tx_result_str = tx_event + .attributes + .iter() + .find_map(|attr| { + if attr.key == "inner_tx" { + Some(&attr.value) + } else { + None + } + }) + .ok_or_else(|| { + Error::Other( + "Missing required tx result in event".to_string(), + ) + })?; + let result = TxResult::from_str(tx_result_str) + .map_err(|e| Error::Other(e.to_string()))?; + (result.wrapper_changed_keys, result.changed_keys) + } else { + (Default::default(), Default::default()) + }; let tx_header = tx.header(); // NOTE: simply looking for masp sections attached to the tx diff --git a/crates/state/src/write_log.rs b/crates/state/src/write_log.rs index bcf7846dd27..7eb52dbfb76 100644 --- a/crates/state/src/write_log.rs +++ b/crates/state/src/write_log.rs @@ -689,8 +689,7 @@ impl WriteLog { /// Remove the transaction hash pub(crate) fn delete_tx_hash(&mut self, hash: Hash) { - self - .replay_protection + self.replay_protection .insert(hash, ReProtStorageModification::Delete); } @@ -984,8 +983,7 @@ mod tests { .unwrap(); // delete previous hash - write_log - .delete_tx_hash(Hash::sha256("tx1".as_bytes())); + write_log.delete_tx_hash(Hash::sha256("tx1".as_bytes())); // finalize previous hashes for tx in ["tx2", "tx3"] { @@ -1014,8 +1012,7 @@ mod tests { ); // try to delete finalized hash which shouldn't work - write_log - .delete_tx_hash(Hash::sha256("tx2".as_bytes())); + write_log.delete_tx_hash(Hash::sha256("tx2".as_bytes())); // commit a block write_log diff --git a/crates/tests/src/e2e/eth_bridge_tests.rs b/crates/tests/src/e2e/eth_bridge_tests.rs index b1ea2636f59..ea3d8851575 100644 --- a/crates/tests/src/e2e/eth_bridge_tests.rs +++ b/crates/tests/src/e2e/eth_bridge_tests.rs @@ -46,9 +46,7 @@ use crate::e2e::setup::constants::{ ALBERT, ALBERT_KEY, BERTHA, BERTHA_KEY, NAM, }; use crate::e2e::setup::{Bin, Who}; -use crate::strings::{ - LEDGER_STARTED, TX_ACCEPTED, TX_APPLIED_SUCCESS, VALIDATOR_NODE, -}; +use crate::strings::{LEDGER_STARTED, TX_APPLIED_SUCCESS, VALIDATOR_NODE}; use crate::{run, run_as}; /// # Examples @@ -828,7 +826,6 @@ async fn test_wdai_transfer_established_unauthorized() -> Result<()> { &bertha_addr.to_string(), &token::DenominatedAmount::new(token::Amount::from(10_000), 0u8.into()), )?; - cmd.exp_string(TX_ACCEPTED)?; cmd.exp_string(TX_REJECTED)?; cmd.assert_success(); diff --git a/crates/tests/src/e2e/helpers.rs b/crates/tests/src/e2e/helpers.rs index 8a24b1f3040..564b2fa6070 100644 --- a/crates/tests/src/e2e/helpers.rs +++ b/crates/tests/src/e2e/helpers.rs @@ -36,7 +36,7 @@ use super::setup::{ ENV_VAR_USE_PREBUILT_BINARIES, }; use crate::e2e::setup::{Bin, Who, APPS_PACKAGE}; -use crate::strings::{LEDGER_STARTED, TX_ACCEPTED, TX_APPLIED_SUCCESS}; +use crate::strings::{LEDGER_STARTED, TX_APPLIED_SUCCESS}; use crate::{run, run_as}; /// Instantiate a new [`HttpClient`] to perform RPC requests with. @@ -100,7 +100,6 @@ pub fn init_established_account( rpc_addr, ]; let mut cmd = run!(test, Bin::Client, init_account_args, Some(40))?; - cmd.exp_string(TX_ACCEPTED)?; cmd.exp_string(TX_APPLIED_SUCCESS)?; cmd.assert_success(); Ok(()) diff --git a/crates/tests/src/e2e/ibc_tests.rs b/crates/tests/src/e2e/ibc_tests.rs index 4cd825b8c81..ffa55a65b3f 100644 --- a/crates/tests/src/e2e/ibc_tests.rs +++ b/crates/tests/src/e2e/ibc_tests.rs @@ -96,7 +96,7 @@ use crate::e2e::setup::{ self, run_hermes_cmd, setup_hermes, sleep, Bin, NamadaCmd, Test, Who, }; use crate::strings::{ - LEDGER_STARTED, TX_ACCEPTED, TX_APPLIED_SUCCESS, TX_FAILED, VALIDATOR_NODE, + LEDGER_STARTED, TX_APPLIED_SUCCESS, TX_FAILED, VALIDATOR_NODE, }; use crate::{run, run_as}; @@ -187,7 +187,7 @@ fn run_ledger_ibc() -> Result<()> { } #[test] -fn run_ledger_ibc_with_hermes() -> Result<()> { +fn drun_ledger_ibc_with_hermes() -> Result<()> { let update_genesis = |mut genesis: templates::All, base_dir: &_| { genesis.parameters.parameters.epochs_per_year = 31536; @@ -1131,7 +1131,6 @@ fn transfer_on_chain( &rpc, ]; let mut client = run!(test, Bin::Client, tx_args, Some(40))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -1539,7 +1538,6 @@ fn delegate_token(test: &Test) -> Result<()> { &rpc, ]; let mut client = run!(test, Bin::Client, tx_args, Some(40))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); Ok(()) @@ -1587,7 +1585,6 @@ fn propose_funding( &rpc_a, ]; let mut client = run!(test_a, Bin::Client, submit_proposal_args, Some(40))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); Ok(start_epoch.into()) @@ -1615,7 +1612,6 @@ fn submit_votes(test: &Test) -> Result<()> { submit_proposal_vote, Some(40) )?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -1633,7 +1629,6 @@ fn submit_votes(test: &Test) -> Result<()> { ]; let mut client = run!(test, Bin::Client, submit_proposal_vote_delagator, Some(40))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); Ok(()) diff --git a/crates/tests/src/e2e/ledger_tests.rs b/crates/tests/src/e2e/ledger_tests.rs index a713314c6cd..e2cd60a088a 100644 --- a/crates/tests/src/e2e/ledger_tests.rs +++ b/crates/tests/src/e2e/ledger_tests.rs @@ -57,8 +57,8 @@ use crate::e2e::setup::{ Who, }; use crate::strings::{ - LEDGER_SHUTDOWN, LEDGER_STARTED, NON_VALIDATOR_NODE, TX_ACCEPTED, - TX_APPLIED_SUCCESS, TX_FAILED, TX_REJECTED, VALIDATOR_NODE, + LEDGER_SHUTDOWN, LEDGER_STARTED, NON_VALIDATOR_NODE, TX_APPLIED_SUCCESS, + TX_FAILED, TX_REJECTED, VALIDATOR_NODE, }; use crate::{run, run_as}; @@ -581,10 +581,6 @@ fn ledger_txs_and_queries() -> Result<()> { tx_args.clone() }; let mut client = run!(test, Bin::Client, tx_args, Some(40))?; - - if !dry_run { - client.exp_string(TX_ACCEPTED)?; - } client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); } @@ -739,7 +735,6 @@ fn wrapper_disposable_signer() -> Result<()> { ]; let mut client = run!(test, Bin::Client, tx_args, Some(720))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; let _ep1 = epoch_sleep(&test, &validator_one_rpc, 720)?; @@ -761,7 +756,6 @@ fn wrapper_disposable_signer() -> Result<()> { ]; let mut client = run!(test, Bin::Client, tx_args, Some(720))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; let _ep1 = epoch_sleep(&test, &validator_one_rpc, 720)?; let tx_args = vec![ @@ -837,7 +831,6 @@ fn invalid_transactions() -> Result<()> { ]; let mut client = run!(test, Bin::Client, tx_args, Some(40))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_REJECTED)?; client.assert_success(); @@ -889,7 +882,6 @@ fn invalid_transactions() -> Result<()> { ]; let mut client = run!(test, Bin::Client, tx_args, Some(40))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_FAILED)?; client.assert_success(); Ok(()) @@ -1736,7 +1728,6 @@ fn ledger_many_txs_in_a_block() -> Result<()> { let mut args = (*tx_args).clone(); args.push(&*validator_one_rpc); let mut client = run!(*test, Bin::Client, args, Some(80))?; - client.exp_string(TX_ACCEPTED)?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); let res: Result<()> = Ok(()); @@ -3237,6 +3228,13 @@ fn deactivate_and_reactivate_validator() -> Result<()> { ethereum_bridge::ledger::Mode::Off, None, ); + set_ethereum_bridge_mode( + &test, + &test.net.chain_id, + Who::Validator(1), + ethereum_bridge::ledger::Mode::Off, + None, + ); // 1. Run the ledger node let _bg_validator_0 = @@ -3749,6 +3747,7 @@ fn change_consensus_key() -> Result<()> { Ok(()) } + #[test] fn proposal_change_shielded_reward() -> Result<()> { let test = setup::network( diff --git a/crates/tests/src/strings.rs b/crates/tests/src/strings.rs index f0b1f8ea826..0a9223dcc50 100644 --- a/crates/tests/src/strings.rs +++ b/crates/tests/src/strings.rs @@ -21,9 +21,6 @@ pub const TX_REJECTED: &str = "Transaction was rejected by VPs"; /// Inner transaction failed in execution (no VPs ran). pub const TX_FAILED: &str = "Transaction failed"; -/// Wrapper transaction accepted. -pub const TX_ACCEPTED: &str = "Wrapper transaction accepted"; - pub const WALLET_HD_PASSPHRASE_PROMPT: &str = "Enter BIP39 passphrase (empty for none): ";