Skip to content

Commit

Permalink
reordering of stack changes
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-aptos committed Nov 13, 2024
1 parent 82822ee commit ce5f67b
Showing 7 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
@@ -7,7 +7,9 @@ use crate::{
gas_feature_versions::{RELEASE_V1_18, RELEASE_V1_24},
gas_schedule::NativeGasParameters,
};
use aptos_gas_algebra::{InternalGas, InternalGasPerArg, InternalGasPerAbstractValueUnit, InternalGasPerByte};
use aptos_gas_algebra::{
InternalGas, InternalGasPerAbstractValueUnit, InternalGasPerArg, InternalGasPerByte,
};

crate::gas_schedule::macros::define_gas_parameters!(
MoveStdlibGasParameters,
2 changes: 1 addition & 1 deletion aptos-move/aptos-gas-schedule/src/ver.rs
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@
/// global operations.
/// - V1
/// - TBA
pub const LATEST_GAS_FEATURE_VERSION: u64 = gas_feature_versions::RELEASE_V1_23;
pub const LATEST_GAS_FEATURE_VERSION: u64 = gas_feature_versions::RELEASE_V1_24;

pub mod gas_feature_versions {
pub const RELEASE_V1_8: u64 = 11;
Original file line number Diff line number Diff line change
@@ -131,6 +131,7 @@ pub enum FeatureFlag {
FederatedKeyless,
TransactionSimulationEnhancement,
CollectionOwner,
NativeMemoryOperations,
EnableLoaderV2,
}

@@ -348,6 +349,7 @@ impl From<FeatureFlag> for AptosFeatureFlag {
AptosFeatureFlag::TRANSACTION_SIMULATION_ENHANCEMENT
},
FeatureFlag::CollectionOwner => AptosFeatureFlag::COLLECTION_OWNER,
FeatureFlag::NativeMemoryOperations => AptosFeatureFlag::NATIVE_MEMORY_OPERATIONS,
FeatureFlag::EnableLoaderV2 => AptosFeatureFlag::ENABLE_LOADER_V2,
}
}
@@ -492,6 +494,7 @@ impl From<AptosFeatureFlag> for FeatureFlag {
FeatureFlag::TransactionSimulationEnhancement
},
AptosFeatureFlag::COLLECTION_OWNER => FeatureFlag::CollectionOwner,
AptosFeatureFlag::NATIVE_MEMORY_OPERATIONS => FeatureFlag::NativeMemoryOperations,
AptosFeatureFlag::ENABLE_LOADER_V2 => FeatureFlag::EnableLoaderV2,
}
}
1 change: 1 addition & 0 deletions aptos-move/framework/move-stdlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ publish = false
[dependencies]
aptos-gas-schedule = { workspace = true }
aptos-native-interface = { workspace = true }
aptos-types = { workspace = true }
move-core-types = { path = "../../../third_party/move/move-core/types" }
move-vm-runtime = { path = "../../../third_party/move/move-vm/runtime" }
move-vm-types = { path = "../../../third_party/move/move-vm/types" }
8 changes: 6 additions & 2 deletions aptos-move/framework/move-stdlib/src/natives/vector.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

//! Implementation of native functions (non-bytecode instructions) for vector.
use super::mem::get_feature_not_available_error;
use aptos_gas_schedule::gas_params::natives::move_stdlib::{
VECTOR_MOVE_RANGE_BASE, VECTOR_MOVE_RANGE_PER_INDEX_MOVED,
};
@@ -28,6 +27,9 @@ use std::collections::VecDeque;
/// Given input positions/lengths are outside of vector boundaries.
pub const EINDEX_OUT_OF_BOUNDS: u64 = 1;

/// The feature is not enabled.
pub const EFEATURE_NOT_ENABLED: u64 = 2;

/***************************************************************************************************
* native fun move_range<T>(from: &mut vector<T>, removal_position: u64, length: u64, to: &mut vector<T>, insert_position: u64)
*
@@ -43,7 +45,9 @@ fn native_move_range(
.get_feature_flags()
.is_native_memory_operations_enabled()
{
return Err(get_feature_not_available_error());
return Err(SafeNativeError::Abort {
abort_code: error::unavailable(EFEATURE_NOT_ENABLED),
});
}

context.charge(VECTOR_MOVE_RANGE_BASE)?;
7 changes: 7 additions & 0 deletions types/src/on_chain_config/aptos_features.rs
Original file line number Diff line number Diff line change
@@ -96,6 +96,8 @@ pub enum FeatureFlag {
FEDERATED_KEYLESS = 77,
TRANSACTION_SIMULATION_ENHANCEMENT = 78,
COLLECTION_OWNER = 79,
/// covers mem::swap and vector::move_range
NATIVE_MEMORY_OPERATIONS = 80,
ENABLE_LOADER_V2 = 81,
}

@@ -174,6 +176,7 @@ impl FeatureFlag {
FeatureFlag::ENABLE_RESOURCE_ACCESS_CONTROL,
FeatureFlag::REJECT_UNSTABLE_BYTECODE_FOR_SCRIPT,
FeatureFlag::TRANSACTION_SIMULATION_ENHANCEMENT,
FeatureFlag::NATIVE_MEMORY_OPERATIONS,
// TODO(loader_v2): Enable V2 loader.
// FeatureFlag::ENABLE_LOADER_V2,
]
@@ -320,6 +323,10 @@ impl Features {
self.is_enabled(FeatureFlag::TRANSACTION_SIMULATION_ENHANCEMENT)
}

pub fn is_native_memory_operations_enabled(&self) -> bool {
self.is_enabled(FeatureFlag::NATIVE_MEMORY_OPERATIONS)
}

pub fn is_loader_v2_enabled(&self) -> bool {
self.is_enabled(FeatureFlag::ENABLE_LOADER_V2)
}

0 comments on commit ce5f67b

Please sign in to comment.