Skip to content

Replay-checked app refactor: comments, dead timeout paths, modules - #28

Open
oroderico wants to merge 4 commits into
display-flushfrom
app-refactor
Open

oroderico wants to merge 4 commits into
display-flushfrom
app-refactor

Conversation

@oroderico

Copy link
Copy Markdown
Owner

Four commits, all verified the same way. A new host tool, origo-replay, runs the app from a key script on a virtual clock and prints a hash of every frame. 5000 random scripts, recorded before these changes, reach 91% of the app's lines, and replay to the same frames after each commit.

  1. Replay the app from a key script. Adds the tool.
  2. Trim comments to contracts and reasons. App, renderer and tests. Code tokens are identical, checked with gcc -fpreprocessed. Several render comments described the QR layout the wrong way round and are now correct.
  3. Drop the timeout plumbing the restart made dead. wait_key never returns a timeout since Navigate with two buttons and type words on a filtered keyboard #1, so the entry screens and flows return whether the reader went on or back. Conditions that cannot happen restart through seedtool_require. The two review lists, the account and index keypads, and the three coin-flip loops are merged.
  4. Split the app into modules. app_ui.c, app_words.c, app_wallet.c, app_seed.c, with app_internal.h for what they share. Functions move unchanged; seedtool_app.c keeps the top level.

Verified with: the replay above (0 of 5000 runs differ after each commit), ctest plain and under ASan/UBSan, Python tests, 60 s fuzz, firmware built twice in espressif/idf:v5.5.4 with audit and cmp.

A host backend that feeds seedtool_run scripted keys on a virtual clock
and prints a hash of every frame, so a change to the app can be checked
to leave every screen as it was.
The app, renderer and tests explained their own history at length; keep
what a reader needs to check the code and drop how it got here. Several
render comments described the QR layout the wrong way round and are now
correct. No code changes; POLL_MS reads 10, the tick it already rounded
to.
wait_key never returns a timeout now, so the entry screens and flows lose
their third outcome and return whether the reader went on or back;
conditions that cannot happen restart through seedtool_require. Merge the
two review lists, the account and index keypads and the three coin-flip
loops. Replaying 5000 random key scripts draws the same frames before and
after.
Screen machinery, mnemonic entry, the wallet and the ways a seed is made
each get a file; app_internal.h holds what they share. Functions move
unchanged, and the 5000-script replay draws the same frames.
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