-
Notifications
You must be signed in to change notification settings - Fork 1.7k
deserialize block only once during verification #9161
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.
LGTM!
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't say I fully understand the implications, but it LGTM.
|
||
let transactions = block.transactions | ||
.into_iter() | ||
.map(|t| { | ||
let t = engine.verify_transaction_unordered(t, &header)?; | ||
if let Some(max_nonce) = nonce_cap { | ||
if t.nonce >= max_nonce { | ||
return Err(BlockError::TooManyTransactions(t.sender()).into()); |
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.
Any reasons why we have return Err(....into())
in some places and bail!(...)
in other ones apart from historical?
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 would say it's for historical reasons and lack of style enforcement (I always forget to use bail!
). At some point we should migrate from error_chain
to failure
and we can do a cleanup to have more consistent error handling.
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 a minor formatting nit.
|
||
let transactions = block.transactions | ||
.into_iter() | ||
.map(|t| { | ||
let t = engine.verify_transaction_unordered(t, &header)?; | ||
if let Some(max_nonce) = nonce_cap { | ||
if t.nonce >= max_nonce { | ||
return Err(BlockError::TooManyTransactions(t.sender()).into()); |
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 would say it's for historical reasons and lack of style enforcement (I always forget to use bail!
). At some point we should migrate from error_chain
to failure
and we can do a cleanup to have more consistent error handling.
})); | ||
} | ||
let expected_uncles = keccak(block_rlp.at(2)?.as_raw()); | ||
if &expected_uncles != block.header.uncles_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.
block.header.uncles_hash(){
that poor {
can't breathe. 😛
* 'master' of https://github.com/paritytech/parity: removed client error (openethereum#9253) Implement EIP-1052 (EXTCODEHASH) and fix several issues in state account cache (openethereum#9234) Improve Tracer documentation (openethereum#9237) Update Dockerfile (openethereum#9242) block cleanup (openethereum#9117) Increase the number of sessions. (openethereum#9203) add changelog for 1.11.8 stable and 2.0.1 beta (openethereum#9230) fix typo (openethereum#9232) Fix potential as_usize overflow when casting from U256 in miner (openethereum#9221) Allow old blocks from peers with lower difficulty (openethereum#9226) Removes duplicate libudev-dev from Dockerfile (openethereum#9220) snap: remove ssl dependencies from snapcraft definition (openethereum#9222) remove ssl from dockerfiles, closes openethereum#8880 (openethereum#9195) Insert PROOF messages for some cases in blockchain (openethereum#9141) [Chain] Add more bootnodes (openethereum#9174) ethcore: update bn version (openethereum#9217) deserialize block only once during verification (openethereum#9161) Simple build instruction fix (openethereum#9215) Added --tx-queue-no-early-reject flag to disable early tx queue rejects (openethereum#9143)
first pull request that tries to limit number of times the block is being deserialized.
before:
now: