Skip to content

Commit

Permalink
Merge branch 'dev' into fix_bls_aggregation_multiple_quorums
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand authored Feb 19, 2025
2 parents ef86269 + d323b0f commit 9dfe126
Show file tree
Hide file tree
Showing 75 changed files with 17,970 additions and 8,211 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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/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
28 changes: 28 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Pull Request Workflow"
on:
merge_group:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

env:
PR_URL: https://github.com/Layr-Labs/eigensdk-go/pull/${{ github.event.number }}

jobs:
# Enforces the update of a changelog file on every pull request
# The update in the changelog can be skipped if the pull request
# includes the `changelog-ignore` label.
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check CHANGELOG.md is updated
uses: dangoslen/changelog-enforcer@v3
with:
skipLabels: changelog-ignore

- name: Check the PR URL is included in CHANGELOG.md
if: contains(github.event.pull_request.labels.*.name, 'changelog-ignore') == false
run: git diff CHANGELOG.md | grep $PR_URL CHANGELOG.md
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
91 changes: 91 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Each version will have a separate `Breaking Changes` section as well. To describe in how to upgrade from one version to another if needed

## [Unreleased]
### Added
### Changed
* fix: change requested pr url in changelog's workflow by @maximopalopoli in <https://github.com/Layr-Labs/eigensdk-go/pull/575>

### Breaking changes

* refactor: encapsulate parameters into `TaskSignature` in [#487](https://github.com/Layr-Labs/eigensdk-go/pull/487)

* Introduced `TaskSignature` struct to encapsulate parameters related to task signatures:
* Updated `ProcessNewSignature` to accept a `TaskSignature` struct instead of multiple parameters.

```go
// BEFORE
blsAggServ.ProcessNewSignature(
context.Background(),
taskIndex,
taskResponse,
blsSigOp1,
testOperator1.OperatorId,
)

// AFTER
taskSignature := NewTaskSignature(taskIndex, taskResponse, blsSig, testOperator1.OperatorId)

blsAggServ.ProcessNewSignature(
context.Background(),
taskSignature,
)
```

* refactor: update interface on `bls aggregation` in [#485](https://github.com/Layr-Labs/eigensdk-go/pull/485).
* Introduces a new struct `TaskMetadata` with a constructor `NewTaskMetadata` to initialize a new task and a method `WithWindowDuration` to set the window duration.
* Refactors `InitializeNewTask` and `singleTaskAggregatorGoroutineFunc` to accept a `TaskMetadata` struct instead of multiple parameters.

```go
// BEFORE
blsAggServ := NewBlsAggregatorService(fakeAvsRegistryService, hashFunction, logger)
blsAggServ.InitializeNewTask(
taskIndex,
blockNum,
quorumNumbers,
quorumThresholdPercentages,
tasksTimeToExpiry,
)
// AFTER
blsAggServ := NewBlsAggregatorService(fakeAvsRegistryService, hashFunction, logger)
metadata := NewTaskMetadata(taskIndex, blockNum, quorumNumbers, quorumThresholdPercentages, tasksTimeToExpiry)
blsAggServ.InitializeNewTask(metadata)
```

* Removes `InitializeNewTaskWithWindow` since `windowDuration` can now be set in `TaskMetadata`.

```go
// BEFORE
blsAggServ := NewBlsAggregatorService(fakeAvsRegistryService, hashFunction, logger)
err = blsAggServ.InitializeNewTaskWithWindow(
taskIndex,
blockNum,
quorumNumbers,
quorumThresholdPercentages,
timeToExpiry,
windowDuration,
)
// AFTER
blsAggServ := NewBlsAggregatorService(fakeAvsRegistryService, hashFunction, logger)
metadata := NewTaskMetadata(
taskIndex,
blockNum,
quorumNumbers,
quorumThresholdPercentages,
tasksTimeToExpiry,
).WithWindowDuration(windowDuration)
blsAggServ.InitializeNewTask(metadata)
```

### Removed
8 changes: 4 additions & 4 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=4m
go test -race ./... -timeout=6m

.PHONY: tests-cover
tests-cover: ## run all tests with test coverge
Expand Down Expand Up @@ -59,11 +59,11 @@ lint: ## runs all linters

___BINDINGS___: ##

core_default := "DelegationManager IRewardsCoordinator StrategyManager EigenPod EigenPodManager IStrategy AVSDirectory AllocationManager PermissionController"
core_default := "DelegationManager RewardsCoordinator StrategyManager EigenPod EigenPodManager IStrategy AVSDirectory AllocationManager PermissionController"
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
Loading

0 comments on commit 9dfe126

Please sign in to comment.