Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
163 changes: 127 additions & 36 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ members = [
"api/types",
"aptos-move/aptos-aggregator",
"aptos-move/aptos-debugger",
"aptos-move/aptos-gas",
"aptos-move/aptos-gas-algebra",
"aptos-move/aptos-gas-meter",
"aptos-move/aptos-gas-profiling",
"aptos-move/aptos-gas-schedule",
"aptos-move/aptos-gas-schedule-updator",
"aptos-move/aptos-memory-usage-tracker",
"aptos-move/aptos-native-interface",
"aptos-move/aptos-release-builder",
"aptos-move/aptos-resource-viewer",
"aptos-move/aptos-sdk-builder",
Expand All @@ -28,7 +32,7 @@ members = [
"aptos-move/e2e-testsuite",
"aptos-move/framework",
"aptos-move/framework/cached-packages",
"aptos-move/gas-algebra-ext",
"aptos-move/framework/table-natives",
"aptos-move/move-examples",
"aptos-move/mvhashmap",
"aptos-move/package-builder",
Expand Down Expand Up @@ -296,9 +300,11 @@ aptos-forge = { path = "testsuite/forge" }
aptos-framework = { path = "aptos-move/framework" }
aptos-fuzzer = { path = "testsuite/aptos-fuzzer" }
fuzzer = { path = "testsuite/fuzzer" }
aptos-gas = { path = "aptos-move/aptos-gas" }
aptos-gas-algebra-ext = { path = "aptos-move/gas-algebra-ext" }
aptos-gas-meter = { path = "aptos-move/aptos-gas-meter" }
aptos-gas-algebra = { path = "aptos-move/aptos-gas-algebra" }
aptos-gas-profiling = { path = "aptos-move/aptos-gas-profiling" }
aptos-gas-schedule = { path = "aptos-move/aptos-gas-schedule" }
aptos-gas-schedule-updator = { path = "aptos-move/aptos-gas-schedule-updator" }
aptos-genesis = { path = "crates/aptos-genesis" }
aptos-github-client = { path = "crates/aptos-github-client" }
aptos-global-constants = { path = "config/global-constants" }
Expand Down Expand Up @@ -328,6 +334,7 @@ aptos-metrics-core = { path = "crates/aptos-metrics-core" }
aptos-move-examples = { path = "aptos-move/move-examples" }
aptos-moving-average = { path = "crates/moving-average" }
aptos-mvhashmap = { path = "aptos-move/mvhashmap" }
aptos-native-interface = { path = "aptos-move/aptos-native-interface" }
aptos-netcore = { path = "network/netcore" }
aptos-network = { path = "network" }
aptos-network-builder = { path = "network/builder" }
Expand Down Expand Up @@ -631,6 +638,7 @@ move-prover = { path = "third_party/move/move-prover" }
move-prover-boogie-backend = { path = "third_party/move/move-prover/boogie-backend" }
move-stackless-bytecode = { path = "third_party/move/move-prover/bytecode" }
aptos-move-stdlib = { path = "aptos-move/framework/move-stdlib" }
aptos-table-natives = { path = "aptos-move/framework/table-natives" }
move-prover-test-utils = { path = "third_party/move/move-prover/test-utils" }
move-resource-viewer = { path = "third_party/move/tools/move-resource-viewer" }
move-symbol-pool = { path = "third_party/move/move-symbol-pool" }
Expand Down
4 changes: 2 additions & 2 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ aptos-api-types = { workspace = true }
aptos-build-info = { workspace = true }
aptos-config = { workspace = true }
aptos-crypto = { workspace = true }
aptos-gas = { workspace = true }
aptos-gas-schedule = { workspace = true }
aptos-logger = { workspace = true }
aptos-mempool = { workspace = true }
aptos-metrics-core = { workspace = true }
Expand Down Expand Up @@ -52,7 +52,7 @@ url = { workspace = true }
aptos-api-test-context = { workspace = true }
aptos-cached-packages = { workspace = true }
aptos-framework = { workspace = true }
aptos-gas = { workspace = true, features = ["testing"] }
aptos-gas-meter = { workspace = true, features = ["testing"] }
aptos-proptest-helpers = { workspace = true }
aptos-sdk = { workspace = true }
move-package = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions api/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use aptos_api_types::{
};
use aptos_config::config::{NodeConfig, RoleType};
use aptos_crypto::HashValue;
use aptos_gas::{AptosGasParameters, FromOnChainGasSchedule};
use aptos_gas_schedule::{AptosGasParameters, FromOnChainGasSchedule};
use aptos_logger::error;
use aptos_mempool::{MempoolClientRequest, MempoolClientSender, SubmissionStatus};
use aptos_state_view::TStateView;
Expand Down Expand Up @@ -1092,7 +1092,7 @@ impl Context {

fn min_gas_unit_price<E: InternalError>(&self, ledger_info: &LedgerInfo) -> Result<u64, E> {
let (_, gas_schedule) = self.get_gas_schedule(ledger_info)?;
Ok(gas_schedule.txn.min_price_per_gas_unit.into())
Ok(gas_schedule.vm.txn.min_price_per_gas_unit.into())
}

pub fn get_gas_schedule<E: InternalError>(
Expand Down
6 changes: 3 additions & 3 deletions api/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ impl TransactionsApi {
let estimated_max_gas_amount = if estimate_max_gas_amount.0.unwrap_or_default() {
// Retrieve max possible gas units
let (_, gas_params) = self.context.get_gas_schedule(&ledger_info)?;
let min_number_of_gas_units = u64::from(gas_params.txn.min_transaction_gas_units)
/ u64::from(gas_params.txn.gas_unit_scaling_factor);
let max_number_of_gas_units = u64::from(gas_params.txn.maximum_number_of_gas_units);
let min_number_of_gas_units = u64::from(gas_params.vm.txn.min_transaction_gas_units)
/ u64::from(gas_params.vm.txn.gas_unit_scaling_factor);
let max_number_of_gas_units = u64::from(gas_params.vm.txn.maximum_number_of_gas_units);

// Retrieve account balance to determine max gas available
let account_state = self
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ rust-version = { workspace = true }
anyhow = { workspace = true }
aptos-crypto = { workspace = true }
aptos-state-view = { workspace = true }
aptos-table-natives = { workspace = true }
aptos-types = { workspace = true }
bcs = { workspace = true }
better_any = { workspace = true }
move-binary-format = { workspace = true }
move-core-types = { workspace = true }
move-table-extension = { workspace = true }
once_cell = { workspace = true }
smallvec = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-aggregator/src/aggregator_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0

use crate::delta_change_set::{addition, deserialize, subtraction};
use aptos_table_natives::{TableHandle, TableResolver};
use aptos_types::vm_status::StatusCode;
use move_binary_format::errors::{PartialVMError, PartialVMResult};
use move_core_types::account_address::AccountAddress;
use move_table_extension::{TableHandle, TableResolver};
use std::collections::{BTreeMap, BTreeSet};

/// Describes the state of each aggregator instance.
Expand Down
5 changes: 3 additions & 2 deletions aptos-move/aptos-debugger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ edition = "2021"
[dependencies]
anyhow = { workspace = true }
aptos-crypto = { workspace = true }
aptos-gas = { workspace = true }
aptos-gas-meter = { workspace = true }
aptos-gas-profiling = { workspace = true }
aptos-gas-schedule = { workspace = true }
aptos-logger = { workspace = true }
aptos-memory-usage-tracker = { workspace = true }
aptos-resource-viewer = { workspace = true }
aptos-rest-client = { workspace = true }
aptos-state-view = { workspace = true }
aptos-table-natives = { workspace = true }
aptos-types = { workspace = true }
aptos-validator-interface = { workspace = true }
aptos-vm = { workspace = true }
Expand All @@ -30,7 +32,6 @@ move-cli = { workspace = true }
move-compiler = { workspace = true }
move-core-types = { workspace = true }
move-resource-viewer = { workspace = true }
move-table-extension = { workspace = true }
move-vm-runtime = { workspace = true }
move-vm-test-utils = { workspace = true }
tokio = { workspace = true }
Expand Down
23 changes: 11 additions & 12 deletions aptos-move/aptos-debugger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// SPDX-License-Identifier: Apache-2.0

use anyhow::{format_err, Result};
use aptos_gas::{
AbstractValueSizeGasParameters, ChangeSetConfigs, NativeGasParameters, StandardGasMeter,
LATEST_GAS_FEATURE_VERSION,
};
use aptos_gas_meter::{StandardGasAlgebra, StandardGasMeter};
use aptos_gas_profiling::{GasProfiler, TransactionGasLog};
use aptos_gas_schedule::{MiscGasParameters, NativeGasParameters, LATEST_GAS_FEATURE_VERSION};
use aptos_memory_usage_tracker::MemoryTrackedGasMeter;
use aptos_resource_viewer::{AnnotatedAccountStateBlob, AptosValueAnnotator};
use aptos_rest_client::Client;
Expand All @@ -30,7 +28,7 @@ use aptos_vm::{
AptosVM, VMExecutor,
};
use aptos_vm_logging::log_schema::AdapterLogSchema;
use aptos_vm_types::{change_set::VMChangeSet, output::VMOutput};
use aptos_vm_types::{change_set::VMChangeSet, output::VMOutput, storage::ChangeSetConfigs};
use move_binary_format::errors::VMResult;
use std::{path::Path, sync::Arc};

Expand Down Expand Up @@ -80,12 +78,13 @@ impl AptosDebugger {
&txn,
&log_context,
|gas_feature_version, gas_params, storage_gas_params, balance| {
let gas_meter = MemoryTrackedGasMeter::new(StandardGasMeter::new(
gas_feature_version,
gas_params,
storage_gas_params,
balance,
));
let gas_meter =
MemoryTrackedGasMeter::new(StandardGasMeter::new(StandardGasAlgebra::new(
gas_feature_version,
gas_params,
storage_gas_params,
balance,
)));
let gas_profiler = match txn.payload() {
TransactionPayload::Script(_) => GasProfiler::new_script(gas_meter),
TransactionPayload::EntryFunction(entry_func) => GasProfiler::new_function(
Expand Down Expand Up @@ -229,7 +228,7 @@ impl AptosDebugger {
let features = Features::fetch_config(&state_view_storage).unwrap_or_default();
let move_vm = MoveVmExt::new(
NativeGasParameters::zeros(),
AbstractValueSizeGasParameters::zeros(),
MiscGasParameters::zeros(),
LATEST_GAS_FEATURE_VERSION,
ChainId::test().id(),
features,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aptos-gas-algebra-ext"
description = "Gas Algebra Ext"
name = "aptos-gas-algebra"
description = "Aptos Gas Algebra"
version = "0.0.1"

# Workspace inherited keys
Expand All @@ -13,4 +13,5 @@ repository = { workspace = true }
rust-version = { workspace = true }

[dependencies]
either = { workspace = true }
move-core-types = { workspace = true }
Loading