perf: L2 gas optimization — 54.8% weighted gas reduction #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Security Analysis | |
| on: | |
| pull_request: | |
| paths: | |
| - 'contracts/**/*.sol' | |
| - 'anchor/**/*.rs' | |
| - 'sdk/**/*.ts' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'contracts/**/*.sol' | |
| - 'anchor/**/*.rs' | |
| - 'sdk/**/*.ts' | |
| workflow_dispatch: | |
| jobs: | |
| slither: | |
| name: Slither Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Install dependencies | |
| working-directory: contracts | |
| run: forge install | |
| - name: Run Slither | |
| uses: crytic/slither-action@v0.4.0 | |
| with: | |
| target: contracts/ | |
| slither-config: contracts/slither.config.json | |
| fail-on: high | |
| sarif: results.sarif | |
| - name: Upload SARIF | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: results.sarif | |
| forge-tests: | |
| name: Forge Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Run tests | |
| working-directory: contracts | |
| run: forge test -vvv | |
| - name: Run invariant tests | |
| working-directory: contracts | |
| run: forge test --match-contract Invariants -vvv | |
| - name: Gas report | |
| working-directory: contracts | |
| run: forge test --gas-report | |
| coverage: | |
| name: Test Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Run coverage | |
| working-directory: contracts | |
| run: forge coverage --report summary | |
| - name: Generate lcov report | |
| working-directory: contracts | |
| run: forge coverage --report lcov | |
| rust-tests: | |
| name: Rust Anchor Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-action@stable | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| anchor/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('anchor/Cargo.lock') }} | |
| - name: Run unit tests | |
| working-directory: anchor | |
| run: cargo test --lib | |
| - name: Run clippy | |
| working-directory: anchor | |
| run: cargo clippy -- -D warnings | |
| - name: Check formatting | |
| working-directory: anchor | |
| run: cargo fmt -- --check | |
| sdk-tests: | |
| name: SDK Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: sdk/package.json | |
| - name: Install dependencies | |
| working-directory: sdk | |
| run: npm install | |
| - name: Build SDK | |
| working-directory: sdk | |
| run: npm run build | |
| - name: Run tests | |
| working-directory: sdk | |
| run: npm test | |
| - name: Run tests with coverage | |
| working-directory: sdk | |
| run: npm run test:coverage | |
| dependency-audit: | |
| name: Dependency Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-action@stable | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Audit Rust dependencies | |
| working-directory: anchor | |
| run: cargo audit | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install SDK dependencies | |
| working-directory: sdk | |
| run: npm install | |
| - name: Audit npm dependencies | |
| working-directory: sdk | |
| run: npm audit --audit-level=high |