Skip to content

Commit

Permalink
Fix IT
Browse files Browse the repository at this point in the history
  • Loading branch information
xevisalle committed Nov 15, 2023
1 parent aa84fd6 commit 3a1bf7b
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 33 deletions.
3 changes: 2 additions & 1 deletion integration-tests/tests/blockchain/get_crs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const MIN_CRS_SIZE: usize = 10 * 1024 * 1024;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn get_crs() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand Down
12 changes: 8 additions & 4 deletions integration-tests/tests/blockchain/retrieve_txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use wallet_accessor::BlockchainAccessConfig;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn retrieve_txs_from_block() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -31,7 +32,8 @@ async fn retrieve_txs_from_block() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn retrieve_txs_from_block_range() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -56,7 +58,8 @@ async fn retrieve_txs_from_block_range() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn retrieve_txs_from_last_n_blocks() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -76,7 +79,8 @@ async fn retrieve_tx_by_id() -> Result<(), Error> {
const TXID: &str =
"44fe2c6407fc400a2dee6e30c62a02b82f3980da18d3b6306e80f9f83730520d";

let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let config = BlockchainAccessConfig::load_path(config_path)?;

Expand Down
5 changes: 3 additions & 2 deletions integration-tests/tests/blockchain/stake_add_owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use wallet_accessor::Password::PwdHash;

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
"9afbce9f2416520733bacb370315d32b6b2c43d6097576df1c1222859d91eecc";
"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8";
const GAS_LIMIT: u64 = 5_000_000_000;
const GAS_PRICE: u64 = 1;

Expand All @@ -28,7 +28,8 @@ pub const ADD_OWNER_METHOD_NAME: &str = "add_owner";
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn stake_add_owner() -> Result<(), Error> {
let blockchain_config_path = "../config.toml";
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let blockchain_config =
BlockchainAccessConfig::load_path(blockchain_config_path)?;
Expand Down
9 changes: 6 additions & 3 deletions integration-tests/tests/citadel/int_test_lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use wallet_accessor::BlockchainAccessConfig;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn lp_scan() -> Result<(), Error> {
let blockchain_config_path = "../config.toml";
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let lp_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/test_secret_key_lp");

Expand All @@ -28,7 +29,8 @@ async fn lp_scan() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn lp_scan_last_blocks() -> Result<(), Error> {
let blockchain_config_path = "../config.toml";
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let lp_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/test_secret_key_lp_2");

Expand All @@ -46,7 +48,8 @@ async fn lp_scan_last_blocks() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn lp_scan_2_lps() -> Result<(), Error> {
let blockchain_config_path = "../config.toml";
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let lp1_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/test_secret_key_lp");
let lp2_config_path =
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/tests/citadel/int_test_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use zk_citadel::license::Request;

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
"9afbce9f2416520733bacb370315d32b6b2c43d6097576df1c1222859d91eecc";
"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8";
const GAS_LIMIT: u64 = 5_000_000_000;
const GAS_PRICE: u64 = 1;

Expand Down Expand Up @@ -121,7 +121,8 @@ async fn user_round_trip() -> Result<(), Error> {
// PUB_PARAMS initialization code
let mut rng = StdRng::seed_from_u64(0xbeef);

let blockchain_config_path = "../config.toml";
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let blockchain_config =
BlockchainAccessConfig::load_path(blockchain_config_path)?;
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/tests/citadel/issue_license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use wallet_accessor::Password::PwdHash;

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
"9afbce9f2416520733bacb370315d32b6b2c43d6097576df1c1222859d91eecc";
"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8";
const GAS_LIMIT: u64 = 5_000_000_000;
const GAS_PRICE: u64 = 1;

Expand All @@ -25,7 +25,8 @@ const GAS_PRICE: u64 = 1;
async fn issue_license() -> Result<(), Error> {
let request_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/request/request.json");
let blockchain_config_path = "../config.toml";
let blockchain_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let lp_config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/test_secret_key_lp_2");
Expand Down
12 changes: 8 additions & 4 deletions integration-tests/tests/citadel/license_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use wallet_accessor::BlockchainAccessConfig;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_licenses() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -32,7 +33,8 @@ async fn call_get_licenses() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_merkle_opening() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -47,7 +49,8 @@ async fn call_get_merkle_opening() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_session() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -66,7 +69,8 @@ async fn call_get_session() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn call_get_info() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let config = BlockchainAccessConfig::load_path(config_path)?;

let client = RuskHttpClient::new(config.rusk_address);
Expand Down
12 changes: 8 additions & 4 deletions integration-tests/tests/citadel/retrieve_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ async fn retrieve_payload() -> Result<(), Error> {
const TXID: &str =
"8d45a9fb7196f322282d522ff4bb2d2e926ddd96b858b91d59f228b27250ef03";

let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let config = BlockchainAccessConfig::load_path(config_path)?;
let client = RuskHttpClient::new(config.rusk_address);
Expand All @@ -31,7 +32,8 @@ async fn retrieve_payload() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "exp_tests"), ignore)]
async fn scan_all_requests() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");
let cfg = BlockchainAccessConfig::load_path(config_path)?;
let mut height = 0;
loop {
Expand All @@ -56,7 +58,8 @@ async fn scan_all_requests() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn scan_requests_in_last_blocks() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand All @@ -74,7 +77,8 @@ async fn scan_requests_in_last_blocks() -> Result<(), Error> {
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "int_tests"), ignore)]
async fn scan_requests_in_block_range() -> Result<(), Error> {
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let cfg = BlockchainAccessConfig::load_path(config_path)?;

Expand Down
5 changes: 3 additions & 2 deletions integration-tests/tests/citadel/send_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use zk_citadel::license::Request;

const WALLET_PATH: &str = concat!(env!("HOME"), "/.dusk/rusk-wallet");
const PWD_HASH: &str =
"9afbce9f2416520733bacb370315d32b6b2c43d6097576df1c1222859d91eecc";
"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8";
const GAS_LIMIT: u64 = 5_000_000_000;
const GAS_PRICE: u64 = 1;

Expand All @@ -37,7 +37,8 @@ async fn send_request() -> Result<(), Error> {

let request_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/request/request.json");
let config_path = "../config.toml";
let config_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/config/config.toml");

let request_json: RequestJson = RequestJson::from_file(request_path)?;

Expand Down
2 changes: 2 additions & 0 deletions integration-tests/tests/config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rusk_address = "http://127.0.0.1:8080"
prover_address = "http://127.0.0.1:8080"
14 changes: 5 additions & 9 deletions moat-cli-user/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use moat_core::{
use rand::rngs::StdRng;
use wallet_accessor::{BlockchainAccessConfig, Password};
use zk_citadel::license::{License, SessionCookie};

use dusk_bytes::Serializable;
/// Commands that can be run against the Moat
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
pub(crate) enum Command {
Expand Down Expand Up @@ -104,9 +104,8 @@ impl Command {
ssk: SecretSpendKey,
psk_lp_bytes: String,
) -> Result<RunResult, Error> {
let A = JubJubExtended::from(JubJubAffine::from_slice(&psk_lp_bytes.clone().into_bytes()[..32]).unwrap());
let B = JubJubExtended::from(JubJubAffine::from_slice(&psk_lp_bytes.clone().into_bytes()[32..]).unwrap());
let psk_lp = PublicSpendKey::new(A, B);
let psk_lp_bytes_formatted: [u8; 64] = hex::decode(psk_lp_bytes.clone()).expect("Decoded.").try_into().unwrap();
let psk_lp = PublicSpendKey::from_bytes(&psk_lp_bytes_formatted).unwrap();

let rng = &mut StdRng::from_entropy(); // seed_from_u64(0xcafe);
let request = RequestCreator::create(
Expand Down Expand Up @@ -185,11 +184,8 @@ impl Command {
println!("using license: {}", RunResult::to_hash_hex(&license));
let ssk_user = ssk;

let psk_lp_bytes = "136d747ff489bd06077f937508b9237ac093ff868dc2e232ab3af0ecd038873288560dbd8aa851e055bc408ebeb89509b26eb6e34b4b43214de467e3ef09594e".to_string();

let A = JubJubExtended::from(JubJubAffine::from_slice(&psk_lp_bytes.clone().into_bytes()[..32]).unwrap());
let B = JubJubExtended::from(JubJubAffine::from_slice(&psk_lp_bytes.clone().into_bytes()[32..]).unwrap());
let psk_lp = PublicSpendKey::new(A, B);
let psk_lp_bytes: [u8; 64] = hex::decode("136d747ff489bd06077f937508b9237ac093ff868dc2e232ab3af0ecd038873288560dbd8aa851e055bc408ebeb89509b26eb6e34b4b43214de467e3ef09594e").expect("Decoded.").try_into().unwrap();
let psk_lp = PublicSpendKey::from_bytes(&psk_lp_bytes).unwrap();

let (tx_id, session_cookie) = Self::prove_and_send_use_license(
blockchain_access_config,
Expand Down

0 comments on commit 3a1bf7b

Please sign in to comment.