Skip to content

Commit 4d8b545

Browse files
authored
Merge pull request #33 from movementlabsxyz/l-monninger/prelude
feat: introduce prelude and provides sketchpad migration test
2 parents f2f7076 + 5ad0aa2 commit 4d8b545

File tree

78 files changed

+2674
-1273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2674
-1273
lines changed

.github/workflows/nix-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919

2020
jobs:
2121
run-command:
22-
runs-on: ubuntu-latest
22+
runs-on: buildjet-16vcpu-ubuntu-2204
2323
steps:
2424
- name: Free Disk Space (Ubuntu)
2525
uses: jlumbroso/free-disk-space@main

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
target
22
*.pem
33
.debug
4-
.env*
4+
.env*
5+
.idea
6+
.direnv

Cargo.lock

Lines changed: 1150 additions & 888 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ resolver = "2"
44

55
members = [
66

7-
"migration/cli/*",
8-
"migration/core/*",
9-
10-
# executor
11-
"checks/executor/util/*",
12-
"checks/executor/citeria/*",
13-
"checks/executor/cli/*",
14-
15-
# e2e
16-
"checks/e2e/util/*",
17-
"checks/e2e/citeria/*",
18-
19-
# util
20-
"util/include-dir"
7+
# migration
8+
"migration/cli/*",
9+
"migration/core/*",
10+
"migration/util/*",
11+
# executor
12+
"checks/executor/util/*",
13+
"checks/executor/citeria/*",
14+
"checks/executor/checks/*",
15+
"checks/executor/preludes",
16+
# e2e
17+
"checks/e2e/util/*",
18+
"checks/e2e/citeria/*",
19+
# util
20+
"util/include-dir",
21+
"util/movement-syncing",
2122

2223
]
2324

@@ -49,8 +50,8 @@ tracing-test = "0.2.5"
4950
tokio = { version = "1.35.1", features = ["full", "tracing"] }
5051
tokio-stream = "0.1.15"
5152
hex = { version = "0.4.3", default-features = false, features = [
52-
"alloc",
53-
"serde",
53+
"alloc",
54+
"serde",
5455
] }
5556
zip = { version = "2.4.2", features = ["flate2"] }
5657
walkdir = "2.3.2"
@@ -72,6 +73,9 @@ tonic-reflection = "0.12.3"
7273
tonic-web = "0.12.3"
7374
prost = "0.13.3"
7475
libp2p = { version = "0.55.0", features = ["tcp", "quic"] }
76+
chrono = "0.4.31"
77+
rand = "0.7.3"
78+
uuid = "1.10.0"
7579

7680
poem = { version = "=3.1.3", features = ["anyhow", "compression", "rustls"] }
7781
poem-openapi = { version = "=5.1.2", features = ["swagger-ui", "url"] }
@@ -83,25 +87,33 @@ jemallocator = { version = "0.5.0", features = [
8387
jemalloc-sys = "0.5.4"
8488

8589
either = "1.8.1"
90+
tempdir = "0.3.7"
91+
sysinfo = "0.34.2"
8692

8793
# movement
88-
maptos-opt-executor = { git = "https://github.com/movementlabsxyz/movement.git", rev = "f6e229e53066f068302dd78eb57d447bd2fa4d3e" }
89-
movement-client = { git = "https://github.com/movementlabsxyz/movement.git", rev = "f6e229e53066f068302dd78eb57d447bd2fa4d3e" }
90-
91-
# maptos-core
92-
aptos-executor= { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "4e1871804307948d43002fc81d8ea723caeb5c31" }
93-
aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "4e1871804307948d43002fc81d8ea723caeb5c31" }
94-
aptos-rest-client = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "4e1871804307948d43002fc81d8ea723caeb5c31" }
95-
aptos-storage-interface = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "4e1871804307948d43002fc81d8ea723caeb5c31" }
96-
aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "4e1871804307948d43002fc81d8ea723caeb5c31" }
97-
94+
maptos-opt-executor = { git = "https://github.com/movementlabsxyz/movement.git", rev = "aa1ffed1a113441a65662792d15682ad52406108" }
95+
movement-client = { git = "https://github.com/movementlabsxyz/movement.git", rev = "aa1ffed1a113441a65662792d15682ad52406108" }
96+
syncador = { git = "https://github.com/movementlabsxyz/movement.git", rev = "aa1ffed1a113441a65662792d15682ad52406108" }
97+
movement-types = { git = "https://github.com/movementlabsxyz/movement.git", rev = "aa1ffed1a113441a65662792d15682ad52406108" }
98+
maptos-execution-util = { git = "https://github.com/movementlabsxyz/movement.git", rev = "aa1ffed1a113441a65662792d15682ad52406108" }
99+
100+
# aptos-core
101+
aptos-executor = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
102+
aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
103+
aptos-rest-client = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
104+
aptos-storage-interface = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
105+
aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
106+
aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
107+
aptos_schemadb = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
108+
aptos-config = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
109+
aptos-db-indexer = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
98110
# model checking and verification
99111

100112

101113
# secure-signing
102114
secure-signer = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
103-
secure-signer-loader = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
104-
secure-signer-aws-kms = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
115+
secure-signer-loader = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
116+
secure-signer-aws-kms = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
105117

106118
# kestrel
107119
kestrel = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "85e2f681ae3e54b29bb18d4ed7ca750116173321" }
@@ -112,20 +124,35 @@ commander = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "85e
112124
orfile = { git = "https://github.com/movementlabsxyz/orfile.git", rev = "d02299214e5aa202130cd1eb9593ce8064d1ec69" }
113125

114126
# docs
115-
clap-markdown-ext = { git = "https://github.com/movementlabsxyz/clap-markdown-ext.git", rev = "8f54fe424504bf37fb01dc69aaed8166e429fe6a"}
127+
clap-markdown-ext = { git = "https://github.com/movementlabsxyz/clap-markdown-ext.git", rev = "8f54fe424504bf37fb01dc69aaed8166e429fe6a" }
116128

117129
# internal
118-
movement-to-movement-aptos-core = { path = "migration/core/movement-to-movement-aptos" }
130+
## migration
131+
132+
### core
133+
mtma-core = { path = "migration/core/mtma" }
134+
mtma-null-core = { path = "migration/core/mtma-null" }
135+
136+
### preludes
137+
migration-executor-preludes = { path = "checks/executor/preludes" }
138+
139+
### util
140+
migration-executor-types = { path = "migration/util/executor-types" }
119141

120142
## checks
121143
### executor
122144
migration-executor-test-types = { path = "checks/executor/util/types" }
145+
migration-executor-test-global-storage-injective-criterion = { path = "checks/executor/citeria/global-storage-injective" }
146+
migration-executor-test-global-storage-includes-criterion = { path = "checks/executor/citeria/global-storage-includes" }
147+
migration-executor-test-global-storage-not-empty-criterion = { path = "checks/executor/citeria/global-storage-not-empty" }
148+
123149

124150
### e2e
125151
migration-e2e-test-types = { path = "checks/e2e/util/types" }
126152

127153
## util
128154
include-dir = { path = "util/include-dir" }
155+
movement-syncing = { path = "util/movement-syncing" }
129156

130157
[workspace.lints.clippy]
131158
debug_assert_with_mut_call = "deny"
File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "migration-executor-checks-mainnet"
3+
version = { workspace = true }
4+
edition = { workspace = true }
5+
license = { workspace = true }
6+
authors = { workspace = true }
7+
homepage = { workspace = true }
8+
publish = { workspace = true }
9+
rust-version = { workspace = true }
10+
11+
[dependencies]
12+
migration-executor-test-types = { workspace = true }
13+
anyhow = { workspace = true }
14+
mtma-null-core = { workspace = true }
15+
migration-executor-test-global-storage-injective-criterion = { workspace = true }
16+
migration-executor-test-global-storage-includes-criterion = { workspace = true }
17+
migration-executor-test-global-storage-not-empty-criterion = { workspace = true }
18+
migration-executor-preludes = { workspace = true }
19+
movement-syncing = { workspace = true }
20+
maptos-execution-util = { workspace = true }
21+
tokio = { workspace = true }
22+
chrono = { workspace = true }
23+
rand = { workspace = true }
24+
futures = { workspace = true }
25+
sysinfo = { workspace = true }
26+
27+
[dev-dependencies]
28+
tracing-test = { workspace = true }
29+
tracing = { workspace = true }
30+
31+
[lints]
32+
workspace = true
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#[cfg(test)]
2+
pub mod test {
3+
4+
use futures::channel::mpsc as futures_mpsc;
5+
use maptos_execution_util::config::Config as MaptosConfig;
6+
use migration_executor_test_global_storage_includes_criterion::GlobalStorageIncludes;
7+
use migration_executor_test_types::{
8+
check::checked_migration,
9+
criterion::movement_executor::{MovementExecutor, MovementOptExecutor},
10+
prelude::Prelude,
11+
};
12+
use movement_syncing::db::DbSync;
13+
use mtma_null_core::config::Config as MtmaNullConfig;
14+
use sysinfo::Disks;
15+
16+
#[tokio::test]
17+
#[tracing_test::traced_test]
18+
async fn test_global_storage_includess_null() -> Result<(), anyhow::Error> {
19+
let disks = Disks::new_with_refreshed_list();
20+
21+
let total_disk_space: u64 = disks.iter().map(|disk| disk.total_space()).sum();
22+
23+
let total_free_space: u64 = disks.iter().map(|disk| disk.available_space()).sum();
24+
25+
const REQUIRED_SPACE: u64 = 1_000_000_000_000; // 1 TB
26+
27+
if total_disk_space < REQUIRED_SPACE {
28+
println!("Device has less than 1 TB of *total* disk space — skipping test (not a viable test platform).");
29+
return Ok(()); // soft pass
30+
}
31+
32+
if total_free_space < REQUIRED_SPACE {
33+
println!("Device has enough total disk space, but less than 1 TB is free.");
34+
return Err(anyhow::anyhow!("not enough free disk space"));
35+
}
36+
37+
println!("Sufficient disk space available.");
38+
39+
// sync the db
40+
let db_sync = DbSync::mainnet_debug();
41+
db_sync.pull().await?;
42+
43+
// form the executor
44+
let (sender, _receiver) = futures_mpsc::channel(100);
45+
let mut config = MaptosConfig::default();
46+
config.chain.maptos_db_path = Some(db_sync.destination_db_path().clone());
47+
let movement_opt_executor = MovementOptExecutor::try_from_config(config, sender).await?;
48+
let mut movement_executor = MovementExecutor::new(movement_opt_executor);
49+
50+
// empty prelude
51+
let prelude = Prelude::new_empty();
52+
53+
// form the migration
54+
let migration_config = MtmaNullConfig::default();
55+
let migration = migration_config.build()?;
56+
57+
// run the checked migration
58+
checked_migration(
59+
&mut movement_executor,
60+
&prelude,
61+
&migration,
62+
vec![Box::new(GlobalStorageIncludes::new())],
63+
)
64+
.await?;
65+
Ok(())
66+
}
67+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod global_storage_includes;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
name = "migration-executor-checks-sketchpad"
3+
version = { workspace = true }
4+
edition = { workspace = true }
5+
license = { workspace = true }
6+
authors = { workspace = true }
7+
homepage = { workspace = true }
8+
publish = { workspace = true }
9+
rust-version = { workspace = true }
10+
11+
[dependencies]
12+
migration-executor-test-types = { workspace = true }
13+
anyhow = { workspace = true }
14+
mtma-null-core = { workspace = true }
15+
migration-executor-test-global-storage-injective-criterion = { workspace = true }
16+
migration-executor-test-global-storage-includes-criterion = { workspace = true }
17+
migration-executor-test-global-storage-not-empty-criterion = { workspace = true }
18+
migration-executor-preludes = { workspace = true }
19+
tokio = { workspace = true }
20+
chrono = { workspace = true }
21+
rand = { workspace = true }
22+
23+
[dev-dependencies]
24+
tracing-test = { workspace = true }
25+
tracing = { workspace = true }
26+
27+
[lints]
28+
workspace = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Migration Executor Checks Sketchpad
2+
A sketchpad for playing around with checks on the testpad.

0 commit comments

Comments
 (0)