From 3b7e6ffd0df3981c3aef2bf0ff128a0b8c66b1be Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 21 Sep 2020 16:09:03 -0400 Subject: [PATCH] ethash: lint --- packages/ethash/.eslintrc.js | 3 ++- packages/ethash/src/index.ts | 12 ++++++------ packages/ethash/src/util.ts | 2 +- packages/ethash/test/block.spec.ts | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/ethash/.eslintrc.js b/packages/ethash/.eslintrc.js index 02ebf6c05c..3ae3d8c0dd 100644 --- a/packages/ethash/.eslintrc.js +++ b/packages/ethash/.eslintrc.js @@ -1,3 +1,4 @@ module.exports = { - extends: "@ethereumjs/eslint-config-defaults" + extends: "@ethereumjs/eslint-config-defaults", + ignorePatterns: ['examples'] } diff --git a/packages/ethash/src/index.ts b/packages/ethash/src/index.ts index 1393e8cae7..75b9933398 100644 --- a/packages/ethash/src/index.ts +++ b/packages/ethash/src/index.ts @@ -5,7 +5,7 @@ import { rlphash, zeros, bufferToInt, - TWO_POW256 + TWO_POW256, } from 'ethereumjs-util' import { params, @@ -15,7 +15,7 @@ import { getEpoc, getCacheSize, getFullSize, - getSeed + getSeed, } from './util' import type { LevelUp } from 'levelup' import type { Block, BlockHeader } from '@ethereumjs/block' @@ -32,7 +32,7 @@ export default class Ethash { constructor(cacheDB?: LevelUp) { this.dbOpts = { - valueEncoding: 'json' + valueEncoding: 'json', } this.cacheDB = cacheDB this.cache = [] @@ -93,7 +93,7 @@ export default class Ethash { (fnv(i ^ s.readUInt32LE(0), mix.readUInt32LE((i % w) * 4)) % Math.floor(n / mixhashes)) * mixhashes - let newdata = [] + const newdata = [] for (let j = 0; j < mixhashes; j++) { newdata.push(this.calcDatasetItem(p + j)) } @@ -110,7 +110,7 @@ export default class Ethash { return { mix: cmix, - hash: keccak256(Buffer.concat([s, cmix])) + hash: keccak256(Buffer.concat([s, cmix])), } } @@ -181,7 +181,7 @@ export default class Ethash { cacheSize: this.cacheSize, fullSize: this.fullSize, seed: this.seed, - cache: cache + cache: cache, }, this.dbOpts ) diff --git a/packages/ethash/src/util.ts b/packages/ethash/src/util.ts index 65187da42c..caa6dc0eea 100644 --- a/packages/ethash/src/util.ts +++ b/packages/ethash/src/util.ts @@ -13,7 +13,7 @@ export const params = { DATASET_PARENTS: 256, // number of parents of each dataset element CACHE_ROUNDS: 3, // number of rounds in cache production ACCESSES: 64, - WORD_BYTES: 4 + WORD_BYTES: 4, } export function getCacheSize(epoc: number) { diff --git a/packages/ethash/test/block.spec.ts b/packages/ethash/test/block.spec.ts index f4e75d5b94..98eae4b76b 100644 --- a/packages/ethash/test/block.spec.ts +++ b/packages/ethash/test/block.spec.ts @@ -7,7 +7,7 @@ const cacheDB = level() const { validBlockRlp, - invalidBlockRlp + invalidBlockRlp, } = require('./ethash_block_rlp_tests.json') tape('Verify POW for valid and invalid blocks', async function (t) {