Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce code cache and loader V2 #14184

Merged
merged 87 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
f5860e5
[move] Full loader integration on MoveVM side (#14075)
georgemitenkov Aug 3, 2024
9e9935b
[move][aptos-vm] Introduce adapters, test module storage and e2e Apto…
georgemitenkov Aug 4, 2024
c6b6cd8
[move][aptos-vm] use shared context for loader, reduce storage zoo
georgemitenkov Aug 22, 2024
739a7ae
comments: add space back to paranoid test
georgemitenkov Aug 23, 2024
7f5c79d
comments: runtime_env --> runtime_environment where possible
georgemitenkov Aug 23, 2024
0f1ebb7
comments: e2e-test factor out session finish
georgemitenkov Aug 23, 2024
8bd4984
comments: return size
georgemitenkov Aug 24, 2024
ccd98b3
[aptos-vm] init_module hack to avoid cache flushing
georgemitenkov Aug 19, 2024
4d9e6f7
[aptos-vm] add state value metadata support for module storage
georgemitenkov Aug 19, 2024
b586ff3
comments: add metadata test
georgemitenkov Aug 24, 2024
fdd105c
[move][aptos-vm] End-to-end module publishing
georgemitenkov Aug 23, 2024
bf9e5e6
[move] Fixing unit tests for loader V2 (#14397)
georgemitenkov Sep 6, 2024
cd2f916
[block-stm] Versioned module storage template
georgemitenkov Jul 14, 2024
7b80d82
[block-stm] Implement module storage
georgemitenkov Aug 11, 2024
b74a4cb
[aptos-vm] Handle runtime environment nicely
georgemitenkov Aug 29, 2024
126ba8d
address comments:
georgemitenkov Sep 4, 2024
223ac2f
[cherrypick]: fix wakeup/delayed fields
georgemitenkov Sep 4, 2024
d5935ed
[fix] Fix a bug where non-veerified entry in captured read cache was …
georgemitenkov Sep 4, 2024
ebb71d6
[block-stm] versioned entry tests and basic generic interface
georgemitenkov Sep 4, 2024
566df04
address comments from Igor & fix rebase
georgemitenkov Sep 6, 2024
b54b4a2
[block-stm] Integrate script caches
georgemitenkov Aug 30, 2024
561ec88
[loader] Enable V2 implementation as default, V1 uses an env var
georgemitenkov Aug 30, 2024
47b948a
[aptos-vm] V2 loader uses the same publishing checks now
georgemitenkov Aug 30, 2024
1d7d795
fixes:
georgemitenkov Aug 30, 2024
b27fb5b
make lint happy
georgemitenkov Aug 30, 2024
ba9b08b
[move] Simplify unsync storage traversal
georgemitenkov Aug 30, 2024
32d501a
[aptos-vm] Fix init_module to correctly respawn session
georgemitenkov Aug 30, 2024
558e3ea
[tests] Fixes to make CI pass:
georgemitenkov Aug 31, 2024
47b4620
[genesis] Fix genesis initialization to produce creations for modules
georgemitenkov Aug 31, 2024
b54559c
[tests] fixed loading script errors & format
georgemitenkov Aug 31, 2024
8687b1b
[loader-v2] Addressing TODOs:
georgemitenkov Sep 1, 2024
104cfa7
[loader-v2] Verification cache for V2 loader
georgemitenkov Sep 1, 2024
3172f65
address comments:
georgemitenkov Sep 3, 2024
4a2e550
[move] Improve & test struct index map
georgemitenkov Sep 3, 2024
2ac6eca
address comments
georgemitenkov Sep 3, 2024
e9b6950
[refactoring] Remove not necessary changes
georgemitenkov Sep 6, 2024
df5b130
[loader] Forcefully enable V2 loader for replay
georgemitenkov Sep 8, 2024
7438278
[loader] Switch to Result<Option<T>> pattern for module storage
georgemitenkov Sep 11, 2024
a3f4554
[loader] Implement runtime environment for module storage, share glob…
georgemitenkov Sep 11, 2024
f6b7074
[aptos] Refactor environment
georgemitenkov Sep 15, 2024
d34141c
Refactoring and documentation
georgemitenkov Sep 15, 2024
578b002
Fix recursive type for depth formula and unreachable code storage
georgemitenkov Sep 15, 2024
5940b82
Fix async vm (reduce number of changes)
georgemitenkov Sep 15, 2024
a0e299f
[fix] Fix depth cache this time
georgemitenkov Sep 16, 2024
431f507
nits:
georgemitenkov Sep 25, 2024
40052d3
[move] Re-implement type cache for loaders
georgemitenkov Sep 25, 2024
c4f3a6f
[perf] Multiple performance improvements:
georgemitenkov Oct 2, 2024
310009c
[loader] Store module id in module writes
georgemitenkov Oct 6, 2024
4a4ccb6
[perf] cross-block framework cache
georgemitenkov Oct 7, 2024
e9b84aa
[executor] avoid validation for empty write sets
georgemitenkov Oct 7, 2024
0b6dcbc
[nits] Different improvements:
georgemitenkov Oct 7, 2024
76679b8
[cleanup] Cleanup unsync code cache
georgemitenkov Oct 7, 2024
256edc4
[cleanup] Remove versioned data strcutures
georgemitenkov Oct 7, 2024
a1d8fad
[perf] Use a cross block cache
georgemitenkov Oct 8, 2024
3211b6e
[cleanup] Improve docs, namings, comments, TODOs in third_party
georgemitenkov Oct 8, 2024
850c483
[code cache] Limit cache sizes, add cache for sequential execution
georgemitenkov Oct 8, 2024
025dcb7
[fix] Test fixes:
georgemitenkov Oct 9, 2024
80309bc
[fix] Fix comparison both test mode with cross-block cache
georgemitenkov Oct 9, 2024
c1f740c
[fix] Validate state value metadata for modules
georgemitenkov Oct 9, 2024
988675f
[cleanup] e2e tests cleanup
georgemitenkov Oct 9, 2024
1e0433c
revert state value validation (perf experiment)
georgemitenkov Oct 9, 2024
ec68451
[fix] Fix module validation and traversal for verified module loading
georgemitenkov Oct 11, 2024
3be6e3e
[test] More unit tests
georgemitenkov Oct 14, 2024
b497eae
[test][cleanup] Add more tests, make more types generic for proptesting
georgemitenkov Oct 14, 2024
0a3c384
[loader] Add API to flush type cache
georgemitenkov Oct 14, 2024
439a5e1
[refactoring] Improve module cache API to be able
georgemitenkov Oct 14, 2024
a44b5bf
[perf] Not validate modules unless really needed
georgemitenkov Oct 15, 2024
5ed3dec
[refactoring] Generic sync impls for caches
georgemitenkov Oct 16, 2024
ad791f4
[replay] adjust replay timeouts
georgemitenkov Oct 16, 2024
3dc9892
[comments] Expose type to layout/tag APIs to VM session
georgemitenkov Oct 16, 2024
bcb8801
[comments] Address Zi's comments (pt 1)
georgemitenkov Oct 16, 2024
6715308
[comments] Address Rati's comments
georgemitenkov Oct 16, 2024
a2e0004
[comments] Address Rati's comments (pt 2)
georgemitenkov Oct 17, 2024
f41ff59
[comments] Address Zekun's comments (pt 1)
georgemitenkov Oct 17, 2024
1a22d2c
[comments] Address Runtian's comments
georgemitenkov Oct 17, 2024
9e029f2
[refactoring] Make cached scripts generic
georgemitenkov Oct 17, 2024
be384b1
[comments] Address remianing Rati's & Zekun's comments
georgemitenkov Oct 17, 2024
de69ed3
[refactoring] Improvements:
georgemitenkov Oct 18, 2024
04e92a2
[refactoring][fix] Add module cache for txn validation
georgemitenkov Oct 20, 2024
ece6f5b
[refactoring] Small nits
georgemitenkov Oct 20, 2024
5245778
[fix] Multiple fixes:
georgemitenkov Oct 21, 2024
dd9c43a
[perf] Optimize index map cloning
georgemitenkov Oct 22, 2024
378e898
[nits] Multiple cleanups & improvements
georgemitenkov Oct 22, 2024
6f77fe7
rebase
georgemitenkov Oct 23, 2024
410d58d
[comments] Adressing Zi's comments, minor nits
georgemitenkov Oct 29, 2024
539b9a9
[nits] Multiple nits:
georgemitenkov Oct 29, 2024
bf7b8fd
[loader] Enable V1 for merging
georgemitenkov Oct 29, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/replay-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
BACKUP_CONFIG_TEMPLATE_PATH: terraform/helm/fullnode/files/backup/gcs.yaml
# workflow config
RUNS_ON: "high-perf-docker-with-local-ssd"
TIMEOUT_MINUTES: 180
TIMEOUT_MINUTES: 240
MAX_VERSIONS_PER_RANGE: 2000000

replay-mainnet:
Expand All @@ -96,7 +96,7 @@ jobs:
BACKUP_CONFIG_TEMPLATE_PATH: terraform/helm/fullnode/files/backup/gcs.yaml
# workflow config
RUNS_ON: "high-perf-docker-with-local-ssd"
TIMEOUT_MINUTES: 180
TIMEOUT_MINUTES: 240
MAX_VERSIONS_PER_RANGE: 800000

test-replay:
Expand Down
68 changes: 65 additions & 3 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = [
"aptos-move/aptos-validator-interface",
"aptos-move/aptos-vm",
"aptos-move/aptos-vm-benchmarks",
"aptos-move/aptos-vm-environment",
"aptos-move/aptos-vm-logging",
"aptos-move/aptos-vm-profiling",
"aptos-move/aptos-vm-types",
Expand Down Expand Up @@ -456,6 +457,7 @@ aptos-validator-interface = { path = "aptos-move/aptos-validator-interface" }
aptos-validator-transaction-pool = { path = "crates/validator-transaction-pool" }
aptos-vault-client = { path = "secure/storage/vault" }
aptos-vm = { path = "aptos-move/aptos-vm" }
aptos-vm-environment = { path = "aptos-move/aptos-vm-environment" }
aptos-vm-logging = { path = "aptos-move/aptos-vm-logging" }
aptos-vm-genesis = { path = "aptos-move/vm-genesis" }
aptos-vm-types = { path = "aptos-move/aptos-vm-types" }
Expand All @@ -471,6 +473,7 @@ atty = "0.2.14"
nalgebra = "0.32"
float-cmp = "0.9.0"
again = "0.1.2"
ambassador = "0.4.1"
anyhow = "1.0.71"
anstyle = "1.0.1"
arbitrary = { version = "1.3.2", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions api/test-context/src/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use aptos_types::{
},
};
use aptos_vm::AptosVM;
use aptos_vm_validator::vm_validator::VMValidator;
use aptos_vm_validator::vm_validator::PooledVMValidator;
use bytes::Bytes;
use hyper::{HeaderMap, Response};
use rand::SeedableRng;
Expand Down Expand Up @@ -172,7 +172,7 @@ pub fn new_test_context_inner(
db_bootstrapper::maybe_bootstrap::<AptosVM>(&db_rw, &genesis, genesis_waypoint).unwrap();
assert!(ret.is_some());

let mempool = MockSharedMempool::new_in_runtime(&db_rw, VMValidator::new(db.clone()));
let mempool = MockSharedMempool::new_in_runtime(&db_rw, PooledVMValidator::new(db.clone(), 1));

node_config
.storage
Expand Down
1 change: 1 addition & 0 deletions aptos-move/aptos-debugger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ aptos-rest-client = { workspace = true }
aptos-types = { workspace = true }
aptos-validator-interface = { workspace = true }
aptos-vm = { workspace = true }
aptos-vm-environment = { workspace = true }
aptos-vm-logging = { workspace = true }
aptos-vm-types = { workspace = true }
bcs = { workspace = true }
Expand Down
8 changes: 6 additions & 2 deletions aptos-move/aptos-debugger/src/aptos_debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ use aptos_vm::{
data_cache::AsMoveResolver,
AptosVM,
};
use aptos_vm_environment::environment::AptosEnvironment;
use aptos_vm_logging::log_schema::AdapterLogSchema;
use aptos_vm_types::output::VMOutput;
use aptos_vm_types::{module_and_script_storage::AsAptosCodeStorage, output::VMOutput};
use itertools::Itertools;
use std::{path::Path, sync::Arc, time::Instant};

Expand Down Expand Up @@ -119,11 +120,14 @@ impl AptosDebugger {
bail!("Module bundle payload has been removed")
}

let vm = AptosVM::new(&state_view);
let env = AptosEnvironment::new(&state_view);
let vm = AptosVM::new(env.clone(), &state_view);
let resolver = state_view.as_move_resolver();
let code_storage = state_view.as_aptos_code_storage(env);

let (status, output, gas_profiler) = vm.execute_user_transaction_with_modified_gas_meter(
&resolver,
&code_storage,
&txn,
&log_context,
|gas_meter| {
Expand Down
4 changes: 3 additions & 1 deletion aptos-move/aptos-gas-meter/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use aptos_types::{
};
use aptos_vm_types::{
change_set::ChangeSetInterface,
module_and_script_storage::module_storage::AptosModuleStorage,
resolver::ExecutorView,
storage::{
io_pricing::IoPricing,
Expand Down Expand Up @@ -144,6 +145,7 @@ pub trait AptosGasMeter: MoveGasMeter {
txn_size: NumBytes,
gas_unit_price: FeePerGasUnit,
executor_view: &dyn ExecutorView,
module_storage: &impl AptosModuleStorage,
) -> VMResult<Fee> {
// The new storage fee are only active since version 7.
if self.feature_version() < 7 {
Expand All @@ -163,7 +165,7 @@ pub trait AptosGasMeter: MoveGasMeter {
// Write set
let mut write_fee = Fee::new(0);
let mut total_refund = Fee::new(0);
for res in change_set.write_op_info_iter_mut(executor_view) {
for res in change_set.write_op_info_iter_mut(executor_view, module_storage) {
let ChargeAndRefund { charge, refund } = pricing.charge_refund_write_op(
params,
res.map_err(|err| err.finish(Location::Undefined))?,
Expand Down
Loading
Loading