Skip to content

Commit 0f2dffb

Browse files
authored
Update header hash calc in slashing test (#10397)
* Using gasLimit in hash if present to make the slasher test work when gasLimit is added to the header in celo-org/celo-blockchain#2062. This function will change again as part of celo-org/celo-blockchain-planning#100. * Use constant header fields in hash if present Related to celo-org/celo-blockchain#2124 * Update header hashing for eth compat Required to support both old headers and Eth-compatible headers. See celo-org/celo-blockchain-planning#100
1 parent 0ed8544 commit 0f2dffb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/celotool/src/e2e-tests/slashing_tests.ts

+21
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,38 @@ const TMP_PATH = '/tmp/e2e'
1818
const safeMarginBlocks = 4
1919

2020
function headerArray(block: any) {
21+
if (!block.nonce) {
22+
// Before Gingerbread fork
23+
return [
24+
block.parentHash,
25+
block.miner,
26+
block.stateRoot,
27+
block.transactionsRoot,
28+
block.receiptsRoot,
29+
block.logsBloom,
30+
block.number,
31+
block.gasUsed,
32+
block.timestamp,
33+
block.extraData,
34+
]
35+
}
2136
return [
2237
block.parentHash,
38+
block.sha3Uncles,
2339
block.miner,
2440
block.stateRoot,
2541
block.transactionsRoot,
2642
block.receiptsRoot,
2743
block.logsBloom,
44+
new BigNumber(block.difficulty).toNumber(),
2845
block.number,
46+
block.gasLimit,
2947
block.gasUsed,
3048
block.timestamp,
3149
block.extraData,
50+
block.mixHash,
51+
block.nonce,
52+
block.baseFee,
3253
]
3354
}
3455

0 commit comments

Comments
 (0)