Skip to content

Commit

Permalink
Add committeePublicKey test
Browse files Browse the repository at this point in the history
  • Loading branch information
cristovaoth committed Jun 4, 2024
1 parent 6dba323 commit 47883f1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
30 changes: 29 additions & 1 deletion packages/evm/test/Enclave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,35 @@ describe("Enclave", function () {
await enclave.setCyphernodeRegistry(prevRegistry);
await expect(enclave.activate(0)).to.not.be.reverted;
});
it("sets committeePublicKey correctly");
it("sets committeePublicKey correctly", async () => {
const {
enclave,
request,
mocks: { registry },
} = await loadFixture(setup);

await enclave.request(
request.pool,
request.threshold,
request.duration,
request.computationModule,
request.cMParams,
request.executionModule,
request.eMParams,
{ value: 10 },
);

const e3Id = 0;
const publicKey = await registry.getCommitteePublicKey(e3Id);

let e3 = await enclave.getE3(e3Id);
expect(e3.committeePublicKey).to.not.equal(publicKey);

await enclave.activate(e3Id);

e3 = await enclave.getE3(e3Id);
expect(e3.committeePublicKey).to.equal(publicKey);
});
it("returns true if E3 is activated successfully");
it("emits E3Activated event");
});
Expand Down
3 changes: 2 additions & 1 deletion packages/evm/test/fixtures/MockCyphernodeRegistry.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ethers } from "hardhat";
import { MockCyphernodeRegistry__factory } from "../../types";

export async function deployCyphernodeRegistryFixture(name?: string) {
const [signer] = await ethers.getSigners();
const deployment = await (await ethers.getContractFactory(name || "MockCyphernodeRegistry")).deploy();

return MockCyphernodeRegistry__factory.connect(await deployment.getAddress());
return MockCyphernodeRegistry__factory.connect(await deployment.getAddress(), signer.provider);
}

0 comments on commit 47883f1

Please sign in to comment.