Skip to content

Commit

Permalink
Merge pull request #450 from bob-collective/feat/relayer
Browse files Browse the repository at this point in the history
Add relayer binary
  • Loading branch information
gregdhill authored Jan 31, 2025
2 parents 9217101 + 3ebd99e commit ef5773c
Show file tree
Hide file tree
Showing 101 changed files with 91,694 additions and 58 deletions.
74 changes: 36 additions & 38 deletions .github/workflows/test.yml → .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,62 @@
name: test
name: Contracts

on: [pull_request]

env:
FOUNDRY_PROFILE: ci

jobs:
contracts:
name: Contracts
tests:
name: Tests
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: contracts
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install foundry
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v0.3.0
- name: Run forge fmt
run: |
forge --version
forge fmt --check
id: fmt
- name: Run forge build
run: |
forge build --sizes --deny-warnings
id: build
- name: Install deps
run: forge install
- name: Run forge tests
# Currently forked tests are disabled to increase reliability of CI builds
run: |
forge test --no-match-contract Forked -vvv --deny-warnings
id: test
- name: Run forge docs
run: |
forge doc --out docs/docs/contracts
python3 docs/scripts/forge_doc_reformat.py
- name: Commit forge docs
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Generate Foundry docs"
file_pattern: "./docs/"
sdk:
name: SDK
bindings:
name: Bindings
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: ./sdk
working-directory: contracts
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
always-auth: true
- run: npm ci
- run: npx prettier --check {examples,src,test}
- run: npm run lint
- name: Run tests
run: npm test
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Pull library deps
run: forge install
- name: Check fmt
run: forge fmt --check
- name: Build contracts before checking bindings are correct
run: forge build --sizes
- name: Versions
run: |
forge --version
git submodule status
- name: Run forge docs
run: |
forge doc --out ../docs/docs/contracts
python3 ../docs/scripts/forge_doc_reformat.py
- name: Commit forge docs
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Generate Foundry docs"
file_pattern: "./docs/"
27 changes: 27 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: SDK

on: [pull_request]

env:
FOUNDRY_PROFILE: ci

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
always-auth: true
- run: npm ci
- run: npx prettier --check {examples,src,test}
- run: npm run lint
- name: Run tests
run: npm test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ node_modules/*

# generated docs
/docs/docs/api/*

# Rust stuff
/target
out/
cache/
Cargo.lock
10 changes: 5 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[submodule "lib/forge-std"]
path = lib/forge-std
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
path = contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/bitcoin-spv"]
path = lib/bitcoin-spv
path = contracts/lib/bitcoin-spv
url = https://github.com/bob-collective/bitcoin-spv
[submodule "lib/account-abstraction"]
path = lib/account-abstraction
path = contracts/lib/account-abstraction
url = https://github.com/eth-infinitism/account-abstraction
[submodule "lib/gsn"]
path = lib/gsn
path = contracts/lib/gsn
url = https://github.com/opengsn/gsn
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[workspace]
members = ["relayer", "crates/bindings"]

[workspace.dependencies]
bindings = { path = "crates/bindings" }
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/make -f

# Default target is build
default: build

# Define variables
CARGO=cargo
CRATES_FOLDER=crates
CONTRACTS_PATH=./contracts
BINDINGS_FOLDER=bindings
BINDINGS_CRATES_FOLDER=$(CRATES_FOLDER)/$(BINDINGS_FOLDER)
BINDINGS_OUT_PATH=$(CONTRACTS_PATH)/out/$(BINDINGS_FOLDER)

# Target for generating bindings
bindings:
rm -rf $(BINDINGS_CRATES_FOLDER)
rm -rf $(BINDINGS_OUT_PATH)

# Generate new bindings
@forge bind --root $(CONTRACTS_PATH) --crate-name $(BINDINGS_FOLDER) --select FullRelay

# Move bindings to the correct location
@mv -f $(BINDINGS_OUT_PATH) $(CRATES_FOLDER)

# Target for building the project
build: bindings
@$(CARGO) build

# Target for building the project in release mode
build-release: bindings
@$(CARGO) build --release

# Target for cleaning the project
clean:
@forge clean --root $(CONTRACTS_PATH)
@$(CARGO) clean

# Target for formatting the code
fmt:
@forge fmt --check --root $(CONTRACTS_PATH)
@$(CARGO) fmt

# Target for running tests
test:
@forge test --root $(CONTRACTS_PATH)
@$(CARGO) test

# Target for installing forge dependencies
setup:
@forge install --root $(CONTRACTS_PATH)


# Declare phony targets
.PHONY: build build-release clean fmt bindings
5 changes: 4 additions & 1 deletion foundry.toml → contracts/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[profile.default]
fs_permissions = [{ access = "read", path = "./optimized-out" }, { access = "read", path = "./test/fullRelay/testData/" }]
fs_permissions = [
{ access = "read", path = "./optimized-out" },
{ access = "read", path = "./test/fullRelay/testData/" },
]
src = "src"
out = "out"
libs = ["lib"]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions crates/bindings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "bindings"
version = "0.1.0"
edition = "2021"

[dependencies]
alloy = { git = "https://github.com/alloy-rs/alloy", features = ["sol-types", "contract"] }
Loading

0 comments on commit ef5773c

Please sign in to comment.