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

bidirectional lookup of denoms / brands for IBC #9211

Closed
Tracked by #8863
turadg opened this issue Apr 9, 2024 · 4 comments · Fixed by #9754 or #9983
Closed
Tracked by #8863

bidirectional lookup of denoms / brands for IBC #9211

turadg opened this issue Apr 9, 2024 · 4 comments · Fixed by #9754 or #9983
Assignees
Labels
enhancement New feature or request

Comments

@turadg
Copy link
Member

turadg commented Apr 9, 2024

What is the Problem Being Solved?

#8879 manages IBC paths but developers need a way to establish a correspondence between a denom and its issuing chain, and optionally an ERTP Brand.

Description of the Design

  • Treat channel info as immutable
  • We provide a lookup service to get the info for a particular chain
  • The set is append-only (the value for a particular chain name is immutable)
  • The right to append is held only by BLD Stakers
  • If a developer needs the info before it’s on-chain (between staker votes) they look it up through some other trusted source (e.g. Google for the chain’s docs)

With the above requirements we landed on each contract having a ChainHub. That can load from agoricNames and/or be filled manually by contract code.

Security Considerations

Scaling Considerations

Test Plan

getBrandInfo works with ChainHub (done in #9754)

All exos look up denoms using ChainHub

Not in scope: filling ChainHub using agoricNames, which is

Upgrade Considerations

not yet deployed but needs an upgrade test

@turadg turadg added the enhancement New feature or request label Apr 9, 2024
@turadg turadg self-assigned this Apr 9, 2024
@dckc
Copy link
Member

dckc commented Apr 12, 2024

@dckc
Copy link
Member

dckc commented May 3, 2024

btw "petname" is a bit of a stretch here. It suggests that each person can have their own name for the tokens and that the names can be changed. I suppose those are true from the perspective of the BLD stakers as one aggregate "person", but... it's a stretch.

@dckc
Copy link
Member

dckc commented May 3, 2024

"well known name handling" might be better

@turadg turadg changed the title pet name handling for IBC denoms well known name handling for IBC denoms May 5, 2024
0xpatrickdev added a commit that referenced this issue May 6, 2024
@aj-agoric aj-agoric assigned dckc and unassigned turadg May 28, 2024
mergify bot added a commit that referenced this issue Jul 12, 2024
refs: #9211

## Description

Prototyping for #9211 suggests we'll want to be [derive IBC denoms](https://tutorials.cosmos.network/tutorials/6-ibc-dev/#how-are-ibc-denoms-derived) using a hash of a path such as `transfer/channel-0/uatom` -> `ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2`.

I tried to use the sha256 function from `@cosmjs/crypto`, but I got error's about node's `crypto` module. `@cosmjs/crypto` imports an old version of `@noble/hashes`. The current version seems to be vat-safe.

### Scaling Considerations

Compute performance: Doing a sha256 computation on XS in pure JS seems a little whacky. We could consider dropping down to C like we do for base64. But since this is a constant time operation, it doesn't seem worthwhile.

Bundle size: A base64 encoded bundle with just this module seems to be around 500k.

```
┌──────────────────────────────┬────────┐
│           (index)            │ Values │
├──────────────────────────────┼────────┤
│ @agoric/orchestration-v0.1.0 │  1702  │
│     @noble/hashes-v1.4.0     │ 18820  │
└──────────────────────────────┴────────┘
total size: 36623
```

### Security Considerations

supply chain: this adds a dependency on the current [@noble/hashes](https://www.npmjs.com/package/@noble/hashes), which is reasonably popular (3m weekly downloads) and seems to be well audited.

### Documentation Considerations

I'm not sure where this shows up in the orchestration API yet.

### Testing Considerations

A test that it works in a compartment is included.

### Upgrade Considerations

Unrelated to any deployed code.
@mergify mergify bot closed this as completed in #9754 Jul 26, 2024
mergify bot added a commit that referenced this issue Jul 26, 2024
closes #9211

## Description

  - feat: chainHub.registerAsset / lookupAsset
  - feat: Orchestrator.getBrandInfo
    - getChain() is now backed by a store
  - groundwork for asset info in agoricNames  - #9752

### Testing Considerations

unit tests cover happy path.

Low code-complexity doesn't seem to merit more.

### Security / Scaling Considerations

none, AFAICT

### Documentation Considerations

make `getBrandInfo()` work as documented, provided assets are registered with the ChainHub

### Upgrade Considerations

not yet deployed
0xpatrickdev added a commit that referenced this issue Aug 9, 2024
- still does not support brand lookups (see #9211)
- throws error if a brand is provided instead of warning in the console
- moves bondDenom check to delegate method to preserve functionality
- also includes this helper on LocalOrchestrationAccount
0xpatrickdev added a commit that referenced this issue Aug 9, 2024
- still does not support brand lookups (see #9211)
- throws error if a brand is provided instead of warning in the console
- moves bondDenom check to delegate method to preserve functionality
- also includes this helper on LocalOrchestrationAccount
0xpatrickdev added a commit that referenced this issue Aug 9, 2024
- still does not support brand lookups (see #9211)
- throws error if a brand is provided instead of warning in the console
- moves bondDenom check to delegate method to preserve functionality
- also includes this helper on LocalOrchestrationAccount
@turadg
Copy link
Member Author

turadg commented Aug 26, 2024

Reopening until the "#9211" comments (8 files) are resolved.

@turadg turadg reopened this Aug 26, 2024
kriskowal pushed a commit that referenced this issue Aug 27, 2024
- still does not support brand lookups (see #9211)
- throws error if a brand is provided instead of warning in the console
- moves bondDenom check to delegate method to preserve functionality
- also includes this helper on LocalOrchestrationAccount
@turadg turadg changed the title well known name handling for IBC denoms bidirectional lookup of denoms / brands for IBC Aug 28, 2024
@turadg turadg assigned turadg and unassigned dckc Aug 28, 2024
@mergify mergify bot closed this as completed in #9983 Aug 30, 2024
@mergify mergify bot closed this as completed in 42d1d4f Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants