diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 8fcb34f2b..000000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -**/build/* -**/node_modules/* diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 168417947..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "./node_modules/@polkadot/dev/config/eslint.js" - ] -} diff --git a/packages/trie-db/src/BaseTrie.ts b/packages/trie-db/src/BaseTrie.ts index adefe4740..1ff3aac8f 100644 --- a/packages/trie-db/src/BaseTrie.ts +++ b/packages/trie-db/src/BaseTrie.ts @@ -9,11 +9,11 @@ import async from 'async'; // @ts-ignore FIXME, we need to properly check the full file import levelup from 'levelup'; import memdown from 'memdown'; -import logger from '@polkadot/util/logger'; +// import logger from '@polkadot/util/logger'; import assert from '@polkadot/util/assert'; import isU8a from '@polkadot/util/is/u8a'; import promisify from '@polkadot/util/promisify'; -import u8aToHex from '@polkadot/util/u8a/toHex'; +// import u8aToHex from '@polkadot/util/u8a/toHex'; import decodeRlp from '@polkadot/util-rlp/decode'; import { EMPTY_ROOT_U8A, EMPTY_ROOT_STR } from './constants'; @@ -27,7 +27,7 @@ import semaphore from './util/semaphore'; type RawPutFn = (key: Uint8Array, value: Uint8Array) => Promise; -const l = logger('trie/base'); +// const l = logger('trie/base'); export default class BaseTrie { // @ts-ignore we are assigning via this.root in constructor @@ -54,7 +54,7 @@ export default class BaseTrie { this.nodeFactory = createFactory(hashing); this.root = root; - l.debug(() => ['Created BaseTrie', typeof db, u8aToHex(root)]); + // l.debug(() => ['Created BaseTrie', typeof db, u8aToHex(root)]); } get root (): Uint8Array { @@ -78,7 +78,7 @@ export default class BaseTrie { * @param {Function} cb A callback `Function` which is given the arguments `err` - for errors that may have occured and `value` - the found value in a `Buffer` or if no value was found `null` */ async get (key: Uint8Array): Promise { - l.debug(() => ['get', 'key ->', u8aToHex(key)]); + // l.debug(() => ['get', 'key ->', u8aToHex(key)]); const result = await this.findPath(key); @@ -99,7 +99,7 @@ export default class BaseTrie { * @returns {Function} Promise */ async put (key: Uint8Array, value: Uint8Array) { - l.debug(() => ['put', 'key ->', u8aToHex(key), 'value ->', u8aToHex(value, 256)]); + // l.debug(() => ['put', 'key ->', u8aToHex(key), 'value ->', u8aToHex(value, 256)]); if (!value || value.toString() === '') { return this.del(key); @@ -124,7 +124,7 @@ export default class BaseTrie { * @param {Function} callback the callback `Function` */ del (key: Uint8Array) { - l.debug(() => ['del', 'key ->', u8aToHex(key)]); + // l.debug(() => ['del', 'key ->', u8aToHex(key)]); return this.semaphore(async () => { const result = await this.findPath(key); @@ -177,7 +177,7 @@ export default class BaseTrie { // @ts-ignore FIXME, we need to properly check the full file value = this.nodeFactory.fromRaw(decodeRlp(value)); } catch (error) { - l.error('_lookupNode decoding', typeof value, value); + // l.error('_lookupNode decoding', typeof value, value); throw error; } } @@ -789,7 +789,7 @@ export default class BaseTrie { // creates a new trie backed by the same db // and starting at the same root copy () { - l.debug(() => ['Copying BaseTrie', typeof this.dbDown, u8aToHex(this.root)]); + // l.debug(() => ['Copying BaseTrie', typeof this.dbDown, u8aToHex(this.root)]); return new BaseTrie(this.dbDown, this.root, this.hashing); } diff --git a/packages/trie-db/src/CheckpointTrie.ts b/packages/trie-db/src/CheckpointTrie.ts index 8bad5ab97..7f45096f0 100644 --- a/packages/trie-db/src/CheckpointTrie.ts +++ b/packages/trie-db/src/CheckpointTrie.ts @@ -11,14 +11,14 @@ import levelws from 'level-ws'; import levelup from 'levelup'; import memdown from 'memdown'; import assert from '@polkadot/util/assert'; -import logger from '@polkadot/util/logger'; -import u8aToHex from '@polkadot/util/u8a/toHex'; +// import logger from '@polkadot/util/logger'; +// import u8aToHex from '@polkadot/util/u8a/toHex'; import BaseTrie from './BaseTrie'; import encoder from './encoder'; import ScratchReadStream from './streams/ScratchRead'; -const l = logger('trie/checkpt'); +// const l = logger('trie/checkpt'); function putRaw (key: Uint8Array, value: Uint8Array) { return Promise.all( @@ -42,7 +42,7 @@ export default class CheckpointTrie extends BaseTrie { this._scratch = null; this._checkpoints = []; - l.debug(() => 'Created CheckpointTrie'); + // l.debug(() => 'Created CheckpointTrie'); } get isCheckpoint () { @@ -50,13 +50,13 @@ export default class CheckpointTrie extends BaseTrie { } copy () { - l.debug(() => ['Copying CheckpointTrie', typeof this.dbDown, u8aToHex(this.root)]); + // l.debug(() => ['Copying CheckpointTrie', typeof this.dbDown, u8aToHex(this.root)]); return new CheckpointTrie(this.dbDown, this.root, this.hashing); } async checkpoint () { - l.debug(() => 'Marking checkpoint'); + // l.debug(() => 'Marking checkpoint'); const wasCheckpoint = this.isCheckpoint; @@ -68,7 +68,7 @@ export default class CheckpointTrie extends BaseTrie { } commit () { - l.debug(() => 'Committing checkpoint'); + // l.debug(() => 'Committing checkpoint'); return this.semaphore(async () => { assert(this.isCheckpoint, 'trying to commit when not checkpointed'); @@ -84,7 +84,7 @@ export default class CheckpointTrie extends BaseTrie { } revert () { - l.debug(() => 'Reverting checkpoint'); + // l.debug(() => 'Reverting checkpoint'); return this.semaphore(async () => { if (!this.isCheckpoint) { @@ -115,7 +115,7 @@ export default class CheckpointTrie extends BaseTrie { } _enterCpMode () { - l.debug(() => 'Entering checkpoint mode'); + // l.debug(() => 'Entering checkpoint mode'); this._scratch = levelup(encoder(memdown())); @@ -128,7 +128,7 @@ export default class CheckpointTrie extends BaseTrie { // @ts-ignore FIXME, we need to properly check the full file _exitCpMode (commitState) { - l.debug(() => 'Exiting checkpoint mode'); + // l.debug(() => 'Exiting checkpoint mode'); const scratch = this._scratch; this._scratch = null; diff --git a/packages/trie-db/src/index.ts b/packages/trie-db/src/index.ts index 173463a34..b2ca5bf01 100644 --- a/packages/trie-db/src/index.ts +++ b/packages/trie-db/src/index.ts @@ -5,13 +5,13 @@ import { HashFn } from './types'; -import logger from '@polkadot/util/logger'; +// import logger from '@polkadot/util/logger'; import keccakAsU8a from '@polkadot/util-crypto/keccak/asU8a'; import CheckpointTrie from './CheckpointTrie'; import { prove, verifyProof } from './proof'; -const l = logger('trie'); +// const l = logger('trie'); export default class Trie extends CheckpointTrie { static prove = prove; @@ -21,6 +21,6 @@ export default class Trie extends CheckpointTrie { constructor (db, root, hashing: HashFn = keccakAsU8a) { super(db, root, hashing); - l.debug('Created Trie'); + // l.debug('Created Trie'); } } diff --git a/packages/trie-db/src/streams/ScratchRead.ts b/packages/trie-db/src/streams/ScratchRead.ts index 4c283802d..419196a37 100644 --- a/packages/trie-db/src/streams/ScratchRead.ts +++ b/packages/trie-db/src/streams/ScratchRead.ts @@ -7,12 +7,12 @@ import { Trie$Base } from '../types'; // @ts-ignore FIXME, we need to properly check the full file import { Readable } from 'readable-stream'; -import logger from '@polkadot/util/logger'; +// import logger from '@polkadot/util/logger'; // import u8aToHex from '@polkadot/util/u8a/toHex'; // import rlpToString from '../util/rlpToString'; -const l = logger('trie/scratch'); +// const l = logger('trie/scratch'); export default class ScratchReadStream extends Readable { trie: Trie$Base; @@ -33,7 +33,7 @@ export default class ScratchReadStream extends Readable { } const onDone = () => { - l.debug(() => 'onDone'); + // l.debug(() => 'onDone'); // @ts-ignore FIXME, we need to properly check the full file this.push(null); }; @@ -50,7 +50,7 @@ export default class ScratchReadStream extends Readable { next(); }; - l.debug(() => 'Starting stream'); + // l.debug(() => 'Starting stream'); this._started = true; this.trie._findDbNodes(onFound, onDone); diff --git a/packages/trie-db/src/streams/TrieRead.ts b/packages/trie-db/src/streams/TrieRead.ts index 9842ea58f..30b010d02 100644 --- a/packages/trie-db/src/streams/TrieRead.ts +++ b/packages/trie-db/src/streams/TrieRead.ts @@ -7,12 +7,12 @@ import { Trie$Base } from '../types'; // @ts-ignore FIXME, we need to properly check the full file import { Readable } from 'readable-stream'; -import logger from '@polkadot/util/logger'; +// import logger from '@polkadot/util/logger'; // import u8aToHex from '@polkadot/util/u8a/toHex'; import { nibblesToU8a } from '../nibbles'; -const l = logger('trie/read'); +// const l = logger('trie/read'); export default class TrieReadStream extends Readable { trie: Trie$Base; @@ -34,7 +34,7 @@ export default class TrieReadStream extends Readable { } const onDone = () => { - l.debug(() => 'onDone'); + // l.debug(() => 'onDone'); // @ts-ignore FIXME, we need to properly check the full file this.push(null); }; @@ -51,7 +51,7 @@ export default class TrieReadStream extends Readable { next(); }; - l.debug(() => 'Starting stream'); + // l.debug(() => 'Starting stream'); this._started = true; this.trie._findValueNodes(onFound, onDone);