fix: hardhat tests

This commit is contained in:
rymnc 2023-03-30 20:28:04 +05:30
parent 99c6625b40
commit d8a9435fa7
No known key found for this signature in database
GPG Key ID: C740033EE3F41EBD

View File

@ -29,7 +29,7 @@ describe("RLN", () => {
); );
}); });
it("should withdraw membership", async () => { it("should slash membership", async () => {
const rln = await ethers.getContract("RLN", ethers.provider.getSigner(0)); const rln = await ethers.getContract("RLN", ethers.provider.getSigner(0));
const price = await rln.MEMBERSHIP_DEPOSIT(); const price = await rln.MEMBERSHIP_DEPOSIT();
@ -45,21 +45,21 @@ describe("RLN", () => {
}); });
await registerTx.wait(); await registerTx.wait();
// We withdraw our id_commitment // We slash the id_commitment
const receiverAddress = "0x000000000000000000000000000000000000dead"; const receiverAddress = "0x000000000000000000000000000000000000dead";
const withdrawTx = await rln["withdraw(uint256,address)"]( const slashTx = await rln["slash(uint256,address)"](
idSecret, idSecret,
receiverAddress receiverAddress
); );
const txWithdrawReceipt = await withdrawTx.wait(); const slashTxReceipt = await slashTx.wait();
const withdrawalPk = txWithdrawReceipt.events[0].args.idCommitment; const slashedIdCommitment = slashTxReceipt.events[0].args.idCommitment;
// We ensure the registered id_commitment is the one we passed and that the index is the same // We ensure the registered id_commitment is the one we passed and that the index is the same
expect( expect(
withdrawalPk.toHexString() === idCommitment, slashedIdCommitment.toHexString() === idCommitment,
"withdraw commitment doesn't match registered commitment" "slashed commitment doesn't match registered commitment"
); );
}); });