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

[FeeHistory] Allow test chains with few blocks #699

Merged
merged 2 commits into from
Mar 7, 2022

Conversation

peak3d
Copy link
Contributor

@peak3d peak3d commented Feb 26, 2022

Allow FeeHistory queries for (test) chains with only few blocks

Description
The (gas)controller requests 20.000 long range results when opening the FeeMarket.
New chains / test chains normally don't have that amount of blocks, and in this case the controller requests feeHistory with a wrong hex value (0x-4756) which pollutes the node logs.

Beside this such a chain can return fewer results than requested, the current code doesn't handle this case correctly when analyzing feeHistory results. This leads to fallback to eth_gas mode.

  • FIXED:

(Gas)Controller does not detect FeeMarket mode for test chains, even the chain supports EIP1559.

Checklist

  • Tests are included if applicable
  • Any added code is fully documented

Note
I tracked the traffic send from Metamask to a node, and I asked myself if it is really required to request 20.000 blocks.
Maybe this value can be exposed, and MM extension can set something lower. I doubt that for a wallet functionallity 20.000 blocks is required. Node owner (Infura) will maybe thank you for reducing.
From node owners POV I would prefer max of 1024 bacause this is the comon cashe size. Requesting more invalidates the cache.

@peak3d peak3d requested a review from a team as a code owner February 26, 2022 18:40
@mcmire
Copy link
Contributor

mcmire commented Mar 2, 2022

Hi @peak3d, thanks for this PR. The changes you're suggesting make sense. Would you be willing to update the corresponding tests?

@peak3d
Copy link
Contributor Author

peak3d commented Mar 3, 2022

Would you be willing to update the corresponding tests?

done

@peak3d peak3d force-pushed the newchain branch 2 times, most recently from 33e489f to 1a34ad3 Compare March 3, 2022 21:26
mcmire
mcmire previously approved these changes Mar 3, 2022
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM!

@mcmire
Copy link
Contributor

mcmire commented Mar 4, 2022

@peak3d Apologies — do you mind rebasing this again? I will make sure to get this in today.

@rekmarks
Copy link
Member

rekmarks commented Mar 4, 2022

@peak3d we'll be cutting a release within the next hour, and it would be great to have your work included. In the future, we recommend allowing edits from maintainers so that we can rebase / update your PRs.

@peak3d
Copy link
Contributor Author

peak3d commented Mar 4, 2022

we'll be cutting a release within the next hour, and it would be great to have your work included. In the future, we recommend allowing edits from maintainers so that we can rebase / update your PRs.

I selected "Update" instead "rebase", hope this is still Ok ?? If not let me know, then I'll have to fix it

Edit: Sorry, forced pushed to get rid of the "merge main" commit - but this eliminates your "stale review status" :-(

@mcmire
Copy link
Contributor

mcmire commented Mar 5, 2022

@peak3d Okay, the other PR is merged, feel free to rebase this!

@mcmire mcmire merged commit eaba91f into MetaMask:main Mar 7, 2022
soralit pushed a commit to KeystoneHQ/controllers that referenced this pull request Mar 14, 2022
The (gas)controller requests 20.000 long range results when opening the FeeMarket.
New chains / test chains normally don't have that amount of blocks, and in this case the controller requests feeHistory with a wrong hex value (0x-4756) which pollutes the node logs.

Beside this such a chain can return fewer results than requested, the current code doesn't handle this case correctly when analyzing feeHistory results. This leads to fallback to eth_gas mode.

FIXED: (Gas)Controller does not detect FeeMarket mode for test chains, even the chain supports EIP1559.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The (gas)controller requests 20.000 long range results when opening the FeeMarket.
New chains / test chains normally don't have that amount of blocks, and in this case the controller requests feeHistory with a wrong hex value (0x-4756) which pollutes the node logs.

Beside this such a chain can return fewer results than requested, the current code doesn't handle this case correctly when analyzing feeHistory results. This leads to fallback to eth_gas mode.

FIXED: (Gas)Controller does not detect FeeMarket mode for test chains, even the chain supports EIP1559.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
The (gas)controller requests 20.000 long range results when opening the FeeMarket.
New chains / test chains normally don't have that amount of blocks, and in this case the controller requests feeHistory with a wrong hex value (0x-4756) which pollutes the node logs.

Beside this such a chain can return fewer results than requested, the current code doesn't handle this case correctly when analyzing feeHistory results. This leads to fallback to eth_gas mode.

FIXED: (Gas)Controller does not detect FeeMarket mode for test chains, even the chain supports EIP1559.
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