Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded to latest plonk, rusk, citadel and rest of the stack #25

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ moat-core={ path = "../moat-core" }
license-provider = { path = "../license-provider" }

[dev-dependencies]
dusk-wallet = "0.18"
zk-citadel = "0.4"
phoenix-core = { version = "0.20.0-rc.0", features = ["alloc"] }
poseidon-merkle = { version = "0.2.1-rc.0", features = ["rkyv-impl"] }
dusk-pki = { version = "0.12", default-features = false, features = ["rkyv-impl"] }
dusk-plonk = { version = "0.14", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-bls12_381 = "0.11"
dusk-wallet = "0.20.0-rc.0"
zk-citadel = "0.5"
phoenix-core = { version = "0.21", features = ["alloc"] }
poseidon-merkle = { version = "0.3", features = ["rkyv-impl"] }
dusk-pki = { version = "0.13", default-features = false, features = ["rkyv-impl"] }
dusk-plonk = { version = "0.16", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-bls12_381 = "0.12"
wallet-accessor = { path = "../wallet-accessor" }
rkyv = { version = "=0.7.39" }
tokio = { version = "1.15", features = ["rt-multi-thread", "time", "fs", "macros"] }
Expand Down
17 changes: 10 additions & 7 deletions integration-tests/tests/citadel/int_test_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use bytecheck::CheckBytes;
use bytes::Bytes;
use dusk_bls12_381::BlsScalar;
use dusk_bytes::{DeserializableSlice, Serializable};
use dusk_bytes::DeserializableSlice;
use dusk_pki::{PublicSpendKey, SecretSpendKey};
use dusk_plonk::prelude::*;
use dusk_wallet::{RuskHttpClient, WalletPath};
Expand Down Expand Up @@ -142,12 +142,14 @@ async fn prove_and_send_use_license(
verifier
.verify(&proof, &public_inputs)
.expect("Verifying the circuit should succeed");
info!("proof validated locally");

let use_license_arg = UseLicenseArg {
proof,
public_inputs,
};

info!("calling license contract's use_license");
let tx_id = PayloadSender::execute_contract_method(
use_license_arg,
&blockchain_config,
Expand Down Expand Up @@ -243,10 +245,11 @@ async fn user_round_trip() -> Result<(), Error> {
// initialize
// NOTE: it is important that the seed is the same as in the recovery
// PUB_PARAMS initialization code
let rng = &mut StdRng::seed_from_u64(0xbeef);
let mut rng = StdRng::seed_from_u64(0xbeef);

info!("performing setup");
let pp = PublicParameters::setup(1 << CAPACITY, rng).unwrap();
let pp = PublicParameters::setup(1 << CAPACITY, &mut rng)
.expect("Initializing public parameters should succeed");

info!("compiling circuit");
let (prover, verifier) = Compiler::compile::<LicenseCircuit>(&pp, LABEL)
Expand Down Expand Up @@ -279,7 +282,7 @@ async fn user_round_trip() -> Result<(), Error> {
let request = RequestCreator::create_from_hex_args(
request_json.user_ssk,
request_json.provider_psk,
rng,
&mut rng,
)?;

// as a User, submit request to blockchain
Expand All @@ -297,7 +300,7 @@ async fn user_round_trip() -> Result<(), Error> {

// as a LP, retrieve request from blockchain
info!("retrieving request from blockchain (as an LP)");
let tx_id = format!("{:X}", tx_id);
let tx_id = hex::encode(tx_id.to_bytes());
let request: Request =
PayloadRetriever::retrieve_payload(tx_id, &client).await?;

Expand All @@ -309,7 +312,7 @@ async fn user_round_trip() -> Result<(), Error> {
&blockchain_config,
&wallet_path,
&request,
rng,
&mut rng,
)
.await?;
show_state(&client, "after issue_license").await?;
Expand Down Expand Up @@ -358,7 +361,7 @@ async fn user_round_trip() -> Result<(), Error> {
&verifier,
&license,
opening.unwrap(),
rng,
&mut rng,
&challenge,
)
.await?;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/citadel/send_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async fn send_request() -> Result<(), Error> {
let client = RuskHttpClient::new(config.rusk_address);
TxAwaiter::wait_for(&client, tx_id).await?;

let tx_id_hex = format!("{:x}", tx_id);
let tx_id_hex = hex::encode(tx_id.to_bytes());

let retrieved_request =
get_request_from_blockchain(tx_id_hex, &client).await?;
Expand Down
14 changes: 7 additions & 7 deletions license-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ version = "0.1.0"
edition = "2021"

[dependencies]
dusk-wallet = "0.18"
zk-citadel = "0.4"
dusk-wallet = "0.20.0-rc.0"
zk-citadel = "0.5"
moat-core={ path = "../moat-core" }
wallet-accessor = { path = "../wallet-accessor" }
dusk-poseidon = { version = "0.30", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-jubjub = { version = "0.12", default-features = false }
dusk-bls12_381 = "0.11"
dusk-pki = { version = "0.12", default-features = false, features = ["rkyv-impl"] }
rusk-abi = { version = "0.10.0-piecrust.0.6", default-features = false }
dusk-poseidon = { version = "0.31", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-jubjub = { version = "0.13", default-features = false }
dusk-bls12_381 = "0.12"
dusk-pki = { version = "0.13", default-features = false, features = ["rkyv-impl"] }
rusk-abi = { version = "0.11", default-features = false }
rkyv = { version = "=0.7.39" }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion license-provider/src/license_issuer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl LicenseIssuer {
.expect("License should serialize correctly")
.to_vec();
let lpk = JubJubAffine::from(license.lsa.pk_r().as_ref());
let license_hash = sponge::hash(&[lpk.get_x(), lpk.get_y()]);
let license_hash = sponge::hash(&[lpk.get_u(), lpk.get_v()]);
let tuple = (license_blob, license_hash);
trace!(
"sending issue license with license blob size={}",
Expand Down
2 changes: 1 addition & 1 deletion macros/code-hasher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ darling = "0.14"
semver = "1.0"

[dev-dependencies]
dusk-plonk = "0.14"
dusk-plonk = "0.16"
2 changes: 1 addition & 1 deletion moat-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
dusk-wallet = "0.18"
dusk-wallet = "0.20.0-rc.0"
wallet-accessor = { path = "../wallet-accessor" }
moat-core = { path = "../moat-core" }
toml-base-config = "0.1"
Expand Down
20 changes: 10 additions & 10 deletions moat-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ tokio-tungstenite = { version = "0.19", default-features = false, features = ["c
futures = "0.3"
futures-core = "0.3"
futures-util = { version = "0.3.28", default-features = false, features = ["sink", "std"] }
dusk-wallet = "0.18"
dusk-wallet = "0.20.0-rc.0"
wallet-accessor = { path = "../wallet-accessor" }
zk-citadel = "0.4"
dusk-plonk = { version = "0.14", default-features = false, features = ["rkyv-impl", "alloc"] }
phoenix-core = { version = "0.20.0-rc.0", features = ["alloc"] }
dusk-poseidon = { version = "0.30", default-features = false, features = ["rkyv-impl", "alloc"] }
poseidon-merkle = { version = "0.2.1-rc.0", features = ["rkyv-impl"] }
dusk-jubjub = { version = "0.12", default-features = false }
dusk-bls12_381 = "0.11"
dusk-pki = { version = "0.12", default-features = false, features = ["rkyv-impl"] }
rusk-abi = { version = "0.10.0-piecrust.0.6", default-features = false }
zk-citadel = "0.5"
dusk-plonk = { version = "0.16", default-features = false, features = ["rkyv-impl", "alloc"] }
phoenix-core = { version = "0.21", features = ["alloc"] }
dusk-poseidon = { version = "0.31", default-features = false, features = ["rkyv-impl", "alloc"] }
poseidon-merkle = { version = "0.3", features = ["rkyv-impl"] }
dusk-jubjub = { version = "0.13", default-features = false }
dusk-bls12_381 = "0.12"
dusk-pki = { version = "0.13", default-features = false, features = ["rkyv-impl"] }
rusk-abi = { version = "0.11", default-features = false }
rkyv = { version = "=0.7.39" }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion moat-core/src/blockchain_queries/tx_awaiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl TxAwaiter {
client: &RuskHttpClient,
tx_id: BlsScalar,
) -> Result<(), Error> {
let tx_id = format!("{:x}", tx_id);
let tx_id = hex::encode(tx_id.to_bytes());
Self::wait_for_tx(client, tx_id).await
}

Expand Down
10 changes: 5 additions & 5 deletions wallet-accessor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ version = "0.1.0"
edition = "2021"

[dependencies]
dusk-wallet = "0.18"
dusk-wallet-core = "0.20.0-piecrust.0.6"
phoenix-core = { version = "0.20.0-rc.0", features = ["alloc"] }
dusk-bls12_381 = "0.11"
rusk-abi = { version = "0.10.0-piecrust.0.6", default-features = false }
dusk-wallet = "0.20.0-rc.0"
dusk-wallet-core = "0.22.0-plonk.0.16"
phoenix-core = { version = "0.21", features = ["alloc"] }
dusk-bls12_381 = "0.12"
rusk-abi = { version = "0.11", default-features = false }
rkyv = { version = "=0.7.39" }
tracing = "0.1"
serde = { version = "1", features = ["derive"] }
Expand Down
3 changes: 2 additions & 1 deletion wallet-accessor/src/wallet_accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ impl WalletAccessor {
},
)
.await?;
wallet.sync().await?;

assert!(wallet.is_online(), "Wallet should be online");
assert!(wallet.is_online().await, "Wallet should be online");

debug!(
"Sending tx with a call to method '{}' of contract='{}'",
Expand Down
Loading