diff --git a/rusk/src/lib/lib.rs b/rusk/src/lib/lib.rs index 64c1713c1c..c435788525 100644 --- a/rusk/src/lib/lib.rs +++ b/rusk/src/lib/lib.rs @@ -189,23 +189,23 @@ impl Rusk { }); } Err(_) => { - let root = hex::encode(session.root()); - println!("UNSPENDABLE ; Resulting root: {root}"); - - let mut new_session = new_genesis_session(&inner.vm); - mem::swap(&mut session, &mut new_session); - - let commited_root = new_session.commit()?; - let commited_root_hex = hex::encode(commited_root); - println!( - "Commited root after UNSPENDABLE: {commited_root_hex}" - ); - - session = rusk_abi::new_session( - &inner.vm, - commited_root, - block_height, - )?; + // let root = hex::encode(session.root()); + // println!("UNSPENDABLE ; Resulting root: {root}"); + + // let mut new_session = new_genesis_session(&inner.vm); + // mem::swap(&mut session, &mut new_session); + + // let commited_root = new_session.commit()?; + // let commited_root_hex = hex::encode(commited_root); + // println!( + // "Commited root after UNSPENDABLE: {commited_root_hex}" + // ); + + // session = rusk_abi::new_session( + // &inner.vm, + // commited_root, + // block_height, + // )?; // An unspendable transaction should be discarded discarded_txs.push(unspent_tx); diff --git a/rusk/tests/services/unspendable.rs b/rusk/tests/services/unspendable.rs index a7ab46a060..caee81de64 100644 --- a/rusk/tests/services/unspendable.rs +++ b/rusk/tests/services/unspendable.rs @@ -122,6 +122,23 @@ fn make_transactions( ) .expect("Making the transaction should succeed"); + + // The second transaction will also be a `wallet.execute` to the transfer + // contract, but with no enough gas to spend. Transaction should be + // discarded + let tx_1_bis = wallet + .execute( + &mut rng, + TRANSFER_CONTRACT.to_bytes().into(), + String::from("root"), + (), + SENDER_INDEX_1, + &refund_1, + GAS_LIMIT_1, + 1, + ) + .expect("Making the transaction should succeed"); + // The third transaction transaction will also be a `wallet.execute` to the // transfer contract, querying for the root of the tree. This will be // tested for gas cost. @@ -143,6 +160,20 @@ fn make_transactions( executed: 2, }; + let spent_transactions = generator_procedure( + rusk, + &[tx_0.clone(), tx_1_bis.clone(), tx_2.clone()], + BLOCK_HEIGHT, + BLOCK_GAS_LIMIT, + Some(expected), + ); + // .expect("generator procedure should succeed"); + + let expected = ExecuteResult { + discarded: 1, + executed: 2, + }; + let spent_transactions = generator_procedure( rusk, &[tx_0, tx_1, tx_2],