Skip to content

Adjust fee currency blacklisting#345

Closed
piersy wants to merge 18 commits intocelo-rebase-12from
piersy/adjust-fee-currency-blacklisting
Closed

Adjust fee currency blacklisting#345
piersy wants to merge 18 commits intocelo-rebase-12from
piersy/adjust-fee-currency-blacklisting

Conversation

@piersy
Copy link

@piersy piersy commented Mar 27, 2025

No description provided.

@ezdac ezdac force-pushed the piersy/adjust-fee-currency-blacklisting branch from 006e714 to 1143d87 Compare March 27, 2025 15:27
@ezdac ezdac force-pushed the piersy/adjust-fee-currency-blacklisting branch from 1b82392 to c20186a Compare March 27, 2025 15:30
headerEvictionTimeoutSeconds uint64
oldestHeader *types.Header

enactFilterEnabled *atomic.Int32
Copy link

Choose a reason for hiding this comment

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

Why not use atomic.Bool?

Copy link

Choose a reason for hiding this comment

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

That's a very good question... somehow I thought it doesn't exist

@piersy piersy marked this pull request as ready for review March 27, 2025 16:45
@ezdac ezdac force-pushed the piersy/adjust-fee-currency-blacklisting branch from b7c39f9 to ed193d8 Compare March 27, 2025 16:47
}

// Clean up old transaction hash from map
oldHash := b.ring[b.index]

Choose a reason for hiding this comment

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

wonder what happens when the ring is not yet full... this returns zero and delete(zero) doesn't break?

Copy link
Author

Choose a reason for hiding this comment

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

It will be the empty hash, and delete the empty hash which will be a no-op.

common.CurrencyAllowlist(env.feeCurrencyContext.ExchangeRates),
header,
)
env.blockingAllowed = miner.feeCurrencyBlocklist.GetEnableFilterStatus()

Choose a reason for hiding this comment

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

is this done for every block?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, env is constructed per block at line 331

Copy link

Choose a reason for hiding this comment

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

Yes, every time a new payload is requested to be built by the engine-api a new environment is created

}
}
if miner.blockedTxRingbuffer.Has(ltx.Hash) {
log.Trace("Skipping tx execution, tx in blockedTxRingbuffer", "hash", ltx.Hash)

Choose a reason for hiding this comment

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

trace? maybe some level we had for skipping a tx due to fee currency lock

Copy link

Choose a reason for hiding this comment

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

This would be logged on every block build attempt, so every 1 second

Copy link
Author

Choose a reason for hiding this comment

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

This is the same level we had for skipping a tx due to the fee currency lock, see line 597

miner/worker.go Outdated
// so that they are not allowlisted in the following blocks
// (only locally in the txpool, not consensus-critical)
miner.feeCurrencyBlocklist.Add(feeCurrency, *env.header)
miner.feeCurrencyBlocklist.Add(*tx.FeeCurrency(), *env.header)

Choose a reason for hiding this comment

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

we're sure that tx.FeeCurrency is never nil here?

Copy link
Author

@piersy piersy Mar 28, 2025

Choose a reason for hiding this comment

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

Previously this function was being called with the de-referenced fee currency here (line 427, github seems to have an issue correctly scrolling to that point) so I'm as sure as we previously were that fee currency is not nil.

eth/api_admin.go Outdated
api.eth.Miner().UnblockTransaction(hash)
}

func (api *AdminAPI) UnblockFeeCurrency(address common.Address) {
Copy link

Choose a reason for hiding this comment

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

Would it be helpful to have getter API for blocked fee currency list or tx list?

Copy link

Choose a reason for hiding this comment

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

Why not. I think the fee-currency is not strictly necessary since we have the "block" and "evict" log messages.
The transactions would be helpful, because this is only logged with trace level.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah I think so. TBH I want to go over this whole blocking feature again and ensure the design is clean. Yesterday we were somewhat in a hurry so didn't have the time to consider all the niceties that you normally would.

Co-authored-by: Seola Oh <osa8361@gmail.com>
@ezdac ezdac force-pushed the piersy/adjust-fee-currency-blacklisting branch 2 times, most recently from 304d0fc to 4e2425a Compare April 3, 2025 12:53
@ezdac
Copy link

ezdac commented Apr 3, 2025

I pulled out the fixes for deactivating the blocklist on l1 derivation / pending building to #363.
This PR is separate (without the changes here), but I have a local copy of the branch that keeps the changes in this branch here into account.

Copy link

@seolaoh seolaoh left a comment

Choose a reason for hiding this comment

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

LGTM, just some nits

return b.enactFilterEnabled.Load()
}

// This only activates / deactivates wether the
Copy link

Choose a reason for hiding this comment

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

Suggested change
// This only activates / deactivates wether the
// SetEnableFilterStatus only activates / deactivates whether the

receipt, err := miner.applyTransaction(env, tx)
if err != nil {
if errors.Is(err, contracts.ErrFeeCurrencyEVMCall) {

Copy link

Choose a reason for hiding this comment

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

Suggested change

@piersy
Copy link
Author

piersy commented Apr 4, 2025

LGTM, just some nits

Hey @seolaoh, thanks we actually decided to split this up, so there will be some smaller PRs arriving soon, first one here - #363

@piersy
Copy link
Author

piersy commented Apr 4, 2025

Closing in favour of 3 more targeted PRs

@piersy piersy closed this Apr 4, 2025
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.

5 participants