Expose Bridge V2 asset metadata - #29
Conversation
There was a problem hiding this comment.
💡 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".
| const ( | ||
| vaultManagerAddress = "0x7904299b3D3dC1b03d1DdEb45E9fDF3576aCBd5f" | ||
| // Syscoin 5 Bridge V2 registry. Legacy pre-cutover SPT metadata is not indexed. | ||
| vaultManagerAddress = "0x28bD37C0926575f2568ea8f297c0745EF16174Ab" |
There was a problem hiding this comment.
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 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 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".
| 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."` |
There was a problem hiding this comment.
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 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
assetType,originDecimals,contract, and NFTtokenIdmetadata in asset and account APIsRoot 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=1git diff --check