Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ABI fuzz tests and dependencies #993

Closed
wants to merge 12 commits into from
Closed

add ABI fuzz tests and dependencies #993

wants to merge 12 commits into from

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Nov 14, 2023

Why this should be merged

Adds ABI package pack vs Ethers (JS library) Pack fuzz tests.

Closes: #769

How this works

  • Adds a testing framework to Pack ABI types and values both with abi package Pack() and Ether's EncodeValue functions.
  • Runs tests for basic types (uint, int, address, bool) and complext types (strings, arrays, bytes)
  • Uses v8go library to run JS Ethers library.
  • Directly compares results from both functions.
  • Adds a yml file for CI to run these Fuzz tests every day (at 00:00)

How this was tested

Adds fuzz tests.

How is this documented

No need.

@ceyonur ceyonur added the testing This primarly focuses on testing label Nov 14, 2023
@ceyonur ceyonur added this to the v0.5.10 milestone Nov 14, 2023
@ceyonur ceyonur self-assigned this Nov 14, 2023
@ceyonur ceyonur changed the title add fuzz tests and dependencies add ABI fuzz tests and dependencies Nov 14, 2023
accounts/abi/unpack_pack_fuzz_test.go Outdated Show resolved Hide resolved
scripts/build_fuzz.sh Outdated Show resolved Hide resolved
scripts/build_fuzz.sh Outdated Show resolved Hide resolved
accounts/abi/unpack_pack_fuzz_test.go Outdated Show resolved Hide resolved
@ceyonur
Copy link
Collaborator Author

ceyonur commented Nov 14, 2023

The PR that actually runs fuzz tests:
#994

marun
marun previously approved these changes Nov 14, 2023
// (c) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build fuzz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a g++/cppgc link problem with v8go package in test runs: https://github.com/ava-labs/subnet-evm/actions/runs/6866130434/job/18671676772?pr=993.

I did not want to change our whole build flags just because of this tests, as these will run every day with fuzz.yml CI flow. So I just ignored this in build in tests and added specific fuzz tag.

@@ -51,6 +51,7 @@ require (
golang.org/x/time v0.1.0
google.golang.org/protobuf v1.31.0
gopkg.in/natefinch/lumberjack.v2 v2.0.0
rogchap.com/v8go v0.9.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I had to add this as a new dependency because goja only supports ES5+ and ethers library is not ES5 compatible. I tried my luck with transpilers + polyfilly but couldn't really get it working with goja.

@ceyonur ceyonur requested a review from marun November 15, 2023 15:51
@ceyonur ceyonur marked this pull request as draft November 23, 2023 18:23
@ceyonur ceyonur removed this from the v0.5.10 milestone Dec 18, 2023
@ceyonur ceyonur closed this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarly focuses on testing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Test Framework / Fuzzing for ABI Package vs. Solidity Packing / Unpacking
2 participants