-
Notifications
You must be signed in to change notification settings - Fork 212
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
Conversation
@turadg, Is there a straightforward change to the test that would allow us to verify the published results?
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. |
This now has tests and is ready to review. |
There was a problem hiding this 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? |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 }) => { |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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.
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.