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: shed: Add --below-basefee to mpool clear #10651

Closed
wants to merge 3 commits into from

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented Apr 11, 2023

Related Issues

Proposed Changes

Additional Info

Not tested at all

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@magik6k magik6k requested a review from a team as a code owner April 11, 2023 13:56
@magik6k magik6k force-pushed the feat/mpoolclear-basefee branch from 84c453b to 8e43ffa Compare April 11, 2023 14:00
Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

I'm not sure I understand the core logic here, simple as it is. There's arguably a few different ways we can implement this, and we need to worry about "holes" in our mSets (I think). It looks like you're trying to handle that, but I'm not sure I understand how.

for nonce, msg := range ms.msgs {
if types.BigCmp(msg.Message.GasFeeCap, baseFee) < 0 {
noncesToRemove = append(noncesToRemove, nonce)
if nonce > ms.nextNonce && firstNonceToRemove == math.MaxUint64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand the nonce > ms.nextNonce check. Why do we only set firstNonceToRemove in this case?

Depending on what the intended logic we want for this, we probably just want to find the lowest nonce that has GasFeeCap < baseFee, and then drop all subsequent messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be the much less dumb way to do that, assuming that message sets are sorted we could just truncate.

Copy link
Contributor

Choose a reason for hiding this comment

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

They're not, they're a map.

@@ -1584,6 +1614,11 @@ func (mp *MessagePool) Clear(ctx context.Context, local bool) {

if ok {
for _, m := range mset.msgs {
if types.BigCmp(co.MinBaseFee, big.Zero()) > 0 &&
types.BigCmp(m.Message.GasFeeCap, co.MinBaseFee) < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't delete messages with GasFeeCap < MinBaseFee? Because?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This.. maay be in the wrong order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is we should remove messages below the specified minimum basefee

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes more sense.

@arajasek arajasek mentioned this pull request Apr 21, 2023
21 tasks
@magik6k magik6k force-pushed the feat/mpoolclear-basefee branch from 8e43ffa to 8c10b2a Compare April 24, 2023 21:44
Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

I'm gonna say let's not merge this unless a pressing need emerges? The mpool really should be doing this kinda thinking itself when necessary.

(Closing for now, but feel free to yell)

@arajasek arajasek closed this May 2, 2023
@rjan90 rjan90 deleted the feat/mpoolclear-basefee branch January 31, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants