Skip to content

Commit

Permalink
Merge pull request #64 from ethereum-optimism/tip/pcw109550/update-bi…
Browse files Browse the repository at this point in the history
…ndings

Refactor bindings
  • Loading branch information
pcw109550 authored Jun 12, 2024
2 parents 4058373 + c52299d commit 5a20396
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 242 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,39 @@ jobs:
- name: Run op-program
run: tar -xzvf ./preimages.tar.gz && ./local_cmd.sh
working-directory: tests/op-program-test

rvgo-abigen:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install justfile
uses: extractions/setup-just@v2
with:
just-version: '1.28.0'
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Cache geth alltools
id: cache-geth
uses: actions/cache@v4
with:
path: geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz
key: ${{ runner.os }}-geth-alltools-linux-amd64-1.13.14-2bd6bd01
- name: Download geth alltools if not cached
if: steps.cache-geth.outputs.cache-hit != 'true'
run: |
wget https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz
echo "76a04354dba9980fcbc35bece2957b30 geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz" | md5sum -c -
- name: Install abigen
run: |
tar -xvf geth-alltools-linux-amd64-1.13.14-2bd6bd01.tar.gz
sudo mv geth-alltools-linux-amd64-1.13.14-2bd6bd01/abigen /usr/local/bin/
- name: Build rvsol
run: forge build
working-directory: rvsol
- name: Check bindings
run: |
make gen-bindings
git diff --exit-code bindings
working-directory: rvgo
19 changes: 3 additions & 16 deletions rvgo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ lint-fix:
golangci-lint run --fix
.PHONY: lint-fix

build-bindgen:
cd ../rvsol/lib/optimism/op-bindings && \
go build -o ./bin/op-bindings ./cmd/. && \
cp ./bin/op-bindings ../../../../rvgo/
.PHONY: build-bindgen

bindgen-generate-local:
./op-bindings \
generate \
--metadata-out ./bindings \
--bindings-package bindings \
--contracts-list ../rvsol/artifacts.json \
--log.level info \
local \
--forge-artifacts ../rvsol/out
.PHONY: bindgen-generate-local
gen-bindings:
just bindings-upgrades
.PHONY: gen-bindings
22 changes: 0 additions & 22 deletions rvgo/bindings/preimageoracle.go

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions rvgo/bindings/preimageoracle_more.go

This file was deleted.

128 changes: 0 additions & 128 deletions rvgo/bindings/registry.go

This file was deleted.

22 changes: 0 additions & 22 deletions rvgo/bindings/riscv.go

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions rvgo/bindings/riscv_more.go

This file was deleted.

19 changes: 19 additions & 0 deletions rvgo/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
out := '../rvsol/out'

bindings-upgrades:
#!/usr/bin/env bash
set -euxo pipefail
build_abi() {
jq .abi "{{out}}/$1.sol/$1.json" > "/tmp/$1.json"

local lowercase=$(echo "$1" | awk '{print tolower($0)}')
abigen \
--abi "/tmp/$1.json" \
--pkg bindings \
--out "bindings/$lowercase.go" \
--type $1
}

build_abi RISCV
build_abi PreimageOracle

0 comments on commit 5a20396

Please sign in to comment.