-
Notifications
You must be signed in to change notification settings - Fork 663
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: Mempool Analyzer #3020
feat: Mempool Analyzer #3020
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3020 +/- ##
===========================================
+ Coverage 82.22% 82.34% +0.11%
===========================================
Files 242 243 +1
Lines 195373 195564 +191
===========================================
+ Hits 160642 161031 +389
+ Misses 34731 34533 -198
Continue to review full report at Codecov.
|
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.
Seems to me that this feature can stay in a side branch (as opposed to merging in master)
@@ -601,11 +602,12 @@ impl<'a> StacksMicroblockBuilder<'a> { | |||
/// # Pre-Checks | |||
/// - skip if the `anchor_mode` rules out micro-blocks | |||
/// - skip if 'tx.txid()` is already in `considered` | |||
/// - skip if adding the block would result in a block size bigger than `MAX_EPOCH_SIZE` | |||
/// - skip if adding the block would result in a block size bigger than the block maximum |
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.
s/the block maximum/the maximum size of a block
@@ -268,9 +286,52 @@ impl ClarityBlockConnection<'_> { | |||
} | |||
} | |||
|
|||
// Maximum amount of data a leader can send during its epoch (2MB). | |||
const MAX_EPOCH_SIZE: u32 = 2 * 1024 * 1024; |
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 are you redefining this constant 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.
I moved the definition here and made it private, so that it would be exposed only through the relevant BlockLimitsFn
.
We could keep this in a side branch, but could still consider putting the hooks into |
Not checking this in now. |
Motivation
Towards #3002
New Code
This program can be used to "analyze the mempool". This can be used to compute statistics, especially:
More specifically, this tool can be used to mine an "unlimited block". That is, it will attempt to build a block from the transactions in the mempool, but will never run out of space in the block.
Each transaction in the mempool will be tried once.
Changed Code
To support this change, we introduce
BlockLimitsFunctions
, which allows the user to specify custom block limits. Currently, there is no choice but to take the limits from theStacksEpoch
. Now, users writing custom tools or tests will be able to override these values.Testing
The new memory analyzer tool is just tested by running it. It's not currently in production.
The changes to introduce
BlockLimitsFunctions
are tested by the existing tests.