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

feat: publish vote results from the voteCounter #6204

Merged
merged 5 commits into from
Sep 15, 2022

Conversation

Chris-Hibbert
Copy link
Contributor

closes: #6198

Description

publish vote results from the voteCounter

Security Considerations

this is already pubic.

Documentation Considerations

We should have description of the structure of the data we publish. Do we, and I'm just unaware?

Testing Considerations

The test doesn't yet verify the published data. I hope to add that before merging.

@turadg,   Is there a straightforward change to the test that would
allow us to verify the published results?
@Chris-Hibbert Chris-Hibbert added enhancement New feature or request Governance Governance pso labels Sep 14, 2022
@Chris-Hibbert Chris-Hibbert added this to the Mainnet 1 RC0 milestone Sep 14, 2022
@Chris-Hibbert Chris-Hibbert self-assigned this Sep 14, 2022
@turadg
Copy link
Member

turadg commented Sep 14, 2022

We should have description of the structure of the data we publish. Do we, and I'm just unaware?

Agree. https://github.com/Agoric/agoric-sdk/blob/master/packages/inter-protocol/README.md#reading-data-off-chain is the closest we have, just the key structure.

The data streams are basically documented by the unit tests but whatever gets onto Mainnet should have end-user documentation. Ideally formatted in a way that an storage node explorer tool can include it.

@Chris-Hibbert
Copy link
Contributor Author

This now has tests and is ready to review.

@Chris-Hibbert Chris-Hibbert requested review from erights and turadg and removed request for erights September 15, 2022 00:37
@Tartuffo Tartuffo removed this from the Mainnet 1 RC0 milestone Sep 15, 2022
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For expedience I pushed the changes I was going to suggest.

Approving with them ;-)

question: details.questionHandle,
outcome: 'No quorum',
};
// @ts-expect-error Expand type to allow non-position?
Copy link
Member

@turadg turadg Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we should. I pushed e93c279

@@ -123,6 +135,12 @@ const makeBinaryVoteCounter = (questionSpec, threshold, instance) => {
} else {
outcomePromise.resolve(questionSpec.tieOutcome);
}

// XXX if we should distinguish ties, publish should be called in if above
Copy link
Member

@turadg turadg Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be good too but I don't object to leaving this tech debt for later. If you want to do it now, e93c279 shows how.

@@ -198,7 +216,7 @@ const makeBinaryVoteCounter = (questionSpec, threshold, instance) => {
/**
* @type {ContractStartFn<VoteCounterPublicFacet, VoteCounterCreatorFacet, {questionSpec: QuestionSpec, quorumThreshold: bigint}>}
*/
const start = zcf => {
const start = (zcf, { outcomesPublisher }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Practically every publisher publishes more than once so the "s" plurality for that isn't informative. What is informative is what each thing they publish is. (That helps to distinguish from when each publication is not unary.)

In this case, outcomePublisher.

@@ -158,13 +158,24 @@ const start = (zcf, privateArgs) => {
}
};

const outcomeNode = E(privateArgs.storageNode).makeChildNode(
'latestOutcome',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little hesitant to have a node for each of these but feels right to error on the side of more nodes so we don't create backwards compatibility problems for any nodes with broader responsibilities.

const voteOutcome = {
question: details.questionHandle,
outcome: 'fail',
reason: 'No quorum',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mentioned that "quorum" isn't the right term for this. Now may be a good time to improve the message. We can at least provide the threshold value for diagnostics.

e..g. Too few voters for threshold ${threshold}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm resisting scope creep. I filed an issue (#6209) to fix the terminology from "quorum" to "threshold". The term "quorum" appears in too many places to want to fix it at the last minute.

@Chris-Hibbert Chris-Hibbert added the automerge:squash Automatically squash merge label Sep 15, 2022
@mergify mergify bot merged commit 7645df0 into master Sep 15, 2022
@mergify mergify bot deleted the 6198-voteCounter-Report branch September 15, 2022 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge enhancement New feature or request Governance Governance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BinaryVoteCounter should report vote results to chain storage
3 participants