SeismicGasFiller
Gas estimation filler with deferred support for seismic transactions
SeismicGasFiller handles gas estimation for both Seismic and standard transactions. For Seismic transactions, it defers gas estimation to the fill phase so that estimation happens on the encrypted calldata rather than the plaintext.
Overview
Gas estimation for shielded transactions presents a unique challenge: the node needs to estimate gas on the encrypted calldata (because that is what will actually be executed), but the calldata is not encrypted until SeismicElementsFiller runs. SeismicGasFiller solves this by:
For Seismic transactions -- Deferring gas estimation to the
fill()phase, which runs afterSeismicElementsFillerhas encrypted the calldataFor standard transactions -- Delegating to Alloy's built-in
GasFiller, which estimates gas in the normal prepare phase
Additionally, SeismicGasFiller validates that Seismic transactions are not contract creation (CREATE) transactions, which are not supported for the Seismic transaction type.
Definition
pub struct SeismicGasFiller {
inner: GasFiller,
rpc_url: Option<reqwest::Url>,
}inner
GasFiller
Standard Alloy gas filler for non-seismic transactions
rpc_url
Option<reqwest::Url>
RPC URL used for deferred gas estimation on seismic transactions
Constructor
with_url
with_urlCreate a SeismicGasFiller with an RPC URL for deferred gas estimation.
rpc_url
reqwest::Url
Yes
RPC endpoint for gas estimation calls
Returns: A new SeismicGasFiller configured for deferred estimation.
The RPC URL is needed because deferred gas estimation happens during the fill() phase, which makes a separate RPC call to eth_estimateGas with the encrypted calldata. This is typically the same URL used by the provider.
Two-Phase Design
Like all Alloy fillers, SeismicGasFiller implements TxFiller<N> with prepare and fill phases.
Prepare Phase
For Seismic transactions: Returns immediately without estimating gas (deferred to fill phase)
For standard transactions: Delegates to the inner
GasFiller, which callseth_estimateGasas normal
Fill Phase
For Seismic transactions: Now that the calldata is encrypted (by
SeismicElementsFiller), makes aneth_estimateGascall usingrpc_urland fills in the gas limitFor standard transactions: Delegates to the inner
GasFillerto apply the prepared gas estimate
Validation
SeismicGasFiller enforces that Seismic transactions cannot be CREATE transactions (i.e., transactions without a to address that deploy new contracts). If a Seismic transaction request has no to field, the filler returns an error.
This restriction exists because the Seismic transaction type (0x4A) is designed for calling existing contracts with encrypted calldata, not for deploying new contracts.
Usage
Default (Automatic)
In most cases, SeismicGasFiller is configured automatically by the provider:
Manual Construction
If building a custom provider stack:
Pipeline Position
SeismicGasFiller must come after SeismicElementsFiller in the filler chain:
If SeismicGasFiller ran before SeismicElementsFiller, it would estimate gas on the plaintext calldata, which would produce an incorrect gas estimate.
Notes
For Seismic transactions, gas estimation happens on the encrypted calldata, which may differ slightly from the plaintext gas cost
The
GasFillerinner field handles all non-Seismic gas estimation logicSeismic CREATE transactions are explicitly rejected with an error
The
rpc_urlfield isOptionto support cases where deferred estimation is not needed (e.g., when gas is pre-specified)
See Also
Fillers Overview - How fillers compose in the pipeline
SeismicElementsFiller - Encryption filler (runs before this one)
SeismicSignedProvider - Provider that uses this filler
SeismicNetwork Trait - Network trait methods used for type checking
Last updated

