Skip to content

Commit

Permalink
stash commit
Browse files Browse the repository at this point in the history
  • Loading branch information
moCello committed Aug 21, 2024
1 parent 242cf56 commit 8c6a7de
Show file tree
Hide file tree
Showing 9 changed files with 424 additions and 655 deletions.
33 changes: 16 additions & 17 deletions execution-core/src/transfer/phoenix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ impl Transaction {
value_commitment(transfer_value, transfer_value_blinder);
let transfer_note_sender_enc = match transfer_note.sender() {
Sender::Encryption(enc) => enc,
Sender::ContractInfo(_) => panic!("The sender is encrypted"),
Sender::ContractInfo(_) => unreachable!("The sender is encrypted"),
};
let change_value_commitment =
value_commitment(change_value, change_value_blinder);
let change_note_sender_enc = match change_note.sender() {
Sender::Encryption(enc) => enc,
Sender::ContractInfo(_) => panic!("The sender is encrypted"),
Sender::ContractInfo(_) => unreachable!("The sender is encrypted"),
};
let output_notes_info = [
OutputNoteInfo {
Expand Down Expand Up @@ -246,23 +246,22 @@ impl Transaction {
let schnorr_sk_b = SchnorrSecretKey::from(sender_sk.b());
let sig_b = schnorr_sk_b.sign(rng, payload_hash);

let circuit_bytes = TxCircuitVec {
input_notes_info,
output_notes_info,
payload_hash,
root,
deposit,
max_fee,
sender_pk,
signatures: (sig_a, sig_b),
}
.to_var_bytes();

Self {
payload,
proof: P::prove(&circuit_bytes[..]).expect(
"The proof generation shouldn't fail with a valid circuit",
),
proof: P::prove(
&TxCircuitVec {
input_notes_info,
output_notes_info,
payload_hash,
root,
deposit,
max_fee,
sender_pk,
signatures: (sig_a, sig_b),
}
.to_var_bytes(),
)
.expect("The proof generation shouldn't fail with a valid circuit"),
}
}

Expand Down
19 changes: 11 additions & 8 deletions rusk-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ edition = "2021"
autobins = false

[dependencies]
dusk-bytes = { version = "0.1" }
poseidon-merkle = { version = "0.7", features = ["rkyv-impl"] }
rand_core = "0.6"
# poseidon-merkle = { version = "0.7", features = ["rkyv-impl"] }
# rand_core = "0.6"

rkyv = { version = "0.7", default-features = false, features = ["size_32"] }
bytecheck = { version = "0.6", default-features = false }
# rkyv = { version = "0.7", default-features = false, features = ["size_32"] }
# bytecheck = { version = "0.6", default-features = false }

execution-core = { version = "0.1.0", path = "../execution-core" }

## feature local_prover
once_cell = { version = "1.9", optional = true }
rand = { version = "0.8", optional = true }
dusk-bytes = { version = "0.1", optional = true }
dusk-plonk = { version = "0.20", default-features = false, features = ["rkyv-impl", "alloc"], optional = true }
rusk-profile = { version = "0.6", path = "../rusk-profile", optional = true }
execution-core = { version = "0.1.0", path = "../execution-core", optional = true }

[dev-dependencies]
hex = "0.4"
Expand All @@ -27,13 +28,15 @@ rand = "0.8"
[features]
default = ["local_prover"]
local_prover = [
"execution-core/zk",
"once_cell",
"rand",
"dusk-bytes",
"dusk-plonk",
"rusk-profile",
"execution-core",
"std",
]
no_random = []
std = [
"execution-core/std"
"dusk-plonk/std"
]
13 changes: 5 additions & 8 deletions rusk-prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ extern crate std;
mod errors;
// mod tx;

// use execution_core::transfer::phoenix::{
// Prove, Transaction as PhoenixTransaction,
// };

pub use errors::ProverError;

#[cfg(feature = "local_prover")]
Expand All @@ -25,12 +21,13 @@ pub use local_prover::LocalProver;
#[cfg(feature = "local_prover")]
mod local_prover {
use dusk_bytes::{Error as BytesError, Serializable};
use execution_core::{
plonk::Prover as PlonkProver,
transfer::phoenix::{Prove, TxCircuit, TxCircuitVec, NOTES_TREE_DEPTH},
};
use dusk_plonk::prelude::Prover as PlonkProver;
use once_cell::sync::Lazy;

use execution_core::transfer::phoenix::{
Prove, TxCircuit, TxCircuitVec, NOTES_TREE_DEPTH,
};

use crate::ProverError;

static TX_CIRCUIT_1_2_PROVER: Lazy<PlonkProver> =
Expand Down
4 changes: 2 additions & 2 deletions test-wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ sha2 = { version = "^0.10", default-features = false }
dusk-bytes = "^0.1"
poseidon-merkle = { version = "0.7", features = ["rkyv-impl"] }
rkyv = { version = "0.7", default-features = false }
rusk-prover = { version = "0.3.0", path = "../rusk-prover", default-features = false }
ff = { version = "0.13", default-features = false }
wallet-core = { version = "0.1", path = "../wallet-core/" }
zeroize = { version = "1", default-features = false, features = ["derive"] }

# rusk dependencies
execution-core = { version = "0.1.0", path = "../execution-core" }
wallet-core = { version = "0.1", path = "../wallet-core/" }

[dev-dependencies]
rand = "^0.8"
Expand Down
Loading

0 comments on commit 8c6a7de

Please sign in to comment.