Skip to content

Staging - #94

Merged
ryleedavis merged 37 commits into
rylee-tmpfrom
staging
Sep 26, 2022
Merged

ryleedavis merged 37 commits into
rylee-tmpfrom
staging

Conversation

@ryleedavis

Copy link
Copy Markdown
Contributor

No description provided.

julian-CStack and others added 7 commits September 26, 2022 12:42
# Conflicts:
#	lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart
#	lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart
#	lib/utilities/text_styles.dart
#	test/services/coins/bitcoincash/bitcoincash_wallet_test.dart
@ryleedavis
ryleedavis merged commit 8cda05f into rylee-tmp Sep 26, 2022
vsnation added a commit to vsnation/campfire-beam that referenced this pull request Oct 10, 2026
…es it

Home's token list drew every Confidential Asset as two letters on a
coloured circle, and showed the DEX liquidity tokens (cypherstack#175, cypherstack#192, cypherstack#193)
as "Unnamed asset". Their names came only from each asset's metadata,
which for a liquidity token is the contract's "Amm Liquidity Token
0-174-2", when it arrived at all.

The web wallet now uses the desktop app's catalogue, ported line for
line (lib/meta.js, lib/lookalike.js, lib/lp_tokens.js):
- verified assets show Campfire's name, ticker and icon;
- a liquidity token is named after its pool, "BEAM/FOMO LP", with
  "Pool share · 1% fee" under it and its pool's two icons. Only the DEX
  contract makes an asset a liquidity token: its pool list ships with
  the app (98 pools, cross-checked with the asset list) and every pool
  list the app reads adds newer pools, never a name;
- any other asset shows its cleaned on-chain name with its number and
  the BEAM desktop wallet's generic icon for that number, and a copy of
  a verified asset gets the desktop's warning.

Labels stay current: when metadata or a pool arrives, Home, Send, Swap,
Activity and the approval sheets all show the new name. Money screens
write an unverified ticker with its number ("5 PEPE cypherstack#94"), as the
desktop does.

The icons are the desktop app's files, byte for byte, bundled in the
signed release and never fetched (img/assets, NOTICE.txt). A unit test
pins each one here and in the desktop's folder.

asset_parity.test.mjs compares the result with the desktop's own code
for every asset on mainnet (203) and 61 edge cases, with and without
metadata: no differences. tools/asset_parity/run.mjs refreshes that
data. test/e2e/asset_icons.test.mjs checks the list in Chrome on a
throwaway mainnet wallet. Documented in the project notes, section 3f.
vsnation added a commit to vsnation/campfire-beam that referenced this pull request Oct 12, 2026
… token

Audit finding D-5. Every pools_view row taught lp_tokens.js which assets are
liquidity tokens and replaced the shipped snapshot's entry when it differed;
meta.js then named the asset after the pool ("BEAM/FOMO LP", verified, no
#id) and the pricer valued it from that same row's reserves into "Total with
tokens". One lying node could make an airdropped asset look like a large,
verified pool share.

- A row never changes a snapshot entry, nor one already confirmed.
- A learnt LP token is unconfirmed until the wallet's own asset record
  (get_asset_info) says the DEX contract created it as that pool's token:
  metadata exactly "STD:SCH_VER=1;N=Amm Liquidity Token a-b-k;SN=AmmL;
  UN=AMML;NTHUN=GROTH" and ownerId = SHA-256("bvm.a.own\0" || DEX cid ||
  SHA-256("B.AssetMeta\0" || varint(len) || metadata)), as BEAM derives a
  contract asset's owner. A second token for a pool that already has one is
  refused (the owner binds contract and text, not the number).
- Until then it is an unverified asset: page title "BEAM/FOMO LP cypherstack#94",
  amounts in "LP cypherstack#94", subtitle "Pool share · unconfirmed cypherstack#94", the generic
  icon, and the pricer does not value it as a pool share (AssetPricer
  trustLp, default lp_tokens.lpTrusted), so it stays out of the total.
- dex_pools.js asks get_asset_info for unconfirmed tokens after each pool
  read, in the background, and redraws when one is confirmed.

The derivation was checked against mainnet: a throwaway wallet-api 7.5.14493
(no funds, deleted after) listed 209 assets; all 100 LP tokens' ownerIds match
it, no other asset's does, and the snapshot agrees with all 98 it holds.

Tests: meta (owner derivation on four live records; a lying row for 175 is
ignored; an airdropped asset named BEAM/FOMO's LP stays unverified with its
number, refused with a foreign owner, another pool's record, or 175's record
copied onto it; a real newer pool (205) is confirmed; confirmLearnt), tokens
(the pricer leaves the lying row unvalued and out of the total; a confirmed
newer pool is valued). Synthetic-id pricer tests pass trustLp explicitly; the
desktop-parity pools of pools are confirmed the way a newer pool is.
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.

3 participants