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

RPC-based Gas Estimation for Moonbeam-based Networks #6460

Conversation

albertov19
Copy link
Contributor

Motivation

Moonbeam introduced MBIP-5 in which gas estimation deviated from Ethereum. The reasoning is that now storage changes are reflected now on gas estimation. This is to prevent spamming the network with junk data. This is a problem on a lot of cheap-to-transact networks

Solution

Solution was simple, just add Moonbeam-based networks to the has_different_gas_calc function (like with Arbitrum) here

If this function returns true then gas estimation is done using the actual provider URL and eth_estimateGas.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

the outlined solution makes sense, though I think you forgot to include it here :)

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

please restore other formatting issues like trailing ;

Comment on lines 174 to 177
| NamedChain::Moonbeam
| NamedChain::Moonriver
| NamedChain::Moonbase
| NamedChain::MoonbeamDev
Copy link
Member

Choose a reason for hiding this comment

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

ah nvm, I overlooked it hehe

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

looks good, pending mattsse's nit

@albertov19
Copy link
Contributor Author

@mattsse @Evalir thanks! I think it should be good. Everything was added by the cargo fmt command, I just reverted the ;

@albertov19
Copy link
Contributor Author

Ah apologies I did not understand you wanted me to revert the | change as well - This should be ready to go right?

I tested this implementation in a local Foundry Forge instance and it worked btw.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse merged commit 494acc7 into foundry-rs:master Nov 30, 2023
19 checks passed
@albertov19 albertov19 deleted the albertov19/use-rpc-gas-estimation-moonbeam branch November 30, 2023 11:29
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