Skip to content

Commit

Permalink
Merge pull request #66 from dusk-network/prep-for-release
Browse files Browse the repository at this point in the history
Preparation for release
  • Loading branch information
miloszm authored Dec 1, 2023
2 parents 951b592 + fe71717 commit e69e53d
Show file tree
Hide file tree
Showing 55 changed files with 170 additions and 233 deletions.
2 changes: 1 addition & 1 deletion integration-tests/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]
moat = { path = "../moat" }
zk-citadel-moat = { path = "../moat" }

[dev-dependencies]
dusk-wallet = "0.20.1"
Expand Down
8 changes: 5 additions & 3 deletions integration-tests/tests/blockchain/contract_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_wallet::{RuskHttpClient, WalletPath};
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::wallet_accessor::Password::PwdHash;
use moat::{Error, JsonLoader, PayloadSender, RequestJson, TxAwaiter};
use phoenix_core::transaction::ModuleId;
use std::path::PathBuf;
use toml_base_config::BaseConfig;
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::wallet_accessor::Password::PwdHash;
use zk_citadel_moat::{
Error, JsonLoader, PayloadSender, RequestJson, TxAwaiter,
};

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/blockchain/get_crs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_wallet::RuskHttpClient;
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::{CrsGetter, Error};
use toml_base_config::BaseConfig;
use tracing::trace;
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::{CrsGetter, Error};

const MIN_CRS_SIZE: usize = 10 * 1024 * 1024;

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/blockchain/retrieve_txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_wallet::RuskHttpClient;
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::{Error, TxInquirer};
use toml_base_config::BaseConfig;
use tracing::trace;
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::{Error, TxInquirer};

#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/citadel/int_test_lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use moat::license_provider::ReferenceLP;
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::Error;
use toml_base_config::BaseConfig;
use zk_citadel_moat::license_provider::ReferenceLP;
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::Error;

#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "exp_tests"), ignore)]
Expand Down
16 changes: 8 additions & 8 deletions integration-tests/tests/citadel/int_test_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ use dusk_bytes::DeserializableSlice;
use dusk_pki::SecretSpendKey;
use dusk_plonk::prelude::*;
use dusk_wallet::{RuskHttpClient, WalletPath};
use moat::license_provider::{LicenseIssuer, ReferenceLP};
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::wallet_accessor::Password::PwdHash;
use moat::{
BcInquirer, CitadelInquirer, CrsGetter, Error, JsonLoader, LicenseCircuit,
LicenseSessionId, LicenseUser, PayloadRetriever, RequestCreator,
RequestJson, RequestSender, TxAwaiter,
};
use rand::rngs::{OsRng, StdRng};
use rand::SeedableRng;
use std::path::PathBuf;
use toml_base_config::BaseConfig;
use tracing::{info, Level};
use zk_citadel::license::Request;
use zk_citadel_moat::license_provider::{LicenseIssuer, ReferenceLP};
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::wallet_accessor::Password::PwdHash;
use zk_citadel_moat::{
BcInquirer, CitadelInquirer, CrsGetter, Error, JsonLoader, LicenseCircuit,
LicenseSessionId, LicenseUser, PayloadRetriever, RequestCreator,
RequestJson, RequestSender, TxAwaiter,
};

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/tests/citadel/issue_license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

use dusk_jubjub::JubJubScalar;
use dusk_wallet::WalletPath;
use moat::license_provider::{LicenseIssuer, ReferenceLP};
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::wallet_accessor::Password::PwdHash;
use moat::{Error, JsonLoader, RequestCreator, RequestJson};
use rand::rngs::StdRng;
use rand::SeedableRng;
use std::path::PathBuf;
use toml_base_config::BaseConfig;
use zk_citadel_moat::license_provider::{LicenseIssuer, ReferenceLP};
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::wallet_accessor::Password::PwdHash;
use zk_citadel_moat::{Error, JsonLoader, RequestCreator, RequestJson};

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/citadel/license_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use dusk_bls12_381::BlsScalar;
use dusk_wallet::RuskHttpClient;
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::{CitadelInquirer, Error, LicenseSessionId, StreamAux};
use toml_base_config::BaseConfig;
use tracing::trace;
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::{CitadelInquirer, Error, LicenseSessionId, StreamAux};

#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/citadel/retrieve_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_wallet::RuskHttpClient;
use moat::wallet_accessor::BlockchainAccessConfig;
use moat::{Error, PayloadRetriever, RequestScanner};
use toml_base_config::BaseConfig;
use tracing::trace;
use zk_citadel::license::Request;
use zk_citadel_moat::wallet_accessor::BlockchainAccessConfig;
use zk_citadel_moat::{Error, PayloadRetriever, RequestScanner};

#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "vol_tests"), ignore)]
Expand Down
14 changes: 8 additions & 6 deletions integration-tests/tests/citadel/send_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
// Copyright (c) DUSK NETWORK. All rights reserved.

use dusk_wallet::{RuskHttpClient, WalletPath};
use moat::wallet_accessor::{BlockchainAccessConfig, Password::PwdHash};
use moat::{
Error, PayloadExtractor, PayloadRetriever, RequestCreator, RequestJson,
RequestSender, TxInquirer, MAX_REQUEST_SIZE,
};
use moat::{JsonLoader, TxAwaiter};
use rand::rngs::StdRng;
use rand::SeedableRng;
use std::path::PathBuf;
Expand All @@ -19,6 +13,14 @@ use tokio::time::sleep;
use toml_base_config::BaseConfig;
use tracing::Level;
use zk_citadel::license::Request;
use zk_citadel_moat::wallet_accessor::{
BlockchainAccessConfig, Password::PwdHash,
};
use zk_citadel_moat::{
Error, PayloadExtractor, PayloadRetriever, RequestCreator, RequestJson,
RequestSender, TxInquirer, MAX_REQUEST_SIZE,
};
use zk_citadel_moat::{JsonLoader, TxAwaiter};

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/websocket/ws_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// Copyright (c) DUSK NETWORK. All rights reserved.

use moat::ContractInquirerWs;
use zk_citadel_moat::ContractInquirerWs;

pub async fn send_request_to_ws_server(port: u32) {
let url = format!("127.0.0.1:{}", port);
Expand Down
4 changes: 3 additions & 1 deletion integration-tests/tests/websocket/ws_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

use crate::websocket::ws_license_contract_mock_multi_server;
use dusk_bls12_381::BlsScalar;
use moat::{CitadelInquirerWs, Error, LicenseSession, LicenseSessionId};
use zk_citadel_moat::{
CitadelInquirerWs, Error, LicenseSession, LicenseSessionId,
};

const TEST_DURATION_SECONDS: u64 = 4;
const PORT: u32 = 9126;
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/websocket/ws_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use crate::websocket::ws_common::*;
use dusk_bls12_381::BlsScalar;
use futures_util::{SinkExt, StreamExt};
use moat::{Error, LicenseSession, MAX_RESPONSE_SIZE};
use tokio::net::{TcpListener, TcpStream};
use tokio_tungstenite::tungstenite::Message;
use tracing::trace;
use zk_citadel_moat::{Error, LicenseSession, MAX_RESPONSE_SIZE};

pub async fn ws_license_contract_mock_server(
seconds: u64,
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/websocket/ws_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use crate::websocket::{
send_request_to_ws_server, ws_license_contract_mock_server,
};
use moat::Error;
use tracing::trace;
use zk_citadel_moat::Error;

const TEST_DURATION_SECONDS: u64 = 4;
const PORT: u32 = 9125;
Expand Down
2 changes: 1 addition & 1 deletion moat-cli/moat-cli-common/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]
moat = { path = "../../moat" }
zk-citadel-moat = { path = "../../moat" }
dusk-plonk = { version = "0.16", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-wallet = "0.20.1"
clap = { version = "4.0", features = ["derive", "env"] }
Expand Down
11 changes: 4 additions & 7 deletions moat-cli/moat-cli-common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ use std::num::ParseIntError;
use std::sync::Arc;
use thiserror::Error;

// todo: rename CliError to Error
// todo: make sure it is used in other CLIs as well

#[derive(Error, Debug, Clone)]
pub enum Error {
/// Moat core error
#[error(transparent)]
Moat(Arc<moat::Error>),
Moat(Arc<zk_citadel_moat::Error>),
/// Interaction error
#[error(transparent)]
Interaction(Arc<requestty::ErrorKind>),
Expand All @@ -41,8 +38,8 @@ pub enum Error {
Wallet(Arc<dusk_wallet::Error>),
}

impl From<moat::Error> for Error {
fn from(e: moat::Error) -> Self {
impl From<zk_citadel_moat::Error> for Error {
fn from(e: zk_citadel_moat::Error) -> Self {
Error::Moat(Arc::from(e))
}
}
Expand Down Expand Up @@ -91,7 +88,7 @@ impl From<bs58::decode::Error> for Error {

impl From<dusk_plonk::error::Error> for Error {
fn from(e: dusk_plonk::error::Error) -> Self {
Error::Moat(Arc::from(moat::Error::Plonk(Arc::from(e))))
Error::Moat(Arc::from(zk_citadel_moat::Error::Plonk(Arc::from(e))))
}
}

Expand Down
2 changes: 1 addition & 1 deletion moat-cli/moat-cli-lp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
dusk-wallet = "0.20.1"
dusk-jubjub = { version = "0.13", default-features = false }
moat = { path = "../../moat" }
zk-citadel-moat = { path = "../../moat" }
moat-cli-common = { path = "../moat-cli-common" }
dusk-pki = "0.13"
zk-citadel = "0.6.0"
Expand Down
6 changes: 3 additions & 3 deletions moat-cli/moat-cli-lp/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use crate::SeedableRng;
use dusk_jubjub::JubJubScalar;
use dusk_pki::SecretSpendKey;
use dusk_wallet::{RuskHttpClient, WalletPath};
use moat::license_provider::{LicenseIssuer, ReferenceLP};
use moat::wallet_accessor::{BlockchainAccessConfig, Password};
use moat::{BcInquirer, CitadelInquirer};
use moat_cli_common::Error;
use rand::rngs::StdRng;
use zk_citadel_moat::license_provider::{LicenseIssuer, ReferenceLP};
use zk_citadel_moat::wallet_accessor::{BlockchainAccessConfig, Password};
use zk_citadel_moat::{BcInquirer, CitadelInquirer};

/// Commands that can be run against the Moat
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion moat-cli/moat-cli-lp/src/interactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use crate::prompt;
use crate::{Command, Menu};
use dusk_pki::SecretSpendKey;
use dusk_wallet::WalletPath;
use moat::wallet_accessor::{BlockchainAccessConfig, Password};
use moat_cli_common::Error;
use requestty::{ErrorKind, Question};
use zk_citadel_moat::wallet_accessor::{BlockchainAccessConfig, Password};

#[derive(PartialEq, Eq, Hash, Debug, Clone)]
enum OpSelection {
Expand Down
6 changes: 4 additions & 2 deletions moat-cli/moat-cli-lp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ use clap::Parser;
use crate::config::LPCliConfig;
use crate::interactor::Interactor;
use dusk_wallet::{Wallet, WalletPath};
use moat::wallet_accessor::Password::{Pwd, PwdHash};
use moat::wallet_accessor::{BlockchainAccessConfig, WalletAccessor};
use moat_cli_common::Error;
use rand::SeedableRng;
use toml_base_config::BaseConfig;
use zk_citadel_moat::wallet_accessor::Password::{Pwd, PwdHash};
use zk_citadel_moat::wallet_accessor::{
BlockchainAccessConfig, WalletAccessor,
};

#[tokio::main]
async fn main() -> Result<(), Error> {
Expand Down
8 changes: 2 additions & 6 deletions moat-cli/moat-cli-lp/src/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ use requestty::{ErrorKind, Question};
pub(crate) fn request_request_hash() -> Result<String, ErrorKind> {
let q = Question::input("request_hash")
.message("Please enter request hash:".to_string())
.validate_on_key(|_, _| {
true // todo: add some validation of the request hash
})
.validate_on_key(|_, _| true)
.validate(|request_hash, _| {
if request_hash.is_empty() {
Err("Please enter a valid request hash".to_string())
Expand All @@ -29,9 +27,7 @@ pub(crate) fn request_request_hash() -> Result<String, ErrorKind> {
pub(crate) fn request_attr_data() -> Result<String, ErrorKind> {
let q = Question::input("attr_data")
.message("Please enter the attribute data:".to_string())
.validate_on_key(|_, _| {
true // todo: add some validation of the attr_data
})
.validate_on_key(|_, _| true)
.validate(|attr_data, _| {
if attr_data.is_empty() {
Err("Please enter valid attribute data".to_string())
Expand Down
Loading

0 comments on commit e69e53d

Please sign in to comment.