Fix lint erros

This commit is contained in:
Rodrigo Q. Saramago 2022-07-15 10:33:37 +02:00
parent 8ce9847652
commit f9d7765305
No known key found for this signature in database
GPG Key ID: 9B36B2525704A359
2 changed files with 8 additions and 8 deletions

View File

@ -141,7 +141,7 @@ export class BaseTree {
* @returns {number[]} the new list of indices * @returns {number[]} the new list of indices
*/ */
static nextLayerMultiPathIndices(indices: number[]): number[] { static nextLayerMultiPathIndices(indices: number[]): number[] {
let nextIndices: Set<number> = new Set() const nextIndices: Set<number> = new Set()
for (let i = 0; i < indices.length; i++) { for (let i = 0; i < indices.length; i++) {
nextIndices.add(indices[i] >> 1) nextIndices.add(indices[i] >> 1)
} }
@ -158,10 +158,10 @@ export class BaseTree {
let layerIndices = indices let layerIndices = indices
for (let level = 0; level < this.levels; level++) { for (let level = 0; level < this.levels; level++) {
// find whether there is a neighbor idx that is not in layerIndices // find whether there is a neighbor idx that is not in layerIndices
let proofElements = layerIndices.reduce((elements, idx) => { const proofElements = layerIndices.reduce((elements, idx) => {
const leafIndex = idx ^ 1 const leafIndex = idx ^ 1
if (!layerIndices.includes(leafIndex)) { if (!layerIndices.includes(leafIndex)) {
if (leafIndex < this._layers[level].length) { if (leafIndex < this._layers[level].length) {
elements.push(this._layers[level][leafIndex]) elements.push(this._layers[level][leafIndex])
} else { } else {
elements.push(this._zeros[level]) elements.push(this._zeros[level])
@ -199,14 +199,14 @@ export class BaseTree {
): boolean { ): boolean {
let layerElements: Element[] = leaves let layerElements: Element[] = leaves
let layerIndices: number[] = leafIndices let layerIndices: number[] = leafIndices
let proofElements: Element[] = pathElements const proofElements: Element[] = pathElements
let layerProofs: Element[] = [] const layerProofs: Element[] = []
for (let level = 0; level < levels; level++) { for (let level = 0; level < levels; level++) {
for (let i = 0; i < layerIndices.length; i++) { for (let i = 0; i < layerIndices.length; i++) {
let layerHash: string let layerHash: string
let elIndex = layerIndices[i] const elIndex = layerIndices[i]
let leafIndex = elIndex ^ 1 const leafIndex = elIndex ^ 1
if (layerIndices.includes(leafIndex)) { if (layerIndices.includes(leafIndex)) {
if (elIndex % 2 === 0) { if (elIndex % 2 === 0) {
layerHash = hashFn(layerElements[0], layerElements[1]) layerHash = hashFn(layerElements[0], layerElements[1])

View File

@ -70,7 +70,7 @@ export default class MerkleTree extends BaseTree {
} }
multiProof(elements: Element[]): MultiProofPath { multiProof(elements: Element[]): MultiProofPath {
let indexes = [] const indexes = []
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
indexes.push(this.indexOf(elements[i])) indexes.push(this.indexOf(elements[i]))
} }