diff --git a/CHANGELOG.md b/CHANGELOG.md index 79658ede6..d835030c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.6.0 (TBD) +- [BREAKING] Changed `TransactionProver` trait to be `maybe_async_trait` based on the `async` feature (#913). - [BREAKING] Changed `TransactionExecutor` and `TransactionHost` to use trait objects (#897). - Implemented kernel procedure to set transaction expiration block delta (#897). - Created a proving service that receives `TransactionWitness` and returns the proof using gRPC (#881). diff --git a/miden-tx/src/prover/mod.rs b/miden-tx/src/prover/mod.rs index 85dfabc12..12085f5d5 100644 --- a/miden-tx/src/prover/mod.rs +++ b/miden-tx/src/prover/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "async")] +use alloc::boxed::Box; use alloc::{sync::Arc, vec::Vec}; use miden_lib::transaction::TransactionKernel; @@ -8,7 +10,7 @@ use miden_objects::{ use miden_prover::prove; pub use miden_prover::ProvingOptions; use vm_processor::MemAdviceProvider; -use winter_maybe_async::maybe_async; +use winter_maybe_async::*; use super::{TransactionHost, TransactionProverError}; use crate::executor::TransactionMastStore; @@ -18,6 +20,7 @@ use crate::executor::TransactionMastStore; /// The [TransactionProver] trait defines the interface that transaction witness objects use to /// prove transactions and generate a [ProvenTransaction]. +#[maybe_async_trait] pub trait TransactionProver { /// Proves the provided transaction and returns a [ProvenTransaction]. /// @@ -28,7 +31,7 @@ pub trait TransactionProver { #[maybe_async] fn prove( &self, - transaction: impl Into, + tx_witness: TransactionWitness, ) -> Result; } @@ -64,13 +67,13 @@ impl Default for LocalTransactionProver { } } +#[maybe_async_trait] impl TransactionProver for LocalTransactionProver { #[maybe_async] fn prove( &self, - transaction: impl Into, + tx_witness: TransactionWitness, ) -> Result { - let tx_witness: TransactionWitness = transaction.into(); let TransactionWitness { tx_inputs, tx_args, advice_witness } = tx_witness; let account = tx_inputs.account(); diff --git a/miden-tx/src/tests/mod.rs b/miden-tx/src/tests/mod.rs index 2963c7195..6c428ed1f 100644 --- a/miden-tx/src/tests/mod.rs +++ b/miden-tx/src/tests/mod.rs @@ -823,7 +823,7 @@ fn prove_witness_and_verify() { let proof_options = ProvingOptions::default(); let prover = LocalTransactionProver::new(proof_options); - let proven_transaction = prover.prove(executed_transaction).unwrap(); + let proven_transaction = prover.prove(executed_transaction.into()).unwrap(); assert_eq!(proven_transaction.id(), executed_transaction_id); diff --git a/miden-tx/tests/integration/main.rs b/miden-tx/tests/integration/main.rs index 5f4d58d16..cd636113e 100644 --- a/miden-tx/tests/integration/main.rs +++ b/miden-tx/tests/integration/main.rs @@ -34,7 +34,7 @@ pub fn prove_and_verify_transaction( let proof_options = ProvingOptions::default(); let prover = LocalTransactionProver::new(proof_options); - let proven_transaction = prover.prove(executed_transaction).unwrap(); + let proven_transaction = prover.prove(executed_transaction.into()).unwrap(); assert_eq!(proven_transaction.id(), executed_transaction_id);