diff --git a/rusk/src/lib/chain/rusk.rs b/rusk/src/lib/chain/rusk.rs index 80e3f43f88..577350e572 100644 --- a/rusk/src/lib/chain/rusk.rs +++ b/rusk/src/lib/chain/rusk.rs @@ -112,7 +112,7 @@ impl Rusk { } } let tx_id = hex::encode(unspent_tx.id()); - if unspent_tx.inner.payload().fee().gas_limit > block_gas_left { + if unspent_tx.inner.payload().fee.gas_limit > block_gas_left { info!("Skipping {tx_id} due gas_limit greater than left: {block_gas_left}"); continue; } diff --git a/rusk/src/lib/chain/vm.rs b/rusk/src/lib/chain/vm.rs index c24d1ec7e6..34af3373f7 100644 --- a/rusk/src/lib/chain/vm.rs +++ b/rusk/src/lib/chain/vm.rs @@ -100,7 +100,7 @@ impl VMExecution for Rusk { info!("Received preverify request"); let tx = &tx.inner; let existing_nullifiers = self - .existing_nullifiers(&tx.payload().tx_skeleton().nullifiers) + .existing_nullifiers(&tx.payload().tx_skeleton.nullifiers) .map_err(|e| anyhow::anyhow!("Cannot check nullifiers: {e}"))?; if !existing_nullifiers.is_empty() { diff --git a/rusk/src/lib/http/chain/graphql.rs b/rusk/src/lib/http/chain/graphql.rs index c7e2612b0c..83411ccf98 100644 --- a/rusk/src/lib/http/chain/graphql.rs +++ b/rusk/src/lib/http/chain/graphql.rs @@ -83,7 +83,7 @@ impl Query { t.0.inner .inner .payload() - .contract_call() + .contract_call .as_ref() .map(|c| c.contract) .unwrap_or( diff --git a/rusk/src/lib/http/chain/graphql/data.rs b/rusk/src/lib/http/chain/graphql/data.rs index e847df13c6..23135de382 100644 --- a/rusk/src/lib/http/chain/graphql/data.rs +++ b/rusk/src/lib/http/chain/graphql/data.rs @@ -249,24 +249,24 @@ impl Transaction<'_> { let mut map = Map::new(); map.insert( "root".into(), - json!(hex::encode(tx.payload().tx_skeleton().root.to_bytes())), + json!(hex::encode(tx.payload().tx_skeleton.root.to_bytes())), ); let nullifiers: Vec<_> = tx .payload() - .tx_skeleton() - .nullifiers() + .tx_skeleton + .nullifiers .iter() .map(|n| hex::encode(n.to_bytes())) .collect(); map.insert("nullifier".into(), json!(nullifiers)); map.insert( "deposit".into(), - json!(hex::encode(tx.payload().tx_skeleton().deposit.to_bytes())), + json!(hex::encode(tx.payload().tx_skeleton.deposit.to_bytes())), ); let notes: Vec<_> = tx .payload() - .tx_skeleton() - .outputs() + .tx_skeleton + .outputs .iter() .map(|n| { let mut map = Map::new(); @@ -301,22 +301,20 @@ impl Transaction<'_> { map.insert("notes".into(), json!(notes)); let mut fee = Map::new(); - fee.insert("gas_limit".into(), json!(tx.payload().fee().gas_limit)); - fee.insert("gas_price".into(), json!(tx.payload().fee().gas_price)); + fee.insert("gas_limit".into(), json!(tx.payload().fee.gas_limit)); + fee.insert("gas_price".into(), json!(tx.payload().fee.gas_price)); fee.insert( "stealth_address".into(), - json!(bs58::encode( - tx.payload().fee().stealth_address().to_bytes() - ) - .into_string()), + json!(bs58::encode(tx.payload().fee.stealth_address.to_bytes()) + .into_string()), ); fee.insert( "sender".into(), - json!(hex::encode(tx.payload().fee().sender().to_bytes())), + json!(hex::encode(tx.payload().fee.sender.to_bytes())), ); map.insert("fee".into(), json!(fee)); - if let Some(c) = tx.payload().contract_call() { + if let Some(c) = &tx.payload().contract_call { let mut call = Map::new(); call.insert("contract".into(), json!(hex::encode(c.contract))); call.insert("fn_name".into(), json!(&c.fn_name)); @@ -332,18 +330,18 @@ impl Transaction<'_> { } pub async fn gas_limit(&self) -> u64 { - self.0.inner.payload().fee().gas_limit + self.0.inner.payload().fee.gas_limit } pub async fn gas_price(&self) -> u64 { - self.0.inner.payload().fee().gas_price + self.0.inner.payload().fee.gas_price } pub async fn call_data(&self) -> Option { self.0 .inner .payload() - .contract_call() + .contract_call .as_ref() .map(|call| CallData { contract: hex::encode(call.contract), diff --git a/rusk/src/lib/verifier.rs b/rusk/src/lib/verifier.rs index 41575641b1..743f44ffda 100644 --- a/rusk/src/lib/verifier.rs +++ b/rusk/src/lib/verifier.rs @@ -45,7 +45,7 @@ pub fn verify_proof(tx: &Transaction) -> Result { // Maybe we want to handle internal serialization error too, currently // they map to `false`. - Ok(rusk_abi::verify_proof(vd.to_vec(), tx.proof().clone(), pi)) + Ok(rusk_abi::verify_proof(vd.to_vec(), tx.proof().to_vec(), pi)) } fn fetch_verifier(circuit_name: &str) -> Vec { diff --git a/rusk/tests/services/multi_transfer.rs b/rusk/tests/services/multi_transfer.rs index c190ea218f..cc0c722bd1 100644 --- a/rusk/tests/services/multi_transfer.rs +++ b/rusk/tests/services/multi_transfer.rs @@ -122,14 +122,14 @@ fn wallet_transfer( .get_balance(0) .expect("Failed to get the balance") .value; - let fee_0 = txs[0].payload().fee(); + let fee_0 = txs[0].payload().fee; let fee_0 = fee_0.gas_limit * fee_0.gas_price; let final_balance_1 = wallet .get_balance(1) .expect("Failed to get the balance") .value; - let fee_1 = txs[1].payload().fee(); + let fee_1 = txs[1].payload().fee; let fee_1 = fee_1.gas_limit * fee_1.gas_price; assert!( diff --git a/rusk/tests/services/transfer.rs b/rusk/tests/services/transfer.rs index cd1c56a0b4..fd03041cf8 100644 --- a/rusk/tests/services/transfer.rs +++ b/rusk/tests/services/transfer.rs @@ -117,7 +117,7 @@ fn wallet_transfer( .get_balance(0) .expect("Failed to get the balance") .value; - let fee = tx.inner.inner.payload().fee(); + let fee = tx.inner.inner.payload().fee; let fee = gas_spent * fee.gas_price; assert_eq!(