Skip to content

Commit e240c07

Browse files
authored
Merge branch 'master' into fix-rewards-network-override
2 parents 34535d3 + 8d1b6c8 commit e240c07

File tree

5 files changed

+76
-102
lines changed

5 files changed

+76
-102
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 25 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,42 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
1+
name: "codeql-scanning"
132

143
on:
154
push:
16-
branches: [ "master" ]
5+
branches:
6+
- master
177
pull_request:
18-
branches: [ "master" ]
8+
branches:
9+
- master
1910
schedule:
20-
- cron: '27 19 * * 1'
11+
- cron: '0 9 * * *'
2112

2213
jobs:
23-
analyze:
24-
name: Analyze (${{ matrix.language }})
25-
# Runner size impacts CodeQL analysis time. To learn more, please see:
26-
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27-
# - https://gh.io/supported-runners-and-hardware-resources
28-
# - https://gh.io/using-larger-runners (GitHub.com only)
29-
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
14+
CodeQL-Scanning:
15+
3016
runs-on: ubuntu-latest
31-
timeout-minutes: 360
17+
3218
permissions:
33-
# required for all workflows
19+
contents: read
3420
security-events: write
21+
pull-requests: read
3522

36-
# required to fetch internal or private CodeQL packs
37-
packages: read
38-
39-
strategy:
40-
fail-fast: false
41-
matrix:
42-
include:
43-
- language: go
44-
build-mode: autobuild
45-
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
46-
# Use `c-cpp` to analyze code written in C, C++ or both
47-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
48-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
49-
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
50-
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
51-
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
52-
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
5323
steps:
5424
- name: Checkout repository
55-
uses: actions/checkout@v4
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
26+
with:
27+
submodules: recursive
5628

29+
- name: Install golang
30+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # 5.3.0
31+
with:
32+
go-version: '1.21.11'
33+
5734
# Initializes the CodeQL tools for scanning.
58-
- name: Initialize CodeQL
59-
uses: github/codeql-action/init@v3
35+
- name: Initialize CodeQL with Trail of Bits Go Queries as well
36+
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a #3.28.8
6037
with:
61-
languages: ${{ matrix.language }}
62-
build-mode: ${{ matrix.build-mode }}
63-
# If you wish to specify custom queries, you can do so here or in a config file.
64-
# By default, queries listed here will override any specified in a config file.
65-
# Prefix the list here with "+" to use these queries and those in the config file.
66-
67-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
68-
# queries: security-extended,security-and-quality
69-
70-
# If the analyze step fails for one of the languages you are analyzing with
71-
# "We were unable to automatically build your code", modify the matrix above
72-
# to set the build mode to "manual" for that language. Then modify this step
73-
# to build your code.
74-
# ℹ️ Command-line programs to run using the OS shell.
75-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
76-
- name: Autobuild
77-
uses: github/codeql-action/autobuild@v3
78-
# - if: matrix.build-mode == 'manual'
79-
# shell: bash
80-
# run: |
81-
# echo 'If you are using a "manual" build mode for one or more of the' \
82-
# 'languages you are analyzing, replace this with the commands to build' \
83-
# 'your code, for example:'
84-
# echo ' make bootstrap'
85-
# echo ' make release'
86-
# exit 1
87-
38+
languages: go
39+
packs: trailofbits/go-queries
40+
8841
- name: Perform CodeQL Analysis
89-
uses: github/codeql-action/analyze@v3
90-
with:
91-
category: "/language:${{matrix.language}}"
42+
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a #3.28.8

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ Links to specific sections are provided below.
143143

144144
If you see any issues in documentation please create an issue or PR [here](https://github.com/Layr-Labs/eigenlayer-docs)
145145

146+
## Integration Testing
147+
Integration testing uses Anvil to generate a reproducible state for the network to be tested against.
148+
149+
### Forge & Anvil
150+
The CLI package leverages tooling from the [eigensdk-go](https://github.com/Layr-Labs/eigensdk-go) to run [Forge](https://github.com/foundry-rs/foundry/tree/master/crates/forge) tests against an [Anvil](https://github.com/foundry-rs/foundry/tree/master/crates/anvil) server based on a predefined network state.
151+
This allows the tests to run against a reproducible environment. See the [Run anvil chain](https://github.com/Layr-Labs/eigenlayer-cli/blob/master/.github/workflows/integration-test.yml#L28-L30)
152+
step in the integration test workflow. See the [eigensdk-go README.md - Anvil](https://github.com/Layr-Labs/eigensdk-go/blob/dev/README.md)
153+
for further discussion on how this environment state is generated and stored.
154+
146155
## Release Process
147156
To release a new version of the CLI, follow the steps below:
148157
> Note: You need to have write permission to this repo to release new version

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ require (
7272
github.com/go-resty/resty/v2 v2.7.0 // indirect
7373
github.com/goccy/go-yaml v1.9.2 // indirect
7474
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
75-
github.com/golang/protobuf v1.5.4 // indirect
7675
github.com/google/uuid v1.6.0 // indirect
7776
github.com/gorilla/websocket v1.5.0 // indirect
7877
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect

go.sum

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ github.com/Layr-Labs/eigenpod-proofs-generation v0.0.14-stable.0.20240730152248-
1616
github.com/Layr-Labs/eigenpod-proofs-generation v0.0.14-stable.0.20240730152248-5c11a259293e/go.mod h1:T7tYN8bTdca2pkMnz9G2+ZwXYWw5gWqQUIu4KLgC/vM=
1717
github.com/Layr-Labs/eigensdk-go v0.1.14-0.20241212232631-72117286b6d8 h1:AMrzXB4M07cpvNbEHS8NHH86LroL+WgE2XwQFrtb/84=
1818
github.com/Layr-Labs/eigensdk-go v0.1.14-0.20241212232631-72117286b6d8/go.mod h1:aYdNURUhaqeYOS+Cq12TfSdPbjFfiLaHkxPdR4Exq/s=
19-
github.com/Layr-Labs/protocol-apis v1.4.1-0.20250205034201-59f1658138f8 h1:n983g2Q7yXltnlySKIGsh4kT2rbVmp2sbjgMrUZBtv0=
20-
github.com/Layr-Labs/protocol-apis v1.4.1-0.20250205034201-59f1658138f8/go.mod h1:prNA2/mLO5vpMZ2q78Nsn0m97wm28uiRnwO+/yOxigk=
21-
github.com/Layr-Labs/protocol-apis v1.4.1-0.20250205141814-bb7c9d0005d0 h1:K+x9x/tV7aj/1Th9OrwohaRM4Z6hEk66eiJKctPtabg=
22-
github.com/Layr-Labs/protocol-apis v1.4.1-0.20250205141814-bb7c9d0005d0/go.mod h1:prNA2/mLO5vpMZ2q78Nsn0m97wm28uiRnwO+/yOxigk=
23-
github.com/Layr-Labs/protocol-apis v1.5.0 h1:O1xpIB42JAPpntFaxVY0Jd1IihrXFOO7bRdhBvBLWYM=
24-
github.com/Layr-Labs/protocol-apis v1.5.0/go.mod h1:prNA2/mLO5vpMZ2q78Nsn0m97wm28uiRnwO+/yOxigk=
2519
github.com/Layr-Labs/protocol-apis v1.6.0 h1:1TTi4+t8Kq4YKsji7xa3CPGYf4fHXZZbbpt3GYQWZ78=
2620
github.com/Layr-Labs/protocol-apis v1.6.0/go.mod h1:zCirDItAbrnEv1kV1RTccY7eVSg0+da4/dFCXHyLNZQ=
2721
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
@@ -215,9 +209,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL
215209
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
216210
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
217211
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
218-
github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo=
219-
github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ=
220212
github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4=
213+
github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
221214
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
222215
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
223216
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
@@ -227,8 +220,6 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
227220
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
228221
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
229222
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
230-
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
231-
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
232223
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
233224
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
234225
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@@ -460,8 +451,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
460451
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
461452
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
462453
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
463-
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
464-
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
465454
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
466455
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
467456
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
@@ -480,8 +469,6 @@ golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qx
480469
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
481470
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
482471
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
483-
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
484-
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
485472
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
486473
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
487474
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -523,8 +510,6 @@ golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
523510
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
524511
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
525512
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
526-
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
527-
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
528513
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
529514
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
530515
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -533,8 +518,6 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
533518
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
534519
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
535520
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
536-
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
537-
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
538521
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
539522
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
540523
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
@@ -552,16 +535,10 @@ golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSm
552535
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
553536
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ=
554537
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY=
555-
google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 h1:HJMDndgxest5n2y77fnErkM62iUsptE/H8p0dC2Huo4=
556-
google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405/go.mod h1:oT32Z4o8Zv2xPQTg0pbVaPr0MPOH6f14RgXt7zfIpwg=
557538
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw=
558539
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU=
559-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I=
560-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc=
561540
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
562541
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
563-
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
564-
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
565542
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
566543
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
567544
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
@@ -572,8 +549,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
572549
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
573550
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
574551
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
575-
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
576-
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
577552
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
578553
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
579554
gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y=

pkg/clients/sidecar/client.go

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,55 @@ package sidecar
22

33
import (
44
"context"
5+
"net/http"
6+
"time"
57

68
rewardsV1 "github.com/Layr-Labs/protocol-apis/gen/protos/eigenlayer/sidecar/v1/rewards"
79
"github.com/akuity/grpc-gateway-client/pkg/grpc/gateway"
810
)
911

1012
//go:generate mockgen -destination=mocks/client.go -package=mocks github.com/Layr-Labs/eigenlayer-cli/pkg/clients/sidecar ISidecarClient
1113

14+
type customTransport struct {
15+
base http.RoundTripper
16+
headers map[string]string
17+
}
18+
19+
func (t *customTransport) RoundTrip(req *http.Request) (*http.Response, error) {
20+
// Clone the request to avoid modifying the original
21+
reqClone := req.Clone(req.Context())
22+
23+
// Add default headers
24+
for key, value := range t.headers {
25+
// Only set the header if it's not already set
26+
if reqClone.Header.Get(key) == "" {
27+
reqClone.Header.Set(key, value)
28+
}
29+
}
30+
31+
// Pass the modified request to the base transport
32+
return t.base.RoundTrip(reqClone)
33+
}
34+
1235
func NewSidecarRewardsClient(url string, opts ...gateway.ClientOption) (rewardsV1.RewardsGatewayClient, error) {
13-
client := rewardsV1.NewRewardsGatewayClient(gateway.NewClient(url, opts...))
36+
httpClient := http.Client{
37+
Transport: &customTransport{
38+
base: http.DefaultTransport,
39+
headers: map[string]string{
40+
"x-sidecar-source": "eigenlayer-cli",
41+
},
42+
},
43+
Timeout: 300 * time.Second,
44+
}
45+
46+
if len(opts) == 0 {
47+
opts = make([]gateway.ClientOption, 0)
48+
}
49+
opts = append(opts, gateway.WithHTTPClient(&httpClient))
50+
51+
gwClient := gateway.NewClient(url, opts...)
52+
53+
client := rewardsV1.NewRewardsGatewayClient(gwClient)
1454

1555
return client, nil
1656
}

0 commit comments

Comments
 (0)