Skip to content

Commit

Permalink
consensus-sim: importing blocks individually instead of concatenating…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
jangko committed Jun 27, 2023
1 parent e183449 commit dac1454
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion hive_integration/nodocker/consensus/consensus_sim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ proc processChainData(cd: ChainData): TestStatus =
)

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 blockHash = "0x" & head.blockHash.data.toHex
if blockHash == cd.lastBlockHash:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import
../../../nimbus/common/chain_config

type
Blob = seq[byte]

ChainData* = object
params*: NetworkParams
lastBlockHash*: string
blocksRlp*: seq[byte]
blocksRlp*: seq[Blob]

const genFields = [
"nonce",
Expand Down

0 comments on commit dac1454

Please sign in to comment.