1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-03 16:56:07 +00:00

fix(common): deal with duplicity code leftovers

also fixes #2759
This commit is contained in:
matejcik 2023-02-08 12:58:42 +01:00 committed by matejcik
parent f44ef58acb
commit 168ab2944c
7 changed files with 36 additions and 64 deletions

View File

@ -66,7 +66,7 @@ Throughout the system, coins are identified by a _key_ - a colon-separated strin
generated from the coin's type and shortcut: generated from the coin's type and shortcut:
* for Bitcoin-likes, key is `bitcoin:<shortcut>` * for Bitcoin-likes, key is `bitcoin:<shortcut>`
* for Ethereum networks, key is `eth:<shortcut>` * for Ethereum networks, key is `eth:<shortcut>:<chain_id>`
* for ERC20 tokens, key is `erc20:<chain_symbol>:<token_shortcut>` * for ERC20 tokens, key is `erc20:<chain_symbol>:<token_shortcut>`
* for NEM mosaic, key is `nem:<shortcut>` * for NEM mosaic, key is `nem:<shortcut>`
* for others, key is `misc:<shortcut>` * for others, key is `misc:<shortcut>`

View File

@ -1,3 +1,11 @@
{ {
"misc:BNB": false "erc20:eth:MATIC": false,
"erc20:eth:USDT": false,
"eth:BNB:56": false,
"eth:MATIC:137": false,
"eth:tETH:3": false,
"eth:tETH:4": false,
"eth:tETH:5": false,
"misc:BNB": false,
"misc:USDT": false
} }

View File

@ -13,7 +13,7 @@
"chain_id": 3, "chain_id": 3,
"is_testnet": true, "is_testnet": true,
"name": "Ropsten", "name": "Ropsten",
"shortcut": "tROP", "shortcut": "tETH",
"slip44": 1 "slip44": 1
}, },
{ {
@ -21,7 +21,7 @@
"chain_id": 4, "chain_id": 4,
"is_testnet": true, "is_testnet": true,
"name": "Rinkeby", "name": "Rinkeby",
"shortcut": "tRIN", "shortcut": "tETH",
"slip44": 1 "slip44": 1
}, },
{ {
@ -29,7 +29,7 @@
"chain_id": 5, "chain_id": 5,
"is_testnet": true, "is_testnet": true,
"name": "Görli", "name": "Görli",
"shortcut": "tGOR", "shortcut": "tETH",
"slip44": 1 "slip44": 1
}, },
{ {

View File

@ -160,12 +160,6 @@
"decimals": 18, "decimals": 18,
"name": "Aave", "name": "Aave",
"shortcut": "AAVE" "shortcut": "AAVE"
},
{
"address": "0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0",
"decimals": 18,
"name": "EOS",
"shortcut": "EOS"
} }
], ],
"56;bnb": [ "56;bnb": [

View File

@ -45,7 +45,7 @@
"bitcoin:tFIRO": true, "bitcoin:tFIRO": true,
"bitcoin:tLTC": true, "bitcoin:tLTC": true,
"bitcoin:tPPC": true, "bitcoin:tPPC": true,
"eth:tROP": true, "eth:tETH:3": true,
"misc:ADA": true, "misc:ADA": true,
"misc:BNB": true, "misc:BNB": true,
"misc:EOS": true, "misc:EOS": true,
@ -77,7 +77,7 @@
"bitcoin:TEST": true, "bitcoin:TEST": true,
"bitcoin:VTC": true, "bitcoin:VTC": true,
"bitcoin:ZEC": true, "bitcoin:ZEC": true,
"eth:tROP": true, "eth:tETH:3": true,
"misc:XRP": true, "misc:XRP": true,
"misc:tXRP": true "misc:tXRP": true
}, },
@ -149,7 +149,6 @@
"erc20:eth:CHZ": "1.11.3", "erc20:eth:CHZ": "1.11.3",
"erc20:eth:CRO": "1.11.3", "erc20:eth:CRO": "1.11.3",
"erc20:eth:DAI": "1.11.3", "erc20:eth:DAI": "1.11.3",
"erc20:eth:EOS": "1.11.3",
"erc20:eth:FRAX": "1.11.3", "erc20:eth:FRAX": "1.11.3",
"erc20:eth:FTT": "1.11.3", "erc20:eth:FTT": "1.11.3",
"erc20:eth:LEO": "1.11.3", "erc20:eth:LEO": "1.11.3",
@ -166,13 +165,13 @@
"erc20:eth:USDT": "1.11.3", "erc20:eth:USDT": "1.11.3",
"erc20:eth:WBTC": "1.11.3", "erc20:eth:WBTC": "1.11.3",
"erc20:eth:XCN": "1.11.3", "erc20:eth:XCN": "1.11.3",
"eth:BNB": "1.11.3", "eth:BNB:56": "1.11.3",
"eth:ETC": "1.11.3", "eth:ETC:61": "1.11.3",
"eth:ETH": "1.11.3", "eth:ETH:1": "1.11.3",
"eth:MATIC": "1.11.3", "eth:MATIC:137": "1.11.3",
"eth:tGOR": "1.11.3", "eth:tETH:3": "1.6.2",
"eth:tRIN": "1.11.3", "eth:tETH:4": "1.11.3",
"eth:tROP": "1.6.2", "eth:tETH:5": "1.11.3",
"misc:MAID": "1.7.2", "misc:MAID": "1.7.2",
"misc:OMNI": "1.7.2", "misc:OMNI": "1.7.2",
"misc:USDT": "1.7.2", "misc:USDT": "1.7.2",
@ -265,7 +264,6 @@
"erc20:eth:CHZ": "2.5.3", "erc20:eth:CHZ": "2.5.3",
"erc20:eth:CRO": "2.5.3", "erc20:eth:CRO": "2.5.3",
"erc20:eth:DAI": "2.5.3", "erc20:eth:DAI": "2.5.3",
"erc20:eth:EOS": "2.5.3",
"erc20:eth:FRAX": "2.5.3", "erc20:eth:FRAX": "2.5.3",
"erc20:eth:FTT": "2.5.3", "erc20:eth:FTT": "2.5.3",
"erc20:eth:LEO": "2.5.3", "erc20:eth:LEO": "2.5.3",
@ -282,13 +280,13 @@
"erc20:eth:USDT": "2.5.3", "erc20:eth:USDT": "2.5.3",
"erc20:eth:WBTC": "2.5.3", "erc20:eth:WBTC": "2.5.3",
"erc20:eth:XCN": "2.5.3", "erc20:eth:XCN": "2.5.3",
"eth:BNB": "2.5.3", "eth:BNB:56": "2.5.3",
"eth:ETC": "2.5.3", "eth:ETC:61": "2.5.3",
"eth:ETH": "2.5.3", "eth:ETH:1": "2.5.3",
"eth:MATIC": "2.5.3", "eth:MATIC:137": "2.5.3",
"eth:tGOR": "2.5.3", "eth:tETH:3": "2.0.7",
"eth:tRIN": "2.5.3", "eth:tETH:4": "2.5.3",
"eth:tROP": "2.0.7", "eth:tETH:5": "2.5.3",
"misc:ADA": "2.0.8", "misc:ADA": "2.0.8",
"misc:BNB": "2.1.5", "misc:BNB": "2.1.5",
"misc:EOS": "2.1.1", "misc:EOS": "2.1.1",

View File

@ -31,8 +31,7 @@ Used to query and manage info in `support.json`. This mainly supports the releas
The following commands are available: The following commands are available:
* **`check`**: check validity of json data. Used in CI. * **`check`**: check validity of json data. Used in CI.
* **`fix`**: fix expected problems: prune keys without associated coins and ensure * **`fix`**: prune keys without associated coins.
that ERC20 tokens are correctly entered as duplicate.
* **`show`**: keyword-search for a coin and show its support status for each device. * **`show`**: keyword-search for a coin and show its support status for each device.
* **`set`**: set support data. * **`set`**: set support data.
* **`release`**: perform the [release workflow](#release-workflow). * **`release`**: perform the [release workflow](#release-workflow).
@ -82,7 +81,7 @@ fee.
# Release Workflow # Release Workflow
This entails collecting information on coins whose support status is unknown and This entails collecting information on coins whose support status is unknown and
including new Ethereum chains and ERC20 tokens. bumping timestamp of external definitions <??? TODO>.
## Maintaining Support Status ## Maintaining Support Status
@ -110,10 +109,6 @@ misc:ONT - Ontology (ONT)
Afterwards, review and commit changes to `defs/support.json`, and update the `trezor-common` Afterwards, review and commit changes to `defs/support.json`, and update the `trezor-common`
submodule in your target firmware. submodule in your target firmware.
ERC20 tokens in _unknown_ state are considered _soon_ as well, unless their symbols
are duplicates. Use `support.py fix` to synchronize duplicate status in `support.json` file.
Or mark them as unsupported explicitly.
## Releasing a new firmware ## Releasing a new firmware
#### **Step 1:** run the release script #### **Step 1:** run the release script
@ -122,29 +117,10 @@ Or mark them as unsupported explicitly.
./tools/release.sh ./tools/release.sh
``` ```
All currently known unreleased ERC20 tokens are automatically set to the given version.
**_Note that "soon" feature was already removed and following paragraph is deprecated._**
_All coins marked _soon_ are set to the current version. This is automatic - coins that
were marked _soon_ were used in code generation and so should be released. If you want
to avoid this, you will have to manually revert each coin to _soon_ status, either with
`support.py set`, or by manually editing `support.json`._
Coins in state _unknown_, i.e., coins that are known in the definitions but not listed Coins in state _unknown_, i.e., coins that are known in the definitions but not listed
in support files, will be also added. But you will be interactively asked to confirm in support files, will be interactively added one by one. To avoid that, run `support.py
each one. Use `-y` or `--add-all` to auto-add all of them. release -y` separately.
Use `-n` or `--dry-run` to see changes without writing them to `support.json`. Use
`-v` or `--verbose` to also show ERC20 tokens which are processed silently by default.
Use `-g` or `--git-tag` to automatically tag the current `HEAD` with a version, e.g.,
`trezor2-2.1.0`. This might become default in the future.
XXX this should also commit the changes though, otherwise the tag will apply to the wrong
commit.
#### **Step 2:** review and commit your changes #### **Step 2:** review and commit your changes
Use `git diff` to review changes made, commit and push. If you tagged the commit in the Use `git diff` to review changes made, commit and push.
previous step, don't forget to `git push --tags` too.

View File

@ -3,7 +3,6 @@ from __future__ import annotations
import json import json
import logging import logging
import os
import re import re
from collections import OrderedDict, defaultdict from collections import OrderedDict, defaultdict
from pathlib import Path from pathlib import Path
@ -371,11 +370,8 @@ def _load_builtin_ethereum_networks() -> Coins:
chains_data = load_json("ethereum", "networks.json") chains_data = load_json("ethereum", "networks.json")
networks: Coins = [] networks: Coins = []
for chain_data in chains_data: for chain_data in chains_data:
chain_data.update( chain_data["key"] = f"eth:{chain_data['shortcut']}:{chain_data['chain_id']}"
chain_id=chain_data["chain_id"],
key=f"eth:{chain_data['shortcut']}",
# is_testnet is present in the JSON # is_testnet is present in the JSON
)
networks.append(cast(Coin, chain_data)) networks.append(cast(Coin, chain_data))
return networks return networks