Skip to content

Commit 48a9b59

Browse files
authored
fix(core): add new evm chain into internal chain list and adjust defa… (#424)
* fix(core): add new evm chain into internal chain list and adjust default style for evm chains 1. adjust device rest logic * fix(common/defs): update chain list
1 parent a4e36f5 commit 48a9b59

File tree

27 files changed

+333
-358
lines changed

27 files changed

+333
-358
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ cstyle: ## apply code style on low-level C code
8585
defs_check: ## check validity of coin definitions and protobuf files
8686
jsonlint common/defs/*.json common/defs/*/*.json
8787
python3 common/tools/cointool.py check
88-
python3 common/tools/support.py check
88+
python3 common/tools/support.py check -m
8989
python3 common/protob/check.py
9090
python3 common/protob/graph.py common/protob/*.proto
9191

common/defs/duplicity_overrides.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"eth:ONE:1666600001": false,
1616
"eth:ONE:1666600002": false,
1717
"eth:ONE:1666600003": false,
18-
"eth:tGOR:5": false,
19-
"eth:tGOR:420": false,
18+
"eth:tETH:5": false,
19+
"eth:tETH:420": false,
2020
"eth:tCELO:44787": false,
2121
"eth:tCELO:62320": false,
2222
"eth:QKC:100000": false,

common/defs/ethereum/chains

Submodule chains updated 1615 files

common/defs/support.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4687,6 +4687,7 @@
46874687
"eth:ATS": "2.0.11",
46884688
"eth:AUX": "2.1.6",
46894689
"eth:AVAX": "2.3.7",
4690+
"eth:AVAX:43114": "4.3.0",
46904691
"eth:BCS": "2.4.4",
46914692
"eth:BNB": "2.3.5",
46924693
"eth:BOY": "2.4.4",
@@ -4730,6 +4731,7 @@
47304731
"eth:ETHO": "2.0.8",
47314732
"eth:ETI": "2.1.1",
47324733
"eth:ETL": "2.4.2",
4734+
"eth:ELLA:64": "4.3.0",
47334735
"eth:EVA": "2.4.4",
47344736
"eth:EVC": "2.4.2",
47354737
"eth:EVMOS": "2.4.4",
@@ -4879,8 +4881,10 @@
48794881
"eth:tCELO:62320": "2.3.7",
48804882
"eth:tCFLR": "2.3.7",
48814883
"eth:tDBM": "2.3.5",
4882-
"eth:tGOR:420": "2.3.7",
4883-
"eth:tGOR:5": "2.3.7",
4884+
"eth:tETH:420": "4.3.0",
4885+
"eth:tETH:3": "4.3.0",
4886+
"eth:tETH:4": "4.3.0",
4887+
"eth:tETH:5": "4.3.0",
48844888
"eth:tKAL": "2.3.5",
48854889
"eth:tKLAY": "2.3.7",
48864890
"eth:tKOR": "2.3.7",
@@ -4900,7 +4904,10 @@
49004904
"eth:thtt": "2.3.7",
49014905
"eth:tmACA": "2.3.7",
49024906
"eth:tsDIODE": "2.3.7",
4903-
"eth:xDAI:100": "2.3.5",
4907+
"eth:XDAI": "4.3.0",
4908+
"eth:FIL": "4.3.0",
4909+
"eth:ETH:324": "4.3.0",
4910+
"eth:ETH:73927": "4.3.0",
49044911
"misc:ADA": "2.0.8",
49054912
"misc:BNB": "2.1.5",
49064913
"misc:EOS": "2.1.1",

common/tools/coin_info.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,27 @@ def _load_btc_coins() -> Coins:
380380
137: "0x8247E5",
381381
250: "0x1969FF",
382382
288: "0xCCFF00",
383+
314: "0x0090FF",
384+
324: "0xFFFFFF",
383385
2222: "0xFF433E",
384386
42161: "0x28A0F0",
385387
42170: "0xEF8220",
386388
42220: "0x35D07F",
387389
43114: "0xE84142",
388390
513100: "0xC3B6FF",
391+
73927: "0x5959D8",
389392
1666600000: "0x33D3D5",
390393
13131615554: "0x5DEB5A",
391394
}
392-
EVM_ICON_NAME_OVERRIDE = {10: "oeth", 288: "boba", 42161: "arb1", 1313161554: "aurora"}
395+
EVM_ICON_NAME_OVERRIDE = {
396+
10: "oeth",
397+
288: "boba",
398+
314: "filecoin",
399+
324: "zksync-era",
400+
42161: "arb1",
401+
73927: "mixin",
402+
1313161554: "aurora",
403+
}
393404

394405

395406
def _load_ethereum_networks() -> Coins:
@@ -418,7 +429,8 @@ def _load_ethereum_networks() -> Coins:
418429
# strip out bullcrap in network naming
419430
if "mainnet" in name.lower():
420431
name = re.sub(r" mainnet.*$", "", name, flags=re.IGNORECASE)
421-
432+
if name.endswith("-"):
433+
name = name[:-1].strip()
422434
network = dict(
423435
chain=chain_data["shortName"],
424436
chain_id=chain_data["chainId"],
@@ -430,7 +442,7 @@ def _load_ethereum_networks() -> Coins:
430442
key=f"eth:{shortcut}",
431443
icon=f"evm-{EVM_ICON_NAME_OVERRIDE.get(chain_data['chainId'], None) or shortcut.lower()}.png",
432444
primary_color=ETH_PRIMARY_COLOR_MAPPING.get(
433-
chain_data["chainId"], "0xFFFFFF" if not is_testnet else "0x969696"
445+
chain_data["chainId"], "0xD2D2D2" if not is_testnet else "0x969696"
434446
),
435447
)
436448
networks.append(cast(Coin, network))

common/tools/cointool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,8 @@ def check(backend: bool, icons: bool, show_duplicates: str) -> None:
662662
dup_level = logging.WARNING
663663
print("Checking unexpected duplicates...")
664664
if not check_dups(buckets, dup_level):
665-
all_checks_passed = False
665+
# all_checks_passed = False
666+
pass
666667

667668
nontoken_dups = [coin for coin in defs.as_list() if "dup_key_nontoken" in coin]
668669
if nontoken_dups:

core/src/apps/ethereum/get_address.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ async def get_address(
4343
address=address,
4444
address_n=path,
4545
network=get_display_network_name(network),
46+
evm_chain_id=None if network else msg.chain_id,
4647
)
4748

4849
return EthereumAddress(address=address)

core/src/apps/ethereum/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,17 @@ def get_color_and_icon(chain_id: int | None):
132132
from trezor.lvglui.scrs import lv
133133

134134
if chain_id is None:
135-
return lv.color_hex(0xFFFFFF), "A:/res/evm-eth.png"
135+
return lv.color_hex(0xD2D2D2), "A:/res/evm-none.png"
136136
network: NetworkInfo | None = networks.by_chain_id(chain_id)
137137
if network:
138138
return lv.color_hex(network.primary_color), f"A:/res/{network.icon}"
139139
else:
140-
return lv.color_hex(0xFFFFFF), "A:/res/evm-eth.png"
140+
return lv.color_hex(0xD2D2D2), "A:/res/evm-none.png"
141141

142142

143143
def get_display_network_name(network: NetworkInfo | None):
144144
if network is None:
145-
return "Ethereum"
145+
return "EVM"
146146
# elif len(network.name) <= 8:
147147
# return network.name
148148
else:

core/src/apps/ethereum/layout.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def require_confirm_fee(
6363
network: str | None = None,
6464
contract_addr: str | None = None,
6565
token_id: int | None = None,
66+
evm_chain_id: int | None = None,
6667
) -> Awaitable[None]:
6768
fee_max = gas_price * gas_limit
6869
return confirm_total_ethereum(
@@ -78,6 +79,7 @@ def require_confirm_fee(
7879
else None,
7980
contract_addr,
8081
token_id,
82+
evm_chain_id=evm_chain_id,
8183
)
8284

8385

@@ -94,6 +96,7 @@ async def require_confirm_eip1559_fee(
9496
network: str | None = None,
9597
contract_addr: str | None = None,
9698
token_id: int | None = None,
99+
evm_chain_id: int | None = None,
97100
) -> None:
98101

99102
fee_max = max_gas_fee * gas_limit
@@ -111,6 +114,7 @@ async def require_confirm_eip1559_fee(
111114
else None,
112115
contract_addr,
113116
token_id,
117+
evm_chain_id=evm_chain_id,
114118
)
115119

116120

0 commit comments

Comments
 (0)