feat(core): re-allow unknown Ethereum networks, using Ethereum or Testnet paths (fixes #1335)

pull/1365/head
matejcik 4 years ago committed by Tomas Susanka
parent 7abe70e484
commit 4628c774aa

@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Bump nanobp dependency to 0.4.3. [#1105]
- BIP-32 paths must now match a pre-defined path schema to be considered valid. [#1184]
- Minimum auto-lock delay to 1 minute. The former value of 10 seconds still applies for debug builds. [#1351]
- It is again possible to sign for Ethereum clones that are not officially supported. [#1335]
### Deprecated
@ -25,7 +26,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- PIVX support
### Fixed
- Path warning is not shown on `GetAddress(show_display=False)` call. [#1206]
- Settings are also erased from RAM when device is wiped. [#1322]
@ -300,6 +300,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- First public release.
[#379]: https://github.com/trezor/trezor-firmware/issues/379
[#800]: https://github.com/trezor/trezor-firmware/issues/800
[#948]: https://github.com/trezor/trezor-firmware/issues/948
[#958]: https://github.com/trezor/trezor-firmware/issues/958
[#982]: https://github.com/trezor/trezor-firmware/issues/982
@ -331,4 +332,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#1206]: https://github.com/trezor/trezor-firmware/issues/1206
[#1246]: https://github.com/trezor/trezor-firmware/issues/1246
[#1322]: https://github.com/trezor/trezor-firmware/issues/1322
[#1335]: https://github.com/trezor/trezor-firmware/issues/1335
[#1351]: https://github.com/trezor/trezor-firmware/issues/1351

@ -69,9 +69,9 @@ def _schemas_from_chain_id(msg: EthereumSignTx) -> Iterable[paths.PathSchema]:
info = networks.by_chain_id(msg.chain_id)
if info is None:
return ()
if networks.is_wanchain(msg.chain_id, msg.tx_type):
# allow Ethereum or testnet paths for unknown networks
slip44_id = (60, 1)
elif networks.is_wanchain(msg.chain_id, msg.tx_type):
slip44_id = (networks.SLIP44_WANCHAIN,)
elif info.slip44 != 60 and info.slip44 != 1:
# allow cross-signing with Ethereum unless it's testnet

@ -144,18 +144,6 @@ class TestEthereumKeychain(unittest.TestCase):
)
)
with self.assertRaises(wire.DataError):
await_result( # unknown chain_id
handler_chain_id(
wire.DUMMY_CONTEXT,
EthereumSignTx(
address_n=[44 | HARDENED, 60 | HARDENED, 0 | HARDENED],
chain_id=123456789,
),
)
)
with self.assertRaises(wire.DataError):
await_result( # chain_id and network mismatch
handler_chain_id(

@ -91,6 +91,26 @@ VECTORS_CHAIN_IDS = ( # chain_id, slip44, sig_v, sig_r, sig_s
"3bee0e5a07661e78c9c4af49c8a42f4735f80cbb82931607ac35fc78f8d5b113",
),
),
# Unknown chain id with Ethereum path
(
609112567,
60,
(
1218225170,
"0b0f20dc9202db0653a827b9dc924653bc83d67eec9e43d678e0fb6bb3eb6d9e",
"5fdbae16da0ffc4d888e915ff210393e5c7655a3c48eaffbbe97d6db428fc277",
)
),
# Unknown chain id with testnet path
(
609112567,
1,
(
1218225169,
"f699de96e886995e460e760839d4f2c7b9f1c98f2d3c108d0add4e8663a679d8",
"1447ba45be9fca42bcbf250389403245c8c1b0476e60b96dea320b0a596b5528",
)
),
)

@ -147,6 +147,8 @@
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[3-1-sig1]": "991d61006e9b5df96d7125825a7d86c96c8c4ea30a8e3dd8d12ac8795c312678",
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[3125659152-164-sig6]": "fa4957f52db037bcd9fdee74be00bee72b2efbdeeffb3cc04819123dc50e5855",
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[4-1-sig2]": "aa53c8ba48faa3ac1227b0c187d73783d47063ce130c2a58fab1dcab841fa1dd",
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[609112567-1-sig8]": "c8e01d20eccadcca4f05e4e8351c3bfc38d0fdbe4a61f63dfd74e065faea86e7",
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[609112567-60-sig7]": "c8e01d20eccadcca4f05e4e8351c3bfc38d0fdbe4a61f63dfd74e065faea86e7",
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[61-61-sig3]": "cd5f04cc7b055503e83f0538709a7ac577445c6089ead12f1fc3a3c45ad96419",
"test_msg_ethereum_signtx_eip155.py::test_with_data": "33e97436953f55bc61c5f54bd9702b1ba962c0e716d20ddbe9827be3d24ad98d",
"test_msg_ethereum_verifymessage.py-test_verify": "2c360ce34c1063cab113c521f2d77d9f312f88a971dbbd71c8891e37d37a70c1",

Loading…
Cancel
Save