Skip to content

Commit f189e7d

Browse files
authored
Merge pull request #78 from movementlabsxyz/l-monninger/integrated-runner-migration
feat: Integrate Runner Migration
2 parents c471db4 + fc1808a commit f189e7d

File tree

95 files changed

+1450
-481
lines changed

Some content is hidden

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

95 files changed

+1450
-481
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ 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/*",
2124
"util/movement-aptos/*",
@@ -39,6 +42,7 @@ async-trait = "0.1.71"
3942
clap = { version = "4.4.10", features = ["derive"] }
4043
dotenv = "0.15.0"
4144
futures = "0.3.17"
45+
futures-channel = "0.3.17"
4246
serde = "1.0"
4347
serde_json = "1.0.140"
4448
serde_derive = "1.0"
@@ -150,29 +154,34 @@ mtma-track-dev = { path = "migration/cli/track-dev" }
150154

151155
### core
152156
mtma-core = { path = "migration/core/mtma" }
153-
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" }
154162

155163
### preludes
156-
migration-executor-preludes = { path = "checks/executor/preludes" }
164+
mtma-node-preludes = { path = "checks/node/preludes" }
157165

158166
### util
159-
migration-executor-types = { path = "migration/util/executor-types" }
160-
167+
mtma-node-types = { path = "migration/util/node-types" }
168+
mtma-migrator-types = { path = "migration/util/migrator-types" }
161169
## checks
162170
### executor
163-
migration-executor-test-types = { path = "checks/executor/util/types" }
164-
migration-executor-test-global-storage-injective-criterion = { path = "checks/executor/citeria/global-storage-injective" }
165-
migration-executor-test-global-storage-includes-criterion = { path = "checks/executor/citeria/global-storage-includes" }
166-
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" }
167175

168176

169177
### e2e
170-
migration-e2e-test-types = { path = "checks/e2e/util/types" }
178+
mtma-migrator-test-types = { path = "checks/migrator/util/types" }
171179

172180
## util
173181
movement-syncing = { path = "util/movement/movement-syncing" }
174182
movement-core = { path = "util/movement/movement-core" }
175183
movement-util = { path = "util/movement/movement-util" }
184+
movement-aptos-core = { path = "util/movement-aptos/movement-aptos-core" }
176185

177186
[workspace.lints.clippy]
178187
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)