Skip to content

Commit

Permalink
chore: cleanup make deps to be OS aware (#534)
Browse files Browse the repository at this point in the history
use backticks

Fix for weird git error

Go away git
  • Loading branch information
seanmcgary authored May 7, 2024
1 parent 3eec97d commit ef2ea4a
Show file tree
Hide file tree
Showing 113 changed files with 8,682 additions and 18,838 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/cache
17 changes: 2 additions & 15 deletions .github/workflows/check-compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ jobs:
- name: Build and validate
if: github.event_name == 'push'
run: |
sudo apt-get update
sudo apt-get install -y make curl git software-properties-common jq
sudo add-apt-repository -y ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install -y golang-1.22
sudo update-alternatives --install /usr/local/bin/go go /usr/lib/go-1.22/bin/go 1
mkdir ~/.go
export GOPATH=~/.go
export PATH=$PATH:~/.go/bin
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.0
curl -L https://foundry.paradigm.xyz | bash
export PATH=$PATH:/home/runner/.config/.foundry/bin
source ~/.bashrc
foundryup
make bindings
make docker
docker run -v `pwd`:/build -w /build --rm -i eigenlayer-contracts:latest bash -c "make gha"
if [ ! -z "$(git status --porcelain)" ]; then git diff; git status; exit 1; fi
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:22.04

RUN apt-get update \
&& apt-get install -y make curl git software-properties-common jq \
&& add-apt-repository -y ppa:longsleep/golang-backports \
&& add-apt-repository -y ppa:ethereum/ethereum \
&& apt-get update \
&& apt-get install -y golang-1.22 ethereum \
&& curl -L https://foundry.paradigm.xyz | bash \
&& /root/.foundry/bin/foundryup

RUN cp -R /root/.foundry/bin/* /usr/local/bin/

41 changes: 34 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@

CONTAINER_NAME = eigenlayer-contracts

.PHONY: install-hooks
install-hooks:
cp scripts/pre-commit.sh .git/hooks/pre-commit
cp bin/pre-commit.sh .git/hooks/pre-commit

.PHONY: deps
deps: install-hooks
brew install libusb
go install github.com/ethereum/go-ethereum/cmd/abigen@latest
curl -L https://foundry.paradigm.xyz | bash
.PHONY: install-deps
install-deps:
./bin/install-deps.sh
foundryup

.PHONY: deps
deps: install-hooks install-deps

.PHONY: compile
compile:
forge b

.PHONY: bindings
bindings: compile
./scripts/compile-bindings.sh
./bin/compile-bindings.sh

.PHONY: all
all: compile bindings

gha:
git config --global --add safe.directory "*"
forge install
forge b
./bin/compile-bindings.sh

docker:
docker build --progress=plain -t ${CONTAINER_NAME}:latest .

compile-in-docker:
docker run -v $(PWD):/build -w /build --rm -it ${CONTAINER_NAME}:latest bash -c "make compile"

bindings-in-docker:
docker run -v $(PWD):/build -w /build --rm -it ${CONTAINER_NAME}:latest bash -c "make bindings"

all-in-docker:
docker run -v $(PWD):/build -w /build --rm -it ${CONTAINER_NAME}:latest bash -c "make all"

gha-docker:
docker run -v $(PWD):/build -w /build --rm -i ${CONTAINER_NAME}:latest bash -c "make gha"
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ The main branches we use are:

## Documentation

### Setup

To set up this repo for the first time, run:

```bash
make deps
```

This will:
* Install the pre-commit hook
* Install foundry and its tools
* Install abigen

### Basics

To get a basic understanding of EigenLayer, check out [You Could've Invented EigenLayer](https://www.blog.eigenlayer.xyz/ycie/). Note that some of the document's content describes features that do not exist yet (like the Slasher). To understand more about how restakers and operators interact with EigenLayer, check out these guides:
Expand All @@ -54,10 +41,21 @@ foundryup
forge build
forge test
```

make bindings
### Contributor Setup

To set up this repo for the first time, run:

```bash
make deps
```

This will:
* Install the pre-commit hook
* Install foundry and its tools
* Install abigen

### Running Fork Tests

We have a few fork tests against ETH mainnet. Passing these requires the environment variable `RPC_MAINNET` to be set. See `.env.example` for an example. Once you've set up your environment, `forge test` should show these fork tests passing.
Expand Down
10 changes: 9 additions & 1 deletion scripts/compile-bindings.sh → bin/compile-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ function create_binding {
--bin=$binding_out_dir/tmp.bin \
--abi=$binding_out_dir/tmp.abi \
--pkg="${contract_name}" \
--out=$BINDING_DIR/$contract_name/binding.go
--out=$BINDING_DIR/$contract_name/binding.go \
> /dev/null 2>&1

if [[ $? == "1" ]];
then
echo "Failed to generate binding for $contract_json_path"
fi
rm $binding_out_dir/tmp.abi
rm $binding_out_dir/tmp.bin
}

contracts=$(find src/contracts -type f -name "*.sol" )
Expand Down
19 changes: 19 additions & 0 deletions bin/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

OS=$(uname -s | tr '[:upper:]' '[:lower:]')

if [[ "$OS" == "linux" ]]; then
sudo apt-get update
sudo apt-get install -y make curl git software-properties-common jq
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install abigen
curl -L https://foundry.paradigm.xyz | bash
elif [[ "$OS" == "darwin" ]]; then
brew tap ethereum/ethereum
brew install libusb ethereum
curl -L https://foundry.paradigm.xyz | bash
else
echo "Unsupported OS: $OS"
exit 1
fi
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/bindings/AVSDirectory/binding.go

Large diffs are not rendered by default.

Loading

0 comments on commit ef2ea4a

Please sign in to comment.