Skip to content

Fuzz Protocol V1 - Refinement Testing #241

@mkchungs

Description

@mkchungs

Refinement Testing

ASN0 Binaries:

ASN1 Binaries:

Fuzz Protocol V0 -> V1

Both duna_fuzzer_asn0 and duna_fuzzer_asn1 support Refinement Testing with the following RefineBundle and Message implemented:

RefineBundle ::= SEQUENCE {
    core-index          CoreIndex,
    bundle              WorkPackageBundle,
    segment-root-mappings  SegmentRootLookup,
    auth-gas-used       Gas,
    auth-trace          ByteSequence
}

Message ::= CHOICE {
    peer-info     [0] PeerInfo,
    import-block  [1] ImportBlock,
    set-state     [2] SetState,
    get-state     [3] GetState,
    state         [4] State,
    state-root    [5] StateRoot,
    refine-bundle [6] RefineBundle
}

Additional message types to be implemented:

Message ::= CHOICE {
    work-report   [7] WorkReport,
    get-exports   [8] GetExports,
    exports       [9] Exports
}

Message Types and Expected Responses

Request Response Purpose
RefineBundle WorkReport Compute work report for a work package bundle

PeerInfo Formats

ASN0 Binary - Uses the existing (pre-)ASN0 PeerInfo format -- which is fully compatible with davxy's current testing framework:

SEQUENCE {name, app-version, fuzz-version}

PeerInfo ::= SEQUENCE {
    -- Application name
    name           UTF8String,
    -- Application version
    app-version    Version,
    -- JAM protocol version
    jam-version    Version
}

ASN1 Binary - Uses the proposed ASN1 PeerInfo format:

SEQUENCE {fuzz-version, app-version, jam-version, features, name}

PeerInfo ::= SEQUENCE {
    -- Fuzzer protocol version
    fuzz-version   U8,
    -- Application version
    app-version    Version,
    -- JAM protocol version
    jam-version    Version,
    -- Supported features
    features       Features,
    -- Application name
    name           UTF8String
}

Quick Start Guide

Running Refinement Testing

Open two terminals: one for the target, one for the fuzzer.

Terminal 1 — Target with Socket

./duna_target_asn1_mac --help
Usage: duna_target [OPTIONS]

Options:
  --pvm-logging   Logging level (none, debug, trace) (default:none)
  --socket        Path for the Unix domain socket (default:/tmp/jam_target.sock)
  -v, --version   Display version information (default:false)

Run the Target:

./duna_target_asn1_mac --socket /tmp/jam_target.sock

Terminal 2 — Fuzzer in Refined Mode

./duna_fuzzer_asn1_mac --help
Usage: importblocks [OPTIONS]

Options:
  --dir                Storage directory (default:/tmp/importBlock)
  --disable-shuffling  Disable shuffling; sort blocks by slot number (default:false)
  --invalidrate        Percentage of invalid blocks (default:0)
  --numblocks          Number of blocks to generate (default:100)
  --pvm-backend        PVM backend to use (Compiler or Interpreter) (default:interpreter)
  --report-dir         Report directory (default:./reports)
  --seed               Seed for random number generation (hex) (default:0x44554E41)
  --socket             Unix domain socket path (default:/tmp/jam_target.sock)
  --statistics         Print statistics interval (default:100)
  --test-dir           Storage directory (default:./rawdata)
  --use-unix-socket    Enable Unix domain socket for communication (default:true)
  --verbose            Enable detailed logging (default:false)
  -n, --network        JAM network size (default:tiny)
  -r, --refine         Enable RefineBundle testing (exclusive with block testing) (default:false)
  -v, --version        Display version information (default:false)

Run the Fuzzer:

./duna_fuzzer_asn1_mac --refine --socket /tmp/jam_target.sock --verbose

Sample Output

Target :

Image

Fuzzer:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions