Skip to content

Updated registry integration to utilize v2 functionality. - #250

Open
Randy808 wants to merge 1 commit into
Blockstream:new-indexfrom
Randy808:registry-v2-integration
Open

Updated registry integration to utilize v2 functionality.#250
Randy808 wants to merge 1 commit into
Blockstream:new-indexfrom
Randy808:registry-v2-integration

Conversation

@Randy808

@Randy808 Randy808 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

The GET /assets/registry response still includes all the fields before but this PR adds a registry property to it. The registry.rs file was also changed to pull information from the service instead of from the asset cache made from the git registry.

The added registry property takes the following shape:

{
    "asset_id": "<asset-id>",
    "contract": {
      "entity": {
        "domain": "example.com"
      },
      "name": "Registry Asset",
      "precision": 8,
      "ticker": "REG",
      "version": 1,
      "custom_contract_field": "preserved"
    },
    "initial_issuer_pubkey": "<pubkey>",
    "initial_issuer_pubkey_source": "contract",
    "current_issuer_pubkey": "<pubkey>",
    "issuer_pubkey_history": [],
    "mutable": {
      "category_tags": [
        "stablecoin"
      ]
    },
    "admin": {
      "featured": true
    },
    "icon": {
      "href": "https://registry.example/v2/assets/<asset-id>/icon/<hash>.png"
    },
    "status": "active",
    "created_at": "2026-01-01T00:00:00Z",
    "updated_at": "2026-01-02T00:00:00Z"
  }

Comment thread src/elements/registry.rs Outdated
Comment thread src/elements/registry.rs
Comment thread src/elements/registry.rs Outdated
Comment thread src/elements/registry.rs Outdated
@Randy808
Randy808 force-pushed the registry-v2-integration branch 2 times, most recently from d6253e8 to 6a734f0 Compare August 20, 2026 20:50
@Randy808
Randy808 marked this pull request as ready for review August 20, 2026 20:50
@philippem

Copy link
Copy Markdown
Collaborator

Some review analysis comments:

  1. contract is no longer a faithful passthrough — this breaks contract-hash verification.

registry.rs:502 types the contract and from_registry_asset re-serializes it via serde_json::to_value. But the optional fields have #[serde(default)] without skip_serializing_if:

#[serde(default)] pub ticker: Option,
#[serde(default)] pub initial_issuer_pubkey: Option,
#[serde(default)] pub issuer_pubkey: Option,

An absent ticker round-trips to an explicit "ticker": null. Previously AssetMeta.contract was a raw JsonValue passed through untouched (6a734f0^:src/elements/registry.rs:124).

A Liquid asset ID commits to the contract bytes. Any client verifying that the asset ID matches the returned contract now computes a different hash for every asset whose contract omits an
optional field. AssetMeta's own fields use skip_serializing_if — the pattern just wasn't applied one struct down.

  1. One missing local asset 503s the entire /assets/registry page.

.ok_or(RegistryError::MissingLocalAsset(asset_id))?

collected into Result<Vec<_>, _>, so a single registry entry absent from the local index fails the whole listing. The old code had the same shape, but the old asset DB was local and synced
alongside — registry and index moved together. Now they're independently versioned services, so this fires whenever the registry is ahead: during initial sync, after a reindex, or on an
asset issued minutes ago.

MissingLocalAsset also maps to 503, which advertises "retry later" for a condition that may never resolve. Skip the entry (or return it registry-only) rather than failing the page.

@Randy808
Randy808 force-pushed the registry-v2-integration branch from 6a734f0 to 3781bf9 Compare August 21, 2026 20:54
@Randy808

Copy link
Copy Markdown
Collaborator Author

Updated branch to no longer serialize missing contract fields with null (if not explicitly present and set to null in the registry), and to skip unavailable registry entries instead of returning a 503

@Randy808
Randy808 force-pushed the registry-v2-integration branch from 3781bf9 to fcd90fd Compare August 24, 2026 20:05
Comment thread src/new_index/query.rs Outdated
Comment thread src/elements/registry.rs Outdated
@Randy808
Randy808 force-pushed the registry-v2-integration branch from fcd90fd to f81c949 Compare September 2, 2026 18:14
agoodminute
agoodminute previously approved these changes Sep 3, 2026

@EddieHouston EddieHouston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Automated GPT 5.6-sol re-review of this PR (medium depth). 15 findings, inline below.
Summary of blocking ones to address before merge:

Blocking

  1. registry.rs — a Fetching cache entry whose spawned task dies is never evicted and receiver.await has no timeout, so that asset id is poisoned for the process lifetime and every later request for it hangs a connection.
  2. rest.rs — a registry outage now returns 200 with precision/name/ticker silently absent. A consumer defaulting a missing precision to 0 shows 1.5 units as 150000000; the old on-disk path could not produce that.
  3. registry.rs — 16 permits with try_acquire (reject, no queue) plus a 1s TTL and no negative caching: metadata drops out non-deterministically under ordinary concurrency, and a slow registry becomes a permanent 16-in-flight herd with each request paying the full 5s timeout.

Worth fixing before merge

  1. The raw RegistryError string — including the registry URL and any embedded credentials — is written into the public response body.
  2. --asset-db-path is deleted with no alias or deprecation, so existing command lines fail at startup.

The rest are a pagination edge case, the no-store vs max-age=10 split between /asset/:id and its supply sibling, a panic on invalid config, a test that can hang the binary, and cleanup items.

Comment thread src/elements/registry.rs Outdated
Comment thread src/rest.rs Outdated
Comment thread src/elements/registry.rs Outdated
Comment thread src/elements/registry.rs Outdated
Comment thread src/elements/registry.rs Outdated
Comment thread tests/rest.rs
Comment thread src/elements/registry.rs Outdated
Comment thread src/rest.rs Outdated
Comment thread src/elements/registry.rs Outdated
Comment thread src/elements/registry.rs Outdated
@Randy808
Randy808 force-pushed the registry-v2-integration branch from d0f5f69 to 501da7a Compare September 4, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants