Skip to content

Commit

Permalink
chore(provider): document privileged status of EIP-1559 (alloy-rs#850)
Browse files Browse the repository at this point in the history
* document priviledged status of EIP-1559

* fix typo

* hf -> tx type

* doc: update 1559 note

---------

Co-authored-by: James <[email protected]>
  • Loading branch information
2 people authored and ben186 committed Jul 27, 2024
1 parent 0a18336 commit 63194fa
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions crates/provider/src/provider/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,34 @@ pub type FilterPollerBuilder<T, R> = PollerBuilder<T, (U256,), Vec<R>>;
///
/// # Subscriptions
///
/// **IMPORTANT:** this is currently only available when `T` is `PubSubFrontend` or `BoxedClient`
/// over `PubSubFrontend` due to an internal limitation. This means that layering transports will
/// always disable subscription support. See [issue #296](https://github.com/alloy-rs/alloy/issues/296).
/// **IMPORTANT:** this is currently only available when `T` is
/// `PubSubFrontend` or `BoxedClient` over `PubSubFrontend` due to an internal
/// limitation. This means that layering transports will always disable
/// subscription support. See
/// [issue #296](https://github.com/alloy-rs/alloy/issues/296).
///
/// The provider supports `pubsub` subscriptions to new block headers and pending transactions. This
/// is only available on `pubsub` clients, such as WebSockets or IPC.
/// The provider supports `pubsub` subscriptions to new block headers and
/// pending transactions. This is only available on `pubsub` clients, such as
/// Websockets or IPC.
///
/// For a polling alternatives available over HTTP, use the `watch_*` methods. However, be aware
/// that polling increases RPC usage drastically.
/// For a polling alternatives available over HTTP, use the `watch_*` methods.
/// However, be aware that polling increases RPC usage drastically.
///
/// ## Special treatment of EIP-1559
///
/// While many RPC features are encapsulated by traits like [`DebugApi`],
/// EIP-1559 fee estimation is generally assumed to be on by default. We
/// generally assume that EIP-1559 is supported by the client and will
/// proactively use it by default.
///
/// As a result, the provider supports EIP-1559 fee estimation the ethereum
/// [`TransactionBuilder`] will use it by default. We acknowledge that this
/// means EIP-1559 has a privileged status in comparison to other transaction
/// types. Networks that DO NOT support EIP-1559 should create their own
/// [`TransactionBuilder`] and Fillers to change this behavior.
///
/// [`TransactionBuilder`]: alloy_network::TransactionBuilder
/// [`DebugApi`]: crate::ext::DebugApi
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
#[auto_impl::auto_impl(&, &mut, Rc, Arc, Box)]
Expand Down Expand Up @@ -790,8 +809,8 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
)
.await?;

// if the base fee of the Latest block is 0 then we need check if the latest block even has
// a base fee/supports EIP1559
// If the base fee of the Latest block is 0 then we need check if the latest block even has
// a base fee/supports EIP1559.
let base_fee_per_gas = match fee_history.latest_block_base_fee() {
Some(base_fee) if (base_fee != 0) => base_fee,
_ => {
Expand Down

0 comments on commit 63194fa

Please sign in to comment.