Skip to content

Commit

Permalink
Merge branch '0xmovses/merge-upstream-june-2' into 0xmovses/setup-tes…
Browse files Browse the repository at this point in the history
…t-framework
  • Loading branch information
0xmovses committed Jun 2, 2024
2 parents a20dcaa + 6fd6a8f commit 7ffd97d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 80 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-moose-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/core': patch
---

update run_locally
11 changes: 11 additions & 0 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ env $(cat ./config/validator.fuji.env | grep -v "#" | xargs) ./target/debug/vali

#### Automated E2E Test

For the E2E test run you need a local instance of postgres running. For macOS:
`brew install postgresql@14`
`brew services start postgresql@14`
`brew services list`

Then you need to create the postgres super user (if this hasn't been created already):
`/opt/homebrew/opt/postgresql@14/bin/createuser -s postgres`

And verify the connection:
`psql -h localhost -U postgres -d postgres`

To perform an automated e2e test of the agents locally, from within the `hyperlane-monorepo/rust` directory, run:

```bash
Expand Down
16 changes: 1 addition & 15 deletions rust/utils/run-locally/src/aptos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,13 @@ use tempfile::{tempdir, NamedTempFile};
pub fn install_aptos_cli() {
log!("Installing Aptos CLI");
// aptos node run-local-testnet --with-faucet --faucet-port 8081 --force-restart --assume-yes
let aptos_cli_dir = tempdir().unwrap();
Program::new("curl")
.flag("location")
.flag("silent")
.arg("output", "install_aptos_cli.py")
.working_dir(aptos_cli_dir.as_ref().to_str().unwrap())
.cmd(format!("https://aptos.dev/scripts/install_cli.py"))
.run()
.join();
Program::new("python3")
.working_dir(aptos_cli_dir.as_ref().to_str().unwrap())
.cmd(format!("install_aptos_cli.py"))
.run()
.join();
}

#[apply(as_task)]
pub fn start_aptos_local_testnet() -> AgentHandles {
log!("Running Aptos Local Testnet");
// aptos node run-local-testnet --with-faucet --faucet-port 8081 --force-restart --assume-yes
let local_net_program = Program::new("/root/.local/bin/aptos")
let local_net_program = Program::new("/opt/homebrew/bin/aptos")
.cmd("node")
.cmd("run-local-testnet")
.flag("with-faucet")
Expand Down
71 changes: 12 additions & 59 deletions rust/utils/run-locally/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,11 @@ fn main() -> ExitCode {
//

install_aptos_cli().join();
// let aptos_local_net_runner = start_aptos_local_testnet().join();
// state.push_agent(aptos_local_net_runner);
let aptos_local_net_runner = start_aptos_local_testnet().join();
state.push_agent(aptos_local_net_runner);
start_aptos_deploying().join();
init_aptos_modules_state().join();

let (solana_path, solana_path_tempdir) = install_solana_cli_tools().join();
state.data.push(Box::new(solana_path_tempdir));
let solana_program_builder = build_solana_programs(solana_path.clone());

// this task takes a long time in the CI so run it in parallel
log!("Building rust...");
let build_rust = Program::new("cargo")
Expand All @@ -345,7 +341,7 @@ fn main() -> ExitCode {

let start_anvil = start_anvil(config.clone());

let solana_program_path = solana_program_builder.join();
//let solana_program_path = solana_program_builder.join();

log!("Running postgres db...");
let postgres = Program::new("docker")
Expand All @@ -360,19 +356,6 @@ fn main() -> ExitCode {

build_rust.join();

let solana_ledger_dir = tempdir().unwrap();
let start_solana_validator = start_solana_test_validator(
solana_path.clone(),
solana_program_path,
solana_ledger_dir.as_ref().to_path_buf(),
);

let (solana_config_path, solana_validator) = start_solana_validator.join();

// Was commented out in aptos-v3 commit
// state.push_agent(solana_validator);
// state.push_agent(start_anvil.join());

// spawn 1st validator before any messages have been sent to test empty mailbox
state.push_agent(validator_envs.first().unwrap().clone().spawn("VL1"));

Expand All @@ -382,15 +365,15 @@ fn main() -> ExitCode {
Program::new(concat_path(AGENT_BIN_PATH, "init-db"))
.run()
.join();
// state.push_agent(scraper_env.spawn("SCR"));
state.push_agent(scraper_env.spawn("SCR"));

// Send half the kathy messages before starting the rest of the agents
let kathy_env_single_insertion = Program::new("yarn")
.working_dir(INFRA_PATH)
.cmd("kathy")
.arg("messages", (config.kathy_messages / 4).to_string())
.arg("timeout", "1000");
// kathy_env_single_insertion.clone().run().join();
kathy_env_single_insertion.clone().run().join();

let kathy_env_zero_insertion = Program::new("yarn")
.working_dir(INFRA_PATH)
Expand All @@ -403,7 +386,7 @@ fn main() -> ExitCode {
// replacing the `aggregationHook` with the `interchainGasPaymaster` means there
// is no more `merkleTreeHook`, causing zero merkle insertions to occur.
.arg("default-hook", "interchainGasPaymaster");
// kathy_env_zero_insertion.clone().run().join();
kathy_env_zero_insertion.clone().run().join();

let kathy_env_double_insertion = Program::new("yarn")
.working_dir(INFRA_PATH)
Expand All @@ -413,12 +396,6 @@ fn main() -> ExitCode {
// replacing the `protocolFees` required hook with the `merkleTreeHook`
// will cause double insertions to occur, which should be handled correctly
.arg("required-hook", "merkleTreeHook");
// kathy_env_double_insertion.clone().run().join();

// Send some sealevel messages before spinning up the agents, to test the backward indexing cursor
for _i in 0..(SOL_MESSAGES_EXPECTED / 2) {
initiate_solana_hyperlane_transfer(solana_path.clone(), solana_config_path.clone()).join();
}

// spawn the rest of the validators
for (i, validator_env) in validator_envs.into_iter().enumerate().skip(1) {
Expand All @@ -428,11 +405,6 @@ fn main() -> ExitCode {

state.push_agent(relayer_env.spawn("RLY"));

// Send some sealevel messages after spinning up the relayer, to test the forward indexing cursor
for _i in 0..(SOL_MESSAGES_EXPECTED / 2) {
initiate_solana_hyperlane_transfer(solana_path.clone(), solana_config_path.clone()).join();
}

for _i in 0..5 {
aptos_send_messages().join();
}
Expand All @@ -441,37 +413,18 @@ fn main() -> ExitCode {
log!("Ctrl+C to end execution...");

// Send half the kathy messages after the relayer comes up
// kathy_env_double_insertion.clone().run().join();
// kathy_env_zero_insertion.clone().run().join();
// state.push_agent(kathy_env_single_insertion.flag("mineforever").spawn("KTY"));
kathy_env_double_insertion.clone().run().join();
kathy_env_zero_insertion.clone().run().join();
state.push_agent(kathy_env_single_insertion.flag("mineforever").spawn("KTY"));

let loop_start = Instant::now();
// give things a chance to fully start.
sleep(Duration::from_secs(10));
let mut failure_occurred = false;
let starting_relayer_balance: f64 = agent_balance_sum(9092).unwrap();
while !SHUTDOWN.load(Ordering::Relaxed) {
if config.ci_mode {
// for CI we have to look for the end condition.
// if termination_invariants_met(&config, starting_relayer_balance)
if termination_invariants_met(
&config,
starting_relayer_balance,
&solana_path,
&solana_config_path,
)
.unwrap_or(false)
{
// end condition reached successfully
break;
} else if (Instant::now() - loop_start).as_secs() > config.ci_mode_timeout {
// we ran out of time
log!("CI timeout reached before queues emptied");
failure_occurred = true;
break;
}
}

// For some reason this agent is not starting on this port. Seperate issue to fix.
let _starting_relayer_balance: f64 = agent_balance_sum(9092).unwrap();
while !SHUTDOWN.load(Ordering::Relaxed) {
// verify long-running tasks are still running
for (name, child) in state.agents.iter_mut() {
if let Some(status) = child.try_wait().unwrap() {
Expand Down
6 changes: 0 additions & 6 deletions typescript/sdk/src/providers/MultiProtocolProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { expect } from 'chai';

<<<<<<< HEAD
import { ethereum } from '../consts/chainMetadata';
import { Chains } from '../consts/chains';
import { MultiProtocolProvider } from './MultiProtocolProvider';
=======
import { TestChainName, test1 } from '../consts/testChains.js';
import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js';
>>>>>>> main

describe('MultiProtocolProvider', () => {
describe('constructs', () => {
Expand Down

0 comments on commit 7ffd97d

Please sign in to comment.