Fixes for misbehavior reporting in AuthorityRound#8998
Conversation
df3b40b to
dccc9e7
Compare
| let set_number = if self.immediate_transitions { | ||
| header.number() | ||
| } else { | ||
| self.epoch_set(header)?.1 |
There was a problem hiding this comment.
Is it guaranteed that parent block is already imported when we are doing block_basic verification? If not then zooming to the epoch set will most likely fail. Would be good to have a test case for this one.
There was a problem hiding this comment.
Didn't think of this, so it's possible that verify_block_basic is done in parallel and therefore the parent might not be imported yet? This verification must be done in phase 1 since we want TemporarilyInvalid errors to be emitted at this phase (otherwise it won't recover the sync process).
There was a problem hiding this comment.
Yes, I believe we do that when the block is imported to the queue:
https://github.com/paritytech/parity/blob/7d7d4822a5087b24b49f2a1ddb111f2daa51a017/ethcore/src/verification/verification.rs#L62
And it seems that both Phase 1 and Phase 2 operate on individual blocks, where there is no guarantee that parent block is already imported. We can only check that in Phase 3 (hence original todo comment was saying that bening reporting should be moved further in the verification.
| let active_set; | ||
| let validators = if self.immediate_transitions { | ||
| &*self.validators | ||
| let (validators, set_number) = if self.immediate_transitions { |
There was a problem hiding this comment.
This pattern seems to repeat couple of times, might be worth to extract it to a function?
There was a problem hiding this comment.
I've refactored part of it into the epoch_set function. Unfortunately it's not easy to get the whole pattern into a function since both branches are returning different types (&ValidatorSet vs SimpleList). It could work by returning Box<ValidatorSet> from the function but I can't clone self.validators.
|
Test |
|
Could you give me an ETA? |
|
I think this is good to review:
|
tomusdrw
left a comment
There was a problem hiding this comment.
LGTM, a comment on why a failure of reporting is allowed would be good for the future.
| Err(BlockError::InvalidSeal) => { | ||
| let set_number = self.epoch_set(header)?.1; | ||
| self.validators.report_benign(header.author(), set_number, header.number()); | ||
| if let Ok((_, set_number)) = self.epoch_set(header) { |
There was a problem hiding this comment.
Maybe add a comment why it may fail and why it's ok?
|
Needs a second review, anyone? |
* aura: only report after checking for repeated skipped primaries * aura: refactor duplicate code for getting epoch validator set * aura: verify_external: report on validator set contract instance * aura: use correct validator set epoch number when reporting * aura: use epoch set when verifying blocks * aura: report skipped primaries when generating seal * aura: handle immediate transitions * aura: don't report skipped steps from genesis to first block * aura: fix reporting test * aura: refactor duplicate code to handle immediate_transitions * aura: let reporting fail on verify_block_basic * aura: add comment about possible failure of reporting
* aura: only report after checking for repeated skipped primaries * aura: refactor duplicate code for getting epoch validator set * aura: verify_external: report on validator set contract instance * aura: use correct validator set epoch number when reporting * aura: use epoch set when verifying blocks * aura: report skipped primaries when generating seal * aura: handle immediate transitions * aura: don't report skipped steps from genesis to first block * aura: fix reporting test * aura: refactor duplicate code to handle immediate_transitions * aura: let reporting fail on verify_block_basic * aura: add comment about possible failure of reporting
* parity-version: bump stable to 1.10.9 * scripts: remove md5 checksums (#8884) * Add support for --chain tobalaba (#8870) * Add support for --chain tobalaba * Only return error log for rustls (#9025) * Fixes for misbehavior reporting in AuthorityRound (#8998) * aura: only report after checking for repeated skipped primaries * aura: refactor duplicate code for getting epoch validator set * aura: verify_external: report on validator set contract instance * aura: use correct validator set epoch number when reporting * aura: use epoch set when verifying blocks * aura: report skipped primaries when generating seal * aura: handle immediate transitions * aura: don't report skipped steps from genesis to first block * aura: fix reporting test * aura: refactor duplicate code to handle immediate_transitions * aura: let reporting fail on verify_block_basic * aura: add comment about possible failure of reporting
* parity-version: bump beta to 1.11.6 * scripts: remove md5 checksums (#8884) * Add support for --chain tobalaba * Convert indents to tabs :) * Fixes for misbehavior reporting in AuthorityRound (#8998) * aura: only report after checking for repeated skipped primaries * aura: refactor duplicate code for getting epoch validator set * aura: verify_external: report on validator set contract instance * aura: use correct validator set epoch number when reporting * aura: use epoch set when verifying blocks * aura: report skipped primaries when generating seal * aura: handle immediate transitions * aura: don't report skipped steps from genesis to first block * aura: fix reporting test * aura: refactor duplicate code to handle immediate_transitions * aura: let reporting fail on verify_block_basic * aura: add comment about possible failure of reporting * Only return error log for rustls (#9025) * Transaction Pool improvements (#8470) * Don't use ethereum_types in transaction pool. * Hide internal insertion_id. * Fix tests. * Review grumbles. * Improve should_replace on NonceAndGasPrice (#8980) * Additional tests for NonceAndGasPrice::should_replace. * Fix should_replace in the distinct sender case. * Use natural priority ordering to simplify should_replace. * Minimal effective gas price in the queue (#8934) * Minimal effective gas price. * Fix naming, add test * Fix minimal entry score and add test. * Fix worst_transaction. * Remove effective gas price threshold. * Don't leak gas_price decisions out of Scoring. * Never drop local transactions from different senders. (#9002) * Recently rejected cache for transaction queue (#9005) * Store recently rejected transactions. * Don't cache AlreadyImported rejections. * Make the size of transaction verification queue dependent on pool size. * Add a test for recently rejected. * Fix logging for recently rejected. * Make rejection cache smaller. * obsolete test removed * obsolete test removed * Construct cache with_capacity. * Optimize pending transactions filter (#9026) * rpc: return unordered transactions in pending transactions filter * ethcore: use LruCache for nonce cache Only clear the nonce cache when a block is retracted * Revert "ethcore: use LruCache for nonce cache" This reverts commit b382c19. * Use only cached nonces when computing pending hashes. * Give filters their own locks, so that they don't block one another. * Fix pending transaction count if not sealing. * Clear cache only when block is enacted. * Fix RPC tests. * Address review comments. * A last bunch of txqueue performance optimizations (#9024) * Clear cache only when block is enacted. * Add tracing for cull. * Cull split. * Cull after creating pending block. * Add constant, remove sync::read tracing. * Reset debug. * Remove excessive tracing. * Use struct for NonceCache. * Fix build * Remove warnings. * Fix build again. * miner: add missing macro use for trace_time * ci: remove md5 merge leftovers
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: Fixes for misbehavior reporting in AuthorityRound (openethereum#8998) A last bunch of txqueue performance optimizations (openethereum#9024) reduce number of constraints for triedb types (openethereum#9043) bump fs-swap to 0.2.3 so it is compatible with osx 10.11 again (openethereum#9050) Recursive test (openethereum#9042) Introduce more optional features in ethcore (openethereum#9020) Update ETSC bootnodes (openethereum#9038) Optimize pending transactions filter (openethereum#9026) eip160/eip161 spec: u64 -> BlockNumber (openethereum#9044)
self.validators)