1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

feat(core): device-tests of staking chunkify

This commit is contained in:
obrusvit 2024-02-21 16:03:48 +01:00 committed by Vít Obrusník
parent e602a87c90
commit 2f77434677
10 changed files with 153 additions and 39 deletions

View File

@ -315,6 +315,14 @@
"ethereum__units_template": "{} jednotek",
"ethereum__unknown_token": "Neznámý token",
"ethereum__valid_signature": "Podpis je platný.",
"ethereum__staking_stake": "STAKE",
"ethereum__staking_stake_address": "STAKE ADDRESS",
"ethereum__staking_stake_intro": "Stake ETH on Everstake?",
"ethereum__staking_unstake": "UNSTAKE",
"ethereum__staking_unstake_intro": "Unstake ETH from Everstake?",
"ethereum__staking_claim": "CLAIM",
"ethereum__staking_claim_address": "CLAIM ADDRESS",
"ethereum__staking_claim_intro": "Claim ETH from Everstake?",
"experimental_mode__enable": "Povolit experimentální funkce?",
"experimental_mode__only_for_dev": "Pouze pro vývoj a beta testování!",
"experimental_mode__title": "EXPERIMENTÁLNÍ REŽIM",

View File

@ -315,6 +315,14 @@
"ethereum__units_template": "{} Einheiten",
"ethereum__unknown_token": "Ungültiger Token",
"ethereum__valid_signature": "Die Signatur ist gültig.",
"ethereum__staking_stake": "STAKE",
"ethereum__staking_stake_address": "STAKE ADDRESS",
"ethereum__staking_stake_intro": "Stake ETH on Everstake?",
"ethereum__staking_unstake": "UNSTAKE",
"ethereum__staking_unstake_intro": "Unstake ETH from Everstake?",
"ethereum__staking_claim": "CLAIM",
"ethereum__staking_claim_address": "CLAIM ADDRESS",
"ethereum__staking_claim_intro": "Claim ETH from Everstake?",
"experimental_mode__enable": "Experimentelle Funktionen aktivieren?",
"experimental_mode__only_for_dev": "Nur für Entwicklung und Beta-Tests.",
"experimental_mode__title": "EXPERIMENTIERMODUS",

View File

@ -315,6 +315,14 @@
"ethereum__units_template": "{} unidades",
"ethereum__unknown_token": "Token desconocido",
"ethereum__valid_signature": "La firma es válida.",
"ethereum__staking_stake": "STAKE",
"ethereum__staking_stake_address": "STAKE ADDRESS",
"ethereum__staking_stake_intro": "Stake ETH on Everstake?",
"ethereum__staking_unstake": "UNSTAKE",
"ethereum__staking_unstake_intro": "Unstake ETH from Everstake?",
"ethereum__staking_claim": "CLAIM",
"ethereum__staking_claim_address": "CLAIM ADDRESS",
"ethereum__staking_claim_intro": "Claim ETH from Everstake?",
"experimental_mode__enable": "¿Activar funciones experimentales?",
"experimental_mode__only_for_dev": "Solo para desarrollo y pruebas beta.",
"experimental_mode__title": "MODO EXPERIMENTAL",

View File

@ -315,6 +315,14 @@
"ethereum__units_template": "{} unités",
"ethereum__unknown_token": "Jeton inconnu",
"ethereum__valid_signature": "Signature valide.",
"ethereum__staking_stake": "STAKE",
"ethereum__staking_stake_address": "STAKE ADDRESS",
"ethereum__staking_stake_intro": "Stake ETH on Everstake?",
"ethereum__staking_unstake": "UNSTAKE",
"ethereum__staking_unstake_intro": "Unstake ETH from Everstake?",
"ethereum__staking_claim": "CLAIM",
"ethereum__staking_claim_address": "CLAIM ADDRESS",
"ethereum__staking_claim_intro": "Claim ETH from Everstake?",
"experimental_mode__enable": "Activer les fonct. expérimentales ?",
"experimental_mode__only_for_dev": "Uniquement pour le dév. et les tests bêta !",
"experimental_mode__title": "MODE EXPÉRIMENTAL",

View File

@ -1,9 +1,9 @@
{
"current": {
"merkle_root": "ebba747f556487944a26b19deb5910648694670f0de05f5a1569e1e12cf47ea0",
"merkle_root": "a303ffb6062b35bf2f5575ae7c50ac2113a79228c8592f5a956dfa6467661af5",
"signature": null,
"datetime": "2024-02-21T15:09:10.231125",
"commit": "4204ba14044132269dc708e3f0b0cfac3bbfd906"
"datetime": "2024-02-21T15:11:21.212950",
"commit": "e26b4099696f14297b1a23c2f284a8b2de16d6b3"
},
"history": []
}

View File

@ -29,6 +29,7 @@ from ...input_flows import (
InputFlowEthereumSignTxDataSkip,
InputFlowEthereumSignTxGoBackFromSummary,
InputFlowEthereumSignTxShowFeeInfo,
InputFlowEthereumSignTxStaking,
)
from .common import encode_network
@ -458,29 +459,12 @@ def test_signtx_data_pagination(client: Client, flow):
@pytest.mark.skip_t1("T1 does not support Everstake")
@parametrize_using_common_fixtures("ethereum/sign_tx_staking.json")
# TODO input flows to go into info screens - then also parametrizing chunkify might make sense
# @pytest.mark.parametrize("chunkify", (True, False))
def test_signtx_staking(client: Client, parameters: dict, result: dict):
with client:
sig_v, sig_r, sig_s = ethereum.sign_tx(
client,
n=parse_path(parameters["path"]),
nonce=int(parameters["nonce"], 16),
gas_price=int(parameters["gas_price"], 16),
gas_limit=int(parameters["gas_limit"], 16),
to=parameters["to_address"],
value=int(parameters["value"], 16),
data=bytes.fromhex(parameters["data"]),
chain_id=parameters["chain_id"],
tx_type=parameters["tx_type"],
definitions=None,
chunkify=False,
@pytest.mark.parametrize("chunkify", (True, False))
def test_signtx_staking(client: Client, chunkify: bool, parameters: dict, result: dict):
input_flow = InputFlowEthereumSignTxStaking(client).get()
_do_test_signtx(
client, parameters, result, input_flow=input_flow, chunkify=chunkify
)
expected_v = 2 * parameters["chain_id"] + 35
assert sig_v in (expected_v, expected_v + 1)
assert sig_r.hex() == result["sig_r"]
assert sig_s.hex() == result["sig_s"]
assert sig_v == result["sig_v"]
@pytest.mark.skip_t1("T1 does not support Everstake")

View File

@ -890,6 +890,14 @@ class InputFlowEthereumSignTxDataGoBack(InputFlowBase):
yield from self.ETH.confirm_tx()
class InputFlowEthereumSignTxStaking(InputFlowBase):
def __init__(self, client: Client):
super().__init__(client)
def input_flow_common(self) -> BRGeneratorType:
yield from self.ETH.confirm_tx_staking(info=True)
def get_mnemonic_and_confirm_success(
debug: DebugLink,
) -> Generator[None, "messages.ButtonRequest", str]:

View File

@ -365,3 +365,81 @@ class EthereumFlow:
self.debug.press_left(wait=True)
self.debug.press_left(wait=True)
self.debug.press_middle()
def confirm_tx_staking(
self,
info: bool = False,
) -> BRGeneratorType:
yield
TR.assert_equals_multiple(
self.debug.wait_layout().title(),
[
"ethereum__staking_stake",
"ethereum__staking_unstake",
"ethereum__staking_claim",
],
)
TR.assert_equals_multiple(
self.debug.wait_layout().text_content(),
[
"ethereum__staking_stake_intro",
"ethereum__staking_unstake_intro",
"ethereum__staking_claim_intro",
],
)
if self.debug.model == "T":
# confirm intro
if info:
self.debug.press_info(wait=True)
TR.assert_equals_multiple(
self.debug.wait_layout().title(),
[
"ethereum__staking_stake_address",
"ethereum__staking_claim_address",
],
)
self.debug.press_no(wait=True)
self.debug.press_yes()
yield
# confirm summary
if info:
self.debug.press_info(wait=True)
TR.assert_in(
self.debug.wait_layout().text_content(), "ethereum__gas_limit"
)
TR.assert_in(
self.debug.wait_layout().text_content(), "ethereum__gas_price"
)
self.debug.press_no(wait=True)
self.debug.press_yes()
yield
else:
# confirm intro
if info:
self.debug.press_right(wait=True)
TR.assert_equals_multiple(
self.debug.wait_layout().title(),
[
"ethereum__staking_stake_address",
"ethereum__staking_claim_address",
],
)
self.debug.press_left(wait=True)
self.debug.press_middle()
yield
# confirm summary
if info:
self.debug.press_right(wait=True)
TR.assert_in(
self.debug.wait_layout().text_content(), "ethereum__gas_limit"
)
self.debug.press_right(wait=True)
TR.assert_in(
self.debug.wait_layout().text_content(), "ethereum__gas_price"
)
self.debug.press_left(wait=True)
self.debug.press_left(wait=True)
self.debug.press_middle()
yield

View File

@ -4507,12 +4507,18 @@
"TR_en_ethereum-test_signtx.py::test_signtx_eip1559_access_list_larger": "5ec441ee292a9034c7d859f216050e7af702dcc219ed16e4ca17352ae4784c9b",
"TR_en_ethereum-test_signtx.py::test_signtx_fee_info": "b4ae728ff71c1e6112abbb0111b85b2760f957b677726b35734e63c318495408",
"TR_en_ethereum-test_signtx.py::test_signtx_go_back_from_summary": "263993daffe2a77a46a17d5b598aca84de52ba0e051e4cb5de5c524a48192ed3",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[claim_holesky]": "8381fbc4aac0431757244c7813c33abee1a3457661a71b7b8b71fb4cd319d6f8",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[claim_mainnet]": "8381fbc4aac0431757244c7813c33abee1a3457661a71b7b8b71fb4cd319d6f8",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[stake_holesky]": "856bc0275109dcf0fbac25b20916ac78f358533e41e896b299959fbc0364a240",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[stake_main]": "856bc0275109dcf0fbac25b20916ac78f358533e41e896b299959fbc0364a240",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[unstake_holesky]": "4d80581b69013423285c924d837135a2c2b09b62cf2635fdbe3a8f224511bc7e",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[unstake_main]": "4d80581b69013423285c924d837135a2c2b09b62cf2635fdbe3a8f224511bc7e",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[False-claim_holesky]": "374471ee49d29d32056b3fd8f8beeca9d253edb5d392348b5dc205fe534cd878",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[False-claim_mainnet]": "93f871429fe5e14d2fac4385d8aa506672acfeeb4d3bf54940bd729b297012bc",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[False-stake_holesky]": "722fde6b11b3ba2f854181cb62a2ce1c5a75fbf2bff184d62edbcdd3cef58ea5",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[False-stake_main]": "54108b6da25ef185f9dfc05c48036298910e2eaa60bb3b2ca8816775e8affc95",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[False-unstake_holesky]": "7ca6ef856bbd187e4770ac001e148a697cf86296e4c93c6a613eade412805dd2",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[False-unstake_main]": "631e79b78f17a3a9eb1883a845a4d269ee8ad34c3c702018e3b819712afbd915",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[True-claim_holesky]": "03ca495bc9c47fd0ec89b2936b845c4e88f3c314faa2662fb442c963e655a7f4",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[True-claim_mainnet]": "edc7490f3b9bdb55f299b18cacf7494f8ae837317dab0a3a865225ee22b1121e",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[True-stake_holesky]": "e3cfba2c7bf17b795657be2eb237bccff345f39134765b6584e61a4c17a5d9f7",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[True-stake_main]": "e37931245d719a72ce9d864eeee33cdaef8a39bf5f1a92c0dbd20f4db5bdadf6",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[True-unstake_holesky]": "f077239cae1f3bd883e7b33b37c9e4843deeffe0b36190d22e9afbbea91e2a16",
"TR_en_ethereum-test_signtx.py::test_signtx_staking[True-unstake_main]": "7be0e0cd0449625238e9cfe71c5b2e70e6252a404a8634db714fb0459cf92e3d",
"TR_en_ethereum-test_signtx.py::test_signtx_staking_bad_inputs[claim_bad_inputs_1]": "b70d9d2aa7a8ace3251763c1d2fcb53dd8c741b7520d717398df8f7ff8ac9128",
"TR_en_ethereum-test_signtx.py::test_signtx_staking_bad_inputs[stake_bad_inputs_1]": "b70d9d2aa7a8ace3251763c1d2fcb53dd8c741b7520d717398df8f7ff8ac9128",
"TR_en_ethereum-test_signtx.py::test_signtx_staking_bad_inputs[stake_bad_inputs_2]": "b70d9d2aa7a8ace3251763c1d2fcb53dd8c741b7520d717398df8f7ff8ac9128",
@ -11581,12 +11587,18 @@
"TT_en_ethereum-test_signtx.py::test_signtx_eip1559_access_list_larger": "243010310ac5a4c70c627507ea8501cc61c2e20728eb06bc796f093132bebb4f",
"TT_en_ethereum-test_signtx.py::test_signtx_fee_info": "714e4c5f6e6b45fa3e78f74c7ee5e3332f39686f8b708a4f56232105bde0c3e4",
"TT_en_ethereum-test_signtx.py::test_signtx_go_back_from_summary": "8bc38a773c40a70c1eb9b91a5d02ce0a61591ce9e42bd0073bc1395f560f2490",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[claim_holesky]": "63a2b20a46d7eb9dbe188f45286f0e19b696b4fa072743156a1f70b8c33d5dad",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[claim_mainnet]": "63a2b20a46d7eb9dbe188f45286f0e19b696b4fa072743156a1f70b8c33d5dad",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[stake_holesky]": "f24ba4c504e12ec403aa99f19f9d9c78cc513edb2b7671063033902d089d894c",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[stake_main]": "f24ba4c504e12ec403aa99f19f9d9c78cc513edb2b7671063033902d089d894c",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[unstake_holesky]": "b24d5247a866e3aa69fe3fc17eabaa210890b285e3c4b84eb253570fcc0c8bed",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[unstake_main]": "b24d5247a866e3aa69fe3fc17eabaa210890b285e3c4b84eb253570fcc0c8bed",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[False-claim_holesky]": "4b89fe403777b910e365031ff4da4ddf844d8d9385ee6d562d8582e7ef270b8d",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[False-claim_mainnet]": "a82c3762d114bf542e9753faf7c54027cfb02c0fddfb7ba914eedac69366fbfb",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[False-stake_holesky]": "afb28033e3093ee6d38266defb14bfe1ae36b727869b631e0b055694ab9097d7",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[False-stake_main]": "c4ef05473b0b238e68385cda289a26b8ecf8c86db213cc6b346a225a0f323332",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[False-unstake_holesky]": "de100f2d3c8cc88672a09795ea9324368bf2c6e5e6b5b76ee04f2b3e69a80444",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[False-unstake_main]": "0c819d43c537b170b91edd29dc1ec88b78577131c6c4a84d14de7cdc42c3042f",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[True-claim_holesky]": "207fb30e30123a92291f95b3769a217e05110ddf9f8c3446970459f2fe50b44a",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[True-claim_mainnet]": "405d4ac4856c34af5606e49a742235062b1550b4fcaec4fc4ac3ac4bbe998256",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[True-stake_holesky]": "c133a3b7addfda617ccd9401ae28a12b1681e9ce47c28ddee8ae78a3ebccbd6d",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[True-stake_main]": "e924f9c247e732fa9b727d71b844bdd734be9afcb4a26ebb74a4450153229f95",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[True-unstake_holesky]": "fac986a6b54fd0ed850fd3810df55de3dc411ebfa9520b8e51ec255bffaf0467",
"TT_en_ethereum-test_signtx.py::test_signtx_staking[True-unstake_main]": "106a4cf1f71595f65c4ed2f12b4f868ba0c5f8b6dce75805489be8e6df3f39cf",
"TT_en_ethereum-test_signtx.py::test_signtx_staking_bad_inputs[claim_bad_inputs_1]": "3b6c5cf5c6512f1491b77f895d21d2f850f774c2b9d67c1b76eaeb2892e95e6b",
"TT_en_ethereum-test_signtx.py::test_signtx_staking_bad_inputs[stake_bad_inputs_1]": "3b6c5cf5c6512f1491b77f895d21d2f850f774c2b9d67c1b76eaeb2892e95e6b",
"TT_en_ethereum-test_signtx.py::test_signtx_staking_bad_inputs[stake_bad_inputs_2]": "3b6c5cf5c6512f1491b77f895d21d2f850f774c2b9d67c1b76eaeb2892e95e6b",

2
vendor/fido2-tests vendored

@ -1 +1 @@
Subproject commit 28e177c4424820aee8a6f031474c890e5bafe72c
Subproject commit 9cfd22ef20fec2c34d0f0e5c16a5d5152da30861