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: add scroll to gas price oracle #687

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Conversation

dohaki
Copy link
Contributor

@dohaki dohaki commented Jul 18, 2024

According to the last paragraph in https://docs.scroll.io/en/developers/transaction-fees-on-scroll/#l1-originated-transactions, we can use the legacy RPC call eth_gasPrice to determine the gas price on Scroll:

If your system supports off-chain mechanisms, you can also call eth_estimateGas and eth_gasPrice on any Scroll RPC node to get an estimate of the gas required for a given transaction.

Closes ACX-2356

Copy link

linear bot commented Jul 18, 2024

Copy link
Contributor

@pxrl pxrl left a comment

Choose a reason for hiding this comment

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

How does this perform in test btw? Does it produce a gas price that kinda-resembles the onchain price advertised by Scrollscan?

According to the last paragraph in https://docs.scroll.io/en/developers/transaction-fees-on-scroll/#l1-originated-transactions, we can use the legacy RPC call eth_gasPrice to determine the gas price on Scroll:

If your system supports off-chain mechanisms, you can also call eth_estimateGas and eth_gasPrice on any Scroll RPC node to get an estimate of the gas required for a given transaction.

That's in the L1 Originated Transactions section, which I think is messaging from mainnet -> Scroll, so I'm, not sure whether it applies to our use case 🤔

In any case, it's probably sensible to just see how legacy pricing performs; if it's reasonably accurate (or over-estimates, but with an insignificant difference) then I think it's probably fine to proceed with that. If we need to go into more detail we can implement a Scroll-specific adapter that queries their gas oracle contracts.

@dohaki
Copy link
Contributor Author

dohaki commented Jul 18, 2024

How does this perform in test btw? Does it produce a gas price that kinda-resembles the onchain price advertised by Scrollscan?
That's in the L1 Originated Transactions section, which I think is messaging from mainnet -> Scroll, so I'm, not sure whether it applies to our use case 🤔
In any case, it's probably sensible to just see how legacy pricing performs; if it's reasonably accurate (or over-estimates, but with an insignificant difference) then I think it's probably fine to proceed with that. If we need to go into more detail we can implement a Scroll-specific adapter that queries their gas oracle contracts.

Ah damn, yea you are right... It is less than the gas price displayed on Scrollscan. So yea I will re-work this PR and implement the adapter
EDIT: It looks like we should be able just to use eth_getGasPrice

@dohaki dohaki merged commit 1efd544 into master Jul 18, 2024
4 checks passed
@dohaki dohaki deleted the add-scroll-gas-price-oracle branch July 18, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants