Skip to content

Feature Guide

Audience: Researchers seeking to understand the mechanism, significance, and utilization of each Crucible capability.


How to Read This Guide

Each feature is documented with three sections:

Section Answers
Mechanism The feature's purpose and mechanism
Significance The technical problem addressed and its academic relevance
Implementation Operational procedures, commands, and configuration

1. Instrumentation Proxy (Auto-Capture)

Mechanism

An HTTP proxy that sits between your attack code and the Anvil fork. Every transaction flows through it, and it automatically captures gas usage, contract events, storage changes, and balance changes ΓÇö without requiring any manual instrumentation code within the exploit payload.

Your Attack Code → Proxy (random port) → Anvil (port 8545)
                  Γåô
         Captures: gas, events, storage diffs, balance diffs
         → written to JSONL files

Significance

  • Zero instrumentation code ΓÇö no logging, no tracing, no manual capture
  • Universal ΓÇö works with Python, forge script, cast send, or any JSON-RPC client
  • Complete ΓÇö every transaction is captured, ensuring comprehensive coverage without manual specification
  • Standardized ΓÇö all artifacts use the same JSONL format, regardless of attack type

Implementation

The proxy starts automatically when you run an experiment:

# Just run an experiment ΓÇö proxy starts, captures everything
crucible experiment run experiments/nomad_replay.yaml

Your attack plugin uses context.chains.runtime_for("ethereum") to get the RPC URL. The framework silently returns the proxy URL ΓÇö rendering the instrumentation process completely transparent to the plugin.

To use the proxy standalone (without an experiment):

# Terminal 1: Start Anvil
anvil --fork-url https://eth.llamarpc.com --fork-block-number 15259100

# Terminal 2: Start the instrumentation proxy
crucible instrument --upstream http://127.0.0.1:8545 --chain ethereum --output-dir ./logs/my_run

# Terminal 3: Send transactions through the proxy
cast send --rpc-url http://127.0.0.1:<proxy-port> 0xTarget --value 1ether

To check if instrumentation is working:

crucible verify logs/demo_experiment/DS-2026-00001

What Gets Captured

Artifact Captured From Stream File
Gas used eth_getTransactionReceipt → gasUsed gas_profile.jsonl
Contract events Receipt → logs[] → decode topic[0] events.jsonl
Storage diffs debug_traceTransaction with prestateTracer diffMode storage_diffs.jsonl
Balance changes Trace pre/post account balances balance_diffs.jsonl

Troubleshooting

If debug_traceTransaction fails (known Anvil nightly-build issue), the proxy still captures gas + events from the receipt. Storage diffs and balance changes are lost, and a warning is logged. Upgrade to a stable Foundry release to fix this.


2. Determinism by Default

Mechanism

Every experiment runs with deterministic flags that ensure the same input produces the same output every time. These flags are set by default ΓÇö explicit opt-out is required.

# Default determinism config (applied automatically)
determinism:
  gas_price: 0               # Fixed gas price ΓÇö no gas auction variance
  block_base_fee: 1000000000 # Fixed base fee
  timestamp: fork_block      # Pinned to the fork block's timestamp
  auto_mine: true            # Transactions mined instantly
  order: fifo                # FIFO order ΓÇö no mempool reordering

Significance

Blockchain forks are inherently non-deterministic: - Different RPC providers return different historical state - Transactions can be ordered differently in the mempool - Gas prices fluctuate - Block timestamps vary

Without determinism, it is impossible to rigorously prove reproduction correctness, as outcomes may diverge across runs. Determinism enables:

  • Verifiable reproductions ΓÇö independent execution of the experiment yields identical results
  • Diff comparisons ΓÇö crucible diff can detect meaningful differences
  • Publication ΓÇö reviewers can independently verify the results

Implementation

No manual intervention is required. Determinism is enabled by default. Just run your experiment:

crucible experiment run experiments/nomad_replay.yaml

To verify determinism, run twice and compare:

crucible experiment run experiments/nomad_replay.yaml --name run-a
crucible experiment run experiments/nomad_replay.yaml --name run-b
crucible diff run-a run-b

Expected output:

{
  "storage_equal": true,
  "events_equal": true,
  "gas_equal": true,
  "balances_equal": true
}

To opt out (if non-deterministic behavior is required for specific research methodologies):

# testbed.local.yaml
chains:
  ethereum:
    determinism:
      gas_price: null        # Use real gas pricing
      order: ""              # Default Anvil ordering
      auto_mine: false       # Wait for block production

3. Fidelity Enforcement (L0ΓÇôL4)

Mechanism

A runtime verification system that checks whether your experiment's behavior matches its declared reproducibility level. Each level has specific requirements:

Level Name Requirements
L0 Narrative Description only ΓÇö no on-chain reproduction
L1 Conceptual Plugin returns a result
L2 Fork-State Chains + contracts verified, trace artifacts exist
L3 Exact Replay Exploit transactions declared and replayed
L4 Multi-Chain 2+ chains, bridge plugin, excluded_components declared

Significance

  • Prevents overclaiming ΓÇö it prevents claiming L3 fidelity without demonstrating an exact exploit transaction replay
  • Builds trust ΓÇö reviewers can verify the declared level programmatically
  • Self-documents ΓÇö every experiment manifest contains the fidelity check result

Implementation

Declare your fidelity level in evidence.yaml:

reproduction_scope:
  fidelity_level: L2

Fidelity runs automatically after every experiment. Check the result:

# After running an experiment
cat logs/my_experiment/DS-2026-00001/run_manifest.json | python3 -m json.tool

# Look for the fidelity_check field:
# {
#   "fidelity_check": {
#     "passed": true,
#     "declared_level": "L2",
#     "failures": [],
#     "warnings": []
#   }
# }

To disable fidelity (e.g., for L4 bridge demos that don't meet formal requirements):

crucible experiment run experiments/my_experiment.yaml --no-fidelity

Blockers

Fidelity Failure Likely Cause Fix
no artifact streams found Attack didn't interact with chain Verify the plugin successfully dispatches transactions
chains declared not in topology evidence.yaml lists a chain not in your topology Update evidence.yaml or topology
no exploit transactions declared L3 requires exploit_transactions in evidence.yaml Add transaction hashes
no bridge plugin L4 requires a bridge in the topology Use a bridge topology

4. Blank Fork Mode

Mechanism

Starting Anvil without --fork-url ΓÇö as a standalone local EVM with zero external dependencies. No archive RPC needed, no historical state, instant startup.

# testbed.local.yaml
chains:
  ethereum:
    fork_block: null   # ← Triggers blank fork mode
    rpc_url: "${ETH_RPC_URL}"  # Still required by schema (unused)

Significance

  • Works offline ΓÇö no internet, no RPC provider needed
  • Instant startup ΓÇö <1 second vs 30sΓÇô5 minutes for archive forks
  • Fully deterministic ΓÇö no archive state variability
  • Perfect for development ΓÇö iterate on attack packs without waiting for forks
  • Great for L4 bridge demos ΓÇö deploy contracts on blank chains, test cross-chain messaging

Implementation

# config/testbed.local.yaml
chains:
  ethereum:
    rpc_url: "${ETH_RPC_URL}"
    fork_block: null
    chain_id: 1
    port: 8545

Then fork and run normally:

crucible clean --all
crucible fork --topology single
crucible experiment run experiments/my_experiment.yaml --no-baseline

Note: The instrumentation proxy works identically in blank fork mode. Same artifacts, same format, same integrity hashing.

Limitations

Available Capabilities Unsupported Capabilities
Instant startup, offline capable, deterministic Historical chain state (no pre-deployed contracts)
10 pre-funded Anvil accounts Real token balances or DeFi protocols
Full instrumentation + artifact capture eth_getCode for real contracts (they don't exist)
Deterministic diff verification L2 fidelity verification (requires archive fork)

5. Publication Gates

Mechanism

A set of 7 research-quality checks that must pass before an experiment can be exported for publication. They enforce:

Gate What It Checks
Evidence evidence.yaml has all required sections
Fidelity Fidelity-level-specific requirements met
Baseline Golden baseline exists and verifies
Foundry Foundry version pinned
Git Provenance Workspace has a known git commit
Artifacts Complete All expected trace artifacts captured
Provenance All provenance fields present

Significance

  • Quality assurance ΓÇö catches incomplete or non-reproducible experiments before publication
  • Reviewer trust ΓÇö gates create an auditable chain of checks
  • Self-documenting ΓÇö validation failures definitively highlight missing prerequisites

Implementation

# Run with publication mode gates
crucible experiment run experiments/nomad_replay.yaml --publication-mode

If publication mode is enabled in config:

# testbed.yaml
publication:
  enabled: true
  require_foundry_pinned: true
  require_baseline_verified: true
  require_provenance_complete: true
  fidelity_enforcement: true

Check gate results in the experiment output. Each gate passes or fails with a clear message.


6. Cache Fingerprinting

Mechanism

The fork cache stores Anvil's downloaded state so subsequent forks at the same block are instant. The CacheManager fingerprints each cache entry with:

Fingerprint Field What It Tracks
Provider identity Which RPC provider was used (ankr, llamarpc, etc.)
Fork block Which block was forked
Chain ID Which chain
Foundry version Which Foundry version created the cache
Config hash Which testbed config was active

Significance

  • Cold cache ΓÇö no data cached ΓåÆ slow fork (30sΓÇô5min)
  • Warm cache ΓÇö data cached from a previous run ΓåÆ instant fork (<5s)
  • Stale cache ΓÇö cache exists but was created by a different provider/version ΓåÆ invalidated in strict mode

Cache poisoning (using wrong data from a different provider) was responsible for countless irreproducible results in other testbeds. Cache fingerprinting eliminates this.

Implementation

# Inspect cache
crucible cache inspect

# Result shows every cached chain/block with provider, version, and size:
# ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
# Γöé Chain    Γöé Fork Block Γöé Provider Γöé Size   Γöé Mode     Γöé
# Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
# Γöé ethereum Γöé 15259100   Γöé llamarpc Γöé 2.1 GB Γöé warm     Γöé
# Γöé bsc      Γöé 22166659   Γöé ankr     Γöé 1.8 GB Γöé warm     Γöé
# ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ

# Clear cache
crucible cache clean

# Compute cache fingerprint (for inclusion in run manifests)
crucible cache fingerprint

Cache Policies

Policy Behavior
permissive (default) Warns on mismatch but does not invalidate ΓÇö best for development
strict Invalidates cache on any mismatch ΓÇö best for publication runs

Set in testbed.yaml:

fork_cache:
  cache_policy: strict

7. 3-Tier Reset System

Mechanism

Three ways to reset chain state, each with a different speed/fidelity tradeoff:

Tier Method Speed When to Use
Soft anvil_loadState snapshot restore <5s Same-chain, same-block iteration
Medium Kill + relaunch + restore <30s After Anvil process corruption
Hard Re-fork from archive RPC <5min After topology change, cache corruption

Significance

  • Soft ΓÇö fastest, perfect for iterating on attack parameters
  • Medium ΓÇö recovers from process issues without re-fetching state
  • Hard ΓÇö nuclear option that guarantees clean state

Implementation

# Three-tier reset: soft (<5s) → medium (<30s) → hard (<5min)
crucible reset --scenario single --mode soft
crucible reset --scenario single --mode medium
crucible reset --scenario single --mode hard
crucible hard-reset --scenario single          # alias for --mode hard

8. Agent Privilege Levels

Mechanism

LLM-driven agents have configurable privilege levels that gate which tools they can access:

Level Access Tools Available
LOW Read-only queries chain_id, get_balance, get_code, get_storage, call_contract, get_logs
MEDIUM Impersonate + transact (default) Above + impersonate, send_transaction
HIGH Full access Above + advance_time

Significance

  • Safety ΓÇö prevents autonomous agents from accidentally causing damage
  • Progressive disclosure ΓÇö start at LOW, increase as you gain confidence
  • Auditability ΓÇö every agent action is logged with its privilege level

Implementation

# experiments/my_agent.yaml
run:
  agent_provider: openai
  agent_privilege: medium
  agent_allowed_accounts:
    - "0xattacker..."

9. Cross-Chain Messaging

Mechanism

The bridge plugin system simulates cross-chain message passing. When a bridge plugin is deployed, messages sent on one chain can be relayed to another.

Significance

  • L4 reproductions ΓÇö reproduce multi-chain exploits that span Ethereum, BSC, and Polygon
  • Bridge protocol validation ΓÇö test how bridge contracts handle forged messages
  • Cross-chain artifact tracking ΓÇö cross_chain.jsonl correlates messages across chains

Implementation

Use a bridge topology:

# experiments/my_experiment.yaml
name: my_experiment
scenario: my_scenario
attack: my_attack
topology: nomad_bridge    # Uses nomad_bridge topology

Configure the topology:

# topologies/nomad_bridge.yaml
name: nomad_bridge
chains: [ethereum, polygon]
bridge: nomad_bridge

From an attack plugin:

bridge = context.bridge_plugin
result = bridge.send_message(
    context=context,
    source_chain="ethereum",
    dest_chain="polygon",
    data="0xforged_calldata",
    correlation_id="msg-001",
)

10. Export Bundle

Mechanism

A self-contained directory with all experiment artifacts, integrity manifests, and reproduction instructions. Suitable for publication, archiving, or sharing with reviewers.

Bundle Structure

datasets/DS-2026-00042/
Γö£ΓöÇΓöÇ run_manifest.json           # Provenance + outcome
Γö£ΓöÇΓöÇ log_integrity.json          # SHA-256 hashes of all streams
Γö£ΓöÇΓöÇ artifact_bundle_manifest.json  # SHA-256 of every file
Γö£ΓöÇΓöÇ report.md                   # Human-readable summary
Γö£ΓöÇΓöÇ REPRODUCE.md                # Step-by-step reproduction guide
Γö£ΓöÇΓöÇ run.jsonl                   # Lifecycle events
Γö£ΓöÇΓöÇ chain_ethereum/             # Per-chain artifacts
Γöé   Γö£ΓöÇΓöÇ events.jsonl
Γöé   Γö£ΓöÇΓöÇ gas_profile.jsonl
Γöé   Γö£ΓöÇΓöÇ storage_diffs.jsonl
Γöé   ΓööΓöÇΓöÇ balance_diffs.jsonl
ΓööΓöÇΓöÇ chain_bsc/
    ΓööΓöÇΓöÇ ...

Significance

  • Self-verifying ΓÇö SHA-256 hashes detect tampering
  • Self-contained ΓÇö everything needed to verify the reproduction
  • Portable ΓÇö can be uploaded to Zenodo, sent to reviewers, or archived

Implementation

# Export a run
crucible export DS-2026-00042

# Verify the bundle
crucible verify datasets/DS-2026-00042

# Publish (mark as permanent)
crucible publish DS-2026-00042

See Also

Doc What It Covers
Technical Overview System architecture and core concepts
Design Decisions Why each feature was built this way
Plugin Development Guide Using features from plugin code
User Guide Getting started and daily usage
Troubleshooting Common blockers and fixes