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

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.

2 participants