Skip to content

Commit 25de9df

Browse files
committed
Merge branch 'l-monninger/fix-secure-signer' of https://github.com/movementlabsxyz/movement-migration into l-monninger/docker-build-with-d-in-d
2 parents ff0d636 + 5258d96 commit 25de9df

File tree

35 files changed

+1009
-115
lines changed

35 files changed

+1009
-115
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
1515

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

Cargo.lock

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

Cargo.toml

Lines changed: 13 additions & 12 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" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Checks that both `movement` and `movement-aptos` balances for the native token a
240240

241241
## Organization
242242

243-
There are five subdirectories which progressively build on one another for node logic.
243+
There are three subdirectories which progressively build on one another for node logic.
244244

245245
1. [`util`](./util): contains utility logic mainly reused in [`migration`](./migration).
246246
2. [`migration`](./migration): contains the implementation of the migration.

checks/README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
# Checks
22

3-
- [`e2e`](./e2e/README.md) covers logic for end-to-end validation of the migration.
4-
- [`e2e`](./executor/README.md) covers logic for validating the
3+
1. [`migrator`](./migration/README.md) covers logic for end-to-end validation of the migration.
4+
2. [`node`](./node/README.md) covers logic for validating the executor-only portions of the migration.
55

6-
All tests rely on clearly stated criteria APIs which are pulled up under a `Criterion` type. Before evaluating each `Criterion` a `Scenario` is run. Hence tests are formed:
6+
All tests rely on clearly stated criteria APIs which are pulled up under a `Criterion` type. Before evaluating each `Criterion` a `Prelude` is run. Hence tests are formed:
77

88
```rust
9-
test(
10-
Scenario,
11-
[
12-
CriterionA,
13-
CriterionB,
14-
CriterionC
15-
]
16-
)
9+
checked_migration(&mut movement_migrator, &prelude, &migration, vec![criterion_a, criterion_b, criterion_c])
10+
.await?;
1711
```
1812

1913
The rigidity of this structure is to make it clear what the migration is accomplishing from the testing entrypoint. More standard and flexible assertions should be performed at lower levels in this repository.
2014

2115
## `Criterion`
2216
Tests are split into separate subdirectories which use their own `Criterion` types:
2317

24-
- `e2e` wherein a `Criterion` is evaluated against a `MovementRestClient` and a `MovementAptosRestClient` respectively.
25-
- `executor` wherein a `Criterion` is evaluated against a `MovementExecutor` and a `MovementAptosExecutor` respectively.
18+
- `migrator` wherein a `Criterion` is evaluated against a `MovementMigrator` and a `MovementAptosMigrator` respectively.
19+
- `node` wherein a `Criterion` is evaluated against a `MovementNode` and a `MovementAptosNode` respectively.
2620

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
hex = { workspace = true }
13+
mtma-types = { workspace = true }
14+
mtma-migrator-types = { workspace = true }
15+
mtma-migrator-test-types = { workspace = true }
16+
anyhow = { workspace = true }
17+
mtma-node-replay-core = { workspace = true }
18+
mtma-node-test-global-storage-injective-criterion = { workspace = true }
19+
mtma-node-test-global-storage-includes-criterion = { workspace = true }
20+
mtma-node-test-global-storage-not-empty-criterion = { workspace = true }
21+
mtma-migrator-test-accounts-equal-criterion = { workspace = true }
22+
mtma-node-preludes = { workspace = true }
23+
mtma-node-null-core = { workspace = true }
24+
tokio = { workspace = true }
25+
chrono = { workspace = true }
26+
rand = { workspace = true }
27+
kestrel = { workspace = true }
28+
mtma-node-test-types = { workspace = true }
29+
mtma-migrator-pre-l1-merge-core = { workspace = true }
30+
movement-core = { workspace = true }
31+
32+
[dev-dependencies]
33+
tracing-test = { workspace = true }
34+
tracing = { workspace = true }
35+
tempfile = { workspace = true }
36+
37+
[lints]
38+
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: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#[cfg(test)]
2+
pub mod test {
3+
4+
use anyhow::Context;
5+
use mtma_node_test_types::criterion::movement_executor::maptos_opt_executor::aptos_types::account_address::AccountAddress;
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::{Overlays, MovementMigrator, Runner}};
10+
use mtma_node_test_types::prelude::Prelude;
11+
use std::str::FromStr;
12+
use tracing::info;
13+
use movement_core::Movement;
14+
use mtma_types::movement::movement_config::Config as MovementConfig;
15+
use hex;
16+
use mtma_types::movement::aptos_sdk::types::account_config::aptos_test_root_address;
17+
18+
#[tokio::test(flavor = "multi_thread")]
19+
#[tracing_test::traced_test]
20+
async fn test_accounts_equal() -> Result<(), anyhow::Error> {
21+
// use a scope to ensure everything is dropped
22+
{
23+
// Create a MovementConfig with the correct port
24+
let mut movement_config = MovementConfig::default();
25+
movement_config
26+
.execution_config
27+
.maptos_config
28+
.client
29+
.maptos_rest_connection_port = 30731;
30+
31+
// Get the account address from the same MovementConfig
32+
let account_address = aptos_test_root_address();
33+
34+
// Create a Movement instance with the config
35+
let movement = Movement::new(
36+
movement_config.clone(),
37+
movement_core::MovementWorkspace::try_temp()?,
38+
Overlays::default(),
39+
true,
40+
true,
41+
);
42+
43+
// Form the migrator with the configured Movement instance
44+
let mut movement_migrator = MovementMigrator::new(Runner::Movement(movement));
45+
46+
// Start the migrator so that it's running in the background.
47+
// In the future, some migrators may be for already running nodes.
48+
let movement_migrator_for_task = movement_migrator.clone();
49+
let movement_migrator_task = kestrel::task(async move {
50+
movement_migrator_for_task.run().await?;
51+
Ok::<_, anyhow::Error>(())
52+
});
53+
54+
// Wait for the Celestia light node to be ready
55+
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
56+
57+
// wait for the rest client to be ready
58+
info!("Waiting for REST client to be ready (timeout: 600s)");
59+
let mut rest_api_url = movement_migrator
60+
.wait_for_rest_api_url(tokio::time::Duration::from_secs(600))
61+
.await?;
62+
info!("REST API URL: {}", rest_api_url);
63+
64+
movement_migrator
65+
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(600))
66+
.await
67+
.context(
68+
"failed to wait for movement migrator rest client while running accounts equal manual prelude",
69+
)?;
70+
info!("REST client is ready");
71+
72+
// Wait for the account to be created
73+
info!("Getting REST client for account check (timeout: 30s)");
74+
let rest_client = movement_migrator
75+
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(30))
76+
.await
77+
.context("failed to get rest client")?;
78+
info!("Checking for account existence, address: {}", account_address);
79+
match rest_client.get_account(account_address).await {
80+
Ok(_) => {
81+
info!("Account found");
82+
}
83+
Err(e) => {
84+
info!("Account not found: {:?}", e);
85+
}
86+
}
87+
88+
// Form the prelude.
89+
info!("Creating empty prelude");
90+
let prelude = Prelude::new_empty();
91+
92+
// Form the migration.
93+
let mut migration_config = PreL1MergeConfig::default();
94+
migration_config.account_address = Some(account_address);
95+
let migration = migration_config.build()?;
96+
97+
// Run the checked migration (skipping the accounts equal check).
98+
info!("Running migration");
99+
match checked_migration(
100+
&mut movement_migrator,
101+
&prelude,
102+
&migration,
103+
Vec::<AccountsEqual>::new(),
104+
)
105+
.await
106+
{
107+
Ok(()) => {}
108+
Err(e) => {
109+
info!("Migration failed: {:?}", e);
110+
return Err(anyhow::anyhow!("Migration failed: {:?}", e));
111+
}
112+
}
113+
info!("Migration succeeded");
114+
115+
// Let the task run in the background and let the Drop implementation handle the shutdown
116+
drop(movement_migrator_task);
117+
}
118+
119+
// 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
120+
std::process::exit(0);
121+
122+
Ok(())
123+
}
124+
}

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 }

0 commit comments

Comments
 (0)