Skip to content

Add fuzz tests implementation - #68

Closed
ikripaka wants to merge 26 commits into
devfrom
feat/fuzz
Closed

ikripaka wants to merge 26 commits into
devfrom
feat/fuzz

Conversation

@ikripaka

Copy link
Copy Markdown
Collaborator
  • This PR suggests a bug fix and I've added the necessary tests.
  • This PR introduces a new feature and I've discussed the update in an Issue or with the team.
  • This PR is just a minor change like a typo fix.

aritkulova and others added 12 commits September 11, 2026 15:45
* added mul_div functions with tests

* added zero checks for div_128 and div_256 to be consistent with jet's `divide`

* added tests for new helper functions

* typo in a test name

* utilized convert and split functions

* added mul_div docs;
moved arithmetic section for u128 and u256 to be consistent with other sections

* linting

* added docs for new functions

* fixed typo

* fixed bug in normalize_to_threshold funcs

* added more tests to cover new u512 division functionality

* bumped simplex version

* optimization for calculate_normalizer_base_128

* typo fixes

* a couple of new tests for calculate_normalizer_base_128
* fix: pin specific Simplex version for tests.yml

* refactor: change simf tests structure

* fmt: apply format and add chech into tests.yml file

* fmt: apply simfmt to all files

* refactor: dedup some of simf/tests functions

* refactor: rust part and organize everything by modules

* refactor(rename): tests/stdlib functions

* refactor: better organization for stdlib tests

* refactor: separate lint from tests in workflows

* refactor: separate crate::lib from crate::tests
* refactored div functions to panic if the divisor is zero;
removed safe_div_128 and safe_div_256 because they duplicate `div` functionality

* refactored mul_div functions to panic if the divisor is zero

* updated docs

* fixed test in common::uint;

added -v workaround to ci;

fixed typos

* fixed comments for checked_div
* removed `safe_` prefixes from div functions

* removed `_safe` prefixes;
`add` became `add_carry`;
`sub` - `sub_borrow`;
`mul` - `mul_wide`.
* added functions for retrieving the AssetId and Amount

* renamed asset_id_amount directory to utxo

* updated tests to have different amounts for input and output of the same index

* optimised getters

* restructured doc comment;
renamed get_current to get_explicit and get_confidential for consistency

* test refactoring:
added negative tests;
added witness for parity bit;
utxo order in a tx is now deterministic;
small cleanups

* refactoring and typo fixes

* test refactoring:
added `send_issued` and `create_utxos_with_new_asset` to send some other asset_id;
added randomization for amounts;
added function to check for pass and failure cases on same utxo.

* refactored doc comments

* excess doc commets
* added functions for asserting the AssetId and Amount

* updated changelog

* increased timeout-minutes for github ci
* added backticks for types in docs, removed backsticks in source comments

* fixed miswording about overflow in math source comments

* added info about panic to getters source comments

* updated readme and changelog
* fix: non-canonical field-element encodings

* fix: gej_point_eq aborts instead of returning false for an invalid compressed point

* fix: Jacobian point equality accepts off-curve witness  points

* feat: optimize get_point_eq function
* added getters for script hash

* added script tweaking for tests

* updated changelog

* removed get_current_script_hash;
minor refactoring;
fixed typos

* fixed typo in version counter
* bumped version;
updated readme

* organized changelog;
bumped `SIMPLEX_VERSION` in CI

* expanded changelog description;
fixed typo
@ikripaka

Copy link
Copy Markdown
Collaborator Author

Successfully ran fuzz tests on commit 4c37c1d with an updated mul_div_256 contract.

Testing was performed with 10_000 fuzz test cases for each test.
No failing test cases were found.

────────────
     Summary [92744.801s] 413 tests run: 413 passed (413 slow), 522 skipped
Exit Status: 0

run_fuzz_tests: finished with exit status 0

The script for running fuzz tests is the following:

#!/usr/bin/env bash
set -eo pipefail

main() {
  need_cmd simplex
  need_cmd tee

  local filter="${*:-all}"
  filter=${filter//[^[:alnum:]_.-]/_}
  filter=${filter:0:120}

  local log_file
  log_file="$(date +%Y-%m-%d_%H-%M-%S)_${filter}_$$.log"
  local status=0

  say "saving output to $log_file"

  # Include stderr: the test runner writes its progress and summary there.
  simplex test --fuzz "$@" --test-threads 10 --no-fail-fast -- --release --show-progress counter 2>&1 | tee "$log_file" || status=$?

  say "finished with exit status $status" | tee -a "$log_file"
  return "$status"
}

say() {
  printf 'run_fuzz_tests: %s\n' "$1"
}

err() {
  say "$*" >&2
  exit 1
}

need_cmd() {
  command -v "$1" > /dev/null 2>&1 || err "need '$1' (command not found)"
}

main "$@"

!/usr/bin/env bash

aritkulova and others added 10 commits October 28, 2026 16:37
* optimization: mul_div_256 function

* fix: review comments and and new coverage test for div_step_320_256 func
* Repo cleanup

* Fix CHANGELOG.md file
* add `macos-latest` runner in `tests.yml`

* edit `simplex test` command to run in parallel by default

* in github actions debug mode it would set verbose flag and run only in 1 thread

* add waiting for a receipt
* add local patch to pass the tests
@ikripaka ikripaka changed the title Add fuzz tests implmentation Add fuzz tests implementation Nov 4, 2026
@ikripaka
ikripaka changed the base branch from dev to feat/bump November 4, 2026 11:43
sort deps only in edited files in this order
* super
* std
* simplicityhl
* simplex
* other deps
* crate
* other deps
* artifacts
Base automatically changed from feat/bump to dev November 5, 2026 10:58
@ikripaka

ikripaka commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Closing because it was partitioned into separate ones.
#80
#82
#84
#87
#86
#88
#89

@ikripaka ikripaka closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants