Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(layers): GasEstimationLayer #326

Merged
merged 17 commits into from
Mar 21, 2024

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Mar 15, 2024

Motivation

Ref: #323

Solution

Implement a layer that populates the gas_price, gas, max_fee_per_gas and max_priority_fee_per_gas.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya changed the title feat(layers): gas estimator boilerplate feat(layers): gas estimator Mar 15, 2024
@yash-atreya yash-atreya marked this pull request as ready for review March 15, 2024 19:55
crates/provider/src/layers/gas.rs Outdated Show resolved Hide resolved
@yash-atreya yash-atreya changed the title feat(layers): gas estimator feat(layers): FillTxLayer Mar 18, 2024
@yash-atreya yash-atreya marked this pull request as draft March 18, 2024 18:12
@yash-atreya
Copy link
Member Author

Decided to make this a more generic tx builder layer. Ref: #326 (comment)

Renaming it to FillTxLayer.
This layer will manage nonces and estimates the gas.

@yash-atreya yash-atreya changed the title feat(layers): FillTxLayer feat(layers): GasEstimationLayer Mar 18, 2024
@yash-atreya yash-atreya marked this pull request as ready for review March 18, 2024 19:57
@yash-atreya
Copy link
Member Author

Decided to make this a more generic tx builder layer. Ref: #326 (comment)

Renaming it to FillTxLayer. This layer will manage nonces and estimates the gas.

Undo above.

crates/provider/src/layers/gas.rs Outdated Show resolved Hide resolved
@onbjerg onbjerg added the enhancement New feature or request label Mar 19, 2024
@yash-atreya yash-atreya marked this pull request as draft March 20, 2024 16:12
@yash-atreya yash-atreya marked this pull request as ready for review March 20, 2024 19:13
@yash-atreya
Copy link
Member Author

Didn't see this getting merged #352

Fixing

crates/provider/src/layers/gas.rs Outdated Show resolved Hide resolved
crates/provider/src/layers/gas.rs Outdated Show resolved Hide resolved
}
Err(err) => {
if err.is_transport_error()
&& err.to_string() == *"EIP-1559 not activated".to_string()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love this to a helper method on the error re 1559 but we can do as followup

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this is a bit of a hole in the API. 1559 not activated should not be a transport error. "endpoint doesn't exist" falls in a hole between transport error and rpc error 🤔

@gakonst gakonst merged commit cf28edd into alloy-rs:main Mar 21, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants