Skip to content

Commit

Permalink
Merge pull request #677 from movementlabsxyz/andygolay/framework-clie…
Browse files Browse the repository at this point in the history
…nt-tests

Client integration tests against framework modules
  • Loading branch information
0xmovses authored Oct 16, 2024
2 parents 903594f + c69fc5a commit 70ae3c1
Show file tree
Hide file tree
Showing 26 changed files with 2,241 additions and 461 deletions.
269 changes: 135 additions & 134 deletions Cargo.lock

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,40 @@ serde_yaml = "0.9.34"
## Aptos dependencies
### We use a forked version so that we can override dependency versions. This is required
### to be avoid dependency conflicts with other Sovereign Labs crates.
aptos-api = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-api-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-bitvec = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-block-executor = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-cached-packages = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-config = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-consensus-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-crypto = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd", features = [
aptos-api = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-api-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-bitvec = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-block-executor = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-cached-packages = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-config = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-consensus-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-crypto = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e", features = [
"cloneable-private-keys",
] }
aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-executor = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-executor-test-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-executor-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-faucet-core = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-framework = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-language-e2e-tests = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-mempool = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-proptest-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-sdk = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-state-view = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-storage-interface = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-temppath = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-vm-genesis = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-vm-logging = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-vm-validator = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-logger = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-vm-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-indexer = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-indexer-grpc-fullnode = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-indexer-grpc-table-info = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-protos = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "70be3926ff79ff4cdb0cee928f717fafcd41ecdd" }
aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-executor = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-executor-test-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-executor-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-faucet-core = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-framework = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-language-e2e-tests = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-mempool = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-proptest-helpers = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-sdk = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-state-view = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-storage-interface = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-temppath = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-vm-genesis = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-vm-logging = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-vm-validator = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-logger = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-vm-types = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-indexer = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-indexer-grpc-fullnode = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-indexer-grpc-table-info = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }
aptos-protos = { git = "https://github.com/movementlabsxyz/aptos-core", rev = "7a0e210fe29e2c81c378568eba2b467a7ef6a56e" }

# Indexer
processor = { git = "https://github.com/movementlabsxyz/aptos-indexer-processors", rev = "8e83cde3cb75fabdade9485e0af680cc4b73ca8e", subdir = "rust" }
Expand Down
25 changes: 20 additions & 5 deletions protocol-units/bridge/config/src/common/movement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const DEFAULT_MVT_FAUCET_CONNECTION_PORT: u16 = 8081;

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct MovementConfig {
#[serde(default = "default_movement_signer_address")]
pub movement_signer_address: Ed25519PrivateKey,
#[serde(default = "default_movement_signer_key")]
pub movement_signer_key: Ed25519PrivateKey,
#[serde(default = "default_movement_native_address")]
pub movement_native_address: String,

Expand All @@ -34,8 +34,8 @@ pub struct MovementConfig {
}

// The default private key
pub fn default_movement_signer_address() -> Ed25519PrivateKey {
match std::env::var("MOVEMENT_SIGNER_ADDRESS") {
pub fn default_movement_signer_key() -> Ed25519PrivateKey {
match std::env::var("MOVEMENT_SIGNER_KEY") {
Ok(val) => Ed25519PrivateKey::from_encoded_string(&val).unwrap(),
Err(_) => Ed25519PrivateKey::generate(&mut rand::thread_rng()),
}
Expand Down Expand Up @@ -110,12 +110,26 @@ impl MovementConfig {
self.mvt_faucet_connection_port
)
}

pub fn suzuka() -> Self {
MovementConfig {
movement_signer_key: Ed25519PrivateKey::from_encoded_string("0x0000000000000000000000000000000000000000000000000000000000000001").unwrap(),
movement_native_address: "0xf90391c81027f03cdea491ed8b36ffaced26b6df208a9b569e5baf2590eb9b16".to_string(),
mvt_rpc_connection_protocol: default_mvt_rpc_connection_protocol(),
mvt_rpc_connection_hostname: default_mvt_rpc_connection_hostname(),
mvt_rpc_connection_port: 30731,
mvt_faucet_connection_protocol: default_mvt_rpc_connection_protocol(),
mvt_faucet_connection_hostname: default_mvt_rpc_connection_hostname(),
mvt_faucet_connection_port: 30732,
mvt_init_network: default_mvt_init_network(),
}
}
}

impl Default for MovementConfig {
fn default() -> Self {
MovementConfig {
movement_signer_address: default_movement_signer_address(),
movement_signer_key: default_movement_signer_key(),
movement_native_address: default_movement_native_address(),
mvt_rpc_connection_protocol: default_mvt_rpc_connection_protocol(),
mvt_rpc_connection_hostname: default_mvt_rpc_connection_hostname(),
Expand All @@ -125,5 +139,6 @@ impl Default for MovementConfig {
mvt_faucet_connection_port: default_mvt_faucet_connection_port(),
mvt_init_network: default_mvt_init_network(),
}

}
}
10 changes: 10 additions & 0 deletions protocol-units/bridge/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@ pub fn get_config_path(dot_movement: &dot_movement::DotMovement) -> std::path::P
pathbuff.push(BRIDGE_CONF_FOLDER);
pathbuff
}

impl Config {
pub fn suzuka() -> Self {
Config {
eth: common::eth::EthConfig::default(),
movement: common::movement::MovementConfig::suzuka(),
testing: common::testing::TestingConfig::default(),
}
}
}
1 change: 1 addition & 0 deletions protocol-units/bridge/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ aptos-types = { workspace = true }
aptos-sdk = { workspace = true }
anyhow = { workspace = true }
bcs = { workspace = true }
chrono = "0.4"
hex = { workspace = true }
alloy = { workspace = true }
reqwest = { workspace = true }
Expand Down
44 changes: 44 additions & 0 deletions protocol-units/bridge/integration-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Running client integration tests against the atomic bridge

The client integration tests for the framework bridge modules are in `tests`:

- `client_l1move_l2move.rs` (run with command `rust_backtrace=1 cargo test --test client_l1move_l2move test_movement_client_initiate_transfer -- --nocapture --test-threads=1`)
- `client_l2move_l1move.rs` (run with command `rust_backtrace=1 cargo test --test client_l2move_l1move test_movement_client_initiate_transfer -- --nocapture --test-threads=1`)

In order to successfully run the tests against a local Suzuka node, the core resource account `0xA550C18` needs to be set to the same private key generated in `config.json`.

## Steps to run integration tests

1. Navigate to the root of the `movement` repo, checkout the `andygolay/framework-client-tests` branch, and start a local Suzuka node:

```
CELESTIA_LOG_LEVEL=FATAL CARGO_PROFILE=release CARGO_PROFILE_FLAGS=--release nix develop --extra-experimental-features nix-command --extra-experimental-features flakes --command bash -c "just bridge native build.setup.eth-local.celestia-local --keep-tui"
```

Note, if you have any `.movement` directories present, e.g. when re-running tests, the directories must be deleted before starting the node.

2. In the generated `.movement` directory, there will be a `config.yaml`. In that file, change `f90391c81027f03cdea491ed8b36ffaced26b6df208a9b569e5baf2590eb9b16` to `0xA550C18` so the file looks like:

```
---
profiles:
default:
network: Custom
private_key: "0x0000000000000000000000000000000000000000000000000000000000000001"
public_key: "0x4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29"
account: "0xA550C18"
rest_url: "http://0.0.0.0:30731/"
faucet_url: "http://0.0.0.0:30732/"
```

3. Run each set of Movement client tests:

L1 Move to L2 Move:
```
rust_backtrace=1 cargo test --test client_l1move_l2move -- --nocapture --test-threads=1
```

L2 Move to L1 Move:
```
rust_backtrace=1 cargo test --test client_l2move_l1move -- --nocapture --test-threads=1
```
Loading

0 comments on commit 70ae3c1

Please sign in to comment.