Commit 3a81a54
committed
fix(tokens): fail closed when the vetted token source is missing
The firmware token table is generated by this repository: lib/firmware/
CMakeLists.txt runs ethereum_tokens.py to produce ethereum_tokens.def, and
unittests/firmware/coins.cpp reads the result.
build() checked neither that the vetted ethereum-lists source was present nor
that the scan produced anything. On an ordinary non-recursive checkout every
add_tokens() call returns early, the table serializes zero rows, "0 of 0 kept"
goes to stderr, and the firmware builds green with an empty token table -- the
device would then show raw addresses and unknown decimals for every ERC-20 it
should have recognized. Measured directly: the old path yields 0 tokens and
raises nothing; the guard now raises.
add_tokens() also returned out of the whole scan on the first entry that was
not a regular file, where os.listdir order is arbitrary. That one is latent,
not live: the currently pinned ethereum-lists has no non-file entries in any
scanned directory, and the table is 1378 tokens with or without the change.
It is corrected to `continue` so the hazard cannot arrive with a source bump.
Restores the fail-closed form that already exists on the fork develop line.
Adds the guarding regression test, which fails without this change.1 parent 6e472fc commit 3a81a54
2 files changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
61 | 75 | | |
62 | 76 | | |
63 | 77 | | |
| |||
0 commit comments