-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
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'm a bit unsure about this. I feel that this options should be respected by InstantSeal
engine as they are respected by every other engine.
It's trivial to set both of those options in CLI to 0
if someone really wants the blocks to be created as fast as possible. In any other case the block should be created at most every reseal_min_period
ms if there are transactions in the pool. And I would consider InstantSeal
to produce empty blocks every reseal_max_period
(if configured).
If this is a fix to some issues we have with InstantSeal
, I don't think it's the right direction. It would be better to re-architecture the way engines and miners interact and new block production is triggered (perhaps using Future
s, like in substrate
) to clean this up.
I completely agree with this. |
So as per the issue reported in #11173 (repeatable) something changed in v2.5.8+ – have you found out what the change was that "broke" this? I know you had a hypothesis that this code was involved but I do not understand the connection between that and the code snippets in the description above. Can you elaborate on that? Is it like this: the fix in #10995 is good but uncovered this quirk where our default config values do not work with Either way, we need a fix here of some sort, code or docs, so we don't have to spend days digging through code to help users. Do we need better defaults in the |
this call to for so And now the next time a transaction is sent, it won't trigger a block sealing because Hopefully this makes sense. |
I worry about having to specify params to an engine to do what its name says it does.
With the way the code is structured, the |
Thanks for the explanations @seunlanlege. Your hypothesis makes a lot of sense and I see the purpose of this PR better now. However I'd be more inclined to just introduce a thread to Why I don't like this approach I feel it's cleaner and safer than overriding |
@seunlanlege Good point. (And thank you for the great description, it sort of makes a little bit more sense now, maybe, much appreciated.) @tomusdrw Regarding the "stepper thread" approach: what if |
No, not at all. |
Hmm. I am still confused, apologies. In Clique the stepper thread ends up calling |
@dvdplm Yes, but block sealing is also triggered in other situation (like transaction import). If we call Actually |
…lock, some line formatting
5c7027c
to
078de7e
Compare
@tomusdrw could you take a look at this? |
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 don't feel that's the way to go. We need something engine-specific not modify miner
to force wasteful block production on every engine.
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
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.
Looks good, but we can get away without this additional check to the transactions pool.
needs one more approval cc @niklasad1 @ordian |
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.
Looks good, just one question.
@@ -1305,13 +1308,14 @@ impl miner::MinerService for Miner { | |||
if self.seal_and_import_block_internally(chain, block) { | |||
trace!(target: "miner", "update_sealing: imported internally sealed block"); | |||
} | |||
return |
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 return doesn't change anything, right?
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 it doesn't
@@ -1451,8 +1454,9 @@ impl miner::MinerService for Miner { | |||
service_transaction_checker.as_ref(), | |||
); | |||
queue.cull(client); | |||
if is_internal_import { |
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.
was this previously true only for instant seal engine? otherwise, should it be something like
if engine.should_reseal_on_update() {
// force update_sealing here to skip `reseal_required` checks
chain.update_sealing(ForceUpdateSealing::Yes);
} else if is_internal_import {
chain.update_sealing(ForceUpdateSealing::No);
}
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 it was only for InstantSeal
.
* Make InstantSeal Instant again * update_sealing if there are transactions in pool after impoerting a block, some line formatting * Apply suggestions from code review Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * InstantSeal specific behaviour * introduce engine.should_reseal_on_update, remove InstantSealService * remove unused code * add force param to update_sealing * better docc * even better docs * revert code changes, doc corrections, sort dep * code optimization * fix test * fix bench
* Make InstantSeal Instant again * update_sealing if there are transactions in pool after impoerting a block, some line formatting * Apply suggestions from code review Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * InstantSeal specific behaviour * introduce engine.should_reseal_on_update, remove InstantSealService * remove unused code * add force param to update_sealing * better docc * even better docs * revert code changes, doc corrections, sort dep * code optimization * fix test * fix bench
* [CI] check evmbin build (#11096) * Correct EIP-712 encoding (#11092) * [client]: Fix for incorrectly dropped consensus messages (#11082) (#11086) * Update hardcoded headers (foundation, classic, kovan, xdai, ewc, ...) (#11053) * Add cargo-remote dir to .gitignore (?) * Update light client headers: ropsten 6631425 foundation 8798209 (#11201) * Update list of bootnodes for xDai chain (#11236) * ethcore/res: add mordor testnet configuration (#11200) * [chain specs]: activate Istanbul on mainnet (#11228) * [builtin]: support multiple prices and activations in chain spec (#11039) * [receipt]: add sender & receiver to RichReceipts (#11179) * [ethcore/builtin]: do not panic in blake2pricer on short input (#11180) * Made ecrecover implementation trait public (#11188) * Fix docker centos build (#11226) * Update MIX bootnodes. (#11203) * Insert explicit warning into the panic hook (#11225) * Use provided usd-per-eth value if an endpoint is specified (#11209) * Cleanup stratum a bit (#11161) * Add Constantinople EIPs to the dev (instant_seal) config (#10809) (already backported) * util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175) * ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172) * Type annotation for next_key() matching of json filter options (#11192) * Upgrade jsonrpc to latest (#11206) * [dependencies]: jsonrpc 14.0.1 (#11183) * Upgrade to jsonrpc v14 (#11151) * Switching sccache from local to Redis (#10971) * Snapshot restoration overhaul (#11219) * Add new line after writing block to hex file. (#10984) * Pause pruning while snapshotting (#11178) * Change how RPCs eth_call and eth_estimateGas handle "Pending" (#11127) * Fix block detail updating (#11015) * Make InstantSeal Instant again #11186 * Filter out some bad ropsten warp snapshots (#11247)
this call to
update_sealing
callsrequires_reseal
https://github.com/paritytech/parity-ethereum/blob/6960d35abb9f11c27b47226e402ec617bfe585f1/ethcore/src/miner/miner.rs#L1266-L1276
and
requires_reseal
does a few checks and updatesSealingWork.next_allowed_reseal
https://github.com/paritytech/parity-ethereum/blob/6960d35abb9f11c27b47226e402ec617bfe585f1/ethcore/src/miner/miner.rs#L637-L663
for
InstantSeal
sealing_state()
is alwaysSealingState::Ready
https://github.com/paritytech/parity-ethereum/blob/6960d35abb9f11c27b47226e402ec617bfe585f1/ethcore/engines/instant-seal/src/lib.rs#L75
so
should_disable_sealing
would befalse
forInstantSeal
and sonext_allowed_reseal
is updated based onreseal_min_period
Now
update_sealing
callsMiner.seal_and_import_block_internally
which in turn callsImportSealedBlock::import_sealed_block
which in turn callsMiner.chain_new_blocks
.Miner.chain_new_blocks
resetsnext_allowed_reseal
toInstant::now()
if a block was successfully imported.https://github.com/paritytech/parity-ethereum/blob/6993ec95312f3ee446345ecb2591f0c66a9b4fcb/ethcore/src/miner/miner.rs#L1415-L1420
Previously
update_sealing
was called immediately after an internal import with the hopes of sealing a new block with local transactions (#9660) but it did so without the knowledge of the transaction_queue. And so if there were no transactions to seal,next_allowed_reseal
is updated, butchain_new_blocks
is never called to reset it back toInstant::now()
And now the next time a transaction is sent, it won't trigger a block sealing because
reseal_allowed()
returnsfalse
https://github.com/paritytech/parity-ethereum/blob/6960d35abb9f11c27b47226e402ec617bfe585f1/ethcore/src/miner/miner.rs#L1009-L1011
https://github.com/paritytech/parity-ethereum/blob/6960d35abb9f11c27b47226e402ec617bfe585f1/ethcore/src/miner/miner.rs#L233-L238
This PR adds a new method to the
Engine
traitshould_reseal_on_update
and checks if there are local pending transactions before callingupdate_sealing
after a block import.should_reseal_on_update
tells the miner that the engine is interested in sealing a new block if there are local pending transactions.closes #11173