Skip to content

Commit

Permalink
Merge branch 'dev' into dependabot/go_modules/github.com/prometheus/c…
Browse files Browse the repository at this point in the history
…lient_golang-1.20.5
  • Loading branch information
MegaRedHand authored Feb 7, 2025
2 parents ad5ea0b + d729fcd commit 0868e39
Show file tree
Hide file tree
Showing 58 changed files with 8,481 additions and 3,531 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Bindings

on:
push:
branches:
- dev
pull_request:
merge_group:

permissions:
contents: read

jobs:
generate_bindings:
name: Generate bindings
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install go1.21
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Add Ethereum PPA
run: sudo add-apt-repository -y ppa:ethereum/ethereum

- name: Install Abigen
run: sudo apt-get update && sudo apt-get install ethereum

- name: Show abigen version
run: abigen --version

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v0.3.0

- name: Run make bindings
run: make bindings

check_bindings:
name: Check bindings are up-to-date
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

# This step is needed to know if the contracts were changed.
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
contracts:
- 'contracts/lib/**'
- 'contracts/script/**'
- 'contracts/src/**'
bindings:
- 'contracts/bindings/**'
# This step runs only if some contract changed.
# It checks whether the bindings directory have changed.
# If there are no changes, then the bindings are outdated
# and therefore this step will fail.
- name: Check the bindings are up-to-date
if: steps.filter.outputs.contracts == 'true'
run: |
BINDINGS_UPDATED=${{ steps.filter.outputs.bindings }}
if [[ "$BINDINGS_UPDATED" == "false" ]]; then
echo "The bindings are outdated";
exit 1
fi
58 changes: 58 additions & 0 deletions .github/workflows/check-anvil-state.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Check anvil state
on:
push:
branches:
- dev
pull_request:
merge_group:

jobs:
generate-anvil-state:
name: generate anvil state
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Generate anvil state
run: make deploy-contracts-to-anvil-and-save-state

check-anvil-state:
name: Check anvil dump is up-to-date
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# This step is needed to know if the contracts were changed.
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
contracts:
- 'contracts/lib/**'
- 'contracts/script/**'
- 'contracts/src/**'
anvil_state:
- 'contracts/anvil/contracts-deployed-anvil-state.json'
# This step runs only if some contract changed.
# It checks whether the anvil state has changed.
# If there are no changes, then the anvil state is outdated
# and therefore this step will fail.
- name: Check the anvil state is up-to-date
if: steps.filter.outputs.contracts == 'true'
run: |
ANVIL_STATE_UPDATED=${{ steps.filter.outputs.anvil_state }}
if [[ "$ANVIL_STATE_UPDATED" == "false" ]]; then
echo "The anvil state is outdated";
exit 1
fi
40 changes: 40 additions & 0 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Contracts CI

on:
push:
branches: [main]
pull_request:
branches: [ '**' ]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./contracts

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

- name: Show Forge version
run: forge --version

- name: Run Forge fmt
run: forge fmt --check

- name: Run Forge build
run: forge build
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mocks: ## generates mocks

.PHONY: tests
tests: ## runs all tests
go test -race ./... -timeout=5m
go test -race ./... -timeout=6m

.PHONY: tests-cover
tests-cover: ## run all tests with test coverge
Expand Down Expand Up @@ -63,7 +63,7 @@ core_default := "DelegationManager IRewardsCoordinator StrategyManager EigenPod
core_location := "./lib/eigenlayer-middleware/lib/eigenlayer-contracts"
core_bindings_location := "../../../../bindings"

middleware_default := "RegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry IBLSSignatureChecker ServiceManagerBase IERC20"
middleware_default := "RegistryCoordinator SlashingRegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry SocketRegistry IBLSSignatureChecker ServiceManagerBase IERC20"
middleware_location := "./lib/eigenlayer-middleware"
middleware_bindings_location := "../../bindings"

Expand Down Expand Up @@ -113,7 +113,7 @@ eigenpod-bindings: ## generates contract bindings for eigenpod

.PHONY: bindings
bindings: ## generates all contract bindings
rm -rf bindings/* && make core-bindings middleware-bindings sdk-bindings eigenpod-bindings
rm -rf contracts/bindings/* && make core-bindings middleware-bindings sdk-bindings eigenpod-bindings


___CONTRACTS___: ##
Expand Down
36 changes: 18 additions & 18 deletions chainio/clients/avsregistry/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func NewBindingsFromConfig(
var (
err error

serviceManagerAddr gethcommon.Address
stakeRegistryAddr gethcommon.Address
blsApkRegistryAddr gethcommon.Address
indexRegistryAddr gethcommon.Address
Expand All @@ -74,18 +73,6 @@ func NewBindingsFromConfig(
return nil, utils.WrapError("Failed to create BLSRegistryCoordinator contract", err)
}

serviceManagerAddr, err = contractBlsRegistryCoordinator.ServiceManager(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to fetch ServiceManager address", err)
}
contractServiceManager, err = servicemanager.NewContractServiceManagerBase(
serviceManagerAddr,
client,
)
if err != nil {
return nil, utils.WrapError("Failed to create ServiceManager contract", err)
}

stakeRegistryAddr, err = contractBlsRegistryCoordinator.StakeRegistry(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to fetch StakeRegistry address", err)
Expand Down Expand Up @@ -123,10 +110,6 @@ func NewBindingsFromConfig(
if err != nil {
return nil, utils.WrapError("Failed to get DelegationManager address", err)
}
avsDirectoryAddr, err = contractServiceManager.AvsDirectory(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to get AvsDirectory address", err)
}

delegationManager, err := contractDelegationManager.NewContractDelegationManager(
delegationManagerAddr,
Expand All @@ -140,6 +123,23 @@ func NewBindingsFromConfig(
}
}

if isZeroAddress(cfg.ServiceManagerAddress) {
logger.Debug("ServiceManager address not provided, the calls to the contract will not work")
} else {
contractServiceManager, err = servicemanager.NewContractServiceManagerBase(
cfg.ServiceManagerAddress,
client,
)
if err != nil {
return nil, utils.WrapError("Failed to create ServiceManager contract", err)
}

avsDirectoryAddr, err = contractServiceManager.AvsDirectory(&bind.CallOpts{})
if err != nil {
return nil, utils.WrapError("Failed to get AvsDirectory address", err)
}
}

if isZeroAddress(cfg.OperatorStateRetrieverAddress) {
logger.Debug("OperatorStateRetriever address not provided, the calls to the contract will not work")
} else {
Expand All @@ -154,7 +154,7 @@ func NewBindingsFromConfig(
}

return &ContractBindings{
ServiceManagerAddr: serviceManagerAddr,
ServiceManagerAddr: cfg.ServiceManagerAddress,
RegistryCoordinatorAddr: cfg.RegistryCoordinatorAddress,
StakeRegistryAddr: stakeRegistryAddr,
BlsApkRegistryAddr: blsApkRegistryAddr,
Expand Down
Loading

0 comments on commit 0868e39

Please sign in to comment.