Skip to main content

soldb_ethdebug/
lib.rs

1//! Loading and interpreting compiler-generated Solidity debug information.
2//!
3//! This is the metadata half of an ETHDebug-first debugger: it turns `solc` artifacts
4//! into the program-counter, source-location, variable, and ABI lookups the rest of the
5//! workspace needs. Nothing here touches the network.
6//!
7//! - [`metadata`] models ETHDebug artifacts: instructions, their source spans, live
8//!   variable locations, and the `address:name:dir` contract specs used on the command
9//!   line.
10//! - [`source_map`] reads the legacy `srcmap` format for compiler and tooling
11//!   interoperability when ETHDebug programs are unavailable.
12//! - [`abi`] encodes calldata and parses function signatures, including tuples and
13//!   arrays, and carries the keccak-256 implementation used to derive selectors.
14//! - [`events`] decodes logs against event ABIs.
15//!
16//! Everything decoded here comes from files or from chain data, so it is untrusted:
17//! offsets and lengths read out of an artifact or a log payload are validated rather
18//! than trusted to be in range.
19
20pub mod abi;
21pub mod events;
22pub mod metadata;
23pub mod source_map;
24
25pub use abi::{
26    canonical_abi_input_type, encode_abi_arguments, encode_function_call, function_selector,
27    keccak256, match_abi_types, match_single_type, parse_signature, parse_tuple_arg, AbiInput,
28    FunctionSignature,
29};
30pub use events::{
31    event_signature, event_topic, parse_event_abis, DecodedEvent, DecodedEventArg, EventAbi,
32    EventParam, EventRegistry, EventRegistryEntry,
33};
34pub use metadata::{
35    parse_ethdebug_spec, parse_multi_contract_spec, parse_single_contract_spec,
36    parse_variable_locations, EthdebugInfo, EthdebugSpec, FunctionExit, FunctionIdentity,
37    Instruction, SourceLocation, VariableLocation,
38};
39pub use source_map::{
40    build_pc_to_instruction_map, is_legacy_compiler, load_source_map_program, parse_srcmap,
41    SourceMapEntry, SourceMapEnvironment, SourceMapInfo, SourceMapProgram,
42};