mirror of
https://github.com/vacp2p/rln-contract.git
synced 2025-01-09 22:05:47 +00:00
fix: hardhat tests
This commit is contained in:
parent
99c6625b40
commit
d8a9435fa7
@ -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"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user