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

testing/remove-mixed-breed #907

Merged
merged 2 commits into from
Jul 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
12 changes: 0 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ jobs:
cargo check --features vdrtools --no-default-features
cargo check --features modular_libs --no-default-features
cargo check --features vdr_proxy_ledger --no-default-features
cargo check --features mixed_breed

##########################################################################################
############################## DOCKER BUILD ##########################################
Expand Down Expand Up @@ -483,17 +482,6 @@ jobs:
with:
name: "docker-services-${{ github.job }}"

test-integration-aries-vcx-mixed-breed:
needs: workflow-setup
runs-on: ubuntu-20.04
steps:
- name: "Git checkout"
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
- name: "Run aries-vcx integration tests"
run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" -F mixed_breed -- --include-ignored;

test-integration-aries-vcx-migration:
needs: workflow-setup
runs-on: ubuntu-20.04
Expand Down
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions aries_vcx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ modular_libs = ["aries_vcx_core/modular_libs"]
# TODO: Remove using "vdrtools" feature flag for vdr_proxy_ledger once IndyCredxAnonCreds
# is fully implemented
vdr_proxy_ledger = ["aries_vcx_core/vdr_proxy_ledger", "vdrtools"]
# Temporary feature used for testing the full credx anoncreds impl
# using vdrtools ledger and wallet.
mixed_breed = ["vdrtools", "modular_libs"]
# Used for testing the migrator
migration = ["vdrtools", "modular_libs"]

Expand Down
6 changes: 1 addition & 5 deletions aries_vcx/src/common/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ pub async fn get_verkey_from_ledger(indy_ledger: &Arc<dyn IndyLedgerRead>, did:
mod test {
#[tokio::test]
#[ignore]
#[cfg(all(
not(feature = "vdr_proxy_ledger"),
not(feature = "modular_libs"),
not(feature = "mixed_breed")
))]
#[cfg(all(not(feature = "vdr_proxy_ledger"), not(feature = "modular_libs"),))]
async fn test_pool_rotate_verkey_fails() {
use super::*;

Expand Down
82 changes: 0 additions & 82 deletions aries_vcx/src/core/profile/mixed_breed_profile.rs

This file was deleted.

2 changes: 0 additions & 2 deletions aries_vcx/src/core/profile/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#[cfg(feature = "mixed_breed")]
pub mod mixed_breed_profile;
#[cfg(feature = "modular_libs")]
pub mod modular_libs_profile;
pub mod profile;
Expand Down
38 changes: 0 additions & 38 deletions aries_vcx/src/utils/devsetup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ use aries_vcx_core::indy::ledger::pool::{
create_pool_ledger_config, indy_close_pool, indy_delete_pool, indy_open_pool,
};

#[cfg(feature = "mixed_breed")]
use crate::core::profile::mixed_breed_profile::MixedBreedProfile;
#[cfg(feature = "modular_libs")]
use crate::core::profile::modular_libs_profile::ModularLibsProfile;
#[cfg(feature = "modular_libs")]
Expand Down Expand Up @@ -138,12 +136,6 @@ impl SetupProfile {
info!("SetupProfile >> using indy profile");
SetupProfile::build_profile_vdrtools(genesis_file_path).await
};
#[cfg(feature = "mixed_breed")]
return {
info!("SetupProfile >> using mixed breed profile");
SetupProfile::build_profile_mixed_breed(genesis_file_path).await
};

#[cfg(feature = "modular_libs")]
return {
info!("SetupProfile >> using modular profile");
Expand Down Expand Up @@ -215,36 +207,6 @@ impl SetupProfile {
}
}

#[cfg(feature = "mixed_breed")]
async fn build_profile_mixed_breed(genesis_file_path: String) -> SetupProfile {
// todo: can remove?
let pool_name = Uuid::new_v4().to_string();
create_pool_ledger_config(&pool_name, &genesis_file_path).unwrap();
let pool_handle = indy_open_pool(&pool_name, None).await.unwrap();

let (institution_did, wallet_handle) = setup_issuer_wallet().await;

let profile: Arc<dyn Profile> = Arc::new(MixedBreedProfile::new(wallet_handle, pool_handle.clone()));

Arc::clone(&profile)
.inject_anoncreds()
.prover_create_link_secret(settings::DEFAULT_LINK_SECRET_ALIAS)
.await
.unwrap();

async fn indy_teardown(pool_handle: PoolHandle, pool_name: String) {
indy_close_pool(pool_handle.clone()).await.unwrap();
indy_delete_pool(&pool_name).await.unwrap();
}

SetupProfile {
genesis_file_path,
institution_did,
profile,
teardown: Arc::new(move || Box::pin(indy_teardown(pool_handle, pool_name.clone()))),
}
}

#[cfg(feature = "vdr_proxy_ledger")]
async fn build_profile_vdr_proxy_ledger(genesis_file_path: String) -> SetupProfile {
use std::env;
Expand Down
1 change: 0 additions & 1 deletion libvcx_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ uuid = { version = "0.7.4", default-features = false, features = ["v4"] }
agency_client = { path = "../agency_client" }
async-trait = "0.1.61"
url = "2.3.1"
wallet_migrator = { path = "../wallet_migrator" }

[dev-dependencies]
tokio = { version = "1.20", features = [ "rt", "macros" ] }
46 changes: 0 additions & 46 deletions libvcx_core/src/api_vcx/api_global/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ use aries_vcx::aries_vcx_core::anoncreds::base_anoncreds::BaseAnonCreds;
#[cfg(all(feature = "anoncreds_credx"))]
use aries_vcx::aries_vcx_core::anoncreds::credx_anoncreds::IndyCredxAnonCreds;
use aries_vcx::aries_vcx_core::anoncreds::indy_anoncreds::IndySdkAnonCreds;
use aries_vcx::aries_vcx_core::indy::wallet::close_wallet;
use aries_vcx::aries_vcx_core::indy::wallet::create_and_open_wallet;
use aries_vcx::aries_vcx_core::indy::wallet::delete_wallet;
use aries_vcx::aries_vcx_core::indy::wallet::{
close_search_wallet, fetch_next_records_wallet, import, open_search_wallet, IssuerConfig, RestoreWalletConfigs,
WalletConfig,
Expand Down Expand Up @@ -227,26 +224,6 @@ pub async fn wallet_import(config: &RestoreWalletConfigs) -> LibvcxResult<()> {
map_ariesvcx_core_result(import(config).await)
}

pub async fn wallet_migrate(wallet_config: &WalletConfig) -> LibvcxResult<()> {
let src_wallet_handle = get_main_wallet_handle()?;
let dest_wallet_handle = create_and_open_wallet(wallet_config).await?;

let migration_res = wallet_migrator::migrate_wallet(
src_wallet_handle,
dest_wallet_handle,
wallet_migrator::vdrtools2credx::migrate_any_record,
)
.await;

if let Err(e) = migration_res {
close_wallet(dest_wallet_handle).await.ok();
delete_wallet(wallet_config).await.ok();
Err(LibvcxError::from_msg(LibvcxErrorKind::WalletMigrationFailed, e))
} else {
Ok(())
}
}

#[allow(clippy::unwrap_used)]
pub mod test_utils {
use aries_vcx::aries_vcx_core::indy::wallet::WalletConfig;
Expand Down Expand Up @@ -327,29 +304,6 @@ pub mod tests {
};
use crate::errors::error::{LibvcxErrorKind, LibvcxResult};

#[tokio::test]
async fn test_wallet_migrate() {
let wallet_name = format!("test_create_wallet_{}", uuid::Uuid::new_v4());
let config: WalletConfig = serde_json::from_value(json!({
"wallet_name": wallet_name,
"wallet_key": DEFAULT_WALLET_KEY,
"wallet_key_derivation": WALLET_KDF_RAW
}))
.unwrap();

create_and_open_as_main_wallet(&config).await.unwrap();

let wallet_name = format!("test_migrate_wallet_{}", uuid::Uuid::new_v4());
let new_config: WalletConfig = serde_json::from_value(json!({
"wallet_name": wallet_name,
"wallet_key": DEFAULT_WALLET_KEY,
"wallet_key_derivation": WALLET_KDF_RAW
}))
.unwrap();

super::wallet_migrate(&new_config).await.unwrap();
}

#[tokio::test]
async fn test_wallet_create() {
let _setup = SetupEmpty::init();
Expand Down
2 changes: 0 additions & 2 deletions libvcx_core/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ pub enum LibvcxErrorKind {
DuplicationWallet,
#[error("Wallet record not found")]
WalletRecordNotFound,
#[error("Wallet migration failed")]
WalletMigrationFailed,
#[error("Record already exists in the wallet")]
DuplicationWalletRecord,
#[error("Wallet not found")]
Expand Down
6 changes: 0 additions & 6 deletions libvdrtools/indy-api-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ pub type IndyHandle = i32;
pub struct WalletHandle(pub i32);
pub const INVALID_WALLET_HANDLE: WalletHandle = WalletHandle(0);

impl From<i32> for WalletHandle {
fn from(value: i32) -> Self {
Self(value)
}
}

pub type CallbackHandle = i32;

pub type PoolHandle = i32;
Expand Down
8 changes: 0 additions & 8 deletions wrappers/node/src/api/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ export async function createWallet(config: object): Promise<void> {
}
}

export async function migrateWallet(config: object): Promise<void> {
try {
return await ffi.walletMigrate(JSON.stringify(config));
} catch (err: any) {
throw new VCXInternalError(err);
}
}

export async function configureIssuerWallet(seed: string): Promise<string> {
try {
return await ffi.configureIssuerWallet(seed);
Expand Down
1 change: 0 additions & 1 deletion wrappers/vcx-napi-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ anoncreds_vdrtools = ["libvcx_core/anoncreds_vdrtools"]

[dependencies]
libvcx_core = { path = "../../libvcx_core" }
wallet_migrator = { path = "../../wallet_migrator" }
log = "0.4.16"
napi = { version = "2.10.14", default-features = false, features = [ "async" ] }
napi-derive = { version = "2.10.1" }
Expand Down
1 change: 0 additions & 1 deletion wrappers/vcx-napi-rs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export function unpack(data: Buffer): Promise<string>
export function createPairwiseInfo(): Promise<string>
export function walletImport(config: string): Promise<void>
export function walletExport(path: string, backupKey: string): Promise<void>
export function walletMigrate(walletConfig: string): Promise<void>
export function getVerkeyFromWallet(did: string): Promise<string>
export function rotateVerkey(did: string): Promise<void>
export function rotateVerkeyStart(did: string): Promise<string>
Expand Down
Loading