From 6eaf4c70fd03b9fcd6cc2e093c2afcd82341edc2 Mon Sep 17 00:00:00 2001 From: Henry Li Date: Mon, 26 Feb 2024 20:04:43 -0500 Subject: [PATCH] change hashLeaves: false, --- scripts/setStages.ts | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/scripts/setStages.ts b/scripts/setStages.ts index 341cad65..8a6f1a6f 100644 --- a/scripts/setStages.ts +++ b/scripts/setStages.ts @@ -69,31 +69,24 @@ export const setStages = async ( } else if (stage.variableLimitPath) { const leaves: any[] = []; const file = fs.readFileSync(stage.variableLimitPath, 'utf-8'); - file.split('\n').filter(line => line).forEach(line => { - const [addressStr, limitStr] = line.split(','); - const address = ethers.utils.getAddress(addressStr.toLowerCase().trim()); - const limit = parseInt(limitStr, 10) - - const digest = keccak256( - [ - 'address', - 'uint32', - ], - [ - address, - limit, - ], - ); - leaves.push(digest); + file + .split('\n') + .filter((line) => line) + .forEach((line) => { + const [addressStr, limitStr] = line.split(','); + const address = ethers.utils.getAddress( + addressStr.toLowerCase().trim(), + ); + const limit = parseInt(limitStr, 10); + + const digest = keccak256(['address', 'uint32'], [address, limit]); + leaves.push(digest); + }); + + const mt = new MerkleTree(leaves, ethers.utils.keccak256, { + sortPairs: true, + hashLeaves: false, }); - const mt = new MerkleTree( - leaves, - ethers.utils.keccak256, - { - sortPairs: true, - hashLeaves: true, - }, - ); return mt.getHexRoot(); }