@ -29,7 +29,7 @@ use tempfile::tempdir;
use crate ::{
config ::Config ,
ethereum ::start_anvil ,
invariants ::termination_invariants_met ,
invariants ::{ termination_invariants_met , SOL_MESSAGES_EXPECTED } ,
metrics ::agent_balance_sum ,
solana ::* ,
utils ::{ concat_path , make_static , stop_child , AgentHandles , ArbitraryData , TaskHandle } ,
@ -54,9 +54,9 @@ const RELAYER_KEYS: &[&str] = &[
// test3
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356" ,
// sealeveltest1
// "0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f",
// // sealeveltest2
// "0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f",
"0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f" ,
// sealeveltest2
"0x892bf6949af4233e62f854cb3618bc1a3ee3341dc71ada08c4d5deca239acf4f" ,
] ;
/// These private keys are from hardhat/anvil's testing accounts.
/// These must be consistent with the ISM config for the test.
@ -66,15 +66,13 @@ const VALIDATOR_KEYS: &[&str] = &[
"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba" ,
"0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e" ,
// sealevel
// "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d" ,
] ;
const VALIDATOR_ORIGIN_CHAINS : & [ & str ] = & [ "test1" , "test2" , "test3" ] ;
// const VALIDATOR_ORIGIN_CHAINS: &[&str] = &["test1", "test2", "test3", "sealeveltest1"];
const VALIDATOR_ORIGIN_CHAINS : & [ & str ] = & [ "test1" , "test2" , "test3" , "sealeveltest1" ] ;
const AGENT_BIN_PATH : & str = "target/debug" ;
const INFRA_PATH : & str = "../typescript/infra" ;
// const TS_SDK_PATH: &str = "../typescript/sdk";
const MONOREPO_ROOT_PATH : & str = "../" ;
const ZERO_MERKLE_INSERTION_KATHY_MESSAGES : u32 = 10 ;
@ -92,6 +90,7 @@ struct State {
watchers : Vec < Box < dyn TaskHandle < Output = ( ) > > > ,
data : Vec < Box < dyn ArbitraryData > > ,
}
impl State {
fn push_agent ( & mut self , handles : AgentHandles ) {
self . agents . push ( ( handles . 0 , handles . 1 ) ) ;
@ -100,6 +99,7 @@ impl State {
self . data . push ( handles . 4 ) ;
}
}
impl Drop for State {
fn drop ( & mut self ) {
SHUTDOWN . store ( true , Ordering ::Relaxed ) ;
@ -137,11 +137,11 @@ fn main() -> ExitCode {
let config = Config ::load ( ) ;
// let solana_checkpoint_path = Path::new(SOLANA_CHECKPOINT_LOCATION);
// fs::remove_dir_all(solana_checkpoint_path).unwrap_or_default();
let checkpoints_dirs : Vec < DynPath > = ( 0 .. VALIDATOR_COUNT )
let solana_checkpoint_path = Path ::new ( SOLANA_CHECKPOINT_LOCATION ) ;
fs ::remove_dir_all ( solana_checkpoint_path ) . unwrap_or_default ( ) ;
let checkpoints_dirs : Vec < DynPath > = ( 0 .. VALIDATOR_COUNT - 1 )
. map ( | _ | Box ::new ( tempdir ( ) . unwrap ( ) ) as DynPath )
// .chain([Box::new(solana_checkpoint_path) as DynPath])
. chain ( [ Box ::new ( solana_checkpoint_path ) as DynPath ] )
. collect ( ) ;
let rocks_db_dir = tempdir ( ) . unwrap ( ) ;
let relayer_db = concat_path ( & rocks_db_dir , "relayer" ) ;
@ -173,8 +173,8 @@ fn main() -> ExitCode {
. hyp_env ( "DB" , relayer_db . to_str ( ) . unwrap ( ) )
. hyp_env ( "CHAINS_TEST1_SIGNER_KEY" , RELAYER_KEYS [ 0 ] )
. hyp_env ( "CHAINS_TEST2_SIGNER_KEY" , RELAYER_KEYS [ 1 ] )
// .hyp_env("CHAINS_SEALEVELTEST1_SIGNER_KEY", RELAYER_KEYS[3])
// .hyp_env("CHAINS_SEALEVELTEST2_SIGNER_KEY", RELAYER_KEYS[4])
. hyp_env ( "CHAINS_SEALEVELTEST1_SIGNER_KEY" , RELAYER_KEYS [ 3 ] )
. hyp_env ( "CHAINS_SEALEVELTEST2_SIGNER_KEY" , RELAYER_KEYS [ 4 ] )
. hyp_env ( "RELAYCHAINS" , "invalidchain,otherinvalid" )
. hyp_env ( "ALLOWLOCALCHECKPOINTSYNCERS" , "true" )
. hyp_env (
@ -201,8 +201,7 @@ fn main() -> ExitCode {
. arg ( "defaultSigner.key" , RELAYER_KEYS [ 2 ] )
. arg (
"relayChains" ,
"test1,test2,test3" ,
// "test1,test2,test3,sealeveltest1,sealeveltest2",
"test1,test2,test3,sealeveltest1,sealeveltest2" ,
) ;
let base_validator_env = common_agent_env
@ -274,9 +273,9 @@ fn main() -> ExitCode {
// Ready to run...
//
// 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());
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..." ) ;
@ -287,13 +286,13 @@ fn main() -> ExitCode {
. arg ( "bin" , "validator" )
. arg ( "bin" , "scraper" )
. arg ( "bin" , "init-db" )
// .arg("bin", "hyperlane-sealevel-client")
. arg ( "bin" , "hyperlane-sealevel-client" )
. filter_logs ( | l | ! l . contains ( "workspace-inheritance" ) )
. run ( ) ;
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" )
@ -308,15 +307,15 @@ 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_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();
// state.push_agent(solana_validator);
let ( solana_config_path , solana_validator ) = start_solana_validator . join ( ) ;
state . push_agent ( solana_validator ) ;
state . push_agent ( start_anvil . join ( ) ) ;
// spawn 1st validator before any messages have been sent to test empty mailbox
@ -362,9 +361,9 @@ fn main() -> ExitCode {
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();
// }
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 ) {
@ -375,9 +374,9 @@ 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 .. ( SOL_MESSAGES_EXPECTED / 2 ) {
initiate_solana_hyperlane_transfer ( solana_path . clone ( ) , solana_config_path . clone ( ) ) . join ( ) ;
}
log ! ( "Setup complete! Agents running in background..." ) ;
log ! ( "Ctrl+C to end execution..." ) ;
@ -395,8 +394,13 @@ fn main() -> ExitCode {
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, &solana_path, &solana_config_path)
// 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