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(vats): publish vbank asset list with agoricNames #6700

Merged
merged 2 commits into from
Dec 23, 2022
Merged

Conversation

dckc
Copy link
Member

@dckc dckc commented Dec 20, 2022

closes: #5762
refs: Agoric/dapp-inter#9

Description

  • add a vbankAsset entry in agoricNames
  • add an entry under it for each addAsset() call that maps denom to { brand, issuer, issuerName, denom, proposedName, displayInfo }
    • provided the optional nameAdmin arg to makeBankManager() is present

Security Considerations

claim for review: the only objects we're publishing here are brands and issuers.

Documentation Considerations

our docs on chainStorage keys / paths are kinda scattered. I suppose we can consider that in scope of #6111 rather than here.

Testing Considerations

tested manually with make scenario2-run-chain, and that before adding displayInfo support.

$ agoric follow :published.agoricNames.vbankAsset
...
[
  [
    "ubld",
    {
      brand: slot(0,"Alleged: BLD brand"),
      issuer: slot(1,"Alleged: BLD issuer"),
      issuerName: "BLD",
      proposedName: "Agoric staking token",
    },
  ],
  [
    "uist",
    {
      brand: slot(2,"Alleged: IST brand"),
      issuer: slot(3,"Alleged: IST issuer"),
      issuerName: "IST",
      proposedName: "Agoric stable local currency",
    },
  ],
]

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.

putting it under agoricNames mostly feels right, but... should it go somewhere else?

I'm sure it should go under published. The other children there are,

  • committees
  • provisionPool
  • psm
  • wallet

It clearly doesn't belong under any of those. But maybe it merits its own key, vbank?

I expect we'll take a pass through to #6111 before release.

packages/vats/src/vat-bank.js Show resolved Hide resolved
const brand = await kit.brand;
const [brand, displayInfo] = await Promise.all([
kit.brand,
E(kit.brand).getDisplayInfo(),
Copy link
Member

Choose a reason for hiding this comment

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

this is awaiting displayInfo even if it's not used. is that cheap?

Copy link
Member Author

Choose a reason for hiding this comment

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

no; it's an inter-vat round-trip. good catch. I can postpone this until I'm waiting for the settled issuer.

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... actually, if we needed a round-trip to settle kit.brand, the call to getDisplayInfo() should get pipelined rather than taking an extra round trip. But kit.brand might have been settled in the 1st place, in which case this is an extra round trip.

@samsiegart
Copy link
Contributor

Tried locally and was able to load the display infos in the UI 👍

@dckc
Copy link
Member Author

dckc commented Dec 20, 2022

... But maybe it merits its own key, vbank?

Right... that's what I was wrestling with.

Aha... it's like all the other things under agoricNames in that it's (the entries of) a NameHub, so it can be used a la lookup('agoricNames', 'vbankAsset', 'uist') from the REPL. And the contents are governed by the swingset.CoreEval big hammer (that is: not yet delegated to anything less than a BLD staker vote). So yes, I think it belongs under agoricNames.

@dckc
Copy link
Member Author

dckc commented Dec 20, 2022

@michaelfig it's currently keyed by denom. I expected to key it by name, a la agoricNames.brand and agoricNames.issuer, but I didn't see any uniqueness guarantee there in vat-bank.js. ISTR from REPL usage that there is such a constraint. Help me find it?

@dckc dckc force-pushed the 5762-vbank-rpc branch 3 times, most recently from b8ad33f to 2c32ee7 Compare December 22, 2022 23:04
@dckc dckc changed the title feat(vats): publish vbank asset list with agoricNames (WIP) feat(vats): publish vbank asset list with agoricNames Dec 22, 2022
@dckc dckc marked this pull request as ready for review December 22, 2022 23:09
@dckc dckc requested a review from turadg December 22, 2022 23:58
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 change requests but I want to understand the two issuer resolutions before approving.

@@ -319,6 +331,10 @@ export function buildRootObject() {

/**
* Add an asset to the bank, and publish it to the subscriptions.
* If nameAdmin is defined, update with denom to AssetInfo entry.
*
* Note that AssetInfo has the settled identity of the issuer,
Copy link
Member

Choose a reason for hiding this comment

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

good doc. for my understanding, is that the same as saying "has a presence of the issuer"?

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, unless the issuer was actually created in the publishing vat, in which case it would be the object itself and not a presence for it.

packages/vats/src/vat-bank.js Show resolved Hide resolved
packages/vats/src/vat-bank.js Show resolved Hide resolved
@dckc dckc added the automerge:rebase Automatically rebase updates, then merge label Dec 23, 2022
@mergify mergify bot merged commit 97f8d1d into master Dec 23, 2022
@mergify mergify bot deleted the 5762-vbank-rpc branch December 23, 2022 04:47
@michaelfig
Copy link
Member

[no apparent denom uniqueness requirement]

The requirement is enforced via:

denomToAddressUpdater.init(denom, makeStore('address'));

The .init will throw if called multiple times with the same denom.

@dckc
Copy link
Member Author

dckc commented Dec 23, 2022

@michaelfig yes, I know denom uniqueness is enforced. My question is: where is issuerName uniqueness enforced?

@michaelfig
Copy link
Member

yes, I know denom uniqueness is enforced.

Ah, sorry for misreading.

My question is: where is issuerName uniqueness enforced?

I don't see any direct enforcement of issuerName uniqueness, but besides denom, reusing the issuer is also forbidden because of brandToAssetRecord.init(brand, assetRecord); Could that be what you're remembering?

@dckc
Copy link
Member Author

dckc commented Dec 25, 2022

... reusing the issuer is also forbidden because of brandToAssetRecord.init(brand, assetRecord); Could that be what you're remembering?

ah. yes.

So denom is the only suitable string key so far. But it seems a little awkward. I wonder if we should add a uniqueness constraint on issuerName so that we can key this NameHub on issuerName instead.

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.

expose VBANK brand list via chainStorage RPC
4 participants