Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ chrono = "0.4.31"
rand = "0.7.3"
uuid = "1.10.0"
glob = "0.3.2"
bytes = { version = "1.4.0", features = ["serde"] }

poem = { version = "=3.1.3", features = ["anyhow", "compression", "rustls"] }
poem-openapi = { version = "=5.1.2", features = ["swagger-ui", "url"] }
Expand Down Expand Up @@ -141,12 +142,12 @@ aptos-vm-genesis = { git = "https://github.com/movementlabsxyz/aptos-core.git",


# kestrel
kestrel = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
jsonlvar = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
commander = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
include-dir = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
include-vendor = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
ready-docker = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "3220d704df7e06d1dcc5266e15eaf05db86fdb07" }
kestrel = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "e23cbcc8c804d27d8ae39f582ff7eae6bebad50" }
jsonlvar = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "e23cbcc8c804d27d8ae39f582ff7eae6bebad50" }
commander = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "e23cbcc8c804d27d8ae39f582ff7eae6bebad50" }
include-dir = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "e23cbcc8c804d27d8ae39f582ff7eae6bebad50" }
include-vendor = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "e23cbcc8c804d27d8ae39f582ff7eae6bebad50" }
ready-docker = { git = "https://github.com/movementlabsxyz/kestrel.git", rev = "e23cbcc8c804d27d8ae39f582ff7eae6bebad50" }

# orfile
orfile = { git = "https://github.com/movementlabsxyz/orfile.git", rev = "f02851242af77791b905efc19aef6af21918fb1e" }
Expand Down
79 changes: 34 additions & 45 deletions checks/migrator/checks/balances-equal/src/balances_equal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,51 @@ pub mod test {
#[tokio::test(flavor = "multi_thread")]
#[tracing_test::traced_test]
async fn test_balances_equal() -> Result<(), anyhow::Error> {
// use a scope to ensure everything is dropped
{
// Form the migrator.
let mut movement_migrator = MovementMigrator::try_temp()?;
movement_migrator.set_overlays(Overlays::default());

// Start the migrator so that it's running in the background.
// In the future, some migrators may be for already running nodes.
let movement_migrator_for_task = movement_migrator.clone();
let movement_migrator_task = kestrel::task(async move {
movement_migrator_for_task.run().await?;
Ok::<_, anyhow::Error>(())
});

// wait for the rest client to be ready
// once we have this, there should also be a config, so we can then kill off the migrator and proceed
movement_migrator
// Form the migrator.
let mut movement_migrator = MovementMigrator::try_temp()?;
movement_migrator.set_overlays(Overlays::default());

// Start the migrator so that it's running in the background.
// In the future, some migrators may be for already running nodes.
let movement_migrator_for_task = movement_migrator.clone();
let movement_migrator_task = kestrel::task(async move {
movement_migrator_for_task.run().await?;
Ok::<_, anyhow::Error>(())
});

// wait for the rest client to be ready
// once we have this, there should also be a config, so we can then kill off the migrator and proceed
movement_migrator
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(600)) // we wait for up to ten minutes because the nix flake in .vendors/movementcan be a bit slow the first time
.await
.context(
"failed to wait for movement migrator rest client while running accounts equal manual prelude",
)?;

kestrel::end!(movement_migrator_task)?;
kestrel::end!(movement_migrator_task)?;

// Form the prelude.
// todo: this needs to be updated to use the prelude generator
let prelude = Prelude::new_empty();
// Form the prelude.
// todo: this needs to be updated to use the prelude generator
let prelude = Prelude::new_empty();

// Form the migration.
let migration_config = MtmaNullConfig::default();
let migration = migration_config.build()?;
// Form the migration.
let migration_config = MtmaNullConfig::default();
let migration = migration_config.build()?;

// Run the checked migration.
let balances_equal = BalancesEqual::new();
info!("Running migration");
match checked_migration(
&mut movement_migrator,
&prelude,
&migration,
vec![balances_equal],
)
// Run the checked migration.
let balances_equal = BalancesEqual::new();
info!("Running migration");
match checked_migration(&mut movement_migrator, &prelude, &migration, vec![balances_equal])
.await
{
Ok(()) => {}
Err(e) => {
info!("Migration failed: {:?}", e);
return Err(anyhow::anyhow!("Migration failed: {:?}", e));
}
{
Ok(()) => {
info!("Migration succeeded");
std::process::exit(0);
}
Err(e) => {
info!("Migration failed: {:?}", e);
panic!("Migration failed: {:?}", e);
}
info!("Migration succeeded");
}

// 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
std::process::exit(0);

// Ok(())
}
}
83 changes: 37 additions & 46 deletions checks/migrator/checks/sketchpad/src/accounts_equal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,53 @@ pub mod test {
#[tokio::test(flavor = "multi_thread")]
#[tracing_test::traced_test]
async fn test_accounts_equal() -> Result<(), anyhow::Error> {
// use a scope to ensure everything is dropped
{
// Form the migrator.
let mut movement_migrator = MovementMigrator::try_temp()?;
movement_migrator.set_overlays(Overlays::default());
// Form the migrator.
let mut movement_migrator = MovementMigrator::try_temp()?;
movement_migrator.set_overlays(Overlays::default());

// Start the migrator so that it's running in the background.
// In the future, some migrators may be for already running nodes.
let movement_migrator_for_task = movement_migrator.clone();
let movement_migrator_task = kestrel::task(async move {
movement_migrator_for_task.run().await?;
Ok::<_, anyhow::Error>(())
});
// Start the migrator so that it's running in the background.
// In the future, some migrators may be for already running nodes.
let movement_migrator_for_task = movement_migrator.clone();
let movement_migrator_task = kestrel::task(async move {
movement_migrator_for_task.run().await?;
Ok::<_, anyhow::Error>(())
});

// wait for the rest client to be ready
// once we have this, there should also be a config, so we can then kill off the migrator and proceed
movement_migrator
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(600)) // we wait for up to ten minutes because the nix flake in .vendors/movementcan be a bit slow the first time
.await
.context(
"failed to wait for movement migrator rest client while running accounts equal manual prelude",
)?;
// wait for the rest client to be ready
// once we have this, there should also be a config, so we can then kill off the migrator and proceed
movement_migrator
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(600)) // we wait for up to ten minutes because the nix flake in .vendors/movementcan be a bit slow the first time
.await
.context(
"failed to wait for movement migrator rest client while running accounts equal manual prelude",
)?;

kestrel::end!(movement_migrator_task)?;
kestrel::end!(movement_migrator_task)?;

// Form the prelude.
// todo: this needs to be updated to use the prelude generator
let prelude = Prelude::new_empty();
// Form the prelude.
// todo: this needs to be updated to use the prelude generator
let prelude = Prelude::new_empty();

// Form the migration.
let migration_config = MtmaNullConfig::default();
let migration = migration_config.build()?;
// Form the migration.
let migration_config = MtmaNullConfig::default();
let migration = migration_config.build()?;

// Run the checked migration.
let accounts_equal = AccountsEqual::new();
info!("Running migration");
match checked_migration(
&mut movement_migrator,
&prelude,
&migration,
vec![accounts_equal],
)
// Run the checked migration.
let accounts_equal = AccountsEqual::new();
info!("Running migration");
match checked_migration(&mut movement_migrator, &prelude, &migration, vec![accounts_equal])
.await
{
Ok(()) => {}
Err(e) => {
info!("Migration failed: {:?}", e);
return Err(anyhow::anyhow!("Migration failed: {:?}", e));
}
{
Ok(_) => {
info!("Migration succeeded");
std::process::exit(0);
}
Err(e) => {
info!("Migration failed: {:?}", e);
panic!("Migration failed: {:?}", e);
}
info!("Migration succeeded");
}

// 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
std::process::exit(0);

// Ok(())
}
}
17 changes: 6 additions & 11 deletions checks/migrator/citeria/accounts-equal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ impl Criterionish for AccountsEqual {
"failed to wait for movement migrator rest client while checking accounts equal",
)
.map_err(|e| CriterionError::Internal(e.into()))?;

let movement_aptos_rest_client = movement_aptos_migrator
.wait_for_rest_client_ready(tokio::time::Duration::from_secs(30))
.await
Expand All @@ -41,19 +42,13 @@ impl Criterionish for AccountsEqual {

info!("Iterating over movement node accounts");
for account_address_res in movement_node
.iter_account_addresses(0)
.iter_account_addresses(Some(0))
.iter()
.map_err(|e| CriterionError::Internal(e.into()))?
{
let account_address = match account_address_res
.context("account address is none")
.map_err(|e| CriterionError::Internal(e.into()))
{
Ok(account_address) => account_address,
Err(e) => {
info!("Transaction has no sender: {:?}", e);
continue;
}
};
let account_address = account_address_res
.context("failed to get account address")
.map_err(|e| CriterionError::Internal(e.into()))?;

info!("Getting movement resource");
let movement_resource = movement_rest_client
Expand Down
Loading
Loading