Skip to content

Commit

Permalink
Inkscope Fuzzer 0.0.1 (#41)
Browse files Browse the repository at this point in the history
* Initial CI (Test+Clippy) (#2)

* initial CI (empty)

* Linted

* feat: Minimal command line parsing with clap (#1)

* feat: Minimal command line parsing with clap

* Move tests to their own module

---------

Co-authored-by: 0xLucca <0xlucca.dev@gmail.com>

* Config wasmi and hostfunctions (#3)

Co-authored-by: Felipe Manzano <felipe.andres.manzano@gmail.com>

* Update CI workflow to include develop branch (#4)

* Update CI workflow to include develop branch

* Make clippy happy

* Add rust fmt config and format files (#6)

* reformatted (#5)

* reformatted

* Remove unused import

---------

Co-authored-by: 0xLucca <0xlucca.dev@gmail.com>

* Testing host fn input (#7)

* Test hf input

* Clippy

* Refactor code (#8)

* Move cli to its own module

* Fix test

* Move input and set_storage

* Move seal0_value_transferred

* Move seal_return

* Add new modules and types

* Create executor

* Delete unused traits

* Refactor project (#9)

* Add drink

* Clean project

* Add rayon for multithreading support (#10)

* Add Rayon

* Use modified drink version

* Load contract from each thread

* Initial attempt to fuzzed generation (#11)

* Planning and testing stuff

* Drinking a sip

* Initial attempt to encoded fuzzed generation

* Main loop

* So close, so far away

* Make it compile

---------

Co-authored-by: 0xLucca <0xlucca.dev@gmail.com>
Co-authored-by: 0xLucca <95830307+0xLucca@users.noreply.github.com>

* Initial cached fuzzing loop (#12)

* Initial cached fuzz loop

* Fix typo (#13)

* Big Refactor

* Adding config and engine:

* Refactor (#21)

* Refactoring the Fuzzer Trace

* Refactor arguments-generator and test

* Extract cli to its own module

* Add scripts for making testing easier

* Fix session handling

* Move scripts to test-contracts

* Make clippy less angry

* Apply cargo fmt

---------

Co-authored-by: 0xLucca <0xlucca.dev@gmail.com>

* Improve run campaign (#22)

* Return failed property traces

* Add print campaign result

* Make reverts rollback and continue

* Update BUG_VALUE constant to 15

* Non needed struct

* Update readme and delete unused tests

* Move max rounds and fail_fast to the config.yaml

* Merge fix moving failfast/max_rounds to config

* No deps in the CI

* Add fail_fast option to config.yaml

* Update drink dependency to specific revision

* Slightly better Output

* Fix the default config yaml

* Fix config default

* Update readme

* REmove some repetition in the readme

* Track Cargo.lock

---------

Co-authored-by: Felipe Manzano <felipe.andres.manzano@gmail.com>

* Create LICENSE (#23)

* Add testing contracts (#25)

* Add comments and fix check_properties fn

* Add tests

* Replace build.sh with build.py

* Add README to Coinfabrik Test Contracts

* Add test

* Apply cargo-fmt and refactor test_contract

* Added Generator unittest (#24)

* Added Generator unittests

* Handle panics (#26)

* Add panic and revert handler, tests and cargo-fmt

* Refactor execute_message and execute_deploy

* Replace impl into to from

* Add comment

* Update CI (#27)

* Update CI

* Add CI workflows

* Add rust-src to workflow

* Make CI happy

* Add more tests (#28)

* Add iterators_over_indexing test

* Add tempfile crate and fix test

* Update CI workflow names

* Add assert_violation test

* Update default accounts in order to not use account 0x0 as caller

*  Add zero_or_test_address test and add account_id generation

* Migrate to ink sandbox (#29)

* WIP: migrate drink to ink_sandbox

* Finish migration

* Apply cargo-fmt

* Fix Cargo.toml dependencies

* Stop tracking Cargo.lock

* Dev/delete locks (#30)

* Deleted cargo locks

* Deleted internal .gitignore

* Adding lock to gitignore

* Simply move path to the new bundle (#32)

* Document the hardcoded hash of an empty trace into a constant (#33)

* Add docker (#34)

* Add Dockerfiles

* Update README.md

* Update config handling

* Remove config.yaml from Dockerfiles

* Update docker run commands in readme

* Addded ALIAS to docker config

---------

Co-authored-by: Felipe Manzano <felipe.andres.manzano@gmail.com>

* Add md book (#35)

* wip: Add mdbook for documentation

* Add ityfuzz example

* Add writing properties section

* Update docker usage

* Create mdbook.yml

Add mdbook CI

* Fix book CI (#36)

* Dev/optimize (#37)

* Remove old commented out code

* Wip - Step function

* Make it compile

* Add docker (#34)

* Add Dockerfiles

* Update README.md

* Update config handling

* Remove config.yaml from Dockerfiles

* Update docker run commands in readme

* Addded ALIAS to docker config

---------

Co-authored-by: Felipe Manzano <felipe.andres.manzano@gmail.com>

* Add md book (#35)

* wip: Add mdbook for documentation

* Add ityfuzz example

* Add writing properties section

* Update docker usage

* Create mdbook.yml

Add mdbook CI

* Fix book CI (#36)

* Remove clone() and add fork()

* Add a configurable initial seed value

* WIP optimize refactor

* execute_last rename refactor

* DeployOrMessage refactor

* CacheEntry refactor and cargo fmt

* WIP, better data structures for the cache and trace management

* Refactor TraceResult

* FailedTrace vec refactor

* Removed unhandled

* WIP: Optimize 1 working example

* WIP: Optimize 1 working example - formatted

* PAssing tests for traces with only a deploy message

* Remove unused fn

* Implement PartialOrd

* Make clippy happy

* better doc

* Better optimization code

* Cargo fmt

* Typo in comment

---------

Co-authored-by: Felipe Manzano <felipe.andres.manzano@gmail.com>

* Console/Text User Interface (#38)

Added an Output api to control the UI from the engine
Added 2 implementations for the UI: TUI(using ratatui) and a simple console

* cargo fmt

* Small readme doc change (#40)

* Added screenshot via web
* Update Readme and mdbook
* Add fuzzer exit
* Linting the clone_from

---------

Co-authored-by: 0xLucca <0xlucca.dev@gmail.com>

---------

Co-authored-by: 0xLucca <0xlucca.dev@gmail.com>
Co-authored-by: 0xLucca <95830307+0xLucca@users.noreply.github.com>
  • Loading branch information
3 people authored May 17, 2024
1 parent 1aa4b97 commit a3483e0
Show file tree
Hide file tree
Showing 66 changed files with 5,663 additions and 491 deletions.
12 changes: 12 additions & 0 deletions .docker/inkscope-fuzzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Build stage
FROM rust:1.76 AS builder
WORKDIR /inkscope-fuzzer
COPY Cargo.toml .
COPY src/ ./src/
RUN cargo build --release

# Final stage
FROM rust:1.76
COPY --from=builder /inkscope-fuzzer/target/release/inkscope-fuzzer /inkscope-fuzzer
WORKDIR /contract
ENTRYPOINT ["/inkscope-fuzzer"]
10 changes: 10 additions & 0 deletions .docker/testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Build stage
FROM rust:1.76
RUN rustup component add rust-src && cargo install --force --locked --version 3.2.0 cargo-contract
WORKDIR /inkscope-fuzzer
COPY Cargo.toml .
COPY src/ ./src/
COPY test-contracts/ ./test-contracts/
RUN cd test-contracts && python3 build.py && cd ..
RUN cargo build
ENTRYPOINT ["cargo", "test"]
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Run Clippy
run: cargo clippy --all-targets --all-features --no-deps
62 changes: 62 additions & 0 deletions .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Sample workflow for building and deploying a mdBook site to GitHub Pages
#
# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
#
name: Deploy mdBook site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["develop"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.36
steps:
- uses: actions/checkout@v4
- name: Install mdBook
run: |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
rustup update
cargo install --version ${MDBOOK_VERSION} mdbook
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with mdBook
run: |
cd book
mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./book/book

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Install cargo-contract
run: rustup component add rust-src && cargo install cargo-contract --version 3.2.0
- name: Build test contracts
run: cd test-contracts && python build.py && cd ..
- name: Run tests
run: cargo test --verbose
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
target
.vscode

# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# MdBook
book/book
60 changes: 60 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
max_width = 90
hard_tabs = false
tab_spaces = 4
newline_style = "Auto"
use_small_heuristics = "Default"
indent_style = "Block"
wrap_comments = true
format_code_in_doc_comments = true
doc_comment_code_block_width = 100
comment_width = 90
normalize_comments = true
normalize_doc_attributes = false
format_strings = false
format_macro_matchers = false
format_macro_bodies = true
empty_item_single_line = true
struct_lit_single_line = true
fn_single_line = false
where_single_line = false
imports_indent = "Block"
imports_layout = "Vertical"
imports_granularity = "Crate"
reorder_imports = true
reorder_modules = true
reorder_impl_items = false
type_punctuation_density = "Wide"
space_before_colon = false
space_after_colon = true
spaces_around_ranges = false
binop_separator = "Front"
remove_nested_parens = true
combine_control_expr = false
overflow_delimited_expr = false
struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = true
fn_params_layout = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = false
trailing_comma = "Vertical"
match_block_trailing_comma = false
blank_lines_upper_bound = 1
blank_lines_lower_bound = 0
edition = "2021" # changed
version = "One"
merge_derives = true
use_try_shorthand = true # changed
use_field_init_shorthand = true # changed
force_explicit_abi = true
condense_wildcard_suffixes = false
color = "Auto"
unstable_features = true # changed
disable_all_formatting = false
skip_children = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
ignore = []
Loading

0 comments on commit a3483e0

Please sign in to comment.