Skip to main content

Module showmap

Module showmap 

Source
Expand description

AFL-afl-showmap-style corpus replay.

Replays a persisted corpus through a fresh executor and emits one text file per trial (or per corpus entry). Each line has the form <id>:<count>:

  • EVM IDs use the deterministic (bytecode_hash, pc) derived from the line-coverage HitMap so that IDs are stable across forge invocations and meaningful for cross-approach analysis. Format: evm_<bytecode_hash[:16]>_<pc:04x>.
  • Sancov IDs use the deterministic guard index from the sancov bitmap: sancov_0x<index:04x>.

Counts are raw saturating-summed hitcounts across the replayed corpus.

Output is consumable by tools like riesentoaster/differential-coverage.

Re-exportsยง

use crate::executors::Executor; ๐Ÿ”’
use crate::executors::corpus::DynamicTargetCtx; ๐Ÿ”’
use crate::executors::corpus::StatelessReplayTarget; ๐Ÿ”’
use crate::executors::corpus::WorkerCorpus; ๐Ÿ”’
use crate::executors::corpus::register_replay_created; ๐Ÿ”’
use crate::executors::corpus::rollback_replay_created; ๐Ÿ”’
use crate::executors::corpus_io::read_corpus_tree; ๐Ÿ”’
use crate::executors::invariant::call_after_invariant_function; ๐Ÿ”’
use crate::executors::invariant::call_invariant_function; ๐Ÿ”’
use crate::executors::invariant::did_fail_on_assert; ๐Ÿ”’
use crate::executors::invariant::execute_tx; ๐Ÿ”’
use crate::executors::invariant::snapshot_edge_fingerprint; ๐Ÿ”’
use crate::executors::should_ignore_revert; ๐Ÿ”’
use crate::inspectors::EdgeIndexMap; ๐Ÿ”’
use alloy_dyn_abi::JsonAbiExt; ๐Ÿ”’
use alloy_json_abi::Function; ๐Ÿ”’
use alloy_primitives::Address; ๐Ÿ”’
use alloy_primitives::B256; ๐Ÿ”’
use alloy_primitives::Selector; ๐Ÿ”’
use alloy_primitives::hex; ๐Ÿ”’
use alloy_primitives::hex; ๐Ÿ”’
use alloy_primitives::keccak256; ๐Ÿ”’
use alloy_primitives::map::HashMap; ๐Ÿ”’
use eyre::Result; ๐Ÿ”’
use foundry_config::FuzzCorpusConfig; ๐Ÿ”’
use foundry_evm_core::constants::MAGIC_ASSUME; ๐Ÿ”’
use foundry_evm_core::evm::FoundryEvmNetwork; ๐Ÿ”’
use foundry_evm_coverage::HitMaps; ๐Ÿ”’
use foundry_evm_fuzz::BasicTxDetails; ๐Ÿ”’
use foundry_evm_fuzz::invariant::FuzzRunIdentifiedContracts; ๐Ÿ”’
use std::borrow::Cow; ๐Ÿ”’
use std::cmp::Ordering; ๐Ÿ”’
use std::collections::BTreeSet; ๐Ÿ”’
use std::fmt; ๐Ÿ”’
use std::fs::File; ๐Ÿ”’
use std::io::BufWriter; ๐Ÿ”’
use std::io::Write; ๐Ÿ”’
use std::path::Path; ๐Ÿ”’
use std::path::PathBuf; ๐Ÿ”’

Structsยง

InvariantReplayOptions
Invariant replay settings that affect when terminal checks run.
MinimizationReplayInput
ReplayObservation
Facts observed while replaying one candidate for corpus minimization.
ShowmapOpts
Per-replay options.
ShowmapReplayTarget
Test target metadata needed to replay corpus entries.
ShowmapStats
Stats returned from a single trial replay.

Enumsยง

ReplayFailure
A structured identity for a failure observed during corpus replay.
ShowmapDomain
Which coverage bitmap(s) to dump.

Constantsยง

MAX_REPORTED_REPLAY_FAILURES ๐Ÿ”’

Functionsยง

accumulate_evm ๐Ÿ”’
Saturating-add per-(bytecode, pc) hits from a HitMaps snapshot into dst.
accumulate_sancov ๐Ÿ”’
Saturating-add src (u8 raw counts) into dst (u64 aggregated counts).
all_invariants_failed ๐Ÿ”’
broken_after_invariant ๐Ÿ”’
first_broken_invariant ๐Ÿ”’
fuzz_replay_call_succeeded ๐Ÿ”’
has_replay_invariant_failure ๐Ÿ”’
invariant_handlers_succeeded ๐Ÿ”’
Whether the just-executed handler call passed the campaignโ€™s success gate.
invariant_replay_failures ๐Ÿ”’
Returns replay failures produced directly by a handler call, mirroring the campaign: assertions are keyed by handler site, while a non-assertion revert breaks every invariant configured with fail_on_revert.
newly_broken_invariants ๐Ÿ”’
replay_corpus_to_showmap
Replay every corpus entry under corpus_dir and emit showmap files.
replay_failure_rank ๐Ÿ”’
replay_failure_report ๐Ÿ”’
replay_sequence_for_minimization
Replays one candidate input and returns coverage/failure facts for minimizers.
should_check_invariant ๐Ÿ”’
Whether the invariant predicate should be evaluated after the accepted-th committed (non-vm.assume) call.
write_evm ๐Ÿ”’
Each EVM ID is evm_<bytecode_hash[:16hex]>_<pc:04x>. The 16-hex prefix (64 bits) of the keccak256 bytecode hash makes IDs deterministic across processes while keeping line lengths short.
write_sancov ๐Ÿ”’
write_showmap_file ๐Ÿ”’
Write a single showmap file. Returns 1 if a file was written, 0 if skipped (no nonzero entries).

Type Aliasesยง

EvmShowmap ๐Ÿ”’