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
17 changes: 5 additions & 12 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
.github
.vscode
.direnv
.git

node_modules
**/node_modules

.env
**/.env

**/test
**/*_test.go
**/build/_workspace
**/build/bin
**/build/_bin
**/tests/testdata
**/l2geth/signer/fourbyte
**/l2geth/cmd/puppeth
**/l2geth/cmd/clef
**/go/gas-oracle/gas-oracle
**/go/batch-submitter/batch-submitter

# Ignore rust target dir to avoid accidentally borking dependencies
target
gopkg/*/lib/*.a
gopkg/*/lib/*.so
# Same as above



17 changes: 17 additions & 0 deletions .github/workflows/on_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build "da-rpc" Docker image and push
uses: docker/build-push-action@v5
with:
Expand All @@ -29,4 +36,14 @@ jobs:
tags: |
ghcr.io/near/rollup-data-availability/da-rpc:${{ github.sha }}
ghcr.io/near/rollup-data-availability/da-rpc:latest

- name: Build "sidecar" Docker image and push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./bin/http-api/Dockerfile
tags: |
ghcr.io/near/rollup-data-availability/http-api:${{ github.sha }}
ghcr.io/near/rollup-data-availability/http-api:latest

160 changes: 140 additions & 20 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,184 @@ on:
- main

jobs:
lint:
name: "Lint"
runs-on:
group: ubuntu-22.04-8core
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: 📜 Lint code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
test-rust:
name: "Test Rust"
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- '.github/**'
- '**/*.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain**'
- 'flake.nix'
- 'flake.lock'
- 'scripts/**'
- 'justfile'
go:
- '.github/**'
- '**/*.go'
- '**/go.mod'
- '**/go.sum'
- '**/gopkg.lock'
- 'scripts/**'
- 'justfile'
eth:
- '.github/**'
- '**/*.sol'
- 'eth/foundry.toml'
- 'eth/justfile'
- 'eth/package.json'
- 'eth/package-lock.json'
- 'scripts/**'
- 'justfile'
outputs:
rust: ${{ steps.filter.outputs.rust }}
go: ${{ steps.filter.outputs.go }}
eth: ${{ steps.filter.outputs.eth }}

rust:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on:
group: ubuntu-22.04-16core
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"

- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: Swatinem/rust-cache@v2

- name: "Install cargo-nextest"
uses: taiki-e/install-action@v2
with:
tool: nextest

- name: 📜 Lint code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: "Build contracts"
run: make build-contracts

- name: "Ensure target dir exists"
run: mkdir -p target/near/near_da_blob_store

- name: "Run tests"
run: TEST_NEAR_ACCOUNT=${{ secrets.TEST_NEAR_ACCOUNT }} TEST_NEAR_SECRET=${{ secrets.TEST_NEAR_SECRET }} cargo nextest run --workspace --locked
# Nice to have, turned off for now
# - name: "Check for bloat"
# uses: orf/cargo-bloat-action@v1
# with:
# token: ${{ secrets.CEJAS_PERSONAL_ACCESS_TOKEN }}
test-go:
name: "Test gopkg"
go:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
runs-on:
group: ubuntu-22.04-8core
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"

- uses: actions-rust-lang/setup-rust-toolchain@v1

- uses: Swatinem/rust-cache@v2

- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Enrich the test config
run: |
HTTP_API_TEST_SECRET_KEY=${{ secrets.HTTP_API_TEST_SECRET_KEY }} \
HTTP_API_TEST_ACCOUNT_ID=${{ secrets.HTTP_API_TEST_ACCOUNT_ID }} \
HTTP_API_TEST_NAMESPACE=${{ secrets.HTTP_API_TEST_NAMESPACE }} \
scripts/enrich.sh

- uses: hoverkraft-tech/compose-action@v2.0.0

- name: "Ubuntu is missing libm :<"
run: sudo apt-get update && sudo apt-get install -y build-essential

- name: "Install FFI library"
run: make da-rpc-sys

- run: sudo cp ./gopkg/da-rpc/lib/* /usr/local/lib

- name: "Test gopkg"
working-directory: ./gopkg/da-rpc
run: go test -v



- name: "Test sidecar api"
working-directory: ./gopkg/sidecar
run: go test -v

eth-contracts:
needs: changes
if: ${{ needs.changes.outputs.eth == 'true' }}
runs-on:
group: ubuntu-22.04-8core
defaults:
run:
working-directory: ./eth
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

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

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "bun install"

- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

- name: "Build the contracts and print their size"
run: "forge build --sizes"

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

- name: "Show the Foundry config"
run: "forge config"

- name: "Generate a fuzz seed that changes weekly to avoid burning through RPC allowance"
run: >
echo "FOUNDRY_FUZZ_SEED=$(
echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800))
)" >> $GITHUB_ENV

- name: "Run the tests"
run: "forge test --gas-report"

- name: "Add test summary"
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ debug/
target/
lib/

# MacOs files
# Macos files
**/.DS_Store

#.envs
Expand All @@ -25,4 +25,8 @@ op-stack/optimism-private
**.env

# IDE
.idea
.idea

# Http api
http-config.json
http-config.ci.json
Loading