Skip to content

Expose Bridge V2 asset metadata - #29

Merged
sidhujag merged 3 commits into
masterfrom
agent/use-bridge-v2-vault
Aug 12, 2026
Merged

Expose Bridge V2 asset metadata#29
sidhujag merged 3 commits into
masterfrom
agent/use-bridge-v2-vault

Conversation

@sidhujag

@sidhujag sidhujag commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • point Syscoin SPT metadata reads at the Bridge V2 vault
  • keep legacy pre-cutover registry out of Blockbook indexing
  • preserve UTXO decimals separately from registered origin decimals
  • expose explicit assetType, originDecimals, contract, and NFT tokenId metadata in asset and account APIs
  • preserve canonical SYSX identity for the existing plaintext cache entry
  • sanitize issuer-controlled token symbols by removing control/bidirectional characters and bounding length
  • keep ERC-20 UTXO precision at eight and ERC-721/ERC-1155 precision at zero

Root cause

Blockbook still queried the legacy vault after the V2 cutover and discarded the registered origin precision when normalizing fungible UTXO SPTs to eight decimals. V2 NFTs could therefore fall back to an incorrect precision of eight, while Pali lacked the origin metadata required to validate NFT quantities and low-decimal return burns.

Impact

New Bridge V2 ERC-20, ERC-721, and ERC-1155 assets expose the metadata Pali needs without changing bridge consensus or amount accounting. SYSX behavior remains built-in and compatible with the existing cache representation.

A V2 asset metadata reindex/refresh is required after deployment; legacy assets are intentionally not indexed.

Validation

  • go test -v ./bchain/coins/sys ./api -count=1
  • git diff --check

@sidhujag
sidhujag marked this pull request as ready for review August 12, 2026 06:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2665e755b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bchain/coins/sys/nevm.go Outdated
const (
vaultManagerAddress = "0x7904299b3D3dC1b03d1DdEb45E9fDF3576aCBd5f"
// Syscoin 5 Bridge V2 registry. Legacy pre-cutover SPT metadata is not indexed.
vaultManagerAddress = "0x28bD37C0926575f2568ea8f297c0745EF16174Ab"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop retrying retired assets against V2

When a fresh index replays any pre-cutover SPT, the V2 registry intentionally has no entry, so FetchNEVMAssetDetails returns an unsupported-type error and the allocation paths store a fallback asset. However, GetAsset treats that fallback as temporary and retries the same NEVM lookup on every later input/output and API cache access (db/rocksdb_syscointype.go:301-307,325-334). Historical assets therefore create persistent RPC amplification during reindexing; select the legacy vault for pre-cutover data or negative-cache permanently retired registry entries instead.

Useful? React with 👍 / 👎.

@sidhujag sidhujag changed the title Use Bridge V2 vault for SPT metadata Expose Bridge V2 asset metadata Aug 12, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee4a693909

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/types.go
Comment on lines +295 to +297
AssetType string `json:"assetType,omitempty" ts_doc:"Origin bridge asset standard for a Syscoin SPT."`
OriginDecimals *int `json:"originDecimals,omitempty" ts_doc:"Decimals registered by the bridge for the origin asset."`
TokenID string `json:"tokenId,omitempty" ts_doc:"Origin token ID for bridged ERC721 and ERC1155 assets."`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate the public API schemas for the new token fields

When clients consume Syscoin account balances, these fields are present in the runtime JSON but absent from both the checked-in blockbook-api.ts Token interface and the Token schema in openapi.yaml, so generated clients cannot access the metadata without bypassing their types. The deploy check does not currently catch this omission because contrib/tests/run-openapi-tests.sh compares the OpenAPI schema against the already-stale checked-in TypeScript file rather than rerunning the Go typescriptify generator; update both public API artifacts alongside these fields.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 87e82e6ca7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag
sidhujag merged commit 0db2531 into master Aug 12, 2026
1 of 2 checks passed
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.

1 participant