fix: merkle type error fix
MODIFY
src/libs/ProofsUtil.ts
src/libs/ProofsUtil.ts
@@ -57,15 +57,7 @@ export default class ProofsUtil {
}
static recursiveZeroHash(n: number, web3) {
- if (n === 0)
- return ethUtils.keccak256(
- ethUtils.toBuffer(
- web3.eth.abi.encodeParameters(
- ['bytes32'],
- ['0x0000000000000000000000000000000000000000000000000000000000000000']
- )
- )
- )
+ if (n === 0) return '0x0000000000000000000000000000000000000000000000000000000000000000'
const subHash = this.recursiveZeroHash(n - 1, web3)
return ethUtils.keccak256(
ethUtils.toBuffer(web3.eth.abi.encodeParameters(['bytes32', 'bytes32'], [subHash, subHash]))
@@ -132,7 +124,7 @@ export default class ProofsUtil {
const leafRoots = this.recursiveZeroHash(subTreeHeight, web3)
// Build a merkle tree of correct size for the subtree using these merkle roots
- const leaves = Array.from({ length: 2 ** heightDifference }, () => leafRoots)
+ const leaves = Array.from({ length: 2 ** heightDifference }, () => ethUtils.toBuffer(leafRoots))
leaves[0] = remainingNodesHash
const subTreeMerkleRoot = new MerkleTree(leaves).getRoot()

fix: merkle type error fix