From 6c239d27bd3e9c8cda5a8c90bd293fe0021247ff Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Fri, 28 Jun 2024 15:50:58 -0700 Subject: [PATCH] support set claimer (#146) * support set claimer * add new commit * disable it for mainnet * correct tabs --- go.mod | 15 +++--- go.sum | 44 +++++++-------- pkg/operator.go | 2 +- pkg/operator/flags.go | 21 ++++++++ pkg/operator/register.go | 16 ++++++ pkg/operator/setclaimer.go | 101 +++++++++++++++++++++++++++++++++++ pkg/types/chain_metadata.go | 9 ++-- pkg/types/operator_config.go | 19 +++---- pkg/utils/utils.go | 27 +++++----- 9 files changed, 196 insertions(+), 58 deletions(-) create mode 100644 pkg/operator/flags.go create mode 100644 pkg/operator/setclaimer.go diff --git a/go.mod b/go.mod index 9beacd3..95de0d6 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.21.11 require ( github.com/AlecAivazis/survey/v2 v2.3.7 - github.com/Layr-Labs/eigensdk-go v0.1.7 + github.com/Layr-Labs/eigensdk-go v0.1.9-0.20240628053008-cc3b8d2dd339 github.com/consensys/gnark-crypto v0.12.1 - github.com/ethereum/go-ethereum v1.14.3 + github.com/ethereum/go-ethereum v1.14.5 github.com/fatih/color v1.17.0 github.com/posthog/posthog-go v0.0.0-20240327112532-87b23fe11103 github.com/stretchr/testify v1.9.0 @@ -18,7 +18,7 @@ require ( ) require ( - github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect github.com/aws/aws-sdk-go-v2/config v1.27.11 // indirect @@ -38,12 +38,12 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/deckarep/golang-set/v2 v2.1.0 // indirect + github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect @@ -72,12 +72,11 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/mod v0.17.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect + golang.org/x/sys v0.20.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.20.0 // indirect google.golang.org/protobuf v1.33.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index b64b183..9ba357e 100644 --- a/go.sum +++ b/go.sum @@ -6,18 +6,18 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOEl github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Layr-Labs/eigensdk-go v0.1.7 h1:2qC3Wl2gKw/mJJfESeXTH7bKoHWqQCFz6qKO3Ny7TDI= -github.com/Layr-Labs/eigensdk-go v0.1.7/go.mod h1:OF9lmS/57MKxS0xpSpX0qHZl0SKkDRpvJIvsGvMN1y8= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Layr-Labs/eigensdk-go v0.1.9-0.20240628053008-cc3b8d2dd339 h1:nyoGQeiFSwAhoiAy9ffaJxGOEgpNpZO4EmGbkejaLkU= +github.com/Layr-Labs/eigensdk-go v0.1.9-0.20240628053008-cc3b8d2dd339/go.mod h1:XcLVDtlB1vOPj63D236b451+SC75B8gwgkpNhYHSxNs= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= -github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= +github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= +github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/config v1.27.11 h1:f47rANd2LQEYHda2ddSCKYId18/8BhSRM4BULGmfgNA= @@ -60,8 +60,8 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqy github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= @@ -84,8 +84,8 @@ github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoY github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= -github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= +github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= @@ -93,8 +93,8 @@ github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= -github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= @@ -109,8 +109,10 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4 github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2eHz4PHA= -github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8= +github.com/ethereum/go-ethereum v1.14.5 h1:szuFzO1MhJmweXjoM5nSAeDvjNUH3vIQoMzzQnfvjpw= +github.com/ethereum/go-ethereum v1.14.5/go.mod h1:VEDGGhSxY7IEjn98hJRFXl/uFvpRgbIIf2PpXiyGGgc= +github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4= +github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w= github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -121,8 +123,6 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= -github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= @@ -301,8 +301,6 @@ golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+ golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -323,8 +321,8 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= @@ -340,8 +338,6 @@ golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= @@ -352,8 +348,8 @@ google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHh gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/operator.go b/pkg/operator.go index 2f2b583..4418695 100644 --- a/pkg/operator.go +++ b/pkg/operator.go @@ -16,9 +16,9 @@ func OperatorCmd(p utils.Prompter) *cli.Command { operator.RegisterCmd(p), operator.StatusCmd(p), operator.UpdateCmd(p), + operator.SetClaimerCmd(p), }, } return operatorCmd - } diff --git a/pkg/operator/flags.go b/pkg/operator/flags.go new file mode 100644 index 0000000..e768b73 --- /dev/null +++ b/pkg/operator/flags.go @@ -0,0 +1,21 @@ +package operator + +import "github.com/urfave/cli/v2" + +var ( + ConfigurationFilePathFlag = cli.StringFlag{ + Name: "configuration-file", + Aliases: []string{"c"}, + Usage: "Path to the configuration file", + Required: true, + EnvVars: []string{"NODE_OPERATOR_CONFIG_FILE"}, + } + + ClaimerAddressFlag = cli.StringFlag{ + Name: "claimer-address", + Aliases: []string{"a"}, + Usage: "Address of the claimer", + Required: true, + EnvVars: []string{"NODE_OPERATOR_CLAIMER_ADDRESS"}, + } +) diff --git a/pkg/operator/register.go b/pkg/operator/register.go index d751cc1..4b29b16 100644 --- a/pkg/operator/register.go +++ b/pkg/operator/register.go @@ -338,6 +338,12 @@ func readConfigFile(path string) (*types.OperatorConfig, error) { return nil, err } operatorCfg.ELAVSDirectoryAddress = elAVSDirectoryAddress + + elRewardsCoordinatorAddress, err := getRewardCoordinatorAddress(operatorCfg.ChainId) + if err != nil { + return nil, err + } + operatorCfg.ELRewardsCoordinatorAddress = elRewardsCoordinatorAddress return &operatorCfg, nil } @@ -351,6 +357,16 @@ func getAVSDirectoryAddress(chainID big.Int) (string, error) { } } +func getRewardCoordinatorAddress(chainID big.Int) (string, error) { + chainIDInt := chainID.Int64() + chainMetadata, ok := utils.ChainMetadataMap[chainIDInt] + if !ok { + return "", fmt.Errorf("chain ID %d not supported", chainIDInt) + } else { + return chainMetadata.ELRewardsCoordinatorAddress, nil + } +} + func getTransactionLink(txHash string, chainId *big.Int) string { chainIDInt := chainId.Int64() chainMetadata, ok := utils.ChainMetadataMap[chainIDInt] diff --git a/pkg/operator/setclaimer.go b/pkg/operator/setclaimer.go new file mode 100644 index 0000000..fa8ac89 --- /dev/null +++ b/pkg/operator/setclaimer.go @@ -0,0 +1,101 @@ +package operator + +import ( + "context" + "fmt" + + "github.com/Layr-Labs/eigenlayer-cli/pkg/telemetry" + "github.com/Layr-Labs/eigenlayer-cli/pkg/utils" + + "github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts" + "github.com/Layr-Labs/eigensdk-go/chainio/clients/eth" + "github.com/Layr-Labs/eigensdk-go/chainio/txmgr" + eigensdkLogger "github.com/Layr-Labs/eigensdk-go/logging" + eigenMetrics "github.com/Layr-Labs/eigensdk-go/metrics" + + "github.com/ethereum/go-ethereum/common" + + "github.com/urfave/cli/v2" +) + +func SetClaimerCmd(p utils.Prompter) *cli.Command { + setClaimerCmd := &cli.Command{ + Name: "set-claimer", + Usage: "Set the claimer address for the operator", + UsageText: "set-claimer", + Description: ` +Set the rewards claimer address for the operator. + `, + After: telemetry.AfterRunAction(), + Flags: []cli.Flag{ + &ConfigurationFilePathFlag, + &ClaimerAddressFlag, + }, + Action: func(cCtx *cli.Context) error { + configurationFilePath := cCtx.String(ConfigurationFilePathFlag.Name) + claimerAddress := cCtx.String(ClaimerAddressFlag.Name) + + operatorCfg, err := validateAndReturnConfig(configurationFilePath) + if err != nil { + return err + } + cCtx.App.Metadata["network"] = operatorCfg.ChainId.String() + if operatorCfg.ChainId.Int64() == utils.MainnetChainId { + return fmt.Errorf("set claimer currently unsupported on mainnet") + } + + logger, err := eigensdkLogger.NewZapLogger(eigensdkLogger.Development) + if err != nil { + return err + } + + ethClient, err := eth.NewClient(operatorCfg.EthRPCUrl) + if err != nil { + return err + } + + keyWallet, sender, err := getWallet(operatorCfg, ethClient, p, logger) + if err != nil { + return err + } + + txMgr := txmgr.NewSimpleTxManager(keyWallet, ethClient, logger, sender) + + noopMetrics := eigenMetrics.NewNoopMetrics() + + contractCfg := elcontracts.Config{ + DelegationManagerAddress: common.HexToAddress(operatorCfg.ELDelegationManagerAddress), + AvsDirectoryAddress: common.HexToAddress(operatorCfg.ELAVSDirectoryAddress), + RewardsCoordinatorAddress: common.HexToAddress(operatorCfg.ELRewardsCoordinatorAddress), + } + fmt.Println(operatorCfg) + + elWriter, err := elcontracts.NewWriterFromConfig(contractCfg, ethClient, logger, noopMetrics, txMgr) + if err != nil { + return err + } + + receipt, err := elWriter.SetClaimerFor(context.Background(), common.HexToAddress(claimerAddress)) + if err != nil { + return err + } + + fmt.Printf( + "%s Claimer address %s set successfully for operator %s\n", + utils.EmojiCheckMark, + claimerAddress, + operatorCfg.Operator.Address, + ) + + printRegistrationInfo( + receipt.TxHash.String(), + common.HexToAddress(operatorCfg.Operator.Address), + &operatorCfg.ChainId, + ) + + return nil + }, + } + + return setClaimerCmd +} diff --git a/pkg/types/chain_metadata.go b/pkg/types/chain_metadata.go index eeeff3f..3a9906f 100644 --- a/pkg/types/chain_metadata.go +++ b/pkg/types/chain_metadata.go @@ -1,8 +1,9 @@ package types type ChainMetadata struct { - BlockExplorerUrl string - ELDelegationManagerAddress string - ELAVSDirectoryAddress string - WebAppUrl string + BlockExplorerUrl string + ELDelegationManagerAddress string + ELAVSDirectoryAddress string + ELRewardsCoordinatorAddress string + WebAppUrl string } diff --git a/pkg/types/operator_config.go b/pkg/types/operator_config.go index 3a9f7a5..6195f10 100644 --- a/pkg/types/operator_config.go +++ b/pkg/types/operator_config.go @@ -40,15 +40,16 @@ type Web3SignerConfig struct { } type OperatorConfig struct { - Operator eigensdkTypes.Operator `yaml:"operator"` - ELDelegationManagerAddress string `yaml:"el_delegation_manager_address"` - ELAVSDirectoryAddress string - EthRPCUrl string `yaml:"eth_rpc_url"` - PrivateKeyStorePath string `yaml:"private_key_store_path"` - SignerType SignerType `yaml:"signer_type"` - ChainId big.Int `yaml:"chain_id"` - FireblocksConfig FireblocksConfig `yaml:"fireblocks"` - Web3SignerConfig Web3SignerConfig `yaml:"web3"` + Operator eigensdkTypes.Operator `yaml:"operator"` + ELDelegationManagerAddress string `yaml:"el_delegation_manager_address"` + ELAVSDirectoryAddress string + ELRewardsCoordinatorAddress string + EthRPCUrl string `yaml:"eth_rpc_url"` + PrivateKeyStorePath string `yaml:"private_key_store_path"` + SignerType SignerType `yaml:"signer_type"` + ChainId big.Int `yaml:"chain_id"` + FireblocksConfig FireblocksConfig `yaml:"fireblocks"` + Web3SignerConfig Web3SignerConfig `yaml:"web3"` } func (config OperatorConfig) MarshalYAML() (interface{}, error) { diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index b4a142b..7f794bb 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -14,22 +14,25 @@ import ( var ChainMetadataMap = map[int64]types.ChainMetadata{ MainnetChainId: { - BlockExplorerUrl: "https://etherscan.io/tx", - ELDelegationManagerAddress: "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A", - ELAVSDirectoryAddress: "0x135dda560e946695d6f155dacafc6f1f25c1f5af", - WebAppUrl: "https://app.eigenlayer.xyz/operator", + BlockExplorerUrl: "https://etherscan.io/tx", + ELDelegationManagerAddress: "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A", + ELAVSDirectoryAddress: "0x135dda560e946695d6f155dacafc6f1f25c1f5af", + ELRewardsCoordinatorAddress: "", + WebAppUrl: "https://app.eigenlayer.xyz/operator", }, HoleskyChainId: { - BlockExplorerUrl: "https://holesky.etherscan.io/tx", - ELDelegationManagerAddress: "0xA44151489861Fe9e3055d95adC98FbD462B948e7", - ELAVSDirectoryAddress: "0x055733000064333CaDDbC92763c58BF0192fFeBf", - WebAppUrl: "https://holesky.eigenlayer.xyz/operator", + BlockExplorerUrl: "https://holesky.etherscan.io/tx", + ELDelegationManagerAddress: "0xA44151489861Fe9e3055d95adC98FbD462B948e7", + ELAVSDirectoryAddress: "0x055733000064333CaDDbC92763c58BF0192fFeBf", + ELRewardsCoordinatorAddress: "0xb22Ef643e1E067c994019A4C19e403253C05c2B0", + WebAppUrl: "https://holesky.eigenlayer.xyz/operator", }, LocalChainId: { - BlockExplorerUrl: "", - ELDelegationManagerAddress: "", - ELAVSDirectoryAddress: "", - WebAppUrl: "", + BlockExplorerUrl: "", + ELDelegationManagerAddress: "", + ELAVSDirectoryAddress: "", + ELRewardsCoordinatorAddress: "", + WebAppUrl: "", }, }