consensus-sim: importing blocks individually instead of concatenating them.

This is a workaround following hive example, because one of the test case
withdrawalsAmountBounds.json, have bad blocks between good blocks.
And that bad blocks contains big int too big to fit in uint64 of
withdrawal amount field.

Clients who still importing concatenated blocks cannot pass all tests.
This commit is contained in:
jangko 2023-06-27 07:30:05 +07:00
parent e183449072
commit dac1454a15
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 10 additions and 2 deletions

View File

@ -26,7 +26,13 @@ proc processChainData(cd: ChainData): TestStatus =
) )
com.initializeEmptyDb() com.initializeEmptyDb()
discard importRlpBlock(cd.blocksRlp, com, "consensus_sim")
for bytes in cd.blocksRlp:
# ignore return value here
# because good blocks maybe interleaved with
# bad blocks
discard importRlpBlock(bytes, com, "consensus_sim")
let head = com.db.getCanonicalHead() let head = com.db.getCanonicalHead()
let blockHash = "0x" & head.blockHash.data.toHex let blockHash = "0x" & head.blockHash.data.toHex
if blockHash == cd.lastBlockHash: if blockHash == cd.lastBlockHash:

View File

@ -15,10 +15,12 @@ import
../../../nimbus/common/chain_config ../../../nimbus/common/chain_config
type type
Blob = seq[byte]
ChainData* = object ChainData* = object
params*: NetworkParams params*: NetworkParams
lastBlockHash*: string lastBlockHash*: string
blocksRlp*: seq[byte] blocksRlp*: seq[Blob]
const genFields = [ const genFields = [
"nonce", "nonce",