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!: add a claimsRegistrar based on attestations #3622

Merged
merged 13 commits into from
Oct 8, 2021
Merged

Conversation

Chris-Hibbert
Copy link
Contributor

Agents who can deposit an attestation payment will get the ability to vote that amount.
refactor common registrat code to a library
tests that BinaryBallotCounter can count these votes.

@Chris-Hibbert Chris-Hibbert added enhancement New feature or request security Small Zoe Contract Contracts within Zoe Core Economy OBSOLETE in favor of INTER-protocol Governance Governance labels Aug 7, 2021
@Chris-Hibbert Chris-Hibbert added this to the Beta Phase 4: Governance milestone Aug 7, 2021
@Chris-Hibbert Chris-Hibbert self-assigned this Aug 7, 2021
@Chris-Hibbert Chris-Hibbert marked this pull request as draft August 7, 2021 00:28
@Chris-Hibbert Chris-Hibbert force-pushed the manageTreasury-3189 branch 2 times, most recently from d2d2be3 to 965f471 Compare September 18, 2021 00:43
@Chris-Hibbert Chris-Hibbert force-pushed the manageTreasury-3189 branch 3 times, most recently from 48fd832 to 1eb2464 Compare September 20, 2021 23:07
@Chris-Hibbert Chris-Hibbert mentioned this pull request Sep 21, 2021
26 tasks
@Chris-Hibbert Chris-Hibbert marked this pull request as ready for review September 21, 2021 17:51
@Chris-Hibbert Chris-Hibbert mentioned this pull request Sep 21, 2021
18 tasks
@Chris-Hibbert Chris-Hibbert force-pushed the manageTreasury-3189 branch 2 times, most recently from 402c207 to 185ba61 Compare October 1, 2021 19:54
@Chris-Hibbert Chris-Hibbert requested a review from dckc October 4, 2021 17:04
@dckc dckc mentioned this pull request Oct 6, 2021
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

after poring over the code, I packaged up a bunch of suggestions in #3932

What's here is a good step forward with or without those suggestions.

Comment on lines +23 to +24
// has a persistent handle that survives through extending the duration of the
// lien and augmenting the number of shares it represents. This contract makes
Copy link
Member

Choose a reason for hiding this comment

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

"the lean"? What does that definite description refer to?

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'll assume "the lean" is auto-corrupted from "the lien".

There's an underlying lien for the tokens represented in the go-code. When the holder extends the duration (locks up for an extended period) or adds to the deposited tokens, the attestation contract makes sure to use the same identity, so that attestation payments are re-usable without confusing vote counters, even though the value locked or duration of the lock can change over time.

Copy link
Member

@dckc dckc Oct 7, 2021

Choose a reason for hiding this comment

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

This is sort of a copy-editing / tech writing comment. Whenever I see a definite description that doesn't have a clear referent, my mind flags it like a compiler error. Usually making the referent clear is straightforward, but sometimes the ill-formed definite description is a sign of a larger problem with the text or even the design, as if we were referring to "the solution to the equation" when there may in fact be none or more than one.

My first reaction to this comment was to wonder what it is about; i.e. what it is documenting. It would make sense to make it a /** JSDoc comment on start or to use JSDoc's @file. But we've had that discussion before, so I let that go.

Then I bumped over "shareHolders is ..." -- a plural subject with a singular verb. But OK, I can read it as "The shareHolders contract is..." or some such.

Then "relies on an attestation contract" reminds me of a long-standing issue I've had with the platform: what is a contract? I know what a bundle, an installation, and an instance are. I read it as an instance in this case. The instance isn't in the terms, but a corresponding brand is, and it's clear enough how they relate after reading attestation/expiring/expiringNFT.js and such.

"to ensure that only valid holders of shares have the ability to vote" somewhat raises the question of what a valid holder of a share is; on the other hand, it defines it in terms of capabilities. So very well.

"each votable share has a persistent handle" sounds at first like if I have 1000 shares then I get 1000 handles. Perhaps "... for every votable share, there is a persistent handle..." would be better, but I figured it out by reading attestation.js etc. and forgot to comment on that part.

But then we get to "extending the duration of the lien" and nothing in this comment introduced a lien into the discussion.

"the attestations" follows "an attestation contract" soon enough to allude to it, though on review, it's not clear enough to serve as a specification.

I wonder if it would be cost-effective for this comment to start with attestationBrand and tell the rest of the story from there.

In the end, my code review bar is: am I OK maintaining this code? If I'm called on to work on this file, there's a good chance I'll refine that comment. But I think I understand it well enough to endorse the code as-is.

packages/governance/src/shareHolders.js Outdated Show resolved Hide resolved
packages/governance/src/shareHolders.js Show resolved Hide resolved
packages/governance/src/types.js Outdated Show resolved Hide resolved
Comment on lines 251 to 265
/**
* @typedef {Object} CommitteeElectoratePublicMixin
* @property {() => string} getName
*/

/**
* @typedef {Object} ClaimsElectorateMixin
* @property {() => ERef<Invitation>} makeVoterInvitation
*/

/**
* @typedef { ElectoratePublic & ClaimsElectorateMixin } ClaimsElectoratePublic
* @typedef { ElectoratePublic & CommitteeElectoratePublicMixin } CommitteeElectoratePublic
* @typedef { ClaimsElectoratePublic | CommitteeElectoratePublic } AnyElectoratePublic
*/
Copy link
Member

Choose a reason for hiding this comment

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

Making up all these names for things we only use once only makes the code harder to read, to my mind. I suggest:

Suggested change
/**
* @typedef {Object} CommitteeElectoratePublicMixin
* @property {() => string} getName
*/
/**
* @typedef {Object} ClaimsElectorateMixin
* @property {() => ERef<Invitation>} makeVoterInvitation
*/
/**
* @typedef { ElectoratePublic & ClaimsElectorateMixin } ClaimsElectoratePublic
* @typedef { ElectoratePublic & CommitteeElectoratePublicMixin } CommitteeElectoratePublic
* @typedef { ClaimsElectoratePublic | CommitteeElectoratePublic } AnyElectoratePublic
*/
/**
* @typedef { ElectoratePublic & {makeVoterInvitation: () => ERef<Invitation>} } ClaimsElectoratePublic
* @typedef { ElectoratePublic & {getName: () => string} } CommitteeElectoratePublic
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is simpler for this case. It feels like if there were more than one added method, we'd need to break it out for readability anyway. Do you think the in-line approach would apply more generally?

Copy link
Member

Choose a reason for hiding this comment

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

Do you think the in-line approach would apply more generally?

I do, though I gather it goes against an established norm to some extent.

packages/governance/src/electorateTools.js Show resolved Hide resolved
packages/governance/src/shareHolders.js Outdated Show resolved Hide resolved
@Chris-Hibbert
Copy link
Contributor Author

I incorporated the suggestions from #3932, though not always the way you wrote them.

@dckc
Copy link
Member

dckc commented Oct 7, 2021

I incorporated the suggestions from #3932, though not always the way you wrote them.

Cool. That's the spirit in which they were offered.

Agents who can deposit an attestation payment will get the ability to vote that amount.
refactor common registrat code to a library
tests that BinaryBallotCounter can count these votes.
more handles have capitalized names than not.

Suggestions from #3932
@Chris-Hibbert Chris-Hibbert added the automerge:squash Automatically squash merge label Oct 8, 2021
Base automatically changed from manageTreasury-3189 to master October 8, 2021 16:32
@mergify mergify bot merged commit 3acf78d into master Oct 8, 2021
@mergify mergify bot deleted the claimRegistrar-3474 branch October 8, 2021 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request Governance Governance security Zoe Contract Contracts within Zoe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants