From b6b5bfc4ac144374facf52d8c449594c5e9482a1 Mon Sep 17 00:00:00 2001 From: supernovahs Date: Tue, 13 Aug 2024 14:57:13 +0530 Subject: [PATCH 1/5] add reset anvil in make file --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 56f5c72f..fe620a87 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ ############################# HELP MESSAGE ############################# # Make sure the help command stays first, so that it's printed by default when `make` is called without arguments +PHONY: reset-anvil .PHONY: help tests help: @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @@ -13,6 +14,10 @@ CHAINID=31337 STRATEGY_ADDRESS=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F DEPLOYMENT_FILES_DIR=contracts/script/output/${CHAINID} +reset-anvil: + -docker stop anvil + -docker rm anvil + -----------------------------: ## ___CONTRACTS___: ## @@ -20,15 +25,15 @@ ___CONTRACTS___: ## build-contracts: ## builds all contracts cd contracts && forge build -deploy-eigenlayer-contracts-to-anvil-and-save-state: ## Deploy eigenlayer +deploy-eigenlayer-contracts-to-anvil-and-save-state: reset-anvil ## Deploy eigenlayer ./utils/anvil/deploy-eigenlayer-save-anvil-state.sh -deploy-hello-world-contracts-to-anvil-and-save-state: ## Deploy avs +deploy-hello-world-contracts-to-anvil-and-save-state: reset-anvil ## Deploy avs ./utils/anvil/deploy-avs-save-anvil-state.sh -deploy-contracts-to-anvil-and-save-state: deploy-eigenlayer-contracts-to-anvil-and-save-state deploy-hello-world-contracts-to-anvil-and-save-state ## deploy eigenlayer, shared avs contracts, and inc-sq contracts (part of quickstart) +deploy-contracts-to-anvil-and-save-state: reset-anvil deploy-eigenlayer-contracts-to-anvil-and-save-state deploy-hello-world-contracts-to-anvil-and-save-state ## deploy eigenlayer, shared avs contracts, and inc-sq contracts (part of quickstart) -start-chain-with-contracts-deployed: ## starts anvil from a saved state file (with el and avs contracts deployed) +start-chain-with-contracts-deployed: reset-anvil ## starts anvil from a saved state file (with el and avs contracts deployed) ./utils/anvil/start-anvil-chain-with-el-and-avs-deployed.sh # start-chain-and-deploy-hello-world-avs: build-contracts deploy-contracts-to-anvil-and-save-state start-anvil-chain-with-el-and-avs-deployed From 4628994f495ac6046503d3ec57720c5ff1358ca6 Mon Sep 17 00:00:00 2001 From: supernovahs Date: Tue, 13 Aug 2024 19:49:38 +0530 Subject: [PATCH 2/5] add logging in spam_tasks ,clean up --- .env.local | 16 - Cargo.lock | 537 +++++++++++++----- Cargo.toml | 62 +- contracts/lib/eigenlayer-middleware | 2 +- operator/rust/crates/operator/Cargo.toml | 7 +- .../rust/crates/operator/src/spam_tasks.rs | 43 +- .../crates/operator/src/start_operator.rs | 47 +- .../rust/crates/operator/src/test_utils.rs | 82 +-- 8 files changed, 493 insertions(+), 303 deletions(-) delete mode 100644 .env.local diff --git a/.env.local b/.env.local deleted file mode 100644 index ba248cb8..00000000 --- a/.env.local +++ /dev/null @@ -1,16 +0,0 @@ -PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -RPC_URL=http://127.0.0.1:8545 -CONTRACT_ADDRESS=0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB -DELEGATION_MANAGER_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 -STAKE_REGISTRY_ADDRESS=0x9E545E3C0baAB3E08CdfD552C960A1050f373042 -AVS_DIRECTORY_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 - - - -HOLESKY_PRIVATE_KEY=0x70cf3589410a4471117581a3ed6aed567d180ad96b51d97bf2744a9c74fe55d0 -HOLESKY_RPC_URL=https://1rpc.io/holesky -HOLESKY_CONTRACT_ADDRESS=0x3361953F4a9628672dCBcDb29e91735fb1985390 -HOLESKY_DELEGATION_MANAGER_ADDRESS=0xA44151489861Fe9e3055d95adC98FbD462B948e7 -HOLESKY_STAKE_REGISTRY_ADDRESS=0xBDACD5998989Eec814ac7A0f0f6596088AA2a270 -HOLESKY_AVS_DIRECTORY_ADDRESS=0x055733000064333CaDDbC92763c58BF0192fFeBf -HOLESKY_WS_RPC_URL=wss://holesky.drpc.org \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f1328c17..df3b463f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,8 +77,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da374e868f54c7f4ad2ad56829827badca388efd645f8cf5fccc61c2b5343504" dependencies = [ "alloy-eips", "alloy-primitives", @@ -90,15 +91,16 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dc6957ff706f9e5f6fd42f52a93e4bce476b726c92d077b348de28c4a76730c" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", "alloy-network", "alloy-primitives", "alloy-provider", - "alloy-rpc-types", + "alloy-rpc-types-eth", "alloy-sol-types", "alloy-transport", "futures", @@ -108,9 +110,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd2404399cb1b50572758e66e9b4bf088e5a3df9007be7126456c7e50af935f" +checksum = "413902aa18a97569e60f679c23f46a18db1656d87ab4d4e49d0e1e52042f66df" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -125,8 +127,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f76ecab54890cdea1e4808fc0891c7e6cfcf71fe1a9fe26810c7280ef768f4ed" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -137,22 +140,11 @@ dependencies = [ "sha2", ] -[[package]] -name = "alloy-genesis" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" -dependencies = [ - "alloy-primitives", - "alloy-serde", - "serde", - "serde_json", -] - [[package]] name = "alloy-json-abi" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3abf6446a292e19853aaca43590eeb48bf435dfd2c74200259e8f4872f6ce3" +checksum = "bc05b04ac331a9f07e3a4036ef7926e49a8bf84a99a1ccfc7e2ab55a5fcbb372" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -162,8 +154,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d6f34930b7e3e2744bcc79056c217f00cb2abb33bc5d4ff88da7623c5bb078b" dependencies = [ "alloy-primitives", "serde", @@ -174,14 +167,16 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f6895fc31b48fa12306ef9b4f78b7764f8bd6d7d91cdb0a40e233704a0f23f" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-json-rpc", "alloy-primitives", - "alloy-rpc-types", + "alloy-rpc-types-eth", + "alloy-serde", "alloy-signer", "alloy-sol-types", "async-trait", @@ -192,9 +187,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277af0cbcc483ee6ad2c1e818090b5928d27f04fd6580680f31c1cf8068bcc2" +checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" dependencies = [ "alloy-rlp", "bytes", @@ -214,8 +209,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c538bfa893d07e27cb4f3c1ab5f451592b7c526d511d62b576a2ce59e146e4a" dependencies = [ "alloy-chains", "alloy-consensus", @@ -225,8 +221,7 @@ dependencies = [ "alloy-primitives", "alloy-pubsub", "alloy-rpc-client", - "alloy-rpc-types", - "alloy-rpc-types-trace", + "alloy-rpc-types-eth", "alloy-transport", "alloy-transport-http", "alloy-transport-ws", @@ -248,8 +243,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7341322d9bc0e49f6e9fd9f2eb8e30f73806f2dd12cbb3d6bab2694c921f87" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -288,8 +284,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ba31bae67773fd5a60020bea900231f8396202b7feca4d0c70c6b59308ab4a8" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -311,38 +308,37 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "184a7a42c7ba9141cc9e76368356168c282c3bc3d9e5d78f3556bdfe39343447" dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", + "alloy-rpc-types-eth", "alloy-serde", - "alloy-sol-types", - "itertools 0.12.1", - "serde", - "serde_json", - "thiserror", ] [[package]] -name = "alloy-rpc-types-trace" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +name = "alloy-rpc-types-eth" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab4123ee21f99ba4bd31bfa36ba89112a18a500f8b452f02b35708b1b951e2b9" dependencies = [ + "alloy-consensus", + "alloy-eips", "alloy-primitives", - "alloy-rpc-types", + "alloy-rlp", "alloy-serde", + "alloy-sol-types", + "itertools 0.13.0", "serde", "serde_json", + "thiserror", ] [[package]] name = "alloy-serde" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9416c52959e66ead795a11f4a86c248410e9e368a0765710e57055b8a1774dd6" dependencies = [ "alloy-primitives", "serde", @@ -351,8 +347,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b33753c09fa1ad85e5b092b8dc2372f1e337a42e84b9b4cff9fede75ba4adb32" dependencies = [ "alloy-primitives", "async-trait", @@ -363,9 +360,10 @@ dependencies = [ ] [[package]] -name = "alloy-signer-wallet" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +name = "alloy-signer-local" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dfc9c26fe6c6f1bad818c9a976de9044dd12e1f75f1f156a801ee3e8148c1b6" dependencies = [ "alloy-consensus", "alloy-network", @@ -379,9 +377,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30708a79919b082f2692423c8cc72fc250477e4a2ecb0d4a7244cd3cdb299965" +checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -393,9 +391,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a679ac01774ab7e00a567a918d4231ae692c5c8cedaf4e16956c3116d7896" +checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -412,9 +410,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356da0c2228aa6675a5faaa08a3e4061b967f924753983d72b9a18d9a3fad44e" +checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ "alloy-json-abi", "const-hex", @@ -429,18 +427,19 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fd4783b0a5840479013e9ce960d2eb7b3be381f722e0fe3d1f7c3bb6bd4ebd" +checksum = "cbcba3ca07cf7975f15d871b721fb18031eec8bce51103907f6dcce00b255d98" dependencies = [ + "serde", "winnow 0.6.11", ] [[package]] name = "alloy-sol-types" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb5e6234c0b62514992589fe1578f64d418dbc8ef5cd1ab2d7f2f568f599698" +checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -451,8 +450,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01b51a291f949f755e6165c3ed562883175c97423703703355f4faa4b7d0a57c" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -463,14 +463,15 @@ dependencies = [ "thiserror", "tokio", "tower", + "tracing", "url", - "wasm-bindgen-futures", ] [[package]] name = "alloy-transport-http" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d65871f9f1cafe1ed25cde2f1303be83e6473e995a2d56c275ae4fcce6119c" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -483,16 +484,18 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=cc68b93#cc68b93605f4521c2b0bce1a7efaeff2046cf07c" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aec83fd052684556c78c54df111433493267234d82321c2236560c752f595f20" dependencies = [ "alloy-pubsub", "alloy-transport", "futures", - "http 0.2.12", + "http 1.1.0", + "rustls 0.23.12", "serde_json", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.23.1", "tracing", "ws_stream_wasm", ] @@ -1203,6 +1206,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctor" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" +dependencies = [ + "quote", + "syn 2.0.66", +] + [[package]] name = "ctr" version = "0.9.2" @@ -1366,68 +1379,63 @@ dependencies = [ [[package]] name = "eigen-client-elcontracts" version = "0.0.1-alpha" -source = "git+https://github.com/supernovahs/eigensdk-rs?rev=e700fa2#e700fa223635d0aa132e5af283d16f2741a87081" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" dependencies = [ "alloy-contract", - "alloy-network", "alloy-primitives", - "alloy-provider", - "alloy-signer", - "alloy-signer-wallet", - "alloy-sol-types", - "ark-bn254", - "ark-ff 0.4.2", + "eigen-logging", "eigen-types", "eigen-utils", - "reqwest 0.12.4", "thiserror", "tracing", ] -[[package]] -name = "eigen-contract-bindings" -version = "0.0.1-alpha" -source = "git+https://github.com/supernovahs/eigensdk-rs?rev=e700fa2#e700fa223635d0aa132e5af283d16f2741a87081" -dependencies = [ - "ethers", -] - [[package]] name = "eigen-crypto-bls" version = "0.0.1-alpha" -source = "git+https://github.com/supernovahs/eigensdk-rs?rev=e700fa2#e700fa223635d0aa132e5af283d16f2741a87081" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" dependencies = [ "alloy-primitives", "ark-bn254", "ark-ec", "ark-ff 0.4.2", + "ark-std 0.4.0", "eigen-crypto-bn254", - "hex", + "eigen-utils", "thiserror", ] [[package]] name = "eigen-crypto-bn254" version = "0.0.1-alpha" -source = "git+https://github.com/supernovahs/eigensdk-rs?rev=e700fa2#e700fa223635d0aa132e5af283d16f2741a87081" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" dependencies = [ - "alloy-primitives", "ark-bn254", + "ark-ec", "ark-ff 0.4.2", - "ethers", - "thiserror", + "num-bigint", + "rust-bls-bn254", +] + +[[package]] +name = "eigen-logging" +version = "0.0.1-alpha" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" +dependencies = [ + "ctor", + "once_cell", + "tracing", + "tracing-subscriber", ] [[package]] name = "eigen-types" version = "0.0.1-alpha" -source = "git+https://github.com/supernovahs/eigensdk-rs?rev=e700fa2#e700fa223635d0aa132e5af283d16f2741a87081" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" dependencies = [ - "alloy-contract", "alloy-primitives", - "alloy-sol-types", - "eigen-contract-bindings", "eigen-crypto-bls", + "eigen-utils", "ethers", "num-bigint", ] @@ -1435,13 +1443,16 @@ dependencies = [ [[package]] name = "eigen-utils" version = "0.0.1-alpha" -source = "git+https://github.com/supernovahs/eigensdk-rs?rev=e700fa2#e700fa223635d0aa132e5af283d16f2741a87081" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" dependencies = [ "alloy-contract", + "alloy-json-rpc", "alloy-network", "alloy-provider", - "alloy-signer-wallet", + "alloy-pubsub", + "alloy-signer-local", "alloy-sol-types", + "alloy-transport", "alloy-transport-http", "reqwest 0.12.4", ] @@ -1536,7 +1547,7 @@ dependencies = [ "hmac", "pbkdf2 0.11.0", "rand", - "scrypt", + "scrypt 0.10.0", "serde", "serde_json", "sha2", @@ -1780,7 +1791,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "tracing", "tracing-futures", "url", @@ -2216,7 +2227,7 @@ dependencies = [ "alloy-provider", "alloy-rpc-types", "alloy-signer", - "alloy-signer-wallet", + "alloy-signer-local", "alloy-sol-types", "alloy-transport", "alloy-transport-http", @@ -2224,6 +2235,7 @@ dependencies = [ "chrono", "dotenv", "eigen-client-elcontracts", + "eigen-logging", "eigen-types", "eigen-utils", "eyre", @@ -2260,6 +2272,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + [[package]] name = "hmac" version = "0.12.1" @@ -2399,9 +2420,26 @@ dependencies = [ "futures-util", "http 0.2.12", "hyper 0.14.29", - "rustls", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.3.1", + "hyper-util", + "rustls 0.22.4", + "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.25.0", + "tower-service", ] [[package]] @@ -2571,9 +2609,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -2803,6 +2841,16 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.5" @@ -2811,6 +2859,7 @@ checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ "num-integer", "num-traits", + "serde", ] [[package]] @@ -2959,6 +3008,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -3019,6 +3074,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + [[package]] name = "paste" version = "1.0.15" @@ -3039,7 +3105,7 @@ checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ "digest 0.10.7", "hmac", - "password-hash", + "password-hash 0.4.2", "sha2", ] @@ -3446,7 +3512,7 @@ dependencies = [ "http 0.2.12", "http-body 0.4.6", "hyper 0.14.29", - "hyper-rustls", + "hyper-rustls 0.24.2", "ipnet", "js-sys", "log", @@ -3454,7 +3520,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", + "rustls 0.21.12", "rustls-pemfile 1.0.4", "serde", "serde_json", @@ -3462,13 +3528,13 @@ dependencies = [ "sync_wrapper", "system-configuration", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.25.4", "winreg 0.50.0", ] @@ -3488,6 +3554,7 @@ dependencies = [ "http-body 1.0.0", "http-body-util", "hyper 1.3.1", + "hyper-rustls 0.26.0", "hyper-tls", "hyper-util", "ipnet", @@ -3498,7 +3565,9 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls 0.22.4", "rustls-pemfile 2.1.2", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -3506,11 +3575,13 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls 0.25.0", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots 0.26.3", "winreg 0.52.0", ] @@ -3615,6 +3686,33 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" +[[package]] +name = "rust-bls-bn254" +version = "0.1.0" +source = "git+https://github.com/Layr-Labs/rust-bls-bn254.git?rev=be3ef87#be3ef873f484bb09c2db7b6491715236df8c6174" +dependencies = [ + "aes", + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "ctr", + "hex", + "hkdf", + "num-bigint", + "num-traits", + "pbkdf2 0.12.2", + "rand", + "scrypt 0.11.0", + "serde", + "serde_json", + "sha2", + "thiserror", + "unicode-normalization", + "uuid", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -3666,10 +3764,38 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.6", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +dependencies = [ + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.6", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -3705,6 +3831,17 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "rustversion" version = "1.0.17" @@ -3798,6 +3935,18 @@ dependencies = [ "sha2", ] +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "password-hash 0.5.0", + "pbkdf2 0.12.2", + "salsa20", + "sha2", +] + [[package]] name = "sct" version = "0.7.1" @@ -3906,11 +4055,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -3978,6 +4128,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -4167,9 +4326,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fe08d08d84f2c0a77f1e7c46518789d745c2e87a2721791ed7c3c9bc78df28" +checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" dependencies = [ "paste", "proc-macro2", @@ -4253,6 +4412,16 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "threadpool" version = "1.8.1" @@ -4363,7 +4532,29 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.12", + "rustls-pki-types", "tokio", ] @@ -4387,11 +4578,27 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", + "tungstenite 0.20.1", + "webpki-roots 0.25.4", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" +dependencies = [ + "futures-util", + "log", + "rustls 0.23.12", + "rustls-pki-types", "tokio", - "tokio-rustls", - "tungstenite", - "webpki-roots", + "tokio-rustls 0.26.0", + "tungstenite 0.23.0", + "webpki-roots 0.26.3", ] [[package]] @@ -4510,6 +4717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", ] [[package]] @@ -4522,6 +4730,44 @@ dependencies = [ "tracing", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", + "tracing-serde", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -4541,13 +4787,33 @@ dependencies = [ "httparse", "log", "rand", - "rustls", + "rustls 0.21.12", "sha1", "thiserror", "url", "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.1.0", + "httparse", + "log", + "rand", + "rustls 0.23.12", + "rustls-pki-types", + "sha1", + "thiserror", + "utf-8", +] + [[package]] name = "typenum" version = "1.17.0" @@ -4778,6 +5044,15 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "webpki-roots" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 2681b3fb..5ed37d69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,35 +30,49 @@ tokio = {version = "1.37.0" , features = ["test-util", "full","sync","rt-multi-t hello-world-avs-operator = {path = "operator/crates/operator"} #eigen-rs -eigen-client-elcontracts = {git = "https://github.com/supernovahs/eigensdk-rs", rev = "e700fa2"} -eigen-types = {git = "https://github.com/supernovahs/eigensdk-rs", rev = "e700fa2"} -eigen-utils = {git = "https://github.com/supernovahs/eigensdk-rs", rev = "e700fa2"} +eigen-client-elcontracts = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} +eigen-types = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} +eigen-utils = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} +eigen-logging = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} #alloy alloy-chains = "0.1.15" -alloy-primitives = "0.7.2" +alloy-consensus = { version = "0.1", default-features = false } +alloy-contract = { version = "0.1", default-features = false } alloy-dyn-abi = "0.7.2" -alloy-sol-types = "0.7.2" -alloy-rlp = "0.3.4" -alloy-trie = "0.3.1" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93", default-features = false, features = [ +alloy-eips = { version = "0.1", default-features = false } +alloy-genesis = { version = "0.1", default-features = false } +alloy-json-rpc = { version = "0.1", default-features = false } +alloy-network = { version = "0.1", default-features = false } +alloy-node-bindings = { version = "0.1", default-features = false } +alloy-primitives = "0.7.2" +alloy-provider = { version = "0.1", default-features = false, features = [ "reqwest","ws" ] } -alloy-transport-http = {git = "https://github.com/alloy-rs/alloy", rev = "cc68b93"} -alloy-eips = { git = "https://github.com/alloy-rs/alloy", default-features = false, rev = "cc68b93" } -alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-contract = {git = "https://github.com/alloy-rs/alloy", rev = "cc68b93" } -alloy-transport = {git = "https://github.com/alloy-rs/alloy", rev = "cc68b93"} -alloy-transport-ws = {git = "https://github.com/alloy-rs/alloy", rev = "cc68b93"} -alloy-rpc-client = {git = "https://github.com/alloy-rs/alloy", rev = "cc68b93"} +alloy-pubsub = { version = "0.1", default-features = false } +alloy-rlp = "0.3.4" +alloy-rpc-client = "0.1" +alloy-rpc-types = { version = "0.1", default-features = false, features = [ + "eth", +] } +alloy-rpc-types-admin = { version = "0.1", default-features = false } +alloy-rpc-types-anvil = { version = "0.1", default-features = false } +alloy-rpc-types-beacon = { version = "0.1", default-features = false } +alloy-rpc-types-engine = { version = "0.1", default-features = false } +alloy-rpc-types-eth = { version = "0.1", default-features = false } +alloy-rpc-types-trace = { version = "0.1", default-features = false } +alloy-rpc-types-txpool = { version = "0.1", default-features = false } +alloy-serde = { version = "0.1", default-features = false } +alloy-signer = { version = "0.1", default-features = false } +alloy-signer-aws = "0.1" +alloy-signer-local = { version = "0.1", default-features = false } +alloy-sol-types = "0.7.2" +alloy-transport = { version = "0.1" } +alloy-transport-http = { version = "0.1", features = [ + "reqwest-rustls-tls", +], default-features = false } +alloy-transport-ipc = { version = "0.1", default-features = false } +alloy-transport-ws = { version = "0.1", default-features = false } +alloy-trie = "0.4" diff --git a/contracts/lib/eigenlayer-middleware b/contracts/lib/eigenlayer-middleware index b8161386..a23de118 160000 --- a/contracts/lib/eigenlayer-middleware +++ b/contracts/lib/eigenlayer-middleware @@ -1 +1 @@ -Subproject commit b8161386d360eb2fb484b045144a35c1eb1b0e9b +Subproject commit a23de118e7d16081d350c7f83c24261d1421b0ba diff --git a/operator/rust/crates/operator/Cargo.toml b/operator/rust/crates/operator/Cargo.toml index 387f6cfc..6b1f8ba0 100644 --- a/operator/rust/crates/operator/Cargo.toml +++ b/operator/rust/crates/operator/Cargo.toml @@ -14,7 +14,7 @@ alloy-provider.workspace = true alloy-sol-types = { workspace = true, features = ["json"] } alloy-transport-http.workspace = true alloy-rpc-types.workspace = true -serde_json = "1.0.114" +serde_json = "1.0.121" num-bigint = "0.4.4" reqwest = "0.12.4" hex = "0.4.3" @@ -25,13 +25,14 @@ alloy-eips.workspace = true alloy-transport.workspace = true alloy-network.workspace = true alloy-transport-ws.workspace = true -alloy-signer-wallet.workspace = true +alloy-signer-local.workspace = true alloy-signer.workspace = true -#eigen +#eigensdk-rs eigen-client-elcontracts.workspace = true eigen-types.workspace = true eigen-utils.workspace = true +eigen-logging.workspace = true #misc dotenv = "0.15.0" diff --git a/operator/rust/crates/operator/src/spam_tasks.rs b/operator/rust/crates/operator/src/spam_tasks.rs index ee9f13d6..6218f480 100644 --- a/operator/rust/crates/operator/src/spam_tasks.rs +++ b/operator/rust/crates/operator/src/spam_tasks.rs @@ -1,20 +1,15 @@ #![allow(missing_docs)] -use alloy_network::{Ethereum, EthereumSigner}; use alloy_primitives::Address; -use alloy_provider::fillers::{ - ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SignerFiller, -}; -use alloy_provider::{ProviderBuilder, RootProvider}; -use alloy_signer_wallet::LocalWallet; use alloy_sol_types::sol; -use alloy_transport_http::Client; use dotenv::dotenv; +use eigen_logging::{get_logger, init_logger, log_level::LogLevel, logger::Logger}; +use eigen_utils::get_signer; use eyre::Result; use once_cell::sync::Lazy; use rand::Rng; -use reqwest::Url; use std::{env, str::FromStr}; use tokio::time::{self, Duration}; + pub static RPC_URL: Lazy = Lazy::new(|| env::var("RPC_URL").expect("failed to get rpc url from env")); @@ -52,7 +47,7 @@ async fn create_new_task(task_name: &str) -> Result<()> { let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); - let provider = get_provider_with_wallet(KEY.clone()); + let provider = get_signer(KEY.clone(), &RPC_URL); let hello_world_contract = HelloWorldServiceManager::new(hello_world_contract_address, provider); @@ -75,38 +70,18 @@ async fn create_new_task(task_name: &str) -> Result<()> { /// Start creating tasks at every 15 seconds async fn start_creating_tasks() { let mut interval = time::interval(Duration::from_secs(15)); - + init_logger(LogLevel::Info); loop { interval.tick().await; let random_name = generate_random_name(); + get_logger().tracing_logger.unwrap().info( + &format!("Creating new task with name: {} ", random_name), + &["start_creating_tasks"], + ); let _ = create_new_task(&random_name).await; } } -pub fn get_provider_with_wallet( - key: String, -) -> FillProvider< - JoinFill< - JoinFill< - JoinFill, NonceFiller>, - ChainIdFiller, - >, - SignerFiller, - >, - RootProvider>, - alloy_transport_http::Http, - Ethereum, -> { - let wallet = LocalWallet::from_str(&key.to_string()).expect("failed to generate wallet "); - let url = Url::parse(&RPC_URL.clone()).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); - - return provider; -} - #[allow(dead_code)] #[tokio::main] async fn main() { diff --git a/operator/rust/crates/operator/src/start_operator.rs b/operator/rust/crates/operator/src/start_operator.rs index 2005bf06..ac2f515d 100644 --- a/operator/rust/crates/operator/src/start_operator.rs +++ b/operator/rust/crates/operator/src/start_operator.rs @@ -1,5 +1,5 @@ #![allow(missing_docs)] -use alloy_network::{Ethereum, EthereumSigner}; +use alloy_network::Ethereum; use alloy_provider::RootProvider; use alloy_provider::{Provider, ProviderBuilder}; use alloy_rpc_types::{BlockNumberOrTag, Filter}; @@ -7,6 +7,8 @@ use alloy_sol_types::{sol, SolEvent}; use alloy_transport_http::Client; use chrono::Utc; use dotenv::dotenv; +use eigen_logging::{get_logger, init_logger, log_level::LogLevel, logger::Logger}; +use eigen_utils::get_signer; use once_cell::sync::Lazy; use rand::RngCore; use reqwest::Url; @@ -14,16 +16,13 @@ use HelloWorldServiceManager::Task; use alloy_primitives::{eip191_hash_message, Address, FixedBytes, U256}; use alloy_signer::Signer; -use alloy_signer_wallet::LocalWallet; +use alloy_signer_local::PrivateKeySigner; use eigen_client_elcontracts::{ reader::ELChainReader, writer::{ELChainWriter, Operator}, }; use eyre::Result; -use alloy_provider::fillers::{ - ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SignerFiller, -}; use std::{env, str::FromStr}; use ECDSAStakeRegistry::SignatureWithSaltAndExpiry; @@ -65,11 +64,11 @@ async fn sign_and_response_to_task( task_created_block: u32, name: String, ) -> Result<()> { - let provider = get_provider_with_wallet(KEY.clone()); + let provider = get_signer(KEY.clone(), &RPC_URL); let message = format!("Hello, {}", name); let msg_hash = eip191_hash_message(message); - let wallet = LocalWallet::from_str(&KEY.clone()).expect("failed to generate wallet "); + let wallet = PrivateKeySigner::from_str(&KEY.clone()).expect("failed to generate wallet "); let signature = wallet.sign_hash(&msg_hash).await?; @@ -98,7 +97,7 @@ async fn sign_and_response_to_task( /// Monitor new tasks async fn monitor_new_tasks() -> Result<()> { - let provider = get_provider_with_wallet(KEY.clone()); + let provider = get_signer(KEY.clone(), &RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); @@ -156,9 +155,9 @@ async fn monitor_new_tasks() -> Result<()> { } async fn register_operator() -> Result<()> { - let wallet = LocalWallet::from_str(&KEY).expect("failed to generate wallet "); + let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); - let provider = get_provider_with_wallet(KEY.clone()); + let provider = get_signer(KEY.clone(), &RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); let delegation_manager_contract_address = @@ -171,7 +170,11 @@ async fn register_operator() -> Result<()> { let default_slasher = Address::ZERO; // We don't need slasher for our example. let default_strategy = Address::ZERO; // We don't need strategy for our example. + // initialize logger at Debug tracing + // init_logger(LogLevel::Debug); + let logger = get_logger(); let elcontracts_reader_instance = ELChainReader::new( + logger.clone(), default_slasher, delegation_manager_contract_address, avs_directory_contract_address, @@ -265,27 +268,3 @@ pub async fn main() { tokio::time::sleep(tokio::time::Duration::from_secs(60)).await; } } - -pub fn get_provider_with_wallet( - key: String, -) -> FillProvider< - JoinFill< - JoinFill< - JoinFill, NonceFiller>, - ChainIdFiller, - >, - SignerFiller, - >, - RootProvider>, - alloy_transport_http::Http, - Ethereum, -> { - let wallet = LocalWallet::from_str(&key.to_string()).expect("failed to generate wallet "); - let url = Url::parse(&RPC_URL.clone()).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); - - return provider; -} diff --git a/operator/rust/crates/operator/src/test_utils.rs b/operator/rust/crates/operator/src/test_utils.rs index ef2375fd..e3fd93ce 100644 --- a/operator/rust/crates/operator/src/test_utils.rs +++ b/operator/rust/crates/operator/src/test_utils.rs @@ -1,13 +1,19 @@ #![allow(missing_docs)] -use alloy_network::{Ethereum, EthereumSigner}; -use alloy_provider::fillers::{ - ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SignerFiller, -}; +use alloy_primitives::{eip191_hash_message, Address, FixedBytes, U256}; use alloy_provider::{Provider, ProviderBuilder, RootProvider}; use alloy_rpc_types::{BlockNumberOrTag, Filter}; +use alloy_signer::Signer; +use alloy_signer_local::PrivateKeySigner; use alloy_sol_types::{sol, SolEvent}; use alloy_transport_http::Client; use chrono::Utc; +use eigen_client_elcontracts::{ + reader::ELChainReader, + writer::{ELChainWriter, Operator}, +}; +use eigen_logging::get_test_logger; +use eigen_utils::{get_provider, get_signer}; +use eyre::Result; use once_cell::sync::Lazy; use rand::Rng; use rand::RngCore; @@ -15,15 +21,6 @@ use reqwest::Url; use tokio::time::{self, Duration}; use HelloWorldServiceManager::Task; -use alloy_primitives::{eip191_hash_message, Address, FixedBytes, U256}; -use alloy_signer::Signer; -use alloy_signer_wallet::LocalWallet; -use eigen_client_elcontracts::{ - reader::ELChainReader, - writer::{ELChainWriter, Operator}, -}; -use eyre::Result; - use std::{env, str::FromStr}; use ECDSAStakeRegistry::SignatureWithSaltAndExpiry; @@ -65,7 +62,7 @@ async fn sign_and_response_to_task( task_created_block: u32, name: String, ) -> Result<()> { - let wallet = LocalWallet::from_str(&KEY).expect("failed to generate wallet "); + let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); let message = format!("Hello, {}", name); let msg_hash = eip191_hash_message(message); @@ -74,10 +71,7 @@ async fn sign_and_response_to_task( println!("Signing and responding to task : {:?}", task_index); let url = Url::parse(&RPC_URL.clone()).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); + let provider = get_provider(&RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); let hello_world_contract = @@ -102,12 +96,9 @@ async fn sign_and_response_to_task( /// Monitor new tasks pub async fn monitor_new_tasks() -> Result<()> { - let wallet = LocalWallet::from_str(&KEY).expect("failed to generate wallet "); + let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); let url = Url::parse(&RPC_URL).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); + let provider = get_provider(&RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); @@ -159,7 +150,7 @@ pub async fn monitor_new_tasks() -> Result<()> { } pub async fn register_operator() -> Result<()> { - let wallet = LocalWallet::from_str(&KEY).expect("failed to generate wallet "); + let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); @@ -173,7 +164,9 @@ pub async fn register_operator() -> Result<()> { let default_slasher = Address::ZERO; // We don't need slasher for our example. let default_strategy = Address::ZERO; // We don't need strategy for our example. + let logger = get_test_logger(); let elcontracts_reader_instance = ELChainReader::new( + logger.clone(), default_slasher, delegation_manager_contract_address, avs_directory_contract_address, @@ -217,10 +210,7 @@ pub async fn register_operator() -> Result<()> { let signature = wallet.sign_hash(&digest_hash).await?; let url = Url::parse(&RPC_URL).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); + let provider = get_signer(KEY.clone(), &RPC_URL); let _operator_signature = SignatureWithSaltAndExpiry { signature: signature.as_bytes().into(), salt, @@ -265,7 +255,7 @@ async fn create_new_task(task_name: &str) -> Result<()> { let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); - let provider = get_provider_with_wallet(KEY.clone()); + let provider = get_signer(KEY.clone(), &RPC_URL); let hello_world_contract = HelloWorldServiceManager::new(hello_world_contract_address, provider); @@ -296,30 +286,6 @@ async fn start_creating_tasks() { } } -pub fn get_provider_with_wallet( - key: String, -) -> FillProvider< - JoinFill< - JoinFill< - JoinFill, NonceFiller>, - ChainIdFiller, - >, - SignerFiller, - >, - RootProvider>, - alloy_transport_http::Http, - Ethereum, -> { - let wallet = LocalWallet::from_str(&key.to_string()).expect("failed to generate wallet "); - let url = Url::parse(&RPC_URL.clone()).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); - - return provider; -} - #[cfg(test)] mod tests { use super::*; @@ -331,12 +297,8 @@ mod tests { dotenv().ok(); let _ = register_operator().await; - let wallet = LocalWallet::from_str(&KEY).expect("failed to generate wallet "); - let url = Url::parse(&RPC_URL).expect("Wrong rpc url"); - let provider = ProviderBuilder::new() - .with_recommended_fillers() - .signer(EthereumSigner::from(wallet.clone())) - .on_http(url); + let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); + let provider = get_signer(KEY.clone(), &RPC_URL); let delegation_manager_contract_address = Address::from_str(&DELEGATION_MANAGER_CONTRACT_ADDRESS) @@ -361,7 +323,7 @@ mod tests { #[tokio::test] async fn test_spam_tasks() { dotenv().ok(); - let provider = get_provider_with_wallet(KEY.clone()); + let provider = get_signer(KEY.clone(), &RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); let hello_world_contract = From 4e2d3a28ef0b95f268202d4870574dc76e38d2d0 Mon Sep 17 00:00:00 2001 From: supernovahs Date: Wed, 14 Aug 2024 15:34:42 +0530 Subject: [PATCH 3/5] nits --- Cargo.lock | 14 +++ Cargo.toml | 1 + operator/rust/crates/operator/Cargo.toml | 2 +- .../crates/operator/src/start_operator.rs | 110 ++++++++++-------- .../rust/crates/operator/src/test_utils.rs | 7 +- 5 files changed, 79 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index df3b463f..429f2f87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1428,6 +1428,19 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "eigen-testing-utils" +version = "0.0.1-alpha" +source = "git+https://github.com/Layr-labs/eigensdk-rs?rev=a84983e#a84983ea26f403a5a47d155ee485f73038ebde0d" +dependencies = [ + "alloy-network", + "alloy-primitives", + "alloy-provider", + "alloy-transport-http", + "eigen-utils", + "once_cell", +] + [[package]] name = "eigen-types" version = "0.0.1-alpha" @@ -2236,6 +2249,7 @@ dependencies = [ "dotenv", "eigen-client-elcontracts", "eigen-logging", + "eigen-testing-utils", "eigen-types", "eigen-utils", "eyre", diff --git a/Cargo.toml b/Cargo.toml index 5ed37d69..2a58aa48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ eigen-client-elcontracts = {git = "https://github.com/Layr-labs/eigensdk-rs", re eigen-types = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} eigen-utils = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} eigen-logging = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} +eigen-testing-utils = {git = "https://github.com/Layr-labs/eigensdk-rs", rev = "a84983e"} #alloy alloy-chains = "0.1.15" diff --git a/operator/rust/crates/operator/Cargo.toml b/operator/rust/crates/operator/Cargo.toml index 6b1f8ba0..5effd763 100644 --- a/operator/rust/crates/operator/Cargo.toml +++ b/operator/rust/crates/operator/Cargo.toml @@ -33,6 +33,7 @@ eigen-client-elcontracts.workspace = true eigen-types.workspace = true eigen-utils.workspace = true eigen-logging.workspace = true +eigen-testing-utils.workspace = true #misc dotenv = "0.15.0" @@ -43,7 +44,6 @@ futures-util = "0.3" eyre = "0.6.12" #tokio tokio = {workspace = true, features =["full"]} - [lints] workspace = true diff --git a/operator/rust/crates/operator/src/start_operator.rs b/operator/rust/crates/operator/src/start_operator.rs index ac2f515d..ea817ae5 100644 --- a/operator/rust/crates/operator/src/start_operator.rs +++ b/operator/rust/crates/operator/src/start_operator.rs @@ -1,28 +1,24 @@ #![allow(missing_docs)] -use alloy_network::Ethereum; -use alloy_provider::RootProvider; -use alloy_provider::{Provider, ProviderBuilder}; +use alloy_primitives::{eip191_hash_message, Address, FixedBytes, U256}; +use alloy_provider::Provider; use alloy_rpc_types::{BlockNumberOrTag, Filter}; +use alloy_signer::SignerSync; +use alloy_signer_local::PrivateKeySigner; use alloy_sol_types::{sol, SolEvent}; -use alloy_transport_http::Client; use chrono::Utc; use dotenv::dotenv; -use eigen_logging::{get_logger, init_logger, log_level::LogLevel, logger::Logger}; -use eigen_utils::get_signer; -use once_cell::sync::Lazy; -use rand::RngCore; -use reqwest::Url; -use HelloWorldServiceManager::Task; - -use alloy_primitives::{eip191_hash_message, Address, FixedBytes, U256}; -use alloy_signer::Signer; -use alloy_signer_local::PrivateKeySigner; use eigen_client_elcontracts::{ reader::ELChainReader, writer::{ELChainWriter, Operator}, }; +use eigen_logging::{get_logger, init_logger, log_level::LogLevel, logger::Logger, EigenLogger}; +use eigen_utils::get_signer; use eyre::Result; +use once_cell::sync::Lazy; +use rand::RngCore; +use HelloWorldServiceManager::Task; +use eigen_utils::binding::ECDSAStakeRegistry; use std::{env, str::FromStr}; use ECDSAStakeRegistry::SignatureWithSaltAndExpiry; @@ -33,8 +29,6 @@ sol!( "json_abi/HelloWorldServiceManager.json" ); -use eigen_utils::binding::ECDSAStakeRegistry; - static KEY: Lazy = Lazy::new(|| env::var("PRIVATE_KEY").expect("failed to retrieve private key")); @@ -51,7 +45,7 @@ static DELEGATION_MANAGER_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { }); static STAKE_REGISTRY_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { - env::var("STAKE_REGISTRY_ADDRESS") + env::var("HOLESKY_STAKE_REGISTRY_ADDRESS") .expect("failed to get stake registry contract address from env") }); @@ -59,6 +53,7 @@ static AVS_DIRECTORY_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { env::var("AVS_DIRECTORY_ADDRESS") .expect("failed to get delegation manager contract address from env") }); + async fn sign_and_response_to_task( task_index: u32, task_created_block: u32, @@ -70,7 +65,7 @@ async fn sign_and_response_to_task( let msg_hash = eip191_hash_message(message); let wallet = PrivateKeySigner::from_str(&KEY.clone()).expect("failed to generate wallet "); - let signature = wallet.sign_hash(&msg_hash).await?; + let signature = wallet.sign_hash_sync(&msg_hash)?; println!("Signing and responding to task : {:?}", task_index); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) @@ -101,13 +96,9 @@ async fn monitor_new_tasks() -> Result<()> { let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); - println!( - "hello world contrat address:{:?}", - hello_world_contract_address - ); + let hello_world_contract = HelloWorldServiceManager::new(hello_world_contract_address, &provider); - println!("hello contract :{:?}", hello_world_contract); let word: &str = "EigenWorld"; // If you want to send this tx to holesky , please uncomment the gas price and gas limit @@ -154,25 +145,33 @@ async fn monitor_new_tasks() -> Result<()> { } } -async fn register_operator() -> Result<()> { +async fn register_operator(logger: EigenLogger) -> Result<()> { let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); let provider = get_signer(KEY.clone(), &RPC_URL); + let chain_id = provider + .get_chain_id() + .await + .expect("failed to get chain id "); + let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); - let delegation_manager_contract_address = - Address::from_str(&DELEGATION_MANAGER_CONTRACT_ADDRESS) - .expect("wrong delegation manager contract address"); + let delegation_manager_contract_address: Address; + let avs_directory_contract_address: Address; + delegation_manager_contract_address = Address::from_str(&DELEGATION_MANAGER_CONTRACT_ADDRESS) + .expect("wrong stake registry contract address"); + println!( + "delegation manager :{}", + delegation_manager_contract_address + ); + avs_directory_contract_address = Address::from_str(&AVS_DIRECTORY_CONTRACT_ADDRESS) + .expect("wrong stake registry contract address"); let stake_registry_contract_address = Address::from_str(&STAKE_REGISTRY_CONTRACT_ADDRESS) .expect("wrong stake registry contract address"); - let avs_directory_contract_address = Address::from_str(&AVS_DIRECTORY_CONTRACT_ADDRESS) - .expect("wrong delegation manager contract address"); let default_slasher = Address::ZERO; // We don't need slasher for our example. let default_strategy = Address::ZERO; // We don't need strategy for our example. - // initialize logger at Debug tracing - // init_logger(LogLevel::Debug); - let logger = get_logger(); + let elcontracts_reader_instance = ELChainReader::new( logger.clone(), default_slasher, @@ -195,15 +194,30 @@ async fn register_operator() -> Result<()> { 0u32, None, ); + + let is_registered = elcontracts_reader_instance + .is_operator_registered(wallet.address()) + .await + .unwrap(); + logger + .tracing_logger + .as_ref() + .unwrap() + .info(&format!("is registered {}", is_registered), &[""]); #[allow(unused_doc_comments)] ///In case you are running holesky. Comment the below register_as_operator call after the first /// call . Since we can register only once per operator. let _tx_hash = elcontracts_writer_instance .register_as_operator(operator) .await; - println!("Operator registered on EL successfully"); + logger + .tracing_logger + .as_ref() + .unwrap() + .info("Operator registered on EL successfully", &[""]); let mut salt = [0u8; 32]; rand::rngs::OsRng.fill_bytes(&mut salt); + let salt = FixedBytes::from_slice(&salt); let now = Utc::now().timestamp(); let expiry: U256 = U256::from(now + 3600); @@ -217,8 +231,7 @@ async fn register_operator() -> Result<()> { .await .expect("not able to calculate operator "); - let signature = wallet.sign_hash(&digest_hash).await?; - + let signature = wallet.sign_hash_sync(&digest_hash)?; let operator_signature = SignatureWithSaltAndExpiry { signature: signature.as_bytes().into(), salt, @@ -227,22 +240,21 @@ async fn register_operator() -> Result<()> { let contract_ecdsa_stake_registry = ECDSAStakeRegistry::new(stake_registry_contract_address, provider); - println!("initialize new ecdsa "); - - // If you wish to run on holesky, please deploy the stake registry contract(it's not deployed right now) - // and uncomment the gas and gas_price - let registeroperator_details = contract_ecdsa_stake_registry - .registerOperatorWithSignature(wallet.clone().address(), operator_signature); - let _tx = registeroperator_details - // .gas(300000) - // .gas_price(20000000000) + let registeroperator_details_call = contract_ecdsa_stake_registry + .registerOperatorWithSignature(wallet.clone().address(), operator_signature) + .gas(200000); + registeroperator_details_call .send() .await? .get_receipt() .await?; - println!( - "Operator registered on AVS successfully :{:?}", - wallet.address() + + logger.tracing_logger.unwrap().info( + &format!( + "Operator registered on AVS successfully :{}", + wallet.address() + ), + &[""], ); Ok(()) @@ -251,7 +263,9 @@ async fn register_operator() -> Result<()> { #[tokio::main] pub async fn main() { dotenv().ok(); - if let Err(e) = register_operator().await { + init_logger(LogLevel::Info); + let logger = get_logger(); + if let Err(e) = register_operator(logger).await { eprintln!("Failed to register operator: {:?}", e); return; } diff --git a/operator/rust/crates/operator/src/test_utils.rs b/operator/rust/crates/operator/src/test_utils.rs index e3fd93ce..713e521f 100644 --- a/operator/rust/crates/operator/src/test_utils.rs +++ b/operator/rust/crates/operator/src/test_utils.rs @@ -1,11 +1,10 @@ #![allow(missing_docs)] use alloy_primitives::{eip191_hash_message, Address, FixedBytes, U256}; -use alloy_provider::{Provider, ProviderBuilder, RootProvider}; +use alloy_provider::Provider; use alloy_rpc_types::{BlockNumberOrTag, Filter}; use alloy_signer::Signer; use alloy_signer_local::PrivateKeySigner; use alloy_sol_types::{sol, SolEvent}; -use alloy_transport_http::Client; use chrono::Utc; use eigen_client_elcontracts::{ reader::ELChainReader, @@ -70,7 +69,6 @@ async fn sign_and_response_to_task( let signature = wallet.sign_hash(&msg_hash).await?; println!("Signing and responding to task : {:?}", task_index); - let url = Url::parse(&RPC_URL.clone()).expect("Wrong rpc url"); let provider = get_provider(&RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); @@ -96,8 +94,6 @@ async fn sign_and_response_to_task( /// Monitor new tasks pub async fn monitor_new_tasks() -> Result<()> { - let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); - let url = Url::parse(&RPC_URL).expect("Wrong rpc url"); let provider = get_provider(&RPC_URL); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) @@ -208,7 +204,6 @@ pub async fn register_operator() -> Result<()> { .expect("not able to calculate operator "); let signature = wallet.sign_hash(&digest_hash).await?; - let url = Url::parse(&RPC_URL).expect("Wrong rpc url"); let provider = get_signer(KEY.clone(), &RPC_URL); let _operator_signature = SignatureWithSaltAndExpiry { From 6edd048d5be10f1c0196c8b50911927451d71d65 Mon Sep 17 00:00:00 2001 From: supernovahs Date: Wed, 14 Aug 2024 15:36:20 +0530 Subject: [PATCH 4/5] add env local --- .env.local | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .env.local diff --git a/.env.local b/.env.local new file mode 100644 index 00000000..ba248cb8 --- /dev/null +++ b/.env.local @@ -0,0 +1,16 @@ +PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 +RPC_URL=http://127.0.0.1:8545 +CONTRACT_ADDRESS=0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB +DELEGATION_MANAGER_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 +STAKE_REGISTRY_ADDRESS=0x9E545E3C0baAB3E08CdfD552C960A1050f373042 +AVS_DIRECTORY_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 + + + +HOLESKY_PRIVATE_KEY=0x70cf3589410a4471117581a3ed6aed567d180ad96b51d97bf2744a9c74fe55d0 +HOLESKY_RPC_URL=https://1rpc.io/holesky +HOLESKY_CONTRACT_ADDRESS=0x3361953F4a9628672dCBcDb29e91735fb1985390 +HOLESKY_DELEGATION_MANAGER_ADDRESS=0xA44151489861Fe9e3055d95adC98FbD462B948e7 +HOLESKY_STAKE_REGISTRY_ADDRESS=0xBDACD5998989Eec814ac7A0f0f6596088AA2a270 +HOLESKY_AVS_DIRECTORY_ADDRESS=0x055733000064333CaDDbC92763c58BF0192fFeBf +HOLESKY_WS_RPC_URL=wss://holesky.drpc.org \ No newline at end of file From b704fa1c71251bbb128c435efc10a95dcfac34db Mon Sep 17 00:00:00 2001 From: supernovahs Date: Wed, 14 Aug 2024 23:51:17 +0530 Subject: [PATCH 5/5] update stake registry holesky address, make holesky as default in rust --- .env.local | 4 +-- .../crates/operator/src/start_operator.rs | 33 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.env.local b/.env.local index ba248cb8..45319f9d 100644 --- a/.env.local +++ b/.env.local @@ -8,9 +8,9 @@ AVS_DIRECTORY_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 HOLESKY_PRIVATE_KEY=0x70cf3589410a4471117581a3ed6aed567d180ad96b51d97bf2744a9c74fe55d0 -HOLESKY_RPC_URL=https://1rpc.io/holesky +HOLESKY_RPC_URL=https://ethereum-holesky-rpc.publicnode.com HOLESKY_CONTRACT_ADDRESS=0x3361953F4a9628672dCBcDb29e91735fb1985390 HOLESKY_DELEGATION_MANAGER_ADDRESS=0xA44151489861Fe9e3055d95adC98FbD462B948e7 -HOLESKY_STAKE_REGISTRY_ADDRESS=0xBDACD5998989Eec814ac7A0f0f6596088AA2a270 +HOLESKY_STAKE_REGISTRY_ADDRESS=0x41F6a9eCC12c3Df46608270aAf6C458525269507 HOLESKY_AVS_DIRECTORY_ADDRESS=0x055733000064333CaDDbC92763c58BF0192fFeBf HOLESKY_WS_RPC_URL=wss://holesky.drpc.org \ No newline at end of file diff --git a/operator/rust/crates/operator/src/start_operator.rs b/operator/rust/crates/operator/src/start_operator.rs index ea817ae5..fc34835d 100644 --- a/operator/rust/crates/operator/src/start_operator.rs +++ b/operator/rust/crates/operator/src/start_operator.rs @@ -30,17 +30,18 @@ sol!( ); static KEY: Lazy = - Lazy::new(|| env::var("PRIVATE_KEY").expect("failed to retrieve private key")); + Lazy::new(|| env::var("HOLESKY_PRIVATE_KEY").expect("failed to retrieve private key")); pub static RPC_URL: Lazy = - Lazy::new(|| env::var("RPC_URL").expect("failed to get rpc url from env")); + Lazy::new(|| env::var("HOLESKY_RPC_URL").expect("failed to get rpc url from env")); pub static HELLO_WORLD_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { - env::var("CONTRACT_ADDRESS").expect("failed to get hello world contract address from env") + env::var("HOLESKY_CONTRACT_ADDRESS") + .expect("failed to get hello world contract address from env") }); static DELEGATION_MANAGER_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { - env::var("DELEGATION_MANAGER_ADDRESS") + env::var("HOLESKY_DELEGATION_MANAGER_ADDRESS") .expect("failed to get delegation manager contract address from env") }); @@ -50,7 +51,7 @@ static STAKE_REGISTRY_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { }); static AVS_DIRECTORY_CONTRACT_ADDRESS: Lazy = Lazy::new(|| { - env::var("AVS_DIRECTORY_ADDRESS") + env::var("HOLESKY_AVS_DIRECTORY_ADDRESS") .expect("failed to get delegation manager contract address from env") }); @@ -149,10 +150,6 @@ async fn register_operator(logger: EigenLogger) -> Result<()> { let wallet = PrivateKeySigner::from_str(&KEY).expect("failed to generate wallet "); let provider = get_signer(KEY.clone(), &RPC_URL); - let chain_id = provider - .get_chain_id() - .await - .expect("failed to get chain id "); let hello_world_contract_address = Address::from_str(&HELLO_WORLD_CONTRACT_ADDRESS) .expect("wrong hello world contract address"); @@ -195,15 +192,15 @@ async fn register_operator(logger: EigenLogger) -> Result<()> { None, ); - let is_registered = elcontracts_reader_instance - .is_operator_registered(wallet.address()) - .await - .unwrap(); - logger - .tracing_logger - .as_ref() - .unwrap() - .info(&format!("is registered {}", is_registered), &[""]); + // let is_registered = elcontracts_reader_instance + // .is_operator_registered(wallet.address()) + // .await + // .unwrap(); + // logger + // .tracing_logger + // .as_ref() + // .unwrap() + // .info(&format!("is registered {}", is_registered), &[""]); #[allow(unused_doc_comments)] ///In case you are running holesky. Comment the below register_as_operator call after the first /// call . Since we can register only once per operator.