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:
parent
e183449072
commit
dac1454a15
|
@ -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:
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue