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(inter-protocol): set keyword shares on feeDistributor #6962

Merged
merged 5 commits into from
Feb 17, 2023

Conversation

dckc
Copy link
Member

@dckc dckc commented Feb 10, 2023

closes: #6926

Description

add setKeywordShares creator facet method to fee distributor to facilitate adjustment by BLDer DAO.

Security Considerations

using setKeywordShares() can render the contract terms outdated, so they are somewhat unreliable.
a getKeywordShares() method mitigates this somewhat.

Scaling Considerations

none?

Documentation Considerations

I suppose there should be some docs to update... I wonder where they are.

Testing Considerations

single happy-path unit test

args have pattern guards, so that seems sufficient

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

makeShareConfig should assert that all shares are Nat.

// Run once immediately for these destinations.
await schedulePayments();
},

/** @param {Record<Keyword, bigint>} newShares */
setKeywordShares: newShares => {
Copy link
Contributor

Choose a reason for hiding this comment

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

adding this to the creatorFacet means that it's accessible only to the Builder DAO, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes; that's the goal of #6926

/** @param {Record<Keyword, bigint>} newShares */
setKeywordShares: newShares => {
mustMatch(newShares, M.recordOf(M.string(), M.nat()));
keywordShares = newShares;
Copy link
Contributor

Choose a reason for hiding this comment

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

The original keywordShares is visible in terms. Is there any visibility for the updated value? It could be on the public facet or pushed to chain storage.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can put it on the public facet without significant more work.

Rendering the terms out of date / unreliable does seem awkward, but more challenging to address. Gotta think it over a bit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that that would be a good goal, but I think we can leave it to address til later.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added it to the public facet.

Check for Nat rather than just `bigint` in makeShareConfig(),
but also provide `customTermsShape` so that Zoe checks M.nat()
before starting the contract.
@dckc
Copy link
Member Author

dckc commented Feb 16, 2023

makeShareConfig should assert that all shares are Nat.

done. PTAL.

@Chris-Hibbert
Copy link
Contributor

ICYMI:

/home/runner/work/agoric-sdk/agoric-sdk/packages/inter-protocol/test/test-feeDistributor.js
Error:   10:10  error  'M' is defined but never used. Allowed unused vars must match /^_/u  no-unused-vars

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

LGtM

@dckc dckc added the automerge:squash Automatically squash merge label Feb 17, 2023
@mergify mergify bot merged commit 1d9c7b7 into master Feb 17, 2023
@mergify mergify bot deleted the 6926-set-shares branch February 17, 2023 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vault fee distribution is controllable by BLDer DAO
2 participants