Skip to main content

Module artifacts

Module artifacts 

Source
Expand description

Finding and loading one contract’s debug artifacts from a directory.

An output directory holds the global resource file (ethdebug.json from older compilers, ethdebug_resources.json from modern ones), one program artifact per contract and environment (<Contract>_ethdebug.json for creation code, <Contract>_ethdebug-runtime.json for runtime code), and, for compilers that predate ETHDebug, a combined.json with legacy source maps. load_debug_program is the one path through all of that: ETHDebug first, the legacy map as a fallback, and the source text read from the compilation record or from disk. The CLI and the DAP server both load through it, so a directory that works in one works in the other.

Structs§

ContractMapping
One entry of a contract mapping file: a deployed address and the directory holding the artifacts that describe its code.
DebugProgram
One contract’s debug information as loaded from its artifacts.

Enums§

CodeGenerator
Which of solc’s code generators produced a program.

Functions§

contract_name_from_program_path
The contract name a program artifact’s file name carries.
ethdebug_resources_from_metadata
The resources record of an ETHDebug metadata file: its resources entry when it has one, otherwise one assembled from the compilation, types, and pointers it carries.
find_ethdebug_metadata
The global ETHDebug resource file in root, under either of its names.
find_program_ethdebug
The ETHDebug program artifact for one contract and environment.
load_contract_mapping
Reads a contract mapping file, {"contracts": [{"address", "name", "debug_dir"}]}, where an entry may also name its code_hash.
load_debug_program
Loads a contract’s debug program from root: the ETHDebug artifacts when present, otherwise the legacy source map in combined.json.
load_debug_program_with_sources
The same, also looking for sources in source_roots.
load_storage_layout
The <Contract>_storage.json that solc --storage-layout -o <root> writes, when it is there. A missing file is not an error: the layout is optional debug information. An unreadable one is, because the user compiled with it and would otherwise get a silent “no storage layout” that looks identical to never having asked for it.
load_transient_storage_layout
<Contract>_transient_storage.json, under the same rules as load_storage_layout.
parse_contract_mapping
The entries of a parsed mapping file. A relative debug_dir is relative to the file.
read_debug_source
Reads a source file named by the compiler, trying it relative to the artifact directory, to that directory’s parent, and as given.
read_json_file
Parses a JSON file, naming the file in the error.
source_candidates
Where a source path recorded in an artifact might be on disk.