diff --git a/Cargo.lock b/Cargo.lock index f8b4fb490b7..23c6501824d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2091,9 +2091,9 @@ dependencies = [ [[package]] name = "bnum" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e31ea183f6ee62ac8b8a8cf7feddd766317adfb13ff469de57ce033efd6a790" +checksum = "f781dba93de3a5ef6dc5b17c9958b208f6f3f021623b360fb605ea51ce443f10" [[package]] name = "brotli" @@ -7706,7 +7706,7 @@ dependencies = [ "fastcrypto", "iota-network-stack", "iota-protocol-config", - "iota-rust-sdk", + "iota-sdk-types", "iota-types", "itertools 0.13.0", "mime", @@ -7792,26 +7792,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iota-rust-sdk" -version = "0.0.0" -source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=2ba6b293bdede769a1d9b4d1aecaede2ff7682dd#2ba6b293bdede769a1d9b4d1aecaede2ff7682dd" -dependencies = [ - "base64ct", - "bcs", - "blake2", - "bnum", - "bs58 0.5.1", - "hex", - "roaring", - "schemars", - "serde", - "serde_derive", - "serde_json", - "serde_with", - "winnow 0.6.20", -] - [[package]] name = "iota-sdk" version = "0.10.0-alpha" @@ -7890,6 +7870,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "iota-sdk-types" +version = "0.0.2" +source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=b3b33187aaad4d5b70f511627832c2efd525ced7#b3b33187aaad4d5b70f511627832c2efd525ced7" +dependencies = [ + "base64ct", + "bcs", + "blake2", + "bnum", + "bs58 0.5.1", + "hex", + "roaring", + "schemars", + "serde", + "serde_derive", + "serde_json", + "serde_with", + "winnow 0.6.20", +] + [[package]] name = "iota-simulator" version = "0.10.0-alpha" @@ -8370,8 +8370,8 @@ dependencies = [ "iota-metrics", "iota-network-stack", "iota-protocol-config", - "iota-rust-sdk", "iota-sdk 1.1.5", + "iota-sdk-types", "iota-util-mem", "itertools 0.13.0", "lru", diff --git a/Cargo.toml b/Cargo.toml index 5b2efddbe69..91bc6929df8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -271,6 +271,8 @@ indexmap = { version = "2.1.0", features = ["serde"] } indicatif = "0.17.2" insta = { version = "1.21.1", features = ["redactions", "yaml", "json"] } integer-encoding = "3.0.1" +# core-types with json format for REST API +iota-sdk2 = { package = "iota-sdk-types", git = "https://github.com/iotaledger/iota-rust-sdk.git", rev = "b3b33187aaad4d5b70f511627832c2efd525ced7", features = ["hash", "serde", "schemars"] } itertools = "0.13.0" json_to_table = { git = "https://github.com/zhiburt/tabled/", rev = "e449317a1c02eb6b29e409ad6617e5d9eb7b3bd4" } jsonrpsee = { version = "0.24", features = ["server", "macros", "client", "ws-client", "http-client"] } @@ -304,7 +306,7 @@ rand = "0.8.5" rayon = "1.5.3" regex = "1.7.1" reqwest = { version = "0.12", default-features = false, features = ["http2", "json", "rustls-tls"] } -roaring = "0.10.6" +roaring = "0.10.10" rocksdb = { version = "0.21.0", default-features = false, features = ["snappy", "lz4", "zstd", "zlib", "multi-threaded-cf"] } rstest = "0.16.0" rustls = { version = "0.23.18", default-features = false, features = ["std", "tls12", "ring"] } @@ -413,8 +415,6 @@ iota-rest-api = { path = "crates/iota-rest-api" } 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 = "https://github.com/iotaledger/iota-rust-sdk.git", rev = "2ba6b293bdede769a1d9b4d1aecaede2ff7682dd", 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-core/src/checkpoints/mod.rs b/crates/iota-core/src/checkpoints/mod.rs index 532c5b1e002..f3e22e3da05 100644 --- a/crates/iota-core/src/checkpoints/mod.rs +++ b/crates/iota-core/src/checkpoints/mod.rs @@ -1360,7 +1360,7 @@ impl CheckpointBuilder { TransactionKind::ConsensusCommitPrologueV1(_) | TransactionKind::AuthenticatorStateUpdateV1(_) => { // ConsensusCommitPrologue and - // AuthenticatorStateUpdateV1 + // AuthenticatorStateUpdate // are guaranteed to be // processed before we reach here. } diff --git a/crates/iota-graphql-rpc/schema.graphql b/crates/iota-graphql-rpc/schema.graphql index 7d8a9c0d020..b4a37474107 100644 --- a/crates/iota-graphql-rpc/schema.graphql +++ b/crates/iota-graphql-rpc/schema.graphql @@ -191,7 +191,7 @@ type AuthenticatorStateExpireTransaction { """ minEpoch: Epoch """ - The initial version that the AuthenticatorStateUpdateV1 was shared at. + The initial version that the AuthenticatorStateUpdate was shared at. """ authenticatorObjInitialSharedVersion: UInt53! } diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/end_of_epoch.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/end_of_epoch.rs index 45df35c47bd..0ac44a456a8 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/end_of_epoch.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/end_of_epoch.rs @@ -235,7 +235,7 @@ impl AuthenticatorStateExpireTransaction { .extend() } - /// The initial version that the AuthenticatorStateUpdateV1 was shared at. + /// The initial version that the AuthenticatorStateUpdate was shared at. async fn authenticator_obj_initial_shared_version(&self) -> UInt53 { self.native .authenticator_obj_initial_shared_version diff --git a/crates/iota-graphql-rpc/tests/snapshots/snapshot_tests__schema_sdl_export.snap b/crates/iota-graphql-rpc/tests/snapshots/snapshot_tests__schema_sdl_export.snap index 29b51e42d4c..bae844a3b8a 100644 --- a/crates/iota-graphql-rpc/tests/snapshots/snapshot_tests__schema_sdl_export.snap +++ b/crates/iota-graphql-rpc/tests/snapshots/snapshot_tests__schema_sdl_export.snap @@ -195,7 +195,7 @@ type AuthenticatorStateExpireTransaction { """ minEpoch: Epoch """ - The initial version that the AuthenticatorStateUpdateV1 was shared at. + The initial version that the AuthenticatorStateUpdate was shared at. """ authenticatorObjInitialSharedVersion: UInt53! } diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index 7213f28e1f5..65efd085b8c 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -2865,7 +2865,7 @@ "type": "string", "pattern": "(?:[a-zA-Z][a-zA-Z0-9_]{0,127})|(?:_[a-zA-Z0-9_]{0,127})" }, - "InputArgument": { + "Input": { "oneOf": [ { "type": "object", @@ -4382,7 +4382,7 @@ "description": "Input objects or primitive values", "type": "array", "items": { - "$ref": "#/components/schemas/InputArgument" + "$ref": "#/components/schemas/Input" } }, "kind": { @@ -4908,7 +4908,7 @@ ] }, "signatures": { - "description": "The plain signature encoded with signature scheme.", + "description": "The plain signature encoded with signature scheme.\n\nThe signatures must be in the same order as they are listed in the committee.", "type": "array", "items": { "$ref": "#/components/schemas/MultisigMemberSignature" diff --git a/crates/iota-rest-api/src/accounts.rs b/crates/iota-rest-api/src/accounts.rs index d2e1aa920ee..81f93153d8c 100644 --- a/crates/iota-rest-api/src/accounts.rs +++ b/crates/iota-rest-api/src/accounts.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 use axum::extract::{Path, Query, State}; -use iota_sdk2::types::{Address, ObjectId, StructTag, Version}; +use iota_sdk2::{Address, ObjectId, StructTag, Version}; use iota_types::iota_sdk2_conversions::struct_tag_core_to_sdk; use openapiv3::v3_1::Operation; use tap::Pipe; diff --git a/crates/iota-rest-api/src/checkpoints.rs b/crates/iota-rest-api/src/checkpoints.rs index 720393dc677..7a9a6fb8d26 100644 --- a/crates/iota-rest-api/src/checkpoints.rs +++ b/crates/iota-rest-api/src/checkpoints.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 use axum::extract::{Path, Query, State}; -use iota_sdk2::types::{ +use iota_sdk2::{ CheckpointData, CheckpointDigest, CheckpointSequenceNumber, SignedCheckpointSummary, }; use iota_types::storage::ReadStore; diff --git a/crates/iota-rest-api/src/client/sdk.rs b/crates/iota-rest-api/src/client/sdk.rs index ae07648445b..7007aead1fd 100644 --- a/crates/iota-rest-api/src/client/sdk.rs +++ b/crates/iota-rest-api/src/client/sdk.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_sdk2::types::{ +use iota_sdk2::{ Address, CheckpointData, CheckpointDigest, CheckpointSequenceNumber, EpochId, Object, ObjectId, SignedCheckpointSummary, SignedTransaction, StructTag, TransactionDigest, ValidatorCommittee, Version, diff --git a/crates/iota-rest-api/src/coins.rs b/crates/iota-rest-api/src/coins.rs index 2b684e4ca1f..7ca54a80d37 100644 --- a/crates/iota-rest-api/src/coins.rs +++ b/crates/iota-rest-api/src/coins.rs @@ -6,7 +6,7 @@ use axum::{ Json, extract::{Path, State}, }; -use iota_sdk2::types::{ObjectId, StructTag}; +use iota_sdk2::{ObjectId, StructTag}; use iota_types::iota_sdk2_conversions::struct_tag_sdk_to_core; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/iota-rest-api/src/committee.rs b/crates/iota-rest-api/src/committee.rs index 3a4e6a0c23c..6f268e756b9 100644 --- a/crates/iota-rest-api/src/committee.rs +++ b/crates/iota-rest-api/src/committee.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 use axum::extract::{Path, State}; -use iota_sdk2::types::{EpochId, ValidatorCommittee}; +use iota_sdk2::{EpochId, ValidatorCommittee}; use iota_types::storage::ReadStore; use tap::Pipe; diff --git a/crates/iota-rest-api/src/info.rs b/crates/iota-rest-api/src/info.rs index 2823abe3f6d..2d82e033298 100644 --- a/crates/iota-rest-api/src/info.rs +++ b/crates/iota-rest-api/src/info.rs @@ -5,7 +5,7 @@ use std::borrow::Cow; use axum::{Json, extract::State}; -use iota_sdk2::types::CheckpointDigest; +use iota_sdk2::CheckpointDigest; use tap::Pipe; use crate::{ diff --git a/crates/iota-rest-api/src/objects.rs b/crates/iota-rest-api/src/objects.rs index bb820c63e44..828494d6b94 100644 --- a/crates/iota-rest-api/src/objects.rs +++ b/crates/iota-rest-api/src/objects.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 use axum::extract::{Path, Query, State}; -use iota_sdk2::types::{Object, ObjectId, TypeTag, Version}; +use iota_sdk2::{Object, ObjectId, TypeTag, Version}; use iota_types::{ iota_sdk2_conversions::{SdkTypeConversionError, type_tag_core_to_sdk}, storage::{DynamicFieldIndexInfo, DynamicFieldKey}, diff --git a/crates/iota-rest-api/src/reader.rs b/crates/iota-rest-api/src/reader.rs index d7c1966c800..1c941f328b0 100644 --- a/crates/iota-rest-api/src/reader.rs +++ b/crates/iota-rest-api/src/reader.rs @@ -4,7 +4,7 @@ use std::sync::Arc; -use iota_sdk2::types::{ +use iota_sdk2::{ CheckpointSequenceNumber, EpochId, Object, ObjectId, SignedTransaction, ValidatorCommittee, Version, }; @@ -66,11 +66,11 @@ impl StateReader { pub fn get_transaction( &self, - digest: iota_sdk2::types::TransactionDigest, + digest: iota_sdk2::TransactionDigest, ) -> crate::Result<( - iota_sdk2::types::SignedTransaction, - iota_sdk2::types::TransactionEffects, - Option, + iota_sdk2::SignedTransaction, + iota_sdk2::TransactionEffects, + Option, )> { use iota_types::effects::TransactionEffectsAPI; @@ -106,7 +106,7 @@ impl StateReader { pub fn get_transaction_response( &self, - digest: iota_sdk2::types::TransactionDigest, + digest: iota_sdk2::TransactionDigest, ) -> crate::Result { let ( SignedTransaction { diff --git a/crates/iota-rest-api/src/system.rs b/crates/iota-rest-api/src/system.rs index bc667dcc51e..322392b41f0 100644 --- a/crates/iota-rest-api/src/system.rs +++ b/crates/iota-rest-api/src/system.rs @@ -9,7 +9,7 @@ use axum::{ extract::{Path, State}, }; use iota_protocol_config::{ProtocolConfig, ProtocolConfigValue, ProtocolVersion}; -use iota_sdk2::types::{Address, ObjectId}; +use iota_sdk2::{Address, ObjectId}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -237,9 +237,9 @@ pub struct SystemStateSummary { pub struct ValidatorSummary { // Metadata pub address: Address, - pub authority_public_key: iota_sdk2::types::Bls12381PublicKey, - pub network_public_key: iota_sdk2::types::Ed25519PublicKey, - pub protocol_public_key: iota_sdk2::types::Ed25519PublicKey, + pub authority_public_key: iota_sdk2::Bls12381PublicKey, + pub network_public_key: iota_sdk2::Ed25519PublicKey, + pub protocol_public_key: iota_sdk2::Ed25519PublicKey, #[serde_as(as = "fastcrypto::encoding::Base64")] #[schemars(with = "String")] pub proof_of_possession_bytes: Vec, @@ -250,9 +250,9 @@ pub struct ValidatorSummary { pub net_address: String, pub p2p_address: String, pub primary_address: String, - pub next_epoch_authority_public_key: Option, - pub next_epoch_network_public_key: Option, - pub next_epoch_protocol_public_key: Option, + pub next_epoch_authority_public_key: Option, + pub next_epoch_network_public_key: Option, + pub next_epoch_protocol_public_key: Option, #[serde_as(as = "Option")] #[schemars(with = "Option")] pub next_epoch_proof_of_possession: Option>, @@ -374,18 +374,12 @@ impl From::new(), |mut acc, (address, coin)| { - *acc.entry((address, coin.coin_type())).or_default() -= coin.balance() as i128; + *acc.entry((address, coin.coin_type().clone())).or_default() -= coin.balance() as i128; acc }, ); // 2. add all mutated coins let balances = coins(output_objects).fold(balances, |mut acc, (address, coin)| { - *acc.entry((address, coin.coin_type())).or_default() += coin.balance() as i128; + *acc.entry((address, coin.coin_type().clone())).or_default() += coin.balance() as i128; acc }); @@ -350,7 +350,7 @@ fn derive_balance_changes( Some(BalanceChange { address: *address, - coin_type: coin_type.to_owned(), + coin_type, amount, }) }) diff --git a/crates/iota-rest-api/src/transactions/mod.rs b/crates/iota-rest-api/src/transactions/mod.rs index 0ba16b2075a..de7d8e7d8d9 100644 --- a/crates/iota-rest-api/src/transactions/mod.rs +++ b/crates/iota-rest-api/src/transactions/mod.rs @@ -12,7 +12,7 @@ pub use execution::{ EffectsFinality, ExecuteTransaction, ExecuteTransactionQueryParameters, TransactionExecutionResponse, }; -use iota_sdk2::types::{ +use iota_sdk2::{ CheckpointSequenceNumber, Transaction, TransactionDigest, TransactionEffects, TransactionEvents, UserSignature, }; diff --git a/crates/iota-rosetta/src/types.rs b/crates/iota-rosetta/src/types.rs index 0962a2fb7a0..7ee51c0a726 100644 --- a/crates/iota-rosetta/src/types.rs +++ b/crates/iota-rosetta/src/types.rs @@ -414,7 +414,7 @@ pub enum OperationType { // All other IOTA transaction types, readonly EpochChange, Genesis, - ConsensusCommitPrologue, + ConsensusCommitPrologueV1, ProgrammableTransaction, AuthenticatorStateUpdateV1, RandomnessStateUpdate, @@ -426,7 +426,7 @@ impl From<&IotaTransactionBlockKind> for OperationType { match tx { IotaTransactionBlockKind::Genesis(_) => OperationType::Genesis, IotaTransactionBlockKind::ConsensusCommitPrologueV1(_) => { - OperationType::ConsensusCommitPrologue + OperationType::ConsensusCommitPrologueV1 } IotaTransactionBlockKind::ProgrammableTransaction(_) => { OperationType::ProgrammableTransaction diff --git a/crates/iota-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index 906dd98724e..1e13c9725f3 100644 --- a/crates/iota-types/src/iota_sdk2_conversions.rs +++ b/crates/iota-types/src/iota_sdk2_conversions.rs @@ -11,7 +11,7 @@ //! directly to avoid going through the BCS machinery. use fastcrypto::traits::ToFromBytes; -use iota_sdk2::types::{ +use iota_sdk2::{ object::{MovePackage, MoveStruct}, *, }; @@ -668,7 +668,7 @@ impl From for crate::transaction::EndOfEpochTransacti } } -impl From for InputArgument { +impl From for Input { fn from(value: crate::transaction::CallArg) -> Self { match value { crate::transaction::CallArg::Pure(vec) => Self::Pure { value: vec }, @@ -693,15 +693,15 @@ impl From for InputArgument { } } -impl From for crate::transaction::CallArg { - fn from(value: InputArgument) -> Self { +impl From for crate::transaction::CallArg { + fn from(value: Input) -> 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 { + Input::Pure { value } => Self::Pure(value), + Input::ImmutableOrOwned(object_reference) => Self::Object(ObjectArg::ImmOrOwnedObject( + sdk_obj_ref_to_core(object_reference), + )), + Input::Shared { object_id, initial_shared_version, mutable, @@ -710,7 +710,7 @@ impl From for crate::transaction::CallArg { initial_shared_version: initial_shared_version.into(), mutable, }), - InputArgument::Receiving(object_reference) => { + Input::Receiving(object_reference) => { Self::Object(ObjectArg::Receiving(sdk_obj_ref_to_core(object_reference))) } } @@ -751,37 +751,35 @@ impl TryFrom for TransactionEffects { .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(), - } + 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(), - } + } + }, + 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(), - } + } + 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, - }, + } + }, + 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(), @@ -861,7 +859,7 @@ impl TryFrom for crate::effects::TransactionEffects { ( obj.object_id.into(), crate::effects::EffectsObjectChange { - input_state: match obj.change.input_state { + input_state: match obj.input_state { ObjectIn::NotExist => { crate::effects::ObjectIn::NotExist } @@ -874,7 +872,7 @@ impl TryFrom for crate::effects::TransactionEffects { owner.into(), )), }, - output_state: match obj.change.output_state { + output_state: match obj.output_state { ObjectOut::NotExist => { crate::effects::ObjectOut::NotExist } @@ -891,7 +889,7 @@ impl TryFrom for crate::effects::TransactionEffects { )) } }, - id_operation: match obj.change.id_operation { + id_operation: match obj.id_operation { IdOperation::None => crate::effects::IDOperation::None, IdOperation::Created => { crate::effects::IDOperation::Created diff --git a/crates/iota-types/src/transaction.rs b/crates/iota-types/src/transaction.rs index 2d05d2e58ad..d8f39faa504 100644 --- a/crates/iota-types/src/transaction.rs +++ b/crates/iota-types/src/transaction.rs @@ -236,8 +236,8 @@ pub struct AuthenticatorStateUpdateV1 { pub new_active_jwks: Vec, /// The initial version of the authenticator object that it was shared at. pub authenticator_obj_initial_shared_version: SequenceNumber, - // to version this struct, do not add new fields. Instead, add a AuthenticatorStateUpdateV2 to - // TransactionKind. + // to version this struct, do not add new fields. Instead, add an AuthenticatorStateUpdateV2 + // to TransactionKind. } impl AuthenticatorStateUpdateV1 {