diff --git a/Cargo.toml b/Cargo.toml index cb739fa..49b63ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,9 +55,9 @@ move-command-line-common = { path = "external-crates/move/crates/move-command-li move-core-types = { path = "external-crates/move/crates/move-core-types" } # move-disassembler = { path = "external-crates/move/crates/move-disassembler" } move-ir-types = { path = "external-crates/move/crates/move-ir-types" } -move-vm-test-utils = { path = "external-crates/move/crates/move-vm-test-utils/", features = [ - "tiered-gas", -] } +# move-vm-test-utils = { path = "external-crates/move/crates/move-vm-test-utils/", features = [ +# "tiered-gas", +# ] } move-vm-types = { path = "external-crates/move/crates/move-vm-types" } move-vm-profiler = { path = "external-crates/move/crates/move-vm-profiler" } num-traits = "0.2.18" @@ -98,16 +98,7 @@ proptest-derive = "0.3.0" serde_yaml = "0.8.26" expect-test = "1.4.0" -[[bench]] -name = "accumulator_bench" -harness = false - [features] default = [] test-utils = [] -gas-profiler = [ - "move-vm-profiler/gas-profiler", - "move-vm-types/gas-profiler", - "move-vm-test-utils/gas-profiler", -] fuzzing = ["move-core-types/fuzzing"] diff --git a/benches/accumulator_bench.rs b/benches/accumulator_bench.rs deleted file mode 100644 index 853e3ca..0000000 --- a/benches/accumulator_bench.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use fastcrypto::hash::MultisetHash; -use sui_types::accumulator::Accumulator; -use sui_types::base_types::ObjectDigest; - -use criterion::*; - -fn accumulator_benchmark(c: &mut Criterion) { - { - let digests: Vec<_> = (0..1_000).map(|_| ObjectDigest::random()).collect(); - let mut accumulator = Accumulator::default(); - - let mut group = c.benchmark_group("accumulator"); - group.throughput(Throughput::Elements(digests.len() as u64)); - - group.bench_function("accumulate_digests", |b| { - b.iter(|| accumulator.insert_all(&digests)) - }); - } - - { - let mut group = c.benchmark_group("accumulator"); - group.throughput(Throughput::Elements(1)); - - let mut accumulator = Accumulator::default(); - let point = { - let digest = ObjectDigest::random(); - let mut accumulator = Accumulator::default(); - accumulator.insert(digest); - accumulator - }; - group.bench_function("sum_accumulators", |b| b.iter(|| accumulator.union(&point))); - } -} - -criterion_group!(benches, accumulator_benchmark); -criterion_main!(benches); diff --git a/src/gas_model/tables.rs b/src/gas_model/tables.rs index da8b0ad..59e9046 100644 --- a/src/gas_model/tables.rs +++ b/src/gas_model/tables.rs @@ -910,16 +910,3 @@ pub fn initial_cost_schedule_v5() -> CostTable { stack_height_tiers, } } - -// Convert from our representation of gas costs to the type that the MoveVM expects for unit tests. -// We don't want our gas depending on the MoveVM test utils and we don't want to fix our -// representation to whatever is there, so instead we perform this translation from our gas units -// and cost schedule to the one expected by the Move unit tests. -pub fn initial_cost_schedule_for_unit_tests() -> move_vm_test_utils::gas_schedule::CostTable { - let table = initial_cost_schedule_v5(); - move_vm_test_utils::gas_schedule::CostTable { - instruction_tiers: table.instruction_tiers.into_iter().collect(), - stack_height_tiers: table.stack_height_tiers.into_iter().collect(), - stack_size_tiers: table.stack_size_tiers.into_iter().collect(), - } -} diff --git a/tests/digests_tests.rs b/tests/digests_tests.rs deleted file mode 100644 index 9fcd67b..0000000 --- a/tests/digests_tests.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use std::str::FromStr; - -use sui_types::digests::{ - CheckpointContentsDigest, CheckpointDigest, EffectsAuxDataDigest, ObjectDigest, - TransactionDigest, TransactionEventsDigest, -}; - -macro_rules! define_digest_test { - ($name:ident, $ty:ty) => { - #[test] - fn $name() { - let invalid_b58 = "$$%"; - let short_b58 = "AAAA"; - let good_b58 = "DMBdBZnpYR4EeTXzXL8A6BtVafqGjAWGsFZhP2zJYmXU"; - let good_digest_arr = [ - 0xb7u8, 0x77, 0xdf, 0x27, 0xcc, 0x44, 0xdc, 0x04, 0x7e, 0xea, 0xe8, 0x92, 0x6a, - 0xf9, 0x62, 0x0c, 0xaa, 0xd1, 0x62, 0xcb, 0xf3, 0x4d, 0x9a, 0xe1, 0xb1, 0xd8, 0xa9, - 0x65, 0x33, 0x74, 0x4f, 0xdf, - ]; - - let invalid_digest = <$ty>::from_str(invalid_b58); - let short_digest = <$ty>::from_str(short_b58); - let good_digest = <$ty>::from_str(good_b58); - - assert!(invalid_digest.is_err()); - assert!(short_digest.is_err()); - assert_eq!(good_digest.unwrap(), <$ty>::new(good_digest_arr)); - } - }; -} - -define_digest_test!( - test_checkpoint_contents_digest_from_str, - CheckpointContentsDigest -); - -define_digest_test!(test_checkpoint_digest_from_str, CheckpointDigest); - -define_digest_test!(test_effects_aux_data_digest_from_str, EffectsAuxDataDigest); - -define_digest_test!(test_object_digest_from_str, ObjectDigest); - -define_digest_test!(test_transaction_digest_from_str, TransactionDigest); - -define_digest_test!( - test_transaction_events_digest_from_str, - TransactionEventsDigest -); diff --git a/tests/serde_tests.rs b/tests/serde_tests.rs deleted file mode 100644 index cd70568..0000000 --- a/tests/serde_tests.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -use move_core_types::language_storage::StructTag; -use serde::Serialize; -use serde_json::Value; -use serde_with::serde_as; -use std::str::FromStr; -use sui_types::base_types::ObjectType; -use sui_types::parse_sui_struct_tag; -use sui_types::sui_serde::SuiStructTag; - -#[test] -fn test_struct_tag_serde() { - let tag = parse_sui_struct_tag("0x7f89cdffd8968affa0b47bef91adc5314e19509080470c45bfd434cd83a766b::suifrens::SuiFren<0x7f89cdffd8968affa0b47bef91adc5314e19509080470c45bfd434cd83a766b::capy::Capy>").unwrap(); - #[serde_as] - #[derive(Serialize)] - struct TestStructTag(#[serde_as(as = "SuiStructTag")] StructTag); - - // serialize to json should not trim the leading 0 - let Value::String(json) = serde_json::to_value(&TestStructTag(tag.clone())).unwrap() else { - panic!() - }; - assert_eq!(json, "0x07f89cdffd8968affa0b47bef91adc5314e19509080470c45bfd434cd83a766b::suifrens::SuiFren<0x07f89cdffd8968affa0b47bef91adc5314e19509080470c45bfd434cd83a766b::capy::Capy>"); - - let tag2 = parse_sui_struct_tag(&json).unwrap(); - assert_eq!(tag, tag2); -} - -#[test] -fn test_object_type_to_string() { - let object_type = ObjectType::from_str( - "0x1a1aa18691be519899bf5187f5ce80af629407dd4f68d4175b99f4dc09497c1::custodian::AccountCap", - ) - .unwrap(); - assert_eq!( - object_type.to_string(), - "0x01a1aa18691be519899bf5187f5ce80af629407dd4f68d4175b99f4dc09497c1::custodian::AccountCap" - ); -} diff --git a/tests/staged/exec_failure_status.yaml b/tests/staged/exec_failure_status.yaml deleted file mode 100644 index f2506d9..0000000 --- a/tests/staged/exec_failure_status.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -0: InsufficientGas -1: InvalidGasObject -2: InvariantViolation -3: FeatureNotYetSupported -4: MoveObjectTooBig -5: MovePackageTooBig -6: CircularObjectOwnership -7: InsufficientCoinBalance -8: CoinBalanceOverflow -9: PublishErrorNonZeroAddress -10: SuiMoveVerificationError -11: MovePrimitiveRuntimeError -12: MoveAbort -13: VMVerificationOrDeserializationError -14: VMInvariantViolation -15: FunctionNotFound -16: ArityMismatch -17: TypeArityMismatch -18: NonEntryFunctionInvoked -19: CommandArgumentError -20: TypeArgumentError -21: UnusedValueWithoutDrop -22: InvalidPublicFunctionReturnType -23: InvalidTransferObject -24: EffectsTooLarge -25: PublishUpgradeMissingDependency -26: PublishUpgradeDependencyDowngrade -27: PackageUpgradeError -28: WrittenObjectsTooLarge -29: CertificateDenied -30: SuiMoveVerificationTimedout -31: SharedObjectOperationNotAllowed -32: InputObjectDeleted -33: ExecutionCancelledDueToSharedObjectCongestion