diff --git a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/call_function.exp b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/call_function.exp index 24e4a98414a62a..86bd0baf660c9c 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/call_function.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/call_function.exp @@ -4,7 +4,7 @@ task 2 'run'. lines 32-32: Events: { type: 0x1::transaction_fee::FeeStatement - data: "36000000000000000300000000000000010000000000000050c30000000000000000000000000000" + data: "30000000000000000300000000000000010000000000000030ac0000000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 @@ -12,7 +12,7 @@ task 3 'run'. lines 34-34: Events: { type: 0x1::transaction_fee::FeeStatement - data: "04000000000000000300000000000000020000000000000000000000000000000000000000000000" + data: "05000000000000000300000000000000020000000000000018010000000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 diff --git a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/table.exp b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/table.exp index ba1cc33b317337..5ece525a662c6e 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/table.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/aptos_test_harness/table.exp @@ -10,7 +10,7 @@ Events: } { type: 0x1::transaction_fee::FeeStatement - data: "6a0000000000000004000000000000000200000000000000a0860100000000000000000000000000" + data: "64000000000000000400000000000000020000000000000028720100000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 @@ -36,7 +36,7 @@ Events: } { type: 0x1::transaction_fee::FeeStatement - data: "9f0000000000000006000000000000000300000000000000f0490200000000000000000000000000" + data: "9b0000000000000006000000000000000300000000000000c83a0200000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 @@ -96,7 +96,7 @@ Events: } { type: 0x1::transaction_fee::FeeStatement - data: "6c0000000000000005000000000000000300000000000000a0860100000000000000000000000000" + data: "6b000000000000000500000000000000030000000000000018820100000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 @@ -116,7 +116,7 @@ Events: } { type: 0x1::transaction_fee::FeeStatement - data: "6c0000000000000005000000000000000300000000000000a08601000000000050c3000000000000" + data: "6b0000000000000005000000000000000300000000000000b88201000000000058bb000000000000" }mutable inputs after call: local#0: 0 return values: 0 diff --git a/aptos-move/aptos-transactional-test-harness/tests/v2-tests/smoke_test.exp b/aptos-move/aptos-transactional-test-harness/tests/v2-tests/smoke_test.exp index 73cea4f9847d52..bd21aa0f47b6d9 100644 --- a/aptos-move/aptos-transactional-test-harness/tests/v2-tests/smoke_test.exp +++ b/aptos-move/aptos-transactional-test-harness/tests/v2-tests/smoke_test.exp @@ -4,7 +4,7 @@ task 2 'run'. lines 36-36: Events: { type: 0x1::transaction_fee::FeeStatement - data: "36000000000000000300000000000000010000000000000050c30000000000000000000000000000" + data: "30000000000000000300000000000000010000000000000030ac0000000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 @@ -12,7 +12,7 @@ task 3 'run'. lines 38-38: Events: { type: 0x1::transaction_fee::FeeStatement - data: "04000000000000000300000000000000020000000000000000000000000000000000000000000000" + data: "05000000000000000300000000000000020000000000000018010000000000000000000000000000" }mutable inputs after call: local#0: 0 return values: 0 diff --git a/aptos-move/e2e-move-tests/src/tests/state_metadata.rs b/aptos-move/e2e-move-tests/src/tests/state_metadata.rs index f83c7588bdbf46..ebc475ef123864 100644 --- a/aptos-move/e2e-move-tests/src/tests/state_metadata.rs +++ b/aptos-move/e2e-move-tests/src/tests/state_metadata.rs @@ -10,7 +10,7 @@ use move_core_types::{account_address::AccountAddress, parser::parse_struct_tag} #[test] fn test_metadata_tracking() { - let mut harness = MoveHarness::new(); + let mut harness = MoveHarness::new_with_features(vec![], vec![]); harness.new_epoch(); // so that timestamp is not 0 (rather, 7200000001) let timestamp = CurrentTimeMicroseconds { microseconds: 7200000001, @@ -26,7 +26,10 @@ fn test_metadata_tracking() { let account1 = harness.new_account_at(address1); // Disable storage slot metadata tracking - harness.enable_features(vec![], vec![FeatureFlag::STORAGE_SLOT_METADATA]); + harness.enable_features(vec![], vec![ + FeatureFlag::STORAGE_SLOT_METADATA, + FeatureFlag::REFUNDABLE_BYTES, + ]); // Create and fund account2 harness.run_transaction_payload( &account1, @@ -34,50 +37,54 @@ fn test_metadata_tracking() { ); // Observe that metadata is not tracked for address2 resources assert_eq!( - harness.read_resource_metadata(&address2, coin_store.clone()), - Some(StateValueMetadata::none()), + harness + .read_resource_metadata(&address2, coin_store.clone()) + .unwrap(), + StateValueMetadata::none(), ); // Enable storage slot metadata tracking - harness.enable_features(vec![FeatureFlag::STORAGE_SLOT_METADATA], vec![]); + harness.enable_features( + vec![ + FeatureFlag::STORAGE_SLOT_METADATA, + FeatureFlag::REFUNDABLE_BYTES, + ], + vec![], + ); // Create and fund account3 harness.run_transaction_payload( &account1, aptos_cached_packages::aptos_stdlib::aptos_account_transfer(address3, 100), ); - let slot_fee = harness - .new_vm() - .gas_params() - .unwrap() - .vm - .txn - .legacy_storage_fee_per_state_slot_create - .into(); - assert!(slot_fee > 0); - // Observe that metadata is tracked for address3 resources - assert_eq!( - harness.read_resource_metadata(&address3, coin_store.clone()), - Some(StateValueMetadata::legacy(slot_fee, ×tamp)), - ); + let meta3a = harness + .read_resource_metadata(&address3, coin_store.clone()) + .unwrap(); + assert!(meta3a.slot_deposit() > 0); + assert!(meta3a.bytes_deposit() > 0); + assert_eq!(meta3a.creation_time_usecs(), timestamp.microseconds); - // Bump the timestamp and modify the resources, observe that metadata doesn't change. + // Bump the timestamp and modify the resource, observe that metadata doesn't change. harness.new_epoch(); harness.run_transaction_payload( &account1, - aptos_cached_packages::aptos_stdlib::aptos_account_transfer(address2, 100), + aptos_cached_packages::aptos_stdlib::aptos_account_transfer(address3, 100), ); + let meta3b = harness + .read_resource_metadata(&address3, coin_store.clone()) + .unwrap(); + assert_eq!(meta3a, meta3b); + + // However, enabling refundable_bytes does make StateValueMetadata::None automatically upgrade harness.run_transaction_payload( &account1, - aptos_cached_packages::aptos_stdlib::aptos_account_transfer(address3, 100), - ); - assert_eq!( - harness.read_resource_metadata(&address2, coin_store.clone()), - Some(StateValueMetadata::none()), + aptos_cached_packages::aptos_stdlib::aptos_account_transfer(address2, 100), ); assert_eq!( - harness.read_resource_metadata(&address3, coin_store), - Some(StateValueMetadata::legacy(slot_fee, ×tamp)), + harness + .read_resource_metadata(&address2, coin_store.clone()) + .unwrap(), + StateValueMetadata::new(0, 0, &CurrentTimeMicroseconds { microseconds: 0 }) ); } diff --git a/aptos-move/e2e-move-tests/src/tests/storage_refund.rs b/aptos-move/e2e-move-tests/src/tests/storage_refund.rs index 30a0fd8d1cc6fb..f0ea30d96da206 100644 --- a/aptos-move/e2e-move-tests/src/tests/storage_refund.rs +++ b/aptos-move/e2e-move-tests/src/tests/storage_refund.rs @@ -23,7 +23,10 @@ fn test_refunds() { ], vec![], ); - h.modify_gas_schedule(|params| params.vm.txn.max_execution_gas = 10_000_000_000.into()); + h.modify_gas_schedule(|params| { + params.vm.txn.max_execution_gas = 10_000_000_000.into(); + params.vm.txn.storage_fee_per_state_byte = 0.into(); // tested in DiskSpacePricing. + }); let mod_addr = AccountAddress::from_hex_literal("0xcafe").unwrap(); let user_addr = AccountAddress::from_hex_literal("0x100").unwrap(); let mod_acc = h.new_account_at(mod_addr); @@ -97,7 +100,7 @@ fn read_slot_fee_from_gas_schedule(h: &MoveHarness) -> u64 { .unwrap() .vm .txn - .legacy_storage_fee_per_state_slot_create + .storage_fee_per_state_slot .into(); assert!(slot_fee > 0); assert!(slot_fee > LEEWAY * 10);