Skip to content

Commit b4e05b8

Browse files
authored
Merge pull request #115 from movementlabsxyz/l-monninger/pre-l1-merge-redux
feat: pre-l1-merge migration
2 parents 575740c + 52606dd commit b4e05b8

File tree

30 files changed

+977
-150
lines changed

30 files changed

+977
-150
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
command:
1212
# cargo checks and tests
1313
- cargo check --all-targets
14-
- cargo test
14+
- RUST_MIN_STACK=8388608 cargo test -- --nocapture
1515

1616
with:
1717
command: ${{ matrix.command }}

Cargo.lock

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

Cargo.toml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ portpicker = "0.1.0"
104104

105105

106106
# movement
107-
maptos-opt-executor = { git = "https://github.com/movementlabsxyz/movement.git", rev = "8f820a5c23ce2b632200043acdabb3e6582c078a" }
108-
movement-client = { git = "https://github.com/movementlabsxyz/movement.git", rev = "8f820a5c23ce2b632200043acdabb3e6582c078a" }
109-
syncador = { git = "https://github.com/movementlabsxyz/movement.git", rev = "8f820a5c23ce2b632200043acdabb3e6582c078a" }
110-
movement-types = { git = "https://github.com/movementlabsxyz/movement.git", rev = "8f820a5c23ce2b632200043acdabb3e6582c078a" }
111-
maptos-execution-util = { git = "https://github.com/movementlabsxyz/movement.git", rev = "8f820a5c23ce2b632200043acdabb3e6582c078a" }
112-
movement-util = { git = "https://github.com/movementlabsxyz/movement.git", rev = "8f820a5c23ce2b632200043acdabb3e6582c078a" }
113-
107+
maptos-opt-executor = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
108+
movement-client = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
109+
syncador = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
110+
movement-types = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
111+
maptos-execution-util = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
112+
movement-util = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
113+
aptos-framework-pre-l1-merge-release = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
114+
movement-signer = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
115+
movement-signer-loader = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
116+
movement-config = { git = "https://github.com/movementlabsxyz/movement.git", rev = "07d5fe82f2c824a7f7e032c9dce339afdbbcb5a0" }
114117

115118
# aptos-core
116119
aptos-executor = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "cb3b7b02f68c7d6982257e4c59955d0e63b513db" }
@@ -130,11 +133,6 @@ aptos-executor-types = { git = "https://github.com/movementlabsxyz/aptos-core.gi
130133
aptos-vm-genesis = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "cb3b7b02f68c7d6982257e4c59955d0e63b513db" }
131134

132135

133-
# secure-signing
134-
secure-signer = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
135-
secure-signer-loader = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
136-
secure-signer-aws-kms = { git = "https://github.com/movementlabsxyz/secure-signing.git", rev = "f37eebd6d494d21b26b2faa44e1188de42ff1007" }
137-
138136
# kestrel
139137
kestrel = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
140138
jsonlvar = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
@@ -169,8 +167,11 @@ mtma-track-dev = { path = "migration/cli/track-dev" }
169167
mtma-core = { path = "migration/core/mtma" }
170168
mtma-null-core = { path = "migration/core/mtma-null" }
171169
mtma-node-replay-core = { path = "migration/core/node/mtma-replay" }
170+
172171
#### migrator
173172
mtma-migrator-null-core = { path = "migration/core/migrator/mtma-null" }
173+
mtma-migrator-pre-l1-merge-core = { path = "migration/core/migrator/pre-l1-merge" }
174+
mtma-migrate-chain-core = { path = "migration/core/mtma-migrate-chain" }
174175

175176
#### node
176177
mtma-node-null-core = { path = "migration/core/node/mtma-null" }
@@ -253,12 +254,4 @@ debug = true
253254
[patch.crates-io]
254255
serde-reflection = { git = "https://github.com/aptos-labs/serde-reflection", rev = "73b6bbf748334b71ff6d7d09d06a29e3062ca075" }
255256
merlin = { git = "https://github.com/aptos-labs/merlin" }
256-
x25519-dalek = { git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1" }
257-
futures = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
258-
futures-channel = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
259-
futures-executor = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
260-
futures-core = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
261-
futures-util = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
262-
futures-sink = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
263-
futures-io = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
264-
futures-task = { git = "https://github.com/aptos-labs/futures-rs", branch = "backport" }
257+
x25519-dalek = { git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1" }
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[package]
2+
name = "mtma-migrator-checks-pre-l1-merge"
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+
mtma-types = { workspace = true }
13+
mtma-migrator-types = { workspace = true }
14+
mtma-migrator-test-types = { workspace = true }
15+
anyhow = { workspace = true }
16+
mtma-node-replay-core = { workspace = true }
17+
mtma-node-test-global-storage-injective-criterion = { workspace = true }
18+
mtma-node-test-global-storage-includes-criterion = { workspace = true }
19+
mtma-node-test-global-storage-not-empty-criterion = { workspace = true }
20+
mtma-migrator-test-accounts-equal-criterion = { workspace = true }
21+
mtma-node-preludes = { workspace = true }
22+
mtma-node-null-core = { workspace = true }
23+
tokio = { workspace = true }
24+
chrono = { workspace = true }
25+
rand = { workspace = true }
26+
kestrel = { workspace = true }
27+
mtma-node-test-types = { workspace = true }
28+
mtma-migrator-pre-l1-merge-core = { workspace = true }
29+
movement-core = { workspace = true }
30+
31+
[dev-dependencies]
32+
tracing-test = { workspace = true }
33+
tracing = { workspace = true }
34+
tempfile = { workspace = true }
35+
36+
[lints]
37+
workspace = true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Migration Executor Checks Pre-L1 Merge
2+
A basic testing crate for the pre-l1-merge portion of the migration.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod pre_l1_merge;
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#[cfg(test)]
2+
pub mod test {
3+
4+
use anyhow::Context;
5+
use movement_core::Movement;
6+
use mtma_migrator_pre_l1_merge_core::config::Config as PreL1MergeConfig;
7+
use mtma_migrator_test_accounts_equal_criterion::AccountsEqual;
8+
use mtma_migrator_test_types::check::checked_migration;
9+
use mtma_migrator_types::migrator::movement_migrator::{MovementMigrator, Overlays, Runner};
10+
use mtma_node_test_types::prelude::Prelude;
11+
use mtma_types::movement::aptos_sdk::types::account_config::aptos_test_root_address;
12+
use mtma_types::movement::movement_config::Config as MovementConfig;
13+
use tracing::info;
14+
15+
#[tokio::test(flavor = "multi_thread")]
16+
#[tracing_test::traced_test]
17+
async fn test_pre_l1_merge() -> Result<(), anyhow::Error> {
18+
// use a scope to ensure everything is dropped
19+
{
20+
// Create a MovementConfig with the correct port
21+
let mut movement_config = MovementConfig::default();
22+
movement_config
23+
.execution_config
24+
.maptos_config
25+
.client
26+
.maptos_rest_connection_port = 30731;
27+
28+
// Get the account address from the same MovementConfig
29+
let account_address = aptos_test_root_address();
30+
31+
// Create a Movement instance with the config
32+
let movement = Movement::new(
33+
movement_config.clone(),
34+
movement_core::MovementWorkspace::try_temp()?,
35+
Overlays::default(),
36+
true,
37+
true,
38+
);
39+
40+
// Form the migrator with the configured Movement instance
41+
let mut movement_migrator = MovementMigrator::new(Runner::Movement(movement));
42+
43+
// Start the migrator so that it's running in the background.
44+
// In the future, some migrators may be for already running nodes.
45+
let movement_migrator_for_task = movement_migrator.clone();
46+
let movement_migrator_task = kestrel::task(async move {
47+
movement_migrator_for_task.run().await?;
48+
Ok::<_, anyhow::Error>(())
49+
});
50+
51+
// Wait for the Celestia light node to be ready
52+
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
53+
54+
// wait for the rest client to be ready
55+
info!("Waiting for REST client to be ready (timeout: 600s)");
56+
let rest_api_url = movement_migrator
57+
.wait_for_rest_api_url(tokio::time::Duration::from_secs(600))
58+
.await?;
59+
info!("REST API URL: {}", rest_api_url);
60+
61+
movement_migrator
62+
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(600))
63+
.await
64+
.context(
65+
"failed to wait for movement migrator rest client while running accounts equal manual prelude",
66+
)?;
67+
info!("REST client is ready");
68+
69+
// Wait for the account to be created
70+
info!("Getting REST client for account check (timeout: 30s)");
71+
let rest_client = movement_migrator
72+
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(30))
73+
.await
74+
.context("failed to get rest client")?;
75+
info!("Checking for account existence, address: {}", account_address);
76+
match rest_client.get_account(account_address).await {
77+
Ok(_) => {
78+
info!("Account found");
79+
}
80+
Err(e) => {
81+
info!("Account not found: {:?}", e);
82+
}
83+
}
84+
85+
// Form the prelude.
86+
info!("Creating empty prelude");
87+
let prelude = Prelude::new_empty();
88+
89+
// Form the migration.
90+
let mut migration_config = PreL1MergeConfig::default();
91+
migration_config.account_address = Some(account_address);
92+
let migration = migration_config.build()?;
93+
94+
// Run the checked migration (skipping the accounts equal check).
95+
info!("Running migration");
96+
match checked_migration(
97+
&mut movement_migrator,
98+
&prelude,
99+
&migration,
100+
Vec::<AccountsEqual>::new(),
101+
)
102+
.await
103+
{
104+
Ok(()) => {}
105+
Err(e) => {
106+
info!("Migration failed: {:?}", e);
107+
return Err(anyhow::anyhow!("Migration failed: {:?}", e));
108+
}
109+
}
110+
info!("Migration succeeded");
111+
112+
kestrel::end!(movement_migrator_task)?;
113+
}
114+
115+
// exit the test is fine when you only have one test per crate because when cargo test is run across a workspace, it actually multi-processes the tests by crate
116+
std::process::exit(0);
117+
118+
#[allow(unreachable_code)]
119+
Ok(())
120+
}
121+
}

checks/migrator/checks/sketchpad/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ chrono = { workspace = true }
2525
rand = { workspace = true }
2626
kestrel = { workspace = true }
2727
mtma-node-test-types = { workspace = true }
28+
mtma-migrator-pre-l1-merge-core = { workspace = true }
2829

2930
[dev-dependencies]
3031
tracing-test = { workspace = true }

migration/cli/migrate-chain-dev/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ anyhow = { workspace = true }
1717
clap-markdown-ext = { workspace = true }
1818
orfile = { workspace = true }
1919
mtma-core = { workspace = true }
20+
mtma-migrate-chain-core = { workspace = true }
2021
jemallocator = { workspace = true }
2122
mtma-node-null-core = { workspace = true }
2223
mtma-node-test-global-storage-injective-criterion = { workspace = true }

migration/cli/migrate-chain-dev/docs/cli/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,16 @@ Migrate from Movement to MovementAptos
103103

104104
Run migrate with all parameters passed explicitly as CLI flags. See Orfile documentation for more details: <https://github.com/movementlabsxyz/orfile>
105105

106-
**Usage:** `mtma-migrate-chain-dev migrate where --movement-state-db-path <MOVEMENT_STATE_DB_PATH> --movement-aptos-state-db-path <MOVEMENT_APTOS_STATE_DB_PATH>`
106+
**Usage:** `mtma-migrate-chain-dev migrate where --from <FROM> --to <TO> --maptos-signer <MAPTOS_SIGNER> --da-signer <DA_SIGNER> --mcr-signer <MCR_SIGNER> --movement-args <MOVEMENT_ARGS>`
107107

108108
###### **Options:**
109109

110-
* `--movement-state-db-path <MOVEMENT_STATE_DB_PATH>` — The path to the input Movement state database
111-
* `--movement-aptos-state-db-path <MOVEMENT_APTOS_STATE_DB_PATH>` — The path to the output MovementAptos state database
110+
* `--from <FROM>` — The known release you are migrating from, eg elsa or biarritz-rc1
111+
* `--to <TO>` — The known release you are migrating to, eg biarritz-rc1 or pre-l1-merge
112+
* `--maptos-signer <MAPTOS_SIGNER>` — The canonical string for the Maptos signer used in the migration
113+
* `--da-signer <DA_SIGNER>` — The canonical string for the DA signer used in the migration
114+
* `--mcr-signer <MCR_SIGNER>` — The canonical string for the MCR signer used in the migration
115+
* `--movement-args <MOVEMENT_ARGS>` — Movement configuration arguments
112116

113117

114118

0 commit comments

Comments
 (0)