Skip to content

Commit 03164ee

Browse files
committed
Used PoseidonUnit4L instead of PoseidonUnit1L
1 parent 8dc3f3d commit 03164ee

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

contracts/contracts/Depositor.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pragma solidity 0.8.23;
33

44
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
55

6-
library PoseidonUnit1L {
7-
function poseidon(bytes32[1] calldata) public pure returns (bytes32) {}
6+
library PoseidonUnit4L {
7+
function poseidon(bytes32[4] calldata) public pure returns (bytes32) {}
88
}
99

1010
/**
@@ -72,7 +72,7 @@ contract Depositor {
7272
* @param secret The secret used to withdraw the deposit.
7373
* @param secretHash The Poseidon hash of the secret used to create the deposit.
7474
*/
75-
event Withdrawn(address indexed recipient, uint256 amount, bytes32 secret, bytes32 secretHash);
75+
event Withdrawn(address indexed recipient, uint256 amount, bytes32[4] secret, bytes32 secretHash);
7676

7777
/**
7878
* @notice Emitted when deposited funds are restored to the sender after the lock time has expired.
@@ -155,8 +155,8 @@ contract Depositor {
155155
* Uses the PoseidonUnit1L library to hash the provided secret.
156156
* @param secret_ The prototype of the `secretHash` used in the deposit function.
157157
*/
158-
function withdraw(bytes32 secret_) external {
159-
bytes32 secretHash_ = PoseidonUnit1L.poseidon([secret_]);
158+
function withdraw(bytes32[4] calldata secret_) external {
159+
bytes32 secretHash_ = PoseidonUnit4L.poseidon(secret_);
160160

161161
Deposit storage userDeposit = deposits[secretHash_];
162162

contracts/deploy/1_depositor.migration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { poseidonContract } from "circomlibjs";
66

77
export = async (deployer: Deployer) => {
88
await deployer.deploy({
9-
contractName: "contracts/Depositor.sol:PoseidonUnit1L",
10-
bytecode: poseidonContract.createCode(1),
11-
abi: poseidonContract.generateABI(1),
9+
contractName: "contracts/Depositor.sol:PoseidonUnit4L",
10+
bytecode: poseidonContract.createCode(4),
11+
abi: poseidonContract.generateABI(4),
1212
});
1313

1414
const depositor = await deployer.deploy(Depositor__factory);

0 commit comments

Comments
 (0)