Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 17 additions & 24 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ use iota_storage::{
use iota_types::committee::CommitteeTrait;
use iota_types::{
IOTA_SYSTEM_ADDRESS, TypeTag,
account::{AUTHENTICATOR_DF_NAME, AuthenticatorInfoV1},
account::{self, AuthenticatorInfoV1},
authenticator_state::get_authenticator_state,
base_types::*,
committee::{Committee, EpochId, ProtocolVersion},
crypto::{AuthoritySignInfo, AuthoritySignature, RandomnessRound, Signer, default_hash},
deny_list_v1::check_coin_deny_list_v1_during_signing,
digests::{ChainIdentifier, TransactionEventsDigest},
dynamic_field::{DynamicFieldInfo, DynamicFieldName, visitor as DFV},
dynamic_field::{self, DynamicFieldInfo, DynamicFieldName, visitor as DFV},
effects::{
InputSharedObject, SignedTransactionEffects, TransactionEffects, TransactionEffectsAPI,
TransactionEvents, VerifiedCertifiedTransactionEffects, VerifiedSignedTransactionEffects,
Expand Down Expand Up @@ -5287,33 +5287,26 @@ impl AuthorityState {
);
}

let authenticator_id = self.get_dynamic_field_object_id(
let authenticator_id = dynamic_field::derive_dynamic_field_id(
auth_account_object_id,
AuthenticatorInfoV1::tag().into(),
AUTHENTICATOR_DF_NAME.as_bytes(),
)?;
&account::authenticator_df_name_type_tag(),
&account::authenticator_df_name_as_bcs_bytes(),
)
.map_err(|_| UserInputError::UnableToGetMoveAuthenticatorId {
account_object_id: auth_account_object_id,
})?;

if let Some(authenticator_id) = authenticator_id {
let authenticator_info = self
.get_object_cache_reader()
.try_find_object_lt_or_eq_version(
authenticator_id,
auth_account_object_seq_number,
)?;
let authenticator_info = self
.get_object_cache_reader()
.try_find_object_lt_or_eq_version(authenticator_id, auth_account_object_seq_number)?;

if let Some(authenticator_info) = authenticator_info {
AuthenticatorInfoV1::try_from(authenticator_info)
} else {
Err(UserInputError::MoveAuthenticatorNotFound {
authenticator_object_id: authenticator_id,
account_object_id: auth_account_object_id,
account_object_version: auth_account_object_seq_number,
}
.into())
}
if let Some(authenticator_info) = authenticator_info {
AuthenticatorInfoV1::try_from(authenticator_info)
} else {
Err(UserInputError::UnableToGetMoveAuthenticatorId {
Err(UserInputError::MoveAuthenticatorNotFound {
authenticator_object_id: authenticator_id,
account_object_id: auth_account_object_id,
account_object_version: auth_account_object_seq_number,
}
.into())
}
Expand Down
16 changes: 15 additions & 1 deletion crates/iota-types/src/account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright (c) 2025 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use move_core_types::{ident_str, identifier::IdentStr, language_storage::StructTag};
use move_core_types::{
ident_str,
identifier::IdentStr,
language_storage::{StructTag, TypeTag},
};
use serde::{Deserialize, Serialize};

use crate::{
Expand Down Expand Up @@ -63,3 +67,13 @@ impl TryFrom<Object> for AuthenticatorInfoV1 {
})
}
}

pub fn authenticator_df_name_type_tag() -> TypeTag {
TypeTag::Vector(Box::new(TypeTag::U8))
}

pub fn authenticator_df_name_as_bcs_bytes() -> Vec<u8> {
bcs::to_bytes(&AUTHENTICATOR_DF_NAME).expect(
"authenticator dynamic field name serialization is expected to be finished without any errors",
)
}
Loading