Skip to content
Open

azx #44

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
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
jobs:
build-and-test:
runs-on: [self-hosted, gpu]
env:
EVM_FORK: SHANGHAI

services:
docker:
Expand All @@ -20,7 +22,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/${{ github.run_id }}

Expand All @@ -38,7 +40,7 @@ jobs:
- name: Pull cached Docker image
run: |
cd ${{ github.workspace }}/${{ github.run_id }}
docker pull augustus/goevmlab-cuevm:20241008 || true
docker pull augustus/goevmlab-cuevm:20241216 || true

- name: Start cuevm-test-runner container
run: |
Expand All @@ -52,7 +54,10 @@ jobs:
run: |
cd ${{ github.workspace }}/${{ github.run_id }}
docker exec cuevm-test-runner-${{ github.run_id }} /bin/bash -c "
cmake -S . -B build -DTESTS=OFF -DGPU=ON -DCPU=OFF -DCUDA_COMPUTE_CAPABILITY=86 -DENABLE_EIP_3155_OPTIONAL=OFF -DENABLE_EIP_3155=ON
python3 -m ensurepip --upgrade
python3 -m pip install --no-cache-dir --upgrade cmake==4.2.1
export PATH=\"/root/.local/bin:\$PATH\"
cmake -S . -B build -DTESTS=OFF -DGPU=ON -DCPU=OFF -DEVM_VERSION=${EVM_FORK} -DCUDA_COMPUTE_CAPABILITY=\"103-real;103-virtual\" -DENABLE_EIP_3155_OPTIONAL=OFF -DENABLE_EIP_3155=ON
cmake --build build -j 8
"

Expand Down Expand Up @@ -83,7 +88,7 @@ jobs:


- name: Archive test results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/${{ github.run_id }}/test-outputs
Expand Down
60 changes: 60 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# AGENTS.md — Execution Guide for Advanced Contributors

This document defines how an advanced agent should implement the remaining work to achieve a **GPU‑only, world‑class CuEVM fuzzing stack** on NVIDIA B300‑class GPUs.

## Mission
Deliver maximum‑coverage, GPU‑only fuzzing with multi‑sequence, cross‑contract search and invariant‑based oracles, while keeping the codebase stable, reproducible, and production‑ready.

## Operating principles
- Work in **small, reviewable increments**.
- Keep the system **GPU‑only** for fuzzing (do not depend on CPU‑based gating in the fuzz path).
- Add **measurements first**, then optimize.
- Ensure changes are deterministic and reproducible.

## Repository map (key areas)
- `fuzzing/` — GPU fuzzing harness, configs, invariants.
- `CuEVM/` — core GPU engine and execution semantics.
- `tests/` — GPU/CPU tests and fixtures.
- `scripts/` — CI helpers and test runners.

## Implementation checklist (apply in order)
1. **Fork coverage**
- Implement foundry fork and remove old shits .!
-

2. **Coverage instrumentation**
- Add on‑GPU counters for branches, opcodes, and storage writes.
- Export coverage maps per batch and merge into a global map.

3. **Stateful multi‑sequence search**
- Extend the fuzzer to mutate sequences (insert/delete/reorder).
- Add sender/role, value, and block‑context mutation.
- Support cross‑contract call graphs and receiver pools.

4. **Invariant engine**
- Implement invariant templates (ERC‑20/4626/AMM/lending).
- Add config‑driven invariants per target contract.
- Prioritize cases that violate invariants and retain in corpus.

5. **Corpus + minimization**
- Keep a GPU‑only corpus of interesting sequences.
- Implement minimization to produce small, reproducible JSON tests.

6. **GPU throughput + profiling**
- Auto‑tune batch sizing for B300 occupancy.
- Add timing metrics and Nsight Systems hooks.

7. **Observability + reliability**
- Emit structured logs with coverage and invariant stats.
- Add failure recovery and checkpointing.

## Required quality gates
- Run targeted GPU fuzz smoke tests before merging changes.
- Keep all changes behind configurable flags (opt‑in where needed).
- Maintain consistent formatting and avoid unrelated refactors.

## Useful commands
- Configure (requires CMake 4.2+):
- `cmake -S . -B build -DTESTS=ON -DTESTS_GPU=OFF -DENABLE_EIP_3155=ON`
- Example GPU fuzz run:
- `python fuzzing/fuzzer.py --input fuzzing/contracts/erc20.sol --config fuzzing/configurations/default.json --num_instances 256 --num_iterations 100`
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
endif()
Expand All @@ -25,7 +25,7 @@ enable_language(CUDA)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CUDA_STANDARD 20)
set(CUDA_COMPUTE_CAPABILITY "50" CACHE STRING "CUDA Compute Capability")
set(CUDA_COMPUTE_CAPABILITY "103-real;103-virtual" CACHE STRING "CUDA Compute Capability (e.g. 103-real;103-virtual for NVIDIA B300)")
set(CMAKE_CUDA_ARCHITECTURES ${CUDA_COMPUTE_CAPABILITY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

Expand Down
11 changes: 8 additions & 3 deletions CuEVM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
cmake_minimum_required(VERSION 4.2 FATAL_ERROR)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
endif()
Expand All @@ -23,7 +23,7 @@ enable_language(CUDA)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CUDA_STANDARD 20)
if (NOT CUDA_COMPUTE_CAPABILITY)
set(CUDA_COMPUTE_CAPABILITY "50" CACHE STRING "CUDA Compute Capability")
set(CUDA_COMPUTE_CAPABILITY "103-real;103-virtual" CACHE STRING "CUDA Compute Capability (e.g. 103-real;103-virtual for NVIDIA B300)")
endif()
if (NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES ${CUDA_COMPUTE_CAPABILITY})
Expand Down Expand Up @@ -71,8 +71,13 @@ target_link_libraries(${PROJECT_NAME} PRIVATE CGBN CuCrypto CuBigInt)
# then the external ones
target_link_libraries(${PROJECT_NAME} PUBLIC gmp cjson ${CUDA_LIBRARIES})

# Add curand for GPU fuzzing RNG
find_library(CURAND_LIBRARY curand HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
if(CURAND_LIBRARY)
target_link_libraries(${PROJECT_NAME} PUBLIC ${CURAND_LIBRARY})
endif()


# Add specific NVCC flags using target_compile_options (if necessary)
target_compile_options(${PROJECT_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-lineinfo --std=c++20 -rdc=true --expt-relaxed-constexpr>)
target_compile_definitions(${PROJECT_NAME} PRIVATE CGBN_TPI=${CGBN_TPI})

Loading
Loading