From 62c086ee7db96df57a6dbfb467ce3294e05295ae Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Tue, 4 Feb 2025 09:28:59 -0500 Subject: [PATCH 01/12] chore(*): Update external rust SDK types --- Cargo.lock | 56 +++---- Cargo.toml | 4 +- crates/iota-core/src/authority.rs | 2 +- .../authority/authority_per_epoch_store.rs | 4 +- crates/iota-core/src/checkpoints/mod.rs | 14 +- .../src/unit_tests/authority_tests.rs | 8 +- .../src/unit_tests/transaction_tests.rs | 16 +- .../authenticator_state_update.rs | 2 +- .../consensus_commit_prologue.rs | 2 +- .../transaction_block_kind/end_of_epoch.rs | 2 +- .../src/types/transaction_block_kind/mod.rs | 4 +- .../src/iota_transaction.rs | 8 +- crates/iota-rest-api/src/accounts.rs | 2 +- crates/iota-rest-api/src/checkpoints.rs | 2 +- crates/iota-rest-api/src/client/sdk.rs | 2 +- crates/iota-rest-api/src/coins.rs | 2 +- crates/iota-rest-api/src/committee.rs | 2 +- crates/iota-rest-api/src/info.rs | 2 +- crates/iota-rest-api/src/objects.rs | 2 +- crates/iota-rest-api/src/reader.rs | 12 +- crates/iota-rest-api/src/system.rs | 38 ++--- .../src/transactions/execution.rs | 8 +- crates/iota-rest-api/src/transactions/mod.rs | 2 +- .../iota-types/src/iota_sdk2_conversions.rs | 154 +++++++++--------- crates/iota-types/src/messages_consensus.rs | 2 +- crates/iota-types/src/transaction.rs | 52 +++--- crates/test-cluster/src/lib.rs | 2 +- .../iota-adapter/src/execution_engine.rs | 10 +- 28 files changed, 203 insertions(+), 213 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index acc7bdb4f42..03086f451bb 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" @@ -2163,9 +2163,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" [[package]] name = "byteorder" @@ -7688,7 +7688,7 @@ dependencies = [ "fastcrypto", "iota-network-stack", "iota-protocol-config", - "iota-rust-sdk", + "iota-sdk-types", "iota-types", "itertools 0.13.0", "mime", @@ -7774,26 +7774,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.9.0-alpha" @@ -7872,6 +7852,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "iota-sdk-types" +version = "0.0.2" +source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=7bd24a06d4f54e15254efb7eb03f2c8d80797cfd#7bd24a06d4f54e15254efb7eb03f2c8d80797cfd" +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.9.0-alpha" @@ -8352,8 +8352,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", @@ -12643,9 +12643,9 @@ dependencies = [ [[package]] name = "roaring" -version = "0.10.6" +version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" +checksum = "a652edd001c53df0b3f96a36a8dc93fce6866988efc16808235653c6bcac8bf2" dependencies = [ "bytemuck", "byteorder", diff --git a/Cargo.toml b/Cargo.toml index 2acc8002f84..30efcab7b3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -304,7 +304,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"] } @@ -414,7 +414,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 = "https://github.com/iotaledger/iota-rust-sdk.git", rev = "2ba6b293bdede769a1d9b4d1aecaede2ff7682dd", features = ["hash", "serde", "schemars"] } +iota-sdk2 = { package = "iota-sdk-types", git = "https://github.com/iotaledger/iota-rust-sdk.git", rev = "7bd24a06d4f54e15254efb7eb03f2c8d80797cfd", 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/authority.rs b/crates/iota-core/src/authority.rs index 60d3715868b..4cf28317ff7 100644 --- a/crates/iota-core/src/authority.rs +++ b/crates/iota-core/src/authority.rs @@ -1397,7 +1397,7 @@ impl AuthorityState { ) .await?; - if let TransactionKind::AuthenticatorStateUpdateV1(auth_state) = + if let TransactionKind::AuthenticatorStateUpdate(auth_state) = certificate.data().transaction_data().kind() { if let Some(err) = &execution_error_opt { diff --git a/crates/iota-core/src/authority/authority_per_epoch_store.rs b/crates/iota-core/src/authority/authority_per_epoch_store.rs index 135da20d087..d2382a86aa0 100644 --- a/crates/iota-core/src/authority/authority_per_epoch_store.rs +++ b/crates/iota-core/src/authority/authority_per_epoch_store.rs @@ -55,7 +55,7 @@ use iota_types::{ signature::GenericSignature, storage::{BackingPackageStore, GetSharedLocks, InputKey, ObjectStore}, transaction::{ - AuthenticatorStateUpdateV1, CertifiedTransaction, InputObjectKind, SenderSignedData, + AuthenticatorStateUpdate, CertifiedTransaction, InputObjectKind, SenderSignedData, Transaction, TransactionDataAPI, TransactionKey, TransactionKind, VerifiedCertificate, VerifiedSignedTransaction, VerifiedTransaction, }, @@ -3782,7 +3782,7 @@ impl AuthorityPerEpochStore { .set(self.epoch_open_time.elapsed().as_millis() as i64); } - pub(crate) fn update_authenticator_state(&self, update: &AuthenticatorStateUpdateV1) { + pub(crate) fn update_authenticator_state(&self, update: &AuthenticatorStateUpdate) { info!("Updating authenticator state: {:?}", update); for active_jwk in &update.new_active_jwks { let ActiveJwk { jwk_id, jwk, .. } = active_jwk; diff --git a/crates/iota-core/src/checkpoints/mod.rs b/crates/iota-core/src/checkpoints/mod.rs index 532c5b1e002..af9866921ae 100644 --- a/crates/iota-core/src/checkpoints/mod.rs +++ b/crates/iota-core/src/checkpoints/mod.rs @@ -1151,7 +1151,7 @@ impl CheckpointBuilder { .expect("Transaction block must exist"); Ok(match first_tx.transaction_data().kind() { - TransactionKind::ConsensusCommitPrologueV1(_) => { + TransactionKind::ConsensusCommitPrologue(_) => { assert_eq!(first_tx.digest(), root_effects[0].transaction_digest()); Some((*first_tx.digest(), root_effects[0].clone())) } @@ -1357,8 +1357,8 @@ impl CheckpointBuilder { let (transaction, size) = transaction_and_size .unwrap_or_else(|| panic!("Could not find executed transaction {:?}", effects)); match transaction.inner().transaction_data().kind() { - TransactionKind::ConsensusCommitPrologueV1(_) - | TransactionKind::AuthenticatorStateUpdateV1(_) => { + TransactionKind::ConsensusCommitPrologue(_) + | TransactionKind::AuthenticatorStateUpdate(_) => { // ConsensusCommitPrologue and // AuthenticatorStateUpdateV1 // are guaranteed to be @@ -1701,7 +1701,7 @@ impl CheckpointBuilder { tx.as_ref().filter(|tx| { matches!( tx.transaction_data().kind(), - TransactionKind::ConsensusCommitPrologueV1(_) + TransactionKind::ConsensusCommitPrologue(_) ) }) }) @@ -1730,7 +1730,7 @@ impl CheckpointBuilder { for tx in txs.iter().flatten() { assert!(!matches!( tx.transaction_data().kind(), - TransactionKind::ConsensusCommitPrologueV1(_) + TransactionKind::ConsensusCommitPrologue(_) )); } } else { @@ -1738,7 +1738,7 @@ impl CheckpointBuilder { // checkpoint. assert!(matches!( txs[0].as_ref().unwrap().transaction_data().kind(), - TransactionKind::ConsensusCommitPrologueV1(_) + TransactionKind::ConsensusCommitPrologue(_) )); assert_eq!(ccps[0].digest(), txs[0].as_ref().unwrap().digest()); @@ -1746,7 +1746,7 @@ impl CheckpointBuilder { for tx in txs.iter().skip(1).flatten() { assert!(!matches!( tx.transaction_data().kind(), - TransactionKind::ConsensusCommitPrologueV1(_) + TransactionKind::ConsensusCommitPrologue(_) )); } } diff --git a/crates/iota-core/src/unit_tests/authority_tests.rs b/crates/iota-core/src/unit_tests/authority_tests.rs index ced5e1510ec..f4565d5693f 100644 --- a/crates/iota-core/src/unit_tests/authority_tests.rs +++ b/crates/iota-core/src/unit_tests/authority_tests.rs @@ -4838,7 +4838,7 @@ async fn test_consensus_commit_prologue_generation() { .data() .transaction_data() .kind(), - TransactionKind::ConsensusCommitPrologueV1(..) + TransactionKind::ConsensusCommitPrologue(..) )); // Tests that the system clock object is updated by the new consensus commit @@ -6146,7 +6146,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { // transaction, and it must be the first one. assert!(matches!( scheduled_txns[0].data().transaction_data().kind(), - TransactionKind::ConsensusCommitPrologueV1(..) + TransactionKind::ConsensusCommitPrologue(..) )); assert!(scheduled_txns[1].data().transaction_data().gas_price() == 2000); @@ -6154,7 +6154,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { assert_eq!(scheduled_txns.len(), 2); assert!(matches!( scheduled_txns[0].data().transaction_data().kind(), - TransactionKind::ConsensusCommitPrologueV1(..) + TransactionKind::ConsensusCommitPrologue(..) )); assert!(scheduled_txns[1].data().transaction_data().gas_price() == 2000); @@ -6224,7 +6224,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { // Consensus commit prologue contains cancelled txn shared object version // assignment. - if let TransactionKind::ConsensusCommitPrologueV1(prologue_txn) = + if let TransactionKind::ConsensusCommitPrologue(prologue_txn) = scheduled_txns[0].data().transaction_data().kind() { assert!(matches!( diff --git a/crates/iota-core/src/unit_tests/transaction_tests.rs b/crates/iota-core/src/unit_tests/transaction_tests.rs index 05935f2474e..02ec3ded0cc 100644 --- a/crates/iota-core/src/unit_tests/transaction_tests.rs +++ b/crates/iota-core/src/unit_tests/transaction_tests.rs @@ -26,7 +26,7 @@ use iota_types::{ multisig::{MultiSig, MultiSigPublicKey}, signature::GenericSignature, transaction::{ - AuthenticatorStateUpdateV1, GenesisTransaction, TransactionDataAPI, TransactionKind, + AuthenticatorStateUpdate, GenesisTransaction, TransactionDataAPI, TransactionKind, }, utils::{get_one_zklogin_inputs, load_test_vectors, to_sender_signed_transaction}, zk_login_authenticator::ZkLoginAuthenticator, @@ -60,7 +60,7 @@ macro_rules! assert_matches { use fastcrypto::traits::AggregateAuthenticator; use iota_types::{ - digests::ConsensusCommitDigest, messages_consensus::ConsensusCommitPrologueV1, + digests::ConsensusCommitDigest, messages_consensus::ConsensusCommitPrologue, messages_grpc::HandleCertificateRequestV1, programmable_transaction_builder::ProgrammableTransactionBuilder, }; @@ -228,8 +228,8 @@ async fn test_user_sends_genesis_transaction() { #[tokio::test] async fn test_user_sends_consensus_commit_prologue_v1() { - test_user_sends_system_transaction_impl(TransactionKind::ConsensusCommitPrologueV1( - ConsensusCommitPrologueV1 { + test_user_sends_system_transaction_impl(TransactionKind::ConsensusCommitPrologue( + ConsensusCommitPrologue { epoch: 0, round: 0, sub_dag_index: None, @@ -1001,7 +1001,7 @@ async fn setup_zklogin_network( let gas_object_id = gas_object_ids[0]; let jwks = parse_jwks(DEFAULT_JWK_BYTES, &OIDCProvider::Twitch)?; let epoch_store = authority_state.epoch_store_for_testing(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { epoch: 0, round: 0, new_active_jwks: jwks @@ -1178,7 +1178,7 @@ async fn test_zklogin_txn_fail_if_missing_jwk() { // Initialize an authenticator state with a Google JWK. let jwks = parse_jwks(DEFAULT_JWK_BYTES, &OIDCProvider::Google).unwrap(); let epoch_store = authority_state.epoch_store_for_testing(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { epoch: 0, round: 0, new_active_jwks: jwks @@ -1210,7 +1210,7 @@ async fn test_zklogin_txn_fail_if_missing_jwk() { // Initialize an authenticator state with Twitch's kid as "nosuckkey". pub const BAD_JWK_BYTES: &[u8] = r#"{"keys":[{"alg":"RS256","e":"AQAB","kid":"nosuchkey","kty":"RSA","n":"6lq9MQ-q6hcxr7kOUp-tHlHtdcDsVLwVIw13iXUCvuDOeCi0VSuxCCUY6UmMjy53dX00ih2E4Y4UvlrmmurK0eG26b-HMNNAvCGsVXHU3RcRhVoHDaOwHwU72j7bpHn9XbP3Q3jebX6KIfNbei2MiR0Wyb8RZHE-aZhRYO8_-k9G2GycTpvc-2GBsP8VHLUKKfAs2B6sW3q3ymU6M0L-cFXkZ9fHkn9ejs-sqZPhMJxtBPBxoUIUQFTgv4VXTSv914f_YkNw-EjuwbgwXMvpyr06EyfImxHoxsZkFYB-qBYHtaMxTnFsZBr6fn8Ha2JqT1hoP7Z5r5wxDu3GQhKkHw","use":"sig"}]}"#.as_bytes(); let jwks = parse_jwks(BAD_JWK_BYTES, &OIDCProvider::Twitch).unwrap(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { epoch: 0, round: 0, new_active_jwks: jwks @@ -1255,7 +1255,7 @@ async fn test_zklogin_multisig() { let jwks = parse_jwks(DEFAULT_JWK_BYTES, &OIDCProvider::Twitch).unwrap(); let epoch_store = authority_state.epoch_store_for_testing(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { epoch: 0, round: 0, new_active_jwks: jwks diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs index d543670d4f8..7012d9dff73 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs @@ -8,7 +8,7 @@ use async_graphql::{ }; use iota_types::{ authenticator_state::ActiveJwk as NativeActiveJwk, - transaction::AuthenticatorStateUpdateV1 as NativeAuthenticatorStateUpdateTransactionV1, + transaction::AuthenticatorStateUpdate as NativeAuthenticatorStateUpdateTransactionV1, }; use crate::{ diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs index 343956f1a2b..372af376ce8 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs @@ -4,7 +4,7 @@ use async_graphql::*; use fastcrypto::encoding::{Base58, Encoding}; -use iota_types::messages_consensus::ConsensusCommitPrologueV1 as NativeConsensusCommitPrologueTransactionV1; +use iota_types::messages_consensus::ConsensusCommitPrologue as NativeConsensusCommitPrologueTransactionV1; use crate::types::{date_time::DateTime, epoch::Epoch, uint53::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..d6779db2a8d 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 @@ -238,7 +238,7 @@ impl AuthenticatorStateExpireTransaction { /// The initial version that the AuthenticatorStateUpdateV1 was shared at. async fn authenticator_obj_initial_shared_version(&self) -> UInt53 { self.native - .authenticator_obj_initial_shared_version + .authenticator_object_initial_shared_version .value() .into() } diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs index 5d0c4f8685c..f0256f92d35 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs @@ -47,13 +47,13 @@ impl TransactionBlockKind { native: g, checkpoint_viewed_at, }), - K::ConsensusCommitPrologueV1(ccp) => { + K::ConsensusCommitPrologue(ccp) => { T::ConsensusCommitPrologue(ConsensusCommitPrologueTransaction { native: ccp, checkpoint_viewed_at, }) } - K::AuthenticatorStateUpdateV1(asu) => { + K::AuthenticatorStateUpdate(asu) => { T::AuthenticatorState(AuthenticatorStateUpdateTransaction { native: asu, checkpoint_viewed_at, diff --git a/crates/iota-json-rpc-types/src/iota_transaction.rs b/crates/iota-json-rpc-types/src/iota_transaction.rs index b6aee792178..055f262f82d 100644 --- a/crates/iota-json-rpc-types/src/iota_transaction.rs +++ b/crates/iota-json-rpc-types/src/iota_transaction.rs @@ -468,7 +468,7 @@ impl IotaTransactionBlockKind { .map(|(seq, _event)| EventID::from((tx_digest, seq as u64))) .collect(), }), - TransactionKind::ConsensusCommitPrologueV1(p) => { + TransactionKind::ConsensusCommitPrologue(p) => { Self::ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1 { epoch: p.epoch, round: p.round, @@ -482,7 +482,7 @@ impl IotaTransactionBlockKind { TransactionKind::ProgrammableTransaction(p) => Self::ProgrammableTransaction( IotaProgrammableTransactionBlock::try_from(p, module_cache)?, ), - TransactionKind::AuthenticatorStateUpdateV1(update) => { + TransactionKind::AuthenticatorStateUpdate(update) => { Self::AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1 { epoch: update.epoch, round: update.round, @@ -550,7 +550,7 @@ impl IotaTransactionBlockKind { .map(|(seq, _event)| EventID::from((tx_digest, seq as u64))) .collect(), }), - TransactionKind::ConsensusCommitPrologueV1(p) => { + TransactionKind::ConsensusCommitPrologue(p) => { Self::ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1 { epoch: p.epoch, round: p.round, @@ -568,7 +568,7 @@ impl IotaTransactionBlockKind { ) .await?, ), - TransactionKind::AuthenticatorStateUpdateV1(update) => { + TransactionKind::AuthenticatorStateUpdate(update) => { Self::AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1 { epoch: update.epoch, round: update.round, diff --git a/crates/iota-rest-api/src/accounts.rs b/crates/iota-rest-api/src/accounts.rs index 3911da863c3..23de9a93f6b 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 4c825d21980..41efb12a94b 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 89ae4df822a..9a89c9c1168 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 4562e563ec0..e203dc68258 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 6a0088be245..144cd99bd14 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::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 0446a499a3f..1fd8f518cf6 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, }; @@ -64,11 +64,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; @@ -100,7 +100,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 }); @@ -338,7 +338,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-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index 031089f698c..27f9e68dbbd 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}, *, }; @@ -306,8 +306,8 @@ impl From for TransactionKind { .collect(), }) } - InternalTxnKind::ConsensusCommitPrologueV1(consensus_commit_prologue_v1) => { - let consensus_determined_version_assignments = match consensus_commit_prologue_v1.consensus_determined_version_assignments { + InternalTxnKind::ConsensusCommitPrologue(consensus_commit_prologue) => { + let consensus_determined_version_assignments = match consensus_commit_prologue.consensus_determined_version_assignments { crate::messages_consensus::ConsensusDeterminedVersionAssignments::CancelledTransactions(vec) => ConsensusDeterminedVersionAssignments::CancelledTransactions { cancelled_transactions: vec.into_iter().map(|value| CancelledTransaction { @@ -321,22 +321,22 @@ impl From for TransactionKind { }).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 + TransactionKind::ConsensusCommitPrologue(ConsensusCommitPrologue { + epoch: consensus_commit_prologue.epoch, + round: consensus_commit_prologue.round, + sub_dag_index: consensus_commit_prologue.sub_dag_index, + commit_timestamp_ms: consensus_commit_prologue.commit_timestamp_ms, + consensus_commit_digest: consensus_commit_prologue .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 + InternalTxnKind::AuthenticatorStateUpdate(authenticator_state_update) => { + TransactionKind::AuthenticatorStateUpdate(AuthenticatorStateUpdate { + epoch: authenticator_state_update.epoch, + round: authenticator_state_update.round, + new_active_jwks: authenticator_state_update .new_active_jwks .into_iter() .map(|jwk| ActiveJwk { @@ -353,7 +353,7 @@ impl From for TransactionKind { epoch: jwk.epoch, }) .collect(), - authenticator_obj_initial_shared_version: authenticator_state_update_v1 + authenticator_obj_initial_shared_version: authenticator_state_update .authenticator_obj_initial_shared_version .value(), }) @@ -416,8 +416,8 @@ impl From for crate::transaction::TransactionKind { .collect(), }) } - TransactionKind::ConsensusCommitPrologueV1(consensus_commit_prologue_v1) => { - let consensus_determined_version_assignments = match consensus_commit_prologue_v1.consensus_determined_version_assignments { + TransactionKind::ConsensusCommitPrologue(consensus_commit_prologue) => { + let consensus_determined_version_assignments = match consensus_commit_prologue.consensus_determined_version_assignments { ConsensusDeterminedVersionAssignments::CancelledTransactions{ cancelled_transactions } => crate::messages_consensus::ConsensusDeterminedVersionAssignments::CancelledTransactions( cancelled_transactions.into_iter().map(|value| @@ -432,24 +432,22 @@ impl From for crate::transaction::TransactionKind { ).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, - }, - ) + Self::ConsensusCommitPrologue(crate::messages_consensus::ConsensusCommitPrologue { + epoch: consensus_commit_prologue.epoch, + round: consensus_commit_prologue.round, + sub_dag_index: consensus_commit_prologue.sub_dag_index, + commit_timestamp_ms: consensus_commit_prologue.commit_timestamp_ms, + consensus_commit_digest: consensus_commit_prologue + .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 + TransactionKind::AuthenticatorStateUpdate(authenticator_state_update) => { + Self::AuthenticatorStateUpdate(crate::transaction::AuthenticatorStateUpdate { + epoch: authenticator_state_update.epoch, + round: authenticator_state_update.round, + new_active_jwks: authenticator_state_update .new_active_jwks .into_iter() .map(|jwk| crate::authenticator_state::ActiveJwk { @@ -466,7 +464,7 @@ impl From for crate::transaction::TransactionKind { epoch: jwk.epoch, }) .collect(), - authenticator_obj_initial_shared_version: authenticator_state_update_v1 + authenticator_obj_initial_shared_version: authenticator_state_update .authenticator_obj_initial_shared_version .into(), }) @@ -520,8 +518,8 @@ impl From for EndOfEpochTransacti 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 + authenticator_object_initial_shared_version: authenticator_state_expire + .authenticator_object_initial_shared_version .value(), }), crate::transaction::EndOfEpochTransactionKind::BridgeStateCreate(chain_identifier) => { @@ -567,8 +565,8 @@ impl From for crate::transaction::EndOfEpochTransacti 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 + authenticator_object_initial_shared_version: authenticator_state_expire + .authenticator_object_initial_shared_version .into(), }) } @@ -582,7 +580,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 }, @@ -607,15 +605,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, @@ -624,7 +622,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))) } } @@ -663,37 +661,35 @@ impl From 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(), @@ -769,7 +765,7 @@ impl From 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, ObjectIn::Exist { version, @@ -780,7 +776,7 @@ impl From 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, ObjectOut::ObjectWrite { digest, owner } => { crate::effects::ObjectOut::ObjectWrite(( @@ -795,7 +791,7 @@ impl From 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/messages_consensus.rs b/crates/iota-types/src/messages_consensus.rs index 46def77b51f..2903bf800d6 100644 --- a/crates/iota-types/src/messages_consensus.rs +++ b/crates/iota-types/src/messages_consensus.rs @@ -40,7 +40,7 @@ pub enum ConsensusDeterminedVersionAssignments { } #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)] -pub struct ConsensusCommitPrologueV1 { +pub struct ConsensusCommitPrologue { /// Epoch of the commit prologue transaction pub epoch: u64, /// Consensus round of the commit diff --git a/crates/iota-types/src/transaction.rs b/crates/iota-types/src/transaction.rs index b7f18c242f8..df9086b4dbd 100644 --- a/crates/iota-types/src/transaction.rs +++ b/crates/iota-types/src/transaction.rs @@ -49,7 +49,7 @@ use crate::{ execution::SharedInput, message_envelope::{Envelope, Message, TrustedEnvelope, VerifiedEnvelope}, messages_checkpoint::CheckpointTimestamp, - messages_consensus::{ConsensusCommitPrologueV1, ConsensusDeterminedVersionAssignments}, + messages_consensus::{ConsensusCommitPrologue, ConsensusDeterminedVersionAssignments}, object::{MoveObject, Object, Owner}, programmable_transaction_builder::ProgrammableTransactionBuilder, signature::{GenericSignature, VerifyParams}, @@ -217,17 +217,17 @@ pub struct AuthenticatorStateExpire { /// expire JWKs that have a lower epoch than this pub min_epoch: u64, /// The initial version of the authenticator object that it was shared at. - pub authenticator_obj_initial_shared_version: SequenceNumber, + pub authenticator_object_initial_shared_version: SequenceNumber, } impl AuthenticatorStateExpire { pub fn authenticator_obj_initial_shared_version(&self) -> SequenceNumber { - self.authenticator_obj_initial_shared_version + self.authenticator_object_initial_shared_version } } #[derive(Debug, Hash, PartialEq, Eq, Clone, Serialize, Deserialize)] -pub struct AuthenticatorStateUpdateV1 { +pub struct AuthenticatorStateUpdate { /// Epoch of the authenticator state update transaction pub epoch: u64, /// Consensus round of the authenticator state update @@ -240,7 +240,7 @@ pub struct AuthenticatorStateUpdateV1 { // TransactionKind. } -impl AuthenticatorStateUpdateV1 { +impl AuthenticatorStateUpdate { pub fn authenticator_obj_initial_shared_version(&self) -> SequenceNumber { self.authenticator_obj_initial_shared_version } @@ -280,8 +280,8 @@ pub enum TransactionKind { /// A validator will not sign a transaction of this kind from outside. It /// only signs internally during epoch changes. Genesis(GenesisTransaction), - ConsensusCommitPrologueV1(ConsensusCommitPrologueV1), - AuthenticatorStateUpdateV1(AuthenticatorStateUpdateV1), + ConsensusCommitPrologue(ConsensusCommitPrologue), + AuthenticatorStateUpdate(AuthenticatorStateUpdate), /// EndOfEpochTransaction contains a list of transactions /// that are allowed to run at the end of the epoch. @@ -330,7 +330,7 @@ impl EndOfEpochTransactionKind { ) -> Self { Self::AuthenticatorStateExpire(AuthenticatorStateExpire { min_epoch, - authenticator_obj_initial_shared_version, + authenticator_object_initial_shared_version: authenticator_obj_initial_shared_version, }) } @@ -1130,8 +1130,8 @@ impl TransactionKind { // Keep this as an exhaustive match so that we can't forget to update it. match self { TransactionKind::Genesis(_) - | TransactionKind::ConsensusCommitPrologueV1(_) - | TransactionKind::AuthenticatorStateUpdateV1(_) + | TransactionKind::ConsensusCommitPrologue(_) + | TransactionKind::AuthenticatorStateUpdate(_) | TransactionKind::RandomnessStateUpdate(_) | TransactionKind::EndOfEpochTransaction(_) => true, TransactionKind::ProgrammableTransaction(_) => false, @@ -1170,14 +1170,14 @@ impl TransactionKind { /// transaction. pub fn shared_input_objects(&self) -> impl Iterator + '_ { match &self { - Self::ConsensusCommitPrologueV1(_) => { + Self::ConsensusCommitPrologue(_) => { Either::Left(Either::Left(iter::once(SharedInputObject { id: IOTA_CLOCK_OBJECT_ID, initial_shared_version: IOTA_CLOCK_OBJECT_SHARED_VERSION, mutable: true, }))) } - Self::AuthenticatorStateUpdateV1(update) => { + Self::AuthenticatorStateUpdate(update) => { Either::Left(Either::Left(iter::once(SharedInputObject { id: IOTA_AUTHENTICATOR_STATE_OBJECT_ID, initial_shared_version: update.authenticator_obj_initial_shared_version, @@ -1211,8 +1211,8 @@ impl TransactionKind { pub fn receiving_objects(&self) -> Vec { match &self { TransactionKind::Genesis(_) - | TransactionKind::ConsensusCommitPrologueV1(_) - | TransactionKind::AuthenticatorStateUpdateV1(_) + | TransactionKind::ConsensusCommitPrologue(_) + | TransactionKind::AuthenticatorStateUpdate(_) | TransactionKind::RandomnessStateUpdate(_) | TransactionKind::EndOfEpochTransaction(_) => vec![], TransactionKind::ProgrammableTransaction(pt) => pt.receiving_objects(), @@ -1229,14 +1229,14 @@ impl TransactionKind { Self::Genesis(_) => { vec![] } - Self::ConsensusCommitPrologueV1(_) => { + Self::ConsensusCommitPrologue(_) => { vec![InputObjectKind::SharedMoveObject { id: IOTA_CLOCK_OBJECT_ID, initial_shared_version: IOTA_CLOCK_OBJECT_SHARED_VERSION, mutable: true, }] } - Self::AuthenticatorStateUpdateV1(update) => { + Self::AuthenticatorStateUpdate(update) => { vec![InputObjectKind::SharedMoveObject { id: IOTA_AUTHENTICATOR_STATE_OBJECT_ID, initial_shared_version: update.authenticator_obj_initial_shared_version(), @@ -1285,14 +1285,14 @@ impl TransactionKind { TransactionKind::ProgrammableTransaction(p) => p.validity_check(config)?, // All transaction kinds below are assumed to be system, // and no validity or limit checks are performed. - TransactionKind::Genesis(_) | TransactionKind::ConsensusCommitPrologueV1(_) => (), + TransactionKind::Genesis(_) | TransactionKind::ConsensusCommitPrologue(_) => (), TransactionKind::EndOfEpochTransaction(txns) => { for tx in txns { tx.validity_check(config)?; } } - TransactionKind::AuthenticatorStateUpdateV1(_) => { + TransactionKind::AuthenticatorStateUpdate(_) => { if !config.enable_jwk_consensus_updates() { return Err(UserInputError::Unsupported( "authenticator state updates not enabled".to_string(), @@ -1330,9 +1330,9 @@ impl TransactionKind { pub fn name(&self) -> &'static str { match self { Self::Genesis(_) => "Genesis", - Self::ConsensusCommitPrologueV1(_) => "ConsensusCommitPrologueV1", + Self::ConsensusCommitPrologue(_) => "ConsensusCommitPrologueV1", Self::ProgrammableTransaction(_) => "ProgrammableTransaction", - Self::AuthenticatorStateUpdateV1(_) => "AuthenticatorStateUpdateV1", + Self::AuthenticatorStateUpdate(_) => "AuthenticatorStateUpdateV1", Self::RandomnessStateUpdate(_) => "RandomnessStateUpdate", Self::EndOfEpochTransaction(_) => "EndOfEpochTransaction", } @@ -1346,7 +1346,7 @@ impl Display for TransactionKind { Self::Genesis(_) => { writeln!(writer, "Transaction Kind : Genesis")?; } - Self::ConsensusCommitPrologueV1(p) => { + Self::ConsensusCommitPrologue(p) => { writeln!(writer, "Transaction Kind : Consensus Commit Prologue V1")?; writeln!(writer, "Timestamp : {}", p.commit_timestamp_ms)?; writeln!(writer, "Consensus Digest: {}", p.consensus_commit_digest)?; @@ -1360,7 +1360,7 @@ impl Display for TransactionKind { writeln!(writer, "Transaction Kind : Programmable")?; write!(writer, "{p}")?; } - Self::AuthenticatorStateUpdateV1(_) => { + Self::AuthenticatorStateUpdate(_) => { writeln!(writer, "Transaction Kind : Authenticator State Update")?; } Self::RandomnessStateUpdate(_) => { @@ -2378,7 +2378,7 @@ impl VerifiedTransaction { consensus_commit_digest: ConsensusCommitDigest, cancelled_txn_version_assignment: Vec<(TransactionDigest, Vec<(ObjectID, SequenceNumber)>)>, ) -> Self { - ConsensusCommitPrologueV1 { + ConsensusCommitPrologue { epoch, round, // sub_dag_index is reserved for when we have multi commits per round. @@ -2390,7 +2390,7 @@ impl VerifiedTransaction { cancelled_txn_version_assignment, ), } - .pipe(TransactionKind::ConsensusCommitPrologueV1) + .pipe(TransactionKind::ConsensusCommitPrologue) .pipe(Self::new_system_transaction) } @@ -2400,13 +2400,13 @@ impl VerifiedTransaction { new_active_jwks: Vec, authenticator_obj_initial_shared_version: SequenceNumber, ) -> Self { - AuthenticatorStateUpdateV1 { + AuthenticatorStateUpdate { epoch, round, new_active_jwks, authenticator_obj_initial_shared_version, } - .pipe(TransactionKind::AuthenticatorStateUpdateV1) + .pipe(TransactionKind::AuthenticatorStateUpdate) .pipe(Self::new_system_transaction) } diff --git a/crates/test-cluster/src/lib.rs b/crates/test-cluster/src/lib.rs index 244f6d0471d..572dace1ff2 100644 --- a/crates/test-cluster/src/lib.rs +++ b/crates/test-cluster/src/lib.rs @@ -619,7 +619,7 @@ impl TestCluster { .unwrap(); match &tx.data().intent_message().value.kind() { TransactionKind::EndOfEpochTransaction(_) => (), - TransactionKind::AuthenticatorStateUpdateV1(_) => break, + TransactionKind::AuthenticatorStateUpdate(_) => break, _ => panic!("{:?}", tx), } } diff --git a/iota-execution/latest/iota-adapter/src/execution_engine.rs b/iota-execution/latest/iota-adapter/src/execution_engine.rs index 9b9128532b6..93e825a5062 100644 --- a/iota-execution/latest/iota-adapter/src/execution_engine.rs +++ b/iota-execution/latest/iota-adapter/src/execution_engine.rs @@ -55,7 +55,7 @@ mod checked { randomness_state::{RANDOMNESS_MODULE_NAME, RANDOMNESS_STATE_UPDATE_FUNCTION_NAME}, storage::{BackingStore, Storage}, transaction::{ - Argument, AuthenticatorStateExpire, AuthenticatorStateUpdateV1, CallArg, ChangeEpoch, + Argument, AuthenticatorStateExpire, AuthenticatorStateUpdate, CallArg, ChangeEpoch, CheckedInputObjects, Command, EndOfEpochTransactionKind, GenesisTransaction, ObjectArg, ProgrammableTransaction, RandomnessStateUpdate, TransactionKind, }, @@ -633,7 +633,7 @@ mod checked { Ok(Mode::empty_results()) } - TransactionKind::ConsensusCommitPrologueV1(prologue) => { + TransactionKind::ConsensusCommitPrologue(prologue) => { setup_consensus_commit( prologue.commit_timestamp_ms, temporary_store, @@ -702,7 +702,7 @@ mod checked { "EndOfEpochTransactionKind::ChangeEpoch should be the last transaction in the list" ) } - TransactionKind::AuthenticatorStateUpdateV1(auth_state_update) => { + TransactionKind::AuthenticatorStateUpdate(auth_state_update) => { setup_authenticator_state_update( auth_state_update, temporary_store, @@ -1117,7 +1117,7 @@ mod checked { /// arguments. It then executes the transaction using the system /// execution mode. fn setup_authenticator_state_update( - update: AuthenticatorStateUpdateV1, + update: AuthenticatorStateUpdate, temporary_store: &mut TemporaryStore<'_>, tx_ctx: &mut TxContext, move_vm: &Arc, @@ -1175,7 +1175,7 @@ mod checked { vec![ CallArg::Object(ObjectArg::SharedObject { id: IOTA_AUTHENTICATOR_STATE_OBJECT_ID, - initial_shared_version: expire.authenticator_obj_initial_shared_version, + initial_shared_version: expire.authenticator_object_initial_shared_version, mutable: true, }), CallArg::Pure(bcs::to_bytes(&expire.min_epoch).unwrap()), From c794f7e31ccc126f2f778ad66dc01fd87fc7e9c7 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Tue, 4 Feb 2025 10:16:03 -0500 Subject: [PATCH 02/12] sort --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 30efcab7b3e..195e8a6d23a 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 = "7bd24a06d4f54e15254efb7eb03f2c8d80797cfd", 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"] } @@ -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-sdk-types", git = "https://github.com/iotaledger/iota-rust-sdk.git", rev = "7bd24a06d4f54e15254efb7eb03f2c8d80797cfd", features = ["hash", "serde", "schemars"] } iota-simulator = { path = "crates/iota-simulator" } iota-snapshot = { path = "crates/iota-snapshot" } iota-source-validation = { path = "crates/iota-source-validation" } From 9370777ec0382070ebc7bffc605cf5506dde3e63 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Tue, 4 Feb 2025 12:56:36 -0500 Subject: [PATCH 03/12] update test data --- crates/iota-core/tests/staged/iota.yaml | 14 +++++++------- crates/iota-rest-api/openapi/openapi.json | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/iota-core/tests/staged/iota.yaml b/crates/iota-core/tests/staged/iota.yaml index 8d4074f0ea6..c52e4df82f1 100644 --- a/crates/iota-core/tests/staged/iota.yaml +++ b/crates/iota-core/tests/staged/iota.yaml @@ -29,9 +29,9 @@ Argument: AuthenticatorStateExpire: STRUCT: - min_epoch: U64 - - authenticator_obj_initial_shared_version: + - authenticator_object_initial_shared_version: TYPENAME: SequenceNumber -AuthenticatorStateUpdateV1: +AuthenticatorStateUpdate: STRUCT: - epoch: U64 - round: U64 @@ -232,7 +232,7 @@ CongestedObjects: ConsensusCommitDigest: NEWTYPESTRUCT: TYPENAME: Digest -ConsensusCommitPrologueV1: +ConsensusCommitPrologue: STRUCT: - epoch: U64 - round: U64 @@ -924,13 +924,13 @@ TransactionKind: NEWTYPE: TYPENAME: GenesisTransaction 2: - ConsensusCommitPrologueV1: + ConsensusCommitPrologue: NEWTYPE: - TYPENAME: ConsensusCommitPrologueV1 + TYPENAME: ConsensusCommitPrologue 3: - AuthenticatorStateUpdateV1: + AuthenticatorStateUpdate: NEWTYPE: - TYPENAME: AuthenticatorStateUpdateV1 + TYPENAME: AuthenticatorStateUpdate 4: EndOfEpochTransaction: NEWTYPE: diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index 7213f28e1f5..ec9a8709806 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -1939,12 +1939,12 @@ { "type": "object", "required": [ - "authenticator_obj_initial_shared_version", + "authenticator_object_initial_shared_version", "kind", "min_epoch" ], "properties": { - "authenticator_obj_initial_shared_version": { + "authenticator_object_initial_shared_version": { "description": "The initial version of the authenticator object that it was shared at.", "type": "string", "format": "u64" @@ -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": { @@ -4461,7 +4461,7 @@ "kind": { "type": "string", "enum": [ - "consensus_commit_prologue_v1" + "consensus_commit_prologue" ] }, "round": { @@ -4499,7 +4499,7 @@ "kind": { "type": "string", "enum": [ - "authenticator_state_update_v1" + "authenticator_state_update" ] }, "new_active_jwks": { @@ -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" From 39143e922d608cc0d705bf6fd43c89bea4a684b3 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Tue, 4 Feb 2025 13:31:17 -0500 Subject: [PATCH 04/12] fix more rename locations --- crates/iota-core/src/checkpoints/mod.rs | 2 +- crates/iota-core/src/consensus_handler.rs | 2 +- .../src/unit_tests/authority_tests.rs | 2 +- crates/iota-e2e-tests/tests/zklogin_tests.rs | 4 ++-- .../transaction_block_kind/end_of_epoch.rs | 2 +- .../src/iota_transaction.rs | 24 +++++++++---------- crates/iota-rosetta/src/types.rs | 8 +++---- crates/iota-types/src/transaction.rs | 4 ++-- .../iota-adapter/src/execution_engine.rs | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/crates/iota-core/src/checkpoints/mod.rs b/crates/iota-core/src/checkpoints/mod.rs index af9866921ae..2283a7e3268 100644 --- a/crates/iota-core/src/checkpoints/mod.rs +++ b/crates/iota-core/src/checkpoints/mod.rs @@ -1360,7 +1360,7 @@ impl CheckpointBuilder { TransactionKind::ConsensusCommitPrologue(_) | TransactionKind::AuthenticatorStateUpdate(_) => { // ConsensusCommitPrologue and - // AuthenticatorStateUpdateV1 + // AuthenticatorStateUpdate // are guaranteed to be // processed before we reach here. } diff --git a/crates/iota-core/src/consensus_handler.rs b/crates/iota-core/src/consensus_handler.rs index fb8b054b8e0..7c8b0ab4869 100644 --- a/crates/iota-core/src/consensus_handler.rs +++ b/crates/iota-core/src/consensus_handler.rs @@ -260,7 +260,7 @@ impl ConsensusHandler { let authenticator_state_update_transaction = self.authenticator_state_update_transaction(round, new_jwks); debug!( - "adding AuthenticatorStateUpdateV1({:?}) tx: {:?}", + "adding AuthenticatorStateUpdate({:?}) tx: {:?}", authenticator_state_update_transaction.digest(), authenticator_state_update_transaction, ); diff --git a/crates/iota-core/src/unit_tests/authority_tests.rs b/crates/iota-core/src/unit_tests/authority_tests.rs index f4565d5693f..685667b9f3e 100644 --- a/crates/iota-core/src/unit_tests/authority_tests.rs +++ b/crates/iota-core/src/unit_tests/authority_tests.rs @@ -6239,7 +6239,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { )] )); } else { - panic!("First scheduled transaction must be a ConsensusCommitPrologueV1 transaction."); + panic!("First scheduled transaction must be a ConsensusCommitPrologue transaction."); } } diff --git a/crates/iota-e2e-tests/tests/zklogin_tests.rs b/crates/iota-e2e-tests/tests/zklogin_tests.rs index ae274d1fb26..5c5bcadcd89 100644 --- a/crates/iota-e2e-tests/tests/zklogin_tests.rs +++ b/crates/iota-e2e-tests/tests/zklogin_tests.rs @@ -203,7 +203,7 @@ async fn test_zklogin_auth_state_creation() { // object is not created yet. test_cluster.wait_for_protocol_version(24.into()).await; // Now wait until the auth state object is created, ie. - // AuthenticatorStateUpdateV1 transaction happened. + // AuthenticatorStateUpdate transaction happened. test_cluster.wait_for_authenticator_state_update().await; } @@ -292,7 +292,7 @@ async fn test_zklogin_conflicting_jwks() { .unwrap(); match &tx.data().intent_message().value.kind() { TransactionKind::EndOfEpochTransaction(_) => (), - TransactionKind::AuthenticatorStateUpdateV1(update) => { + TransactionKind::AuthenticatorStateUpdate(update) => { let jwks = &mut *jwks_clone.lock().unwrap(); for jwk in &update.new_active_jwks { jwks.push(jwk.clone()); 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 d6779db2a8d..b9424a742c8 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_object_initial_shared_version diff --git a/crates/iota-json-rpc-types/src/iota_transaction.rs b/crates/iota-json-rpc-types/src/iota_transaction.rs index 055f262f82d..4029ddcfb59 100644 --- a/crates/iota-json-rpc-types/src/iota_transaction.rs +++ b/crates/iota-json-rpc-types/src/iota_transaction.rs @@ -402,12 +402,12 @@ pub enum IotaTransactionBlockKind { Genesis(IotaGenesisTransaction), /// A system transaction marking the start of a series of transactions /// scheduled as part of a checkpoint - ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1), + ConsensusCommitPrologue(IotaConsensusCommitPrologue), /// A series of transactions where the results of one transaction can be /// used in future transactions ProgrammableTransaction(IotaProgrammableTransactionBlock), /// A transaction which updates global authenticator state - AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1), + AuthenticatorStateUpdate(IotaAuthenticatorStateUpdate), /// A transaction which updates global randomness state RandomnessStateUpdate(IotaRandomnessStateUpdate), /// The transaction which occurs only at the end of the epoch @@ -422,7 +422,7 @@ impl Display for IotaTransactionBlockKind { Self::Genesis(_) => { writeln!(writer, "Transaction Kind: Genesis Transaction")?; } - Self::ConsensusCommitPrologueV1(p) => { + Self::ConsensusCommitPrologue(p) => { writeln!(writer, "Transaction Kind: Consensus Commit Prologue V1")?; writeln!( writer, @@ -438,7 +438,7 @@ impl Display for IotaTransactionBlockKind { write!(writer, "Transaction Kind: Programmable")?; write!(writer, "{}", crate::displays::Pretty(p))?; } - Self::AuthenticatorStateUpdateV1(_) => { + Self::AuthenticatorStateUpdate(_) => { writeln!(writer, "Transaction Kind: Authenticator State Update")?; } Self::RandomnessStateUpdate(_) => { @@ -469,7 +469,7 @@ impl IotaTransactionBlockKind { .collect(), }), TransactionKind::ConsensusCommitPrologue(p) => { - Self::ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1 { + Self::ConsensusCommitPrologue(IotaConsensusCommitPrologue { epoch: p.epoch, round: p.round, sub_dag_index: p.sub_dag_index, @@ -483,7 +483,7 @@ impl IotaTransactionBlockKind { IotaProgrammableTransactionBlock::try_from(p, module_cache)?, ), TransactionKind::AuthenticatorStateUpdate(update) => { - Self::AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1 { + Self::AuthenticatorStateUpdate(IotaAuthenticatorStateUpdate { epoch: update.epoch, round: update.round, new_active_jwks: update @@ -551,7 +551,7 @@ impl IotaTransactionBlockKind { .collect(), }), TransactionKind::ConsensusCommitPrologue(p) => { - Self::ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1 { + Self::ConsensusCommitPrologue(IotaConsensusCommitPrologue { epoch: p.epoch, round: p.round, sub_dag_index: p.sub_dag_index, @@ -569,7 +569,7 @@ impl IotaTransactionBlockKind { .await?, ), TransactionKind::AuthenticatorStateUpdate(update) => { - Self::AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1 { + Self::AuthenticatorStateUpdate(IotaAuthenticatorStateUpdate { epoch: update.epoch, round: update.round, new_active_jwks: update @@ -629,9 +629,9 @@ impl IotaTransactionBlockKind { pub fn name(&self) -> &'static str { match self { Self::Genesis(_) => "Genesis", - Self::ConsensusCommitPrologueV1(_) => "ConsensusCommitPrologueV1", + Self::ConsensusCommitPrologue(_) => "ConsensusCommitPrologue", Self::ProgrammableTransaction(_) => "ProgrammableTransaction", - Self::AuthenticatorStateUpdateV1(_) => "AuthenticatorStateUpdateV1", + Self::AuthenticatorStateUpdate(_) => "AuthenticatorStateUpdate", Self::RandomnessStateUpdate(_) => "RandomnessStateUpdate", Self::EndOfEpochTransaction(_) => "EndOfEpochTransaction", } @@ -1560,7 +1560,7 @@ pub struct IotaGenesisTransaction { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] -pub struct IotaConsensusCommitPrologueV1 { +pub struct IotaConsensusCommitPrologue { #[schemars(with = "BigInt")] #[serde_as(as = "BigInt")] pub epoch: u64, @@ -1579,7 +1579,7 @@ pub struct IotaConsensusCommitPrologueV1 { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] -pub struct IotaAuthenticatorStateUpdateV1 { +pub struct IotaAuthenticatorStateUpdate { #[schemars(with = "BigInt")] #[serde_as(as = "BigInt")] pub epoch: u64, diff --git a/crates/iota-rosetta/src/types.rs b/crates/iota-rosetta/src/types.rs index 0962a2fb7a0..02db31bdd23 100644 --- a/crates/iota-rosetta/src/types.rs +++ b/crates/iota-rosetta/src/types.rs @@ -416,7 +416,7 @@ pub enum OperationType { Genesis, ConsensusCommitPrologue, ProgrammableTransaction, - AuthenticatorStateUpdateV1, + AuthenticatorStateUpdate, RandomnessStateUpdate, EndOfEpochTransaction, } @@ -425,14 +425,14 @@ impl From<&IotaTransactionBlockKind> for OperationType { fn from(tx: &IotaTransactionBlockKind) -> Self { match tx { IotaTransactionBlockKind::Genesis(_) => OperationType::Genesis, - IotaTransactionBlockKind::ConsensusCommitPrologueV1(_) => { + IotaTransactionBlockKind::ConsensusCommitPrologue(_) => { OperationType::ConsensusCommitPrologue } IotaTransactionBlockKind::ProgrammableTransaction(_) => { OperationType::ProgrammableTransaction } - IotaTransactionBlockKind::AuthenticatorStateUpdateV1(_) => { - OperationType::AuthenticatorStateUpdateV1 + IotaTransactionBlockKind::AuthenticatorStateUpdate(_) => { + OperationType::AuthenticatorStateUpdate } IotaTransactionBlockKind::RandomnessStateUpdate(_) => { OperationType::RandomnessStateUpdate diff --git a/crates/iota-types/src/transaction.rs b/crates/iota-types/src/transaction.rs index df9086b4dbd..e047aa85f6f 100644 --- a/crates/iota-types/src/transaction.rs +++ b/crates/iota-types/src/transaction.rs @@ -1330,9 +1330,9 @@ impl TransactionKind { pub fn name(&self) -> &'static str { match self { Self::Genesis(_) => "Genesis", - Self::ConsensusCommitPrologue(_) => "ConsensusCommitPrologueV1", + Self::ConsensusCommitPrologue(_) => "ConsensusCommitPrologue", Self::ProgrammableTransaction(_) => "ProgrammableTransaction", - Self::AuthenticatorStateUpdate(_) => "AuthenticatorStateUpdateV1", + Self::AuthenticatorStateUpdate(_) => "AuthenticatorStateUpdate", Self::RandomnessStateUpdate(_) => "RandomnessStateUpdate", Self::EndOfEpochTransaction(_) => "EndOfEpochTransaction", } diff --git a/iota-execution/latest/iota-adapter/src/execution_engine.rs b/iota-execution/latest/iota-adapter/src/execution_engine.rs index 93e825a5062..207648c4e0e 100644 --- a/iota-execution/latest/iota-adapter/src/execution_engine.rs +++ b/iota-execution/latest/iota-adapter/src/execution_engine.rs @@ -643,7 +643,7 @@ mod checked { protocol_config, metrics, ) - .expect("ConsensusCommitPrologueV1 cannot fail"); + .expect("ConsensusCommitPrologue cannot fail"); Ok(Mode::empty_results()) } TransactionKind::ProgrammableTransaction(pt) => { From 4ec87b4ae80bedf839c101eb643d35a4664415e4 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Tue, 4 Feb 2025 14:42:34 -0500 Subject: [PATCH 05/12] more missed locations --- crates/iota-graphql-rpc/schema.graphql | 2 +- .../tests/snapshots/snapshot_tests__schema_sdl_export.snap | 2 +- crates/iota-open-rpc/spec/openrpc.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/iota-graphql-rpc/schema.graphql b/crates/iota-graphql-rpc/schema.graphql index 7bac27a2f22..5c055ddb8ca 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/tests/snapshots/snapshot_tests__schema_sdl_export.snap b/crates/iota-graphql-rpc/tests/snapshots/snapshot_tests__schema_sdl_export.snap index 39faa395417..a27ec4a08a6 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-open-rpc/spec/openrpc.json b/crates/iota-open-rpc/spec/openrpc.json index a4fd912ea8f..8391f02a06c 100644 --- a/crates/iota-open-rpc/spec/openrpc.json +++ b/crates/iota-open-rpc/spec/openrpc.json @@ -11230,7 +11230,7 @@ "kind": { "type": "string", "enum": [ - "ConsensusCommitPrologueV1" + "ConsensusCommitPrologue" ] }, "round": { @@ -11296,7 +11296,7 @@ "kind": { "type": "string", "enum": [ - "AuthenticatorStateUpdateV1" + "AuthenticatorStateUpdate" ] }, "new_active_jwks": { From f3d974b982a14071bef75a3c932f714ac3da7f98 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Wed, 5 Feb 2025 11:49:05 -0500 Subject: [PATCH 06/12] revert transaction type v1 removal --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/iota-core/src/authority.rs | 2 +- .../authority/authority_per_epoch_store.rs | 4 +- crates/iota-core/src/checkpoints/mod.rs | 14 +++--- crates/iota-core/src/consensus_handler.rs | 2 +- .../src/unit_tests/authority_tests.rs | 10 ++-- .../src/unit_tests/transaction_tests.rs | 16 +++--- crates/iota-core/tests/staged/iota.yaml | 13 +++-- crates/iota-e2e-tests/tests/zklogin_tests.rs | 4 +- .../authenticator_state_update.rs | 2 +- .../consensus_commit_prologue.rs | 2 +- .../src/types/transaction_block_kind/mod.rs | 4 +- .../src/iota_transaction.rs | 32 ++++++------ crates/iota-open-rpc/spec/openrpc.json | 4 +- crates/iota-rosetta/src/types.rs | 4 +- .../iota-types/src/iota_sdk2_conversions.rs | 36 ++++++------- crates/iota-types/src/messages_consensus.rs | 4 +- crates/iota-types/src/transaction.rs | 50 +++++++++---------- crates/test-cluster/src/lib.rs | 2 +- .../iota-adapter/src/execution_engine.rs | 10 ++-- 21 files changed, 110 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03086f451bb..c1f062f220e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7855,7 +7855,7 @@ dependencies = [ [[package]] name = "iota-sdk-types" version = "0.0.2" -source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=7bd24a06d4f54e15254efb7eb03f2c8d80797cfd#7bd24a06d4f54e15254efb7eb03f2c8d80797cfd" +source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=c1775f631f5327913353dcfebd98c19dadfdf9c7#c1775f631f5327913353dcfebd98c19dadfdf9c7" dependencies = [ "base64ct", "bcs", diff --git a/Cargo.toml b/Cargo.toml index 195e8a6d23a..0f73a068140 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -272,7 +272,7 @@ 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 = "7bd24a06d4f54e15254efb7eb03f2c8d80797cfd", features = ["hash", "serde", "schemars"] } +iota-sdk2 = { package = "iota-sdk-types", git = "https://github.com/iotaledger/iota-rust-sdk.git", rev = "c1775f631f5327913353dcfebd98c19dadfdf9c7", 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"] } diff --git a/crates/iota-core/src/authority.rs b/crates/iota-core/src/authority.rs index 4cf28317ff7..60d3715868b 100644 --- a/crates/iota-core/src/authority.rs +++ b/crates/iota-core/src/authority.rs @@ -1397,7 +1397,7 @@ impl AuthorityState { ) .await?; - if let TransactionKind::AuthenticatorStateUpdate(auth_state) = + if let TransactionKind::AuthenticatorStateUpdateV1(auth_state) = certificate.data().transaction_data().kind() { if let Some(err) = &execution_error_opt { diff --git a/crates/iota-core/src/authority/authority_per_epoch_store.rs b/crates/iota-core/src/authority/authority_per_epoch_store.rs index d2382a86aa0..135da20d087 100644 --- a/crates/iota-core/src/authority/authority_per_epoch_store.rs +++ b/crates/iota-core/src/authority/authority_per_epoch_store.rs @@ -55,7 +55,7 @@ use iota_types::{ signature::GenericSignature, storage::{BackingPackageStore, GetSharedLocks, InputKey, ObjectStore}, transaction::{ - AuthenticatorStateUpdate, CertifiedTransaction, InputObjectKind, SenderSignedData, + AuthenticatorStateUpdateV1, CertifiedTransaction, InputObjectKind, SenderSignedData, Transaction, TransactionDataAPI, TransactionKey, TransactionKind, VerifiedCertificate, VerifiedSignedTransaction, VerifiedTransaction, }, @@ -3782,7 +3782,7 @@ impl AuthorityPerEpochStore { .set(self.epoch_open_time.elapsed().as_millis() as i64); } - pub(crate) fn update_authenticator_state(&self, update: &AuthenticatorStateUpdate) { + pub(crate) fn update_authenticator_state(&self, update: &AuthenticatorStateUpdateV1) { info!("Updating authenticator state: {:?}", update); for active_jwk in &update.new_active_jwks { let ActiveJwk { jwk_id, jwk, .. } = active_jwk; diff --git a/crates/iota-core/src/checkpoints/mod.rs b/crates/iota-core/src/checkpoints/mod.rs index 2283a7e3268..f3e22e3da05 100644 --- a/crates/iota-core/src/checkpoints/mod.rs +++ b/crates/iota-core/src/checkpoints/mod.rs @@ -1151,7 +1151,7 @@ impl CheckpointBuilder { .expect("Transaction block must exist"); Ok(match first_tx.transaction_data().kind() { - TransactionKind::ConsensusCommitPrologue(_) => { + TransactionKind::ConsensusCommitPrologueV1(_) => { assert_eq!(first_tx.digest(), root_effects[0].transaction_digest()); Some((*first_tx.digest(), root_effects[0].clone())) } @@ -1357,8 +1357,8 @@ impl CheckpointBuilder { let (transaction, size) = transaction_and_size .unwrap_or_else(|| panic!("Could not find executed transaction {:?}", effects)); match transaction.inner().transaction_data().kind() { - TransactionKind::ConsensusCommitPrologue(_) - | TransactionKind::AuthenticatorStateUpdate(_) => { + TransactionKind::ConsensusCommitPrologueV1(_) + | TransactionKind::AuthenticatorStateUpdateV1(_) => { // ConsensusCommitPrologue and // AuthenticatorStateUpdate // are guaranteed to be @@ -1701,7 +1701,7 @@ impl CheckpointBuilder { tx.as_ref().filter(|tx| { matches!( tx.transaction_data().kind(), - TransactionKind::ConsensusCommitPrologue(_) + TransactionKind::ConsensusCommitPrologueV1(_) ) }) }) @@ -1730,7 +1730,7 @@ impl CheckpointBuilder { for tx in txs.iter().flatten() { assert!(!matches!( tx.transaction_data().kind(), - TransactionKind::ConsensusCommitPrologue(_) + TransactionKind::ConsensusCommitPrologueV1(_) )); } } else { @@ -1738,7 +1738,7 @@ impl CheckpointBuilder { // checkpoint. assert!(matches!( txs[0].as_ref().unwrap().transaction_data().kind(), - TransactionKind::ConsensusCommitPrologue(_) + TransactionKind::ConsensusCommitPrologueV1(_) )); assert_eq!(ccps[0].digest(), txs[0].as_ref().unwrap().digest()); @@ -1746,7 +1746,7 @@ impl CheckpointBuilder { for tx in txs.iter().skip(1).flatten() { assert!(!matches!( tx.transaction_data().kind(), - TransactionKind::ConsensusCommitPrologue(_) + TransactionKind::ConsensusCommitPrologueV1(_) )); } } diff --git a/crates/iota-core/src/consensus_handler.rs b/crates/iota-core/src/consensus_handler.rs index 7c8b0ab4869..fb8b054b8e0 100644 --- a/crates/iota-core/src/consensus_handler.rs +++ b/crates/iota-core/src/consensus_handler.rs @@ -260,7 +260,7 @@ impl ConsensusHandler { let authenticator_state_update_transaction = self.authenticator_state_update_transaction(round, new_jwks); debug!( - "adding AuthenticatorStateUpdate({:?}) tx: {:?}", + "adding AuthenticatorStateUpdateV1({:?}) tx: {:?}", authenticator_state_update_transaction.digest(), authenticator_state_update_transaction, ); diff --git a/crates/iota-core/src/unit_tests/authority_tests.rs b/crates/iota-core/src/unit_tests/authority_tests.rs index 685667b9f3e..ced5e1510ec 100644 --- a/crates/iota-core/src/unit_tests/authority_tests.rs +++ b/crates/iota-core/src/unit_tests/authority_tests.rs @@ -4838,7 +4838,7 @@ async fn test_consensus_commit_prologue_generation() { .data() .transaction_data() .kind(), - TransactionKind::ConsensusCommitPrologue(..) + TransactionKind::ConsensusCommitPrologueV1(..) )); // Tests that the system clock object is updated by the new consensus commit @@ -6146,7 +6146,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { // transaction, and it must be the first one. assert!(matches!( scheduled_txns[0].data().transaction_data().kind(), - TransactionKind::ConsensusCommitPrologue(..) + TransactionKind::ConsensusCommitPrologueV1(..) )); assert!(scheduled_txns[1].data().transaction_data().gas_price() == 2000); @@ -6154,7 +6154,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { assert_eq!(scheduled_txns.len(), 2); assert!(matches!( scheduled_txns[0].data().transaction_data().kind(), - TransactionKind::ConsensusCommitPrologue(..) + TransactionKind::ConsensusCommitPrologueV1(..) )); assert!(scheduled_txns[1].data().transaction_data().gas_price() == 2000); @@ -6224,7 +6224,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { // Consensus commit prologue contains cancelled txn shared object version // assignment. - if let TransactionKind::ConsensusCommitPrologue(prologue_txn) = + if let TransactionKind::ConsensusCommitPrologueV1(prologue_txn) = scheduled_txns[0].data().transaction_data().kind() { assert!(matches!( @@ -6239,7 +6239,7 @@ async fn test_consensus_handler_congestion_control_transaction_cancellation() { )] )); } else { - panic!("First scheduled transaction must be a ConsensusCommitPrologue transaction."); + panic!("First scheduled transaction must be a ConsensusCommitPrologueV1 transaction."); } } diff --git a/crates/iota-core/src/unit_tests/transaction_tests.rs b/crates/iota-core/src/unit_tests/transaction_tests.rs index 02ec3ded0cc..05935f2474e 100644 --- a/crates/iota-core/src/unit_tests/transaction_tests.rs +++ b/crates/iota-core/src/unit_tests/transaction_tests.rs @@ -26,7 +26,7 @@ use iota_types::{ multisig::{MultiSig, MultiSigPublicKey}, signature::GenericSignature, transaction::{ - AuthenticatorStateUpdate, GenesisTransaction, TransactionDataAPI, TransactionKind, + AuthenticatorStateUpdateV1, GenesisTransaction, TransactionDataAPI, TransactionKind, }, utils::{get_one_zklogin_inputs, load_test_vectors, to_sender_signed_transaction}, zk_login_authenticator::ZkLoginAuthenticator, @@ -60,7 +60,7 @@ macro_rules! assert_matches { use fastcrypto::traits::AggregateAuthenticator; use iota_types::{ - digests::ConsensusCommitDigest, messages_consensus::ConsensusCommitPrologue, + digests::ConsensusCommitDigest, messages_consensus::ConsensusCommitPrologueV1, messages_grpc::HandleCertificateRequestV1, programmable_transaction_builder::ProgrammableTransactionBuilder, }; @@ -228,8 +228,8 @@ async fn test_user_sends_genesis_transaction() { #[tokio::test] async fn test_user_sends_consensus_commit_prologue_v1() { - test_user_sends_system_transaction_impl(TransactionKind::ConsensusCommitPrologue( - ConsensusCommitPrologue { + test_user_sends_system_transaction_impl(TransactionKind::ConsensusCommitPrologueV1( + ConsensusCommitPrologueV1 { epoch: 0, round: 0, sub_dag_index: None, @@ -1001,7 +1001,7 @@ async fn setup_zklogin_network( let gas_object_id = gas_object_ids[0]; let jwks = parse_jwks(DEFAULT_JWK_BYTES, &OIDCProvider::Twitch)?; let epoch_store = authority_state.epoch_store_for_testing(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { epoch: 0, round: 0, new_active_jwks: jwks @@ -1178,7 +1178,7 @@ async fn test_zklogin_txn_fail_if_missing_jwk() { // Initialize an authenticator state with a Google JWK. let jwks = parse_jwks(DEFAULT_JWK_BYTES, &OIDCProvider::Google).unwrap(); let epoch_store = authority_state.epoch_store_for_testing(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { epoch: 0, round: 0, new_active_jwks: jwks @@ -1210,7 +1210,7 @@ async fn test_zklogin_txn_fail_if_missing_jwk() { // Initialize an authenticator state with Twitch's kid as "nosuckkey". pub const BAD_JWK_BYTES: &[u8] = r#"{"keys":[{"alg":"RS256","e":"AQAB","kid":"nosuchkey","kty":"RSA","n":"6lq9MQ-q6hcxr7kOUp-tHlHtdcDsVLwVIw13iXUCvuDOeCi0VSuxCCUY6UmMjy53dX00ih2E4Y4UvlrmmurK0eG26b-HMNNAvCGsVXHU3RcRhVoHDaOwHwU72j7bpHn9XbP3Q3jebX6KIfNbei2MiR0Wyb8RZHE-aZhRYO8_-k9G2GycTpvc-2GBsP8VHLUKKfAs2B6sW3q3ymU6M0L-cFXkZ9fHkn9ejs-sqZPhMJxtBPBxoUIUQFTgv4VXTSv914f_YkNw-EjuwbgwXMvpyr06EyfImxHoxsZkFYB-qBYHtaMxTnFsZBr6fn8Ha2JqT1hoP7Z5r5wxDu3GQhKkHw","use":"sig"}]}"#.as_bytes(); let jwks = parse_jwks(BAD_JWK_BYTES, &OIDCProvider::Twitch).unwrap(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { epoch: 0, round: 0, new_active_jwks: jwks @@ -1255,7 +1255,7 @@ async fn test_zklogin_multisig() { let jwks = parse_jwks(DEFAULT_JWK_BYTES, &OIDCProvider::Twitch).unwrap(); let epoch_store = authority_state.epoch_store_for_testing(); - epoch_store.update_authenticator_state(&AuthenticatorStateUpdate { + epoch_store.update_authenticator_state(&AuthenticatorStateUpdateV1 { epoch: 0, round: 0, new_active_jwks: jwks diff --git a/crates/iota-core/tests/staged/iota.yaml b/crates/iota-core/tests/staged/iota.yaml index c52e4df82f1..61509c89756 100644 --- a/crates/iota-core/tests/staged/iota.yaml +++ b/crates/iota-core/tests/staged/iota.yaml @@ -31,7 +31,7 @@ AuthenticatorStateExpire: - min_epoch: U64 - authenticator_object_initial_shared_version: TYPENAME: SequenceNumber -AuthenticatorStateUpdate: +AuthenticatorStateUpdateV1: STRUCT: - epoch: U64 - round: U64 @@ -232,7 +232,7 @@ CongestedObjects: ConsensusCommitDigest: NEWTYPESTRUCT: TYPENAME: Digest -ConsensusCommitPrologue: +ConsensusCommitPrologueV1: STRUCT: - epoch: U64 - round: U64 @@ -924,13 +924,13 @@ TransactionKind: NEWTYPE: TYPENAME: GenesisTransaction 2: - ConsensusCommitPrologue: + ConsensusCommitPrologueV1: NEWTYPE: - TYPENAME: ConsensusCommitPrologue + TYPENAME: ConsensusCommitPrologueV1 3: - AuthenticatorStateUpdate: + AuthenticatorStateUpdateV1: NEWTYPE: - TYPENAME: AuthenticatorStateUpdate + TYPENAME: AuthenticatorStateUpdateV1 4: EndOfEpochTransaction: NEWTYPE: @@ -1031,4 +1031,3 @@ ZkLoginAuthenticatorAsBytes: ZkLoginPublicIdentifier: NEWTYPESTRUCT: SEQ: U8 - diff --git a/crates/iota-e2e-tests/tests/zklogin_tests.rs b/crates/iota-e2e-tests/tests/zklogin_tests.rs index 5c5bcadcd89..ae274d1fb26 100644 --- a/crates/iota-e2e-tests/tests/zklogin_tests.rs +++ b/crates/iota-e2e-tests/tests/zklogin_tests.rs @@ -203,7 +203,7 @@ async fn test_zklogin_auth_state_creation() { // object is not created yet. test_cluster.wait_for_protocol_version(24.into()).await; // Now wait until the auth state object is created, ie. - // AuthenticatorStateUpdate transaction happened. + // AuthenticatorStateUpdateV1 transaction happened. test_cluster.wait_for_authenticator_state_update().await; } @@ -292,7 +292,7 @@ async fn test_zklogin_conflicting_jwks() { .unwrap(); match &tx.data().intent_message().value.kind() { TransactionKind::EndOfEpochTransaction(_) => (), - TransactionKind::AuthenticatorStateUpdate(update) => { + TransactionKind::AuthenticatorStateUpdateV1(update) => { let jwks = &mut *jwks_clone.lock().unwrap(); for jwk in &update.new_active_jwks { jwks.push(jwk.clone()); diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs index 7012d9dff73..d543670d4f8 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/authenticator_state_update.rs @@ -8,7 +8,7 @@ use async_graphql::{ }; use iota_types::{ authenticator_state::ActiveJwk as NativeActiveJwk, - transaction::AuthenticatorStateUpdate as NativeAuthenticatorStateUpdateTransactionV1, + transaction::AuthenticatorStateUpdateV1 as NativeAuthenticatorStateUpdateTransactionV1, }; use crate::{ diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs index 372af376ce8..343956f1a2b 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/consensus_commit_prologue.rs @@ -4,7 +4,7 @@ use async_graphql::*; use fastcrypto::encoding::{Base58, Encoding}; -use iota_types::messages_consensus::ConsensusCommitPrologue as NativeConsensusCommitPrologueTransactionV1; +use iota_types::messages_consensus::ConsensusCommitPrologueV1 as NativeConsensusCommitPrologueTransactionV1; use crate::types::{date_time::DateTime, epoch::Epoch, uint53::UInt53}; diff --git a/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs b/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs index f0256f92d35..5d0c4f8685c 100644 --- a/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs +++ b/crates/iota-graphql-rpc/src/types/transaction_block_kind/mod.rs @@ -47,13 +47,13 @@ impl TransactionBlockKind { native: g, checkpoint_viewed_at, }), - K::ConsensusCommitPrologue(ccp) => { + K::ConsensusCommitPrologueV1(ccp) => { T::ConsensusCommitPrologue(ConsensusCommitPrologueTransaction { native: ccp, checkpoint_viewed_at, }) } - K::AuthenticatorStateUpdate(asu) => { + K::AuthenticatorStateUpdateV1(asu) => { T::AuthenticatorState(AuthenticatorStateUpdateTransaction { native: asu, checkpoint_viewed_at, diff --git a/crates/iota-json-rpc-types/src/iota_transaction.rs b/crates/iota-json-rpc-types/src/iota_transaction.rs index 4029ddcfb59..b6aee792178 100644 --- a/crates/iota-json-rpc-types/src/iota_transaction.rs +++ b/crates/iota-json-rpc-types/src/iota_transaction.rs @@ -402,12 +402,12 @@ pub enum IotaTransactionBlockKind { Genesis(IotaGenesisTransaction), /// A system transaction marking the start of a series of transactions /// scheduled as part of a checkpoint - ConsensusCommitPrologue(IotaConsensusCommitPrologue), + ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1), /// A series of transactions where the results of one transaction can be /// used in future transactions ProgrammableTransaction(IotaProgrammableTransactionBlock), /// A transaction which updates global authenticator state - AuthenticatorStateUpdate(IotaAuthenticatorStateUpdate), + AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1), /// A transaction which updates global randomness state RandomnessStateUpdate(IotaRandomnessStateUpdate), /// The transaction which occurs only at the end of the epoch @@ -422,7 +422,7 @@ impl Display for IotaTransactionBlockKind { Self::Genesis(_) => { writeln!(writer, "Transaction Kind: Genesis Transaction")?; } - Self::ConsensusCommitPrologue(p) => { + Self::ConsensusCommitPrologueV1(p) => { writeln!(writer, "Transaction Kind: Consensus Commit Prologue V1")?; writeln!( writer, @@ -438,7 +438,7 @@ impl Display for IotaTransactionBlockKind { write!(writer, "Transaction Kind: Programmable")?; write!(writer, "{}", crate::displays::Pretty(p))?; } - Self::AuthenticatorStateUpdate(_) => { + Self::AuthenticatorStateUpdateV1(_) => { writeln!(writer, "Transaction Kind: Authenticator State Update")?; } Self::RandomnessStateUpdate(_) => { @@ -468,8 +468,8 @@ impl IotaTransactionBlockKind { .map(|(seq, _event)| EventID::from((tx_digest, seq as u64))) .collect(), }), - TransactionKind::ConsensusCommitPrologue(p) => { - Self::ConsensusCommitPrologue(IotaConsensusCommitPrologue { + TransactionKind::ConsensusCommitPrologueV1(p) => { + Self::ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1 { epoch: p.epoch, round: p.round, sub_dag_index: p.sub_dag_index, @@ -482,8 +482,8 @@ impl IotaTransactionBlockKind { TransactionKind::ProgrammableTransaction(p) => Self::ProgrammableTransaction( IotaProgrammableTransactionBlock::try_from(p, module_cache)?, ), - TransactionKind::AuthenticatorStateUpdate(update) => { - Self::AuthenticatorStateUpdate(IotaAuthenticatorStateUpdate { + TransactionKind::AuthenticatorStateUpdateV1(update) => { + Self::AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1 { epoch: update.epoch, round: update.round, new_active_jwks: update @@ -550,8 +550,8 @@ impl IotaTransactionBlockKind { .map(|(seq, _event)| EventID::from((tx_digest, seq as u64))) .collect(), }), - TransactionKind::ConsensusCommitPrologue(p) => { - Self::ConsensusCommitPrologue(IotaConsensusCommitPrologue { + TransactionKind::ConsensusCommitPrologueV1(p) => { + Self::ConsensusCommitPrologueV1(IotaConsensusCommitPrologueV1 { epoch: p.epoch, round: p.round, sub_dag_index: p.sub_dag_index, @@ -568,8 +568,8 @@ impl IotaTransactionBlockKind { ) .await?, ), - TransactionKind::AuthenticatorStateUpdate(update) => { - Self::AuthenticatorStateUpdate(IotaAuthenticatorStateUpdate { + TransactionKind::AuthenticatorStateUpdateV1(update) => { + Self::AuthenticatorStateUpdateV1(IotaAuthenticatorStateUpdateV1 { epoch: update.epoch, round: update.round, new_active_jwks: update @@ -629,9 +629,9 @@ impl IotaTransactionBlockKind { pub fn name(&self) -> &'static str { match self { Self::Genesis(_) => "Genesis", - Self::ConsensusCommitPrologue(_) => "ConsensusCommitPrologue", + Self::ConsensusCommitPrologueV1(_) => "ConsensusCommitPrologueV1", Self::ProgrammableTransaction(_) => "ProgrammableTransaction", - Self::AuthenticatorStateUpdate(_) => "AuthenticatorStateUpdate", + Self::AuthenticatorStateUpdateV1(_) => "AuthenticatorStateUpdateV1", Self::RandomnessStateUpdate(_) => "RandomnessStateUpdate", Self::EndOfEpochTransaction(_) => "EndOfEpochTransaction", } @@ -1560,7 +1560,7 @@ pub struct IotaGenesisTransaction { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] -pub struct IotaConsensusCommitPrologue { +pub struct IotaConsensusCommitPrologueV1 { #[schemars(with = "BigInt")] #[serde_as(as = "BigInt")] pub epoch: u64, @@ -1579,7 +1579,7 @@ pub struct IotaConsensusCommitPrologue { #[serde_as] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] -pub struct IotaAuthenticatorStateUpdate { +pub struct IotaAuthenticatorStateUpdateV1 { #[schemars(with = "BigInt")] #[serde_as(as = "BigInt")] pub epoch: u64, diff --git a/crates/iota-open-rpc/spec/openrpc.json b/crates/iota-open-rpc/spec/openrpc.json index 8391f02a06c..a4fd912ea8f 100644 --- a/crates/iota-open-rpc/spec/openrpc.json +++ b/crates/iota-open-rpc/spec/openrpc.json @@ -11230,7 +11230,7 @@ "kind": { "type": "string", "enum": [ - "ConsensusCommitPrologue" + "ConsensusCommitPrologueV1" ] }, "round": { @@ -11296,7 +11296,7 @@ "kind": { "type": "string", "enum": [ - "AuthenticatorStateUpdate" + "AuthenticatorStateUpdateV1" ] }, "new_active_jwks": { diff --git a/crates/iota-rosetta/src/types.rs b/crates/iota-rosetta/src/types.rs index 02db31bdd23..01c0aa4402d 100644 --- a/crates/iota-rosetta/src/types.rs +++ b/crates/iota-rosetta/src/types.rs @@ -425,13 +425,13 @@ impl From<&IotaTransactionBlockKind> for OperationType { fn from(tx: &IotaTransactionBlockKind) -> Self { match tx { IotaTransactionBlockKind::Genesis(_) => OperationType::Genesis, - IotaTransactionBlockKind::ConsensusCommitPrologue(_) => { + IotaTransactionBlockKind::ConsensusCommitPrologueV1(_) => { OperationType::ConsensusCommitPrologue } IotaTransactionBlockKind::ProgrammableTransaction(_) => { OperationType::ProgrammableTransaction } - IotaTransactionBlockKind::AuthenticatorStateUpdate(_) => { + IotaTransactionBlockKind::AuthenticatorStateUpdateV1(_) => { OperationType::AuthenticatorStateUpdate } IotaTransactionBlockKind::RandomnessStateUpdate(_) => { diff --git a/crates/iota-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index 27f9e68dbbd..0696c2c5136 100644 --- a/crates/iota-types/src/iota_sdk2_conversions.rs +++ b/crates/iota-types/src/iota_sdk2_conversions.rs @@ -306,7 +306,7 @@ impl From for TransactionKind { .collect(), }) } - InternalTxnKind::ConsensusCommitPrologue(consensus_commit_prologue) => { + InternalTxnKind::ConsensusCommitPrologueV1(consensus_commit_prologue) => { let consensus_determined_version_assignments = match consensus_commit_prologue.consensus_determined_version_assignments { crate::messages_consensus::ConsensusDeterminedVersionAssignments::CancelledTransactions(vec) => ConsensusDeterminedVersionAssignments::CancelledTransactions { @@ -321,7 +321,7 @@ impl From for TransactionKind { }).collect() }, }; - TransactionKind::ConsensusCommitPrologue(ConsensusCommitPrologue { + TransactionKind::ConsensusCommitPrologueV1(ConsensusCommitPrologueV1 { epoch: consensus_commit_prologue.epoch, round: consensus_commit_prologue.round, sub_dag_index: consensus_commit_prologue.sub_dag_index, @@ -332,8 +332,8 @@ impl From for TransactionKind { consensus_determined_version_assignments, }) } - InternalTxnKind::AuthenticatorStateUpdate(authenticator_state_update) => { - TransactionKind::AuthenticatorStateUpdate(AuthenticatorStateUpdate { + InternalTxnKind::AuthenticatorStateUpdateV1(authenticator_state_update) => { + TransactionKind::AuthenticatorStateUpdateV1(AuthenticatorStateUpdateV1 { epoch: authenticator_state_update.epoch, round: authenticator_state_update.round, new_active_jwks: authenticator_state_update @@ -416,7 +416,7 @@ impl From for crate::transaction::TransactionKind { .collect(), }) } - TransactionKind::ConsensusCommitPrologue(consensus_commit_prologue) => { + TransactionKind::ConsensusCommitPrologueV1(consensus_commit_prologue) => { let consensus_determined_version_assignments = match consensus_commit_prologue.consensus_determined_version_assignments { ConsensusDeterminedVersionAssignments::CancelledTransactions{ cancelled_transactions } => crate::messages_consensus::ConsensusDeterminedVersionAssignments::CancelledTransactions( @@ -432,19 +432,21 @@ impl From for crate::transaction::TransactionKind { ).collect() ), }; - Self::ConsensusCommitPrologue(crate::messages_consensus::ConsensusCommitPrologue { - epoch: consensus_commit_prologue.epoch, - round: consensus_commit_prologue.round, - sub_dag_index: consensus_commit_prologue.sub_dag_index, - commit_timestamp_ms: consensus_commit_prologue.commit_timestamp_ms, - consensus_commit_digest: consensus_commit_prologue - .consensus_commit_digest - .into(), - consensus_determined_version_assignments, - }) + Self::ConsensusCommitPrologueV1( + crate::messages_consensus::ConsensusCommitPrologueV1 { + epoch: consensus_commit_prologue.epoch, + round: consensus_commit_prologue.round, + sub_dag_index: consensus_commit_prologue.sub_dag_index, + commit_timestamp_ms: consensus_commit_prologue.commit_timestamp_ms, + consensus_commit_digest: consensus_commit_prologue + .consensus_commit_digest + .into(), + consensus_determined_version_assignments, + }, + ) } - TransactionKind::AuthenticatorStateUpdate(authenticator_state_update) => { - Self::AuthenticatorStateUpdate(crate::transaction::AuthenticatorStateUpdate { + TransactionKind::AuthenticatorStateUpdateV1(authenticator_state_update) => { + Self::AuthenticatorStateUpdateV1(crate::transaction::AuthenticatorStateUpdateV1 { epoch: authenticator_state_update.epoch, round: authenticator_state_update.round, new_active_jwks: authenticator_state_update diff --git a/crates/iota-types/src/messages_consensus.rs b/crates/iota-types/src/messages_consensus.rs index 2903bf800d6..dbafa8dda49 100644 --- a/crates/iota-types/src/messages_consensus.rs +++ b/crates/iota-types/src/messages_consensus.rs @@ -40,7 +40,7 @@ pub enum ConsensusDeterminedVersionAssignments { } #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)] -pub struct ConsensusCommitPrologue { +pub struct ConsensusCommitPrologueV1 { /// Epoch of the commit prologue transaction pub epoch: u64, /// Consensus round of the commit @@ -446,7 +446,7 @@ fn test_jwk_compatibility() { // Ensure that the JWK and JwkId structs in fastcrypto do not change formats. // If this test breaks DO NOT JUST UPDATE THE EXPECTED BYTES. Instead, add a // local JWK or JwkId struct that mirrors the fastcrypto struct, use it in - // AuthenticatorStateUpdate, and add Into/From as necessary. + // AuthenticatorStateUpdateV1, and add Into/From as necessary. let jwk = JWK { kty: "a".to_string(), e: "b".to_string(), diff --git a/crates/iota-types/src/transaction.rs b/crates/iota-types/src/transaction.rs index e047aa85f6f..d63c40bfc66 100644 --- a/crates/iota-types/src/transaction.rs +++ b/crates/iota-types/src/transaction.rs @@ -49,7 +49,7 @@ use crate::{ execution::SharedInput, message_envelope::{Envelope, Message, TrustedEnvelope, VerifiedEnvelope}, messages_checkpoint::CheckpointTimestamp, - messages_consensus::{ConsensusCommitPrologue, ConsensusDeterminedVersionAssignments}, + messages_consensus::{ConsensusCommitPrologueV1, ConsensusDeterminedVersionAssignments}, object::{MoveObject, Object, Owner}, programmable_transaction_builder::ProgrammableTransactionBuilder, signature::{GenericSignature, VerifyParams}, @@ -227,7 +227,7 @@ impl AuthenticatorStateExpire { } #[derive(Debug, Hash, PartialEq, Eq, Clone, Serialize, Deserialize)] -pub struct AuthenticatorStateUpdate { +pub struct AuthenticatorStateUpdateV1 { /// Epoch of the authenticator state update transaction pub epoch: u64, /// Consensus round of the authenticator state update @@ -236,11 +236,11 @@ pub struct AuthenticatorStateUpdate { 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 AuthenticatorStateUpdate { +impl AuthenticatorStateUpdateV1 { pub fn authenticator_obj_initial_shared_version(&self) -> SequenceNumber { self.authenticator_obj_initial_shared_version } @@ -280,8 +280,8 @@ pub enum TransactionKind { /// A validator will not sign a transaction of this kind from outside. It /// only signs internally during epoch changes. Genesis(GenesisTransaction), - ConsensusCommitPrologue(ConsensusCommitPrologue), - AuthenticatorStateUpdate(AuthenticatorStateUpdate), + ConsensusCommitPrologueV1(ConsensusCommitPrologueV1), + AuthenticatorStateUpdateV1(AuthenticatorStateUpdateV1), /// EndOfEpochTransaction contains a list of transactions /// that are allowed to run at the end of the epoch. @@ -1130,8 +1130,8 @@ impl TransactionKind { // Keep this as an exhaustive match so that we can't forget to update it. match self { TransactionKind::Genesis(_) - | TransactionKind::ConsensusCommitPrologue(_) - | TransactionKind::AuthenticatorStateUpdate(_) + | TransactionKind::ConsensusCommitPrologueV1(_) + | TransactionKind::AuthenticatorStateUpdateV1(_) | TransactionKind::RandomnessStateUpdate(_) | TransactionKind::EndOfEpochTransaction(_) => true, TransactionKind::ProgrammableTransaction(_) => false, @@ -1170,14 +1170,14 @@ impl TransactionKind { /// transaction. pub fn shared_input_objects(&self) -> impl Iterator + '_ { match &self { - Self::ConsensusCommitPrologue(_) => { + Self::ConsensusCommitPrologueV1(_) => { Either::Left(Either::Left(iter::once(SharedInputObject { id: IOTA_CLOCK_OBJECT_ID, initial_shared_version: IOTA_CLOCK_OBJECT_SHARED_VERSION, mutable: true, }))) } - Self::AuthenticatorStateUpdate(update) => { + Self::AuthenticatorStateUpdateV1(update) => { Either::Left(Either::Left(iter::once(SharedInputObject { id: IOTA_AUTHENTICATOR_STATE_OBJECT_ID, initial_shared_version: update.authenticator_obj_initial_shared_version, @@ -1211,8 +1211,8 @@ impl TransactionKind { pub fn receiving_objects(&self) -> Vec { match &self { TransactionKind::Genesis(_) - | TransactionKind::ConsensusCommitPrologue(_) - | TransactionKind::AuthenticatorStateUpdate(_) + | TransactionKind::ConsensusCommitPrologueV1(_) + | TransactionKind::AuthenticatorStateUpdateV1(_) | TransactionKind::RandomnessStateUpdate(_) | TransactionKind::EndOfEpochTransaction(_) => vec![], TransactionKind::ProgrammableTransaction(pt) => pt.receiving_objects(), @@ -1229,14 +1229,14 @@ impl TransactionKind { Self::Genesis(_) => { vec![] } - Self::ConsensusCommitPrologue(_) => { + Self::ConsensusCommitPrologueV1(_) => { vec![InputObjectKind::SharedMoveObject { id: IOTA_CLOCK_OBJECT_ID, initial_shared_version: IOTA_CLOCK_OBJECT_SHARED_VERSION, mutable: true, }] } - Self::AuthenticatorStateUpdate(update) => { + Self::AuthenticatorStateUpdateV1(update) => { vec![InputObjectKind::SharedMoveObject { id: IOTA_AUTHENTICATOR_STATE_OBJECT_ID, initial_shared_version: update.authenticator_obj_initial_shared_version(), @@ -1285,14 +1285,14 @@ impl TransactionKind { TransactionKind::ProgrammableTransaction(p) => p.validity_check(config)?, // All transaction kinds below are assumed to be system, // and no validity or limit checks are performed. - TransactionKind::Genesis(_) | TransactionKind::ConsensusCommitPrologue(_) => (), + TransactionKind::Genesis(_) | TransactionKind::ConsensusCommitPrologueV1(_) => (), TransactionKind::EndOfEpochTransaction(txns) => { for tx in txns { tx.validity_check(config)?; } } - TransactionKind::AuthenticatorStateUpdate(_) => { + TransactionKind::AuthenticatorStateUpdateV1(_) => { if !config.enable_jwk_consensus_updates() { return Err(UserInputError::Unsupported( "authenticator state updates not enabled".to_string(), @@ -1330,9 +1330,9 @@ impl TransactionKind { pub fn name(&self) -> &'static str { match self { Self::Genesis(_) => "Genesis", - Self::ConsensusCommitPrologue(_) => "ConsensusCommitPrologue", + Self::ConsensusCommitPrologueV1(_) => "ConsensusCommitPrologueV1", Self::ProgrammableTransaction(_) => "ProgrammableTransaction", - Self::AuthenticatorStateUpdate(_) => "AuthenticatorStateUpdate", + Self::AuthenticatorStateUpdateV1(_) => "AuthenticatorStateUpdateV1", Self::RandomnessStateUpdate(_) => "RandomnessStateUpdate", Self::EndOfEpochTransaction(_) => "EndOfEpochTransaction", } @@ -1346,7 +1346,7 @@ impl Display for TransactionKind { Self::Genesis(_) => { writeln!(writer, "Transaction Kind : Genesis")?; } - Self::ConsensusCommitPrologue(p) => { + Self::ConsensusCommitPrologueV1(p) => { writeln!(writer, "Transaction Kind : Consensus Commit Prologue V1")?; writeln!(writer, "Timestamp : {}", p.commit_timestamp_ms)?; writeln!(writer, "Consensus Digest: {}", p.consensus_commit_digest)?; @@ -1360,7 +1360,7 @@ impl Display for TransactionKind { writeln!(writer, "Transaction Kind : Programmable")?; write!(writer, "{p}")?; } - Self::AuthenticatorStateUpdate(_) => { + Self::AuthenticatorStateUpdateV1(_) => { writeln!(writer, "Transaction Kind : Authenticator State Update")?; } Self::RandomnessStateUpdate(_) => { @@ -2378,7 +2378,7 @@ impl VerifiedTransaction { consensus_commit_digest: ConsensusCommitDigest, cancelled_txn_version_assignment: Vec<(TransactionDigest, Vec<(ObjectID, SequenceNumber)>)>, ) -> Self { - ConsensusCommitPrologue { + ConsensusCommitPrologueV1 { epoch, round, // sub_dag_index is reserved for when we have multi commits per round. @@ -2390,7 +2390,7 @@ impl VerifiedTransaction { cancelled_txn_version_assignment, ), } - .pipe(TransactionKind::ConsensusCommitPrologue) + .pipe(TransactionKind::ConsensusCommitPrologueV1) .pipe(Self::new_system_transaction) } @@ -2400,13 +2400,13 @@ impl VerifiedTransaction { new_active_jwks: Vec, authenticator_obj_initial_shared_version: SequenceNumber, ) -> Self { - AuthenticatorStateUpdate { + AuthenticatorStateUpdateV1 { epoch, round, new_active_jwks, authenticator_obj_initial_shared_version, } - .pipe(TransactionKind::AuthenticatorStateUpdate) + .pipe(TransactionKind::AuthenticatorStateUpdateV1) .pipe(Self::new_system_transaction) } diff --git a/crates/test-cluster/src/lib.rs b/crates/test-cluster/src/lib.rs index 572dace1ff2..244f6d0471d 100644 --- a/crates/test-cluster/src/lib.rs +++ b/crates/test-cluster/src/lib.rs @@ -619,7 +619,7 @@ impl TestCluster { .unwrap(); match &tx.data().intent_message().value.kind() { TransactionKind::EndOfEpochTransaction(_) => (), - TransactionKind::AuthenticatorStateUpdate(_) => break, + TransactionKind::AuthenticatorStateUpdateV1(_) => break, _ => panic!("{:?}", tx), } } diff --git a/iota-execution/latest/iota-adapter/src/execution_engine.rs b/iota-execution/latest/iota-adapter/src/execution_engine.rs index 207648c4e0e..0df85f13af8 100644 --- a/iota-execution/latest/iota-adapter/src/execution_engine.rs +++ b/iota-execution/latest/iota-adapter/src/execution_engine.rs @@ -55,7 +55,7 @@ mod checked { randomness_state::{RANDOMNESS_MODULE_NAME, RANDOMNESS_STATE_UPDATE_FUNCTION_NAME}, storage::{BackingStore, Storage}, transaction::{ - Argument, AuthenticatorStateExpire, AuthenticatorStateUpdate, CallArg, ChangeEpoch, + Argument, AuthenticatorStateExpire, AuthenticatorStateUpdateV1, CallArg, ChangeEpoch, CheckedInputObjects, Command, EndOfEpochTransactionKind, GenesisTransaction, ObjectArg, ProgrammableTransaction, RandomnessStateUpdate, TransactionKind, }, @@ -633,7 +633,7 @@ mod checked { Ok(Mode::empty_results()) } - TransactionKind::ConsensusCommitPrologue(prologue) => { + TransactionKind::ConsensusCommitPrologueV1(prologue) => { setup_consensus_commit( prologue.commit_timestamp_ms, temporary_store, @@ -643,7 +643,7 @@ mod checked { protocol_config, metrics, ) - .expect("ConsensusCommitPrologue cannot fail"); + .expect("ConsensusCommitPrologueV1 cannot fail"); Ok(Mode::empty_results()) } TransactionKind::ProgrammableTransaction(pt) => { @@ -702,7 +702,7 @@ mod checked { "EndOfEpochTransactionKind::ChangeEpoch should be the last transaction in the list" ) } - TransactionKind::AuthenticatorStateUpdate(auth_state_update) => { + TransactionKind::AuthenticatorStateUpdateV1(auth_state_update) => { setup_authenticator_state_update( auth_state_update, temporary_store, @@ -1117,7 +1117,7 @@ mod checked { /// arguments. It then executes the transaction using the system /// execution mode. fn setup_authenticator_state_update( - update: AuthenticatorStateUpdate, + update: AuthenticatorStateUpdateV1, temporary_store: &mut TemporaryStore<'_>, tx_ctx: &mut TxContext, move_vm: &Arc, From 66f9cb79643f4e7723e6450b98adf011fe27c4d1 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Wed, 5 Feb 2025 11:54:55 -0500 Subject: [PATCH 07/12] additional reverts --- crates/iota-rest-api/openapi/openapi.json | 4 +- crates/iota-rosetta/src/types.rs | 8 ++-- .../iota-types/src/iota_sdk2_conversions.rs | 48 +++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index ec9a8709806..82cdcfb79d0 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -4461,7 +4461,7 @@ "kind": { "type": "string", "enum": [ - "consensus_commit_prologue" + "consensus_commit_prologue_v1" ] }, "round": { @@ -4499,7 +4499,7 @@ "kind": { "type": "string", "enum": [ - "authenticator_state_update" + "authenticator_state_update_v1" ] }, "new_active_jwks": { diff --git a/crates/iota-rosetta/src/types.rs b/crates/iota-rosetta/src/types.rs index 01c0aa4402d..7ee51c0a726 100644 --- a/crates/iota-rosetta/src/types.rs +++ b/crates/iota-rosetta/src/types.rs @@ -414,9 +414,9 @@ pub enum OperationType { // All other IOTA transaction types, readonly EpochChange, Genesis, - ConsensusCommitPrologue, + ConsensusCommitPrologueV1, ProgrammableTransaction, - AuthenticatorStateUpdate, + AuthenticatorStateUpdateV1, RandomnessStateUpdate, EndOfEpochTransaction, } @@ -426,13 +426,13 @@ impl From<&IotaTransactionBlockKind> for OperationType { match tx { IotaTransactionBlockKind::Genesis(_) => OperationType::Genesis, IotaTransactionBlockKind::ConsensusCommitPrologueV1(_) => { - OperationType::ConsensusCommitPrologue + OperationType::ConsensusCommitPrologueV1 } IotaTransactionBlockKind::ProgrammableTransaction(_) => { OperationType::ProgrammableTransaction } IotaTransactionBlockKind::AuthenticatorStateUpdateV1(_) => { - OperationType::AuthenticatorStateUpdate + OperationType::AuthenticatorStateUpdateV1 } IotaTransactionBlockKind::RandomnessStateUpdate(_) => { OperationType::RandomnessStateUpdate diff --git a/crates/iota-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index 0696c2c5136..487f6fd72b7 100644 --- a/crates/iota-types/src/iota_sdk2_conversions.rs +++ b/crates/iota-types/src/iota_sdk2_conversions.rs @@ -306,8 +306,8 @@ impl From for TransactionKind { .collect(), }) } - InternalTxnKind::ConsensusCommitPrologueV1(consensus_commit_prologue) => { - let consensus_determined_version_assignments = match consensus_commit_prologue.consensus_determined_version_assignments { + 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 { @@ -322,21 +322,21 @@ impl From for TransactionKind { }, }; TransactionKind::ConsensusCommitPrologueV1(ConsensusCommitPrologueV1 { - epoch: consensus_commit_prologue.epoch, - round: consensus_commit_prologue.round, - sub_dag_index: consensus_commit_prologue.sub_dag_index, - commit_timestamp_ms: consensus_commit_prologue.commit_timestamp_ms, - consensus_commit_digest: consensus_commit_prologue + 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) => { + InternalTxnKind::AuthenticatorStateUpdateV1(authenticator_state_update_v1) => { TransactionKind::AuthenticatorStateUpdateV1(AuthenticatorStateUpdateV1 { - epoch: authenticator_state_update.epoch, - round: authenticator_state_update.round, - new_active_jwks: authenticator_state_update + 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 { @@ -353,7 +353,7 @@ impl From for TransactionKind { epoch: jwk.epoch, }) .collect(), - authenticator_obj_initial_shared_version: authenticator_state_update + authenticator_obj_initial_shared_version: authenticator_state_update_v1 .authenticator_obj_initial_shared_version .value(), }) @@ -416,8 +416,8 @@ impl From for crate::transaction::TransactionKind { .collect(), }) } - TransactionKind::ConsensusCommitPrologueV1(consensus_commit_prologue) => { - let consensus_determined_version_assignments = match consensus_commit_prologue.consensus_determined_version_assignments { + 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| @@ -434,22 +434,22 @@ impl From for crate::transaction::TransactionKind { }; Self::ConsensusCommitPrologueV1( crate::messages_consensus::ConsensusCommitPrologueV1 { - epoch: consensus_commit_prologue.epoch, - round: consensus_commit_prologue.round, - sub_dag_index: consensus_commit_prologue.sub_dag_index, - commit_timestamp_ms: consensus_commit_prologue.commit_timestamp_ms, - consensus_commit_digest: consensus_commit_prologue + 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) => { + TransactionKind::AuthenticatorStateUpdateV1(authenticator_state_update_v1) => { Self::AuthenticatorStateUpdateV1(crate::transaction::AuthenticatorStateUpdateV1 { - epoch: authenticator_state_update.epoch, - round: authenticator_state_update.round, - new_active_jwks: authenticator_state_update + 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 { @@ -466,7 +466,7 @@ impl From for crate::transaction::TransactionKind { epoch: jwk.epoch, }) .collect(), - authenticator_obj_initial_shared_version: authenticator_state_update + authenticator_obj_initial_shared_version: authenticator_state_update_v1 .authenticator_obj_initial_shared_version .into(), }) From 2ecb8ef6c17aaa8d7969999b0ff2dfa04111d914 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Wed, 5 Feb 2025 13:21:13 -0500 Subject: [PATCH 08/12] newline --- crates/iota-core/tests/staged/iota.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/iota-core/tests/staged/iota.yaml b/crates/iota-core/tests/staged/iota.yaml index 61509c89756..f1aca5cb170 100644 --- a/crates/iota-core/tests/staged/iota.yaml +++ b/crates/iota-core/tests/staged/iota.yaml @@ -1031,3 +1031,4 @@ ZkLoginAuthenticatorAsBytes: ZkLoginPublicIdentifier: NEWTYPESTRUCT: SEQ: U8 + From a576eeefa83eaf3cd5da234ed88649a10616258e Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Thu, 6 Feb 2025 08:32:07 -0500 Subject: [PATCH 09/12] Revert field rename --- crates/iota-core/tests/staged/iota.yaml | 3 +-- .../src/types/transaction_block_kind/end_of_epoch.rs | 2 +- crates/iota-rest-api/openapi/openapi.json | 4 ++-- crates/iota-types/src/iota_sdk2_conversions.rs | 4 ++-- crates/iota-types/src/transaction.rs | 6 +++--- iota-execution/latest/iota-adapter/src/execution_engine.rs | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/iota-core/tests/staged/iota.yaml b/crates/iota-core/tests/staged/iota.yaml index f1aca5cb170..4b5a6166c15 100644 --- a/crates/iota-core/tests/staged/iota.yaml +++ b/crates/iota-core/tests/staged/iota.yaml @@ -29,7 +29,7 @@ Argument: AuthenticatorStateExpire: STRUCT: - min_epoch: U64 - - authenticator_object_initial_shared_version: + - authenticator_obj_initial_shared_version: TYPENAME: SequenceNumber AuthenticatorStateUpdateV1: STRUCT: @@ -1031,4 +1031,3 @@ ZkLoginAuthenticatorAsBytes: ZkLoginPublicIdentifier: NEWTYPESTRUCT: SEQ: U8 - 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 b9424a742c8..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 @@ -238,7 +238,7 @@ impl AuthenticatorStateExpireTransaction { /// The initial version that the AuthenticatorStateUpdate was shared at. async fn authenticator_obj_initial_shared_version(&self) -> UInt53 { self.native - .authenticator_object_initial_shared_version + .authenticator_obj_initial_shared_version .value() .into() } diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index 82cdcfb79d0..65efd085b8c 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -1939,12 +1939,12 @@ { "type": "object", "required": [ - "authenticator_object_initial_shared_version", + "authenticator_obj_initial_shared_version", "kind", "min_epoch" ], "properties": { - "authenticator_object_initial_shared_version": { + "authenticator_obj_initial_shared_version": { "description": "The initial version of the authenticator object that it was shared at.", "type": "string", "format": "u64" diff --git a/crates/iota-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index 487f6fd72b7..16f6a12a173 100644 --- a/crates/iota-types/src/iota_sdk2_conversions.rs +++ b/crates/iota-types/src/iota_sdk2_conversions.rs @@ -521,7 +521,7 @@ impl From for EndOfEpochTransacti ) => EndOfEpochTransactionKind::AuthenticatorStateExpire(AuthenticatorStateExpire { min_epoch: authenticator_state_expire.min_epoch, authenticator_object_initial_shared_version: authenticator_state_expire - .authenticator_object_initial_shared_version + .authenticator_obj_initial_shared_version .value(), }), crate::transaction::EndOfEpochTransactionKind::BridgeStateCreate(chain_identifier) => { @@ -567,7 +567,7 @@ impl From for crate::transaction::EndOfEpochTransacti EndOfEpochTransactionKind::AuthenticatorStateExpire(authenticator_state_expire) => { Self::AuthenticatorStateExpire(crate::transaction::AuthenticatorStateExpire { min_epoch: authenticator_state_expire.min_epoch, - authenticator_object_initial_shared_version: authenticator_state_expire + authenticator_obj_initial_shared_version: authenticator_state_expire .authenticator_object_initial_shared_version .into(), }) diff --git a/crates/iota-types/src/transaction.rs b/crates/iota-types/src/transaction.rs index d63c40bfc66..e75e151576c 100644 --- a/crates/iota-types/src/transaction.rs +++ b/crates/iota-types/src/transaction.rs @@ -217,12 +217,12 @@ pub struct AuthenticatorStateExpire { /// expire JWKs that have a lower epoch than this pub min_epoch: u64, /// The initial version of the authenticator object that it was shared at. - pub authenticator_object_initial_shared_version: SequenceNumber, + pub authenticator_obj_initial_shared_version: SequenceNumber, } impl AuthenticatorStateExpire { pub fn authenticator_obj_initial_shared_version(&self) -> SequenceNumber { - self.authenticator_object_initial_shared_version + self.authenticator_obj_initial_shared_version } } @@ -330,7 +330,7 @@ impl EndOfEpochTransactionKind { ) -> Self { Self::AuthenticatorStateExpire(AuthenticatorStateExpire { min_epoch, - authenticator_object_initial_shared_version: authenticator_obj_initial_shared_version, + authenticator_obj_initial_shared_version, }) } diff --git a/iota-execution/latest/iota-adapter/src/execution_engine.rs b/iota-execution/latest/iota-adapter/src/execution_engine.rs index 0df85f13af8..9b9128532b6 100644 --- a/iota-execution/latest/iota-adapter/src/execution_engine.rs +++ b/iota-execution/latest/iota-adapter/src/execution_engine.rs @@ -1175,7 +1175,7 @@ mod checked { vec![ CallArg::Object(ObjectArg::SharedObject { id: IOTA_AUTHENTICATOR_STATE_OBJECT_ID, - initial_shared_version: expire.authenticator_object_initial_shared_version, + initial_shared_version: expire.authenticator_obj_initial_shared_version, mutable: true, }), CallArg::Pure(bcs::to_bytes(&expire.min_epoch).unwrap()), From 053597243a3436003e5ec02146d894b1fa2d5693 Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Thu, 6 Feb 2025 09:03:58 -0500 Subject: [PATCH 10/12] fix tests --- crates/iota-core/tests/staged/iota.yaml | 1 + crates/iota-rest-api/openapi/openapi.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/iota-core/tests/staged/iota.yaml b/crates/iota-core/tests/staged/iota.yaml index 4b5a6166c15..8d4074f0ea6 100644 --- a/crates/iota-core/tests/staged/iota.yaml +++ b/crates/iota-core/tests/staged/iota.yaml @@ -1031,3 +1031,4 @@ ZkLoginAuthenticatorAsBytes: ZkLoginPublicIdentifier: NEWTYPESTRUCT: SEQ: U8 + diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index 65efd085b8c..82cdcfb79d0 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -1939,12 +1939,12 @@ { "type": "object", "required": [ - "authenticator_obj_initial_shared_version", + "authenticator_object_initial_shared_version", "kind", "min_epoch" ], "properties": { - "authenticator_obj_initial_shared_version": { + "authenticator_object_initial_shared_version": { "description": "The initial version of the authenticator object that it was shared at.", "type": "string", "format": "u64" From cb8e85a7b1a8ab17888f46db83e967980991293b Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Thu, 6 Feb 2025 12:07:24 -0500 Subject: [PATCH 11/12] revert field name --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/iota-rest-api/openapi/openapi.json | 4 ++-- crates/iota-types/src/iota_sdk2_conversions.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c1f062f220e..0ff25fe0792 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7855,7 +7855,7 @@ dependencies = [ [[package]] name = "iota-sdk-types" version = "0.0.2" -source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=c1775f631f5327913353dcfebd98c19dadfdf9c7#c1775f631f5327913353dcfebd98c19dadfdf9c7" +source = "git+https://github.com/iotaledger/iota-rust-sdk.git?rev=b3b33187aaad4d5b70f511627832c2efd525ced7#b3b33187aaad4d5b70f511627832c2efd525ced7" dependencies = [ "base64ct", "bcs", diff --git a/Cargo.toml b/Cargo.toml index 0f73a068140..8f3cf49b8ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -272,7 +272,7 @@ 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 = "c1775f631f5327913353dcfebd98c19dadfdf9c7", features = ["hash", "serde", "schemars"] } +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"] } diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index 82cdcfb79d0..65efd085b8c 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -1939,12 +1939,12 @@ { "type": "object", "required": [ - "authenticator_object_initial_shared_version", + "authenticator_obj_initial_shared_version", "kind", "min_epoch" ], "properties": { - "authenticator_object_initial_shared_version": { + "authenticator_obj_initial_shared_version": { "description": "The initial version of the authenticator object that it was shared at.", "type": "string", "format": "u64" diff --git a/crates/iota-types/src/iota_sdk2_conversions.rs b/crates/iota-types/src/iota_sdk2_conversions.rs index 16f6a12a173..3d4c6be2aed 100644 --- a/crates/iota-types/src/iota_sdk2_conversions.rs +++ b/crates/iota-types/src/iota_sdk2_conversions.rs @@ -520,7 +520,7 @@ impl From for EndOfEpochTransacti authenticator_state_expire, ) => EndOfEpochTransactionKind::AuthenticatorStateExpire(AuthenticatorStateExpire { min_epoch: authenticator_state_expire.min_epoch, - authenticator_object_initial_shared_version: authenticator_state_expire + authenticator_obj_initial_shared_version: authenticator_state_expire .authenticator_obj_initial_shared_version .value(), }), @@ -568,7 +568,7 @@ impl From for crate::transaction::EndOfEpochTransacti Self::AuthenticatorStateExpire(crate::transaction::AuthenticatorStateExpire { min_epoch: authenticator_state_expire.min_epoch, authenticator_obj_initial_shared_version: authenticator_state_expire - .authenticator_object_initial_shared_version + .authenticator_obj_initial_shared_version .into(), }) } From 9a85eb43b74b56285528c61e5883348e2efdc9bb Mon Sep 17 00:00:00 2001 From: Chloe Martin Date: Thu, 6 Feb 2025 12:08:11 -0500 Subject: [PATCH 12/12] review --- crates/iota-types/src/messages_consensus.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-types/src/messages_consensus.rs b/crates/iota-types/src/messages_consensus.rs index dbafa8dda49..46def77b51f 100644 --- a/crates/iota-types/src/messages_consensus.rs +++ b/crates/iota-types/src/messages_consensus.rs @@ -446,7 +446,7 @@ fn test_jwk_compatibility() { // Ensure that the JWK and JwkId structs in fastcrypto do not change formats. // If this test breaks DO NOT JUST UPDATE THE EXPECTED BYTES. Instead, add a // local JWK or JwkId struct that mirrors the fastcrypto struct, use it in - // AuthenticatorStateUpdateV1, and add Into/From as necessary. + // AuthenticatorStateUpdate, and add Into/From as necessary. let jwk = JWK { kty: "a".to_string(), e: "b".to_string(),