API reference¶
The top-level evm_gasfit package re-exports the small public surface. Everything
else is internal.
evm_gasfit ¶
evm-gasfit: estimate worst-case EVM gas costs from runtime measurements.
GasFit ¶
High-level driver wrapping the pipeline stages.
Attributes:
| Name | Type | Description |
|---|---|---|
config |
Config
|
The validated configuration loaded from YAML. |
runtimes_df |
DataFrame | None
|
The raw runtimes frame loaded from CSV. |
opcounts |
dict[str, dict[str, float]] | None
|
The parsed opcounts mapping loaded from JSON. |
fixtures_df |
DataFrame | None
|
The merged per-fixture frame consumed by every stage. |
estimate_output |
EstimateOutput | None
|
The output of :meth: |
glue_estimate_output |
GlueEstimateOutput | None
|
The output of :meth: |
proposal_output |
ProposalOutput | None
|
The output of :meth: |
Source code in src/evm_gasfit/api.py
from_config
classmethod
¶
Load and validate the YAML config at path and return a fresh driver.
Source code in src/evm_gasfit/api.py
load_runtimes ¶
Load the runtimes CSV at path, restricted to config.clients.
Source code in src/evm_gasfit/api.py
load_opcounts ¶
estimate_models ¶
Fit each ModelSpec and populate :attr:estimate_output.
Source code in src/evm_gasfit/api.py
estimate_glue ¶
Fit the priced glue opcodes and populate :attr:glue_estimate_output.
Source code in src/evm_gasfit/api.py
build_proposal ¶
Aggregate and apply derived params; populate :attr:proposal_output.
Source code in src/evm_gasfit/api.py
write_reports ¶
Write every CSV + markdown artifact (and figs, if plots enabled).
Source code in src/evm_gasfit/api.py
GasCosts
dataclass
¶
GasCosts(values: dict[str, int] = dict(), fork: str = '', source: str = '', _field_names: frozenset[str] = frozenset())
A flat, mutable mapping of fork gas-param field names to integer costs.
The instance is dict-backed so callers can patch individual fields after
construction (used by gas_costs.overrides in the YAML config) without
mutating module-level state. field_names returns the original fork
field set, captured at construction time so later additions (e.g. derived
params) do not pollute the "raw fork fields" universe.
Attributes:
| Name | Type | Description |
|---|---|---|
values |
dict[str, int]
|
The underlying |
fork |
str
|
The fork name this table belongs to, normalized to lowercase. |
source |
str
|
Either |
field_names
property
¶
The raw fork-field names captured at construction time.
load_config ¶
Load and validate the YAML config at path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Filesystem path to the YAML config file. |
required |
Returns:
| Type | Description |
|---|---|
Config
|
The validated |
Raises:
| Type | Description |
|---|---|
ConfigError
|
When the file is missing, the YAML is malformed, or any Pydantic / cross-field validation rule fails. |