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(addAssetToVault): support issuerName separate from keyword #8229

Merged
merged 4 commits into from
Oct 5, 2023

Conversation

dckc
Copy link
Member

@dckc dckc commented Aug 21, 2023

fixes: #8235
refs: #8176, #8177

Description

In addAssetToVault, we conflated keyword (needed for registration with the reserve and auction) with issuerName (for use in agoricNames). This adds to InterchainAssetOptions an issuerName property that defaults to the value of keyword.

Security, Documentation Considerations

Allows higher fidelity between agoricNames and well-known names of assets.

Scaling Considerations

n/a/

Testing Considerations

Manual testing with issuerName: 'atom' and issuerName: 'stars' succeeded. We could keep the issuerName: 'stars' tweak. But first, I'd like to see what ci thinks of this.

Upgrade Considerations

doesn't affect existing vats.

@dckc dckc requested a review from turadg August 21, 2023 22:51
Comment on lines 21 to 22
* @property {string} [issuerName]
* @property {string} oracleBrand
Copy link
Member

Choose a reason for hiding this comment

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

why allow oracleBrand to be different than issuerName?

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 don't recall. Perhaps no reason. I suppose the thought at the time of writing was: why constrain them to be the same?

@michaelfig ? maybe you have a more clear idea of the constraints?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh... are you suggesting that oracleBrand suffices instead of adding an issuerName property? I suppose that could work, though it seems like a stretch.

Copy link
Member

Choose a reason for hiding this comment

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

if they don't truly need to be different my suggestion would be to rename the oracleBrand property to issuerName.

Whether they need to be different… they are different brands but I think it's a source of unnecessary confusion to have different strings, since their different namespaces suffice.

Copy link
Member

Choose a reason for hiding this comment

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

My 2c - in the event there were ever multiple oracle options for a single asset (say, redemption rate, twap, etc), provided as separate PriceAuthorities, it seems like it'd be beneficial to have issuerName and oracleBrand decoupled

@0xpatrickdev
Copy link
Member

Do we also need to update /scripts/add-collateral-core.js? If I specify an issuerName in interchainAssetOptions in /scripts/add-STARS.js, it is not propagated through to the getManifestCall object in the generated script

@dckc dckc force-pushed the dc-interchain-name-case branch from d69413d to 38edd99 Compare August 22, 2023 15:50
0xpatrickdev added a commit to 0xpatrickdev/agoric-sdk that referenced this pull request Aug 22, 2023
@dckc
Copy link
Member Author

dckc commented Aug 22, 2023

@0xpatrickdev did some testing and found a problem

2023-08-22T15:54:16.291Z SwingSet: xsnap: v29: Error: keyword "stATOM" must be an ascii identifier starting with upper case.
 at construct ()
...
 at In "assertUniqueKeyword" method of (InstanceRecord) (/bundled-source/.../node_modules/@endo/exo/src/exo-tools.js:42)
 at saveIssuer (.../zoe/src/contractFacet/zcfZygote.js:261)
 at saveIssuer (.../zoe/src/contractFacet/zcfZygote.js:257)
 at updateState (.../vats/src/provisionPoolKit.js:344)
 at updateState (.../vats/src/provisionPoolKit.js:342)

Looks like we have more keyword/issuerName conflation in provisionPool. :-/

https://github.com/Agoric/agoric-sdk/blob/mainnet1B/packages/vats/src/provisionPoolKit.js#L347

p.s. for follow-up, see #8238

0xpatrickdev added a commit to 0xpatrickdev/agoric-sdk that referenced this pull request Aug 22, 2023
0xpatrickdev added a commit to 0xpatrickdev/agoric-sdk that referenced this pull request Aug 22, 2023
0xpatrickdev added a commit to 0xpatrickdev/agoric-sdk that referenced this pull request Aug 22, 2023
@dckc dckc force-pushed the dc-interchain-name-case branch from 2b75c1b to 8fc0c23 Compare August 22, 2023 21:46
@dckc dckc force-pushed the dc-interchain-name-case branch 2 times, most recently from 9600d4e to 7b29446 Compare October 3, 2023 01:06
@dckc dckc marked this pull request as ready for review October 3, 2023 01:06
@dckc dckc requested review from 0xpatrickdev and turadg October 3, 2023 01:07
Comment on lines 19 to 22
* @property {string} [proposedName]
* @property {string} keyword
* @property {string} oracleBrand
* @property {string} [issuerName]
* @property {string} [oracleBrand]
Copy link
Member

@0xpatrickdev 0xpatrickdev Oct 3, 2023

Choose a reason for hiding this comment

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

The new changes since last testing period look good to me (note: just from reading the code, i have yet to try a deployment). I might suggest adding these comments, or something along these lines, to add more clarity around the parameters:

Suggested change
* @property {string} [proposedName]
* @property {string} keyword
* @property {string} oracleBrand
* @property {string} [issuerName]
* @property {string} [oracleBrand]
* @property {string} keyword - the issuer keyword record for the contract instance
* @property {string} [issuerName] - defaults to `keyword` if not provided
* @property {string} [proposedName] - defaults to `issuerName` if not provided
* @property {string} [oracleBrand] - defaults to `issuerName` if not provided

(keyword took me a minute to grok, but it's seemingly just for the use case i described)

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.

No blockers but please consider the suggestions before merging.

@@ -10,6 +10,8 @@ import {
/** @typedef {import('@agoric/vat-data').Baggage} Baggage */

/**
* NOTE: "keyword" connotes initial caps constraint, which doesn't apply here.
Copy link
Member

Choose a reason for hiding this comment

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

consider explaining why the imperfect name remains

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm. I considered it, but I don't see a concise explanation.

Changing the name wouldn't require upgrading the existing contract vats. It would just require remembering that the old ones use a different name. It might even be possible to support a new name property and deprecate the keyword property.

I suppose the real reason the keyword name remains is: changing it isn't necessary to address #8235.

Copy link
Member

Choose a reason for hiding this comment

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

require remembering that the old ones use a different name
That seems reason enough to me.

the keyword name remains is: changing it isn't necessary

Fair. Though with this PR that imperfect name is tech debt. We should at least document the rationale to take on the debt.

Comment on lines 131 to 134
keyword: kwd,
issuerName = kwd,
oracleBrand = issuerName,
Copy link
Member

Choose a reason for hiding this comment

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

You have a nice and clear progressive override below. Why not use it here?

Suggested change
keyword: kwd,
issuerName = kwd,
oracleBrand = issuerName,
keyword,
issuerName = keyword,
oracleBrand = issuerName,

assert.typeof(proposedName, 'string');
assert.typeof(decimalPlaces, 'number');
Copy link
Member

Choose a reason for hiding this comment

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

moving this line looks superfluous to me. If you are going to move it, consider some rational ordering like alphabetical (as you have in the destructuring for this fn

@dckc dckc added the automerge:rebase Automatically rebase updates, then merge label Oct 3, 2023
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

@dckc - This PR appears to be stuck. It's had a merge label for > 24 hours

@dckc dckc force-pushed the dc-interchain-name-case branch from 65c0d76 to 54e5094 Compare October 5, 2023 17:36
@dckc dckc force-pushed the dc-interchain-name-case branch from 54e5094 to f0b1559 Compare October 5, 2023 18:47
@mhofman
Copy link
Member

mhofman commented Oct 5, 2023

@Mergifyio refresh

@mergify
Copy link
Contributor

mergify bot commented Oct 5, 2023

refresh

✅ Pull request refreshed

@mergify mergify bot merged commit 3fd7a2b into master Oct 5, 2023
71 checks passed
@mergify mergify bot deleted the dc-interchain-name-case branch October 5, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

addAssetToVault does not support initial lower-case asset names
4 participants