-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
In circomlibjs version 0.1.7, the generated Solidity code and JS functions for poseidon produce a different hash for the same input. Hardhat running with solc version 0.8.27 if that matters.
async initialize() {
// deploy hash contracts
let poseidon2Factory = new ethers.ContractFactory(
poseidonContract.generateABI(2),
poseidonContract.createCode(2),
this.owner
);
this.poseidon2 = await poseidon2Factory.deploy();
// test it
let onchainP2Result = ethers.toBigInt(await this.poseidon2['poseidon(uint256[2])']([1, 2]));
let offchainP2Result = ethers.toBigInt((await buildPoseidon(2))([1, 2]));
if (onchainP2Result !== offchainP2Result) {
console.log(onchainP2Result, offchainP2Result);
throw new Error('Poseidon2 test failed', {onchainP2Result, offchainP2Result});
}
}I saw issue #13, but:
- it's talking about circom vs JS (not Solidity vs JS)
- for that bug, it seems to be outputting the same hashes, just with different return types. For this bug, the functions output entirely different bytes.
Please let me know if you need any help reproducing this. I actually can't get the two implementations to output the same hash at all.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels