Ragger tests fix
Also lower the EIP-712 autonext delay but slow it down for golden runs
@@ -23,6 +23,7 @@ def default_handler():
|
||||
|
||||
|
||||
autonext_handler: Callable = default_handler
|
||||
is_golden_run: bool
|
||||
|
||||
|
||||
# From a string typename, extract the type and all the array depth
|
||||
@@ -394,6 +395,12 @@ def enable_autonext():
|
||||
delay = 1/3
|
||||
else:
|
||||
delay = 1/4
|
||||
|
||||
# golden run has to be slower to make sure we take good snapshots
|
||||
# and not processing/loading screens
|
||||
if is_golden_run:
|
||||
delay *= 3
|
||||
|
||||
signal.setitimer(signal.ITIMER_REAL, delay, delay)
|
||||
|
||||
|
||||
@@ -404,10 +411,12 @@ def disable_autonext():
|
||||
def process_data(aclient: EthAppClient,
|
||||
data_json: dict,
|
||||
filters: Optional[dict] = None,
|
||||
autonext: Optional[Callable] = None) -> bool:
|
||||
autonext: Optional[Callable] = None,
|
||||
golden_run: bool = False) -> bool:
|
||||
global sig_ctx
|
||||
global app_client
|
||||
global autonext_handler
|
||||
global is_golden_run
|
||||
|
||||
# deepcopy because this function modifies the dict
|
||||
data_json = copy.deepcopy(data_json)
|
||||
@@ -422,6 +431,8 @@ def process_data(aclient: EthAppClient,
|
||||
autonext_handler = autonext
|
||||
signal.signal(signal.SIGALRM, next_timeout)
|
||||
|
||||
is_golden_run = golden_run
|
||||
|
||||
if filters:
|
||||
init_signature_context(types, domain)
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -112,11 +112,13 @@ def eip712_new_common(firmware: Firmware,
|
||||
app_client: EthAppClient,
|
||||
json_data: dict,
|
||||
filters: Optional[dict],
|
||||
verbose: bool):
|
||||
verbose: bool,
|
||||
golden_run: bool):
|
||||
assert InputData.process_data(app_client,
|
||||
json_data,
|
||||
filters,
|
||||
partial(autonext, firmware, navigator, default_screenshot_path))
|
||||
partial(autonext, firmware, navigator, default_screenshot_path),
|
||||
golden_run)
|
||||
with app_client.eip712_sign_new(BIP32_PATH):
|
||||
moves = []
|
||||
if firmware.device.startswith("nano"):
|
||||
@@ -126,15 +128,13 @@ def eip712_new_common(firmware: Firmware,
|
||||
moves += [NavInsID.BOTH_CLICK]
|
||||
else:
|
||||
# need to skip the message hash
|
||||
if not verbose and filters is None:
|
||||
moves += [NavInsID.USE_CASE_REVIEW_TAP]
|
||||
moves += [NavInsID.USE_CASE_REVIEW_TAP]
|
||||
moves += [NavInsID.USE_CASE_REVIEW_CONFIRM]
|
||||
if SNAPS_CONFIG is not None:
|
||||
navigator.navigate_and_compare(default_screenshot_path,
|
||||
SNAPS_CONFIG.test_name,
|
||||
moves,
|
||||
snap_start_idx=SNAPS_CONFIG.idx)
|
||||
SNAPS_CONFIG.idx += 1
|
||||
else:
|
||||
navigator.navigate(moves)
|
||||
return ResponseParser.signature(app_client.response().data)
|
||||
@@ -173,7 +173,8 @@ def test_eip712_new(firmware: Firmware,
|
||||
app_client,
|
||||
data,
|
||||
filters,
|
||||
verbose)
|
||||
verbose,
|
||||
False)
|
||||
|
||||
recovered_addr = recover_message(data, vrs)
|
||||
|
||||
@@ -340,7 +341,8 @@ def test_eip712_advanced_filtering(firmware: Firmware,
|
||||
navigator: Navigator,
|
||||
default_screenshot_path: Path,
|
||||
test_name: str,
|
||||
data_set: DataSet):
|
||||
data_set: DataSet,
|
||||
golden_run: bool):
|
||||
global SNAPS_CONFIG
|
||||
|
||||
app_client = EthAppClient(backend)
|
||||
@@ -355,7 +357,8 @@ def test_eip712_advanced_filtering(firmware: Firmware,
|
||||
app_client,
|
||||
data_set.data,
|
||||
data_set.filters,
|
||||
False)
|
||||
False,
|
||||
golden_run)
|
||||
|
||||
# verify signature
|
||||
addr = recover_message(data_set.data, vrs)
|
||||
|
||||