Skip to content

Commit

Permalink
chore(coordinator): update deps and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed Aug 1, 2024
1 parent a729e6c commit 025f969
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 209 deletions.
10 changes: 5 additions & 5 deletions packages/coordinator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"ethers": "^6.13.1",
"hardhat": "^2.22.6",
"helmet": "^7.1.0",
"maci-circuits": "0.0.0-ci.03f7713",
"maci-cli": "0.0.0-ci.03f7713",
"maci-contracts": "0.0.0-ci.03f7713",
"maci-domainobjs": "0.0.0-ci.03f7713",
"maci-subgraph": "0.0.0-ci.03f7713",
"maci-circuits": "0.0.0-ci.ee40301",
"maci-cli": "0.0.0-ci.ee40301",
"maci-contracts": "0.0.0-ci.ee40301",
"maci-domainobjs": "0.0.0-ci.ee40301",
"maci-subgraph": "0.0.0-ci.ee40301",
"mustache": "^4.2.0",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/coordinator/ts/proof/__tests__/proof.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ describe("ProofGeneratorService", () => {

beforeEach(() => {
mockContract = {
polls: jest.fn(() => Promise.resolve(ZeroAddress.replace("0x0", "0x1"))),
polls: jest.fn(() =>
Promise.resolve({ poll: ZeroAddress.replace("0x0", "0x1"), messageProcessor: ZeroAddress, tally: ZeroAddress }),
),
getMainRoot: jest.fn(() => Promise.resolve(1n)),
treeDepths: jest.fn(() => Promise.resolve([1, 2, 3])),
extContracts: jest.fn(() => Promise.resolve({ messageAq: ZeroAddress })),
Expand Down Expand Up @@ -144,7 +146,7 @@ describe("ProofGeneratorService", () => {
});

test("should throw error if poll is not found in maci contract", async () => {
mockContract.polls.mockResolvedValue(ZeroAddress);
mockContract.polls.mockResolvedValue({ poll: ZeroAddress });
const service = new ProofGeneratorService(defaultCryptoService, fileService);

await expect(service.generate({ ...defaultArgs, poll: 2 })).rejects.toThrow(ErrorCodes.POLL_NOT_FOUND);
Expand Down
9 changes: 6 additions & 3 deletions packages/coordinator/ts/proof/proof.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ export class ProofGeneratorService {
address: maciContractAddress,
});

const [signer, pollAddress] = await Promise.all([this.deployment.getDeployer(), maciContract.polls(poll)]);
const [signer, pollContracts] = await Promise.all([this.deployment.getDeployer(), maciContract.polls(poll)]);

if (pollAddress.toLowerCase() === ZeroAddress.toLowerCase()) {
if (pollContracts.poll.toLowerCase() === ZeroAddress.toLowerCase()) {
this.logger.error(`Error: ${ErrorCodes.POLL_NOT_FOUND}, Poll ${poll} not found`);
throw new Error(ErrorCodes.POLL_NOT_FOUND);
}

const pollContract = await this.deployment.getContract<Poll>({ name: EContracts.Poll, address: pollAddress });
const pollContract = await this.deployment.getContract<Poll>({
name: EContracts.Poll,
address: pollContracts.poll,
});
const [{ messageAq: messageAqAddress }, coordinatorPublicKey, isStateAqMerged, messageTreeDepth] =
await Promise.all([
pollContract.extContracts(),
Expand Down
4 changes: 2 additions & 2 deletions packages/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"graphql-request": "^6.1.0",
"lowdb": "^1.0.0",
"lucide-react": "^0.316.0",
"maci-cli": "0.0.0-ci.4d2d340",
"maci-domainobjs": "0.0.0-ci.4d2d340",
"maci-cli": "0.0.0-ci.ee40301",
"maci-domainobjs": "0.0.0-ci.ee40301",
"next": "^14.1.0",
"next-auth": "^4.24.5",
"next-themes": "^0.2.1",
Expand Down
Loading

0 comments on commit 025f969

Please sign in to comment.