Skip to content

Commit

Permalink
fix: fix workspace build after the external crates updating
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriyr committed Dec 23, 2024
1 parent b5165fc commit a62259b
Show file tree
Hide file tree
Showing 46 changed files with 293 additions and 282 deletions.
17 changes: 16 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions crates/iota-core/src/unit_tests/authority_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use std::{collections::HashSet, convert::TryInto, env, fs};
use std::{collections::HashSet, convert::TryInto, env, fs, str::FromStr};

use bcs;
use fastcrypto::traits::KeyPair;
Expand Down Expand Up @@ -47,7 +47,6 @@ use move_core_types::{
ident_str,
identifier::{IdentStr, Identifier},
language_storage::{StructTag, TypeTag},
parser::parse_type_tag,
};
use rand::{
Rng, SeedableRng,
Expand Down Expand Up @@ -3676,7 +3675,7 @@ async fn test_dynamic_field_struct_name_parsing() {
assert!(matches!(fields[0].type_, DynamicFieldType::DynamicField));
assert_eq!(json!({"name_str": "Test Name"}), fields[0].name.value);
assert_eq!(
parse_type_tag("0x0::object_basics::Name").unwrap(),
TypeTag::from_str("0x0::object_basics::Name").unwrap(),
fields[0].name.type_
)
}
Expand All @@ -3688,7 +3687,10 @@ async fn test_dynamic_field_bytearray_name_parsing() {

assert_eq!(fields.len(), 1);
assert!(matches!(fields[0].type_, DynamicFieldType::DynamicField));
assert_eq!(parse_type_tag("vector<u8>").unwrap(), fields[0].name.type_);
assert_eq!(
TypeTag::from_str("vector<u8>").unwrap(),
fields[0].name.type_
);
assert_eq!(json!("Test Name".as_bytes()), fields[0].name.value);
}

Expand All @@ -3699,7 +3701,7 @@ async fn test_dynamic_field_address_name_parsing() {

assert_eq!(fields.len(), 1);
assert!(matches!(fields[0].type_, DynamicFieldType::DynamicField));
assert_eq!(parse_type_tag("address").unwrap(), fields[0].name.type_);
assert_eq!(TypeTag::from_str("address").unwrap(), fields[0].name.type_);
assert_eq!(json!(sender), fields[0].name.value);
}

Expand All @@ -3711,7 +3713,7 @@ async fn test_dynamic_object_field_struct_name_parsing() {
assert!(matches!(fields[0].type_, DynamicFieldType::DynamicObject));
assert_eq!(json!({"name_str": "Test Name"}), fields[0].name.value);
assert_eq!(
parse_type_tag("0x0::object_basics::Name").unwrap(),
TypeTag::from_str("0x0::object_basics::Name").unwrap(),
fields[0].name.type_
)
}
Expand All @@ -3723,7 +3725,10 @@ async fn test_dynamic_object_field_bytearray_name_parsing() {

assert_eq!(fields.len(), 1);
assert!(matches!(fields[0].type_, DynamicFieldType::DynamicObject));
assert_eq!(parse_type_tag("vector<u8>").unwrap(), fields[0].name.type_);
assert_eq!(
TypeTag::from_str("vector<u8>").unwrap(),
fields[0].name.type_
);
assert_eq!(json!("Test Name".as_bytes()), fields[0].name.value);
}

Expand All @@ -3734,7 +3739,7 @@ async fn test_dynamic_object_field_address_name_parsing() {

assert_eq!(fields.len(), 1);
assert!(matches!(fields[0].type_, DynamicFieldType::DynamicObject));
assert_eq!(parse_type_tag("address").unwrap(), fields[0].name.type_);
assert_eq!(TypeTag::from_str("address").unwrap(), fields[0].name.type_);
assert_eq!(json!(sender), fields[0].name.value);
}

Expand Down
14 changes: 8 additions & 6 deletions crates/iota-core/src/unit_tests/subscription_handler_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,23 @@ impl TestEvent {
fn layout() -> MoveStructLayout {
MoveStructLayout {
type_: Self::type_(),
fields: vec![
fields: Box::new(vec![
MoveFieldLayout::new(ident_str!("creator").to_owned(), MoveTypeLayout::Address),
MoveFieldLayout::new(
ident_str!("name").to_owned(),
MoveTypeLayout::Struct(UTF8String::layout()),
MoveTypeLayout::Struct(Box::new(UTF8String::layout())),
),
MoveFieldLayout::new(
ident_str!("data").to_owned(),
MoveTypeLayout::Vector(Box::new(MoveTypeLayout::U64)),
),
MoveFieldLayout::new(
ident_str!("coins").to_owned(),
MoveTypeLayout::Vector(Box::new(MoveTypeLayout::Struct(GasCoin::layout()))),
MoveTypeLayout::Vector(Box::new(MoveTypeLayout::Struct(Box::new(
GasCoin::layout(),
)))),
),
],
]),
}
}
}
Expand Down Expand Up @@ -128,10 +130,10 @@ impl UTF8String {
fn layout() -> MoveStructLayout {
MoveStructLayout {
type_: Self::type_(),
fields: vec![MoveFieldLayout::new(
fields: Box::new(vec![MoveFieldLayout::new(
ident_str!("bytes").to_owned(),
MoveTypeLayout::Vector(Box::new(MoveTypeLayout::U8)),
)],
)]),
}
}
}
23 changes: 2 additions & 21 deletions crates/iota-framework/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use iota_types::{
storage::ObjectStore,
};
use move_binary_format::{
CompiledModule,
binary_config::BinaryConfig,
compatibility::Compatibility,
file_format::{Ability, AbilitySet},
CompiledModule, binary_config::BinaryConfig, compatibility::Compatibility,
};
use move_core_types::gas_algebra::InternalGas;
use once_cell::sync::Lazy;
Expand Down Expand Up @@ -222,23 +219,7 @@ pub async fn compare_system_package<S: ObjectStore>(
return Some(cur_ref);
}

let compatibility = Compatibility {
check_datatype_and_pub_function_linking: true,
check_datatype_layout: true,
check_friend_linking: false,
// Checking `entry` linkage is required because system packages are updated in-place, and a
// transaction that was rolled back to make way for reconfiguration should still be runnable
// after a reconfiguration that upgraded the framework.
//
// A transaction that calls a system function that was previously `entry` and is now private
// will fail because its entrypoint became no longer callable. A transaction that calls a
// system function that was previously `public entry` and is now just `public` could also
// fail if one of its mutable inputs was being used in another private `entry` function.
check_private_entry_linking: true,
disallowed_new_abilities: AbilitySet::singleton(Ability::Key),
disallow_change_datatype_type_params: true,
disallow_new_variants: true,
};
let compatibility = Compatibility::framework_upgrade_check();

let new_pkg = new_object
.data
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-graphql-rpc/src/types/move_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ impl TryFrom<A::MoveTypeLayout> for MoveTypeLayout {
TL::Address => Self::Address,

TL::Vector(v) => Self::Vector(Box::new(Self::try_from(*v)?)),
TL::Struct(s) => Self::Struct(s.try_into()?),
TL::Enum(e) => Self::Enum(e.try_into()?),
TL::Struct(s) => Self::Struct((*s).try_into()?),
TL::Enum(e) => Self::Enum((*e).try_into()?),
})
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/iota-graphql-rpc/src/types/move_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ mod tests {

macro_rules! struct_layout {
($type:literal { $($name:literal : $layout:expr),* $(,)?}) => {
A::MoveTypeLayout::Struct(S {
A::MoveTypeLayout::Struct(Box::new(S {
type_: StructTag::from_str($type).expect("Failed to parse struct"),
fields: vec![$(MoveFieldLayout {
fields: Box::new(vec![$(MoveFieldLayout {
name: ident_str!($name).to_owned(),
layout: $layout,
}),*]
})
}),*])
}))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/iota-indexer/src/handlers/checkpoint_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ async fn get_move_struct_layout_map(
move_core_types::annotated_value::MoveStructLayout,
),
IndexerError,
>((struct_tag, move_struct_layout))
>((struct_tag, *move_struct_layout))
}
})
.collect::<Vec<_>>();
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-indexer/src/models/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl StoredObject {
)),
}?;

Ok(ObjectRead::Exists(oref, object, Some(move_struct_layout)))
Ok(ObjectRead::Exists(oref, object, Some(*move_struct_layout)))
}

pub async fn try_into_expectant_dynamic_field_info(
Expand Down
Loading

0 comments on commit a62259b

Please sign in to comment.