-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adjust fee currency blacklisting #345
base: celo-rebase-12
Are you sure you want to change the base?
Conversation
006e714
to
1143d87
Compare
1b82392
to
c20186a
Compare
miner/currency_blocklist.go
Outdated
@@ -18,21 +19,41 @@ type AddressBlocklist struct { | |||
// will get evicted when evict() is called | |||
headerEvictionTimeoutSeconds uint64 | |||
oldestHeader *types.Header | |||
|
|||
enactFilterEnabled *atomic.Int32 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
We want to be verbose when the API handler fails, since the blocklist is assumed to not be nil
b7c39f9
to
ed193d8
Compare
} | ||
|
||
// Clean up old transaction hash from map | ||
oldHash := b.ring[b.index] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
miner/worker.go
Outdated
@@ -345,6 +346,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir | |||
common.CurrencyAllowlist(env.feeCurrencyContext.ExchangeRates), | |||
header, | |||
) | |||
env.blockingAllowed = miner.feeCurrencyBlocklist.GetEnableFilterStatus() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
@@ -596,6 +599,12 @@ func (miner *Miner) commitTransactions(env *environment, plainTxs, blobTxs *tran | |||
continue | |||
} | |||
} | |||
if miner.blockedTxRingbuffer.Has(ltx.Hash) { | |||
log.Trace("Skipping tx execution, tx in blockedTxRingbuffer", "hash", ltx.Hash) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
// also add the fee-currency to a worker-wide blocklist, | ||
// 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 <[email protected]>
We want to be able to recognize when the passed in fee-currency does not have an individual multi-gas-pool set, e.g. when setting the remaining gas-allowance to 0 due to a fee-currency block.
No description provided.