SeismicGasFiller
Gas estimation filler with deferred support for seismic transactions
SeismicGasFiller handles gas estimation for both Seismic and standard transactions. For Seismic transactions with a wallet, it defers gas estimation to the fill phase and signs the transaction before calling eth_estimateGas, so the node can authenticate the sender and execute gas estimation against msg.sender-gated private state.
Overview
Gas estimation for shielded transactions presents two challenges:
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
SeismicElementsFillerruns.When the contract's gas cost depends on private state gated by
msg.sender, the node must be able to authenticate the sender during estimation — an anonymouseth_estimateGaswould execute against a zero-address caller and produce an incorrect estimate.
SeismicGasFiller addresses both:
For Seismic transactions with a wallet — Defers gas estimation to the
fill()phase, signs the transaction, and submits the signed envelope toeth_estimateGasover a fresh RPC client using the stored URL.For Seismic transactions without a wallet — Falls back to Alloy's standard unsigned
GasFiller. This is the defaultRecommendedFillerspath for unsigned providers.For standard (non-Seismic) transactions — Always delegates to the inner
GasFillerfor normal prepare-phase estimation.
Additionally, SeismicGasFiller rejects Seismic CREATE transactions (no to address), which are not supported for the Seismic transaction type.
Definition
pub struct SeismicGasFiller<N: SeismicNetwork>
where
N::UnsignedTx: Send + Sync,
{
inner: GasFiller,
rpc_url: Option<reqwest::Url>,
wallet: Option<SeismicWallet<N>>,
}inner
GasFiller
Standard Alloy gas filler for non-seismic and unsigned fallback paths
rpc_url
Option<reqwest::Url>
RPC URL used for signed eth_estimateGas on seismic transactions
wallet
Option<SeismicWallet<N>>
Wallet used to sign the tx before submitting to eth_estimateGas
Constructors
new
Create a SeismicGasFiller with both an RPC URL and a wallet for signed gas estimation.
rpc_url
reqwest::Url
Yes
RPC endpoint for the eth_estimateGas call
wallet
SeismicWallet<N>
Yes
Wallet used to sign the transaction before sending
Returns: A new SeismicGasFiller configured for signed gas estimation on Seismic transactions.
default
Create a SeismicGasFiller with no RPC URL and no wallet. Gas estimation falls back to the standard unsigned GasFiller path.
This is the variant used by the unsigned provider's RecommendedFillers default.
Two-Phase Design
Like all Alloy fillers, SeismicGasFiller implements TxFiller<N> with prepare and fill phases.
Prepare Phase
Seismic tx + wallet present: Returns immediately without estimating gas (deferred to fill phase so the tx can be signed after
SeismicElementsFillerruns)Seismic tx without a wallet or non-Seismic tx: Delegates to the inner
GasFiller, which callseth_estimateGasas normal
Fill Phase
Seismic tx + wallet present: The calldata is now encrypted (by
SeismicElementsFiller). The filler signs the transaction with the wallet and submits the signed envelope toeth_estimateGasvia the storedrpc_url, then fills in the gas limit.Seismic tx without a wallet or non-Seismic tx: 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 is the last filler in the signed provider chain, running after SeismicElementsFiller:
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, signed calldata, which may differ from the plaintext gas cost.
The signed gas-estimation path authenticates
msg.senderto the node, so contracts that gate state onmsg.senderreturn correct estimates.The
GasFillerinner field handles all non-Seismic gas estimation logic and the unsigned Seismic fallback.Seismic CREATE transactions are explicitly rejected with an error.
rpc_urlandwalletare bothOptionto support the default / unsigned paths.
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

