Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Adding difficulty tests from ethereum/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evertonfraga committed Dec 13, 2019
1 parent 6205815 commit f7f9845
Show file tree
Hide file tree
Showing 4 changed files with 34,070 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/difficulty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ tape('[Header]: difficulty tests', t => {
homestead: require('./difficultyHomestead.json').tests,
byzantium: require('./difficultyByzantium.json').tests,
constantinople: require('./difficultyConstantinople.json').tests,
muirGlacier: Object.assign(
require('./difficultyEIP2384.json').tests,
require('./difficultyEIP2384_random.json').tests,
require('./difficultyEIP2384_random_to20M.json').tests,
),
}
for (const hardfork in hardforkTestData) {
const testData = hardforkTestData[hardfork]
Expand All @@ -44,7 +49,12 @@ tape('[Header]: difficulty tests', t => {
block.header.difficulty = test.currentDifficulty
block.header.number = test.currentBlockNumber

runDifficultyTests(test, parentBlock, block, 'fork determination by hardfork param')
runDifficultyTests(
test,
parentBlock,
block,
`fork determination by hardfork param (${hardfork})`,
)
}
}

Expand All @@ -66,7 +76,12 @@ tape('[Header]: difficulty tests', t => {
block.header.difficulty = test.currentDifficulty
block.header.number = test.currentBlockNumber

runDifficultyTests(test, parentBlock, block, 'fork determination by block number')
runDifficultyTests(
test,
parentBlock,
block,
`fork determination by block number (${test.currentBlockNumber})`,
)
}
}

Expand Down
Loading

0 comments on commit f7f9845

Please sign in to comment.