From da2c4a313f6c86088b5832323c492c8308ce979d Mon Sep 17 00:00:00 2001 From: umr1352 Date: Wed, 27 Nov 2024 17:22:39 +0100 Subject: [PATCH 01/25] debug output --- identity_iota_core/tests/e2e/common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index 1a4fad984..b8ccbf903 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -122,7 +122,7 @@ async fn get_active_address() -> anyhow::Result { .output() .await .context("Failed to execute command") - .and_then(|output| Ok(serde_json::from_slice::(&output.stdout)?)) + .and_then(|output| Ok(serde_json::from_slice::(dbg!(&output.stdout))?)) } async fn publish_package(active_address: IotaAddress) -> anyhow::Result { From 012d299a3a974840bb91feb121d45c9d269e17fa Mon Sep 17 00:00:00 2001 From: umr1352 Date: Wed, 27 Nov 2024 18:16:04 +0100 Subject: [PATCH 02/25] test --- .github/actions/iota-rebase-sandbox/setup/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index 0f0554aa8..a6dc0c0cf 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -38,4 +38,8 @@ runs: - name: Start the Network shell: bash working-directory: iota - run: iota start --with-faucet --force-regenesis & + run: | + # Clear previous configuration + rm -rf ~/.iota || true + # Start the network + iota start --with-faucet & From e95d0be382f2b9793854f732be7a30110f871cdb Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 09:48:58 +0100 Subject: [PATCH 03/25] publish package before running the test harness --- .github/workflows/build-and-test.yml | 7 +++++++ examples/Cargo.toml | 2 +- examples/utils/utils.rs | 4 ++-- identity_iota_core/scripts/publish_identity_package.sh | 8 ++++---- identity_iota_core/tests/e2e/common.rs | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index feef4c3b8..22766bc84 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -135,6 +135,13 @@ jobs: with: platform: ${{ matrix.os == 'ubuntu-24.04' && 'linux' || 'macos' }} + - name: publish IotaIdentity package + if: matrix.os != 'windows-latest' + with: + platform: ${{ matrix.os == 'ubuntu-24.04' && 'linux' || 'macos' }} + # publish the package and set the IOTA_IDENTITY_PKG_ID env variable + run: source ./identity_iota_core/scripts/publish_identity_package.sh + - name: Run tests excluding `custom_time` feature if: matrix.os != 'windows-latest' run: cargo test --workspace --release diff --git a/examples/Cargo.toml b/examples/Cargo.toml index c0af97083..d9c6a2467 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -17,7 +17,7 @@ rand = "0.8.5" sd-jwt-payload = { version = "0.2.1", default-features = false, features = ["sha"] } secret-storage = { git = "/~https://github.com/iotaledger/secret-storage.git", tag = "v0.1.0" } serde_json = { version = "1.0", default-features = false } -tokio = { version = "1.29", default-features = false, features = ["rt"] } +tokio = { version = "1.29", default-features = false, features = ["rt", "macros"] } [dependencies.identity_iota] path = "../identity_iota" diff --git a/examples/utils/utils.rs b/examples/utils/utils.rs index 47b350f13..ca9fd74da 100644 --- a/examples/utils/utils.rs +++ b/examples/utils/utils.rs @@ -98,9 +98,9 @@ where let public_key_bytes = get_sender_public_key(&public_key_jwk)?; let sender_address = convert_to_address(&public_key_bytes)?; request_funds(&sender_address).await?; - let package_id = std::env::var("IDENTITY_IOTA_PKG_ID") + let package_id = std::env::var("IOTA_IDENTITY_PKG_ID") .map_err(|e| { - anyhow::anyhow!("env variable IDENTITY_IOTA_PKG_ID must be set in order to run the examples").context(e) + anyhow::anyhow!("env variable IOTA_IDENTITY_PKG_ID must be set in order to run the examples").context(e) }) .and_then(|pkg_str| pkg_str.parse().context("invalid package id"))?; diff --git a/identity_iota_core/scripts/publish_identity_package.sh b/identity_iota_core/scripts/publish_identity_package.sh index 977e9f27c..96e155d28 100755 --- a/identity_iota_core/scripts/publish_identity_package.sh +++ b/identity_iota_core/scripts/publish_identity_package.sh @@ -3,9 +3,9 @@ # Copyright 2020-2024 IOTA Stiftung # SPDX-License-Identifier: Apache-2.0 -script_dir=$(dirname $0) +script_dir=$(cd "$(dirname $0)" && pwd) package_dir=$script_dir/../packages/iota_identity -# echo "publishing package from $package_dir" -cd $package_dir -iota client publish --with-unpublished-dependencies --skip-dependency-verification --json --gas-budget 500000000 . +echo "publishing package from $package_dir" +package_id=$(iota client publish --with-unpublished-dependencies --skip-dependency-verification --silence-warnings --json --gas-budget 500000000 $package_dir | jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId') +export IOTA_IDENTITY_PKG_ID=$package_id diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index b8ccbf903..1a4fad984 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -122,7 +122,7 @@ async fn get_active_address() -> anyhow::Result { .output() .await .context("Failed to execute command") - .and_then(|output| Ok(serde_json::from_slice::(dbg!(&output.stdout))?)) + .and_then(|output| Ok(serde_json::from_slice::(&output.stdout)?)) } async fn publish_package(active_address: IotaAddress) -> anyhow::Result { From b6a58df9a72eaa3e754cb7d9e8113ef8548ac74a Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 10:30:06 +0100 Subject: [PATCH 04/25] remove 'with' clause in workflow --- .github/workflows/build-and-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 22766bc84..06e82f245 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -137,8 +137,6 @@ jobs: - name: publish IotaIdentity package if: matrix.os != 'windows-latest' - with: - platform: ${{ matrix.os == 'ubuntu-24.04' && 'linux' || 'macos' }} # publish the package and set the IOTA_IDENTITY_PKG_ID env variable run: source ./identity_iota_core/scripts/publish_identity_package.sh From 21e0a1ea69e854db57e2849bf7bfb49bddbd6fd0 Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 11:12:11 +0100 Subject: [PATCH 05/25] publish package without script --- .github/workflows/build-and-test.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 06e82f245..0714731ab 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -138,7 +138,17 @@ jobs: - name: publish IotaIdentity package if: matrix.os != 'windows-latest' # publish the package and set the IOTA_IDENTITY_PKG_ID env variable - run: source ./identity_iota_core/scripts/publish_identity_package.sh + run: | + export IOTA_IDENTITY_PKG_ID=$( \ + iota client publish \ + --skip-dependency-verification \ + --json \ + --gas-budget 500000000 \ + . \ + | \ + jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId' \ + ) + working-directory: ./identity_iota_core/package/iota_identity - name: Run tests excluding `custom_time` feature if: matrix.os != 'windows-latest' From 153f083b203e2d9289c65c7261921bda8e926386 Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 11:45:44 +0100 Subject: [PATCH 06/25] fix typo --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0714731ab..d311706fc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -148,7 +148,7 @@ jobs: | \ jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId' \ ) - working-directory: ./identity_iota_core/package/iota_identity + working-directory: ./identity_iota_core/packages/iota_identity - name: Run tests excluding `custom_time` feature if: matrix.os != 'windows-latest' From 345067646597665fb4f453a2d76852f6119f2ac7 Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 12:34:53 +0100 Subject: [PATCH 07/25] request funds and add dbg statement --- .github/actions/iota-rebase-sandbox/setup/action.yml | 2 ++ identity_iota_core/tests/e2e/common.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index a6dc0c0cf..0f799c479 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -43,3 +43,5 @@ runs: rm -rf ~/.iota || true # Start the network iota start --with-faucet & + # Request more funds just in case + iota client faucet diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index 1a4fad984..90b8c66eb 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -74,6 +74,7 @@ lazy_static! { } pub async fn get_client() -> anyhow::Result { + { let client = IotaClientBuilder::default().build_localnet().await?; let package_id = PACKAGE_ID.get_or_try_init(|| init(&client)).await.copied()?; let address = get_active_address().await?; @@ -89,6 +90,7 @@ pub async fn get_client() -> anyhow::Result { address, storage, }) + }.inspect_err(|e: &anyhow::Error| {dbg!(e); dbg!(e.source());}) } async fn init(iota_client: &IotaClient) -> anyhow::Result { From b36cd43501f31d8cc4a9ee2ac7d1365238bfd113 Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 13:24:44 +0100 Subject: [PATCH 08/25] remove faucet call --- .github/actions/iota-rebase-sandbox/setup/action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index 0f799c479..a6dc0c0cf 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -43,5 +43,3 @@ runs: rm -rf ~/.iota || true # Start the network iota start --with-faucet & - # Request more funds just in case - iota client faucet From 8ddb9afbc04593a6a7e0bfdf01e8f01b6a5cfdaf Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 13:52:01 +0100 Subject: [PATCH 09/25] debug error --- identity_iota_core/tests/e2e/common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index 90b8c66eb..f1224f376 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -90,7 +90,7 @@ pub async fn get_client() -> anyhow::Result { address, storage, }) - }.inspect_err(|e: &anyhow::Error| {dbg!(e); dbg!(e.source());}) + }.inspect_err(|e: &anyhow::Error| {println!("{e}"); println!("{:?}", e.source());}) } async fn init(iota_client: &IotaClient) -> anyhow::Result { From 460b8f0405cedaccd4a2554cfbbcb08f64dba701 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 14:40:26 +0100 Subject: [PATCH 10/25] add output that could not be parsed to error message --- identity_iota_core/tests/e2e/common.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index f1224f376..c6bf10c92 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -144,7 +144,7 @@ async fn publish_package(active_address: IotaAddress) -> anyhow::Result(output_str[start_of_json..].trim())? }; @@ -238,7 +238,7 @@ impl TestClient { .await?; let new_address = { let output_str = std::str::from_utf8(&output.stdout).unwrap(); - let start_of_json = output_str.find('{').ok_or(anyhow!("No json in output"))?; + let start_of_json = output_str.find('{').ok_or(anyhow!("No json in output: {}", output_str))?; let json_result = serde_json::from_str::(output_str[start_of_json..].trim())?; let address_json = json_result .path("$.address") From abf20c75c519c6c7e747b2b285d5f6469d3d060a Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 15:07:32 +0100 Subject: [PATCH 11/25] comment out debug log in publishing script --- identity_iota_core/scripts/publish_identity_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity_iota_core/scripts/publish_identity_package.sh b/identity_iota_core/scripts/publish_identity_package.sh index 96e155d28..506662f06 100755 --- a/identity_iota_core/scripts/publish_identity_package.sh +++ b/identity_iota_core/scripts/publish_identity_package.sh @@ -6,6 +6,6 @@ script_dir=$(cd "$(dirname $0)" && pwd) package_dir=$script_dir/../packages/iota_identity -echo "publishing package from $package_dir" +# echo "publishing package from $package_dir" package_id=$(iota client publish --with-unpublished-dependencies --skip-dependency-verification --silence-warnings --json --gas-budget 500000000 $package_dir | jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId') export IOTA_IDENTITY_PKG_ID=$package_id From 0215f6afd93d8878768aaccc3156acebe55b565c Mon Sep 17 00:00:00 2001 From: umr1352 Date: Thu, 28 Nov 2024 15:47:35 +0100 Subject: [PATCH 12/25] make sure package id env is set --- .github/workflows/build-and-test.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d311706fc..4368cafa3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -139,15 +139,9 @@ jobs: if: matrix.os != 'windows-latest' # publish the package and set the IOTA_IDENTITY_PKG_ID env variable run: | - export IOTA_IDENTITY_PKG_ID=$( \ - iota client publish \ - --skip-dependency-verification \ - --json \ - --gas-budget 500000000 \ - . \ - | \ - jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId' \ - ) + json_output=$(iota client publish --skip-dependency-verification --with-unpublished-dependencies --json --gas-budget 500000000 .) + package_id=$(echo $json_output | jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId') + echo "IOTA_IDENTITY_PKG_ID=$package_id" >> "$GITHUB_ENV" working-directory: ./identity_iota_core/packages/iota_identity - name: Run tests excluding `custom_time` feature From 81b426f935e6bc3452231d55f580ffe09d857784 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 15:56:11 +0100 Subject: [PATCH 13/25] update publish package script handling in tests and grpc to follow update --- bindings/grpc/tests/api/helpers.rs | 18 ++++++------------ .../scripts/publish_identity_package.sh | 1 + identity_iota_core/tests/e2e/common.rs | 18 ++++++------------ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/bindings/grpc/tests/api/helpers.rs b/bindings/grpc/tests/api/helpers.rs index 97c50b2b0..a2b58fedf 100644 --- a/bindings/grpc/tests/api/helpers.rs +++ b/bindings/grpc/tests/api/helpers.rs @@ -38,6 +38,7 @@ use serde_json::Value; use std::io::Write; use std::net::SocketAddr; use std::path::PathBuf; +use std::str::FromStr; use tokio::net::TcpListener; use tokio::process::Command; @@ -375,20 +376,13 @@ async fn publish_package(active_address: IotaAddress) -> anyhow::Result(output_str[start_of_json..].trim())? + let package_id: ObjectID = { + let output_str = std::str::from_utf8(&output.stdout).unwrap().trim(); + ObjectID::from_str(output_str).context(format!( + "failed to find IDENTITY_IOTA_PKG_ID in response from: {output_str}" + ))? }; - let package_id = publish_result - .path("$.objectChanges[?(@.type == 'published')].packageId") - .map_err(|e| anyhow!("Failed to parse JSONPath: {e}")) - .and_then(|value| Ok(serde_json::from_value::>(value)?))? - .first() - .copied() - .ok_or_else(|| anyhow!("Failed to parse package ID after publishing"))?; - // Persist package ID in order to avoid publishing the package for every test. let package_id_str = package_id.to_string(); std::env::set_var("IDENTITY_IOTA_PKG_ID", package_id_str.as_str()); diff --git a/identity_iota_core/scripts/publish_identity_package.sh b/identity_iota_core/scripts/publish_identity_package.sh index 506662f06..620d39289 100755 --- a/identity_iota_core/scripts/publish_identity_package.sh +++ b/identity_iota_core/scripts/publish_identity_package.sh @@ -9,3 +9,4 @@ package_dir=$script_dir/../packages/iota_identity # echo "publishing package from $package_dir" package_id=$(iota client publish --with-unpublished-dependencies --skip-dependency-verification --silence-warnings --json --gas-budget 500000000 $package_dir | jq --raw-output '.objectChanges[] | select(.type | contains("published")) | .packageId') export IOTA_IDENTITY_PKG_ID=$package_id +echo "${IOTA_IDENTITY_PKG_ID}" \ No newline at end of file diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index c6bf10c92..759a6cc49 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -38,6 +38,7 @@ use secret_storage::Signer; use serde_json::Value; use std::io::Write; use std::ops::Deref; +use std::str::FromStr; use std::sync::Arc; use tokio::process::Command; use tokio::sync::OnceCell; @@ -142,20 +143,13 @@ async fn publish_package(active_address: IotaAddress) -> anyhow::Result(output_str[start_of_json..].trim())? + let package_id: ObjectID = { + let output_str = std::str::from_utf8(&output.stdout).unwrap().trim(); + ObjectID::from_str(output_str).context(format!( + "failed to find IDENTITY_IOTA_PKG_ID in response from: {output_str}" + ))? }; - let package_id = publish_result - .path("$.objectChanges[?(@.type == 'published')].packageId") - .map_err(|e| anyhow!("Failed to parse JSONPath: {e}")) - .and_then(|value| Ok(serde_json::from_value::>(value)?))? - .first() - .copied() - .ok_or_else(|| anyhow!("Failed to parse package ID after publishing"))?; - // Persist package ID in order to avoid publishing the package for every test. let package_id_str = package_id.to_string(); std::env::set_var("IDENTITY_IOTA_PKG_ID", package_id_str.as_str()); From 4b06bffe192f71163b0b5583ce41c5be821666b7 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 16:22:39 +0100 Subject: [PATCH 14/25] fix clippy issues --- identity_iota/Cargo.toml | 6 ++++++ identity_iota_core/tests/e2e/common.rs | 6 +++--- identity_jose/src/jws/decoder.rs | 2 +- identity_jose/src/jws/encoding/utils.rs | 4 ++-- identity_jose/src/jws/recipient.rs | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/identity_iota/Cargo.toml b/identity_iota/Cargo.toml index 2475bf086..81f96fd55 100644 --- a/identity_iota/Cargo.toml +++ b/identity_iota/Cargo.toml @@ -21,6 +21,12 @@ identity_resolver = { version = "=1.4.0", path = "../identity_resolver", default identity_storage = { version = "=1.4.0", path = "../identity_storage", default-features = false, features = ["iota-document"] } identity_verification = { version = "=1.4.0", path = "../identity_verification", default-features = false } +[dev-dependencies] +anyhow = "1.0.64" +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } +rand = "0.8.5" +tokio = { version = "1.29.0", features = ["full"] } + [features] default = ["revocation-bitmap", "iota-client", "resolver"] diff --git a/identity_iota_core/tests/e2e/common.rs b/identity_iota_core/tests/e2e/common.rs index 759a6cc49..025fa3c1e 100644 --- a/identity_iota_core/tests/e2e/common.rs +++ b/identity_iota_core/tests/e2e/common.rs @@ -75,7 +75,6 @@ lazy_static! { } pub async fn get_client() -> anyhow::Result { - { let client = IotaClientBuilder::default().build_localnet().await?; let package_id = PACKAGE_ID.get_or_try_init(|| init(&client)).await.copied()?; let address = get_active_address().await?; @@ -91,7 +90,6 @@ pub async fn get_client() -> anyhow::Result { address, storage, }) - }.inspect_err(|e: &anyhow::Error| {println!("{e}"); println!("{:?}", e.source());}) } async fn init(iota_client: &IotaClient) -> anyhow::Result { @@ -232,7 +230,9 @@ impl TestClient { .await?; let new_address = { let output_str = std::str::from_utf8(&output.stdout).unwrap(); - let start_of_json = output_str.find('{').ok_or(anyhow!("No json in output: {}", output_str))?; + let start_of_json = output_str + .find('{') + .ok_or(anyhow!("No json in output: {}", output_str))?; let json_result = serde_json::from_str::(output_str[start_of_json..].trim())?; let address_json = json_result .path("$.address") diff --git a/identity_jose/src/jws/decoder.rs b/identity_jose/src/jws/decoder.rs index 6b93488ac..c1635c86d 100644 --- a/identity_jose/src/jws/decoder.rs +++ b/identity_jose/src/jws/decoder.rs @@ -322,7 +322,7 @@ pub struct JwsValidationIter<'decoder, 'payload, 'signatures> { payload: &'payload [u8], } -impl<'decoder, 'payload, 'signatures> Iterator for JwsValidationIter<'decoder, 'payload, 'signatures> { +impl<'payload> Iterator for JwsValidationIter<'_, 'payload, '_> { type Item = Result>; fn next(&mut self) -> Option { diff --git a/identity_jose/src/jws/encoding/utils.rs b/identity_jose/src/jws/encoding/utils.rs index b1d903e61..2be270348 100644 --- a/identity_jose/src/jws/encoding/utils.rs +++ b/identity_jose/src/jws/encoding/utils.rs @@ -86,7 +86,7 @@ pub(super) struct Flatten<'payload, 'unprotected> { pub(super) signature: JwsSignature<'unprotected>, } -impl<'payload, 'unprotected> Flatten<'payload, 'unprotected> { +impl Flatten<'_, '_> { pub(super) fn to_json(&self) -> Result { serde_json::to_string(&self).map_err(Error::InvalidJson) } @@ -99,7 +99,7 @@ pub(super) struct General<'payload, 'unprotected> { pub(super) signatures: Vec>, } -impl<'payload, 'unprotected> General<'payload, 'unprotected> { +impl General<'_, '_> { pub(super) fn to_json(&self) -> Result { serde_json::to_string(&self).map_err(Error::InvalidJson) } diff --git a/identity_jose/src/jws/recipient.rs b/identity_jose/src/jws/recipient.rs index 602f1e6f3..96dd410fa 100644 --- a/identity_jose/src/jws/recipient.rs +++ b/identity_jose/src/jws/recipient.rs @@ -15,7 +15,7 @@ pub struct Recipient<'a> { pub unprotected: Option<&'a JwsHeader>, } -impl<'a> Default for Recipient<'a> { +impl Default for Recipient<'_> { fn default() -> Self { Self::new() } From 9e02cee4142b698d0cd100439d900d28a98c291f Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 16:49:48 +0100 Subject: [PATCH 15/25] fix dependencies for doc test --- identity_iota/Cargo.toml | 2 ++ identity_iota/README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/identity_iota/Cargo.toml b/identity_iota/Cargo.toml index 81f96fd55..c61cbbd4f 100644 --- a/identity_iota/Cargo.toml +++ b/identity_iota/Cargo.toml @@ -22,7 +22,9 @@ identity_storage = { version = "=1.4.0", path = "../identity_storage", default-f identity_verification = { version = "=1.4.0", path = "../identity_verification", default-features = false } [dev-dependencies] +# required for doc test anyhow = "1.0.64" +identity_iota = { version = "=1.4.0", path = "./", features = ["memstore"] } iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } rand = "0.8.5" tokio = { version = "1.29.0", features = ["full"] } diff --git a/identity_iota/README.md b/identity_iota/README.md index c66dd54e3..76ff3895b 100644 --- a/identity_iota/README.md +++ b/identity_iota/README.md @@ -92,7 +92,7 @@ version = "1.0.0" edition = "2021" [dependencies] -identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha" } +identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.0-alpha" } tokio = { version = "1", features = ["full"] } anyhow = "1.0.62" From 6a1f4b32e5ca760e3db3a07268a7441ad8250f81 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 17:09:41 +0100 Subject: [PATCH 16/25] fix clippy issues --- identity_document/src/document/core_document.rs | 4 ++-- identity_iota_core/src/document/iota_document.rs | 4 ++-- identity_iota_core/src/rebased/assets/asset.rs | 4 ++-- identity_iota_core/src/rebased/migration/alias.rs | 1 - identity_iota_core/src/rebased/migration/identity.rs | 2 +- identity_iota_core/src/rebased/proposals/borrow.rs | 4 ++-- .../src/rebased/proposals/config_change.rs | 2 +- identity_iota_core/src/rebased/proposals/controller.rs | 2 +- identity_iota_core/src/rebased/proposals/mod.rs | 10 +++++----- identity_iota_core/src/rebased/proposals/send.rs | 2 +- 10 files changed, 17 insertions(+), 18 deletions(-) diff --git a/identity_document/src/document/core_document.rs b/identity_document/src/document/core_document.rs index 2747f7fae..1e1a340bb 100644 --- a/identity_document/src/document/core_document.rs +++ b/identity_document/src/document/core_document.rs @@ -690,7 +690,7 @@ impl CoreDocument { &'me self, method_query: Q, scope: Option, - ) -> Option<&VerificationMethod> + ) -> Option<&'me VerificationMethod> where Q: Into>, { @@ -773,7 +773,7 @@ impl CoreDocument { /// Returns the first [`Service`] with an `id` property matching the provided `service_query`, if present. // NOTE: This method demonstrates unexpected behavior in the edge cases where the document contains // services whose ids are of the form #. - pub fn resolve_service<'query, 'me, Q>(&'me self, service_query: Q) -> Option<&Service> + pub fn resolve_service<'query, 'me, Q>(&'me self, service_query: Q) -> Option<&'me Service> where Q: Into>, { diff --git a/identity_iota_core/src/document/iota_document.rs b/identity_iota_core/src/document/iota_document.rs index 73e07d41f..60e304aa1 100644 --- a/identity_iota_core/src/document/iota_document.rs +++ b/identity_iota_core/src/document/iota_document.rs @@ -332,7 +332,7 @@ impl IotaDocument { /// Returns the first [`Service`] with an `id` property matching the provided `service_query`, if present. // NOTE: This method demonstrates unexpected behaviour in the edge cases where the document contains // services whose ids are of the form #. - pub fn resolve_service<'query, 'me, Q>(&'me self, service_query: Q) -> Option<&Service> + pub fn resolve_service<'query, 'me, Q>(&'me self, service_query: Q) -> Option<&'me Service> where Q: Into>, { @@ -347,7 +347,7 @@ impl IotaDocument { &'me self, method_query: Q, scope: Option, - ) -> Option<&VerificationMethod> + ) -> Option<&'me VerificationMethod> where Q: Into>, { diff --git a/identity_iota_core/src/rebased/assets/asset.rs b/identity_iota_core/src/rebased/assets/asset.rs index e1e60b3e4..e96554262 100644 --- a/identity_iota_core/src/rebased/assets/asset.rs +++ b/identity_iota_core/src/rebased/assets/asset.rs @@ -223,7 +223,7 @@ impl AuthenticatedAssetBuilder { } /// Proposal for the transfer of an [`AuthenticatedAsset`]'s ownership from one [`IotaAddress`] to another. - +/// /// # Detailed Workflow /// A [`TransferProposal`] is a **shared** _Move_ object that represents a request to transfer ownership /// of an [`AuthenticatedAsset`] to a new owner. @@ -375,7 +375,7 @@ pub struct UpdateContentTx<'a, T> { } #[async_trait] -impl<'a, T> Transaction for UpdateContentTx<'a, T> +impl Transaction for UpdateContentTx<'_, T> where T: MoveType + Serialize + Clone + Send + Sync, { diff --git a/identity_iota_core/src/rebased/migration/alias.rs b/identity_iota_core/src/rebased/migration/alias.rs index ba56ca379..917edf4c1 100644 --- a/identity_iota_core/src/rebased/migration/alias.rs +++ b/identity_iota_core/src/rebased/migration/alias.rs @@ -45,7 +45,6 @@ pub struct UnmigratedAlias { /// The sender feature. pub sender: Option, - /// The metadata feature. pub metadata: Option>, /// The immutable issuer feature. pub immutable_issuer: Option, diff --git a/identity_iota_core/src/rebased/migration/identity.rs b/identity_iota_core/src/rebased/migration/identity.rs index 16b1d9e4c..561659f6c 100644 --- a/identity_iota_core/src/rebased/migration/identity.rs +++ b/identity_iota_core/src/rebased/migration/identity.rs @@ -501,7 +501,7 @@ impl MoveType for OnChainIdentity { pub struct CreateIdentityTx<'a>(IdentityBuilder<'a>); #[async_trait] -impl<'a> Transaction for CreateIdentityTx<'a> { +impl Transaction for CreateIdentityTx<'_> { type Output = OnChainIdentity; async fn execute_with_opt_gas( self, diff --git a/identity_iota_core/src/rebased/proposals/borrow.rs b/identity_iota_core/src/rebased/proposals/borrow.rs index 3ff90dc49..145b3a8bf 100644 --- a/identity_iota_core/src/rebased/proposals/borrow.rs +++ b/identity_iota_core/src/rebased/proposals/borrow.rs @@ -73,7 +73,7 @@ impl BorrowAction { } } -impl<'i> ProposalBuilder<'i, BorrowAction> { +impl ProposalBuilder<'_, BorrowAction> { /// Adds an object to the list of objects that will be borrowed when executing this action. pub fn borrow(mut self, object_id: ObjectID) -> Self { self.borrow_object(object_id); @@ -177,7 +177,7 @@ impl<'i> ProtoTransaction for UserDrivenTx<'i, BorrowAction> { } #[async_trait] -impl<'i, F> Transaction for UserDrivenTx<'i, BorrowActionWithIntent> +impl Transaction for UserDrivenTx<'_, BorrowActionWithIntent> where F: FnOnce(&mut Ptb, &HashMap) + Send, { diff --git a/identity_iota_core/src/rebased/proposals/config_change.rs b/identity_iota_core/src/rebased/proposals/config_change.rs index cec2bc10c..eec2b54cb 100644 --- a/identity_iota_core/src/rebased/proposals/config_change.rs +++ b/identity_iota_core/src/rebased/proposals/config_change.rs @@ -52,7 +52,7 @@ impl MoveType for ConfigChange { } } -impl<'i> ProposalBuilder<'i, ConfigChange> { +impl ProposalBuilder<'_, ConfigChange> { /// Sets a new value for the identity's threshold. pub fn threshold(mut self, threshold: u64) -> Self { self.set_threshold(threshold); diff --git a/identity_iota_core/src/rebased/proposals/controller.rs b/identity_iota_core/src/rebased/proposals/controller.rs index ec71fc0ec..4be8b08e8 100644 --- a/identity_iota_core/src/rebased/proposals/controller.rs +++ b/identity_iota_core/src/rebased/proposals/controller.rs @@ -160,7 +160,7 @@ impl<'i> ProtoTransaction for UserDrivenTx<'i, ControllerExecution> { } #[async_trait] -impl<'i, F> Transaction for UserDrivenTx<'i, ControllerExecutionWithIntent> +impl Transaction for UserDrivenTx<'_, ControllerExecutionWithIntent> where F: FnOnce(&mut Ptb, &Argument) + Send, { diff --git a/identity_iota_core/src/rebased/proposals/mod.rs b/identity_iota_core/src/rebased/proposals/mod.rs index cb9f61987..a5b8b5380 100644 --- a/identity_iota_core/src/rebased/proposals/mod.rs +++ b/identity_iota_core/src/rebased/proposals/mod.rs @@ -96,14 +96,14 @@ pub struct ProposalBuilder<'i, A> { action: A, } -impl<'i, A> Deref for ProposalBuilder<'i, A> { +impl Deref for ProposalBuilder<'_, A> { type Target = A; fn deref(&self) -> &Self::Target { &self.action } } -impl<'i, A> DerefMut for ProposalBuilder<'i, A> { +impl DerefMut for ProposalBuilder<'_, A> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.action } @@ -161,7 +161,7 @@ pub struct CreateProposalTx<'i, A> { } #[async_trait] -impl<'i, A> Transaction for CreateProposalTx<'i, A> +impl Transaction for CreateProposalTx<'_, A> where Proposal: ProposalT + DeserializeOwned, A: Send, @@ -234,7 +234,7 @@ pub struct ExecuteProposalTx<'i, A> { } #[async_trait] -impl<'i, A> Transaction for ExecuteProposalTx<'i, A> +impl Transaction for ExecuteProposalTx<'_, A> where Proposal: ProposalT, A: Send, @@ -278,7 +278,7 @@ pub struct ApproveProposalTx<'p, 'i, A> { } #[async_trait] -impl<'p, 'i, A> Transaction for ApproveProposalTx<'p, 'i, A> +impl Transaction for ApproveProposalTx<'_, '_, A> where Proposal: ProposalT, A: MoveType + Send, diff --git a/identity_iota_core/src/rebased/proposals/send.rs b/identity_iota_core/src/rebased/proposals/send.rs index 61ee22bae..5b68a2d67 100644 --- a/identity_iota_core/src/rebased/proposals/send.rs +++ b/identity_iota_core/src/rebased/proposals/send.rs @@ -63,7 +63,7 @@ impl SendAction { } } -impl<'i> ProposalBuilder<'i, SendAction> { +impl ProposalBuilder<'_, SendAction> { /// Adds one object to the list of objects to send. pub fn object(mut self, object_id: ObjectID, recipient: IotaAddress) -> Self { self.send_object(object_id, recipient); From 7f644b0d3be9b6c54bb16230a80175a028e99a28 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 17:18:04 +0100 Subject: [PATCH 17/25] fix clippy issues --- identity_document/src/utils/did_url_query.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/identity_document/src/utils/did_url_query.rs b/identity_document/src/utils/did_url_query.rs index 1af2b80b4..d9399457e 100644 --- a/identity_document/src/utils/did_url_query.rs +++ b/identity_document/src/utils/did_url_query.rs @@ -13,7 +13,7 @@ use identity_did::DID; #[repr(transparent)] pub struct DIDUrlQuery<'query>(Cow<'query, str>); -impl<'query> DIDUrlQuery<'query> { +impl DIDUrlQuery<'_> { /// Returns whether this query matches the given DIDUrl. pub(crate) fn matches(&self, did_url: &DIDUrl) -> bool { // Ensure the DID matches if included in the query. @@ -81,7 +81,7 @@ impl<'query> From<&'query DIDUrl> for DIDUrlQuery<'query> { } } -impl<'query> From for DIDUrlQuery<'query> { +impl From for DIDUrlQuery<'_> { fn from(other: DIDUrl) -> Self { Self(Cow::Owned(other.to_string())) } From 05f9d22927580952b370e423170b581fe122c4f4 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 17:23:14 +0100 Subject: [PATCH 18/25] fix clippy issues --- identity_credential/src/credential/jwt_serialization.rs | 2 +- .../src/domain_linkage/domain_linkage_validator.rs | 1 - identity_credential/src/presentation/jwt_serialization.rs | 2 +- identity_credential/src/revocation/status_list_2021/entry.rs | 2 +- .../validity_timeframe_2024/revocation_timeframe_status.rs | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/identity_credential/src/credential/jwt_serialization.rs b/identity_credential/src/credential/jwt_serialization.rs index 82bb1ae24..f2727741c 100644 --- a/identity_credential/src/credential/jwt_serialization.rs +++ b/identity_credential/src/credential/jwt_serialization.rs @@ -131,7 +131,7 @@ where } #[cfg(feature = "validator")] -impl<'credential, T> CredentialJwtClaims<'credential, T> +impl CredentialJwtClaims<'_, T> where T: ToOwned + Serialize + DeserializeOwned, { diff --git a/identity_credential/src/domain_linkage/domain_linkage_validator.rs b/identity_credential/src/domain_linkage/domain_linkage_validator.rs index be67c9683..746a9b2f5 100644 --- a/identity_credential/src/domain_linkage/domain_linkage_validator.rs +++ b/identity_credential/src/domain_linkage/domain_linkage_validator.rs @@ -21,7 +21,6 @@ use super::DomainLinkageValidationResult; use crate::utils::url_only_includes_origin; /// A validator for a Domain Linkage Configuration and Credentials. - pub struct JwtDomainLinkageValidator { validator: JwtCredentialValidator, } diff --git a/identity_credential/src/presentation/jwt_serialization.rs b/identity_credential/src/presentation/jwt_serialization.rs index d8bb18c23..50aab3d42 100644 --- a/identity_credential/src/presentation/jwt_serialization.rs +++ b/identity_credential/src/presentation/jwt_serialization.rs @@ -136,7 +136,7 @@ where } #[cfg(feature = "validator")] -impl<'presentation, CRED, T> PresentationJwtClaims<'presentation, CRED, T> +impl PresentationJwtClaims<'_, CRED, T> where CRED: ToOwned + Serialize + DeserializeOwned + Clone, T: ToOwned + Serialize + DeserializeOwned, diff --git a/identity_credential/src/revocation/status_list_2021/entry.rs b/identity_credential/src/revocation/status_list_2021/entry.rs index 92415d06b..1108b5e7c 100644 --- a/identity_credential/src/revocation/status_list_2021/entry.rs +++ b/identity_credential/src/revocation/status_list_2021/entry.rs @@ -18,7 +18,7 @@ where D: serde::Deserializer<'de>, { struct ExactStrVisitor(&'static str); - impl<'a> Visitor<'a> for ExactStrVisitor { + impl Visitor<'_> for ExactStrVisitor { type Value = &'static str; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "the exact string \"{}\"", self.0) diff --git a/identity_credential/src/revocation/validity_timeframe_2024/revocation_timeframe_status.rs b/identity_credential/src/revocation/validity_timeframe_2024/revocation_timeframe_status.rs index 0a7058911..6ae6ea74f 100644 --- a/identity_credential/src/revocation/validity_timeframe_2024/revocation_timeframe_status.rs +++ b/identity_credential/src/revocation/validity_timeframe_2024/revocation_timeframe_status.rs @@ -18,7 +18,7 @@ where D: serde::Deserializer<'de>, { struct ExactStrVisitor(&'static str); - impl<'a> Visitor<'a> for ExactStrVisitor { + impl Visitor<'_> for ExactStrVisitor { type Value = &'static str; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "the exact string \"{}\"", self.0) From 3414ac9e2792c0427bbc311eb6df1ae337b11567 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 17:28:15 +0100 Subject: [PATCH 19/25] fix clippy issues --- identity_storage/src/storage/storage_signer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/identity_storage/src/storage/storage_signer.rs b/identity_storage/src/storage/storage_signer.rs index 13ab3a1ec..1c64ba3c0 100644 --- a/identity_storage/src/storage/storage_signer.rs +++ b/identity_storage/src/storage/storage_signer.rs @@ -24,7 +24,7 @@ pub struct StorageSigner<'a, K, I> { storage: &'a Storage, } -impl<'a, K, I> Clone for StorageSigner<'a, K, I> { +impl Clone for StorageSigner<'_, K, I> { fn clone(&self) -> Self { StorageSigner { key_id: self.key_id.clone(), @@ -62,7 +62,7 @@ impl<'a, K, I> StorageSigner<'a, K, I> { #[cfg_attr(not(feature = "send-sync-storage"), async_trait(?Send))] #[cfg_attr(feature = "send-sync-storage", async_trait)] -impl<'a, K, I> Signer for StorageSigner<'a, K, I> +impl Signer for StorageSigner<'_, K, I> where K: JwkStorage + Sync, I: KeyIdStorage + Sync, From f2db8ad8df100d221c56b46319dee5afb72dc2d5 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Thu, 28 Nov 2024 19:21:18 +0100 Subject: [PATCH 20/25] fix examples from readme --- README.md | 17 +++++------------ identity_iota/README.md | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 5d1b73618..383fb457f 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Test this example using /~https://github.com/anko/txm: `txm README.md` !test program cd ../.. mkdir tmp -cat | sed -e 's#identity_iota = { git = "[^"]*"#identity_iota = { path = "../identity_iota"#' > tmp/Cargo.toml +cat | sed -e 's#identity_iota = { git = "[^"]*", tag = "[^"]*"#identity_iota = { path = "../identity_iota"#' > tmp/Cargo.toml echo '[workspace]' >>tmp/Cargo.toml --> @@ -93,7 +93,7 @@ edition = "2021" [dependencies] identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.0-alpha" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } tokio = { version = "1", features = ["full"] } anyhow = "1.0.62" rand = "0.8.5" @@ -113,7 +113,6 @@ timeout 360 cargo build || (echo "Process timed out after 360 seconds" && exit 1 --> - ```rust,no_run use anyhow::Context; use identity_iota::iota::IotaDocument; @@ -134,18 +133,12 @@ use identity_iota::verification::MethodScope; use iota_sdk::IotaClientBuilder; use tokio::io::AsyncReadExt; -// The endpoint of the IOTA node to use. -static API_ENDPOINT: &str = "http://localhost"; - -// Test budget for transactions. -const TEST_GAS_BUDGET: u64 = 50_000_000; - /// Demonstrates how to create a DID Document and publish it in a new identity. #[tokio::main] async fn main() -> anyhow::Result<()> { // Create a new client to interact with the IOTA ledger. let iota_client = IotaClientBuilder::default() - .build(API_ENDPOINT) + .build_localnet() .await .map_err(|err| anyhow::anyhow!(format!("failed to connect to network; {}", err)))?; @@ -170,12 +163,12 @@ async fn main() -> anyhow::Result<()> { let identity_client = IdentityClient::new(read_only_client, signer).await?; println!("Your wallet address is: {}", sender_address); - println!("Please request funds from http://localhost/faucet/, wait for a couple of seconds and then press Enter."); + println!("Please request funds from http://127.0.0.1:9123/gas, wait for a couple of seconds and then press Enter."); tokio::io::stdin().read_u8().await?; // Create a new DID document with a placeholder DID. let mut unpublished: IotaDocument = IotaDocument::new(identity_client.network()); - let verification_method_fragment = unpublished + unpublished .generate_method( &storage, JwkMemStore::ED25519_KEY_TYPE, diff --git a/identity_iota/README.md b/identity_iota/README.md index 76ff3895b..713652a0a 100644 --- a/identity_iota/README.md +++ b/identity_iota/README.md @@ -80,7 +80,7 @@ Test this example using /~https://github.com/anko/txm: `txm README.md` !test program cd ../.. mkdir tmp -cat | sed -e 's#identity_iota = { git = "[^"]*"#identity_iota = { path = "../identity_iota"#' > tmp/Cargo.toml +cat | sed -e 's#identity_iota = { git = "[^"]*", tag = "[^"]*"#identity_iota = { path = "../identity_iota"#' > tmp/Cargo.toml echo '[workspace]' >>tmp/Cargo.toml --> @@ -93,7 +93,7 @@ edition = "2021" [dependencies] identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.0-alpha" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } tokio = { version = "1", features = ["full"] } anyhow = "1.0.62" rand = "0.8.5" @@ -113,7 +113,6 @@ timeout 360 cargo build || (echo "Process timed out after 360 seconds" && exit 1 --> - ```rust,no_run use anyhow::Context; use identity_iota::iota::IotaDocument; @@ -134,18 +133,12 @@ use identity_iota::verification::MethodScope; use iota_sdk::IotaClientBuilder; use tokio::io::AsyncReadExt; -// The endpoint of the IOTA node to use. -static API_ENDPOINT: &str = "http://localhost"; - -// Test budget for transactions. -const TEST_GAS_BUDGET: u64 = 50_000_000; - /// Demonstrates how to create a DID Document and publish it in a new identity. #[tokio::main] async fn main() -> anyhow::Result<()> { // Create a new client to interact with the IOTA ledger. let iota_client = IotaClientBuilder::default() - .build(API_ENDPOINT) + .build_localnet() .await .map_err(|err| anyhow::anyhow!(format!("failed to connect to network; {}", err)))?; @@ -170,12 +163,12 @@ async fn main() -> anyhow::Result<()> { let identity_client = IdentityClient::new(read_only_client, signer).await?; println!("Your wallet address is: {}", sender_address); - println!("Please request funds from http://localhost/faucet/, wait for a couple of seconds and then press Enter."); + println!("Please request funds from http://127.0.0.1:9123/gas, wait for a couple of seconds and then press Enter."); tokio::io::stdin().read_u8().await?; // Create a new DID document with a placeholder DID. let mut unpublished: IotaDocument = IotaDocument::new(identity_client.network()); - let verification_method_fragment = unpublished + unpublished .generate_method( &storage, JwkMemStore::ED25519_KEY_TYPE, From f932a65e39c8d4d59500a48fd5e33502e68c8893 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Fri, 29 Nov 2024 09:14:36 +0100 Subject: [PATCH 21/25] add action auth token to release check and check response status --- .../iota-rebase-sandbox/setup/action.yml | 22 ++++++++++++++++--- README.md | 4 ++-- identity_iota/README.md | 4 ++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index a6dc0c0cf..476a77e15 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -21,9 +21,25 @@ runs: PLATFORM="${{ inputs.platform }}" echo "Looking for platform: $PLATFORM" - # Get download URL - DOWNLOAD_URL=$(curl "https://api.github.com/repos/iotaledger/iota/releases/latest" | \ - jq -r --arg p "$PLATFORM" '.assets[] | select(.name | contains($p)) | .browser_download_url') + # Try to get latest releases with action's auth token (-> increased request limit) + CODE_AND_BODY=$(curl \ + "https://api.github.com/repos/iotaledger/iota/releases/latest" \ + -s \ + -w "\n%{http_code}" \ + --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}") + CODE=$(tail -n1 <<< "$CODE_AND_BODY") + BODY=$(sed '$ d' <<< "$CODE_AND_BODY") + + # Check response status + if [[ "$CODE" != 2** ]] + then + echo "IOTA release check failed with status $CODE" + echo "$BODY" + exit 1 + fi + + # Get download link for platform + DOWNLOAD_URL=$(jq -r --arg p "$PLATFORM" '.assets[] | select(.name | contains($p)) | .browser_download_url' <<< "$BODY") # Download and extract echo "Downloading from: $DOWNLOAD_URL" diff --git a/README.md b/README.md index 383fb457f..ac8256e16 100644 --- a/README.md +++ b/README.md @@ -92,11 +92,11 @@ version = "1.0.0" edition = "2021" [dependencies] +anyhow = "1.0.62" identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } -tokio = { version = "1", features = ["full"] } -anyhow = "1.0.62" rand = "0.8.5" +tokio = { version = "1", features = ["full"] } ``` _main.__rs_ diff --git a/identity_iota/README.md b/identity_iota/README.md index 713652a0a..6c682ddae 100644 --- a/identity_iota/README.md +++ b/identity_iota/README.md @@ -92,11 +92,11 @@ version = "1.0.0" edition = "2021" [dependencies] +anyhow = "1.0.62" identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } -tokio = { version = "1", features = ["full"] } -anyhow = "1.0.62" rand = "0.8.5" +tokio = { version = "1", features = ["full"] } ``` _main.__rs_ From 28e1060b7924a97e12e31ddf00bfe7c60e297cd9 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Fri, 29 Nov 2024 09:41:26 +0100 Subject: [PATCH 22/25] update action token to execution step scoped variant --- .github/actions/iota-rebase-sandbox/setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index 476a77e15..fa7cb9483 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -26,7 +26,7 @@ runs: "https://api.github.com/repos/iotaledger/iota/releases/latest" \ -s \ -w "\n%{http_code}" \ - --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}") + --header "authorization: Bearer ${{ github.token }}") CODE=$(tail -n1 <<< "$CODE_AND_BODY") BODY=$(sed '$ d' <<< "$CODE_AND_BODY") From c2bb643b4951898034f2be6bc2e72c263dd764d2 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Fri, 29 Nov 2024 10:01:24 +0100 Subject: [PATCH 23/25] add check for parsed download url --- .github/actions/iota-rebase-sandbox/setup/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index fa7cb9483..01dfb8857 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -40,6 +40,11 @@ runs: # Get download link for platform DOWNLOAD_URL=$(jq -r --arg p "$PLATFORM" '.assets[] | select(.name | contains($p)) | .browser_download_url' <<< "$BODY") + if [ -z "$DOWNLOAD_URL" ] + then + echo "Could not find download url in response body: $BODY" + exit 1 + fi # Download and extract echo "Downloading from: $DOWNLOAD_URL" From 68546b40a6713aff8f452ea8603a7f2a9cd7cdfe Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Fri, 29 Nov 2024 10:57:13 +0100 Subject: [PATCH 24/25] set IOTA binary version to fixed urls - avoid CI breaking on releases, where binariese have not yet been published --- .../iota-rebase-sandbox/setup/action.yml | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/.github/actions/iota-rebase-sandbox/setup/action.yml b/.github/actions/iota-rebase-sandbox/setup/action.yml index 01dfb8857..169fd4eca 100644 --- a/.github/actions/iota-rebase-sandbox/setup/action.yml +++ b/.github/actions/iota-rebase-sandbox/setup/action.yml @@ -21,28 +21,15 @@ runs: PLATFORM="${{ inputs.platform }}" echo "Looking for platform: $PLATFORM" - # Try to get latest releases with action's auth token (-> increased request limit) - CODE_AND_BODY=$(curl \ - "https://api.github.com/repos/iotaledger/iota/releases/latest" \ - -s \ - -w "\n%{http_code}" \ - --header "authorization: Bearer ${{ github.token }}") - CODE=$(tail -n1 <<< "$CODE_AND_BODY") - BODY=$(sed '$ d' <<< "$CODE_AND_BODY") - - # Check response status - if [[ "$CODE" != 2** ]] - then - echo "IOTA release check failed with status $CODE" - echo "$BODY" - exit 1 - fi - - # Get download link for platform - DOWNLOAD_URL=$(jq -r --arg p "$PLATFORM" '.assets[] | select(.name | contains($p)) | .browser_download_url' <<< "$BODY") - if [ -z "$DOWNLOAD_URL" ] - then - echo "Could not find download url in response body: $BODY" + # pinned releases from: + # url = https://api.github.com/repos/iotaledger/iota/releases/latest + # releases might be visible before all binaries are available, so refer to fixed binaries here + if [ "$PLATFORM" = "linux" ]; then + DOWNLOAD_URL="/~https://github.com/iotaledger/iota/releases/download/v0.7.3-rc/iota-v0.7.3-rc-linux-x86_64.tgz" + elif [ "$PLATFORM" = "macos" ]; then + DOWNLOAD_URL="/~https://github.com/iotaledger/iota/releases/download/v0.7.3-rc/iota-v0.7.3-rc-macos-arm64.tgz" + else + echo "not binaries for platform: $PLATFORM" exit 1 fi From 0130f58fffc0cd3f09134dcefb1c196d3a7e8633 Mon Sep 17 00:00:00 2001 From: Sebastian Wolfram Date: Fri, 29 Nov 2024 11:39:13 +0100 Subject: [PATCH 25/25] bump iota dependencies to `v0.7.3-rc` --- README.md | 2 +- bindings/grpc/Cargo.toml | 2 +- examples/Cargo.toml | 2 +- identity_iota/Cargo.toml | 2 +- identity_iota/README.md | 2 +- identity_iota_core/Cargo.toml | 8 ++++---- identity_iota_core/packages/iota_identity/Move.toml | 8 +++++--- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ac8256e16..183c04bd9 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ edition = "2021" [dependencies] anyhow = "1.0.62" identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.3-rc" } rand = "0.8.5" tokio = { version = "1", features = ["full"] } ``` diff --git a/bindings/grpc/Cargo.toml b/bindings/grpc/Cargo.toml index 85c26daa7..f2830d183 100644 --- a/bindings/grpc/Cargo.toml +++ b/bindings/grpc/Cargo.toml @@ -24,7 +24,7 @@ identity_iota = { path = "../../identity_iota", features = ["resolver", "sd-jwt" identity_jose = { path = "../../identity_jose" } identity_storage = { path = "../../identity_storage", features = ["memstore"] } identity_stronghold = { path = "../../identity_stronghold", features = ["send-sync-storage"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.3-rc" } iota-sdk-legacy = { package = "iota-sdk", version = "1.1.2", features = ["stronghold"] } prost = "0.13" rand = "0.8.5" diff --git a/examples/Cargo.toml b/examples/Cargo.toml index d9c6a2467..a280ec5d0 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -10,7 +10,7 @@ anyhow = "1.0.62" identity_eddsa_verifier = { path = "../identity_eddsa_verifier", default-features = false, features = ["ed25519"] } identity_storage = { path = "../identity_storage" } identity_stronghold = { path = "../identity_stronghold", default-features = false, features = ["send-sync-storage"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.3-rc" } iota-sdk-legacy = { package = "iota-sdk", version = "1.0", default-features = false, features = ["tls", "client", "stronghold"] } json-proof-token.workspace = true rand = "0.8.5" diff --git a/identity_iota/Cargo.toml b/identity_iota/Cargo.toml index c61cbbd4f..260004f95 100644 --- a/identity_iota/Cargo.toml +++ b/identity_iota/Cargo.toml @@ -25,7 +25,7 @@ identity_verification = { version = "=1.4.0", path = "../identity_verification", # required for doc test anyhow = "1.0.64" identity_iota = { version = "=1.4.0", path = "./", features = ["memstore"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.3-rc" } rand = "0.8.5" tokio = { version = "1.29.0", features = ["full"] } diff --git a/identity_iota/README.md b/identity_iota/README.md index 6c682ddae..2d50abfd5 100644 --- a/identity_iota/README.md +++ b/identity_iota/README.md @@ -94,7 +94,7 @@ edition = "2021" [dependencies] anyhow = "1.0.62" identity_iota = { git = "/~https://github.com/iotaledger/identity.rs.git", tag = "v1.6.0-alpha", features = ["memstore"] } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9" } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.3-rc" } rand = "0.8.5" tokio = { version = "1", features = ["full"] } ``` diff --git a/identity_iota_core/Cargo.toml b/identity_iota_core/Cargo.toml index 2023c6ad5..e2203ffe9 100644 --- a/identity_iota_core/Cargo.toml +++ b/identity_iota_core/Cargo.toml @@ -35,15 +35,15 @@ bcs = { version = "0.1.4", optional = true } fastcrypto = { git = "/~https://github.com/MystenLabs/fastcrypto", rev = "5f2c63266a065996d53f98156f0412782b468597", package = "fastcrypto", optional = true } identity_eddsa_verifier = { version = "=1.4.0", path = "../identity_eddsa_verifier", optional = true } identity_jose = { version = "=1.4.0", path = "../identity_jose", optional = true } -iota-config = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-config", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9", optional = true } +iota-config = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-config", tag = "v0.7.3-rc", optional = true } iota-crypto = { version = "0.23", optional = true } -iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9", optional = true } +iota-sdk = { git = "/~https://github.com/iotaledger/iota.git", package = "iota-sdk", tag = "v0.7.3-rc", optional = true } itertools = { version = "0.13.0", optional = true } -move-core-types = { git = "/~https://github.com/iotaledger/iota.git", package = "move-core-types", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9", optional = true } +move-core-types = { git = "/~https://github.com/iotaledger/iota.git", package = "move-core-types", tag = "v0.7.3-rc", optional = true } rand = { version = "0.8.5", optional = true } secret-storage = { git = "/~https://github.com/iotaledger/secret-storage.git", tag = "v0.1.0", optional = true } serde-aux = { version = "4.5.0", optional = true } -shared-crypto = { git = "/~https://github.com/iotaledger/iota.git", package = "shared-crypto", rev = "39c83ddcf07894cdee2abd146381d8704205e6e9", optional = true } +shared-crypto = { git = "/~https://github.com/iotaledger/iota.git", package = "shared-crypto", tag = "v0.7.3-rc", optional = true } tokio = { version = "1.29.0", default-features = false, optional = true, features = ["macros", "sync", "rt", "process"] } [dev-dependencies] diff --git a/identity_iota_core/packages/iota_identity/Move.toml b/identity_iota_core/packages/iota_identity/Move.toml index 83cc4519b..c794264cf 100644 --- a/identity_iota_core/packages/iota_identity/Move.toml +++ b/identity_iota_core/packages/iota_identity/Move.toml @@ -6,9 +6,11 @@ name = "IotaIdentity" edition = "2024.beta" [dependencies] -MoveStdlib = { git = "/~https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/move-stdlib", rev = "ead968e573d8feaa1aa78dddadb8b18a8a99870d" } -Iota = { git = "/~https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "ead968e573d8feaa1aa78dddadb8b18a8a99870d" } -Stardust = { git = "/~https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/stardust", rev = "ead968e573d8feaa1aa78dddadb8b18a8a99870d" } +# 'tag' keyword not supported here, therefore use rev instead +# 'tag = "v0.7.3-rc"' equals 'rev = "34da09d2684e7e3356bc457b5e412405357f9972"', which we use here +MoveStdlib = { git = "/~https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/move-stdlib", rev = "34da09d2684e7e3356bc457b5e412405357f9972" } +Iota = { git = "/~https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "34da09d2684e7e3356bc457b5e412405357f9972" } +Stardust = { git = "/~https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/stardust", rev = "34da09d2684e7e3356bc457b5e412405357f9972" } [addresses] iota_identity = "0x0"