Skip to content

Commit 5322d0e

Browse files
authored
Merge pull request #77 from movementlabsxyz/l-monninger/aptos-runner-rewrite
feat: Embedded Aptos Runnner
2 parents 4fb7c2d + f189e7d commit 5322d0e

File tree

97 files changed

+2669
-545
lines changed

Some content is hidden

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

97 files changed

+2669
-545
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ members = [
66

77
# migration
88
"migration/cli/*",
9-
"migration/core/*",
9+
"migration/core/mtma",
10+
"migration/core/node/*",
11+
"migration/core/migrator/*",
1012
"migration/util/*",
1113
# executor
12-
"checks/executor/util/*",
13-
"checks/executor/citeria/*",
14-
"checks/executor/checks/*",
15-
"checks/executor/preludes",
14+
"checks/node/util/*",
15+
"checks/node/citeria/*",
16+
"checks/node/checks/*",
17+
"checks/node/preludes",
1618
# e2e
17-
"checks/e2e/util/*",
18-
"checks/e2e/citeria/*",
19+
"checks/migrator/util/*",
20+
"checks/migrator/citeria/*",
21+
"checks/migrator/checks/*",
1922
# util
2023
"util/movement/*",
24+
"util/movement-aptos/*",
2125

2226
]
2327

@@ -38,6 +42,7 @@ async-trait = "0.1.71"
3842
clap = { version = "4.4.10", features = ["derive"] }
3943
dotenv = "0.15.0"
4044
futures = "0.3.17"
45+
futures-channel = "0.3.17"
4146
serde = "1.0"
4247
serde_json = "1.0.140"
4348
serde_derive = "1.0"
@@ -108,7 +113,8 @@ aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2
108113
aptos_schemadb = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
109114
aptos-config = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
110115
aptos-db-indexer = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
111-
# model checking and verification
116+
aptos-node = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
117+
aptos-cached-packages = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "2941ee2b5876ab93cfb8010154c9466d7d593ed9" }
112118

113119

114120
# secure-signing
@@ -148,29 +154,34 @@ mtma-track-dev = { path = "migration/cli/track-dev" }
148154

149155
### core
150156
mtma-core = { path = "migration/core/mtma" }
151-
mtma-null-core = { path = "migration/core/mtma-null" }
157+
#### migrator
158+
mtma-migrator-null-core = { path = "migration/core/migrator/mtma-null" }
159+
160+
#### node
161+
mtma-node-null-core = { path = "migration/core/node/mtma-null" }
152162

153163
### preludes
154-
migration-executor-preludes = { path = "checks/executor/preludes" }
164+
mtma-node-preludes = { path = "checks/node/preludes" }
155165

156166
### util
157-
migration-executor-types = { path = "migration/util/executor-types" }
158-
167+
mtma-node-types = { path = "migration/util/node-types" }
168+
mtma-migrator-types = { path = "migration/util/migrator-types" }
159169
## checks
160170
### executor
161-
migration-executor-test-types = { path = "checks/executor/util/types" }
162-
migration-executor-test-global-storage-injective-criterion = { path = "checks/executor/citeria/global-storage-injective" }
163-
migration-executor-test-global-storage-includes-criterion = { path = "checks/executor/citeria/global-storage-includes" }
164-
migration-executor-test-global-storage-not-empty-criterion = { path = "checks/executor/citeria/global-storage-not-empty" }
171+
mtma-node-test-types = { path = "checks/node/util/types" }
172+
mtma-node-test-global-storage-injective-criterion = { path = "checks/node/citeria/global-storage-injective" }
173+
mtma-node-test-global-storage-includes-criterion = { path = "checks/node/citeria/global-storage-includes" }
174+
mtma-node-test-global-storage-not-empty-criterion = { path = "checks/node/citeria/global-storage-not-empty" }
165175

166176

167177
### e2e
168-
migration-e2e-test-types = { path = "checks/e2e/util/types" }
178+
mtma-migrator-test-types = { path = "checks/migrator/util/types" }
169179

170180
## util
171181
movement-syncing = { path = "util/movement/movement-syncing" }
172182
movement-core = { path = "util/movement/movement-core" }
173183
movement-util = { path = "util/movement/movement-util" }
184+
movement-aptos-core = { path = "util/movement-aptos/movement-aptos-core" }
174185

175186
[workspace.lints.clippy]
176187
debug_assert_with_mut_call = "deny"

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ We otherwise recommend reading the [checks](./checks/README.md) and working down
2323

2424
Please see [CONTRIBUTING.md](CONTRIBUTING.md) file for additional contribution guidelines.
2525

26+
## Strategies
27+
The migration is organized into passes, which are categorized as follows:
28+
29+
- [`node`](/migration/core/node) for migration passes that take place with access to node processes, memory, and disk.
30+
- `transaction` is suggested but not broken out for all over-the-wire/transaction-based migration passes.
31+
- [`migrator`](migration/core/migrator) for migration passes that take place with direct or indirect access to all other levels of abstraction--everything that is needed to migrate.
32+
2633
## Organization
2734

2835
There are five subdirectories which progressively build on one another for node logic.
File renamed without changes.

checks/executor/checks/sketchpad/Cargo.toml renamed to checks/migrator/checks/sketchpad/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "migration-executor-checks-sketchpad"
2+
name = "mtma-migrator-checks-sketchpad"
33
version = { workspace = true }
44
edition = { workspace = true }
55
license = { workspace = true }
@@ -9,16 +9,16 @@ publish = { workspace = true }
99
rust-version = { workspace = true }
1010

1111
[dependencies]
12-
migration-executor-test-types = { workspace = true }
12+
mtma-migrator-types = { workspace = true }
13+
mtma-migrator-test-types = { workspace = true }
1314
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 }
15+
mtma-node-null-core = { workspace = true }
1916
tokio = { workspace = true }
2017
chrono = { workspace = true }
2118
rand = { workspace = true }
19+
kestrel = { workspace = true }
20+
mtma-node-preludes = { workspace = true }
21+
mtma-node-test-types = { workspace = true }
2222

2323
[dev-dependencies]
2424
tracing-test = { workspace = true }
File renamed without changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#[cfg(test)]
2+
pub mod test {
3+
4+
use mtma_migrator_test_types::check::checked_migration;
5+
use mtma_migrator_types::migrator::MovementMigrator;
6+
use mtma_node_null_core::config::Config as MtmaNullConfig;
7+
use mtma_node_test_types::prelude::{Prelude, PreludeError};
8+
9+
#[tokio::test]
10+
#[tracing_test::traced_test]
11+
async fn test_global_storage_includes_null() -> Result<(), anyhow::Error> {
12+
// Form the migrator.
13+
let mut movement_migrator = MovementMigrator::try_temp()?;
14+
15+
// Start the migrator so that it's running in the background.
16+
// In the future, some migrators may be for already running nodes.
17+
let movement_migrator_for_task = movement_migrator.clone();
18+
let movement_migrator_task = kestrel::task(async move {
19+
movement_migrator_for_task.run().await?;
20+
Ok::<_, anyhow::Error>(())
21+
});
22+
23+
// Form the prelude.
24+
// todo: this needs to be updated to use the prelude generator
25+
let prelude = Prelude::new_empty();
26+
27+
// Form the migration.
28+
let migration_config = MtmaNullConfig::default();
29+
let migration = migration_config.build()?;
30+
31+
// Run the checked migration.
32+
checked_migration(&mut movement_migrator, &prelude, &migration, vec![]).await?;
33+
34+
// WITHIN THE CRITERION, you'd be able to do similar background startup and processing to the above. The [Migrationish] trait will give you a [MovementAptosMigrator] which can spawn the runner in the background.
35+
//
36+
// Note: WITHIN THE CRITERION, you'll be able to do something like the below.
37+
// let movement_aptos_migrator_for_task = movement_aptos_migrator.clone();
38+
// let movement_aptos_migrator_task = kestrel::task(async move {
39+
// movement_aptos_migrator_for_task.run().await?;
40+
// Ok::<_, anyhow::Error>(())
41+
// });
42+
// // TODO: SOMETHING
43+
// kestrel::end!(movement_aptos_migrator_task)?;
44+
45+
// end the running migrators
46+
kestrel::end!(movement_migrator_task)?;
47+
48+
Ok(())
49+
}
50+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod example;
File renamed without changes.

checks/e2e/citeria/empty/Cargo.toml renamed to checks/migrator/citeria/empty/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "migration-e2e-test-empty-criterion"
2+
name = "mtma-migrator-test-empty-criterion"
33
version = { workspace = true }
44
edition = { workspace = true }
55
license = { workspace = true }
@@ -9,7 +9,7 @@ publish = { workspace = true }
99
rust-version = { workspace = true }
1010

1111
[dependencies]
12-
migration-executor-test-types = { workspace = true }
12+
mtma-node-test-types = { workspace = true }
1313

1414

1515
[lints]

0 commit comments

Comments
 (0)