Skip to content

feat: render byte sequence call args as text or hex instead of per-byte cards#2549

Open
stepanLav wants to merge 3 commits into
masterfrom
feat/byte-sequences-as-text-or-hex
Open

feat: render byte sequence call args as text or hex instead of per-byte cards#2549
stepanLav wants to merge 3 commits into
masterfrom
feat/byte-sequences-as-text-or-hex

Conversation

@stepanLav

@stepanLav stepanLav commented Jun 11, 2026

Copy link
Copy Markdown
Member

Purpose

With the metadata-proof parsing flow (payload types 06/07), Vec<u8> call arguments are rendered as one numeric card per byte. A system.remarkWithEvent remark turns into a screen-long column of decimal numbers (123, 34, 107, …) that is impossible to review before signing.

The legacy decoder (decoding_sci.rs) already special-cases remark/remark_with_event fields and shows them as a single text card — this behavior was lost when call decoding moved to the state-machine parser.

Scope

  • rust/parser/src/state_machine.rs — byte sequences (Vec<u8>) now collapse into a single card in visit_sequence: UTF-8 text when the current state expects text, 0x… hex otherwise (also a fallback for non-UTF-8 "text" bytes). Added a minimal U8Collector visitor to drain the bytes without producing per-byte cards.
  • rust/parser/src/state.rs — new TextState and a State::expects_text() hook; the default process_field enters TextState for fields named remark/remark_with_event, mirroring the legacy decoder rule.
  • rust/parser/src/tests.rs — three new tests: remark rendered as text, invalid-UTF-8 remark rendered as hex, non-remark byte sequence (e.g. system.set_code) rendered as a single hex card.

No UI changes needed: ParserCard::Text already maps to TextCard and is rendered by both apps.

Discussion

  • Hex (not per-byte) was chosen as the generic Vec<u8> rendering: a single 0xdeadbeef line is reviewable and matches how other tools display byte blobs. Text rendering is deliberately limited to remark-like fields to avoid content-sniffing on a signing device.
  • The legacy decoding path is untouched, so old QR payload types behave exactly as before.

Screenshots

Before: system.remarkWithEvent remark shown as a column of decimal byte values, one row per byte.

Screenshot IMG_2398

After:

Screenshot IMG_2397

- Ignore 6 new RUSTSEC advisories (bytes, libsecp256k1, rustls-webpki,
  time) in deny.toml following the existing transitive-dependency
  convention; these come from substrate/subxt/jsonrpsee and have no
  upgrade path available yet.
- Fix real spelling typos in docs/comments (particular, cryptographic,
  Polkadot.js, running, uninitiated).
- Add missing domain/code terms to the spellcheck dictionary.

Verified locally with cargo-spellcheck 0.15.7 (matching CI): exit 0.
@stepanLav stepanLav force-pushed the feat/byte-sequences-as-text-or-hex branch from eea0eee to 5f35539 Compare June 22, 2026 12:56
Xcode runs script phases with a minimal PATH that excludes Homebrew's
bin dir (/opt/homebrew/bin on Apple Silicon), so 'which swiftformat'
failed even when installed. The script then fell into a brittle
install/symlink branch and ended with an 'echo error:' while exiting 0,
producing the 'Failed to install SwiftFormat' error and the spurious
'PhaseScriptExecution emitted errors but did not return a nonzero exit
code' message.

Prepend Homebrew paths to PATH, drop the Homebrew-bootstrap and symlink
hacks, and downgrade the not-installed case to a warning.
@stepanLav stepanLav requested review from ERussel and valentunn June 23, 2026 07:25
@stepanLav stepanLav marked this pull request as ready for review June 23, 2026 07:25
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