diff --git a/bolt-cli/Cargo.lock b/bolt-cli/Cargo.lock index 009d4ce5..71d28129 100644 --- a/bolt-cli/Cargo.lock +++ b/bolt-cli/Cargo.lock @@ -60,22 +60,22 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b524b8c28a7145d1fe4950f84360b5de3e307601679ff0558ddc20ea229399" +checksum = "98452d9acf0e74c318625cbd45342c95ba6302214391baf23d28c7ae480fa80b" dependencies = [ "alloy-consensus", "alloy-contract", "alloy-core", "alloy-eips", - "alloy-genesis", + "alloy-genesis 0.7.0", "alloy-network", - "alloy-node-bindings", + "alloy-node-bindings 0.7.0", "alloy-provider", "alloy-pubsub", "alloy-rpc-client", "alloy-rpc-types", - "alloy-serde", + "alloy-serde 0.7.0", "alloy-signer", "alloy-signer-local", "alloy-transport", @@ -97,14 +97,15 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae09ffd7c29062431dd86061deefe4e3c6f07fa0d674930095f8dcedb0baf02c" +checksum = "3a1ff8439834ab71a4b0ecd1a8ff80b3921c87615f158940c3364f399c732786" dependencies = [ "alloy-eips", "alloy-primitives 0.8.12", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.7.0", + "alloy-trie", "auto_impl", "c-kzg", "derive_more 1.0.0", @@ -112,11 +113,25 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-consensus-any" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "519a86faaa6729464365a90c04eba68539b6d3a30f426edb4b3dafd78920d42f" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives 0.8.12", + "alloy-rlp", + "alloy-serde 0.7.0", + "serde", +] + [[package]] name = "alloy-contract" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66430a72d5bf5edead101c8c2f0a24bada5ec9f3cf9909b3e08b6d6899b4803e" +checksum = "cca2b353d8b7f160dc930dfa174557acefece6deab5ecd7e6230d38858579eea" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -189,15 +204,15 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6aa3961694b30ba53d41006131a2fca3bdab22e4c344e46db2c639e7c2dfdd" +checksum = "8dedb328c2114284f767e075589ca9de8d5e9c8a91333402f4804a584ed71a38" dependencies = [ "alloy-eip2930", "alloy-eip7702", "alloy-primitives 0.8.12", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.7.0", "c-kzg", "derive_more 1.0.0", "once_cell", @@ -212,7 +227,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e53f7877ded3921d18a0a9556d55bedf84535567198c9edab2aa23106da91855" dependencies = [ "alloy-primitives 0.8.12", - "alloy-serde", + "alloy-serde 0.6.4", + "serde", +] + +[[package]] +name = "alloy-genesis" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4841e8dd4e0f53d76b501fd4c6bc21d95d688bc8ebf0ea359fc6c7ab65b48742" +dependencies = [ + "alloy-primitives 0.8.12", + "alloy-serde 0.7.0", "serde", ] @@ -230,9 +256,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3694b7e480728c0b3e228384f223937f14c10caef5a4c766021190fc8f283d35" +checksum = "254f770918f96dc4ec88a15e6e2e243358e1719d66b40ef814428e7697079d25" dependencies = [ "alloy-primitives 0.8.12", "alloy-sol-types", @@ -244,17 +270,19 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea94b8ceb5c75d7df0a93ba0acc53b55a22b47b532b600a800a87ef04eb5b0b4" +checksum = "931dd176c6e33355f3dc0170ec69cf5b951f4d73870b276e2c837ab35f9c5136" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", "alloy-primitives 0.8.12", + "alloy-rpc-types-any", "alloy-rpc-types-eth", - "alloy-serde", + "alloy-serde 0.7.0", "alloy-signer", "alloy-sol-types", "async-trait", @@ -267,14 +295,14 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9f3e281005943944d15ee8491534a1c7b3cbf7a7de26f8c433b842b93eb5f9" +checksum = "fa6ec0f23be233e851e31c5e4badfedfa9c7bc177bc37f4e03616072cd40a806" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-primitives 0.8.12", - "alloy-serde", + "alloy-serde 0.7.0", "serde", ] @@ -284,7 +312,24 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9805d126f24be459b958973c0569c73e1aadd27d4535eee82b2b6764aa03616" dependencies = [ - "alloy-genesis", + "alloy-genesis 0.6.4", + "alloy-primitives 0.8.12", + "k256 0.13.4", + "rand", + "serde_json", + "tempfile", + "thiserror", + "tracing", + "url", +] + +[[package]] +name = "alloy-node-bindings" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bce85f0f67b2248c2eb42941bb75079ac53648569a668e8bfd7de5a831ec64" +dependencies = [ + "alloy-genesis 0.7.0", "alloy-primitives 0.8.12", "k256 0.13.4", "rand", @@ -347,9 +392,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c1f9eede27bf4c13c099e8e64d54efd7ce80ef6ea47478aa75d5d74e2dba3b" +checksum = "5545e2cbf2f8f24c68bb887ba0294fa12a2f816b9e72c4f226cd137b77d0e294" dependencies = [ "alloy-chains", "alloy-consensus", @@ -357,7 +402,7 @@ dependencies = [ "alloy-json-rpc", "alloy-network", "alloy-network-primitives", - "alloy-node-bindings", + "alloy-node-bindings 0.7.0", "alloy-primitives 0.8.12", "alloy-pubsub", "alloy-rpc-client", @@ -391,9 +436,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f1f34232f77341076541c405482e4ae12f0ee7153d8f9969fc1691201b2247" +checksum = "b633f7731a3df2f4f334001bf80436565113816c5aa5c136c1ded563051e049b" dependencies = [ "alloy-json-rpc", "alloy-primitives 0.8.12", @@ -432,9 +477,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374dbe0dc3abdc2c964f36b3d3edf9cdb3db29d16bda34aa123f03d810bec1dd" +checksum = "aed9e40c2a73265ebf70f1e48303ee55920282e1ea5971e832873fb2d32cea74" dependencies = [ "alloy-json-rpc", "alloy-primitives 0.8.12", @@ -458,41 +503,53 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74832aa474b670309c20fffc2a869fa141edab7c79ff7963fad0a08de60bae1" +checksum = "42dea20fa715a6f39ec7adc735cfd9567342870737270ac67795d55896527772" dependencies = [ "alloy-primitives 0.8.12", "alloy-rpc-types-anvil", "alloy-rpc-types-engine", "alloy-rpc-types-eth", - "alloy-serde", + "alloy-serde 0.7.0", "serde", ] [[package]] name = "alloy-rpc-types-anvil" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca97963132f78ddfc60e43a017348e6d52eea983925c23652f5b330e8e02291" +checksum = "2750f4f694b27461915b9794df60177198bf733da38dde71aadfbe2946a3c0be" dependencies = [ "alloy-primitives 0.8.12", "alloy-rpc-types-eth", - "alloy-serde", + "alloy-serde 0.7.0", "serde", ] +[[package]] +name = "alloy-rpc-types-any" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79d7620e22d6ed7c58451dd303d0501ade5a8bec9dc8daef0fbc48ceffabbae1" +dependencies = [ + "alloy-consensus", + "alloy-consensus-any", + "alloy-rpc-types-eth", + "alloy-serde 0.7.0", +] + [[package]] name = "alloy-rpc-types-engine" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56294dce86af23ad6ee8df46cf8b0d292eb5d1ff67dc88a0886051e32b1faf" +checksum = "9fb843daa6feb011475f0db8c499fff5ac62e1e6012fc01d97477ddb3217a83f" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-primitives 0.8.12", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.7.0", "derive_more 1.0.0", "serde", "strum", @@ -500,16 +557,17 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a477281940d82d29315846c7216db45b15e90bcd52309da9f54bcf7ad94a11" +checksum = "df34b88df4deeac9ecfc80ad7cbb26a33e57437b9db8be5b952792feef6134bc" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-network-primitives", "alloy-primitives 0.8.12", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.7.0", "alloy-sol-types", "derive_more 1.0.0", "itertools 0.13.0", @@ -528,11 +586,22 @@ dependencies = [ "serde_json", ] +[[package]] +name = "alloy-serde" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a89fd4cc3f96b3c5c0dd1cebeb63323e4659bbdc837117fa3fd5ac168df7d9" +dependencies = [ + "alloy-primitives 0.8.12", + "serde", + "serde_json", +] + [[package]] name = "alloy-signer" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e10aec39d60dc27edcac447302c7803d2371946fb737245320a05b78eb2fafd" +checksum = "532010243a96d1f8593c2246ec3971bc52303884fa1e43ca0a776798ba178910" dependencies = [ "alloy-primitives 0.8.12", "async-trait", @@ -544,9 +613,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8396f6dff60700bc1d215ee03d86ff56de268af96e2bf833a14d0bafcab9882" +checksum = "e8080c0ab2dc729b0cbb183843d08e78d2a1629140c9fc16234d2272abb483bd" dependencies = [ "alloy-consensus", "alloy-network", @@ -633,9 +702,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99acddb34000d104961897dbb0240298e8b775a7efffb9fda2a1a3efedd65b3" +checksum = "b6f295f4b745fb9e4e663d70bc57aed991288912c7aaaf25767def921050ee43" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -653,9 +722,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc013132e34eeadaa0add7e74164c1503988bfba8bae885b32e0918ba85a8a6" +checksum = "39139015a5ec127d9c895b49b484608e27fe4538544f84cdf5eae0bd36339bc6" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -668,9 +737,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063edc0660e81260653cc6a95777c29d54c2543a668aa5da2359fb450d25a1ba" +checksum = "d9b4f865b13bb8648e93f812b19b74838b9165212a2beb95fc386188c443a5e3" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -687,9 +756,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abd170e600801116d5efe64f74a4fc073dbbb35c807013a7d0a388742aeebba0" +checksum = "6af91e3521b8b3eac26809b1c6f9b86e3ed455dfab812f036836aabdf709b921" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -703,6 +772,21 @@ dependencies = [ "ws_stream_wasm", ] +[[package]] +name = "alloy-trie" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b2e366c0debf0af77766c23694a3f863b02633050e71e096e257ffbd395e50" +dependencies = [ + "alloy-primitives 0.8.12", + "alloy-rlp", + "arrayvec", + "derive_more 1.0.0", + "nybbles", + "smallvec", + "tracing", +] + [[package]] name = "anstream" version = "0.6.15" @@ -1204,7 +1288,7 @@ name = "bolt" version = "0.3.0-alpha" dependencies = [ "alloy", - "alloy-node-bindings", + "alloy-node-bindings 0.6.4", "blst", "clap", "dotenvy", @@ -2869,6 +2953,16 @@ dependencies = [ "syn 2.0.82", ] +[[package]] +name = "nybbles" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95f06be0417d97f81fe4e5c86d7d01b392655a9cac9c19a848aa033e18937b23" +dependencies = [ + "const-hex", + "smallvec", +] + [[package]] name = "object" version = "0.36.5" diff --git a/bolt-cli/Cargo.toml b/bolt-cli/Cargo.toml index d530448a..d8645982 100644 --- a/bolt-cli/Cargo.toml +++ b/bolt-cli/Cargo.toml @@ -23,7 +23,7 @@ blst = "0.3.12" # ethereum ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "cf3c404" } lighthouse_eth2_keystore = { package = "eth2_keystore", git = "https://github.com/sigp/lighthouse", rev = "a87f19d" } -alloy = { version = "0.6.4", features = [ +alloy = { version = "0.7.0", features = [ "full", "provider-anvil-api", "provider-anvil-node", diff --git a/bolt-cli/src/commands/operators.rs b/bolt-cli/src/commands/operators.rs index 7d3acff2..5a11b492 100644 --- a/bolt-cli/src/commands/operators.rs +++ b/bolt-cli/src/commands/operators.rs @@ -350,8 +350,6 @@ impl OperatorsCommand { #[cfg(test)] mod tests { - use std::process::{Command, Output}; - use crate::{ cli::{ Chain, EigenLayerSubcommand, OperatorsCommand, OperatorsSubcommand, SymbioticSubcommand, @@ -364,26 +362,30 @@ mod tests { }; use alloy::{ network::EthereumWallet, + node_bindings::Anvil, primitives::{address, keccak256, utils::parse_units, Address, B256, U256}, - providers::{ext::AnvilApi, Provider, ProviderBuilder, WalletProvider}, + providers::{ext::AnvilApi, ProviderBuilder, WalletProvider}, signers::local::PrivateKeySigner, sol_types::SolValue, }; - use rand::Rng; + use reqwest::Url; + use std::process::{Command, Output}; #[tokio::test] async fn test_eigenlayer_flow() { - let _ = tracing_subscriber::fmt().try_init(); - let mut rnd = rand::thread_rng(); - let secret_key = B256::from(rnd.gen::<[u8; 32]>()); - let wallet = PrivateKeySigner::from_bytes(&secret_key).expect("valid private key"); + let s1 = PrivateKeySigner::random(); + let secret_key = s1.to_bytes(); + let s2 = PrivateKeySigner::random(); + + let wallet = EthereumWallet::new(s1); let rpc_url = "https://holesky.drpc.org"; + let anvil = Anvil::default().fork(rpc_url).spawn(); + let anvil_url = Url::parse(&anvil.endpoint()).expect("valid URL"); let provider = ProviderBuilder::new() .with_recommended_fillers() - .wallet(EthereumWallet::from(wallet)) - .on_anvil_with_config(|anvil| anvil.fork(rpc_url)); - let anvil_url = provider.client().transport().url(); + .wallet(wallet) + .on_http(anvil_url.clone()); let account = provider.default_signer_address(); @@ -407,7 +409,7 @@ mod tests { .await .expect("to set storage"); - let random_address = Address::from(rnd.gen::<[u8; 20]>()); + let random_address = s2.address(); // 1. Register the operator into EigenLayer. This should be done by the operator using the // EigenLayer CLI, but we do it here for testing purposes. @@ -446,7 +448,7 @@ mod tests { let deposit_into_strategy = OperatorsCommand { subcommand: OperatorsSubcommand::EigenLayer { subcommand: EigenLayerSubcommand::Deposit { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), operator_private_key: secret_key, strategy: EigenLayerStrategy::WEth, amount: U256::from(1), @@ -461,7 +463,7 @@ mod tests { let register_operator = OperatorsCommand { subcommand: OperatorsSubcommand::EigenLayer { subcommand: EigenLayerSubcommand::Register { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), operator_private_key: secret_key, operator_rpc: "https://bolt.chainbound.io/rpc".parse().expect("valid url"), salt: B256::ZERO, @@ -476,7 +478,7 @@ mod tests { let check_operator_registration = OperatorsCommand { subcommand: OperatorsSubcommand::EigenLayer { subcommand: EigenLayerSubcommand::Status { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), address: account, }, }, @@ -487,7 +489,7 @@ mod tests { let deregister_operator = OperatorsCommand { subcommand: OperatorsSubcommand::EigenLayer { subcommand: EigenLayerSubcommand::Deregister { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), operator_private_key: secret_key, }, }, @@ -497,10 +499,7 @@ mod tests { let check_operator_registration = OperatorsCommand { subcommand: OperatorsSubcommand::EigenLayer { - subcommand: EigenLayerSubcommand::Status { - rpc_url: anvil_url.parse().expect("valid url"), - address: account, - }, + subcommand: EigenLayerSubcommand::Status { rpc_url: anvil_url, address: account }, }, }; @@ -513,16 +512,17 @@ mod tests { #[tokio::test] #[ignore = "requires Symbiotic CLI installed"] async fn test_symbiotic_flow() { - let mut rnd = rand::thread_rng(); - let secret_key = B256::from(rnd.gen::<[u8; 32]>()); - let wallet = PrivateKeySigner::from_bytes(&secret_key).expect("valid private key"); + let s1 = PrivateKeySigner::random(); + let secret_key = s1.to_bytes(); + let wallet = EthereumWallet::new(s1); - let rpc_url = "https://rpc-holesky.bolt.chainbound.io/rpc"; + let rpc_url = "https://holesky.drpc.org"; + let anvil = Anvil::default().fork(rpc_url).spawn(); + let anvil_url = Url::parse(&anvil.endpoint()).expect("valid URL"); let provider = ProviderBuilder::new() .with_recommended_fillers() - .wallet(EthereumWallet::from(wallet)) - .on_anvil_with_config(|anvil| anvil.fork(rpc_url)); - let anvil_url = provider.client().transport().url(); + .wallet(wallet) + .on_http(anvil_url.clone()); let account = provider.default_signer_address(); @@ -552,7 +552,7 @@ mod tests { .arg("--chain") .arg("holesky") .arg("--provider") - .arg(anvil_url) + .arg(anvil_url.to_string()) .arg("register-operator") .arg("--private-key") .arg(secret_key.to_string()) @@ -566,7 +566,7 @@ mod tests { .arg("--chain") .arg("holesky") .arg("--provider") - .arg(anvil_url) + .arg(anvil_url.to_string()) .arg("opt-in-network") .arg("--private-key") .arg(secret_key.to_string()) @@ -583,7 +583,7 @@ mod tests { .arg("--chain") .arg("holesky") .arg("--provider") - .arg(anvil_url) + .arg(anvil_url.to_string()) .arg("opt-in-vault") .arg("--private-key") .arg(secret_key.to_string()) @@ -598,7 +598,7 @@ mod tests { .arg("--chain") .arg("holesky") .arg("--provider") - .arg(anvil_url) + .arg(anvil_url.to_string()) .arg("deposit") .arg("--private-key") .arg(secret_key.to_string()) @@ -612,7 +612,7 @@ mod tests { let register_into_bolt = OperatorsCommand { subcommand: OperatorsSubcommand::Symbiotic { subcommand: SymbioticSubcommand::Register { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), operator_private_key: secret_key, operator_rpc: "https://bolt.chainbound.io".parse().expect("valid url"), }, @@ -624,7 +624,7 @@ mod tests { let check_status = OperatorsCommand { subcommand: OperatorsSubcommand::Symbiotic { subcommand: SymbioticSubcommand::Status { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), address: account, }, }, @@ -635,7 +635,7 @@ mod tests { let deregister_command = OperatorsCommand { subcommand: OperatorsSubcommand::Symbiotic { subcommand: SymbioticSubcommand::Deregister { - rpc_url: anvil_url.parse().expect("valid url"), + rpc_url: anvil_url.clone(), operator_private_key: secret_key, }, }, @@ -645,10 +645,7 @@ mod tests { let check_status = OperatorsCommand { subcommand: OperatorsSubcommand::Symbiotic { - subcommand: SymbioticSubcommand::Status { - rpc_url: anvil_url.parse().expect("valid url"), - address: account, - }, + subcommand: SymbioticSubcommand::Status { rpc_url: anvil_url, address: account }, }, }; diff --git a/bolt-cli/src/commands/validators.rs b/bolt-cli/src/commands/validators.rs index 4580e586..43954ef2 100644 --- a/bolt-cli/src/commands/validators.rs +++ b/bolt-cli/src/commands/validators.rs @@ -83,18 +83,21 @@ impl ValidatorsCommand { #[cfg(test)] mod tests { use alloy::{ + node_bindings::Anvil, primitives::{Address, B256, U256}, - providers::{ext::AnvilApi, Provider, ProviderBuilder}, + providers::{ext::AnvilApi, ProviderBuilder}, signers::k256::ecdsa::SigningKey, }; + use reqwest::Url; use crate::cli::{ValidatorsCommand, ValidatorsSubcommand}; #[tokio::test] async fn test_register_validators() { let rpc_url = "https://holesky.drpc.org"; - let provider = ProviderBuilder::new().on_anvil_with_config(|anvil| anvil.fork(rpc_url)); - let anvil_url = provider.client().transport().url(); + let anvil = Anvil::default().fork(rpc_url).spawn(); + let anvil_url = Url::parse(&anvil.endpoint()).expect("valid URL"); + let provider = ProviderBuilder::new().on_http(anvil_url.clone()); let mut rnd = rand::thread_rng(); let secret_key = SigningKey::random(&mut rnd); @@ -108,7 +111,7 @@ mod tests { admin_private_key: B256::try_from(secret_key.to_bytes().as_slice()).unwrap(), authorized_operator: account, pubkeys_path: "./test_data/pubkeys.json".parse().unwrap(), - rpc_url: anvil_url.parse().unwrap(), + rpc_url: anvil_url, }, };