Skip to content

Commit

Permalink
ethash: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
evertonfraga committed Oct 8, 2020
1 parent 3994df9 commit 3b7e6ff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/ethash/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
extends: "@ethereumjs/eslint-config-defaults"
extends: "@ethereumjs/eslint-config-defaults",
ignorePatterns: ['examples']
}
12 changes: 6 additions & 6 deletions packages/ethash/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
rlphash,
zeros,
bufferToInt,
TWO_POW256
TWO_POW256,
} from 'ethereumjs-util'
import {
params,
Expand All @@ -15,7 +15,7 @@ import {
getEpoc,
getCacheSize,
getFullSize,
getSeed
getSeed,
} from './util'
import type { LevelUp } from 'levelup'
import type { Block, BlockHeader } from '@ethereumjs/block'
Expand All @@ -32,7 +32,7 @@ export default class Ethash {

constructor(cacheDB?: LevelUp) {
this.dbOpts = {
valueEncoding: 'json'
valueEncoding: 'json',
}
this.cacheDB = cacheDB
this.cache = []
Expand Down Expand Up @@ -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))
}
Expand All @@ -110,7 +110,7 @@ export default class Ethash {

return {
mix: cmix,
hash: keccak256(Buffer.concat([s, cmix]))
hash: keccak256(Buffer.concat([s, cmix])),
}
}

Expand Down Expand Up @@ -181,7 +181,7 @@ export default class Ethash {
cacheSize: this.cacheSize,
fullSize: this.fullSize,
seed: this.seed,
cache: cache
cache: cache,
},
this.dbOpts
)
Expand Down
2 changes: 1 addition & 1 deletion packages/ethash/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ethash/test/block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3b7e6ff

Please sign in to comment.