Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/evm-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: EVM Contracts CI

on:
push:
branches: [main]
paths:
- "contracts/evm/**"
- ".github/workflows/evm-contracts.yml"
pull_request:
paths:
- "contracts/evm/**"
- ".github/workflows/evm-contracts.yml"
Comment thread
JoE11-y marked this conversation as resolved.
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
name: EVM Contracts
runs-on: ubuntu-latest
defaults:
run:
working-directory: contracts/evm

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Show Forge version
run: forge --version

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: .

- name: Run Forge fmt
run: forge fmt --check
id: fmt

- name: Run Forge build
run: forge build --sizes
id: build

- name: Build deposit circuit
run: scripts/build_circuits.sh proof_circuits/deposits
working-directory: .

- name: Run Forge tests
run: forge test -vvv
id: test
99 changes: 99 additions & 0 deletions .github/workflows/stellar-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Stellar Contracts CI

on:
push:
branches: [main]
paths:
- "contracts/stellar/**"
- ".github/workflows/stellar-contracts.yml"
pull_request:
paths:
- "contracts/stellar/**"
- ".github/workflows/stellar-contracts.yml"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
lint:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check
working-directory: contracts/stellar

build-and-test:
name: Build & Test
runs-on: ubuntu-latest
needs: lint

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- name: Install wasm32v1-none target
run: rustup target add wasm32v1-none

- name: Cache cargo directories
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/stellar/target
key: ${{ runner.os }}-cargo-stellar-${{ hashFiles('contracts/stellar/Cargo.lock') }}

- name: Install Stellar CLI
run: |
curl -Ls https://github.com/stellar/stellar-cli/releases/download/v23.3.0/stellar-cli-23.3.0-x86_64-unknown-linux-gnu.tar.gz -o /tmp/stellar-cli.tar.gz
mkdir -p "$HOME/.local/bin"
tar -xzf /tmp/stellar-cli.tar.gz -C "$HOME/.local/bin" stellar
chmod +x "$HOME/.local/bin/stellar"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "pnpm"

- name: Install Node dependencies
run: pnpm install --frozen-lockfile

- name: Build contract WASMs
run: |
stellar contract build --package ad-manager
stellar contract build --package order-portal
stellar contract build --package merkle-manager
stellar contract build --package verifier
working-directory: contracts/stellar

- name: Build deposit circuit
run: scripts/build_circuits.sh proof_circuits/deposits

- name: Build verifier test circuits
run: scripts/build_circuits.sh contracts/stellar/contracts/verifier/tests --prove

- name: Run unit tests
run: cargo test --workspace --exclude proofbridge-stellar
working-directory: contracts/stellar

- name: Generate integration test fixtures
run: npx tsx generate_fixtures.ts
working-directory: contracts/stellar/tests/fixtures

- name: Run integration tests
run: cargo test --test integration_test -- --nocapture
working-directory: contracts/stellar
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
target
Prover.toml
target
40 changes: 0 additions & 40 deletions contracts/evm/.github/workflows/test.yml

This file was deleted.

1 change: 1 addition & 0 deletions contracts/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@types/node": "^20.0.0",
"ts-node": "^10.9.2",
"tsx": "^4.21.0",
"typescript": "^5.3.3"
}
}
12 changes: 5 additions & 7 deletions contracts/evm/src/AdManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,11 @@ contract AdManager is AccessControl, ReentrancyGuard, EIP712 {
* @param adId Ad id to fund.
* @param amount Amount to deposit.
*/
function fundAd(
bytes memory signature,
bytes32 authToken,
uint256 timeToExpire,
string memory adId,
uint256 amount
) external payable nonReentrant {
function fundAd(bytes memory signature, bytes32 authToken, uint256 timeToExpire, string memory adId, uint256 amount)
external
payable
nonReentrant
{
Ad storage ad = __getAdOwned(adId, msg.sender);
if (!ad.open) revert AdManager__AdClosed();
if (amount == 0) revert AdManager__ZeroAmount();
Expand Down
Loading
Loading