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

feat: update parameter path from SDK to manta-parameters #119

Merged
merged 1 commit into from
Jun 21, 2022
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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ derivative = { version = "2.2.0", default-features = false, features = ["use_cor
dirs-next = { version = "2.0.0", default-features = false }
futures = { version = "0.3.17", default-features = false, features = ["alloc"] }
http-types = { version = "2.12.0", default-features = false }
manta-accounting = { git = "https://github.com/manta-network/manta-rs", default-features = false, features = ["cocoon-fs"] }
manta-crypto = { git = "https://github.com/manta-network/manta-rs", default-features = false, features = ["getrandom"] }
manta-pay = { git = "https://github.com/manta-network/manta-rs", default-features = false, features = ["bs58", "groth16", "serde", "wallet"] }
manta-sdk = { git = "https://github.com/manta-network/sdk", default-features = false, features = ["download"] }
manta-util = { git = "https://github.com/manta-network/manta-rs", default-features = false }
manta-accounting = { git = "https://github.com/manta-network/manta-rs", tag = "v0.5.1", default-features = false, features = ["cocoon-fs"] }
manta-crypto = { git = "https://github.com/manta-network/manta-rs", tag = "v0.5.1", default-features = false, features = ["getrandom"] }
manta-parameters = { git = "https://github.com/manta-network/manta-rs", tag = "v0.5.1", default-features = false, features = ["download"] }
manta-pay = { git = "https://github.com/manta-network/manta-rs", tag = "v0.5.1", default-features = false, features = ["bs58", "groth16", "serde", "wallet"] }
manta-util = { git = "https://github.com/manta-network/manta-rs", tag = "v0.5.1", default-features = false }
parking_lot = { version = "0.12.1", default-features = false }
password-hash = { version = "0.3.2", default-features = false, features = ["alloc"] }
secrecy = { version = "0.8.0", default-features = false, features = ["alloc"] }
Expand Down
3 changes: 1 addition & 2 deletions src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

#![allow(unused_imports, unused_macros)] // NOTE: We are exposing them as a library for this crate.

use core::fmt;
use core::marker::Unpin;
use core::{fmt, marker::Unpin};
use tokio::io::{self, AsyncWrite, AsyncWriteExt};

pub use tokio::io::stdout;
Expand Down
22 changes: 13 additions & 9 deletions src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ where
directory.push("proving");
fs::create_dir_all(&directory).ok()?;
let mint = directory.join("mint.dat");
manta_sdk::pay::testnet::proving::Mint::download_if_invalid(&mint).ok()?;
manta_parameters::pay::testnet::proving::Mint::download_if_invalid(&mint).ok()?;
let private_transfer = directory.join("private-transfer.dat");
manta_sdk::pay::testnet::proving::PrivateTransfer::download_if_invalid(&private_transfer)
.ok()?;
manta_parameters::pay::testnet::proving::PrivateTransfer::download_if_invalid(
&private_transfer,
)
.ok()?;
let reclaim = directory.join("reclaim.dat");
manta_sdk::pay::testnet::proving::Reclaim::download_if_invalid(&reclaim).ok()?;
manta_parameters::pay::testnet::proving::Reclaim::download_if_invalid(&reclaim).ok()?;
Some(SignerParameters {
proving_context: MultiProvingContext {
mint: ProvingContext::decode(IoReader(File::open(mint).ok()?)).ok()?,
Expand All @@ -60,15 +62,15 @@ where
},
parameters: Parameters {
note_encryption_scheme: NoteEncryptionScheme::decode(
manta_sdk::pay::testnet::parameters::NoteEncryptionScheme::get()?,
manta_parameters::pay::testnet::parameters::NoteEncryptionScheme::get()?,
)
.ok()?,
utxo_commitment: UtxoCommitmentScheme::decode(
manta_sdk::pay::testnet::parameters::UtxoCommitmentScheme::get()?,
manta_parameters::pay::testnet::parameters::UtxoCommitmentScheme::get()?,
)
.ok()?,
void_number_commitment: VoidNumberCommitmentScheme::decode(
manta_sdk::pay::testnet::parameters::VoidNumberCommitmentScheme::get()?,
manta_parameters::pay::testnet::parameters::VoidNumberCommitmentScheme::get()?,
)
.ok()?,
},
Expand All @@ -78,6 +80,8 @@ where
/// Loads the [`UtxoAccumulatorModel`] from the Manta SDK.
#[inline]
pub fn load_utxo_accumulator_model() -> Option<UtxoAccumulatorModel> {
UtxoAccumulatorModel::decode(manta_sdk::pay::testnet::parameters::UtxoAccumulatorModel::get()?)
.ok()
UtxoAccumulatorModel::decode(
manta_parameters::pay::testnet::parameters::UtxoAccumulatorModel::get()?,
)
.ok()
}
4 changes: 2 additions & 2 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

//! Manta Signer Service Implementation

use crate::log::{info, trace, warn};
use crate::{
config::{Config, Setup},
log::{info, trace, warn},
secret::{Argon2, Authorizer, ExposeSecret, PasswordHash, SecretString},
};
use core::{future::Future, time::Duration};
Expand Down Expand Up @@ -187,7 +187,7 @@ where
#[inline]
async fn build(config: Config, mut authorizer: A) -> Result<Self> {
info!("building signer server")?;
info!("loading latest parameters from Manta SDK")?;
info!("loading latest parameters from Manta Parameters")?;
let data_path = config.data_directory().to_owned();
let parameters = task::spawn_blocking(move || crate::parameters::load(data_path))
.await?
Expand Down