diff --git a/.github/workflows/fastcrypto_pull.yml b/.github/workflows/fastcrypto_pull.yml deleted file mode 100644 index 081a939c899..00000000000 --- a/.github/workflows/fastcrypto_pull.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Update the Fastcrypto pointer IOTA - -on: - ## Allow triggering this workflow manually via GitHub CLI/web - workflow_dispatch: - schedule: - # Update on every hour at 10 past the hour - - cron: "10 * * * *" - -jobs: - update-dep: - runs-on: self-hosted - # Important settings as we don't want to open a PR when the update fails - continue-on-error: false - steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 - # Fork of 'Swatinem/rust-cache' which allows caching additional paths - - uses: bmwill/rust-cache@fb63fcd7a959767755b88b5af2f5cbf65fb8a127 # pin@v1 - - name: Install cargo-hakari, and cache the binary - uses: baptiste0928/cargo-install@1cd874a5478fdca35d868ccc74640c5aabbb8f1b # pin@v3.0.0 - with: - crate: cargo-hakari - locked: true - - name: Update the fastcrypto pointer - run: | - scripts/update_fastcrypto.sh - - name: Create Pull Request - uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # pin@v5 - with: - # TODO: change the token to something FC-specific? - token: ${{ secrets.NW_AUTO_UPDATE }} - commit-message: chore(deps) Update the Fastcrypto pointer - title: chore(deps) Update the Fastcrypto pointer - body: | - - Update Fastcrypto - - Auto-generated by [create-pull-request][1] and the scripts/update_fastcrypto.sh script - - [1]: https://github.com/peter-evans/create-pull-request - branch: update-fastcrypto diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml deleted file mode 100644 index 644941eda69..00000000000 --- a/.github/workflows/trigger_builds.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Trigger builds for images and binaries - -on: - workflow_dispatch: - push: - branches: - - "devnet" - - "testnet" - - "mainnet" - - "releases/iota-*-release" - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -jobs: - docker-images: - runs-on: self-hosted - steps: - - name: Dispatch Docker Builds in iotaledger/iota-operations - uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # pin@v3 - with: - repository: iotaledger/iota-operations - token: ${{ secrets.DOCKER_BINARY_BUILDS_DISPATCH }} - event-type: build-docker-images - client-payload: '{"iota_commit": "${{ github.sha }}", "docker_hub_tag": "${{ github.ref }}"}' - - release-binaries: - runs-on: self-hosted - steps: - - name: Dispatch Release binaries builds in iotaledger/iota-operations - uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # pin@v3 - with: - repository: iotaledger/iota-operations - token: ${{ secrets.DOCKER_BINARY_BUILDS_DISPATCH }} - event-type: build-release-binaries - client-payload: '{"iota_commit": "${{ github.sha }}"}' diff --git a/Cargo.lock b/Cargo.lock index 143d13d6b82..977d527739b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5778,7 +5778,7 @@ dependencies = [ [[package]] name = "iota-adapter-transactional-tests" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "datatest-stable", "iota-transactional-test-runner", @@ -5905,7 +5905,7 @@ dependencies = [ [[package]] name = "iota-authority-aggregation" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "futures", "iota-metrics", @@ -5916,7 +5916,7 @@ dependencies = [ [[package]] name = "iota-aws-orchestrator" -version = "0.0.1" +version = "0.5.0-alpha" dependencies = [ "async-trait", "aws-config", @@ -5947,7 +5947,7 @@ dependencies = [ [[package]] name = "iota-benchmark" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -6072,7 +6072,7 @@ dependencies = [ [[package]] name = "iota-bridge-indexer" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -6142,7 +6142,7 @@ dependencies = [ [[package]] name = "iota-common" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "futures", "parking_lot 0.12.3", @@ -6151,7 +6151,7 @@ dependencies = [ [[package]] name = "iota-config" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anyhow", @@ -6178,7 +6178,7 @@ dependencies = [ [[package]] name = "iota-core" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anyhow", @@ -6280,7 +6280,7 @@ dependencies = [ [[package]] name = "iota-cost" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -6369,7 +6369,7 @@ dependencies = [ [[package]] name = "iota-data-ingestion-core" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -6458,7 +6458,7 @@ dependencies = [ [[package]] name = "iota-enum-compat-util" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "serde_yaml", ] @@ -6539,7 +6539,7 @@ dependencies = [ [[package]] name = "iota-framework" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -6575,7 +6575,7 @@ dependencies = [ [[package]] name = "iota-framework-tests" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "datatest-stable", "iota-adapter-latest", @@ -6595,7 +6595,7 @@ dependencies = [ [[package]] name = "iota-genesis-builder" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -6647,7 +6647,7 @@ dependencies = [ [[package]] name = "iota-genesis-common" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "iota-execution", "iota-protocol-config", @@ -6665,7 +6665,7 @@ dependencies = [ [[package]] name = "iota-graphql-e2e-tests" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "datatest-stable", "iota-graphql-rpc", @@ -6676,7 +6676,7 @@ dependencies = [ [[package]] name = "iota-graphql-rpc" -version = "2024.7.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-graphql", @@ -6755,7 +6755,7 @@ dependencies = [ [[package]] name = "iota-graphql-rpc-client" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "async-graphql", "axum", @@ -6768,7 +6768,7 @@ dependencies = [ [[package]] name = "iota-graphql-rpc-headers" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "axum", ] @@ -6835,7 +6835,7 @@ dependencies = [ [[package]] name = "iota-indexer-builder" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -6850,7 +6850,7 @@ dependencies = [ [[package]] name = "iota-json" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -6869,7 +6869,7 @@ dependencies = [ [[package]] name = "iota-json-rpc" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "arc-swap", @@ -6922,7 +6922,7 @@ dependencies = [ [[package]] name = "iota-json-rpc-api" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "fastcrypto", @@ -6941,7 +6941,7 @@ dependencies = [ [[package]] name = "iota-json-rpc-tests" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -6979,7 +6979,7 @@ dependencies = [ [[package]] name = "iota-json-rpc-types" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -7008,7 +7008,7 @@ dependencies = [ [[package]] name = "iota-keys" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bip32", @@ -7051,7 +7051,7 @@ dependencies = [ [[package]] name = "iota-macros" -version = "0.7.0" +version = "0.5.0-alpha" dependencies = [ "futures", "iota-proc-macros", @@ -7082,7 +7082,7 @@ dependencies = [ [[package]] name = "iota-metrics" -version = "0.7.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anemo-tower", @@ -7219,7 +7219,7 @@ dependencies = [ [[package]] name = "iota-network" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anemo-build", @@ -7257,7 +7257,7 @@ dependencies = [ [[package]] name = "iota-network-stack" -version = "0.2.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "bcs", @@ -7354,7 +7354,7 @@ dependencies = [ [[package]] name = "iota-open-rpc-macros" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "derive-syn-parse", "itertools 0.13.0", @@ -7398,7 +7398,7 @@ dependencies = [ [[package]] name = "iota-package-resolver" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "async-trait", "bcs", @@ -7421,7 +7421,7 @@ dependencies = [ [[package]] name = "iota-proc-macros" -version = "0.7.0" +version = "0.5.0-alpha" dependencies = [ "msim-macros", "proc-macro2 1.0.86", @@ -7431,7 +7431,7 @@ dependencies = [ [[package]] name = "iota-protocol-config" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "clap", "insta", @@ -7445,7 +7445,7 @@ dependencies = [ [[package]] name = "iota-protocol-config-macros" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.37", @@ -7454,7 +7454,7 @@ dependencies = [ [[package]] name = "iota-replay" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-recursion", @@ -7501,7 +7501,7 @@ dependencies = [ [[package]] name = "iota-rest-api" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -7600,7 +7600,7 @@ dependencies = [ [[package]] name = "iota-rust-sdk" version = "0.0.0" -source = "git+ssh://git@github.com/iotaledger/iota-rust-sdk.git?rev=ed6173d434c77604ddc93aaa1550168fdbe97b09#ed6173d434c77604ddc93aaa1550168fdbe97b09" +source = "git+ssh://git@github.com/iotaledger/iota-rust-sdk.git?rev=dd7b331a5ec62fd5e810051d19f31dff90ea7e3f#dd7b331a5ec62fd5e810051d19f31dff90ea7e3f" dependencies = [ "base64ct", "bcs", @@ -7696,7 +7696,7 @@ dependencies = [ [[package]] name = "iota-simulator" -version = "0.7.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anemo-tower", @@ -7753,7 +7753,7 @@ dependencies = [ [[package]] name = "iota-snapshot" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -7813,7 +7813,7 @@ dependencies = [ [[package]] name = "iota-source-validation-service" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "axum", @@ -7852,7 +7852,7 @@ dependencies = [ [[package]] name = "iota-storage" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -7935,7 +7935,7 @@ dependencies = [ [[package]] name = "iota-swarm" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "futures", @@ -7960,7 +7960,7 @@ dependencies = [ [[package]] name = "iota-swarm-config" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anyhow", @@ -7987,7 +7987,7 @@ dependencies = [ [[package]] name = "iota-test-transaction-builder" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "bcs", "iota-genesis-builder", @@ -8000,7 +8000,7 @@ dependencies = [ [[package]] name = "iota-tls" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "axum", @@ -8066,7 +8066,7 @@ dependencies = [ [[package]] name = "iota-transaction-builder" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -8082,7 +8082,7 @@ dependencies = [ [[package]] name = "iota-transaction-checks" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "fastcrypto-zkp", "iota-config", @@ -8096,7 +8096,7 @@ dependencies = [ [[package]] name = "iota-transactional-test-runner" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -8145,7 +8145,7 @@ dependencies = [ [[package]] name = "iota-types" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anemo", "anyhow", @@ -8176,6 +8176,7 @@ dependencies = [ "iota-protocol-config", "iota-rust-sdk", "iota-sdk 1.1.5", + "iota-util-mem", "itertools 0.13.0", "lru 0.12.4", "move-binary-format", @@ -8226,7 +8227,7 @@ dependencies = [ [[package]] name = "iota-upgrade-compatibility-transactional-tests" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "datatest-stable", @@ -8240,7 +8241,7 @@ dependencies = [ [[package]] name = "iota-util-mem" -version = "0.11.0" +version = "0.5.0-alpha" dependencies = [ "cfg-if", "ed25519-consensus", @@ -8258,7 +8259,7 @@ dependencies = [ [[package]] name = "iota-util-mem-derive" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "proc-macro2 1.0.86", "syn 1.0.109", @@ -8282,7 +8283,7 @@ dependencies = [ [[package]] name = "iota-verifier-transactional-tests" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "datatest-stable", "iota-transactional-test-runner", @@ -11782,7 +11783,7 @@ dependencies = [ [[package]] name = "prometheus-closure-metric" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "prometheus", @@ -13560,7 +13561,7 @@ dependencies = [ [[package]] name = "shared-crypto" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "bcs", "eyre", @@ -13683,7 +13684,7 @@ dependencies = [ [[package]] name = "simulacrum" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "async-trait", @@ -14387,7 +14388,7 @@ dependencies = [ [[package]] name = "telemetry-subscribers" -version = "0.2.0" +version = "0.5.0-alpha" dependencies = [ "atomic_float", "bytes", @@ -14463,7 +14464,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test-cluster" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "anyhow", "bcs", @@ -15204,7 +15205,7 @@ dependencies = [ [[package]] name = "transaction-fuzzer" -version = "0.1.0" +version = "0.5.0-alpha" dependencies = [ "iota-core", "iota-move-build", @@ -15310,7 +15311,7 @@ dependencies = [ [[package]] name = "typed-store" -version = "0.4.0" +version = "0.5.0-alpha" dependencies = [ "async-trait", "bcs", @@ -15341,7 +15342,7 @@ dependencies = [ [[package]] name = "typed-store-derive" -version = "0.3.0" +version = "0.5.0-alpha" dependencies = [ "itertools 0.13.0", "proc-macro2 1.0.86", @@ -15351,7 +15352,7 @@ dependencies = [ [[package]] name = "typed-store-error" -version = "0.4.0" +version = "0.5.0-alpha" dependencies = [ "serde", "thiserror", @@ -15359,7 +15360,7 @@ dependencies = [ [[package]] name = "typed-store-workspace-hack" -version = "0.0.0" +version = "0.5.0-alpha" dependencies = [ "libc", "memchr", diff --git a/Cargo.toml b/Cargo.toml index 6e2a2216326..b8fdc8cecde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -417,7 +417,7 @@ iota-rosetta = { path = "crates/iota-rosetta" } iota-rpc-loadgen = { path = "crates/iota-rpc-loadgen" } iota-sdk = { path = "crates/iota-sdk" } # core-types with json format for REST API -iota-sdk2 = { package = "iota-rust-sdk", git = "ssh://git@github.com/iotaledger/iota-rust-sdk.git", rev = "ed6173d434c77604ddc93aaa1550168fdbe97b09", features = ["hash", "serde", "schemars"] } +iota-sdk2 = { package = "iota-rust-sdk", git = "ssh://git@github.com/iotaledger/iota-rust-sdk.git", rev = "dd7b331a5ec62fd5e810051d19f31dff90ea7e3f", features = ["hash", "serde", "schemars"] } iota-simulator = { path = "crates/iota-simulator" } iota-snapshot = { path = "crates/iota-snapshot" } iota-source-validation = { path = "crates/iota-source-validation" } diff --git a/crates/iota-adapter-transactional-tests/Cargo.toml b/crates/iota-adapter-transactional-tests/Cargo.toml index e83a36b63e7..cbbf533c426 100644 --- a/crates/iota-adapter-transactional-tests/Cargo.toml +++ b/crates/iota-adapter-transactional-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-adapter-transactional-tests" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-authority-aggregation/Cargo.toml b/crates/iota-authority-aggregation/Cargo.toml index d3806d75bbf..96933a2db1a 100644 --- a/crates/iota-authority-aggregation/Cargo.toml +++ b/crates/iota-authority-aggregation/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-authority-aggregation" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-aws-orchestrator/Cargo.toml b/crates/iota-aws-orchestrator/Cargo.toml index 9f1feb3fb82..f1e379bf55f 100644 --- a/crates/iota-aws-orchestrator/Cargo.toml +++ b/crates/iota-aws-orchestrator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-aws-orchestrator" -version = "0.0.1" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-benchmark/Cargo.toml b/crates/iota-benchmark/Cargo.toml index 4a8bc1dbe07..18b7528c396 100644 --- a/crates/iota-benchmark/Cargo.toml +++ b/crates/iota-benchmark/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-benchmark" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-bridge-indexer/Cargo.toml b/crates/iota-bridge-indexer/Cargo.toml index a4c53387246..ef569b6fc10 100644 --- a/crates/iota-bridge-indexer/Cargo.toml +++ b/crates/iota-bridge-indexer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-bridge-indexer" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-common/Cargo.toml b/crates/iota-common/Cargo.toml index a50362ce983..dae484a5052 100644 --- a/crates/iota-common/Cargo.toml +++ b/crates/iota-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-common" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-config/Cargo.toml b/crates/iota-config/Cargo.toml index 3e8f0e0ab8d..b9a2c09c78d 100644 --- a/crates/iota-config/Cargo.toml +++ b/crates/iota-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-config" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-core/Cargo.toml b/crates/iota-core/Cargo.toml index 8138aea0c46..15b4ed36fae 100644 --- a/crates/iota-core/Cargo.toml +++ b/crates/iota-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-core" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-core/src/execution_cache.rs b/crates/iota-core/src/execution_cache.rs index ee795648f53..e9d885485ed 100644 --- a/crates/iota-core/src/execution_cache.rs +++ b/crates/iota-core/src/execution_cache.rs @@ -17,7 +17,7 @@ use iota_types::{ object::{Object, Owner}, storage::{ BackingPackageStore, BackingStore, ChildObjectResolver, InputKey, MarkerValue, ObjectKey, - ObjectOrTombstone, ObjectStore, PackageObject, ParentSync, + ObjectOrTombstone, ObjectStore, PackageObject, error::{Error as StorageError, Result as StorageResult}, }, transaction::{VerifiedSignedTransaction, VerifiedTransaction}, @@ -819,15 +819,6 @@ macro_rules! implement_storage_traits { ObjectCacheRead::get_package_object(self, package_id) } } - - impl ParentSync for $implementor { - fn get_latest_parent_entry_ref_deprecated( - &self, - object_id: ObjectID, - ) -> IotaResult> { - ObjectCacheRead::get_latest_object_ref_or_tombstone(self, object_id) - } - } }; } diff --git a/crates/iota-core/tests/staged/iota.yaml b/crates/iota-core/tests/staged/iota.yaml index 7a2a28721f5..1d2cd9c0734 100644 --- a/crates/iota-core/tests/staged/iota.yaml +++ b/crates/iota-core/tests/staged/iota.yaml @@ -453,7 +453,7 @@ ExecutionFailureStatus: 29: CertificateDenied: UNIT 30: - IotaMoveVerificationTimedout: UNIT + IotaMoveVerificationTimeout: UNIT 31: SharedObjectOperationNotAllowed: UNIT 32: diff --git a/crates/iota-cost/Cargo.toml b/crates/iota-cost/Cargo.toml index 7558a4dfbde..f3aa0296262 100644 --- a/crates/iota-cost/Cargo.toml +++ b/crates/iota-cost/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-cost" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-data-ingestion-core/Cargo.toml b/crates/iota-data-ingestion-core/Cargo.toml index 8387e5f6dc0..7c81d572656 100644 --- a/crates/iota-data-ingestion-core/Cargo.toml +++ b/crates/iota-data-ingestion-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-data-ingestion-core" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-e2e-tests/tests/full_node_tests.rs b/crates/iota-e2e-tests/tests/full_node_tests.rs index 899f314b5ad..a705d3b346b 100644 --- a/crates/iota-e2e-tests/tests/full_node_tests.rs +++ b/crates/iota-e2e-tests/tests/full_node_tests.rs @@ -271,32 +271,7 @@ async fn test_full_node_indexes() -> Result<(), anyhow::Error> { let node = &test_cluster.fullnode_handle.iota_node; let context = &mut test_cluster.wallet; - let (transferred_object, sender, receiver, digest, _) = transfer_coin(context).await?; - - let txes = node - .state() - .get_transactions_for_tests( - Some(TransactionFilter::InputObject(transferred_object)), - None, - None, - false, - ) - .await?; - - assert_eq!(txes.len(), 1); - assert_eq!(txes[0], digest); - - let txes = node - .state() - .get_transactions_for_tests( - Some(TransactionFilter::ChangedObject(transferred_object)), - None, - None, - false, - ) - .await?; - assert_eq!(txes.len(), 2); - assert_eq!(txes[1], digest); + let (_, sender, receiver, digest, _) = transfer_coin(context).await?; let txes = node .state() @@ -641,14 +616,14 @@ async fn test_full_node_event_read_api_ok() { let node = &test_cluster.fullnode_handle.iota_node; let jsonrpc_client = &test_cluster.fullnode_handle.rpc_client; - let (package_id, gas_id_1, _) = publish_nfts_package(context).await; + let (package_id, _, publish_digest) = publish_nfts_package(context).await; - let (transferred_object, _, _, digest, _) = transfer_coin(context).await.unwrap(); + let (_, sender, _, transfer_digest, _) = transfer_coin(context).await.unwrap(); let txes = node .state() .get_transactions_for_tests( - Some(TransactionFilter::InputObject(transferred_object)), + Some(TransactionFilter::FromAddress(sender)), None, None, false, @@ -656,13 +631,11 @@ async fn test_full_node_event_read_api_ok() { .await .unwrap(); - if gas_id_1 == transferred_object { - assert_eq!(txes.len(), 2); - assert!(txes[0] == digest || txes[1] == digest); - } else { - assert_eq!(txes.len(), 1); - assert_eq!(txes[0], digest); - } + assert_eq!(txes.len(), 2); + assert!( + (txes[0] == publish_digest && txes[1] == transfer_digest) + || (txes[0] == transfer_digest && txes[1] == publish_digest) + ); // This is a poor substitute for the post processing taking some time sleep(Duration::from_millis(1000)).await; diff --git a/crates/iota-enum-compat-util/Cargo.toml b/crates/iota-enum-compat-util/Cargo.toml index 8668c700e71..de38fa5b4d0 100644 --- a/crates/iota-enum-compat-util/Cargo.toml +++ b/crates/iota-enum-compat-util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-enum-compat-util" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-framework-tests/Cargo.toml b/crates/iota-framework-tests/Cargo.toml index 17fa82809a8..8f97e952c9f 100644 --- a/crates/iota-framework-tests/Cargo.toml +++ b/crates/iota-framework-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-framework-tests" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-framework/Cargo.toml b/crates/iota-framework/Cargo.toml index 9657612ff55..08416551421 100644 --- a/crates/iota-framework/Cargo.toml +++ b/crates/iota-framework/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-framework" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-genesis-builder/Cargo.toml b/crates/iota-genesis-builder/Cargo.toml index 30b67e5cd94..a70eac62788 100644 --- a/crates/iota-genesis-builder/Cargo.toml +++ b/crates/iota-genesis-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-genesis-builder" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-genesis-common/Cargo.toml b/crates/iota-genesis-common/Cargo.toml index 13f22b1e239..cf366831ee0 100644 --- a/crates/iota-genesis-common/Cargo.toml +++ b/crates/iota-genesis-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-genesis-common" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-graphql-e2e-tests/Cargo.toml b/crates/iota-graphql-e2e-tests/Cargo.toml index a1be716fdff..de5796645cb 100644 --- a/crates/iota-graphql-e2e-tests/Cargo.toml +++ b/crates/iota-graphql-e2e-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-graphql-e2e-tests" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-graphql-e2e-tests/tests/call/simple.exp b/crates/iota-graphql-e2e-tests/tests/call/simple.exp index 61e00b36401..1f64469d77c 100644 --- a/crates/iota-graphql-e2e-tests/tests/call/simple.exp +++ b/crates/iota-graphql-e2e-tests/tests/call/simple.exp @@ -114,11 +114,11 @@ task 15, lines 64-69: Headers: { "content-type": "application/json", "content-length": "157", - "x-iota-rpc-version": "2024.7.0-testing-no-sha", + "x-iota-rpc-version": "0.5.0-testing-no-sha", "vary": "origin, access-control-request-method, access-control-request-headers", "access-control-allow-origin": "*", } -Service version: 2024.7.0-testing-no-sha +Service version: 0.5.0-testing-no-sha Response: { "data": { "checkpoint": { @@ -375,7 +375,7 @@ Response: { "data": { "serviceConfig": { "availableVersions": [ - "2024.7" + "0.5" ] } } diff --git a/crates/iota-graphql-rpc-client/Cargo.toml b/crates/iota-graphql-rpc-client/Cargo.toml index 0e2c3c4fdae..9e255bcb29c 100644 --- a/crates/iota-graphql-rpc-client/Cargo.toml +++ b/crates/iota-graphql-rpc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-graphql-rpc-client" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-graphql-rpc-headers/Cargo.toml b/crates/iota-graphql-rpc-headers/Cargo.toml index b868c1c6ccd..5e534bb0975 100644 --- a/crates/iota-graphql-rpc-headers/Cargo.toml +++ b/crates/iota-graphql-rpc-headers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-graphql-rpc-headers" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-graphql-rpc/Cargo.toml b/crates/iota-graphql-rpc/Cargo.toml index 5cdddb177de..4e8b5b27650 100644 --- a/crates/iota-graphql-rpc/Cargo.toml +++ b/crates/iota-graphql-rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-graphql-rpc" -version = "2024.7.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-indexer-builder/Cargo.toml b/crates/iota-indexer-builder/Cargo.toml index 095bbce7bae..1b12d82425f 100644 --- a/crates/iota-indexer-builder/Cargo.toml +++ b/crates/iota-indexer-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-indexer-builder" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-json-rpc-api/Cargo.toml b/crates/iota-json-rpc-api/Cargo.toml index 1075408aff0..7bec4ba6e6c 100644 --- a/crates/iota-json-rpc-api/Cargo.toml +++ b/crates/iota-json-rpc-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-json-rpc-api" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-json-rpc-tests/Cargo.toml b/crates/iota-json-rpc-tests/Cargo.toml index 421b2aa0578..27426da9f8f 100644 --- a/crates/iota-json-rpc-tests/Cargo.toml +++ b/crates/iota-json-rpc-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-json-rpc-tests" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-json-rpc-types/Cargo.toml b/crates/iota-json-rpc-types/Cargo.toml index 364acf02a42..0ed71ce6863 100644 --- a/crates/iota-json-rpc-types/Cargo.toml +++ b/crates/iota-json-rpc-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-json-rpc-types" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-json-rpc-types/src/iota_transaction.rs b/crates/iota-json-rpc-types/src/iota_transaction.rs index af0cdca061b..23e4cdfc8c0 100644 --- a/crates/iota-json-rpc-types/src/iota_transaction.rs +++ b/crates/iota-json-rpc-types/src/iota_transaction.rs @@ -184,14 +184,6 @@ impl IotaTransactionBlockResponseOptions { } } - #[deprecated( - since = "1.33.0", - note = "Balance and object changes no longer require local execution" - )] - pub fn require_local_execution(&self) -> bool { - self.show_balance_changes || self.show_object_changes - } - pub fn require_input(&self) -> bool { self.show_input || self.show_raw_input || self.show_object_changes } diff --git a/crates/iota-json-rpc/Cargo.toml b/crates/iota-json-rpc/Cargo.toml index 538552407eb..59f00a802b4 100644 --- a/crates/iota-json-rpc/Cargo.toml +++ b/crates/iota-json-rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-json-rpc" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-json/Cargo.toml b/crates/iota-json/Cargo.toml index dbb3d323f8f..b1c4d4cda25 100644 --- a/crates/iota-json/Cargo.toml +++ b/crates/iota-json/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-json" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-keys/Cargo.toml b/crates/iota-keys/Cargo.toml index d8aa7d381a5..d7a76664418 100644 --- a/crates/iota-keys/Cargo.toml +++ b/crates/iota-keys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-keys" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-macros/Cargo.toml b/crates/iota-macros/Cargo.toml index 8d3cd2b60ed..3f7f960dd06 100644 --- a/crates/iota-macros/Cargo.toml +++ b/crates/iota-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-macros" -version = "0.7.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-metrics/Cargo.toml b/crates/iota-metrics/Cargo.toml index 58bd91fd4bc..f871d0221e1 100644 --- a/crates/iota-metrics/Cargo.toml +++ b/crates/iota-metrics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-metrics" -version = "0.7.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-metrics/src/metered_channel.rs b/crates/iota-metrics/src/metered_channel.rs index 39b875a8a62..210580e1b4b 100644 --- a/crates/iota-metrics/src/metered_channel.rs +++ b/crates/iota-metrics/src/metered_channel.rs @@ -378,28 +378,6 @@ pub fn channel(size: usize, gauge: &IntGauge) -> (Sender, Receiver) { ) } -/// Deprecated: use `monitored_mpsc::channel` instead. -#[track_caller] -pub fn channel_with_total( - size: usize, - gauge: &IntGauge, - total_gauge: &IntCounter, -) -> (Sender, Receiver) { - gauge.set(0); - let (sender, receiver) = mpsc::channel(size); - ( - Sender { - inner: sender, - gauge: gauge.clone(), - }, - Receiver { - inner: receiver, - gauge: gauge.clone(), - total: Some(total_gauge.clone()), - }, - ) -} - /// Defines an asynchronous method `with_permit` for working with a permit to /// send a message. #[async_trait] diff --git a/crates/iota-metrics/src/tests/metered_channel_tests.rs b/crates/iota-metrics/src/tests/metered_channel_tests.rs index 99b64706e65..b3e85fd1a01 100644 --- a/crates/iota-metrics/src/tests/metered_channel_tests.rs +++ b/crates/iota-metrics/src/tests/metered_channel_tests.rs @@ -7,10 +7,10 @@ use futures::{ FutureExt, task::{Context, Poll, noop_waker}, }; -use prometheus::{IntCounter, IntGauge}; +use prometheus::IntGauge; use tokio::sync::mpsc::error::TrySendError; -use super::{channel, channel_with_total}; +use super::channel; #[tokio::test] async fn test_send() { @@ -26,22 +26,6 @@ async fn test_send() { assert_eq!(counter.get(), 0); } -#[tokio::test] -async fn test_total() { - let counter = IntGauge::new("TEST_COUNTER", "test").unwrap(); - let counter_total = IntCounter::new("TEST_TOTAL", "test_total").unwrap(); - let (tx, mut rx) = channel_with_total(8, &counter, &counter_total); - - assert_eq!(counter.get(), 0); - let item = 42; - tx.send(item).await.unwrap(); - assert_eq!(counter.get(), 1); - let received_item = rx.recv().await.unwrap(); - assert_eq!(received_item, item); - assert_eq!(counter.get(), 0); - assert_eq!(counter_total.get(), 1); -} - #[tokio::test] async fn test_empty_closed_channel() { let counter = IntGauge::new("TEST_COUNTER", "test").unwrap(); diff --git a/crates/iota-network-stack/Cargo.toml b/crates/iota-network-stack/Cargo.toml index 09c71863011..47f9d97f3fb 100644 --- a/crates/iota-network-stack/Cargo.toml +++ b/crates/iota-network-stack/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-network-stack" -version = "0.2.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-network/Cargo.toml b/crates/iota-network/Cargo.toml index 24098d9e430..22283e9537d 100644 --- a/crates/iota-network/Cargo.toml +++ b/crates/iota-network/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-network" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-open-rpc-macros/Cargo.toml b/crates/iota-open-rpc-macros/Cargo.toml index 77c30f3357a..fec90a14d91 100644 --- a/crates/iota-open-rpc-macros/Cargo.toml +++ b/crates/iota-open-rpc-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-open-rpc-macros" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-package-resolver/Cargo.toml b/crates/iota-package-resolver/Cargo.toml index e66462ed79b..4e3c54da62e 100644 --- a/crates/iota-package-resolver/Cargo.toml +++ b/crates/iota-package-resolver/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-package-resolver" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-proc-macros/Cargo.toml b/crates/iota-proc-macros/Cargo.toml index 232a8917e22..635d828d407 100644 --- a/crates/iota-proc-macros/Cargo.toml +++ b/crates/iota-proc-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-proc-macros" -version = "0.7.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-protocol-config-macros/Cargo.toml b/crates/iota-protocol-config-macros/Cargo.toml index e5dd7a0feaf..fa7c0700b3f 100644 --- a/crates/iota-protocol-config-macros/Cargo.toml +++ b/crates/iota-protocol-config-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-protocol-config-macros" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-protocol-config/Cargo.toml b/crates/iota-protocol-config/Cargo.toml index 37d84dcaf96..388abe0649b 100644 --- a/crates/iota-protocol-config/Cargo.toml +++ b/crates/iota-protocol-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-protocol-config" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-replay/Cargo.toml b/crates/iota-replay/Cargo.toml index 6e105fc4b7f..c04d90ed733 100644 --- a/crates/iota-replay/Cargo.toml +++ b/crates/iota-replay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-replay" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-replay/src/replay.rs b/crates/iota-replay/src/replay.rs index d5048ca2589..858f1cc0f8f 100644 --- a/crates/iota-replay/src/replay.rs +++ b/crates/iota-replay/src/replay.rs @@ -32,8 +32,8 @@ use iota_types::{ metrics::LimitsMetrics, object::{Data, Object, Owner}, storage::{ - BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, ParentSync, - get_module, get_module_by_id, + BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, get_module, + get_module_by_id, }, transaction::{ CheckedInputObjects, InputObjectKind, InputObjects, ObjectReadResult, ObjectReadResultKind, @@ -1970,39 +1970,6 @@ impl ChildObjectResolver for LocalExec { } } -impl ParentSync for LocalExec { - /// The objects here much already exist in the store because we downloaded - /// them earlier No download from network - fn get_latest_parent_entry_ref_deprecated( - &self, - object_id: ObjectID, - ) -> IotaResult> { - fn inner(self_: &LocalExec, object_id: ObjectID) -> IotaResult> { - if let Some(v) = self_ - .storage - .live_objects_store - .lock() - .expect("Can't lock") - .get(&object_id) - { - return Ok(Some(v.compute_object_reference())); - } - Ok(None) - } - let res = inner(self, object_id); - self.exec_store_events - .lock() - .expect("Unable to lock events list") - .push( - ExecutionStoreEvent::ParentSyncStoreGetLatestParentEntryRef { - object_id, - result: res.clone(), - }, - ); - res - } -} - impl ResourceResolver for LocalExec { type Error = IotaError; diff --git a/crates/iota-replay/src/types.rs b/crates/iota-replay/src/types.rs index 11ca9df050c..993868020a6 100644 --- a/crates/iota-replay/src/types.rs +++ b/crates/iota-replay/src/types.rs @@ -276,10 +276,6 @@ pub enum ExecutionStoreEvent { child: ObjectID, result: IotaResult>, }, - ParentSyncStoreGetLatestParentEntryRef { - object_id: ObjectID, - result: IotaResult>, - }, ResourceResolverGetResource { address: AccountAddress, typ: StructTag, diff --git a/crates/iota-rest-api/Cargo.toml b/crates/iota-rest-api/Cargo.toml index 01a2340dc7c..52398fb326c 100644 --- a/crates/iota-rest-api/Cargo.toml +++ b/crates/iota-rest-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-rest-api" -version = "0.1.0" +version.workspace = true edition = "2021" license = "Apache-2.0" publish = false diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index b787b05bdb7..0a59da60bdf 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -2602,7 +2602,7 @@ "error": { "type": "string", "enum": [ - "iota_move_verification_timedout" + "iota_move_verification_timeout" ] } } @@ -4394,10 +4394,17 @@ { "type": "object", "required": [ + "events", "kind", "objects" ], "properties": { + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Event" + } + }, "kind": { "type": "string", "enum": [ diff --git a/crates/iota-sdk/src/apis/read.rs b/crates/iota-sdk/src/apis/read.rs index 14fe1f9f915..a334f457137 100644 --- a/crates/iota-sdk/src/apis/read.rs +++ b/crates/iota-sdk/src/apis/read.rs @@ -298,7 +298,7 @@ impl ReadApi { .await?) } - /// Return a [IotaObjectResponse] based on the provided [ObjectID] and + /// Return an [IotaObjectResponse] based on the provided [ObjectID] and /// [IotaObjectDataOptions], or an error upon failure. /// /// The [IotaObjectResponse] contains two fields: @@ -456,8 +456,9 @@ impl ReadApi { Ok(*self.api.http.get_total_transaction_blocks().await?) } - /// Return a transaction and its effects in a [IotaTransactionBlockResponse] - /// based on its [TransactionDigest], or an error upon failure. + /// Return a transaction and its effects in an + /// [IotaTransactionBlockResponse] based on its [TransactionDigest], or + /// an error upon failure. pub async fn get_transaction_with_options( &self, digest: TransactionDigest, diff --git a/crates/iota-sdk/src/lib.rs b/crates/iota-sdk/src/lib.rs index 1a2c0268500..27ed64393c5 100644 --- a/crates/iota-sdk/src/lib.rs +++ b/crates/iota-sdk/src/lib.rs @@ -26,7 +26,7 @@ //! //! # Usage //! The main way to interact with the API is through the [IotaClientBuilder], -//! which returns a [IotaClient] object from which the user can access the +//! which returns an [IotaClient] object from which the user can access the //! various APIs. //! //! ## Getting Started @@ -195,7 +195,7 @@ impl IotaClientBuilder { self } - /// Returns a [IotaClient] object connected to the Iota network running at + /// Returns an [IotaClient] object connected to the Iota network running at /// the URI provided. /// /// # Examples @@ -285,7 +285,7 @@ impl IotaClientBuilder { }) } - /// Returns a [IotaClient] object that is ready to interact with the local + /// Returns an [IotaClient] object that is ready to interact with the local /// development network (by default it expects the Iota network to be /// up and running at `127.0.0.1:9000`). /// @@ -308,7 +308,7 @@ impl IotaClientBuilder { self.build(IOTA_LOCAL_NETWORK_URL).await } - /// Returns a [IotaClient] object that is ready to interact with the Iota + /// Returns an [IotaClient] object that is ready to interact with the Iota /// devnet. /// /// For connecting to a custom URI, use the `build` function instead.. @@ -330,7 +330,7 @@ impl IotaClientBuilder { self.build(IOTA_DEVNET_URL).await } - /// Returns a [IotaClient] object that is ready to interact with the Iota + /// Returns an [IotaClient] object that is ready to interact with the Iota /// testnet. /// /// For connecting to a custom URI, use the `build` function instead. @@ -404,7 +404,7 @@ impl IotaClientBuilder { /// /// # Usage /// -/// Use [IotaClientBuilder] to build a [IotaClient]. +/// Use [IotaClientBuilder] to build an [IotaClient]. /// /// # Examples /// diff --git a/crates/iota-simulator/Cargo.toml b/crates/iota-simulator/Cargo.toml index b881cefb26b..f0f8a82d7d7 100644 --- a/crates/iota-simulator/Cargo.toml +++ b/crates/iota-simulator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-simulator" -version = "0.7.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-single-node-benchmark/src/mock_storage.rs b/crates/iota-single-node-benchmark/src/mock_storage.rs index c0ff1624cfc..e5740a903d8 100644 --- a/crates/iota-single-node-benchmark/src/mock_storage.rs +++ b/crates/iota-single-node-benchmark/src/mock_storage.rs @@ -9,13 +9,13 @@ use std::{ use iota_storage::package_object_cache::PackageObjectCache; use iota_types::{ - base_types::{EpochId, ObjectID, ObjectRef, SequenceNumber, VersionNumber}, + base_types::{EpochId, ObjectID, SequenceNumber, VersionNumber}, error::{IotaError, IotaResult}, inner_temporary_store::InnerTemporaryStore, object::{Object, Owner}, storage::{ BackingPackageStore, ChildObjectResolver, GetSharedLocks, ObjectStore, PackageObject, - ParentSync, get_module_by_id, + get_module_by_id, }, transaction::{InputObjectKind, InputObjects, ObjectReadResult, TransactionKey}, }; @@ -170,15 +170,6 @@ impl GetModule for InMemoryObjectStore { } } -impl ParentSync for InMemoryObjectStore { - fn get_latest_parent_entry_ref_deprecated( - &self, - _object_id: ObjectID, - ) -> IotaResult> { - unreachable!() - } -} - impl GetSharedLocks for InMemoryObjectStore { fn get_shared_locks( &self, diff --git a/crates/iota-snapshot/Cargo.toml b/crates/iota-snapshot/Cargo.toml index e52716185b9..26c10319894 100644 --- a/crates/iota-snapshot/Cargo.toml +++ b/crates/iota-snapshot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-snapshot" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-source-validation-service/Cargo.toml b/crates/iota-source-validation-service/Cargo.toml index 861edf99d63..7c0451f1298 100644 --- a/crates/iota-source-validation-service/Cargo.toml +++ b/crates/iota-source-validation-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-source-validation-service" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-storage/Cargo.toml b/crates/iota-storage/Cargo.toml index 61bddb1328c..d0d7a9cb32b 100644 --- a/crates/iota-storage/Cargo.toml +++ b/crates/iota-storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-storage" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-storage/tests/key_value_tests.rs b/crates/iota-storage/tests/key_value_tests.rs index 8f20904994f..07fa3b01421 100644 --- a/crates/iota-storage/tests/key_value_tests.rs +++ b/crates/iota-storage/tests/key_value_tests.rs @@ -427,42 +427,47 @@ async fn test_get_tx_from_fallback() { #[cfg(msim)] mod simtests { use std::{ + net::SocketAddr, sync::Mutex, time::{Duration, Instant}, }; use axum::{ + body::Body, extract::{Request, State}, + response::Response, routing::get, }; use iota_macros::sim_test; use iota_simulator::configs::constant_latency_ms; use iota_storage::http_key_value_store::*; use rustls::crypto::{CryptoProvider, ring}; - use tokio::net::TcpListener; use tracing::info; use super::*; + async fn svc( + State(state): State>>>>, + request: Request, + ) -> Response { + let path = request.uri().path().to_string(); + let key = path.trim_start_matches('/'); + let value = state.lock().unwrap().get(key).cloned(); + info!("Got request for key: {:?}, value: {:?}", key, value); + match value { + Some(v) => Response::new(Body::from(v)), + None => Response::builder() + .status(hyper::StatusCode::NOT_FOUND) + .body(Body::empty()) + .unwrap(), + } + } + async fn test_server(data: Arc>>>) { let handle = iota_simulator::runtime::Handle::current(); let builder = handle.create_node(); let (startup_sender, mut startup_receiver) = tokio::sync::watch::channel(false); let startup_sender = Arc::new(startup_sender); - let (sender, _) = tokio::sync::broadcast::channel::<()>(1); - - async fn get_data( - data: State>>>>, - req: Request, - ) -> Result, String> { - let path = req.uri().path().to_string(); - let key = path.trim_start_matches('/'); - let value = data.lock().unwrap().get(key).cloned(); - info!("Got request for key: {:?}, value: {:?}", key, value); - value.ok_or_else(|| "no value".to_owned()) - } - - let sender_clone = sender.clone(); let _node = builder .ip("10.10.10.10".parse().unwrap()) .name("server") @@ -470,21 +475,13 @@ mod simtests { info!("Server started"); let data = data.clone(); let startup_sender = startup_sender.clone(); - let mut receiver = sender_clone.subscribe(); async move { - let app = axum::Router::new() - .route("/", get(get_data)) - .with_state(data); - - let addr = TcpListener::bind(("10.10.10.10", 8080)).await.unwrap(); - - tokio::spawn(async move { - axum::serve(addr, app) - .with_graceful_shutdown(async move { - receiver.recv().await.ok(); - }) - .await - .unwrap() + let router = get(svc).with_state(data); + let addr = SocketAddr::from(([10, 10, 10, 10], 8080)); + let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); + + tokio::spawn(async { + axum::serve(listener, router).await.unwrap(); }); startup_sender.send(true).ok(); @@ -492,7 +489,6 @@ mod simtests { }) .build(); startup_receiver.changed().await.unwrap(); - sender.send(()).ok(); } #[sim_test(config = "constant_latency_ms(250)")] diff --git a/crates/iota-swarm-config/Cargo.toml b/crates/iota-swarm-config/Cargo.toml index 184c38b6bd2..3f36999d2f6 100644 --- a/crates/iota-swarm-config/Cargo.toml +++ b/crates/iota-swarm-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-swarm-config" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-swarm/Cargo.toml b/crates/iota-swarm/Cargo.toml index e69ed6612ad..783c57c891a 100644 --- a/crates/iota-swarm/Cargo.toml +++ b/crates/iota-swarm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-swarm" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-test-transaction-builder/Cargo.toml b/crates/iota-test-transaction-builder/Cargo.toml index b3cf1f4d923..cfcbe035366 100644 --- a/crates/iota-test-transaction-builder/Cargo.toml +++ b/crates/iota-test-transaction-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-test-transaction-builder" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-tls/Cargo.toml b/crates/iota-tls/Cargo.toml index 25a602741b1..3a1002c1946 100644 --- a/crates/iota-tls/Cargo.toml +++ b/crates/iota-tls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-tls" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-transaction-builder/Cargo.toml b/crates/iota-transaction-builder/Cargo.toml index 7023993b4c5..b7b2ea053a8 100644 --- a/crates/iota-transaction-builder/Cargo.toml +++ b/crates/iota-transaction-builder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-transaction-builder" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-transaction-checks/Cargo.toml b/crates/iota-transaction-checks/Cargo.toml index cb4829109e4..95b648a590b 100644 --- a/crates/iota-transaction-checks/Cargo.toml +++ b/crates/iota-transaction-checks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-transaction-checks" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-transactional-test-runner/Cargo.toml b/crates/iota-transactional-test-runner/Cargo.toml index 5909b1d6e46..a4ca6024125 100644 --- a/crates/iota-transactional-test-runner/Cargo.toml +++ b/crates/iota-transactional-test-runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-transactional-test-runner" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-transactional-test-runner/src/simulator_persisted_store.rs b/crates/iota-transactional-test-runner/src/simulator_persisted_store.rs index 073afb43ed9..d5282dd11bc 100644 --- a/crates/iota-transactional-test-runner/src/simulator_persisted_store.rs +++ b/crates/iota-transactional-test-runner/src/simulator_persisted_store.rs @@ -20,8 +20,8 @@ use iota_types::{ }, object::{Object, Owner}, storage::{ - BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, ParentSync, - ReadStore, RestStateReader, load_package_object_from_object_store, + BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, ReadStore, + RestStateReader, load_package_object_from_object_store, }, transaction::VerifiedTransaction, }; @@ -517,15 +517,6 @@ impl ObjectStore for PersistedStore { } } -impl ParentSync for PersistedStore { - fn get_latest_parent_entry_ref_deprecated( - &self, - _object_id: ObjectID, - ) -> iota_types::error::IotaResult> { - panic!("Never called in newer protocol versions") - } -} - impl ObjectStore for PersistedStoreInnerReadOnlyWrapper { fn get_object( &self, diff --git a/crates/iota-types/Cargo.toml b/crates/iota-types/Cargo.toml index 6527f245153..d90f6b26953 100644 --- a/crates/iota-types/Cargo.toml +++ b/crates/iota-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-types" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" @@ -81,6 +81,7 @@ shared-crypto.workspace = true typed-store-error.workspace = true [dev-dependencies] +# external dependencies async-trait.workspace = true bincode.workspace = true coset.workspace = true @@ -94,6 +95,9 @@ serde_yaml.workspace = true tokio.workspace = true url.workspace = true +# internal dependencies +iota-util-mem.workspace = true + [[bench]] name = "accumulator_bench" harness = false @@ -107,3 +111,6 @@ gas-profiler = [ "move-vm-types/gas-profiler", ] fuzzing = ["move-core-types/fuzzing", "dep:proptest-derive", "dep:proptest"] + +[package.metadata.cargo-udeps.ignore] +development = ["iota-util-mem"] diff --git a/crates/iota-types/src/authenticator_state.rs b/crates/iota-types/src/authenticator_state.rs index 48ea0861ade..c350b756723 100644 --- a/crates/iota-types/src/authenticator_state.rs +++ b/crates/iota-types/src/authenticator_state.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use fastcrypto_zkp::bn254::zk_login::{JWK, JwkId}; +pub(crate) use fastcrypto_zkp::bn254::zk_login::{JWK, JwkId}; use move_core_types::{account_address::AccountAddress, ident_str, identifier::IdentStr}; use serde::{Deserialize, Serialize}; diff --git a/crates/iota-types/src/base_types.rs b/crates/iota-types/src/base_types.rs index a557ddb80ff..b28eafbdcd0 100644 --- a/crates/iota-types/src/base_types.rs +++ b/crates/iota-types/src/base_types.rs @@ -615,6 +615,10 @@ pub struct IotaAddress( impl IotaAddress { pub const ZERO: Self = Self([0u8; IOTA_ADDRESS_LENGTH]); + pub fn new(bytes: [u8; IOTA_ADDRESS_LENGTH]) -> Self { + Self(bytes) + } + /// Convert the address to a byte buffer. pub fn to_vec(&self) -> Vec { self.0.to_vec() diff --git a/crates/iota-types/src/digests.rs b/crates/iota-types/src/digests.rs index f776e4c4345..761d86fba66 100644 --- a/crates/iota-types/src/digests.rs +++ b/crates/iota-types/src/digests.rs @@ -157,7 +157,7 @@ impl fmt::UpperHex for Digest { Deserialize, JsonSchema, )] -pub struct ChainIdentifier(CheckpointDigest); +pub struct ChainIdentifier(pub(crate) CheckpointDigest); pub static MAINNET_CHAIN_IDENTIFIER: OnceCell = OnceCell::new(); pub static TESTNET_CHAIN_IDENTIFIER: OnceCell = OnceCell::new(); @@ -205,6 +205,14 @@ impl ChainIdentifier { pub fn as_bytes(&self) -> &[u8; 32] { self.0.inner() } + + pub fn into_bytes(self) -> [u8; 32] { + self.0.into_inner() + } + + pub fn digest(&self) -> CheckpointDigest { + self.0 + } } pub fn get_mainnet_chain_identifier() -> ChainIdentifier { diff --git a/crates/iota-types/src/effects/effects_v1.rs b/crates/iota-types/src/effects/effects_v1.rs index 75210c4344b..3f3458d42b0 100644 --- a/crates/iota-types/src/effects/effects_v1.rs +++ b/crates/iota-types/src/effects/effects_v1.rs @@ -31,37 +31,37 @@ use crate::{ #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)] pub struct TransactionEffectsV1 { /// The status of the execution - status: ExecutionStatus, + pub(crate) status: ExecutionStatus, /// The epoch when this transaction was executed. - executed_epoch: EpochId, - gas_used: GasCostSummary, + pub(crate) executed_epoch: EpochId, + pub(crate) gas_used: GasCostSummary, /// The transaction digest - transaction_digest: TransactionDigest, + pub(crate) transaction_digest: TransactionDigest, /// The updated gas object reference, as an index into the `changed_objects` /// vector. Having a dedicated field for convenient access. /// System transaction that don't require gas will leave this as None. - gas_object_index: Option, + pub(crate) gas_object_index: Option, /// The digest of the events emitted during execution, /// can be None if the transaction does not emit any event. - events_digest: Option, + pub(crate) events_digest: Option, /// The set of transaction digests this transaction depends on. - dependencies: Vec, + pub(crate) dependencies: Vec, /// The version number of all the written Move objects by this transaction. pub(crate) lamport_version: SequenceNumber, /// Objects whose state are changed in the object store. - changed_objects: Vec<(ObjectID, EffectsObjectChange)>, + pub(crate) changed_objects: Vec<(ObjectID, EffectsObjectChange)>, /// Shared objects that are not mutated in this transaction. Unlike owned /// objects, read-only shared objects' version are not committed in the /// transaction, and in order for a node to catch up and execute it /// without consensus sequencing, the version needs to be committed in /// the effects. - unchanged_shared_objects: Vec<(ObjectID, UnchangedSharedKind)>, + pub(crate) unchanged_shared_objects: Vec<(ObjectID, UnchangedSharedKind)>, /// Auxiliary data that are not protocol-critical, generated as part of the /// effects but are stored separately. Storing it separately allows us /// to avoid bloating the effects with data that are not critical. /// It also provides more flexibility on the format and type of the data. - aux_data_digest: Option, + pub(crate) aux_data_digest: Option, } impl TransactionEffectsAPI for TransactionEffectsV1 { @@ -574,6 +574,10 @@ impl TransactionEffectsV1 { pub fn changed_objects(&self) -> &[(ObjectID, EffectsObjectChange)] { &self.changed_objects } + + pub fn aux_data_digest(&self) -> Option { + self.aux_data_digest + } } impl Default for TransactionEffectsV1 { diff --git a/crates/iota-types/src/effects/mod.rs b/crates/iota-types/src/effects/mod.rs index 24f7f528259..b67048f2473 100644 --- a/crates/iota-types/src/effects/mod.rs +++ b/crates/iota-types/src/effects/mod.rs @@ -30,7 +30,7 @@ use crate::{ storage::WriteKind, }; -mod effects_v1; +pub(crate) mod effects_v1; mod object_change; mod test_effects_builder; diff --git a/crates/iota-types/src/execution_status.rs b/crates/iota-types/src/execution_status.rs index 7e3b4c129c9..22a23be2188 100644 --- a/crates/iota-types/src/execution_status.rs +++ b/crates/iota-types/src/execution_status.rs @@ -186,7 +186,7 @@ pub enum ExecutionFailureStatus { "Iota Move Bytecode Verification Timeout. \ Please run the Iota Move Verifier for more information." )] - IotaMoveVerificationTimedout, + IotaMoveVerificationTimeout, #[error("The shared object operation is not allowed.")] SharedObjectOperationNotAllowed, diff --git a/crates/iota-types/src/in_memory_storage.rs b/crates/iota-types/src/in_memory_storage.rs index a0632a46109..a06b711d4e6 100644 --- a/crates/iota-types/src/in_memory_storage.rs +++ b/crates/iota-types/src/in_memory_storage.rs @@ -10,14 +10,14 @@ use move_bytecode_utils::module_cache::GetModule; use move_core_types::{language_storage::ModuleId, resolver::ModuleResolver}; use crate::{ - base_types::{ObjectID, ObjectRef, SequenceNumber, VersionNumber}, + base_types::{ObjectID, SequenceNumber, VersionNumber}, committee::EpochId, error::{IotaError, IotaResult}, inner_temporary_store::WrittenObjects, object::{Object, Owner}, storage::{ - BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, ParentSync, - get_module, get_module_by_id, load_package_object_from_object_store, + BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, get_module, + get_module_by_id, load_package_object_from_object_store, }, transaction::{ InputObjectKind, InputObjects, ObjectReadResult, Transaction, TransactionDataAPI, @@ -87,15 +87,6 @@ impl ChildObjectResolver for InMemoryStorage { } } -impl ParentSync for InMemoryStorage { - fn get_latest_parent_entry_ref_deprecated( - &self, - _object_id: ObjectID, - ) -> IotaResult> { - unreachable!("Should not be called for InMemoryStorage as it's deprecated.") - } -} - impl ModuleResolver for InMemoryStorage { type Error = IotaError; diff --git a/crates/iota-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index abb2301f486..dc79e3e6973 100644 --- a/crates/iota-types/src/iota_sdk2_conversions.rs +++ b/crates/iota-types/src/iota_sdk2_conversions.rs @@ -11,42 +11,1585 @@ //! directly to avoid going through the BCS machinery. use fastcrypto::traits::ToFromBytes; -use iota_sdk2::types::*; +use iota_sdk2::types::{ + object::{MovePackage, MoveStruct}, + *, +}; +use move_core_types::language_storage::ModuleId; -use crate::crypto::AuthorityPublicKeyBytes; +use crate::transaction::TransactionDataAPI as _; -macro_rules! bcs_convert_impl { - ($core:ty, $external:ty) => { - impl From<$core> for $external { - fn from(value: $core) -> Self { - let bytes = bcs::to_bytes(&value).unwrap(); - bcs::from_bytes(&bytes).unwrap() +impl From for Object { + fn from(value: crate::object::Object) -> Self { + Self { + data: value.data.clone().into(), + owner: value.owner.into(), + previous_transaction: value.previous_transaction.into(), + storage_rebate: value.storage_rebate, + } + } +} + +impl From for crate::object::Object { + fn from(value: Object) -> Self { + Self::new_from_genesis( + value.data.into(), + value.owner.into(), + value.previous_transaction.into(), + ) + } +} + +impl From for ObjectData { + fn from(value: crate::object::Data) -> Self { + match value { + crate::object::Data::Move(move_object) => Self::Struct(move_object_to_sdk(move_object)), + crate::object::Data::Package(move_package) => { + Self::Package(move_package_to_sdk(move_package)) } } + } +} + +impl From for crate::object::Data { + fn from(value: ObjectData) -> Self { + match value { + ObjectData::Struct(move_object) => Self::Move(sdk_object_to_move(move_object)), + ObjectData::Package(move_package) => Self::Package(sdk_package_to_move(move_package)), + } + } +} - impl From<$external> for $core { - fn from(value: $external) -> Self { - let bytes = bcs::to_bytes(&value).unwrap(); - bcs::from_bytes(&bytes).unwrap() +fn move_type_tag_to_sdk(tt: move_core_types::language_storage::TypeTag) -> TypeTag { + use move_core_types::language_storage::TypeTag as MoveTypeTag; + match tt { + MoveTypeTag::Bool => TypeTag::Bool, + MoveTypeTag::U8 => TypeTag::U8, + MoveTypeTag::U64 => TypeTag::U64, + MoveTypeTag::U128 => TypeTag::U128, + MoveTypeTag::Address => TypeTag::Address, + MoveTypeTag::Signer => TypeTag::Signer, + MoveTypeTag::Vector(type_tag) => TypeTag::Vector(Box::new(move_type_tag_to_sdk(*type_tag))), + MoveTypeTag::Struct(struct_tag) => { + TypeTag::Struct(Box::new(move_struct_tag_to_sdk(*struct_tag))) + } + MoveTypeTag::U16 => TypeTag::U16, + MoveTypeTag::U32 => TypeTag::U32, + MoveTypeTag::U256 => TypeTag::U256, + } +} + +fn move_struct_tag_to_sdk(st: move_core_types::language_storage::StructTag) -> StructTag { + StructTag { + address: Address::new(st.address.into_bytes()), + module: Identifier::new(st.module.as_str()).expect("module identifier conversion failed"), + name: Identifier::new(st.name.as_str()).expect("struct name identifier conversion failed"), + type_params: st + .type_params + .into_iter() + .map(move_type_tag_to_sdk) + .collect(), + } +} + +fn move_package_to_sdk(package: crate::move_package::MovePackage) -> MovePackage { + MovePackage { + id: package.id().into(), + version: package.version().value(), + modules: package + .module_map + .into_iter() + .map(|(name, bytes)| { + ( + Identifier::new(name).expect("package name identifier conversion failed"), + bytes, + ) + }) + .collect(), + type_origin_table: package + .type_origin_table + .into_iter() + .map(move_type_origin_to_sdk) + .collect(), + linkage_table: package + .linkage_table + .into_iter() + .map(|(id, info)| (id.into(), move_upgrade_info_to_sdk(info))) + .collect(), + } +} + +fn sdk_package_to_move(package: MovePackage) -> crate::move_package::MovePackage { + crate::move_package::MovePackage { + id: package.id.into(), + version: package.version.into(), + module_map: package + .modules + .into_iter() + .map(|(name, bytes)| (name.to_string(), bytes)) + .collect(), + type_origin_table: package + .type_origin_table + .into_iter() + .map(sdk_type_origin_to_move) + .collect(), + linkage_table: package + .linkage_table + .into_iter() + .map(|(id, info)| (id.into(), sdk_upgrade_info_to_move(info))) + .collect(), + } +} + +fn move_object_to_sdk(obj: crate::object::MoveObject) -> MoveStruct { + MoveStruct { + type_: move_object_type_to_sdk(obj.type_), + has_public_transfer: obj.has_public_transfer, + version: obj.version.value(), + contents: obj.contents, + } +} + +fn sdk_object_to_move(obj: MoveStruct) -> crate::object::MoveObject { + crate::object::MoveObject { + type_: sdk_object_type_to_move(obj.type_), + has_public_transfer: obj.has_public_transfer, + version: obj.version.into(), + contents: obj.contents, + } +} + +fn move_object_type_to_sdk(type_: crate::base_types::MoveObjectType) -> StructTag { + move_struct_tag_to_sdk(move_core_types::language_storage::StructTag { + address: type_.address(), + module: type_.module().to_owned(), + name: type_.name().to_owned(), + type_params: type_.type_params(), + }) +} + +fn sdk_object_type_to_move(type_: StructTag) -> crate::base_types::MoveObjectType { + crate::base_types::MoveObjectType::from(move_core_types::language_storage::StructTag { + address: move_core_types::account_address::AccountAddress::new(type_.address.into_inner()), + module: crate::Identifier::new(type_.module.as_str()) + .expect("struct module name conversion failed"), + name: crate::Identifier::new(type_.name.as_str()).expect("struct name conversion failed"), + type_params: type_ + .type_params + .into_iter() + .map(type_tag_sdk_to_core) + .collect(), + }) +} + +fn move_type_origin_to_sdk(origin: crate::move_package::TypeOrigin) -> TypeOrigin { + TypeOrigin { + module_name: Identifier::new(&origin.module_name) + .expect("module identifier conversion failed"), + struct_name: Identifier::new(&origin.datatype_name) + .expect("struct identifier conversion failed"), + package: origin.package.into(), + } +} + +fn sdk_type_origin_to_move(origin: TypeOrigin) -> crate::move_package::TypeOrigin { + crate::move_package::TypeOrigin { + module_name: origin.module_name.to_string(), + datatype_name: origin.struct_name.to_string(), + package: origin.package.into(), + } +} + +fn move_upgrade_info_to_sdk(info: crate::move_package::UpgradeInfo) -> UpgradeInfo { + UpgradeInfo { + upgraded_id: info.upgraded_id.into(), + upgraded_version: info.upgraded_version.value(), + } +} + +fn sdk_upgrade_info_to_move(info: UpgradeInfo) -> crate::move_package::UpgradeInfo { + crate::move_package::UpgradeInfo { + upgraded_id: info.upgraded_id.into(), + upgraded_version: info.upgraded_version.into(), + } +} + +impl From for Transaction { + fn from(value: crate::transaction::TransactionData) -> Self { + Self { + sender: Address::new(value.sender().to_inner()), + gas_payment: GasPayment { + objects: value + .gas() + .iter() + .map(|(id, seq, digest)| { + ObjectReference::new((*id).into(), seq.value(), (*digest).into()) + }) + .collect(), + owner: Address::new(value.gas_data().owner.to_inner()), + price: value.gas_data().price, + budget: value.gas_data().budget, + }, + expiration: match value.expiration() { + crate::transaction::TransactionExpiration::None => TransactionExpiration::None, + crate::transaction::TransactionExpiration::Epoch(e) => { + TransactionExpiration::Epoch(*e) + } + }, + kind: value.into_kind().into(), + } + } +} + +impl From for crate::transaction::TransactionData { + fn from(value: Transaction) -> Self { + Self::new_with_gas_data( + value.kind.into(), + value.sender.into(), + crate::transaction::GasData { + payment: value + .gas_payment + .objects + .into_iter() + .map(ObjectReference::into_parts) + .map(|(id, seq, digest)| (id.into(), seq.into(), digest.into())) + .collect(), + owner: value.gas_payment.owner.into(), + price: value.gas_payment.price, + budget: value.gas_payment.budget, + }, + ) + } +} + +impl From for TransactionKind { + fn from(value: crate::transaction::TransactionKind) -> Self { + use crate::transaction::TransactionKind as InternalTxnKind; + match value { + InternalTxnKind::ProgrammableTransaction(programmable_transaction) => { + TransactionKind::ProgrammableTransaction(ProgrammableTransaction { + inputs: programmable_transaction + .inputs + .into_iter() + .map(Into::into) + .collect(), + commands: programmable_transaction + .commands + .into_iter() + .map(Into::into) + .collect(), + }) + } + InternalTxnKind::Genesis(genesis_transaction) => { + TransactionKind::Genesis(GenesisTransaction { + objects: genesis_transaction + .objects + .into_iter() + .map(|obj| match obj { + crate::transaction::GenesisObject::RawObject { data, owner } => { + GenesisObject { + data: data.into(), + owner: owner.into(), + } + } + }) + .collect(), + events: genesis_transaction + .events + .into_iter() + .map(|event| Event { + package_id: event.package_id.into(), + module: Identifier::new(event.transaction_module.as_str()) + .expect("invalid transaction module"), + sender: event.sender.into(), + type_: struct_tag_core_to_sdk(event.type_), + contents: event.contents, + }) + .collect(), + }) + } + InternalTxnKind::ConsensusCommitPrologueV1(consensus_commit_prologue_v1) => { + let consensus_determined_version_assignments = match consensus_commit_prologue_v1.consensus_determined_version_assignments { + crate::messages_consensus::ConsensusDeterminedVersionAssignments::CancelledTransactions(vec) => + ConsensusDeterminedVersionAssignments::CancelledTransactions { + cancelled_transactions: vec.into_iter().map(|value| CancelledTransaction { + digest: value.0.into(), + version_assignments: + value + .1 + .into_iter() + .map(|value| VersionAssignment { object_id: value.0.into(), version: value.1.value() }) + .collect(), + }).collect() + }, + }; + TransactionKind::ConsensusCommitPrologueV1(ConsensusCommitPrologueV1 { + epoch: consensus_commit_prologue_v1.epoch, + round: consensus_commit_prologue_v1.round, + sub_dag_index: consensus_commit_prologue_v1.sub_dag_index, + commit_timestamp_ms: consensus_commit_prologue_v1.commit_timestamp_ms, + consensus_commit_digest: consensus_commit_prologue_v1 + .consensus_commit_digest + .into(), + consensus_determined_version_assignments, + }) + } + InternalTxnKind::AuthenticatorStateUpdateV1(authenticator_state_update_v1) => { + TransactionKind::AuthenticatorStateUpdateV1(AuthenticatorStateUpdateV1 { + epoch: authenticator_state_update_v1.epoch, + round: authenticator_state_update_v1.round, + new_active_jwks: authenticator_state_update_v1 + .new_active_jwks + .into_iter() + .map(|jwk| ActiveJwk { + jwk_id: JwkId { + iss: jwk.jwk_id.iss, + kid: jwk.jwk_id.kid, + }, + jwk: Jwk { + kty: jwk.jwk.kty, + e: jwk.jwk.e, + n: jwk.jwk.n, + alg: jwk.jwk.alg, + }, + epoch: jwk.epoch, + }) + .collect(), + authenticator_obj_initial_shared_version: authenticator_state_update_v1 + .authenticator_obj_initial_shared_version + .value(), + }) + } + InternalTxnKind::EndOfEpochTransaction(vec) => { + TransactionKind::EndOfEpoch(vec.into_iter().map(Into::into).collect()) + } + InternalTxnKind::RandomnessStateUpdate(randomness_state_update) => { + TransactionKind::RandomnessStateUpdate(RandomnessStateUpdate { + epoch: randomness_state_update.epoch, + randomness_round: randomness_state_update.randomness_round.0, + random_bytes: randomness_state_update.random_bytes, + randomness_obj_initial_shared_version: randomness_state_update + .randomness_obj_initial_shared_version + .value(), + }) + } + } + } +} + +impl From for crate::transaction::TransactionKind { + fn from(value: TransactionKind) -> Self { + match value { + TransactionKind::ProgrammableTransaction(programmable_transaction) => { + Self::ProgrammableTransaction(crate::transaction::ProgrammableTransaction { + inputs: programmable_transaction + .inputs + .into_iter() + .map(Into::into) + .collect(), + commands: programmable_transaction + .commands + .into_iter() + .map(Into::into) + .collect(), + }) + } + TransactionKind::Genesis(genesis_transaction) => { + Self::Genesis(crate::transaction::GenesisTransaction { + objects: genesis_transaction + .objects + .into_iter() + .map(|obj| crate::transaction::GenesisObject::RawObject { + data: obj.data.into(), + owner: obj.owner.into(), + }) + .collect(), + events: genesis_transaction + .events + .into_iter() + .map(|event| crate::event::Event { + package_id: event.package_id.into(), + transaction_module: crate::Identifier::new(event.module.as_str()) + .expect("invalid transaction module"), + sender: event.sender.into(), + type_: struct_tag_sdk_to_core(event.type_), + contents: event.contents, + }) + .collect(), + }) + } + TransactionKind::ConsensusCommitPrologueV1(consensus_commit_prologue_v1) => { + let consensus_determined_version_assignments = match consensus_commit_prologue_v1.consensus_determined_version_assignments { + ConsensusDeterminedVersionAssignments::CancelledTransactions{ cancelled_transactions } => + crate::messages_consensus::ConsensusDeterminedVersionAssignments::CancelledTransactions( + cancelled_transactions.into_iter().map(|value| + ( + value.digest.into(), + value + .version_assignments + .into_iter() + .map(|value| (value.object_id.into(), value.version.into())) + .collect() + ) + ).collect() + ), + }; + Self::ConsensusCommitPrologueV1( + crate::messages_consensus::ConsensusCommitPrologueV1 { + epoch: consensus_commit_prologue_v1.epoch, + round: consensus_commit_prologue_v1.round, + sub_dag_index: consensus_commit_prologue_v1.sub_dag_index, + commit_timestamp_ms: consensus_commit_prologue_v1.commit_timestamp_ms, + consensus_commit_digest: consensus_commit_prologue_v1 + .consensus_commit_digest + .into(), + consensus_determined_version_assignments, + }, + ) + } + TransactionKind::AuthenticatorStateUpdateV1(authenticator_state_update_v1) => { + Self::AuthenticatorStateUpdateV1(crate::transaction::AuthenticatorStateUpdateV1 { + epoch: authenticator_state_update_v1.epoch, + round: authenticator_state_update_v1.round, + new_active_jwks: authenticator_state_update_v1 + .new_active_jwks + .into_iter() + .map(|jwk| crate::authenticator_state::ActiveJwk { + jwk_id: crate::authenticator_state::JwkId { + iss: jwk.jwk_id.iss, + kid: jwk.jwk_id.kid, + }, + jwk: crate::authenticator_state::JWK { + kty: jwk.jwk.kty, + e: jwk.jwk.e, + n: jwk.jwk.n, + alg: jwk.jwk.alg, + }, + epoch: jwk.epoch, + }) + .collect(), + authenticator_obj_initial_shared_version: authenticator_state_update_v1 + .authenticator_obj_initial_shared_version + .into(), + }) + } + TransactionKind::EndOfEpoch(vec) => { + Self::EndOfEpochTransaction(vec.into_iter().map(Into::into).collect()) + } + TransactionKind::RandomnessStateUpdate(randomness_state_update) => { + Self::RandomnessStateUpdate(crate::transaction::RandomnessStateUpdate { + epoch: randomness_state_update.epoch, + randomness_round: crate::crypto::RandomnessRound( + randomness_state_update.randomness_round, + ), + random_bytes: randomness_state_update.random_bytes, + randomness_obj_initial_shared_version: randomness_state_update + .randomness_obj_initial_shared_version + .into(), + }) + } + } + } +} + +impl From for EndOfEpochTransactionKind { + fn from(value: crate::transaction::EndOfEpochTransactionKind) -> Self { + match value { + crate::transaction::EndOfEpochTransactionKind::ChangeEpoch(change_epoch) => { + EndOfEpochTransactionKind::ChangeEpoch(ChangeEpoch { + epoch: change_epoch.epoch, + protocol_version: change_epoch.protocol_version.as_u64(), + storage_charge: change_epoch.storage_charge, + computation_charge: change_epoch.computation_charge, + storage_rebate: change_epoch.storage_rebate, + non_refundable_storage_fee: change_epoch.non_refundable_storage_fee, + epoch_start_timestamp_ms: change_epoch.epoch_start_timestamp_ms, + system_packages: change_epoch + .system_packages + .into_iter() + .map(|(version, modules, dependencies)| SystemPackage { + version: version.value(), + modules, + dependencies: dependencies.into_iter().map(Into::into).collect(), + }) + .collect(), + }) + } + crate::transaction::EndOfEpochTransactionKind::AuthenticatorStateCreate => { + EndOfEpochTransactionKind::AuthenticatorStateCreate + } + crate::transaction::EndOfEpochTransactionKind::AuthenticatorStateExpire( + authenticator_state_expire, + ) => EndOfEpochTransactionKind::AuthenticatorStateExpire(AuthenticatorStateExpire { + min_epoch: authenticator_state_expire.min_epoch, + authenticator_obj_initial_shared_version: authenticator_state_expire + .authenticator_obj_initial_shared_version + .value(), + }), + crate::transaction::EndOfEpochTransactionKind::BridgeStateCreate(chain_identifier) => { + EndOfEpochTransactionKind::BridgeStateCreate { + chain_id: CheckpointDigest::new(chain_identifier.digest().into()), + } + } + crate::transaction::EndOfEpochTransactionKind::BridgeCommitteeInit(sequence_number) => { + EndOfEpochTransactionKind::BridgeCommitteeInit { + bridge_object_version: sequence_number.value(), + } + } + } + } +} + +impl From for crate::transaction::EndOfEpochTransactionKind { + fn from(value: EndOfEpochTransactionKind) -> Self { + match value { + EndOfEpochTransactionKind::ChangeEpoch(change_epoch) => { + Self::ChangeEpoch(crate::transaction::ChangeEpoch { + epoch: change_epoch.epoch, + protocol_version: change_epoch.protocol_version.into(), + storage_charge: change_epoch.storage_charge, + computation_charge: change_epoch.computation_charge, + storage_rebate: change_epoch.storage_rebate, + non_refundable_storage_fee: change_epoch.non_refundable_storage_fee, + epoch_start_timestamp_ms: change_epoch.epoch_start_timestamp_ms, + system_packages: change_epoch + .system_packages + .into_iter() + .map(|package| { + ( + package.version.into(), + package.modules, + package.dependencies.into_iter().map(Into::into).collect(), + ) + }) + .collect(), + }) + } + EndOfEpochTransactionKind::AuthenticatorStateCreate => Self::AuthenticatorStateCreate, + EndOfEpochTransactionKind::AuthenticatorStateExpire(authenticator_state_expire) => { + Self::AuthenticatorStateExpire(crate::transaction::AuthenticatorStateExpire { + min_epoch: authenticator_state_expire.min_epoch, + authenticator_obj_initial_shared_version: authenticator_state_expire + .authenticator_obj_initial_shared_version + .into(), + }) + } + EndOfEpochTransactionKind::BridgeStateCreate { chain_id } => { + Self::BridgeStateCreate(crate::digests::ChainIdentifier(chain_id.into())) + } + EndOfEpochTransactionKind::BridgeCommitteeInit { + bridge_object_version, + } => Self::BridgeCommitteeInit(bridge_object_version.into()), + } + } +} + +impl From for InputArgument { + fn from(value: crate::transaction::CallArg) -> Self { + match value { + crate::transaction::CallArg::Pure(vec) => Self::Pure { value: vec }, + crate::transaction::CallArg::Object(object_arg) => match object_arg { + crate::transaction::ObjectArg::ImmOrOwnedObject(obj_ref) => { + Self::ImmutableOrOwned(core_obj_ref_to_sdk(obj_ref)) + } + crate::transaction::ObjectArg::SharedObject { + id, + initial_shared_version, + mutable, + } => Self::Shared { + object_id: id.into(), + initial_shared_version: initial_shared_version.value(), + mutable, + }, + crate::transaction::ObjectArg::Receiving(obj_ref) => { + Self::Receiving(core_obj_ref_to_sdk(obj_ref)) + } + }, + } + } +} + +impl From for crate::transaction::CallArg { + fn from(value: InputArgument) -> Self { + use crate::transaction::ObjectArg; + match value { + InputArgument::Pure { value } => Self::Pure(value), + InputArgument::ImmutableOrOwned(object_reference) => Self::Object( + ObjectArg::ImmOrOwnedObject(sdk_obj_ref_to_core(object_reference)), + ), + InputArgument::Shared { + object_id, + initial_shared_version, + mutable, + } => Self::Object(ObjectArg::SharedObject { + id: object_id.into(), + initial_shared_version: initial_shared_version.into(), + mutable, + }), + InputArgument::Receiving(object_reference) => { + Self::Object(ObjectArg::Receiving(sdk_obj_ref_to_core(object_reference))) + } + } + } +} + +fn core_obj_ref_to_sdk(obj_ref: crate::base_types::ObjectRef) -> ObjectReference { + ObjectReference::new(obj_ref.0.into(), obj_ref.1.value(), obj_ref.2.into()) +} + +fn sdk_obj_ref_to_core(obj_ref: ObjectReference) -> crate::base_types::ObjectRef { + let (id, seq, digest) = obj_ref.into_parts(); + (id.into(), seq.into(), digest.into()) +} + +impl From for TransactionEffects { + fn from(value: crate::effects::TransactionEffects) -> Self { + match value { + crate::effects::TransactionEffects::V1(effects) => { + Self::V1(Box::new(TransactionEffectsV1 { + epoch: effects.executed_epoch, + gas_used: GasCostSummary::new( + effects.gas_used.computation_cost, + effects.gas_used.storage_cost, + effects.gas_used.storage_rebate, + effects.gas_used.non_refundable_storage_fee, + ), + gas_object_index: effects.gas_object_index, + transaction_digest: effects.transaction_digest.into(), + events_digest: effects.events_digest.map(Into::into), + dependencies: effects.dependencies.into_iter().map(Into::into).collect(), + lamport_version: effects.lamport_version.value(), + changed_objects: effects + .changed_objects + .into_iter() + .map(|(id, change)| ChangedObject { + object_id: id.into(), + change: EffectsObjectChange { + input_state: match change.input_state { + crate::effects::ObjectIn::NotExist => ObjectIn::NotExist, + crate::effects::ObjectIn::Exist(((version, digest), owner)) => { + ObjectIn::Exist { + version: version.value(), + digest: digest.into(), + owner: owner.into(), + } + } + }, + output_state: match change.output_state { + crate::effects::ObjectOut::NotExist => ObjectOut::NotExist, + crate::effects::ObjectOut::ObjectWrite((digest, owner)) => { + ObjectOut::ObjectWrite { + digest: digest.into(), + owner: owner.into(), + } + } + crate::effects::ObjectOut::PackageWrite((seq, digest)) => { + ObjectOut::PackageWrite { + version: seq.value(), + digest: digest.into(), + } + } + }, + id_operation: match change.id_operation { + crate::effects::IDOperation::None => IdOperation::None, + crate::effects::IDOperation::Created => IdOperation::Created, + crate::effects::IDOperation::Deleted => IdOperation::Deleted, + }, + }, + }) + .collect(), + unchanged_shared_objects: effects + .unchanged_shared_objects + .into_iter() + .map(|(id, kind)| UnchangedSharedObject { + object_id: id.into(), + kind: match kind { + crate::effects::UnchangedSharedKind::ReadOnlyRoot(( + version, + digest, + )) => UnchangedSharedKind::ReadOnlyRoot { + version: version.value(), + digest: digest.into(), + }, + crate::effects::UnchangedSharedKind::MutateDeleted( + sequence_number, + ) => UnchangedSharedKind::MutateDeleted { + version: sequence_number.value(), + }, + crate::effects::UnchangedSharedKind::ReadDeleted( + sequence_number, + ) => UnchangedSharedKind::ReadDeleted { + version: sequence_number.value(), + }, + crate::effects::UnchangedSharedKind::Cancelled(sequence_number) => { + UnchangedSharedKind::Cancelled { + version: sequence_number.value(), + } + } + crate::effects::UnchangedSharedKind::PerEpochConfig => { + UnchangedSharedKind::PerEpochConfig + } + }, + }) + .collect(), + auxiliary_data_digest: effects.aux_data_digest.map(Into::into), + status: effects.status.into(), + })) + } + } + } +} + +impl From for crate::effects::TransactionEffects { + fn from(value: TransactionEffects) -> Self { + match value { + TransactionEffects::V1(transaction_effects_v1) => { + crate::effects::effects_v1::TransactionEffectsV1 { + status: transaction_effects_v1.status.into(), + executed_epoch: transaction_effects_v1.epoch, + gas_used: crate::gas::GasCostSummary::new( + transaction_effects_v1.gas_used.computation_cost, + transaction_effects_v1.gas_used.storage_cost, + transaction_effects_v1.gas_used.storage_rebate, + transaction_effects_v1.gas_used.non_refundable_storage_fee, + ), + transaction_digest: transaction_effects_v1.transaction_digest.into(), + gas_object_index: transaction_effects_v1.gas_object_index, + events_digest: transaction_effects_v1.events_digest.map(Into::into), + dependencies: transaction_effects_v1 + .dependencies + .into_iter() + .map(Into::into) + .collect(), + lamport_version: transaction_effects_v1.lamport_version.into(), + changed_objects: transaction_effects_v1 + .changed_objects + .into_iter() + .map(|obj| { + (obj.object_id.into(), crate::effects::EffectsObjectChange { + input_state: match obj.change.input_state { + ObjectIn::NotExist => crate::effects::ObjectIn::NotExist, + ObjectIn::Exist { + version, + digest, + owner, + } => crate::effects::ObjectIn::Exist(( + (version.into(), digest.into()), + owner.into(), + )), + }, + output_state: match obj.change.output_state { + ObjectOut::NotExist => crate::effects::ObjectOut::NotExist, + ObjectOut::ObjectWrite { digest, owner } => { + crate::effects::ObjectOut::ObjectWrite(( + digest.into(), + owner.into(), + )) + } + ObjectOut::PackageWrite { version, digest } => { + crate::effects::ObjectOut::PackageWrite(( + version.into(), + digest.into(), + )) + } + }, + id_operation: match obj.change.id_operation { + IdOperation::None => crate::effects::IDOperation::None, + IdOperation::Created => crate::effects::IDOperation::Created, + IdOperation::Deleted => crate::effects::IDOperation::Deleted, + }, + }) + }) + .collect(), + unchanged_shared_objects: transaction_effects_v1 + .unchanged_shared_objects + .into_iter() + .map(|obj| { + (obj.object_id.into(), match obj.kind { + UnchangedSharedKind::ReadOnlyRoot { version, digest } => { + crate::effects::UnchangedSharedKind::ReadOnlyRoot(( + version.into(), + digest.into(), + )) + } + UnchangedSharedKind::MutateDeleted { version } => { + crate::effects::UnchangedSharedKind::MutateDeleted( + version.into(), + ) + } + UnchangedSharedKind::ReadDeleted { version } => { + crate::effects::UnchangedSharedKind::ReadDeleted(version.into()) + } + UnchangedSharedKind::Cancelled { version } => { + crate::effects::UnchangedSharedKind::Cancelled(version.into()) + } + UnchangedSharedKind::PerEpochConfig => { + crate::effects::UnchangedSharedKind::PerEpochConfig + } + }) + }) + .collect(), + aux_data_digest: transaction_effects_v1.auxiliary_data_digest.map(Into::into), + } + .into() + } + } + } +} + +macro_rules! impl_convert_digest { + ($name:ident) => { + impl From for $name { + fn from(value: crate::digests::$name) -> Self { + Self::new(value.into_inner()) + } + } + + impl From<$name> for crate::digests::$name { + fn from(value: $name) -> Self { + Self::new(value.into_inner()) } } }; } -bcs_convert_impl!(crate::object::Object, Object); -bcs_convert_impl!(crate::transaction::TransactionData, Transaction); -bcs_convert_impl!(crate::effects::TransactionEffects, TransactionEffects); -bcs_convert_impl!( - crate::messages_checkpoint::CheckpointContents, - CheckpointContents -); -bcs_convert_impl!( - crate::full_checkpoint_content::CheckpointData, - CheckpointData -); -bcs_convert_impl!(crate::signature::GenericSignature, UserSignature); -bcs_convert_impl!(crate::effects::TransactionEvents, TransactionEvents); -bcs_convert_impl!(crate::transaction::Command, Command); +impl_convert_digest!(Digest); +impl_convert_digest!(ObjectDigest); +impl_convert_digest!(CheckpointDigest); +impl_convert_digest!(TransactionDigest); +impl_convert_digest!(TransactionEffectsDigest); +impl_convert_digest!(TransactionEventsDigest); +impl_convert_digest!(CheckpointContentsDigest); +impl_convert_digest!(ConsensusCommitDigest); + +impl From for EffectsAuxiliaryDataDigest { + fn from(value: crate::digests::EffectsAuxDataDigest) -> Self { + Self::new(value.into_inner()) + } +} + +impl From for crate::digests::EffectsAuxDataDigest { + fn from(value: EffectsAuxiliaryDataDigest) -> Self { + Self::new(value.into_inner()) + } +} + +impl From for ExecutionStatus { + fn from(value: crate::execution_status::ExecutionStatus) -> Self { + match value { + crate::execution_status::ExecutionStatus::Success => Self::Success, + crate::execution_status::ExecutionStatus::Failure { error, command } => Self::Failure { + error: error.into(), + command: command.map(|v| v as u64), + }, + } + } +} + +impl From for crate::execution_status::ExecutionStatus { + fn from(value: ExecutionStatus) -> Self { + match value { + ExecutionStatus::Success => Self::Success, + ExecutionStatus::Failure { error, command } => Self::Failure { + error: error.into(), + command: command.map(|v| v as usize), + }, + } + } +} + +impl From for ExecutionError { + fn from(value: crate::execution_status::ExecutionFailureStatus) -> Self { + use crate::execution_status::ExecutionFailureStatus; + match value { + ExecutionFailureStatus::InsufficientGas => Self::InsufficientGas, + ExecutionFailureStatus::InvalidGasObject => Self::InvalidGasObject, + ExecutionFailureStatus::InvariantViolation => Self::InvariantViolation, + ExecutionFailureStatus::FeatureNotYetSupported => Self::FeatureNotYetSupported, + ExecutionFailureStatus::MoveObjectTooBig { + object_size, + max_object_size, + } => Self::ObjectTooBig { + object_size, + max_object_size, + }, + ExecutionFailureStatus::MovePackageTooBig { + object_size, + max_object_size, + } => Self::PackageTooBig { + object_size, + max_object_size, + }, + ExecutionFailureStatus::CircularObjectOwnership { object } => { + Self::CircularObjectOwnership { + object: object.into(), + } + } + ExecutionFailureStatus::InsufficientCoinBalance => Self::InsufficientCoinBalance, + ExecutionFailureStatus::CoinBalanceOverflow => Self::CoinBalanceOverflow, + ExecutionFailureStatus::PublishErrorNonZeroAddress => Self::PublishErrorNonZeroAddress, + ExecutionFailureStatus::IotaMoveVerificationError => Self::IotaMoveVerificationError, + ExecutionFailureStatus::MovePrimitiveRuntimeError(move_location_opt) => { + Self::MovePrimitiveRuntimeError { + location: move_location_opt.0.map(Into::into), + } + } + ExecutionFailureStatus::MoveAbort(move_location, code) => Self::MoveAbort { + location: move_location.into(), + code, + }, + ExecutionFailureStatus::VMVerificationOrDeserializationError => { + Self::VmVerificationOrDeserializationError + } + ExecutionFailureStatus::VMInvariantViolation => Self::VmInvariantViolation, + ExecutionFailureStatus::FunctionNotFound => Self::FunctionNotFound, + ExecutionFailureStatus::ArityMismatch => Self::ArityMismatch, + ExecutionFailureStatus::TypeArityMismatch => Self::TypeArityMismatch, + ExecutionFailureStatus::NonEntryFunctionInvoked => Self::NonEntryFunctionInvoked, + ExecutionFailureStatus::CommandArgumentError { arg_idx, kind } => { + use crate::execution_status::CommandArgumentError as InternalCmdArgErr; + Self::CommandArgumentError { + argument: arg_idx, + kind: match kind { + InternalCmdArgErr::TypeMismatch => CommandArgumentError::TypeMismatch, + InternalCmdArgErr::InvalidBCSBytes => CommandArgumentError::InvalidBcsBytes, + InternalCmdArgErr::InvalidUsageOfPureArg => { + CommandArgumentError::InvalidUsageOfPureArgument + } + InternalCmdArgErr::InvalidArgumentToPrivateEntryFunction => { + CommandArgumentError::InvalidArgumentToPrivateEntryFunction + } + InternalCmdArgErr::IndexOutOfBounds { idx } => { + CommandArgumentError::IndexOutOfBounds { index: idx } + } + InternalCmdArgErr::SecondaryIndexOutOfBounds { + result_idx, + secondary_idx, + } => CommandArgumentError::SecondaryIndexOutOfBounds { + result: result_idx, + subresult: secondary_idx, + }, + InternalCmdArgErr::InvalidResultArity { result_idx } => { + CommandArgumentError::InvalidResultArity { result: result_idx } + } + InternalCmdArgErr::InvalidGasCoinUsage => { + CommandArgumentError::InvalidGasCoinUsage + } + InternalCmdArgErr::InvalidValueUsage => { + CommandArgumentError::InvalidValueUsage + } + InternalCmdArgErr::InvalidObjectByValue => { + CommandArgumentError::InvalidObjectByValue + } + InternalCmdArgErr::InvalidObjectByMutRef => { + CommandArgumentError::InvalidObjectByMutRef + } + InternalCmdArgErr::SharedObjectOperationNotAllowed => { + CommandArgumentError::SharedObjectOperationNotAllowed + } + }, + } + } + ExecutionFailureStatus::TypeArgumentError { argument_idx, kind } => { + use crate::execution_status::TypeArgumentError as InternalTypeArgErr; + Self::TypeArgumentError { + type_argument: argument_idx, + kind: match kind { + InternalTypeArgErr::TypeNotFound => TypeArgumentError::TypeNotFound, + InternalTypeArgErr::ConstraintNotSatisfied => { + TypeArgumentError::ConstraintNotSatisfied + } + }, + } + } + ExecutionFailureStatus::UnusedValueWithoutDrop { + result_idx, + secondary_idx, + } => Self::UnusedValueWithoutDrop { + result: result_idx, + subresult: secondary_idx, + }, + ExecutionFailureStatus::InvalidPublicFunctionReturnType { idx } => { + Self::InvalidPublicFunctionReturnType { index: idx } + } + ExecutionFailureStatus::InvalidTransferObject => Self::InvalidTransferObject, + ExecutionFailureStatus::EffectsTooLarge { + current_size, + max_size, + } => Self::EffectsTooLarge { + current_size, + max_size, + }, + ExecutionFailureStatus::PublishUpgradeMissingDependency => { + Self::PublishUpgradeMissingDependency + } + ExecutionFailureStatus::PublishUpgradeDependencyDowngrade => { + Self::PublishUpgradeDependencyDowngrade + } + ExecutionFailureStatus::PackageUpgradeError { upgrade_error } => { + use crate::execution_status::PackageUpgradeError as InternalPkgUpgradeErr; + Self::PackageUpgradeError { + kind: match upgrade_error { + InternalPkgUpgradeErr::UnableToFetchPackage { package_id } => { + PackageUpgradeError::UnableToFetchPackage { + package_id: package_id.into(), + } + } + InternalPkgUpgradeErr::NotAPackage { object_id } => { + PackageUpgradeError::NotAPackage { + object_id: object_id.into(), + } + } + InternalPkgUpgradeErr::IncompatibleUpgrade => { + PackageUpgradeError::IncompatibleUpgrade + } + InternalPkgUpgradeErr::DigestDoesNotMatch { digest } => { + PackageUpgradeError::DigestDoesNotMatch { + digest: Digest::from_bytes(digest).expect("invalid digest bytes"), + } + } + InternalPkgUpgradeErr::UnknownUpgradePolicy { policy } => { + PackageUpgradeError::UnknownUpgradePolicy { policy } + } + InternalPkgUpgradeErr::PackageIDDoesNotMatch { + package_id, + ticket_id, + } => PackageUpgradeError::PackageIdDoesNotMatch { + package_id: package_id.into(), + ticket_id: ticket_id.into(), + }, + }, + } + } + ExecutionFailureStatus::WrittenObjectsTooLarge { + current_size, + max_size, + } => Self::WrittenObjectsTooLarge { + object_size: current_size, + max_object_size: max_size, + }, + ExecutionFailureStatus::CertificateDenied => Self::CertificateDenied, + ExecutionFailureStatus::IotaMoveVerificationTimeout => { + Self::IotaMoveVerificationTimeout + } + ExecutionFailureStatus::SharedObjectOperationNotAllowed => { + Self::SharedObjectOperationNotAllowed + } + ExecutionFailureStatus::InputObjectDeleted => Self::InputObjectDeleted, + ExecutionFailureStatus::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + } => Self::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects: congested_objects.0.into_iter().map(Into::into).collect(), + }, + ExecutionFailureStatus::AddressDeniedForCoin { address, coin_type } => { + Self::AddressDeniedForCoin { + address: address.into(), + coin_type, + } + } + ExecutionFailureStatus::CoinTypeGlobalPause { coin_type } => { + Self::CoinTypeGlobalPause { coin_type } + } + ExecutionFailureStatus::ExecutionCancelledDueToRandomnessUnavailable => { + Self::ExecutionCancelledDueToRandomnessUnavailable + } + } + } +} + +impl From for crate::execution_status::ExecutionFailureStatus { + fn from(value: ExecutionError) -> Self { + match value { + ExecutionError::InsufficientGas => Self::InsufficientGas, + ExecutionError::InvalidGasObject => Self::InvalidGasObject, + ExecutionError::InvariantViolation => Self::InvariantViolation, + ExecutionError::FeatureNotYetSupported => Self::FeatureNotYetSupported, + ExecutionError::ObjectTooBig { + object_size, + max_object_size, + } => Self::MoveObjectTooBig { + object_size, + max_object_size, + }, + ExecutionError::PackageTooBig { + object_size, + max_object_size, + } => Self::MovePackageTooBig { + object_size, + max_object_size, + }, + ExecutionError::CircularObjectOwnership { object } => Self::CircularObjectOwnership { + object: object.into(), + }, + ExecutionError::InsufficientCoinBalance => Self::InsufficientCoinBalance, + ExecutionError::CoinBalanceOverflow => Self::CoinBalanceOverflow, + ExecutionError::PublishErrorNonZeroAddress => Self::PublishErrorNonZeroAddress, + ExecutionError::IotaMoveVerificationError => Self::IotaMoveVerificationError, + ExecutionError::MovePrimitiveRuntimeError { location } => { + Self::MovePrimitiveRuntimeError(crate::execution_status::MoveLocationOpt( + location.map(Into::into), + )) + } + ExecutionError::MoveAbort { location, code } => Self::MoveAbort(location.into(), code), + ExecutionError::VmVerificationOrDeserializationError => { + Self::VMVerificationOrDeserializationError + } + ExecutionError::VmInvariantViolation => Self::VMInvariantViolation, + ExecutionError::FunctionNotFound => Self::FunctionNotFound, + ExecutionError::ArityMismatch => Self::ArityMismatch, + ExecutionError::TypeArityMismatch => Self::TypeArityMismatch, + ExecutionError::NonEntryFunctionInvoked => Self::NonEntryFunctionInvoked, + ExecutionError::CommandArgumentError { argument, kind } => { + use crate::execution_status::CommandArgumentError as InternalCmdArgErr; + Self::CommandArgumentError { + arg_idx: argument, + kind: match kind { + CommandArgumentError::TypeMismatch => InternalCmdArgErr::TypeMismatch, + CommandArgumentError::InvalidBcsBytes => InternalCmdArgErr::InvalidBCSBytes, + CommandArgumentError::InvalidUsageOfPureArgument => { + InternalCmdArgErr::InvalidUsageOfPureArg + } + CommandArgumentError::InvalidArgumentToPrivateEntryFunction => { + InternalCmdArgErr::InvalidArgumentToPrivateEntryFunction + } + CommandArgumentError::IndexOutOfBounds { index } => { + InternalCmdArgErr::IndexOutOfBounds { idx: index } + } + CommandArgumentError::SecondaryIndexOutOfBounds { result, subresult } => { + InternalCmdArgErr::SecondaryIndexOutOfBounds { + result_idx: result, + secondary_idx: subresult, + } + } + CommandArgumentError::InvalidResultArity { result } => { + InternalCmdArgErr::InvalidResultArity { result_idx: result } + } + CommandArgumentError::InvalidGasCoinUsage => { + InternalCmdArgErr::InvalidGasCoinUsage + } + CommandArgumentError::InvalidValueUsage => { + InternalCmdArgErr::InvalidValueUsage + } + CommandArgumentError::InvalidObjectByValue => { + InternalCmdArgErr::InvalidObjectByValue + } + CommandArgumentError::InvalidObjectByMutRef => { + InternalCmdArgErr::InvalidObjectByMutRef + } + CommandArgumentError::SharedObjectOperationNotAllowed => { + InternalCmdArgErr::SharedObjectOperationNotAllowed + } + }, + } + } + ExecutionError::TypeArgumentError { + type_argument, + kind, + } => { + use crate::execution_status::TypeArgumentError as InternalTypeArgErr; + Self::TypeArgumentError { + argument_idx: type_argument, + kind: match kind { + TypeArgumentError::TypeNotFound => InternalTypeArgErr::TypeNotFound, + TypeArgumentError::ConstraintNotSatisfied => { + InternalTypeArgErr::ConstraintNotSatisfied + } + }, + } + } + ExecutionError::UnusedValueWithoutDrop { result, subresult } => { + Self::UnusedValueWithoutDrop { + result_idx: result, + secondary_idx: subresult, + } + } + ExecutionError::InvalidPublicFunctionReturnType { index } => { + Self::InvalidPublicFunctionReturnType { idx: index } + } + ExecutionError::InvalidTransferObject => Self::InvalidTransferObject, + ExecutionError::EffectsTooLarge { + current_size, + max_size, + } => Self::EffectsTooLarge { + current_size, + max_size, + }, + ExecutionError::PublishUpgradeMissingDependency => { + Self::PublishUpgradeMissingDependency + } + ExecutionError::PublishUpgradeDependencyDowngrade => { + Self::PublishUpgradeDependencyDowngrade + } + ExecutionError::PackageUpgradeError { kind } => { + use crate::execution_status::PackageUpgradeError as InternalPkgUpgradeErr; + Self::PackageUpgradeError { + upgrade_error: match kind { + PackageUpgradeError::UnableToFetchPackage { package_id } => { + InternalPkgUpgradeErr::UnableToFetchPackage { + package_id: package_id.into(), + } + } + PackageUpgradeError::NotAPackage { object_id } => { + InternalPkgUpgradeErr::NotAPackage { + object_id: object_id.into(), + } + } + PackageUpgradeError::IncompatibleUpgrade => { + InternalPkgUpgradeErr::IncompatibleUpgrade + } + PackageUpgradeError::DigestDoesNotMatch { digest } => { + InternalPkgUpgradeErr::DigestDoesNotMatch { + digest: digest.as_bytes().to_vec(), + } + } + PackageUpgradeError::UnknownUpgradePolicy { policy } => { + InternalPkgUpgradeErr::UnknownUpgradePolicy { policy } + } + PackageUpgradeError::PackageIdDoesNotMatch { + package_id, + ticket_id, + } => InternalPkgUpgradeErr::PackageIDDoesNotMatch { + package_id: package_id.into(), + ticket_id: ticket_id.into(), + }, + }, + } + } + ExecutionError::WrittenObjectsTooLarge { + object_size, + max_object_size, + } => Self::WrittenObjectsTooLarge { + current_size: object_size, + max_size: max_object_size, + }, + ExecutionError::CertificateDenied => Self::CertificateDenied, + ExecutionError::IotaMoveVerificationTimeout => Self::IotaMoveVerificationTimeout, + ExecutionError::SharedObjectOperationNotAllowed => { + Self::SharedObjectOperationNotAllowed + } + ExecutionError::InputObjectDeleted => Self::InputObjectDeleted, + ExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects } => { + Self::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects: crate::execution_status::CongestedObjects( + congested_objects.into_iter().map(Into::into).collect(), + ), + } + } + ExecutionError::AddressDeniedForCoin { address, coin_type } => { + Self::AddressDeniedForCoin { + address: address.into(), + coin_type, + } + } + ExecutionError::CoinTypeGlobalPause { coin_type } => { + Self::CoinTypeGlobalPause { coin_type } + } + ExecutionError::ExecutionCancelledDueToRandomnessUnavailable => { + Self::ExecutionCancelledDueToRandomnessUnavailable + } + } + } +} + +impl From for MoveLocation { + fn from(value: crate::execution_status::MoveLocation) -> Self { + Self { + package: ObjectId::new(value.module.address().into_bytes()), + module: Identifier::new(value.module.name().as_str()).expect("invalid module name"), + function: value.function, + instruction: value.instruction, + function_name: value + .function_name + .map(|name| Identifier::new(name).expect("invalid function name")), + } + } +} + +impl From for crate::execution_status::MoveLocation { + fn from(value: MoveLocation) -> Self { + Self { + module: ModuleId::new( + move_core_types::account_address::AccountAddress::new(value.package.into_inner()), + crate::Identifier::new(value.module.as_str()).expect("invalid module name"), + ), + function: value.function, + instruction: value.instruction, + function_name: value.function_name.map(|name| name.to_string()), + } + } +} + +impl From for CheckpointContents { + fn from(value: crate::messages_checkpoint::CheckpointContents) -> Self { + Self( + value + .into_iter_with_signatures() + .map(|(digests, signatures)| CheckpointTransactionInfo { + transaction: digests.transaction.into(), + effects: digests.effects.into(), + signatures: signatures.into_iter().map(Into::into).collect(), + }) + .collect(), + ) + } +} + +impl From for crate::messages_checkpoint::CheckpointContents { + fn from(value: CheckpointContents) -> Self { + let (transactions, user_signatures) = value.0.into_iter().fold( + (Vec::new(), Vec::new()), + |(mut transactions, mut user_signatures), info| { + transactions.push(crate::base_types::ExecutionDigests { + transaction: info.transaction.into(), + effects: info.effects.into(), + }); + user_signatures.push(info.signatures.into_iter().map(Into::into).collect()); + (transactions, user_signatures) + }, + ); + crate::messages_checkpoint::CheckpointContents::new_with_digests_and_signatures( + transactions, + user_signatures, + ) + } +} + +impl From for CheckpointData { + fn from(value: crate::full_checkpoint_content::CheckpointData) -> Self { + Self { + checkpoint_summary: value.checkpoint_summary.into(), + checkpoint_contents: value.checkpoint_contents.into(), + transactions: value.transactions.into_iter().map(Into::into).collect(), + } + } +} + +impl From for crate::full_checkpoint_content::CheckpointData { + fn from(value: CheckpointData) -> Self { + Self { + checkpoint_summary: value.checkpoint_summary.into(), + checkpoint_contents: value.checkpoint_contents.into(), + transactions: value.transactions.into_iter().map(Into::into).collect(), + } + } +} + +impl From for CheckpointTransaction { + fn from(value: crate::full_checkpoint_content::CheckpointTransaction) -> Self { + Self { + transaction: value.transaction.into(), + effects: value.effects.into(), + events: value.events.map(Into::into), + input_objects: value.input_objects.into_iter().map(Into::into).collect(), + output_objects: value.output_objects.into_iter().map(Into::into).collect(), + } + } +} + +impl From for crate::full_checkpoint_content::CheckpointTransaction { + fn from(value: CheckpointTransaction) -> Self { + Self { + transaction: value.transaction.into(), + effects: value.effects.into(), + events: value.events.map(Into::into), + input_objects: value.input_objects.into_iter().map(Into::into).collect(), + output_objects: value.output_objects.into_iter().map(Into::into).collect(), + } + } +} + +impl From for UserSignature { + fn from(value: crate::signature::GenericSignature) -> Self { + bcs::from_bytes(&bcs::to_bytes(&value).expect("invalid signature")) + .expect("invalid signature") + } +} + +impl From for crate::signature::GenericSignature { + fn from(value: UserSignature) -> Self { + bcs::from_bytes(&bcs::to_bytes(&value).expect("invalid signature")) + .expect("invalid signature") + } +} + +impl From for TransactionEvents { + fn from(value: crate::effects::TransactionEvents) -> Self { + Self(value.data.into_iter().map(Into::into).collect()) + } +} + +impl From for crate::effects::TransactionEvents { + fn from(value: TransactionEvents) -> Self { + Self { + data: value.0.into_iter().map(Into::into).collect(), + } + } +} + +impl From for Event { + fn from(value: crate::event::Event) -> Self { + Self { + package_id: value.package_id.into(), + module: Identifier::new(value.transaction_module.as_str()) + .expect("invalid event module identifier"), + sender: value.sender.into(), + type_: struct_tag_core_to_sdk(value.type_), + contents: value.contents, + } + } +} + +impl From for crate::event::Event { + fn from(value: Event) -> Self { + Self { + package_id: value.package_id.into(), + transaction_module: crate::Identifier::new(value.module.as_str()) + .expect("invalid event module identifier"), + sender: value.sender.into(), + type_: struct_tag_sdk_to_core(value.type_), + contents: value.contents, + } + } +} + +impl From for Command { + fn from(value: crate::transaction::Command) -> Self { + use crate::transaction::Command as InternalCmd; + match value { + InternalCmd::MoveCall(programmable_move_call) => Self::MoveCall(MoveCall { + package: programmable_move_call.package.into(), + module: Identifier::new(programmable_move_call.module.as_str()) + .expect("invalid move call module identifier"), + function: Identifier::new(programmable_move_call.function.as_str()) + .expect("invalid move call function identifier"), + type_arguments: programmable_move_call + .type_arguments + .into_iter() + .map(type_tag_core_to_sdk) + .collect(), + arguments: programmable_move_call + .arguments + .into_iter() + .map(Into::into) + .collect(), + }), + InternalCmd::TransferObjects(objects, address) => { + Self::TransferObjects(TransferObjects { + objects: objects.into_iter().map(Into::into).collect(), + address: address.into(), + }) + } + InternalCmd::SplitCoins(coin, amounts) => Self::SplitCoins(SplitCoins { + coin: coin.into(), + amounts: amounts.into_iter().map(Into::into).collect(), + }), + InternalCmd::MergeCoins(argument, coins_to_merge) => Self::MergeCoins(MergeCoins { + coin: argument.into(), + coins_to_merge: coins_to_merge.into_iter().map(Into::into).collect(), + }), + InternalCmd::Publish(modules, dependencies) => Self::Publish(Publish { + modules, + dependencies: dependencies.into_iter().map(Into::into).collect(), + }), + InternalCmd::MakeMoveVec(type_tag, elements) => Self::MakeMoveVector(MakeMoveVector { + type_: type_tag.map(type_tag_core_to_sdk), + elements: elements.into_iter().map(Into::into).collect(), + }), + InternalCmd::Upgrade(modules, dependencies, package, ticket) => { + Self::Upgrade(Upgrade { + modules, + dependencies: dependencies.into_iter().map(Into::into).collect(), + package: package.into(), + ticket: ticket.into(), + }) + } + } + } +} + +impl From for crate::transaction::Command { + fn from(value: Command) -> Self { + match value { + Command::MoveCall(move_call) => { + Self::MoveCall(Box::new(crate::transaction::ProgrammableMoveCall { + package: move_call.package.into(), + module: crate::Identifier::new(move_call.module.as_str()) + .expect("invalid move call module identifier"), + function: crate::Identifier::new(move_call.function.as_str()) + .expect("invalid move call function identifier"), + type_arguments: move_call + .type_arguments + .into_iter() + .map(type_tag_sdk_to_core) + .collect(), + arguments: move_call.arguments.into_iter().map(Into::into).collect(), + })) + } + Command::TransferObjects(transfer_objects) => Self::TransferObjects( + transfer_objects + .objects + .into_iter() + .map(Into::into) + .collect(), + transfer_objects.address.into(), + ), + Command::SplitCoins(split_coins) => Self::SplitCoins( + split_coins.coin.into(), + split_coins.amounts.into_iter().map(Into::into).collect(), + ), + Command::MergeCoins(merge_coins) => Self::MergeCoins( + merge_coins.coin.into(), + merge_coins + .coins_to_merge + .into_iter() + .map(Into::into) + .collect(), + ), + Command::Publish(publish) => Self::Publish( + publish.modules, + publish.dependencies.into_iter().map(Into::into).collect(), + ), + Command::MakeMoveVector(make_move_vector) => Self::MakeMoveVec( + make_move_vector.type_.map(type_tag_sdk_to_core), + make_move_vector + .elements + .into_iter() + .map(Into::into) + .collect(), + ), + Command::Upgrade(upgrade) => Self::Upgrade( + upgrade.modules, + upgrade.dependencies.into_iter().map(Into::into).collect(), + upgrade.package.into(), + upgrade.ticket.into(), + ), + } + } +} + +impl From for Argument { + fn from(value: crate::transaction::Argument) -> Self { + match value { + crate::transaction::Argument::GasCoin => Self::Gas, + crate::transaction::Argument::Input(idx) => Self::Input(idx), + crate::transaction::Argument::Result(idx) => Self::Result(idx), + crate::transaction::Argument::NestedResult(idx1, idx2) => { + Self::NestedResult(idx1, idx2) + } + } + } +} + +impl From for crate::transaction::Argument { + fn from(value: Argument) -> Self { + match value { + Argument::Gas => Self::GasCoin, + Argument::Input(idx) => Self::Input(idx), + Argument::Result(idx) => Self::Result(idx), + Argument::NestedResult(idx1, idx2) => Self::NestedResult(idx1, idx2), + } + } +} impl From for GasCostSummary { fn from(value: crate::gas::GasCostSummary) -> Self { @@ -98,12 +1641,7 @@ impl From for crate::messages_checkpoint::EndOfEpochData { next_epoch_committee: value .next_epoch_committee .into_iter() - .map(|v| { - ( - AuthorityPublicKeyBytes::new(v.public_key.into_inner()), - v.stake, - ) - }) + .map(|v| (v.public_key.into(), v.stake)) .collect(), next_epoch_protocol_version: value.next_epoch_protocol_version.into(), epoch_commitments: value @@ -135,18 +1673,6 @@ impl From for crate::messages_checkpoint::CheckpointCommit } } -impl From for CheckpointContentsDigest { - fn from(value: crate::messages_checkpoint::CheckpointContentsDigest) -> Self { - Self::new(value.into_inner()) - } -} - -impl From for crate::messages_checkpoint::CheckpointContentsDigest { - fn from(value: CheckpointContentsDigest) -> Self { - Self::new(value.into_inner()) - } -} - impl From for CheckpointSummary { fn from(value: crate::messages_checkpoint::CheckpointSummary) -> Self { Self { @@ -367,26 +1893,6 @@ pub fn type_tag_core_to_sdk(value: move_core_types::language_storage::TypeTag) - } } -pub fn struct_tag_core_to_sdk(value: move_core_types::language_storage::StructTag) -> StructTag { - let move_core_types::language_storage::StructTag { - address, - module, - name, - type_params, - } = value; - - let address = Address::new(address.into_bytes()); - let module = Identifier::new(module.as_str()).unwrap(); - let name = Identifier::new(name.as_str()).unwrap(); - let type_params = type_params.into_iter().map(type_tag_core_to_sdk).collect(); - StructTag { - address, - module, - name, - type_params, - } -} - pub fn type_tag_sdk_to_core(value: TypeTag) -> move_core_types::language_storage::TypeTag { match value { TypeTag::Bool => move_core_types::language_storage::TypeTag::Bool, @@ -407,6 +1913,26 @@ pub fn type_tag_sdk_to_core(value: TypeTag) -> move_core_types::language_storage } } +pub fn struct_tag_core_to_sdk(value: move_core_types::language_storage::StructTag) -> StructTag { + let move_core_types::language_storage::StructTag { + address, + module, + name, + type_params, + } = value; + + let address = Address::new(address.into_bytes()); + let module = Identifier::new(module.as_str()).unwrap(); + let name = Identifier::new(name.as_str()).unwrap(); + let type_params = type_params.into_iter().map(type_tag_core_to_sdk).collect(); + StructTag { + address, + module, + name, + type_params, + } +} + pub fn struct_tag_sdk_to_core(value: StructTag) -> move_core_types::language_storage::StructTag { let StructTag { address, @@ -427,42 +1953,6 @@ pub fn struct_tag_sdk_to_core(value: StructTag) -> move_core_types::language_sto } } -impl From for CheckpointDigest { - fn from(value: crate::messages_checkpoint::CheckpointDigest) -> Self { - Self::new(value.into_inner()) - } -} - -impl From for crate::messages_checkpoint::CheckpointDigest { - fn from(value: CheckpointDigest) -> Self { - Self::new(value.into_inner()) - } -} - -impl From for TransactionDigest { - fn from(value: crate::digests::TransactionDigest) -> Self { - Self::new(value.into_inner()) - } -} - -impl From for crate::digests::TransactionDigest { - fn from(value: TransactionDigest) -> Self { - Self::new(value.into_inner()) - } -} - -impl From for ObjectDigest { - fn from(value: crate::digests::ObjectDigest) -> Self { - Self::new(value.into_inner()) - } -} - -impl From for crate::digests::ObjectDigest { - fn from(value: ObjectDigest) -> Self { - Self::new(value.into_inner()) - } -} - impl From for ValidatorCommittee { fn from(value: crate::committee::Committee) -> Self { Self { diff --git a/crates/iota-types/src/messages_checkpoint.rs b/crates/iota-types/src/messages_checkpoint.rs index 4dad931676c..50a9f25d252 100644 --- a/crates/iota-types/src/messages_checkpoint.rs +++ b/crates/iota-types/src/messages_checkpoint.rs @@ -424,13 +424,10 @@ pub struct CheckpointContentsV1 { } impl CheckpointContents { - pub fn new_with_digests_and_signatures( - contents: T, + pub fn new_with_digests_and_signatures( + contents: impl IntoIterator, user_signatures: Vec>, - ) -> Self - where - T: IntoIterator, - { + ) -> Self { let transactions: Vec<_> = contents.into_iter().collect(); assert_eq!(transactions.len(), user_signatures.len()); Self::V1(CheckpointContentsV1 { @@ -440,10 +437,9 @@ impl CheckpointContents { }) } - pub fn new_with_causally_ordered_execution_data<'a, T>(contents: T) -> Self - where - T: IntoIterator, - { + pub fn new_with_causally_ordered_execution_data<'a>( + contents: impl IntoIterator, + ) -> Self { let (transactions, user_signatures): (Vec<_>, Vec<_>) = contents .into_iter() .map(|data| { @@ -462,10 +458,9 @@ impl CheckpointContents { } #[cfg(any(test, feature = "test-utils"))] - pub fn new_with_digests_only_for_tests(contents: T) -> Self - where - T: IntoIterator, - { + pub fn new_with_digests_only_for_tests( + contents: impl IntoIterator, + ) -> Self { let transactions: Vec<_> = contents.into_iter().collect(); let user_signatures = transactions.iter().map(|_| vec![]).collect(); Self::V1(CheckpointContentsV1 { diff --git a/crates/iota-types/src/metrics.rs b/crates/iota-types/src/metrics.rs index 4b7f2585cc7..e98b3aaab31 100644 --- a/crates/iota-types/src/metrics.rs +++ b/crates/iota-types/src/metrics.rs @@ -90,14 +90,6 @@ pub struct BytecodeVerifierMetrics { } impl BytecodeVerifierMetrics { - /// DEPRECATED in latest metered verifier, which only report overall success - /// or timeout. - pub const MOVE_VERIFIER_TAG: &'static str = "move_verifier"; - - /// DEPRECATED in latest metered verifier, which only report overall success - /// or timeout. - pub const IOTA_VERIFIER_TAG: &'static str = "iota_verifier"; - pub const OVERALL_TAG: &'static str = "overall"; pub const SUCCESS_TAG: &'static str = "success"; pub const TIMEOUT_TAG: &'static str = "failed"; diff --git a/crates/iota-types/src/move_package.rs b/crates/iota-types/src/move_package.rs index 5790a7ad620..d5cb2d32232 100644 --- a/crates/iota-types/src/move_package.rs +++ b/crates/iota-types/src/move_package.rs @@ -88,7 +88,7 @@ pub struct UpgradeInfo { #[serde_as] #[derive(Eq, PartialEq, Debug, Clone, Deserialize, Serialize, Hash)] pub struct MovePackage { - id: ObjectID, + pub(crate) id: ObjectID, /// Most move packages are uniquely identified by their ID (i.e. there is /// only one version per ID), but the version is still stored because /// one package may be an upgrade of another (at a different ID), in @@ -100,18 +100,18 @@ pub struct MovePackage { /// /// In all cases, packages are referred to by move calls using just their /// ID, and they are always loaded at their latest version. - version: SequenceNumber, + pub(crate) version: SequenceNumber, // TODO use session cache #[serde_as(as = "BTreeMap<_, Bytes>")] - module_map: BTreeMap>, + pub(crate) module_map: BTreeMap>, /// Maps struct/module to a package version where it was first defined, /// stored as a vector for simple serialization and deserialization. - type_origin_table: Vec, + pub(crate) type_origin_table: Vec, // For each dependency, maps original package ID to the info about the (upgraded) dependency // version that this package is using - linkage_table: BTreeMap, + pub(crate) linkage_table: BTreeMap, } // NB: do _not_ add `Serialize` or `Deserialize` to this enum. Convert to u8 diff --git a/crates/iota-types/src/object.rs b/crates/iota-types/src/object.rs index 62000c6c304..9be8217a25d 100644 --- a/crates/iota-types/src/object.rs +++ b/crates/iota-types/src/object.rs @@ -50,18 +50,18 @@ pub const OBJECT_START_VERSION: SequenceNumber = SequenceNumber::from_u64(1); #[derive(Eq, PartialEq, Debug, Clone, Deserialize, Serialize, Hash)] pub struct MoveObject { /// The type of this object. Immutable - type_: MoveObjectType, + pub(crate) type_: MoveObjectType, /// DEPRECATED this field is no longer used to determine whether a tx can /// transfer this object. Instead, it is always calculated from the /// objects type when loaded in execution - has_public_transfer: bool, + pub(crate) has_public_transfer: bool, /// Number that increases each time a tx takes this object as a mutable /// input This is a lamport timestamp, not a sequentially increasing /// version - version: SequenceNumber, + pub(crate) version: SequenceNumber, /// BCS bytes of a Move struct value #[serde_as(as = "Bytes")] - contents: Vec, + pub(crate) contents: Vec, } /// Index marking the end of the object's ID + the beginning of its version diff --git a/crates/iota-types/src/storage/mod.rs b/crates/iota-types/src/storage/mod.rs index ae5fa86124f..e685f91d39f 100644 --- a/crates/iota-types/src/storage/mod.rs +++ b/crates/iota-types/src/storage/mod.rs @@ -160,8 +160,8 @@ pub enum ObjectChange { Delete(DeleteKindWithOldVersion), } -pub trait StorageView: Storage + ParentSync + ChildObjectResolver {} -impl StorageView for T {} +pub trait StorageView: Storage + ChildObjectResolver {} +impl StorageView for T {} /// An abstraction of the (possibly distributed) store for objects. This /// API only allows for the retrieval of objects, not any state changes @@ -382,42 +382,6 @@ impl BackingPackageStore for PostExecutionPackageResolver { } } -pub trait ParentSync { - /// This function is only called by older protocol versions. - /// It creates an explicit dependency to tombstones, which is not desired. - fn get_latest_parent_entry_ref_deprecated( - &self, - object_id: ObjectID, - ) -> IotaResult>; -} - -impl ParentSync for std::sync::Arc { - fn get_latest_parent_entry_ref_deprecated( - &self, - object_id: ObjectID, - ) -> IotaResult> { - ParentSync::get_latest_parent_entry_ref_deprecated(self.as_ref(), object_id) - } -} - -impl ParentSync for &S { - fn get_latest_parent_entry_ref_deprecated( - &self, - object_id: ObjectID, - ) -> IotaResult> { - ParentSync::get_latest_parent_entry_ref_deprecated(*self, object_id) - } -} - -impl ParentSync for &mut S { - fn get_latest_parent_entry_ref_deprecated( - &self, - object_id: ObjectID, - ) -> IotaResult> { - ParentSync::get_latest_parent_entry_ref_deprecated(*self, object_id) - } -} - impl ChildObjectResolver for std::sync::Arc { fn read_child_object( &self, @@ -589,9 +553,7 @@ impl Display for DeleteKind { } } -pub trait BackingStore: - BackingPackageStore + ChildObjectResolver + ObjectStore + ParentSync -{ +pub trait BackingStore: BackingPackageStore + ChildObjectResolver + ObjectStore { fn as_object_store(&self) -> &dyn ObjectStore; } @@ -600,7 +562,6 @@ where T: BackingPackageStore, T: ChildObjectResolver, T: ObjectStore, - T: ParentSync, { fn as_object_store(&self) -> &dyn ObjectStore { self diff --git a/crates/iota-types/tests/staged/exec_failure_status.yaml b/crates/iota-types/tests/staged/exec_failure_status.yaml index 5ddf42a34da..00e684c3fa7 100644 --- a/crates/iota-types/tests/staged/exec_failure_status.yaml +++ b/crates/iota-types/tests/staged/exec_failure_status.yaml @@ -29,7 +29,7 @@ 27: PackageUpgradeError 28: WrittenObjectsTooLarge 29: CertificateDenied -30: IotaMoveVerificationTimedout +30: IotaMoveVerificationTimeout 31: SharedObjectOperationNotAllowed 32: InputObjectDeleted 33: ExecutionCancelledDueToSharedObjectCongestion diff --git a/crates/iota-upgrade-compatibility-transactional-tests/Cargo.toml b/crates/iota-upgrade-compatibility-transactional-tests/Cargo.toml index 9dc55b3714c..bb5940619f4 100644 --- a/crates/iota-upgrade-compatibility-transactional-tests/Cargo.toml +++ b/crates/iota-upgrade-compatibility-transactional-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-upgrade-compatibility-transactional-tests" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota-util-mem-derive/Cargo.toml b/crates/iota-util-mem-derive/Cargo.toml index 50d1798f3f7..6243cbeb6fb 100644 --- a/crates/iota-util-mem-derive/Cargo.toml +++ b/crates/iota-util-mem-derive/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "iota-util-mem-derive" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "MIT OR Apache-2.0" publish = false -repository = "https://github.com/mystenlabs/mysten-infra" rust-version = "1.56.1" description = "Crate for memory reporting" diff --git a/crates/iota-util-mem/Cargo.toml b/crates/iota-util-mem/Cargo.toml index 45c0c7d8d87..3aa8608f96d 100644 --- a/crates/iota-util-mem/Cargo.toml +++ b/crates/iota-util-mem/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "iota-util-mem" -version = "0.11.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "MIT OR Apache-2.0" publish = false -repository = "https://github.com/mystenlabs/mysten-infra" rust-version = "1.56.1" description = "Collection of memory related utilities" diff --git a/crates/iota-verifier-transactional-tests/Cargo.toml b/crates/iota-verifier-transactional-tests/Cargo.toml index 4e1b638658a..767e3f1e938 100644 --- a/crates/iota-verifier-transactional-tests/Cargo.toml +++ b/crates/iota-verifier-transactional-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iota-verifier-transactional-tests" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/iota/genesis.md b/crates/iota/genesis.md index d8bd8082abc..f76dd67fc4b 100644 --- a/crates/iota/genesis.md +++ b/crates/iota/genesis.md @@ -77,16 +77,28 @@ $ iota genesis-ceremony add-validator \ --project-url https://www.iota.org ``` -3. Add token allocation for the faucet +3. Initialize token-distribution schedule -Add allocation for any faucet that might have been launched. +Set the initial token-distribution schedule through a csv file. E.g. +```csv +recipient-address,amount-nanos,staked-with-validator,staked-with-timelock-expiration +,1500000000000000,, +,1500000000000000,, +,1500000000000000,, ``` -$ iota genesis-ceremony add-token-allocation \ - --recipient-address \ - --amount-nanos <# of iota coins> + +This is useful for allocating funds for a faucet, or for distributing the initial +stake to validators. + +The resulting distribution schedule is amended only if any migration sources are +passed in the "Build Genesis" step. + +``` +$ iota genesis-ceremony init-token-distribution-schedule \ + --token-allocations-path $ git add . -$ git commit -m "add faucet token allocation" +$ git commit -m "initialize token distribution schedule" $ git push ``` diff --git a/crates/iota/src/genesis_ceremony.rs b/crates/iota/src/genesis_ceremony.rs index 413f17d1fea..162acf416ce 100644 --- a/crates/iota/src/genesis_ceremony.rs +++ b/crates/iota/src/genesis_ceremony.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use std::path::PathBuf; +use std::{fs::File, path::PathBuf}; use anyhow::Result; use camino::Utf8PathBuf; @@ -10,7 +10,7 @@ use clap::Parser; use fastcrypto::encoding::{Encoding, Hex}; use iota_config::{ IOTA_GENESIS_FILENAME, - genesis::{TokenAllocation, TokenDistributionScheduleBuilder, UnsignedGenesis}, + genesis::{TokenDistributionScheduleBuilder, UnsignedGenesis}, }; use iota_genesis_builder::{ Builder, GENESIS_BUILDER_PARAMETERS_FILE, SnapshotSource, SnapshotUrl, @@ -95,12 +95,14 @@ pub enum CeremonyCommand { #[clap(long)] project_url: Option, }, - /// Add token allocation for the given address. - AddTokenAllocation { - #[clap(long)] - recipient_address: IotaAddress, - #[clap(long)] - amount_nanos: u64, + /// Initialize token distribution schedule. + InitTokenDistributionSchedule { + #[clap( + long, + help = "The path to the csv file with the token allocations", + name = "token_allocations.csv" + )] + token_allocations_path: PathBuf, }, /// List the current validators in the Genesis builder. ListValidators, @@ -113,12 +115,7 @@ pub enum CeremonyCommand { )] #[arg(num_args(0..))] local_migration_snapshots: Vec, - #[clap( - long, - name = "iota|", - help = "Remote migration snapshots.", - default_values_t = vec![SnapshotUrl::Iota], - )] + #[clap(long, name = "iota|", help = "Remote migration snapshots.")] #[arg(num_args(0..))] remote_migration_snapshots: Vec, }, @@ -163,21 +160,19 @@ pub async fn run(cmd: Ceremony) -> Result<()> { ); } - CeremonyCommand::AddTokenAllocation { - recipient_address, - amount_nanos, + CeremonyCommand::InitTokenDistributionSchedule { + token_allocations_path, } => { let mut builder = Builder::load(&dir).await?; - let token_allocation = TokenAllocation { - recipient_address, - amount_nanos, - staked_with_validator: None, - staked_with_timelock_expiration: None, - }; let mut schedule_builder = TokenDistributionScheduleBuilder::new(); - schedule_builder.add_allocation(token_allocation); - builder = builder.with_token_distribution_schedule(schedule_builder.build()); + let token_allocations_csv = File::open(token_allocations_path)?; + let mut reader = csv::Reader::from_reader(token_allocations_csv); + for allocation in reader.deserialize() { + schedule_builder.add_allocation(allocation?); + } + + builder = builder.with_token_distribution_schedule(schedule_builder.build()); builder.save(dir)?; } diff --git a/crates/prometheus-closure-metric/Cargo.toml b/crates/prometheus-closure-metric/Cargo.toml index 0557a081041..0f1bfaf9531 100644 --- a/crates/prometheus-closure-metric/Cargo.toml +++ b/crates/prometheus-closure-metric/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "prometheus-closure-metric" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/mystenlabs/mysten-infra" description = "Library for a Prometheus metric that computes its value by given closure at collection time" [dependencies] diff --git a/crates/shared-crypto/Cargo.toml b/crates/shared-crypto/Cargo.toml index d4cf0bae5d5..c0da759a017 100644 --- a/crates/shared-crypto/Cargo.toml +++ b/crates/shared-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shared-crypto" -version = "0.0.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/simulacrum/Cargo.toml b/crates/simulacrum/Cargo.toml index 1218a2c8dea..8480e289088 100644 --- a/crates/simulacrum/Cargo.toml +++ b/crates/simulacrum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simulacrum" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/simulacrum/src/store/in_mem_store.rs b/crates/simulacrum/src/store/in_mem_store.rs index e704f797259..cd05dc3e8a4 100644 --- a/crates/simulacrum/src/store/in_mem_store.rs +++ b/crates/simulacrum/src/store/in_mem_store.rs @@ -18,8 +18,8 @@ use iota_types::{ }, object::{Object, Owner}, storage::{ - BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, ParentSync, - get_module, load_package_object_from_object_store, + BackingPackageStore, ChildObjectResolver, ObjectStore, PackageObject, get_module, + load_package_object_from_object_store, }, transaction::VerifiedTransaction, }; @@ -326,15 +326,6 @@ impl ObjectStore for InMemoryStore { } } -impl ParentSync for InMemoryStore { - fn get_latest_parent_entry_ref_deprecated( - &self, - _object_id: ObjectID, - ) -> iota_types::error::IotaResult> { - panic!("Never called in newer protocol versions") - } -} - #[derive(Debug)] pub struct KeyStore { validator_keys: BTreeMap, diff --git a/crates/simulacrum/src/store/mod.rs b/crates/simulacrum/src/store/mod.rs index b6a2b92fc7f..0da62903796 100644 --- a/crates/simulacrum/src/store/mod.rs +++ b/crates/simulacrum/src/store/mod.rs @@ -16,7 +16,7 @@ use iota_types::{ VerifiedCheckpoint, }, object::Object, - storage::{BackingStore, ChildObjectResolver, ParentSync}, + storage::{BackingStore, ChildObjectResolver}, transaction::{ InputObjectKind, InputObjects, ObjectReadResult, ReceivingObjectReadResult, ReceivingObjects, VerifiedTransaction, @@ -25,10 +25,7 @@ use iota_types::{ pub mod in_mem_store; pub trait SimulatorStore: - iota_types::storage::BackingPackageStore - + iota_types::storage::ObjectStore - + ParentSync - + ChildObjectResolver + iota_types::storage::BackingPackageStore + iota_types::storage::ObjectStore + ChildObjectResolver { fn init_with_genesis(&mut self, genesis: &genesis::Genesis) { self.insert_checkpoint(genesis.checkpoint()); diff --git a/crates/telemetry-subscribers/Cargo.toml b/crates/telemetry-subscribers/Cargo.toml index 10a0bfe8bfb..0c72ef2a852 100644 --- a/crates/telemetry-subscribers/Cargo.toml +++ b/crates/telemetry-subscribers/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "telemetry-subscribers" -version = "0.2.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/mystenlabs/mysten-infra" description = "Library for common telemetry and observability functionality" [dependencies] diff --git a/crates/test-cluster/Cargo.toml b/crates/test-cluster/Cargo.toml index 56861ab4fbd..0d2d1c2f3cf 100644 --- a/crates/test-cluster/Cargo.toml +++ b/crates/test-cluster/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test-cluster" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/transaction-fuzzer/Cargo.toml b/crates/transaction-fuzzer/Cargo.toml index 97b1df784d4..60523fe6424 100644 --- a/crates/transaction-fuzzer/Cargo.toml +++ b/crates/transaction-fuzzer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "transaction-fuzzer" -version = "0.1.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/typed-store-derive/Cargo.toml b/crates/typed-store-derive/Cargo.toml index f355b808f50..5e0e1bddbc7 100644 --- a/crates/typed-store-derive/Cargo.toml +++ b/crates/typed-store-derive/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "typed-store-derive" -version = "0.3.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/mystenlabs/mysten-infra" description = "macros for the typed-store crate" [lib] diff --git a/crates/typed-store-error/Cargo.toml b/crates/typed-store-error/Cargo.toml index ab14978016d..053debfe3c4 100644 --- a/crates/typed-store-error/Cargo.toml +++ b/crates/typed-store-error/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "typed-store-error" -version = "0.4.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" diff --git a/crates/typed-store-workspace-hack/Cargo.toml b/crates/typed-store-workspace-hack/Cargo.toml index b6d7587f629..b5ce61668d5 100644 --- a/crates/typed-store-workspace-hack/Cargo.toml +++ b/crates/typed-store-workspace-hack/Cargo.toml @@ -6,7 +6,7 @@ # dependencies that were relevant for rocksdb. [package] name = "typed-store-workspace-hack" -version = "0.0.0" +version.workspace = true edition = "2021" license = "Apache-2.0" publish = false diff --git a/crates/typed-store/Cargo.toml b/crates/typed-store/Cargo.toml index 48389f44d0b..603c728be05 100644 --- a/crates/typed-store/Cargo.toml +++ b/crates/typed-store/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "typed-store" -version = "0.4.0" +version.workspace = true authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/mystenlabs/mysten-infra" description = "a typed database interface" [dependencies] diff --git a/docs/content/references/cli/ceremony.mdx b/docs/content/references/cli/ceremony.mdx index 5f6943ba522..cee2316d766 100644 --- a/docs/content/references/cli/ceremony.mdx +++ b/docs/content/references/cli/ceremony.mdx @@ -3,7 +3,7 @@ title: IOTA Genesis Ceremony CLI description: The IOTA Genesis Ceremony CLI provides commands for building a Genesis blob file. --- -The IOTA CLI `genesis-ceremony` command allows the orchestration of an IOTA Genesis Ceremony, +The IOTA CLI `genesis-ceremony` command allows the orchestration of an IOTA Genesis Ceremony, where multiple remote validators can sign a genesis blob. Each step persists in a file structure that can be shared (for instance, via GitHub) with the validators. @@ -41,7 +41,7 @@ The following example demonstrates how to build a genesis blob. ### Initialize the Genesis Builder -This command creates a structure in the file system to persist the genesis builder. +This command creates a structure in the file system to persist the genesis builder. Afterward, the below commands can be used to set additional configurations. ```shell @@ -126,15 +126,26 @@ validator1 0xba55e3ce221bb7edfbbef4d59b68893f5550b6302a9456b738ad8cf06919be0 -### Add Token Allocation +### Initialize the Token Distribution Schedule -This command allocates tokens to a given address for the genesis transaction, -and can be used to provide tokens to the faucet address. +Set the initial token distribution schedule through a `.csv` file: + +```csv +recipient-address,amount-nanos,staked-with-validator,staked-with-timelock-expiration +,1500000000000000,, +,1500000000000000,, +,1500000000000000,, +``` + +This is useful for allocating funds for a faucet, or for distributing the initial +stake to validators. + +The resulting distribution schedule is amended only if any migration sources are +passed in the [Build the Unsigned Checkpoint](#build-the-unsigned-checkpoint) step. ```shell -iota genesis-ceremony add-token-allocation \ - --recipient-address 0x923f43e0d325cd298c28a148858bb755921cfb032deeb0d2fb7772d6b4b168e0 \ - --amount-nanos 1500000000000000 +$ iota genesis-ceremony init-token-distribution-schedule \ + --token-allocations-path ``` ### Validate the Genesis State @@ -153,7 +164,7 @@ iota genesis-ceremony build-unsigned-checkpoint ### Examine the Genesis Checkpoint -This command opens the Genesis Inspector, a responsive command-line tool which allows viewing various +This command opens the Genesis Inspector, a responsive command-line tool which allows viewing various attributes of the current built checkpoint. ```shell diff --git a/external-crates/move/crates/bytecode-verifier-prop-tests/Cargo.toml b/external-crates/move/crates/bytecode-verifier-prop-tests/Cargo.toml index 819600b4d7f..eb7214686bb 100644 --- a/external-crates/move/crates/bytecode-verifier-prop-tests/Cargo.toml +++ b/external-crates/move/crates/bytecode-verifier-prop-tests/Cargo.toml @@ -3,11 +3,9 @@ name = "bytecode-verifier-prop-tests" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem bytecode verifier tests" +description = "Move bytecode verifier tests" [dev-dependencies] hex.workspace = true diff --git a/external-crates/move/crates/bytecode-verifier-tests/Cargo.toml b/external-crates/move/crates/bytecode-verifier-tests/Cargo.toml index 6659eeb238f..37dd473d1ae 100644 --- a/external-crates/move/crates/bytecode-verifier-tests/Cargo.toml +++ b/external-crates/move/crates/bytecode-verifier-tests/Cargo.toml @@ -3,11 +3,9 @@ name = "bytecode-verifier-tests" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem bytecode verifier tests" +description = "Move bytecode verifier tests" [dev-dependencies] hex.workspace = true diff --git a/external-crates/move/crates/invalid-mutations/Cargo.toml b/external-crates/move/crates/invalid-mutations/Cargo.toml index 531d1c1f0e3..7021c23a31b 100644 --- a/external-crates/move/crates/invalid-mutations/Cargo.toml +++ b/external-crates/move/crates/invalid-mutations/Cargo.toml @@ -3,11 +3,9 @@ name = "invalid-mutations" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem invalid mutations" +description = "Move invalid mutations" [dependencies] move-binary-format.workspace = true diff --git a/external-crates/move/crates/language-benchmarks/Cargo.toml b/external-crates/move/crates/language-benchmarks/Cargo.toml index 493fd835976..582979bdcd2 100644 --- a/external-crates/move/crates/language-benchmarks/Cargo.toml +++ b/external-crates/move/crates/language-benchmarks/Cargo.toml @@ -3,10 +3,8 @@ name = "language-benchmarks" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move language benchmarks" [dependencies] diff --git a/external-crates/move/crates/module-generation/Cargo.toml b/external-crates/move/crates/module-generation/Cargo.toml index 650f3c1d3c2..f7a131cf8ac 100644 --- a/external-crates/move/crates/module-generation/Cargo.toml +++ b/external-crates/move/crates/module-generation/Cargo.toml @@ -3,11 +3,9 @@ name = "module-generation" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem binary module generation" +description = "Move binary module generation" [dependencies] rand.workspace = true diff --git a/external-crates/move/crates/move-analyzer/Cargo.toml b/external-crates/move/crates/move-analyzer/Cargo.toml index 359f21bc70c..2ff11f4caaf 100644 --- a/external-crates/move/crates/move-analyzer/Cargo.toml +++ b/external-crates/move/crates/move-analyzer/Cargo.toml @@ -5,7 +5,6 @@ authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/move-language/move" description = "A language server for Move" [dependencies] diff --git a/external-crates/move/crates/move-analyzer/editors/code/package-lock.json b/external-crates/move/crates/move-analyzer/editors/code/package-lock.json index ebb58e03531..05ce33f9371 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/package-lock.json +++ b/external-crates/move/crates/move-analyzer/editors/code/package-lock.json @@ -1,12 +1,12 @@ { - "name": "move", - "version": "1.0.10", + "name": "iota-move", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "move", - "version": "1.0.10", + "name": "iota-move", + "version": "1.0.0", "license": "Apache-2.0", "dependencies": { "command-exists": "^1.2.9", @@ -23,7 +23,7 @@ "@types/vscode": "^1.61.0", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", - "@vscode/test-electron": "^2.0.0", + "@vscode/test-electron": "^2.4.1", "copyfiles": "2.4.1", "cross-env": "^7.0.3", "eslint": "^8.53.0", @@ -463,20 +463,63 @@ "dev": true }, "node_modules/@vscode/test-electron": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.6.tgz", - "integrity": "sha512-M31xGH0RgqNU6CZ4/9g39oUMJ99nLzfjA+4UbtIQ6TcXQ6+2qkjOOxedmPBDDCg26/3Al5ubjY80hIoaMwKYSw==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz", + "integrity": "sha512-Gc6EdaLANdktQ1t+zozoBVRynfIsMKMc94Svu1QreOBC8y76x4tvaK32TljrLi1LI2+PK58sDVbL7ALdqf3VRQ==", "dev": true, + "license": "MIT", "dependencies": { - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.5", "jszip": "^3.10.1", - "semver": "^7.5.2" + "ora": "^7.0.1", + "semver": "^7.6.2" }, "engines": { "node": ">=16" } }, + "node_modules/@vscode/test-electron/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@vscode/test-electron/node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@vscode/test-electron/node_modules/https-proxy-agent": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/acorn": { "version": "8.11.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", @@ -915,6 +958,35 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -1231,6 +1303,13 @@ "readable-stream": "^2.0.2" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, "node_modules/editorconfig": { "version": "0.15.3", "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", @@ -2093,6 +2172,19 @@ "node": ">=0.10.0" } }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2381,6 +2473,16 @@ "node": ">=4" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", @@ -2690,6 +2792,22 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -2707,6 +2825,127 @@ "node": ">= 0.8.0" } }, + "node_modules/ora": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-7.0.1.tgz", + "integrity": "sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^5.3.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.9.0", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.3.0", + "log-symbols": "^5.1.0", + "stdin-discarder": "^0.1.0", + "string-width": "^6.1.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true, + "license": "MIT" + }, + "node_modules/ora/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/string-width": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz", + "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^10.2.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3061,6 +3300,23 @@ "node": ">=4" } }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -3203,6 +3459,13 @@ "integrity": "sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g==", "dev": true }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, "node_modules/simple-concat": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", @@ -3257,6 +3520,74 @@ "node": ">=8" } }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz", + "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stdin-discarder/node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/stdin-discarder/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/stdin-discarder/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", diff --git a/external-crates/move/crates/move-analyzer/editors/code/package.json b/external-crates/move/crates/move-analyzer/editors/code/package.json index e5242702ddb..0f6737c2c29 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/package.json +++ b/external-crates/move/crates/move-analyzer/editors/code/package.json @@ -1,11 +1,11 @@ { - "name": "move", - "displayName": "Move", - "description": "A Move language integrated development environment for Iota.", - "publisher": "IOTA Foundation", + "name": "iota-move", + "displayName": "IOTA Move", + "description": "A Move language integrated development environment for IOTA.", + "publisher": "iota-foundation", "icon": "images/move.png", "license": "Apache-2.0", - "version": "1.0.11", + "version": "1.0.0", "preview": true, "repository": { "url": "https://github.com/iotaledger/iota.git", @@ -33,17 +33,17 @@ "contributes": { "commands": [ { - "command": "move.serverVersion", + "command": "iota-move.serverVersion", "title": "Show Server Version", "category": "Move" }, { - "command": "move.build", + "command": "iota-move.build", "title": "Build a Move package", "category": "Move" }, { - "command": "move.test", + "command": "iota-move.test", "title": "Test a Move package", "category": "Move" } @@ -52,17 +52,17 @@ "type": "object", "title": "Move", "properties": { - "move.inlay-hints.type": { + "iota-move.inlay-hints.type": { "type": "boolean", "default": true, "markdownDescription": "Enable/disable type inlay hints" }, - "move.inlay-hints.param": { + "iota-move.inlay-hints.param": { "type": "boolean", "default": true, "markdownDescription": "Enable/disable parameter inlay hints" }, - "move.lint": { + "iota-move.lint": { "type": "string", "enum": [ "default", @@ -72,7 +72,7 @@ "default": "default", "markdownDescription": "Move source code linting level." }, - "move.server.path": { + "iota-move.server.path": { "type": [ "null", "string" @@ -81,16 +81,16 @@ "default": null, "markdownDescription": "Path to rust-analyzer executable (points to `~/.iota/bin/move-analyzer` by default)." }, - "move.iota.path": { + "iota-move.iota.path": { "type": [ "null", "string" ], "scope": "machine-overridable", "default": null, - "markdownDescription": "Path to Iota executable (by default assumes that `iota` is on the systems path)." + "markdownDescription": "Path to IOTA executable (by default assumes that `iota` is on the systems path)." }, - "move.trace.server": { + "iota-move.trace.server": { "type": "string", "scope": "window", "enum": [ @@ -145,7 +145,7 @@ "test": "node ./out/tests/runTests.js", "dev": "npm run pretest && cross-env mode=dev node ./out/tests/runTests.js", "vscode:prepublish": "npm run pretest", - "package": "npm run pretest && vsce package -o move.vsix", + "package": "npm run pretest && vsce package -o iota-move.vsix", "publish": "npm run pretest && npm run test && vsce publish" }, "extensionDependencies": [ @@ -166,7 +166,7 @@ "@types/vscode": "^1.61.0", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", - "@vscode/test-electron": "^2.0.0", + "@vscode/test-electron": "^2.4.1", "copyfiles": "2.4.1", "cross-env": "^7.0.3", "eslint": "^8.53.0", @@ -180,9 +180,9 @@ "vscode-test": "^1.6.1" }, "__metadata": { - "id": "71e74fc8-23c2-47b7-8594-ed00192d96a6", - "publisherDisplayName": "move", - "publisherId": "40d7def1-c662-4965-9ead-c06109c7cc6d", + "id": "227cd049-67e6-468e-bc8f-b60e02b79e36", + "publisherDisplayName": "iota-move", + "publisherId": "af4b9db3-cc45-4876-a5ad-e9ec96971b48", "isPreReleaseVersion": false } } diff --git a/external-crates/move/crates/move-analyzer/editors/code/scripts/create.sh b/external-crates/move/crates/move-analyzer/editors/code/scripts/create.sh index 9102fff8e8d..a63c8adc9fa 100755 --- a/external-crates/move/crates/move-analyzer/editors/code/scripts/create.sh +++ b/external-crates/move/crates/move-analyzer/editors/code/scripts/create.sh @@ -33,7 +33,7 @@ do exit 0 elif [[ "$cmd" == "-pkg" ]]; then OP="package" - OPTS="-omove-VSCODE_OS.vsix" + OPTS="-oiota-move-VSCODE_OS.vsix" elif [[ "$cmd" == "-pub" ]]; then OP="publish" OPTS="" @@ -44,16 +44,16 @@ do done # these will have to change if we want a different network/version -NETWORK="testnet" -VERSION="1.13.0" +NETWORK="alphanet" +VERSION="0.4.0" # a map from os version identifiers in Iota's binary distribution to os version identifiers # representing VSCode's target platforms used for creating platform-specific plugin distributions declare -A SUPPORTED_OS SUPPORTED_OS[macos-arm64]=darwin-arm64 -SUPPORTED_OS[macos-x86_64]=darwin-x64 -SUPPORTED_OS[ubuntu-x86_64]=linux-x64 -SUPPORTED_OS[windows-x86_64]=win32-x64 +#SUPPORTED_OS[macos-x86_64]=darwin-x64 +SUPPORTED_OS[linux-x86_64]=linux-x64 +#SUPPORTED_OS[windows-x86_64]=win32-x64 TMP_DIR=$( mktemp -d -t vscode-create ) trap "clean_tmp_dir $TMP_DIR" EXIT @@ -66,7 +66,7 @@ mkdir $LANG_SERVER_DIR for DIST_OS VSCODE_OS in "${(@kv)SUPPORTED_OS}"; do # Iota distribution identifier IOTA_DISTRO=$NETWORK"-v"$VERSION - # name of the Iota distribution archive file, for example iota-testnet-v1.13.0-macos-arm64.tgz + # name of the Iota distribution archive file, for example iota-testnet-v1.0.0-macos-arm64.tgz IOTA_ARCHIVE="iota-"$IOTA_DISTRO"-"$DIST_OS".tgz" # a path to downloaded Iota archive IOTA_ARCHIVE_PATH=$TMP_DIR"/"$IOTA_ARCHIVE diff --git a/external-crates/move/crates/move-analyzer/editors/code/src/configuration.ts b/external-crates/move/crates/move-analyzer/editors/code/src/configuration.ts index a9a711598c0..919d8086ad7 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/src/configuration.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/src/configuration.ts @@ -7,7 +7,7 @@ import * as os from 'os'; import * as vscode from 'vscode'; import * as path from 'path'; -export const MOVE_CONF_NAME = 'move'; +export const MOVE_CONF_NAME = 'iota-move'; export const LINT_OPT = 'lint'; export const TYPE_HINTS_OPT = 'inlay-hints.type'; export const PARAM_HINTS_OPT = 'inlay-hints.param'; diff --git a/external-crates/move/crates/move-analyzer/editors/code/src/context.ts b/external-crates/move/crates/move-analyzer/editors/code/src/context.ts index bee84b633e6..686af1638a2 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/src/context.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/src/context.ts @@ -124,7 +124,7 @@ export class Context { command: (context: Readonly, ...args: Array) => any, ): void { const disposable = vscode.commands.registerCommand( - `move.${name}`, + `iota-move.${name}`, async (...args: Array) : Promise => { const ret = await command(this, ...args); return ret; diff --git a/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts b/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts index c1a989885de..a414f1827a6 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/src/extension.ts @@ -9,7 +9,7 @@ import * as vscode from 'vscode'; /** Information related to this extension itself, such as its identifier and version. */ export class Extension { /** The string used to uniquely identify this particular extension to VS Code. */ - readonly identifier = 'iota.move'; + readonly identifier = 'iota-foundation.iota-move'; private readonly extension: vscode.Extension; diff --git a/external-crates/move/crates/move-analyzer/editors/code/src/log.ts b/external-crates/move/crates/move-analyzer/editors/code/src/log.ts index ef2eab95cd1..dc52e5ff21e 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/src/log.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/src/log.ts @@ -14,7 +14,7 @@ import * as vscode from 'vscode'; * server, which appear in a separate output channel. **/ export const log = new class { - private readonly output = vscode.window.createOutputChannel('Move Client'); + private readonly output = vscode.window.createOutputChannel('IOTA Move Client'); /** Log an informational message (as opposed to an error or a warning). */ info(message: string): void { diff --git a/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts b/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts index 80de75368fc..093d0b24f62 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/tests/ext.test.ts @@ -8,7 +8,7 @@ import * as vscode from 'vscode'; Mocha.suite('ext', () => { Mocha.test('ext_exists', () => { - const ext = vscode.extensions.getExtension('move.move-analyzer'); + const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); assert.ok(ext); }); }); diff --git a/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts b/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts index c07e29730f4..0dc0512d528 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/tests/lsp.test.ts @@ -24,7 +24,7 @@ const PRIMITIVE_TYPES = ['u8', 'u16', 'u32', 'u64', 'u128', 'u256', 'bool', 'vec Mocha.suite('LSP', () => { Mocha.test('textDocument/documentSymbol', async () => { - const ext = vscode.extensions.getExtension('move.move-analyzer'); + const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -45,7 +45,7 @@ Mocha.suite('LSP', () => { const syms: Array | undefined = await vscode.commands.executeCommand( - 'move-analyzer.textDocumentDocumentSymbol', params, + 'iota-move.textDocumentDocumentSymbol', params, ); assert.ok(syms); @@ -69,7 +69,7 @@ Mocha.suite('LSP', () => { }); Mocha.test('textDocument/hover for definition in the same module', async () => { - const ext = vscode.extensions.getExtension('move.move-analyzer'); + const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -96,19 +96,19 @@ Mocha.suite('LSP', () => { const hoverResult: lc.Hover | undefined = await vscode.commands.executeCommand( - 'move-analyzer.textDocumentHover', + 'iota-move.textDocumentHover', params, ); assert.ok(hoverResult); assert.deepStrictEqual((hoverResult.contents as MarkupContent).value, // eslint-disable-next-line max-len - 'fun Symbols::M2::other_doc_struct(): Symbols::M3::OtherDocStruct\n\n\nThis is a multiline docstring\n\nThis docstring has empty lines.\n\nIt uses the ** format instead of ///\n\n'); + '```rust\nfun Symbols::M2::other_doc_struct(): Symbols::M3::OtherDocStruct\n```\n\nThis is a multiline docstring\n\nThis docstring has empty lines.\n\nIt uses the ** format instead of ///\n\n'); }); Mocha.test('textDocument/hover for definition in an external module', async () => { - const ext = vscode.extensions.getExtension('move.move-analyzer'); + const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -135,18 +135,19 @@ Mocha.suite('LSP', () => { const hoverResult: lc.Hover | undefined = await vscode.commands.executeCommand( - 'move-analyzer.textDocumentHover', + 'iota-move.textDocumentHover', params, ); assert.ok(hoverResult); assert.deepStrictEqual((hoverResult.contents as MarkupContent).value, - 'Symbols::M3::OtherDocStruct\n\nDocumented struct in another module\n'); + // eslint-disable-next-line max-len + '```rust\nstruct Symbols::M3::OtherDocStruct has drop {\n\tsome_field: u64\n}\n```\nDocumented struct in another module\n'); }); Mocha.test('textDocument/completion', async () => { - const ext = vscode.extensions.getExtension('move.move-analyzer'); + const ext = vscode.extensions.getExtension('iota-foundation.iota-move'); assert.ok(ext); await ext.activate(); // Synchronous waiting for activation to complete @@ -172,7 +173,7 @@ Mocha.suite('LSP', () => { }; const items = await vscode.commands.executeCommand>( - 'move-analyzer.textDocumentCompletion', + 'iota-move.textDocumentCompletion', params, ); @@ -188,31 +189,31 @@ Mocha.suite('LSP', () => { assert.strictEqual(isKeywordInCompletionItems(primitive, items), true); }); - const colonParams: lc.CompletionParams = { + const parameterTypeParams: lc.CompletionParams = { textDocument: { uri: docs.uri.toString(), }, - // The position of the character ":" + // The position of the character "u" position: { line: 9, - character: 15, + character: 17, }, }; - const itemsOnColon = await vscode.commands.executeCommand>( - 'move-analyzer.textDocumentCompletion', - colonParams, + const itemsOnParameterType = await vscode.commands.executeCommand>( + 'iota-move.textDocumentCompletion', + parameterTypeParams, ); - assert.ok(itemsOnColon); + assert.ok(itemsOnParameterType); - const keywordsOnColon = itemsOnColon.filter(i => i.kind === CompletionItemKind.Keyword); - // Primitive types are the only keywords returned after inserting the colon - assert.strictEqual(keywordsOnColon.length, PRIMITIVE_TYPES.length); + const keywordsOnParameterType = itemsOnParameterType.filter(i => i.kind === CompletionItemKind.Keyword); + // Primitive types + `address` are the only keywords returned + assert.strictEqual(keywordsOnParameterType.length, PRIMITIVE_TYPES.length + 1); // Final safety check PRIMITIVE_TYPES.forEach((primitive) => { - assert.strictEqual(isKeywordInCompletionItems(primitive, keywordsOnColon), true); + assert.strictEqual(isKeywordInCompletionItems(primitive, keywordsOnParameterType), true); }); }); }); diff --git a/external-crates/move/crates/move-analyzer/editors/code/tests/runTests.ts b/external-crates/move/crates/move-analyzer/editors/code/tests/runTests.ts index e1769fea29b..ae2c120f8a5 100644 --- a/external-crates/move/crates/move-analyzer/editors/code/tests/runTests.ts +++ b/external-crates/move/crates/move-analyzer/editors/code/tests/runTests.ts @@ -74,8 +74,7 @@ async function runVSCodeTest(vscodeVersion: string): Promise { } async function main(): Promise { - await runVSCodeTest('1.64.0'); // Test with vscode v1.64.0 - await runVSCodeTest('1.69.2'); // Test with vscode v1.69.2 + await runVSCodeTest('1.82.0'); // Test with vscode v1.82.0, the minimal supported version } void main(); diff --git a/external-crates/move/crates/move-binary-format/Cargo.toml b/external-crates/move/crates/move-binary-format/Cargo.toml index 7a26d5ab334..ffbadb4e2a1 100644 --- a/external-crates/move/crates/move-binary-format/Cargo.toml +++ b/external-crates/move/crates/move-binary-format/Cargo.toml @@ -3,10 +3,8 @@ name = "move-binary-format" version = "0.0.3" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = ["crates-io"] -repository = "https://github.com/diem/diem" description = "Move Binary Format" [dependencies] diff --git a/external-crates/move/crates/move-bytecode-utils/Cargo.toml b/external-crates/move/crates/move-bytecode-utils/Cargo.toml index 5e441d4f26b..67c7089e7ce 100644 --- a/external-crates/move/crates/move-bytecode-utils/Cargo.toml +++ b/external-crates/move/crates/move-bytecode-utils/Cargo.toml @@ -3,10 +3,8 @@ name = "move-bytecode-utils" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Libraries for working with sets of Move bytecode modules" [dependencies] diff --git a/external-crates/move/crates/move-bytecode-verifier-meter/Cargo.toml b/external-crates/move/crates/move-bytecode-verifier-meter/Cargo.toml index 3184abe4247..f3e1389235d 100644 --- a/external-crates/move/crates/move-bytecode-verifier-meter/Cargo.toml +++ b/external-crates/move/crates/move-bytecode-verifier-meter/Cargo.toml @@ -3,10 +3,8 @@ name = "move-bytecode-verifier-meter" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Traits for metering the bytecode verifier" [dependencies] diff --git a/external-crates/move/crates/move-bytecode-verifier/Cargo.toml b/external-crates/move/crates/move-bytecode-verifier/Cargo.toml index 4b299d1fcf4..c1201ed60a2 100644 --- a/external-crates/move/crates/move-bytecode-verifier/Cargo.toml +++ b/external-crates/move/crates/move-bytecode-verifier/Cargo.toml @@ -3,10 +3,8 @@ name = "move-bytecode-verifier" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move bytecode verifier" [dependencies] diff --git a/external-crates/move/crates/move-cli/Cargo.toml b/external-crates/move/crates/move-cli/Cargo.toml index 14aea8bf704..1a9adfd1a7f 100644 --- a/external-crates/move/crates/move-cli/Cargo.toml +++ b/external-crates/move/crates/move-cli/Cargo.toml @@ -3,10 +3,8 @@ name = "move-cli" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "CLI frontend for the Move compiler and VM" [dependencies] diff --git a/external-crates/move/crates/move-command-line-common/Cargo.toml b/external-crates/move/crates/move-command-line-common/Cargo.toml index 4ee43bc801d..e5a5fe5fcf8 100644 --- a/external-crates/move/crates/move-command-line-common/Cargo.toml +++ b/external-crates/move/crates/move-command-line-common/Cargo.toml @@ -3,10 +3,8 @@ name = "move-command-line-common" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move shared command line and file tools" [dependencies] diff --git a/external-crates/move/crates/move-core-types/Cargo.toml b/external-crates/move/crates/move-core-types/Cargo.toml index 05fad72c937..8b9af6cfa9c 100644 --- a/external-crates/move/crates/move-core-types/Cargo.toml +++ b/external-crates/move/crates/move-core-types/Cargo.toml @@ -3,10 +3,8 @@ name = "move-core-types" version = "0.0.4" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = ["crates-io"] -repository = "https://github.com/diem/diem" description = "Core types for Move" [dependencies] diff --git a/external-crates/move/crates/move-coverage/Cargo.toml b/external-crates/move/crates/move-coverage/Cargo.toml index ef6d15a05d6..b3a0ea529af 100644 --- a/external-crates/move/crates/move-coverage/Cargo.toml +++ b/external-crates/move/crates/move-coverage/Cargo.toml @@ -3,11 +3,9 @@ name = "move-coverage" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem Move VM code coverage" +description = "Move VM code coverage" [dependencies] anyhow.workspace = true diff --git a/external-crates/move/crates/move-docgen/Cargo.toml b/external-crates/move/crates/move-docgen/Cargo.toml index 509e85cb75d..4158a2b7ab8 100644 --- a/external-crates/move/crates/move-docgen/Cargo.toml +++ b/external-crates/move/crates/move-docgen/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" publish = false [dependencies] -# diem dependencies +# internal dependencies move-compiler.workspace = true move-model.workspace = true diff --git a/external-crates/move/crates/move-ir-compiler/Cargo.toml b/external-crates/move/crates/move-ir-compiler/Cargo.toml index e998222ef18..ed54783080b 100644 --- a/external-crates/move/crates/move-ir-compiler/Cargo.toml +++ b/external-crates/move/crates/move-ir-compiler/Cargo.toml @@ -3,10 +3,8 @@ name = "move-ir-compiler" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move IR to bytecode compiler" [dependencies] diff --git a/external-crates/move/crates/move-ir-to-bytecode-syntax/Cargo.toml b/external-crates/move/crates/move-ir-to-bytecode-syntax/Cargo.toml index b529c0cd38f..5295e34237e 100644 --- a/external-crates/move/crates/move-ir-to-bytecode-syntax/Cargo.toml +++ b/external-crates/move/crates/move-ir-to-bytecode-syntax/Cargo.toml @@ -3,11 +3,9 @@ name = "move-ir-to-bytecode-syntax" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem ir to bytecode syntax" +description = "Move ir to bytecode syntax" [dependencies] anyhow.workspace = true diff --git a/external-crates/move/crates/move-ir-to-bytecode/Cargo.toml b/external-crates/move/crates/move-ir-to-bytecode/Cargo.toml index f2aa67c8a2b..6a883c661d3 100644 --- a/external-crates/move/crates/move-ir-to-bytecode/Cargo.toml +++ b/external-crates/move/crates/move-ir-to-bytecode/Cargo.toml @@ -3,11 +3,9 @@ name = "move-ir-to-bytecode" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem ir to bytecode" +description = "Move ir to bytecode" [dependencies] anyhow.workspace = true diff --git a/external-crates/move/crates/move-ir-types/Cargo.toml b/external-crates/move/crates/move-ir-types/Cargo.toml index 7bf0c291e12..7565ed8771a 100644 --- a/external-crates/move/crates/move-ir-types/Cargo.toml +++ b/external-crates/move/crates/move-ir-types/Cargo.toml @@ -3,10 +3,8 @@ name = "move-ir-types" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Types for Move IR" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/external-crates/move/crates/move-model/Cargo.toml b/external-crates/move/crates/move-model/Cargo.toml index 2f8a3592d4d..45364281f76 100644 --- a/external-crates/move/crates/move-model/Cargo.toml +++ b/external-crates/move/crates/move-model/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" publish = false [dependencies] -# diem dependencies +# internal dependencies move-binary-format.workspace = true move-bytecode-source-map.workspace = true move-command-line-common.workspace = true diff --git a/external-crates/move/crates/move-stackless-bytecode/Cargo.toml b/external-crates/move/crates/move-stackless-bytecode/Cargo.toml index cfa58174eb6..a5f7cd3d4d8 100644 --- a/external-crates/move/crates/move-stackless-bytecode/Cargo.toml +++ b/external-crates/move/crates/move-stackless-bytecode/Cargo.toml @@ -3,10 +3,8 @@ name = "move-stackless-bytecode" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move stackless bytecode" [dependencies] diff --git a/external-crates/move/crates/move-stdlib-natives/Cargo.toml b/external-crates/move/crates/move-stdlib-natives/Cargo.toml index 62720419805..5d6c8c40cdf 100644 --- a/external-crates/move/crates/move-stdlib-natives/Cargo.toml +++ b/external-crates/move/crates/move-stdlib-natives/Cargo.toml @@ -1,13 +1,11 @@ [package] name = "move-stdlib-natives" version = "0.1.1" -authors = ["Diem Association "] +authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem stdlib" +description = "Move stdlib" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/external-crates/move/crates/move-stdlib/Cargo.toml b/external-crates/move/crates/move-stdlib/Cargo.toml index 88957796257..9055b18e6e2 100644 --- a/external-crates/move/crates/move-stdlib/Cargo.toml +++ b/external-crates/move/crates/move-stdlib/Cargo.toml @@ -3,11 +3,9 @@ name = "move-stdlib" version = "0.1.1" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem stdlib" +description = "Move stdlib" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/external-crates/move/crates/move-symbol-pool/Cargo.toml b/external-crates/move/crates/move-symbol-pool/Cargo.toml index aa5cf4123a3..348df2609f2 100644 --- a/external-crates/move/crates/move-symbol-pool/Cargo.toml +++ b/external-crates/move/crates/move-symbol-pool/Cargo.toml @@ -3,10 +3,8 @@ name = "move-symbol-pool" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "A static, global string table for Move tools" [dependencies] diff --git a/external-crates/move/crates/move-transactional-test-runner/Cargo.toml b/external-crates/move/crates/move-transactional-test-runner/Cargo.toml index 37523947ff0..af7bb1efde6 100644 --- a/external-crates/move/crates/move-transactional-test-runner/Cargo.toml +++ b/external-crates/move/crates/move-transactional-test-runner/Cargo.toml @@ -3,10 +3,8 @@ name = "move-transactional-test-runner" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Transactional testing framework for Move" [dependencies] diff --git a/external-crates/move/crates/move-unit-test/Cargo.toml b/external-crates/move/crates/move-unit-test/Cargo.toml index b6a7dba6eee..4ba2fbaabb0 100644 --- a/external-crates/move/crates/move-unit-test/Cargo.toml +++ b/external-crates/move/crates/move-unit-test/Cargo.toml @@ -3,10 +3,8 @@ name = "move-unit-test" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Unit testing framework for Move code" [dependencies] diff --git a/external-crates/move/crates/move-vm-config/Cargo.toml b/external-crates/move/crates/move-vm-config/Cargo.toml index 8aa524e0b40..6780cd878ab 100644 --- a/external-crates/move/crates/move-vm-config/Cargo.toml +++ b/external-crates/move/crates/move-vm-config/Cargo.toml @@ -5,7 +5,6 @@ authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/move-language/move" [dependencies] move-binary-format.workspace = true diff --git a/external-crates/move/crates/move-vm-integration-tests/Cargo.toml b/external-crates/move/crates/move-vm-integration-tests/Cargo.toml index ec8810d6be0..27c282a2606 100644 --- a/external-crates/move/crates/move-vm-integration-tests/Cargo.toml +++ b/external-crates/move/crates/move-vm-integration-tests/Cargo.toml @@ -3,10 +3,8 @@ name = "move-vm-integration-tests" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move VM Integration Tests" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/external-crates/move/crates/move-vm-runtime/Cargo.toml b/external-crates/move/crates/move-vm-runtime/Cargo.toml index c79837df399..7348e2ef37f 100644 --- a/external-crates/move/crates/move-vm-runtime/Cargo.toml +++ b/external-crates/move/crates/move-vm-runtime/Cargo.toml @@ -3,10 +3,8 @@ name = "move-vm-runtime" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Core Move execution logic" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/external-crates/move/crates/move-vm-test-utils/Cargo.toml b/external-crates/move/crates/move-vm-test-utils/Cargo.toml index 86b96f29e4d..a69b5f0f42f 100644 --- a/external-crates/move/crates/move-vm-test-utils/Cargo.toml +++ b/external-crates/move/crates/move-vm-test-utils/Cargo.toml @@ -3,10 +3,8 @@ name = "move-vm-test-utils" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move VM Test Utils" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/external-crates/move/crates/move-vm-types/Cargo.toml b/external-crates/move/crates/move-vm-types/Cargo.toml index 00ed9ad4347..0804f5fb672 100644 --- a/external-crates/move/crates/move-vm-types/Cargo.toml +++ b/external-crates/move/crates/move-vm-types/Cargo.toml @@ -3,10 +3,8 @@ name = "move-vm-types" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Types for Move VM" [dependencies] diff --git a/external-crates/move/crates/serializer-tests/Cargo.toml b/external-crates/move/crates/serializer-tests/Cargo.toml index 3796ab7ffbc..a78452e154a 100644 --- a/external-crates/move/crates/serializer-tests/Cargo.toml +++ b/external-crates/move/crates/serializer-tests/Cargo.toml @@ -3,11 +3,9 @@ name = "serializer-tests" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem serializer tests" +description = "Move serializer tests" [dev-dependencies] move-binary-format = { workspace = true, features = ["fuzzing"] } diff --git a/external-crates/move/crates/test-generation/Cargo.toml b/external-crates/move/crates/test-generation/Cargo.toml index b3934bdffe9..7a5188c5de0 100644 --- a/external-crates/move/crates/test-generation/Cargo.toml +++ b/external-crates/move/crates/test-generation/Cargo.toml @@ -3,10 +3,8 @@ name = "test-generation" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Tool for generating tests for the bytecode verifier and Move VM runtime" [dependencies] diff --git a/external-crates/move/move-execution/v0/crates/bytecode-verifier-tests/Cargo.toml b/external-crates/move/move-execution/v0/crates/bytecode-verifier-tests/Cargo.toml index 764251d2cb6..e6484d36ef7 100644 --- a/external-crates/move/move-execution/v0/crates/bytecode-verifier-tests/Cargo.toml +++ b/external-crates/move/move-execution/v0/crates/bytecode-verifier-tests/Cargo.toml @@ -3,11 +3,9 @@ name = "bytecode-verifier-tests-v0" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem bytecode verifier tests" +description = "Move bytecode verifier tests" [dev-dependencies] hex.workspace = true diff --git a/external-crates/move/move-execution/v0/crates/move-bytecode-verifier/Cargo.toml b/external-crates/move/move-execution/v0/crates/move-bytecode-verifier/Cargo.toml index a94ead8cd7c..66e4d921646 100644 --- a/external-crates/move/move-execution/v0/crates/move-bytecode-verifier/Cargo.toml +++ b/external-crates/move/move-execution/v0/crates/move-bytecode-verifier/Cargo.toml @@ -3,10 +3,8 @@ name = "move-bytecode-verifier-v0" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Move bytecode verifier" [dependencies] diff --git a/external-crates/move/move-execution/v0/crates/move-stdlib-natives/Cargo.toml b/external-crates/move/move-execution/v0/crates/move-stdlib-natives/Cargo.toml index 38298e19277..e6329818aba 100644 --- a/external-crates/move/move-execution/v0/crates/move-stdlib-natives/Cargo.toml +++ b/external-crates/move/move-execution/v0/crates/move-stdlib-natives/Cargo.toml @@ -1,13 +1,11 @@ [package] name = "move-stdlib-natives-v0" version = "0.1.1" -authors = ["Diem Association "] +authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" -description = "Diem stdlib" +description = "Move stdlib" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/external-crates/move/move-execution/v0/crates/move-vm-runtime/Cargo.toml b/external-crates/move/move-execution/v0/crates/move-vm-runtime/Cargo.toml index 49585cc02bc..a1fb83b233c 100644 --- a/external-crates/move/move-execution/v0/crates/move-vm-runtime/Cargo.toml +++ b/external-crates/move/move-execution/v0/crates/move-vm-runtime/Cargo.toml @@ -3,10 +3,8 @@ name = "move-vm-runtime-v0" version = "0.1.0" authors = ["IOTA Foundation "] edition = "2021" -homepage = "https://diem.com" license = "Apache-2.0" publish = false -repository = "https://github.com/diem/diem" description = "Core Move execution logic" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/iota-execution/latest/iota-adapter/src/temporary_store.rs b/iota-execution/latest/iota-adapter/src/temporary_store.rs index 1f35ae0fcf2..10f5a7304f5 100644 --- a/iota-execution/latest/iota-adapter/src/temporary_store.rs +++ b/iota-execution/latest/iota-adapter/src/temporary_store.rs @@ -29,7 +29,7 @@ use iota_types::{ object::{Data, Object, Owner}, storage::{ BackingPackageStore, BackingStore, ChildObjectResolver, DenyListResult, PackageObject, - ParentSync, Storage, + Storage, }, transaction::InputObjects, }; @@ -1139,12 +1139,3 @@ impl<'backing> ResourceResolver for TemporaryStore<'backing> { } } } - -impl<'backing> ParentSync for TemporaryStore<'backing> { - fn get_latest_parent_entry_ref_deprecated( - &self, - _object_id: ObjectID, - ) -> IotaResult> { - unreachable!("Never called in newer protocol versions") - } -} diff --git a/iota-execution/latest/iota-verifier/src/lib.rs b/iota-execution/latest/iota-verifier/src/lib.rs index f2140abb868..e01d51b6c07 100644 --- a/iota-execution/latest/iota-verifier/src/lib.rs +++ b/iota-execution/latest/iota-verifier/src/lib.rs @@ -23,7 +23,7 @@ fn verification_failure(error: String) -> ExecutionError { } fn to_verification_timeout_error(error: String) -> ExecutionError { - ExecutionError::new_with_source(ExecutionErrorKind::IotaMoveVerificationTimedout, error) + ExecutionError::new_with_source(ExecutionErrorKind::IotaMoveVerificationTimeout, error) } /// Runs the Move verifier and checks if the error counts as a Move verifier diff --git a/iota-execution/latest/iota-verifier/src/verifier.rs b/iota-execution/latest/iota-verifier/src/verifier.rs index 0644392062a..7303e6a9ef1 100644 --- a/iota-execution/latest/iota-verifier/src/verifier.rs +++ b/iota-execution/latest/iota-verifier/src/verifier.rs @@ -39,7 +39,7 @@ pub fn iota_verify_module_metered_check_timeout_only( if let Err(error) = iota_verify_module_metered(module, fn_info_map, meter) { if matches!( error.kind(), - iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimedout + iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimeout ) { return Err(error); } @@ -57,7 +57,7 @@ pub fn iota_verify_module_unmetered( debug_assert!( !matches!( err.kind(), - iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimedout + iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimeout ), "Unexpected timeout error in execution" ); diff --git a/iota-execution/v0/iota-adapter/src/adapter.rs b/iota-execution/v0/iota-adapter/src/adapter.rs index 1d29399cd18..295facc2e8f 100644 --- a/iota-execution/v0/iota-adapter/src/adapter.rs +++ b/iota-execution/v0/iota-adapter/src/adapter.rs @@ -36,6 +36,12 @@ mod checked { }; use tracing::instrument; + /// Creates a new instance of `MoveVM` with the specified native functions + /// and protocol configuration. The VM is configured using a `VMConfig` + /// that sets limits for vector length, value depth, and other + /// runtime options based on the provided `ProtocolConfig`. If gas profiling + /// is enabled, the function configures the profiler with the provided + /// path. pub fn new_move_vm( natives: NativeFunctionTable, protocol_config: &ProtocolConfig, @@ -71,6 +77,12 @@ mod checked { .map_err(|_| IotaError::ExecutionInvariantViolation) } + /// Creates a new set of `NativeContextExtensions` for the Move VM, + /// configuring extensions such as `ObjectRuntime` and + /// `NativesCostTable`. These extensions manage object resolution, input + /// objects, metering, protocol configuration, and metrics tracking. + /// They are available and mainly used in native function implementations + /// via `NativeContext` instance. pub fn new_native_extensions<'r>( child_resolver: &'r dyn ChildObjectResolver, input_objects: BTreeMap, @@ -127,6 +139,7 @@ mod checked { Ok(()) } + /// Returns an error message for a missing unwrapped object. pub fn missing_unwrapped_msg(id: &ObjectID) -> String { format!( "Unable to unwrap object {}. Was unable to retrieve last known version in the parent sync", diff --git a/iota-execution/v0/iota-adapter/src/execution_engine.rs b/iota-execution/v0/iota-adapter/src/execution_engine.rs index c4361c81a06..26353e36d0a 100644 --- a/iota-execution/v0/iota-adapter/src/execution_engine.rs +++ b/iota-execution/v0/iota-adapter/src/execution_engine.rs @@ -74,6 +74,17 @@ mod checked { type_layout_resolver::TypeLayoutResolver, }; + /// The main entry point to the adapter's transaction execution. It + /// prepares a transaction for execution, then executes it through an + /// inner execution method and finally produces an instance of + /// transaction effects. It also returns the inner temporary store, which + /// contains the objects resulting from the transction execution, the gas + /// status instance, which tracks the gas usage, and the execution result. + /// The function handles transaction execution based on the provided + /// `TransactionKind`. It checks for any expensive operations, manages + /// shared object references, and ensures transaction dependencies are + /// met. The returned objects are not committed to the store until the + /// resulting effects are applied by the caller. #[instrument(name = "tx_execute_to_effects", level = "debug", skip_all)] pub fn execute_transaction_to_effects( store: &dyn BackingStore, @@ -231,6 +242,12 @@ mod checked { ) } + /// Function dedicated to the execution of a GenesisTransaction. + /// The function creates an `InnerTemporaryStore`, processes the input + /// objects, and executes the transaction in unmetered mode using the + /// `Genesis` execution mode. It returns an inner temporary store that + /// contains the objects found into the input `GenesisTransaction` by + /// adding the data for `previous_transaction` and `storage_rebate` fields. pub fn execute_genesis_state_update( store: &dyn BackingStore, protocol_config: &ProtocolConfig, @@ -263,6 +280,14 @@ mod checked { Ok(temporary_store.into_inner()) } + /// Executes a transaction by processing the specified `TransactionKind`, + /// applying the necessary gas charges and running the main execution logic. + /// The function handles certain error conditions such as denied + /// certificate, deleted input objects, exceeded execution meter limits, + /// failed conservation checks. It also accounts for unmetered storage + /// rebates and adjusts for special cases like epoch change + /// transactions. Gas costs are managed through the `GasCharger` + /// argument; gas is also charged in case of errors. #[instrument(name = "tx_execute", level = "debug", skip_all)] fn execute_transaction( temporary_store: &mut TemporaryStore<'_>, @@ -387,6 +412,14 @@ mod checked { (cost_summary, result) } + /// Performs IOTA conservation checks during transaction execution, ensuring + /// that the transaction does not create or destroy IOTA. If + /// conservation is violated, the function attempts to recover + /// by resetting the gas charger, recharging gas, and rechecking + /// conservation. If recovery fails, it panics to avoid IOTA creation or + /// destruction. These checks include both simple and expensive + /// checks based on the configuration and are skipped for genesis or epoch + /// change transactions. #[instrument(name = "run_conservation_checks", level = "debug", skip_all)] fn run_conservation_checks( temporary_store: &mut TemporaryStore<'_>, @@ -465,6 +498,10 @@ mod checked { result } + /// Checks if the estimated size of transaction effects exceeds predefined + /// limits based on the protocol configuration. For metered + /// transactions, it enforces hard limits, while for system transactions, it + /// allows soft limits with warnings. #[instrument(name = "check_meter_limit", level = "debug", skip_all)] fn check_meter_limit( temporary_store: &mut TemporaryStore<'_>, @@ -504,6 +541,10 @@ mod checked { } } + /// Checks if the total size of written objects in the transaction exceeds + /// the limits defined in the protocol configuration. For metered + /// transactions, it enforces a hard limit, while for system transactions, + /// it allows a soft limit with warnings. #[instrument(name = "check_written_objects_limit", level = "debug", skip_all)] fn check_written_objects_limit( temporary_store: &mut TemporaryStore<'_>, @@ -547,6 +588,12 @@ mod checked { Ok(()) } + /// Executes the given transaction based on its `TransactionKind` by + /// processing it through corresponding handlers such as epoch changes, + /// genesis transactions, consensus commit prologues, and programmable + /// transactions. For each type of transaction, the corresponding logic is + /// invoked, such as advancing the epoch, setting up consensus commits, or + /// executing a programmable transaction. #[instrument(level = "debug", skip_all)] fn execution_loop( temporary_store: &mut TemporaryStore<'_>, @@ -684,6 +731,14 @@ mod checked { Ok(result) } + /// Mints epoch rewards by creating both storage and computation rewards + /// using a `ProgrammableTransactionBuilder`. The function takes in the + /// `AdvanceEpochParams`, serializes the storage and computation + /// charges, and invokes the reward creation function within the Iota + /// Prepares invocations for creating both storage and computation rewards + /// with a `ProgrammableTransactionBuilder` using the `AdvanceEpochParams`. + /// The corresponding functions from the Iota framework can be invoked later + /// during execution of the programmable transaction. fn mint_epoch_rewards_in_pt( builder: &mut ProgrammableTransactionBuilder, params: &AdvanceEpochParams, @@ -718,6 +773,13 @@ mod checked { (storage_charges, computation_rewards) } + /// Constructs a `ProgrammableTransaction` to advance the epoch. It creates + /// storage charges and computation rewards by invoking + /// `mint_epoch_rewards_in_pt`, advances the epoch by setting up the + /// necessary arguments, such as epoch number, protocol version, storage + /// rebate, and slashing rate, and executing the `advance_epoch` function + /// within the Iota system. Then, it destroys the storage rebates to + /// complete the transaction. pub fn construct_advance_epoch_pt( mut builder: ProgrammableTransactionBuilder, params: &AdvanceEpochParams, @@ -774,6 +836,13 @@ mod checked { Ok(builder.finish()) } + /// Advances the epoch by constructing a `ProgrammableTransaction` with + /// `construct_advance_epoch_pt` and executing it. + /// If the transaction fails, it switches to safe mode and retries the + /// epoch advancement in a more controlled environment. The function also + /// handles the publication and upgrade of system packages for the new + /// epoch. If any system package is added or upgraded, it ensures the + /// proper execution and storage of the changes. fn advance_epoch( builder: ProgrammableTransactionBuilder, change_epoch: ChangeEpoch, @@ -949,6 +1018,9 @@ mod checked { ) } + /// This function adds a Move call to the Iota framework's + /// `authenticator_state_create` function, preparing the transaction for + /// execution. fn setup_authenticator_state_create( mut builder: ProgrammableTransactionBuilder, ) -> ProgrammableTransactionBuilder { @@ -964,6 +1036,7 @@ mod checked { builder } + /// Configures a `ProgrammableTransactionBuilder` to create a bridge. fn setup_bridge_create( mut builder: ProgrammableTransactionBuilder, chain_id: ChainIdentifier, @@ -994,6 +1067,8 @@ mod checked { builder } + /// Configures a `ProgrammableTransactionBuilder` to update the bridge + /// committee. fn setup_bridge_committee_update( mut builder: ProgrammableTransactionBuilder, bridge_shared_version: SequenceNumber, @@ -1035,6 +1110,12 @@ mod checked { builder } + /// Sets up and executes a `ProgrammableTransaction` to update the + /// authenticator state. This function constructs a transaction that + /// invokes the `authenticator_state_update` function from the Iota + /// framework, passing the authenticator state object and new active JWKS as + /// arguments. It then executes the transaction using the system + /// execution mode. fn setup_authenticator_state_update( update: AuthenticatorStateUpdateV1, temporary_store: &mut TemporaryStore<'_>, @@ -1077,6 +1158,10 @@ mod checked { ) } + /// Configures a `ProgrammableTransactionBuilder` to expire authenticator + /// state by invoking the `authenticator_state_expire_jwks` function + /// from the Iota framework. The function adds the necessary Move call + /// with the authenticator state object and the minimum epoch as arguments. fn setup_authenticator_state_expire( mut builder: ProgrammableTransactionBuilder, expire: AuthenticatorStateExpire, @@ -1100,6 +1185,11 @@ mod checked { builder } + /// The function constructs a transaction that invokes + /// the `randomness_state_update` function from the Iota framework, + /// passing the randomness state object, the `randomness_round`, + /// and the `random_bytes` as arguments. It then executes the transaction + /// using the system execution mode. fn setup_randomness_state_update( update: RandomnessStateUpdate, temporary_store: &mut TemporaryStore<'_>, diff --git a/iota-execution/v0/iota-adapter/src/programmable_transactions/context.rs b/iota-execution/v0/iota-adapter/src/programmable_transactions/context.rs index f5c630c28ec..3881633441a 100644 --- a/iota-execution/v0/iota-adapter/src/programmable_transactions/context.rs +++ b/iota-execution/v0/iota-adapter/src/programmable_transactions/context.rs @@ -118,6 +118,12 @@ mod checked { } impl<'vm, 'state, 'a> ExecutionContext<'vm, 'state, 'a> { + /// Creates a new instance of the transaction execution context, + /// initializing the necessary components such as protocol + /// configuration, Move VM, gas management, inputs, and native + /// extensions. This function processes the input arguments, sets up gas + /// handling for the transaction, and prepares the state for + /// executing Move programs. #[instrument(name = "ExecutionContext::new", level = "trace", skip_all)] pub fn new( protocol_config: &'a ProtocolConfig, @@ -381,6 +387,7 @@ mod checked { ) { return Err(CommandArgumentError::InvalidObjectByValue); } + // Any input object taken by value must be mutable if matches!( input_metadata_opt, @@ -940,6 +947,10 @@ mod checked { Ok((metadata, &mut result_value.value)) } + /// Executes a Move function bypassing visibility checks, allowing the + /// execution of private or protected functions. This method + /// sets up the necessary gas status and data store, and then + /// delegates the execution to the Move VM runtime. pub(crate) fn execute_function_bypass_visibility( &mut self, module: &ModuleId, @@ -960,6 +971,10 @@ mod checked { ) } + /// Loads a Move function from the specified module with the given type + /// arguments without executing it. This function initializes + /// the data store and delegates the loading process to the Move + /// VM runtime. pub(crate) fn load_function( &mut self, module_id: &ModuleId, @@ -975,6 +990,10 @@ mod checked { ) } + /// Constructs an `ObjectValue` based on the provided Move object type, + /// transferability, usage context, and byte contents. This + /// function utilizes the protocol configuration, Move VM, and + /// linkage view to properly interpret and instantiate the object. pub(crate) fn make_object_value( &mut self, type_: MoveObjectType, @@ -991,6 +1010,10 @@ mod checked { ) } + /// Publishes a bundle of Move modules to the blockchain under the + /// specified sender's account address. The function initializes + /// a data store and delegates the publishing operation to the Move VM + /// runtime. pub fn publish_module_bundle( &mut self, modules: Vec>, @@ -1009,6 +1032,8 @@ mod checked { } impl<'vm, 'state, 'a> TypeTagResolver for ExecutionContext<'vm, 'state, 'a> { + /// Retrieves the `TypeTag` corresponding to the provided `Type` by + /// querying the Move VM runtime. fn get_type_tag(&self, type_: &Type) -> Result { self.vm .get_runtime() @@ -1040,6 +1065,11 @@ mod checked { } } + /// Loads a `Type` from the given `StructTag`, retrieving the corresponding + /// struct from the package in storage. The function sets up the linkage + /// context to resolve the struct's module and verifies + /// any type parameter constraints. If the struct has type parameters, they + /// are recursively loaded and verified. pub fn load_type_from_struct( vm: &MoveVM, linkage_view: &mut LinkageView, @@ -1135,6 +1165,12 @@ mod checked { }) } + /// Constructs an `ObjectValue` based on the provided `MoveObjectType`, + /// contents, and additional flags such as transferability and usage + /// context. If the object is a coin, it deserializes the contents into + /// a `Coin` type; otherwise, it treats the contents as raw data. The + /// function then loads the corresponding struct type from the Move + /// package and verifies its abilities if needed. pub(crate) fn make_object_value( vm: &MoveVM, linkage_view: &mut LinkageView, @@ -1168,6 +1204,10 @@ mod checked { }) } + /// Converts a provided `Object` into an `ObjectValue`, extracting and + /// validating the `MoveObjectType` and contents. This function assumes + /// the object contains Move-specific data and passes the extracted data + /// through `make_object_value` to create the corresponding `ObjectValue`. pub(crate) fn value_from_object( vm: &MoveVM, linkage_view: &mut LinkageView, diff --git a/iota-execution/v0/iota-adapter/src/programmable_transactions/execution.rs b/iota-execution/v0/iota-adapter/src/programmable_transactions/execution.rs index cccc62f4eed..cc70099dc59 100644 --- a/iota-execution/v0/iota-adapter/src/programmable_transactions/execution.rs +++ b/iota-execution/v0/iota-adapter/src/programmable_transactions/execution.rs @@ -71,6 +71,13 @@ mod checked { programmable_transactions::context::*, }; + /// Executes a `ProgrammableTransaction` in the specified `ExecutionMode`, + /// applying a series of commands to the execution context. The + /// function initializes the execution context, processes each command + /// in sequence, and handles errors by recording any loaded runtime objects + /// before exiting. After successful command execution, it applies the + /// resulting changes, saving the loaded runtime objects and wrapped + /// object containers for later use. pub fn execute( protocol_config: &ProtocolConfig, metrics: Arc, @@ -408,6 +415,11 @@ mod checked { res } + /// Writes back the results of an execution, updating mutable references and + /// processing return values. This function iterates through mutable + /// reference values and their corresponding kinds, restoring them to + /// the execution context. It also processes return values for non-entry + /// Move calls by converting them into `Value` types. fn write_back_results( context: &mut ExecutionContext<'_, '_, '_>, argument_updates: &mut Mode::ArgumentUpdates, @@ -438,6 +450,12 @@ mod checked { .collect() } + /// Constructs a `Value` from the given `ValueKind` and byte data. Depending + /// on the kind, it either creates an `Object` or `Raw` value. For + /// `Object` types, it uses the execution context to generate an + /// `ObjectValue`, considering whether the object was used in a non-entry + /// Move call. For `Raw` types, it wraps the raw bytes with type and ability + /// information. fn make_value( context: &mut ExecutionContext<'_, '_, '_>, value_info: ValueKind, @@ -635,6 +653,11 @@ mod checked { )]) } + /// Checks the compatibility between an existing Move package and the new + /// upgrading modules based on the specified upgrade policy. The + /// function first validates the upgrade policy, then normalizes the + /// existing and new modules to compare them. For each module, it verifies + /// compatibility according to the policy. fn check_compatibility<'a>( context: &ExecutionContext, existing_package: &MovePackage, @@ -672,6 +695,11 @@ mod checked { Ok(()) } + /// Verifies the compatibility of two normalized Move modules based on the + /// specified upgrade policy. Depending on the policy, it checks if the + /// new module is a subset, equal, or compatible with the + /// current module. The compatibility check may include aspects like struct + /// layout, public function linking, and struct type parameters. fn check_module_compatibility( policy: &UpgradePolicy, cur_module: &normalized::Module, @@ -705,6 +733,10 @@ mod checked { }) } + /// Retrieves a `PackageObject` from the storage based on the provided + /// `package_id`. It ensures that exactly one package is fetched, + /// returning an invariant violation if the number of fetched packages + /// does not match the expected count. fn fetch_package( context: &ExecutionContext<'_, '_, '_>, package_id: &ObjectID, @@ -722,6 +754,9 @@ mod checked { } } + /// Fetches a list of `PackageObject` instances based on the provided + /// package IDs from the execution context. It collects the package IDs + /// and attempts to retrieve the corresponding packages from the state view. fn fetch_packages<'ctx, 'vm, 'state, 'a>( context: &'ctx ExecutionContext<'vm, 'state, 'a>, package_ids: impl IntoIterator, @@ -755,6 +790,11 @@ mod checked { /// ************************************************************************ /// **** ******************* + /// Executes a Move function within the given module by invoking the Move + /// VM, passing the specified type arguments and serialized arguments. + /// Depending on the `TxContextKind`, the transaction context + /// is appended to the arguments. The function handles mutable updates to + /// the transaction context when objects are created during execution. fn vm_move_call( context: &mut ExecutionContext<'_, '_, '_>, module_id: &ModuleId, @@ -800,6 +840,10 @@ mod checked { Ok(result) } + /// Deserializes a list of binary-encoded Move modules into `CompiledModule` + /// instances using the protocol's binary configuration. The function + /// ensures that the module list is not empty and converts any + /// deserialization errors into an `ExecutionError`. #[allow(clippy::extra_unused_type_parameters)] fn deserialize_modules( context: &mut ExecutionContext<'_, '_, '_>, @@ -823,6 +867,11 @@ mod checked { Ok(modules) } + /// Publishes a set of `CompiledModule` instances to the blockchain under + /// the specified package ID and verifies them using the Iota bytecode + /// verifier. The modules are serialized and published via the VM, + /// and the Iota verifier runs additional checks after the Move bytecode + /// verifier has passed. fn publish_and_verify_modules( context: &mut ExecutionContext<'_, '_, '_>, package_id: ObjectID, @@ -857,6 +906,11 @@ mod checked { Ok(()) } + /// Initializes the provided `CompiledModule` instances by searching for and + /// executing any functions named `INIT_FN_NAME`. For each module + /// containing an initialization function, the function is invoked + /// without arguments, and the result is checked to ensure no return values + /// are present. fn init_modules( context: &mut ExecutionContext<'_, '_, '_>, argument_updates: &mut Mode::ArgumentUpdates, @@ -1126,6 +1180,10 @@ mod checked { .collect() } + /// Verifies that certain private functions in the Iota framework are not + /// directly invoked. This function checks if the module and function + /// being called belong to restricted areas, such as the `iota::event` + /// or `iota::transfer` modules. fn check_private_generics( _context: &mut ExecutionContext, module_id: &ModuleId, diff --git a/iota-execution/v0/iota-adapter/src/programmable_transactions/linkage_view.rs b/iota-execution/v0/iota-adapter/src/programmable_transactions/linkage_view.rs index fe0bcc57d57..40a0270c3fe 100644 --- a/iota-execution/v0/iota-adapter/src/programmable_transactions/linkage_view.rs +++ b/iota-execution/v0/iota-adapter/src/programmable_transactions/linkage_view.rs @@ -58,6 +58,10 @@ pub struct LinkageInfo { pub struct SavedLinkage(LinkageInfo); impl<'state> LinkageView<'state> { + /// Creates a new `LinkageView` instance with the provided `IotaResolver`. + /// This instance is responsible for resolving and linking types across + /// different contexts. It initializes internal caches for type origins + /// and past contexts. pub fn new(resolver: Box) -> Self { Self { resolver, @@ -67,6 +71,7 @@ impl<'state> LinkageView<'state> { } } + /// Reset the `LinkageInfo`. pub fn reset_linkage(&mut self) { self.linkage_info = None; } @@ -151,10 +156,16 @@ impl<'state> LinkageView<'state> { Ok(runtime_id) } + /// Retrieves the original package ID (as an `AccountAddress`) from the + /// linkage information, if available. pub fn original_package_id(&self) -> Option { Some(self.linkage_info.as_ref()?.runtime_id) } + /// Retrieves the cached type origin for the given `ModuleId` and struct + /// identifier (`IdentStr`). This method uses the internal + /// `type_origin_cache` to provide fast lookups for previously resolved + /// types. fn get_cached_type_origin( &self, runtime_id: &ModuleId, @@ -167,6 +178,8 @@ impl<'state> LinkageView<'state> { .cloned() } + /// Adds a type origin to the cache, associating the given `ModuleId` and + /// struct identifier (`Identifier`) with the provided defining `ObjectID`. fn add_type_origin( &self, runtime_id: ModuleId, @@ -197,12 +210,14 @@ impl<'state> LinkageView<'state> { Ok(()) } + /// Retrieves the current link context's storage ID as an `AccountAddress`. pub(crate) fn link_context(&self) -> AccountAddress { self.linkage_info .as_ref() .map_or(AccountAddress::ZERO, |l| l.storage_id) } + /// Relocates a given `ModuleId` based on the current linkage context. pub(crate) fn relocate(&self, module_id: &ModuleId) -> Result { let Some(linkage) = &self.linkage_info else { invariant_violation!("No linkage context set while relocating {module_id}.") @@ -233,6 +248,12 @@ impl<'state> LinkageView<'state> { )) } + /// Determines the defining module for a given struct within a `ModuleId`. + /// The function first checks the cached type origin and returns the + /// corresponding `ModuleId` if found. If not, it relocates the + /// module and queries the type origin table from the associated package. If + /// the defining module is found, it caches the result and returns the + /// `ModuleId`. pub(crate) fn defining_module( &self, runtime_id: &ModuleId, diff --git a/iota-execution/v0/iota-adapter/src/temporary_store.rs b/iota-execution/v0/iota-adapter/src/temporary_store.rs index 1f35ae0fcf2..10f5a7304f5 100644 --- a/iota-execution/v0/iota-adapter/src/temporary_store.rs +++ b/iota-execution/v0/iota-adapter/src/temporary_store.rs @@ -29,7 +29,7 @@ use iota_types::{ object::{Data, Object, Owner}, storage::{ BackingPackageStore, BackingStore, ChildObjectResolver, DenyListResult, PackageObject, - ParentSync, Storage, + Storage, }, transaction::InputObjects, }; @@ -1139,12 +1139,3 @@ impl<'backing> ResourceResolver for TemporaryStore<'backing> { } } } - -impl<'backing> ParentSync for TemporaryStore<'backing> { - fn get_latest_parent_entry_ref_deprecated( - &self, - _object_id: ObjectID, - ) -> IotaResult> { - unreachable!("Never called in newer protocol versions") - } -} diff --git a/iota-execution/v0/iota-verifier/src/lib.rs b/iota-execution/v0/iota-verifier/src/lib.rs index f2140abb868..e01d51b6c07 100644 --- a/iota-execution/v0/iota-verifier/src/lib.rs +++ b/iota-execution/v0/iota-verifier/src/lib.rs @@ -23,7 +23,7 @@ fn verification_failure(error: String) -> ExecutionError { } fn to_verification_timeout_error(error: String) -> ExecutionError { - ExecutionError::new_with_source(ExecutionErrorKind::IotaMoveVerificationTimedout, error) + ExecutionError::new_with_source(ExecutionErrorKind::IotaMoveVerificationTimeout, error) } /// Runs the Move verifier and checks if the error counts as a Move verifier diff --git a/iota-execution/v0/iota-verifier/src/verifier.rs b/iota-execution/v0/iota-verifier/src/verifier.rs index 0644392062a..7303e6a9ef1 100644 --- a/iota-execution/v0/iota-verifier/src/verifier.rs +++ b/iota-execution/v0/iota-verifier/src/verifier.rs @@ -39,7 +39,7 @@ pub fn iota_verify_module_metered_check_timeout_only( if let Err(error) = iota_verify_module_metered(module, fn_info_map, meter) { if matches!( error.kind(), - iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimedout + iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimeout ) { return Err(error); } @@ -57,7 +57,7 @@ pub fn iota_verify_module_unmetered( debug_assert!( !matches!( err.kind(), - iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimedout + iota_types::execution_status::ExecutionFailureStatus::IotaMoveVerificationTimeout ), "Unexpected timeout error in execution" ); diff --git a/sdk/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx b/sdk/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx index 73b348cc3fc..5cf63eb64b7 100644 --- a/sdk/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx +++ b/sdk/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx @@ -164,7 +164,7 @@ describe('useSignAndExecuteTransaction', () => { ]), ); const effectsBcs = bcs.TransactionEffects.serialize({ - V2: { + V1: { status: { Success: true, }, diff --git a/sdk/graphql-transport/src/mappers/transaction-block.ts b/sdk/graphql-transport/src/mappers/transaction-block.ts index 02f82f95c49..f722709dc7e 100644 --- a/sdk/graphql-transport/src/mappers/transaction-block.ts +++ b/sdk/graphql-transport/src/mappers/transaction-block.ts @@ -14,8 +14,10 @@ import type { IotaTransactionBlockResponse, IotaTransactionBlockResponseOptions, } from '@iota/iota-sdk/client'; +import type { IotaObjectRef } from '@iota/iota-sdk/client'; import { normalizeIotaAddress } from '@iota/iota-sdk/utils'; +import type { ObjectOut } from '@iota/iota-sdk/src/bcs/effects.js'; import type { Rpc_Transaction_FieldsFragment } from '../generated/queries.js'; import { toShortTypeString } from './util.js'; @@ -351,250 +353,236 @@ const ADDRESS_ZERO = normalizeIotaAddress('0x0'); export function mapEffects(data: string): IotaTransactionBlockResponse['effects'] { const effects = bcs.TransactionEffects.parse(fromB64(data)); - let effectsV1 = effects.V1; - - if (effects.V2) { - const sharedObjects = effects.V2.unchangedSharedObjects.map(([id, sharedObject]) => { - switch (sharedObject.$kind) { - case 'ReadOnlyRoot': - return { - objectId: id, - version: Number(sharedObject.ReadOnlyRoot[0]) as unknown as string, - digest: sharedObject.ReadOnlyRoot[1], - }; - case 'MutateDeleted': - return { - objectId: id, - version: Number(sharedObject.MutateDeleted) as unknown as string, - digest: OBJECT_DIGEST_DELETED, - }; - case 'ReadDeleted': - return { - objectId: id, - version: Number(sharedObject.ReadDeleted) as unknown as string, - digest: OBJECT_DIGEST_DELETED, - }; - default: - throw new Error(`Unknown shared object type: ${sharedObject}`); - } - }); + type InferedOwner = Exclude<(typeof ObjectOut)['$inferType']['ObjectWrite'], undefined>[1]; - effects.V2.changedObjects - .filter(([_id, change]) => change.inputState.Exist?.[1].Shared) - .forEach(([id, change]) => { - sharedObjects.push({ + const sharedObjects = effects.V1.unchangedSharedObjects.map(([id, sharedObject]) => { + switch (sharedObject.$kind) { + case 'ReadOnlyRoot': + return { objectId: id, - version: Number(change.inputState.Exist![0][0]) as unknown as string, - digest: change.inputState.Exist![0][1], - }); - }); - - const gasObject = - effects.V2.gasObjectIndex != null - ? effects.V2.changedObjects[effects.V2.gasObjectIndex] - : null; - - effectsV1 = { - status: effects.V2.status, - executedEpoch: effects.V2.executedEpoch, - gasUsed: effects.V2.gasUsed, - modifiedAtVersions: effects.V2.changedObjects - .filter(([_id, change]) => change.inputState.Exist) - .map(([id, change]) => [id, change.inputState.Exist![0][0]] as const), - sharedObjects, - transactionDigest: effects.V2.transactionDigest, - created: effects.V2.changedObjects - .filter( - ([_id, change]) => - change.inputState.NotExist && - (change.outputState.ObjectWrite || change.outputState.PackageWrite) && - change.idOperation.Created, - ) - .map(([objectId, change]) => - change.outputState.PackageWrite - ? ([ - { - objectId, - version: Number( - change.outputState.PackageWrite[0], - ) as unknown as string, - digest: change.outputState.PackageWrite[1], - }, - { $kind: 'Immutable', Immutable: true }, - ] as const) - : ([ - { - objectId, - version: Number(effects.V2.lamportVersion) as unknown as string, - digest: change.outputState.ObjectWrite![0], - }, - change.outputState.ObjectWrite![1], - ] as const), - ), - mutated: effects.V2.changedObjects - .filter( - ([_id, change]) => - change.inputState.Exist && - (change.outputState.ObjectWrite || change.outputState.PackageWrite), - ) - .map(([objectId, change]) => [ - change.outputState.PackageWrite - ? { - objectId, - version: Number( - change.outputState.PackageWrite[0], - ) as unknown as string, - digest: change.outputState.PackageWrite[1], - } - : { - objectId, - version: Number(effects.V2.lamportVersion) as unknown as string, - digest: change.outputState.ObjectWrite![0], - }, - change.outputState.ObjectWrite - ? change.outputState.ObjectWrite[1] - : { $kind: 'Immutable', Immutable: true }, - ]), - unwrapped: effects.V2.changedObjects - .filter( - ([_id, change]) => - change.inputState.NotExist && - change.outputState.ObjectWrite && - change.idOperation.None, - ) - .map(([objectId, change]) => [ - { - objectId, - version: Number(effects.V2.lamportVersion) as unknown as string, - digest: change.outputState.ObjectWrite![0], - }, - change.outputState.ObjectWrite![1], - ]), - deleted: effects.V2.changedObjects - .filter( - ([_id, change]) => - change.inputState.Exist && - change.outputState.NotExist && - change.idOperation.Deleted, - ) - .map(([objectId, _change]) => ({ - objectId, - version: Number(effects.V2.lamportVersion) as unknown as string, + version: Number(sharedObject.ReadOnlyRoot[0]) as unknown as string, + digest: sharedObject.ReadOnlyRoot[1], + }; + case 'MutateDeleted': + return { + objectId: id, + version: Number(sharedObject.MutateDeleted) as unknown as string, digest: OBJECT_DIGEST_DELETED, - })), - unwrappedThenDeleted: effects.V2.changedObjects - .filter( - ([_id, change]) => - change.inputState.NotExist && - change.outputState.NotExist && - change.idOperation.Deleted, - ) - .map(([objectId, _change]) => ({ - objectId, - version: Number(effects.V2.lamportVersion) as unknown as string, + }; + case 'ReadDeleted': + return { + objectId: id, + version: Number(sharedObject.ReadDeleted) as unknown as string, digest: OBJECT_DIGEST_DELETED, - })), - wrapped: effects.V2.changedObjects - .filter( - ([_id, change]) => - change.inputState.Exist && - change.outputState.NotExist && - change.idOperation.None, - ) - .map(([objectId, _change]) => ({ - objectId, - version: Number(effects.V2.lamportVersion) as unknown as string, - digest: OBJECT_DIGEST_WRAPPED, - })), - gasObject: gasObject - ? [ - { - objectId: gasObject[0], - digest: gasObject[1].outputState.ObjectWrite![0], - version: Number(effects.V2.lamportVersion) as unknown as string, - }, - gasObject[1].outputState.ObjectWrite![1], - ] - : [ + }; + default: + throw new Error(`Unknown shared object type: ${sharedObject}`); + } + }); + + effects.V1.changedObjects + .filter(([_id, change]) => change.inputState.Exist?.[1].Shared) + .forEach(([id, change]) => { + sharedObjects.push({ + objectId: id, + version: Number(change.inputState.Exist![0][0]) as unknown as string, + digest: change.inputState.Exist![0][1], + }); + }); + + const modifiedAtVersions = effects.V1.changedObjects + .filter(([_id, change]) => change.inputState.Exist) + .map(([id, change]) => [id, change.inputState.Exist![0][0]] as const); + + const created = effects.V1.changedObjects + .filter( + ([_id, change]) => + change.inputState.NotExist && + (change.outputState.ObjectWrite || change.outputState.PackageWrite) && + change.idOperation.Created, + ) + .map(([objectId, change]) => + change.outputState.PackageWrite + ? ([ { - objectId: ADDRESS_ZERO, - version: '0', - digest: OBJECT_DIGEST_ZERO, + objectId, + version: Number(change.outputState.PackageWrite[0]) as unknown as string, + digest: change.outputState.PackageWrite[1], }, + { $kind: 'Immutable', Immutable: true }, + ] as const) + : ([ { - $kind: 'AddressOwner', - AddressOwner: ADDRESS_ZERO, + objectId, + version: Number(effects.V1.lamportVersion) as unknown as string, + digest: change.outputState.ObjectWrite![0], }, - ], - eventsDigest: effects.V2.eventsDigest, - dependencies: effects.V2.dependencies, - }; - } + change.outputState.ObjectWrite![1], + ] as const), + ); - if (!effectsV1) { - throw new Error('Invalid effects'); - } + const mutated: Array<[IotaObjectRef, InferedOwner]> = effects.V1.changedObjects + .filter( + ([_id, change]) => + change.inputState.Exist && + (change.outputState.ObjectWrite || change.outputState.PackageWrite), + ) + .map(([objectId, change]) => [ + change.outputState.PackageWrite + ? { + objectId, + version: Number(change.outputState.PackageWrite[0]) as unknown as string, + digest: change.outputState.PackageWrite[1], + } + : { + objectId, + version: Number(effects.V1.lamportVersion) as unknown as string, + digest: change.outputState.ObjectWrite![0], + }, + change.outputState.ObjectWrite + ? change.outputState.ObjectWrite[1] + : { $kind: 'Immutable', Immutable: true }, + ]); + + const unwrapped: Array<[IotaObjectRef, InferedOwner]> = effects.V1.changedObjects + .filter( + ([_id, change]) => + change.inputState.NotExist && + change.outputState.ObjectWrite && + change.idOperation.None, + ) + .map(([objectId, change]) => [ + { + objectId, + version: Number(effects.V1.lamportVersion) as unknown as string, + digest: change.outputState.ObjectWrite![0], + }, + change.outputState.ObjectWrite![1], + ]); + + const deleted = effects.V1.changedObjects + .filter( + ([_id, change]) => + change.inputState.Exist && + change.outputState.NotExist && + change.idOperation.Deleted, + ) + .map(([objectId, _change]) => ({ + objectId, + version: Number(effects.V1.lamportVersion) as unknown as string, + digest: OBJECT_DIGEST_DELETED, + })); + + const unwrappedThenDeleted = effects.V1.changedObjects + .filter( + ([_id, change]) => + change.inputState.NotExist && + change.outputState.NotExist && + change.idOperation.Deleted, + ) + .map(([objectId, _change]) => ({ + objectId, + version: Number(effects.V1.lamportVersion) as unknown as string, + digest: OBJECT_DIGEST_DELETED, + })); + + const wrapped = effects.V1.changedObjects + .filter( + ([_id, change]) => + change.inputState.Exist && change.outputState.NotExist && change.idOperation.None, + ) + .map(([objectId, _change]) => ({ + objectId, + version: Number(effects.V1.lamportVersion) as unknown as string, + digest: OBJECT_DIGEST_WRAPPED, + })); + + const gasObjectFromV1 = + effects.V1.gasObjectIndex != null + ? effects.V1.changedObjects[effects.V1.gasObjectIndex] + : null; + + const gasObject: [IotaObjectRef, InferedOwner] = gasObjectFromV1 + ? [ + { + objectId: gasObjectFromV1[0], + digest: gasObjectFromV1[1].outputState.ObjectWrite![0], + version: Number(effects.V1.lamportVersion) as unknown as string, + }, + gasObjectFromV1[1].outputState.ObjectWrite![1], + ] + : [ + { + objectId: ADDRESS_ZERO, + version: '0', + digest: OBJECT_DIGEST_ZERO, + }, + { + $kind: 'AddressOwner', + AddressOwner: ADDRESS_ZERO, + }, + ]; return { messageVersion: 'v1', - status: effectsV1.status.Success + status: effects.V1.status.Success ? { status: 'success', } : { status: 'failure', // TODO: we don't have the error message from bcs effects - error: effectsV1.status.$kind, + error: effects.V1.status.$kind, }, - executedEpoch: effectsV1.executedEpoch, - gasUsed: effectsV1.gasUsed, - modifiedAtVersions: effectsV1.modifiedAtVersions.map(([objectId, sequenceNumber]) => ({ + executedEpoch: effects.V1.executedEpoch, + gasUsed: effects.V1.gasUsed, + modifiedAtVersions: modifiedAtVersions.map(([objectId, sequenceNumber]) => ({ objectId, sequenceNumber, })), - ...(effectsV1.sharedObjects.length === 0 ? {} : { sharedObjects: effectsV1.sharedObjects }), - transactionDigest: effectsV1.transactionDigest, - ...(effectsV1.created.length === 0 + ...(sharedObjects.length === 0 ? {} : { sharedObjects }), + transactionDigest: effects.V1.transactionDigest, + ...(created.length === 0 ? {} : { - created: effectsV1.created.map(([reference, owner]) => ({ + created: created.map(([reference, owner]) => ({ reference, owner: mapEffectsOwner(owner), })), }), - ...(effectsV1.mutated.length === 0 + ...(mutated.length === 0 ? {} : { - mutated: effectsV1.mutated.map(([reference, owner]) => ({ + mutated: mutated.map(([reference, owner]) => ({ reference, - owner: mapEffectsOwner(owner), + owner: mapEffectsOwner(owner as InferedOwner), })), }), - ...(effectsV1.unwrapped.length === 0 + ...(unwrapped.length === 0 ? {} : { unwrapped: - effectsV1.unwrapped.length === 0 + unwrapped.length === 0 ? undefined - : effectsV1.unwrapped.map(([reference, owner]) => ({ + : unwrapped.map(([reference, owner]) => ({ reference, - owner: mapEffectsOwner(owner), + owner: mapEffectsOwner(owner as InferedOwner), })), }), - ...(effectsV1.deleted.length === 0 ? {} : { deleted: effectsV1.deleted }), - ...(effectsV1.unwrappedThenDeleted.length === 0 + ...(deleted.length === 0 ? {} : { deleted: deleted }), + ...(unwrappedThenDeleted.length === 0 ? {} - : { unwrappedThenDeleted: effectsV1.unwrappedThenDeleted }), - ...(effectsV1.wrapped.length === 0 ? {} : { wrapped: effectsV1.wrapped }), + : { unwrappedThenDeleted: unwrappedThenDeleted }), + ...(wrapped.length === 0 ? {} : { wrapped: wrapped }), gasObject: { - reference: effectsV1.gasObject[0], - owner: mapEffectsOwner(effectsV1.gasObject[1]), + reference: gasObject[0], + owner: mapEffectsOwner(gasObject[1]), }, - ...(effectsV1.eventsDigest ? { eventsDigest: effectsV1.eventsDigest } : {}), - dependencies: effectsV1.dependencies, + ...(effects.V1.eventsDigest ? { eventsDigest: effects.V1.eventsDigest } : {}), + dependencies: effects.V1.dependencies, }; - function mapEffectsOwner(owner: NonNullable['gasObject'][1]) { + function mapEffectsOwner(owner: NonNullable) { if (owner.Immutable) { return 'Immutable'; } else if (owner.Shared) { diff --git a/sdk/move-bytecode-template/Cargo.toml b/sdk/move-bytecode-template/Cargo.toml index 5728535a27f..c9d71c3886e 100644 --- a/sdk/move-bytecode-template/Cargo.toml +++ b/sdk/move-bytecode-template/Cargo.toml @@ -5,7 +5,6 @@ authors = ["IOTA Foundation "] edition = "2021" license = "Apache-2.0" publish = false -repository = "https://github.com/iotaledger/iota.git" description = "WASM variant of the move-binary-format which allows bytecode templates" [dependencies] diff --git a/sdk/typescript/src/bcs/effects.ts b/sdk/typescript/src/bcs/effects.ts index 08cc8d8fe06..bb9f23c37c0 100644 --- a/sdk/typescript/src/bcs/effects.ts +++ b/sdk/typescript/src/bcs/effects.ts @@ -4,7 +4,7 @@ import { bcs } from '@iota/bcs'; -import { Address, ObjectDigest, IotaObjectRef } from './bcs.js'; +import { Address, ObjectDigest } from './bcs.js'; const PackageUpgradeError = bcs.enum('PackageUpgradeError', { UnableToFetchPackage: bcs.struct('UnableToFetchPackage', { packageId: Address }), @@ -132,24 +132,6 @@ const Owner = bcs.enum('Owner', { Immutable: null, }); -const TransactionEffectsV1 = bcs.struct('TransactionEffectsV1', { - status: ExecutionStatus, - executedEpoch: bcs.u64(), - gasUsed: GasCostSummary, - modifiedAtVersions: bcs.vector(bcs.tuple([Address, bcs.u64()])), - sharedObjects: bcs.vector(IotaObjectRef), - transactionDigest: ObjectDigest, - created: bcs.vector(bcs.tuple([IotaObjectRef, Owner])), - mutated: bcs.vector(bcs.tuple([IotaObjectRef, Owner])), - unwrapped: bcs.vector(bcs.tuple([IotaObjectRef, Owner])), - deleted: bcs.vector(IotaObjectRef), - unwrappedThenDeleted: bcs.vector(IotaObjectRef), - wrapped: bcs.vector(IotaObjectRef), - gasObject: bcs.tuple([IotaObjectRef, Owner]), - eventsDigest: bcs.option(ObjectDigest), - dependencies: bcs.vector(ObjectDigest), -}); - const VersionDigest = bcs.tuple([bcs.u64(), ObjectDigest]); const ObjectIn = bcs.enum('ObjectIn', { @@ -157,7 +139,7 @@ const ObjectIn = bcs.enum('ObjectIn', { Exist: bcs.tuple([VersionDigest, Owner]), }); -const ObjectOut = bcs.enum('ObjectOut', { +export const ObjectOut = bcs.enum('ObjectOut', { NotExist: null, ObjectWrite: bcs.tuple([ObjectDigest, Owner]), PackageWrite: VersionDigest, @@ -183,7 +165,7 @@ const UnchangedSharedKind = bcs.enum('UnchangedSharedKind', { PerEpochConfig: null, }); -const TransactionEffectsV2 = bcs.struct('TransactionEffectsV2', { +const TransactionEffectsV1 = bcs.struct('TransactionEffectsV1', { status: ExecutionStatus, executedEpoch: bcs.u64(), gasUsed: GasCostSummary, @@ -199,5 +181,4 @@ const TransactionEffectsV2 = bcs.struct('TransactionEffectsV2', { export const TransactionEffects = bcs.enum('TransactionEffects', { V1: TransactionEffectsV1, - V2: TransactionEffectsV2, }); diff --git a/sdk/typescript/src/transactions/ObjectCache.ts b/sdk/typescript/src/transactions/ObjectCache.ts index 6ce896a5d82..f33455d6304 100644 --- a/sdk/typescript/src/transactions/ObjectCache.ts +++ b/sdk/typescript/src/transactions/ObjectCache.ts @@ -267,11 +267,11 @@ export class ObjectCache { } async applyEffects(effects: typeof bcs.TransactionEffects.$inferType) { - if (!effects.V2) { + if (!effects.V1) { throw new Error(`Unsupported transaction effects version ${effects.$kind}`); } - const { lamportVersion, changedObjects } = effects.V2; + const { lamportVersion, changedObjects } = effects.V1; const deletedIds: string[] = []; const addedObjects: ObjectCacheEntry[] = []; diff --git a/sdk/typescript/src/transactions/executor/caching.ts b/sdk/typescript/src/transactions/executor/caching.ts index 6db0f214b1e..a57c342eabe 100644 --- a/sdk/typescript/src/transactions/executor/caching.ts +++ b/sdk/typescript/src/transactions/executor/caching.ts @@ -99,7 +99,7 @@ export class CachingTransactionExecutor { } async applyEffects(effects: typeof bcs.TransactionEffects.$inferType) { - this.#lastDigest = effects.V2?.transactionDigest ?? null; + this.#lastDigest = effects.V1?.transactionDigest ?? null; await this.cache.applyEffects(effects); } diff --git a/sdk/typescript/src/transactions/executor/parallel.ts b/sdk/typescript/src/transactions/executor/parallel.ts index 1d1e797f48f..36cf8455056 100644 --- a/sdk/typescript/src/transactions/executor/parallel.ts +++ b/sdk/typescript/src/transactions/executor/parallel.ts @@ -228,7 +228,7 @@ export class ParallelTransactionExecutor { const effects = bcs.TransactionEffects.parse(effectsBytes); const gasResult = getGasCoinFromEffects(effects); - const gasUsed = effects.V2?.gasUsed; + const gasUsed = effects.V1?.gasUsed; if (gasCoin && gasUsed && gasResult.owner === this.#signer.toIotaAddress()) { const totalUsed = @@ -428,14 +428,14 @@ export class ParallelTransactionExecutor { }); const effects = bcs.TransactionEffects.parse(Uint8Array.from(result.rawEffects!)); - effects.V2?.changedObjects.forEach(([id, { outputState }], i) => { - if (i === effects.V2?.gasObjectIndex || !outputState.ObjectWrite) { + effects.V1?.changedObjects.forEach(([id, { outputState }], i) => { + if (i === effects.V1?.gasObjectIndex || !outputState.ObjectWrite) { return; } this.#coinPool.push({ id, - version: effects.V2!.lamportVersion, + version: effects.V1!.lamportVersion, digest: outputState.ObjectWrite[0], balance: BigInt(this.#initialCoinBalance), }); diff --git a/sdk/typescript/src/transactions/executor/serial.ts b/sdk/typescript/src/transactions/executor/serial.ts index 8c0d92fef79..c11e6878b4c 100644 --- a/sdk/typescript/src/transactions/executor/serial.ts +++ b/sdk/typescript/src/transactions/executor/serial.ts @@ -41,7 +41,7 @@ export class SerialTransactionExecutor { } #cacheGasCoin = async (effects: typeof bcs.TransactionEffects.$inferType) => { - if (!effects.V2) { + if (!effects.V1) { return; } @@ -117,11 +117,11 @@ export class SerialTransactionExecutor { } export function getGasCoinFromEffects(effects: typeof bcs.TransactionEffects.$inferType) { - if (!effects.V2) { + if (!effects.V1) { throw new Error('Unexpected effects version'); } - const gasObjectChange = effects.V2.changedObjects[effects.V2.gasObjectIndex!]; + const gasObjectChange = effects.V1.changedObjects[effects.V1.gasObjectIndex!]; if (!gasObjectChange) { throw new Error('Gas object not found in effects'); @@ -139,7 +139,7 @@ export function getGasCoinFromEffects(effects: typeof bcs.TransactionEffects.$in ref: { objectId, digest, - version: effects.V2.lamportVersion, + version: effects.V1.lamportVersion, }, owner: owner.AddressOwner || owner.ObjectOwner!, }; diff --git a/sdk/typescript/test/e2e/parallel-executor.test.ts b/sdk/typescript/test/e2e/parallel-executor.test.ts index 391f1819633..35cd2b08626 100644 --- a/sdk/typescript/test/e2e/parallel-executor.test.ts +++ b/sdk/typescript/test/e2e/parallel-executor.test.ts @@ -146,9 +146,9 @@ describe('ParallelTransactionExecutor', { retry: 3 }, () => { const result = await executor.executeTransaction(txb); const effects = bcs.TransactionEffects.fromBase64(result.effects); - const newCoinId = effects.V2?.changedObjects.find( + const newCoinId = effects.V1?.changedObjects.find( ([_id, { outputState }], index) => - index !== effects.V2.gasObjectIndex && outputState.ObjectWrite, + index !== effects.V1.gasObjectIndex && outputState.ObjectWrite, )?.[0]!; return newCoinId; diff --git a/sdk/typescript/test/e2e/serial-executor.test.ts b/sdk/typescript/test/e2e/serial-executor.test.ts index 89c48bd8cdf..ab2ba8b74df 100644 --- a/sdk/typescript/test/e2e/serial-executor.test.ts +++ b/sdk/typescript/test/e2e/serial-executor.test.ts @@ -46,9 +46,9 @@ describe('SerialExecutor', { retry: 3 }, () => { const effects = bcs.TransactionEffects.fromBase64(result.effects); - const newCoinId = effects.V2?.changedObjects.find( + const newCoinId = effects.V1?.changedObjects.find( ([_id, { outputState }], index) => - index !== effects.V2.gasObjectIndex && outputState.ObjectWrite, + index !== effects.V1.gasObjectIndex && outputState.ObjectWrite, )?.[0]!; expect(toolbox.client.getCoins).toHaveBeenCalledTimes(1); @@ -82,9 +82,9 @@ describe('SerialExecutor', { retry: 3 }, () => { await toolbox.client.waitForTransaction({ digest: result.digest }); - const newCoinId = effects.V2?.changedObjects.find( + const newCoinId = effects.V1?.changedObjects.find( ([_id, { outputState }], index) => - index !== effects.V2.gasObjectIndex && outputState.ObjectWrite, + index !== effects.V1.gasObjectIndex && outputState.ObjectWrite, )?.[0]!; expect(toolbox.client.getCoins).toHaveBeenCalledTimes(1); @@ -106,6 +106,6 @@ describe('SerialExecutor', { retry: 3 }, () => { const result2 = await executor.executeTransaction(txb3); expect(result2.digest).not.toEqual(result.digest); - expect(bcs.TransactionEffects.fromBase64(result2.effects).V2?.status.Success).toEqual(true); + expect(bcs.TransactionEffects.fromBase64(result2.effects).V1?.status.Success).toEqual(true); }); });