Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

egnkey cli functionality #71

Merged
merged 42 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
142141c
add skeleton
ricomateo Jul 30, 2024
03b9dad
add commands info and load provider
TomasArrachea Jul 31, 2024
28f684e
add contract addresses
ricomateo Jul 31, 2024
29fe3bb
remove unused crates
TomasArrachea Jul 31, 2024
80e15df
add testing against sdk-go output
TomasArrachea Jul 31, 2024
2a81e79
add error handling and reorganize eigen-cli crate
ricomateo Aug 1, 2024
7d1fadd
add EigenAddressCliError type and reorganize egnaddrs crate (remove e…
ricomateo Aug 1, 2024
f70121d
add documentation to functions and fixing spaces
pablodeymo Aug 1, 2024
3d672f5
add param checking with clap
TomasArrachea Aug 2, 2024
6cca229
update tests expected result and rename addresses structs
TomasArrachea Aug 2, 2024
6b65333
remove todo
TomasArrachea Aug 2, 2024
1767313
fix merge conflicts
ricomateo Aug 2, 2024
ad2f495
add doc attribute in lib.rs
ricomateo Aug 2, 2024
fb718d4
add egnkey initial implementation
TomasArrachea Aug 2, 2024
ba64fe7
add ecdsa key generation
TomasArrachea Aug 2, 2024
3746bf8
add ecdsa test
TomasArrachea Aug 6, 2024
57d5104
add generate bls keys implementation
TomasArrachea Aug 6, 2024
47a34c4
add convert command functionality
ricomateo Aug 6, 2024
a3513e8
add documentation to KeyGenerator functions
ricomateo Aug 6, 2024
aae6b19
add error handling and move password creation
TomasArrachea Aug 6, 2024
7f46f61
Merge branch 'main' into cmd-egnkey
TomasArrachea Aug 6, 2024
5bb7ab3
fix merge egnaddrs
TomasArrachea Aug 6, 2024
68e16d8
join egnaddr and egnkey into a single crate
ricomateo Aug 7, 2024
bdf98e3
change error handling in execute_command function
ricomateo Aug 7, 2024
6cf80a6
change args commands so that it matches the eigensdk-go spec
ricomateo Aug 7, 2024
9ba3815
add documentation
ricomateo Aug 7, 2024
ed13aeb
add derive-operator-id command implementation
ricomateo Aug 7, 2024
f371a7a
add test for derive-operator-id command
ricomateo Aug 7, 2024
13fe3f3
add documentation and error handling
ricomateo Aug 7, 2024
5a540fb
fix cargo.toml
ricomateo Aug 7, 2024
5eca30e
add test for 'convert' command
ricomateo Aug 8, 2024
a77ca67
add serializaton error handling and fix Cargo.toml
ricomateo Aug 8, 2024
b76d963
merge main
ricomateo Aug 8, 2024
9abfa5b
fix clippy warnings
ricomateo Aug 8, 2024
4d9bdb7
Update crates/eigen-cli/src/lib.rs
pablodeymo Aug 8, 2024
3b577ff
rename EigenKeyCommand::Convert to ConvertECDSA and fix clippy warning
ricomateo Aug 9, 2024
c0e9423
separate module declarations
TomasArrachea Aug 9, 2024
fcdd811
add prefix 'test' to the cli tests
ricomateo Aug 9, 2024
a7461c0
Merge branch 'cmd-egnkey' of github.com:lambdaclass/eigen-rs into cmd…
ricomateo Aug 9, 2024
e89518b
fix egnkey command description
ricomateo Aug 9, 2024
5199da6
Merge branch 'main' into cmd-egnkey
ricomateo Aug 13, 2024
615ab0b
fix merge conflicts
ricomateo Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 62 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ members = [
"crates/chainio/clients/elcontracts/",
"crates/chainio/clients/eth/",
"crates/chainio/clients/fireblocks/",
"crates/contracts/bindings/",
"crates/chainio/utils/",
"crates/crypto/bn254/",
"crates/utils/",
"crates/contracts/bindings/",
"crates/crypto/bls/",
"crates/crypto/bn254/",
"crates/crypto/keystore/",
"crates/eigen-cli/",
"crates/logging/",
"crates/metrics/",
"crates/metrics/collectors/economic/",
"crates/metrics/collectors/rpc_calls/",
"crates/metrics/metrics-derive",
"crates/services/avsregistry/",
"crates/services/bls_aggregation/",
"crates/metrics/metrics-derive",
"crates/services/operatorsinfo/",
"crates/types/",
"crates/metrics/",
"crates/types/",
"crates/signer/",
"crates/logging/",
"crates/signer/",
"examples/info-operator-service/",
"testing/testing-utils/",
"crates/types/",
"crates/types/",
"crates/utils/",
"examples/anvil-utils",
"examples/avsregistry-read",
"examples/avsregistry-write",
"examples/anvil-utils",
"examples/info-operator-service/",
"testing/testing-utils/",
]
resolver = "2"

Expand All @@ -49,7 +49,9 @@ rust.rust_2018_idioms = { level = "deny", priority = -1 }
rustdoc.all = "warn"

[workspace.dependencies]
ark-ec = "0.4"
ark-ff = "0.4.0"
ark-serialize = "0.4.2"
async-trait = "0.1.81"
aws-config = "1.5.4"
aws-sdk-kms = "1.37.0"
Expand Down Expand Up @@ -80,26 +82,33 @@ ethers = "2.0.14"
ethers-signers = "2.0.14"
eyre = "0.6.12"
futures-util = "0.3.30"
hex = "0.4"
hex-literal = "0.4.1"
hyper = "0.14.25"
info-operator-service = { path = "examples/info-operator-service" }
k256 = "0.13.3"
metrics = "0.21.1"
metrics-exporter-prometheus = "0.12.0"
num-bigint = "0.4.6"
once_cell = "1.17"
prometheus-client = "0.22.2"
quote = "1.0"
rand = "0.8"
rand_core = "0.6"
reqwest = "0.12.4"
reth = { git = "https://github.com/paradigmxyz/reth" }
rstest = "0.22.0"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.121"
syn = "2.0"
tempfile = "3"
testcontainers = "0.20.1"
thiserror = "1.0"
tokio = { version = "1.37.0", features = ["test-util", "full", "sync"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3", features = ["json"] }
url = "2.5.2"
uuid = { version = "1.10.0", features = ["v4"] }

#misc
parking_lot = "0.12"
Expand Down
18 changes: 18 additions & 0 deletions crates/eigen-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,28 @@ alloy-json-rpc.workspace = true
alloy-primitives.workspace = true
alloy-provider.workspace = true
alloy-transport.workspace = true
ark-ec.workspace = true
ark-ff.workspace = true
ark-serialize.workspace = true
clap.workspace = true
eigen-crypto-bls.workspace = true
eigen-testing-utils.workspace = true
eigen-types.workspace = true
eigen-utils.workspace = true
eth-keystore.workspace = true
hex.workspace = true
k256.workspace = true
num-bigint.workspace = true
rand.workspace = true
rand_core.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio.workspace = true
uuid.workspace = true


[dev-dependencies]
eigen-testing-utils.workspace = true
rstest.workspace = true
tempfile.workspace = true
70 changes: 68 additions & 2 deletions crates/eigen-cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ pub enum Commands {
#[command(
about = "Given an initial contract address, which can be either a registry coordinator or service manager address,
outputs addresses for all relevant Eigenlayer and AVS contracts within the network",
alias = "a",
name = "egnaddrs",
group(
ArgGroup::new("manager_or_coordinator")
.required(true)
.args(&["service_manager", "registry_coordinator"]),
)
)]
GetAddresses {
EigenAddress {
#[arg(
long,
help = "ServiceManager contract address",
Expand All @@ -42,4 +42,70 @@ outputs addresses for all relevant Eigenlayer and AVS contracts within the netwo
#[arg(long, help = "rpc url", default_value = ANVIL_RPC_URL)]
rpc_url: String,
},

#[command(about = "EigenLayer CLI Key tools", name = "egnkey")]
EigenKey {
#[command(subcommand)]
subcommand: EigenKeyCommand,
},
}

#[derive(Subcommand, Debug)]
pub enum EigenKeyCommand {
#[command(
about = "Generate keys for testing purpose.
This command creates ecdsa or bls key pair for testing purposes. It generates
all the relevant files for reading and keys and decrypted it and also gets
ricomateo marked this conversation as resolved.
Show resolved Hide resolved
you the private keys in plaintext.

It creates the following artifacts based on arguments
- passwords.txt - contains all passwords to decrypt keys
- private_key_hex.txt - will create plaintext private keys
- keys/* - create all the encrypted json files in this folder",
alias = "g"
)]
Generate {
#[arg(long, help = "key type to create (ecdsa or bls)")]
#[clap(value_enum)]
key_type: KeyType,

#[arg(long, help = "number of keys to create", default_value = "1")]
num_keys: u32,

#[arg(long, help = "folder to store keys")]
output_dir: Option<String>,
},

#[command(
about = "Given a private key, output its associated operatorId (hash of bn254 G1 pubkey).",
alias = "d"
)]
DeriveOperatorId {
#[arg(
long,
help = "(bn254) private key from which to derive operatorId from"
)]
private_key: String,
},

#[command(
about = "Stores an ecdsa key to a file, in web3 secret storage format.",
alias = "c"
)]
Convert {
ricomateo marked this conversation as resolved.
Show resolved Hide resolved
#[arg(long, help = "private key to store (in hex)")]
private_key: String,

#[arg(long, help = "file to store key")]
output_file: Option<String>,

#[arg(long, help = "password to encrypt key")]
password: Option<String>,
},
}

#[derive(clap::ValueEnum, Debug, Clone)]
pub enum KeyType {
Ecdsa,
Bls,
}
Loading
Loading