Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(poll-command): fixed poll command to support merged state root #1477

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/tests/unit/poll.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("poll", () => {

expect(pollData.id).to.eq(finishedPollData.id);
expect(pollData.address).to.eq(finishedPollData.address);
expect(finishedPollData.isStateAqMerged).to.eq(true);
expect(finishedPollData.mergedStateRoot).to.eq(true);
});

it("should throw error if there are no signer and provider", async () => {
Expand Down
10 changes: 5 additions & 5 deletions cli/ts/commands/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export const getPoll = async ({

const pollContract = PollFactory.connect(pollAddress, signer ?? provider);

const [[deployTime, duration], isStateAqMerged] = await Promise.all([
const [[deployTime, duration], mergedStateRoot] = await Promise.all([
pollContract.getDeployTimeAndDuration(),
pollContract.stateMerged(),
pollContract.mergedStateRoot(),
]);

const numSignups = await (isStateAqMerged ? pollContract.numSignups() : maciContract.numSignUps());
const numSignups = await (mergedStateRoot ? pollContract.numSignups() : maciContract.numSignUps());
ctrlc03 marked this conversation as resolved.
Show resolved Hide resolved

logGreen(
quiet,
Expand All @@ -55,7 +55,7 @@ export const getPoll = async ({
`Deploy time: ${new Date(Number(deployTime) * 1000).toString()}`,
`End time: ${new Date(Number(deployTime + duration) * 1000).toString()}`,
`Number of signups ${numSignups}`,
`State Aq merged: ${isStateAqMerged}`,
`State Aq merged: ${mergedStateRoot}`,
ctrlc03 marked this conversation as resolved.
Show resolved Hide resolved
].join("\n"),
),
);
Expand All @@ -66,6 +66,6 @@ export const getPoll = async ({
deployTime,
duration,
numSignups,
isStateAqMerged,
mergedStateRoot,
};
};
2 changes: 1 addition & 1 deletion cli/ts/utils/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ export interface IGetPollData {
/**
* Whether the MACI contract's stateAq has been merged by this contract
ctrlc03 marked this conversation as resolved.
Show resolved Hide resolved
*/
isStateAqMerged: boolean;
mergedStateRoot: bigint;
ctrlc03 marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
Loading