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

Check bindings in ci #428

Draft
wants to merge 14 commits into
base: dev
Choose a base branch
from
Draft
48 changes: 48 additions & 0 deletions .github/workflows/check-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: check bindings are up-to-date
on:
push:
branches:
- dev
pull_request:
merge_group:

permissions:
contents: read

jobs:
make-bindings:
name: make bindings and check for diffs
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
submodules: recursive

- name: install go1.22
uses: actions/setup-go@v5
with:
go-version: "1.22"

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

- name: Install abigen
run: go install github.com/ethereum/go-ethereum/cmd/abigen@latest

- name: Print versions used
run: |
go version
abigen --version
forge --version

- name: run make bindings and check for diffs
run: |
make bindings
# sudo required due to bindings being owned by root
if [ ! -z "$(sudo git status --porcelain)" ]; then
printf "Current generated bindings not up to date\n"
sudo git diff
sudo git status
exit 1
fi
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions chainio/clients/eigenpod/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cleanup_bindings_dir() {

clone() {
echo "Cloning the EigenLayer contracts repository"
git clone -b slashing-magnitudes --depth=1 git@github.com:Layr-Labs/eigenlayer-contracts.git "${TMP_DIR}"
git clone -b slashing-magnitudes --depth=1 https://github.com/Layr-Labs/eigenlayer-contracts.git "${TMP_DIR}"
}

generate_bindings() {
Expand Down Expand Up @@ -56,4 +56,4 @@ main() {
cleanup
}

main
main
4 changes: 2 additions & 2 deletions contracts/generate-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function create_binding {
echo ${solc_bin} >data/tmp.bin

rm -f $binding_dir/${contract}/binding.go
docker run -v $(realpath $binding_dir):/home/binding_dir -v .:/home/repo abigen-with-interfaces --bin=/home/repo/data/tmp.bin --abi=/home/repo/data/tmp.abi --pkg=contract${contract} --out=/home/binding_dir/${contract}/binding.go
docker run --rm -v $(realpath $binding_dir):/home/binding_dir -v .:/home/repo abigen-with-interfaces --bin=/home/repo/data/tmp.bin --abi=/home/repo/data/tmp.abi --pkg=contract${contract} --out=/home/binding_dir/${contract}/binding.go
rm -rf data/tmp.abi data/tmp.bin
}

Expand All @@ -46,4 +46,4 @@ echo "Generating bindings for contracts: $contracts"
for contract in $contracts; do
sleep 1 # this is a hack to fix the issue with abigen randomly failing for some contracts
create_binding . "$contract" "$bindings_path"
done
done
Loading