Skip to content

Commit

Permalink
vm, block: fix VM StateTest runner, block hardforkByBlockNumber typo …
Browse files Browse the repository at this point in the history
…correction
  • Loading branch information
holgerd77 committed Sep 8, 2020
1 parent 63a3560 commit 93c63eb
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/block/src/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class BlockHeader {
]
defineProperties(this, fields, data)

if (options.hardforkByBlockNumer) {
if (options.hardforkByBlockNumber) {
this._common.setHardforkByBlockNumber(bufferToInt(this.number))
}

Expand Down
2 changes: 1 addition & 1 deletion packages/block/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface BlockOptions {
*
* Default: `false` (HF is set to whatever default HF is set by the Common instance)
*/
hardforkByBlockNumer?: boolean
hardforkByBlockNumber?: boolean
/**
* Turns the block header into the canonical genesis block header
*
Expand Down
4 changes: 2 additions & 2 deletions packages/block/test/difficulty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ tape('[Header]: difficulty tests', (t) => {
uncleHash: test.parentUncles,
},
}
const parentBlock = new Block(parentData, { common, hardforkByBlockNumer: true })
const parentBlock = new Block(parentData, { common, hardforkByBlockNumber: true })

const blockData = {
header: {
Expand All @@ -87,7 +87,7 @@ tape('[Header]: difficulty tests', (t) => {
number: test.currentBlockNumber,
},
}
const block = new Block(blockData, { common, hardforkByBlockNumer: true })
const block = new Block(blockData, { common, hardforkByBlockNumber: true })

runDifficultyTests(
test,
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:buildIntegrity": "npm run test:state -- --test='stackOverflow'",
"test:blockchain": "node -r ts-node/register --stack-size=1500 ./tests/tester --blockchain",
"test:blockchain:allForks": "echo 'Chainstart Homestead dao TangerineWhistle SpuriousDragon Byzantium Constantinople Petersburg Istanbul MuirGlacier' | xargs -n1 | xargs -I v1 node -r ts-node/register --stack-size=1500 ./tests/tester --blockchain --fork=v1",
"test:API": "tape -r ts-node/register --stack-size=1500 ./tests/api/**/*.js",
"test:API": "tape -r ts-node/register --stack-size=1500 './tests/api/**/*.js'",
"test:API:browser": "npm run build && karma start karma.conf.js",
"test": "echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"",
"tslint": "ethereumjs-config-tslint",
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/tests/GeneralStateTestsRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function runTestCase(options, testData, t) {

await setupPreConditions(vm.stateManager._trie, testData)

let tx = makeTx(testData.transaction, options.forkConfigVM)
let tx = makeTx(testData.transaction, { common })
block = makeBlockFromEnv(testData.env)

if (!tx.validate()) {
Expand Down
1 change: 0 additions & 1 deletion packages/vm/tests/api/runBlockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ tape('runBlockchain', (t) => {
})

function createBlock(parent = null, n = 0, opts = {}) {
opts.chain = opts.chain ? opts.chain : 'mainnet'
if (parent === null) {
return createGenesis(opts)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vm/tests/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ var format = (exports.format = function (a, toZero, isHex) {
* @param {[type]} txData the transaction object from tests repo
* @returns {Object} object that will be passed to VM.runTx function
*/
exports.makeTx = function (txData, hf) {
var tx = new Transaction({}, { hardfork: hf })
exports.makeTx = function (txData, options) {
var tx = new Transaction({}, options)
tx.nonce = format(txData.nonce)
tx.gasPrice = format(txData.gasPrice)
tx.gasLimit = format(txData.gasLimit)
Expand Down

1 comment on commit 93c63eb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 93c63eb Previous: 567bd82 Ratio
Block 9422905 1823 ops/sec (±4.05%) 2628 ops/sec (±4.54%) 1.44
Block 9422906 1768 ops/sec (±7.75%) 2698 ops/sec (±1.36%) 1.53
Block 9422907 1848 ops/sec (±1.16%) 2289 ops/sec (±11.51%) 1.24
Block 9422908 1654 ops/sec (±9.57%) 2573 ops/sec (±1.63%) 1.56
Block 9422909 1881 ops/sec (±0.81%) 2510 ops/sec (±1.82%) 1.33
Block 9422910 1830 ops/sec (±1.03%) 2559 ops/sec (±1.69%) 1.40
Block 9422911 1787 ops/sec (±1.01%) 2517 ops/sec (±1.89%) 1.41
Block 9422912 1618 ops/sec (±9.41%) 2494 ops/sec (±1.71%) 1.54
Block 9422913 1311 ops/sec (±12.25%) 2408 ops/sec (±1.85%) 1.84
Block 9422914 1634 ops/sec (±2.10%) 1884 ops/sec (±15.55%) 1.15

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.