-
Notifications
You must be signed in to change notification settings - Fork 668
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
Fix: update microblock mining behavior #2981
Conversation
…ccount, other changes
Codecov Report
@@ Coverage Diff @@
## develop #2981 +/- ##
=========================================
Coverage 82.65% 82.66%
=========================================
Files 242 242
Lines 195781 196143 +362
=========================================
+ Hits 161829 162136 +307
- Misses 33952 34007 +55
Continue to review full report at Codecov.
|
Error::BlockTooBigError => { | ||
// done mining -- our execution budget is exceeded. | ||
// Make the block from the transactions we did manage to get | ||
test_debug!("Block budget exceeded on tx {}", &tx.txid()); |
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.
Can this test_debug!
statement be merged with the ones in either if
branch, so that there's just one debug line emitted here? Makes it easier to grep
for this event in test output. Same below.
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.
LGTM! Let's just make sure all the tests pass first. Looks like you might have some uncommitted code or something, because the unit tests are failing with a compile error.
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.
LGTM -- just had some comments on log entries.
While working on #2975, I noticed some unexpected logic in the miner.
Here is a summary of changes in this PR:
mine_next_microblock
to keep track ofblock_limit_hit
. This variable toggles betweenNO_LIMIT_HIT
,CONTRACT_LIMIT_HIT
, andLIMIT_REACHED
. Keeping track of this signals the microblock builder to stop processing transactions once the block limit is hit.mine_next_transaction
(which is used bymine_next_microblock
) to takeblock_limit_hit
as an input. This allows the function to skip over appropriate transactions (for example whenblock_limit_hit=CONTRACT_LIMIT_HIT
, contract call and smart contract payloads will be automatically skipped).build_anchored_block
so that it only gets executed if the transaction being considered was successfully mined. As it was before, these values were sometimes being updated even when the transaction processing failed.considered
set for the microblock mining flow. It was originally inmine_next_transaction
, but I moved the logic out to the calling function because I thought it was (a) more readable, and (b) it now mirrors the logic for the anchored block mining flow.I need feedback on the following change:
block_limit_hit
variable moves onto its next state if a transaction errors with eitherBlockTooBigError
orTransactionTooBigError
. I removed this transition for the latter case, since I felt that it didn't make sense to change the block's limit behavior for an invalid tx that consumes >80% of the block budget that we are anyway dropping from the mempool.Tests:
Ran existing tests.
Added 4 tests: