diff --git a/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00000.png b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00000.png new file mode 100644 index 000000000..14713d83b Binary files /dev/null and b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00000.png differ diff --git a/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00001.png b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00001.png new file mode 100644 index 000000000..7d202e913 Binary files /dev/null and b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00001.png differ diff --git a/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00002.png b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00002.png new file mode 100644 index 000000000..cbaa88901 Binary files /dev/null and b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00002.png differ diff --git a/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00003.png b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00003.png new file mode 100644 index 000000000..8b981d44c Binary files /dev/null and b/tests/ragger/snapshots/flex/test_eip712_filtering_empty_array/00003.png differ diff --git a/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00000.png b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00000.png new file mode 100644 index 000000000..b546f65af Binary files /dev/null and b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00000.png differ diff --git a/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00001.png b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00001.png new file mode 100644 index 000000000..9bc9e1ed7 Binary files /dev/null and b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00001.png differ diff --git a/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00002.png b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00002.png new file mode 100644 index 000000000..f070aac76 Binary files /dev/null and b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00002.png differ diff --git a/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00003.png b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00003.png new file mode 100644 index 000000000..53ae65195 Binary files /dev/null and b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00003.png differ diff --git a/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00004.png b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00004.png new file mode 100644 index 000000000..657887225 Binary files /dev/null and b/tests/ragger/snapshots/nanosp/test_eip712_filtering_empty_array/00004.png differ diff --git a/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00000.png b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00000.png new file mode 100644 index 000000000..b546f65af Binary files /dev/null and b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00000.png differ diff --git a/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00001.png b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00001.png new file mode 100644 index 000000000..9bc9e1ed7 Binary files /dev/null and b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00001.png differ diff --git a/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00002.png b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00002.png new file mode 100644 index 000000000..f070aac76 Binary files /dev/null and b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00002.png differ diff --git a/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00003.png b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00003.png new file mode 100644 index 000000000..53ae65195 Binary files /dev/null and b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00003.png differ diff --git a/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00004.png b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00004.png new file mode 100644 index 000000000..657887225 Binary files /dev/null and b/tests/ragger/snapshots/nanox/test_eip712_filtering_empty_array/00004.png differ diff --git a/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00000.png b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00000.png new file mode 100644 index 000000000..eb8072d46 Binary files /dev/null and b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00000.png differ diff --git a/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00001.png b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00001.png new file mode 100644 index 000000000..efce2dfe6 Binary files /dev/null and b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00001.png differ diff --git a/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00002.png b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00002.png new file mode 100644 index 000000000..fbea72d8f Binary files /dev/null and b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00002.png differ diff --git a/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00003.png b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00003.png new file mode 100644 index 000000000..cfee3aec2 Binary files /dev/null and b/tests/ragger/snapshots/stax/test_eip712_filtering_empty_array/00003.png differ diff --git a/tests/ragger/test_eip712.py b/tests/ragger/test_eip712.py index 1f64fb159..830d2a5d3 100644 --- a/tests/ragger/test_eip712.py +++ b/tests/ragger/test_eip712.py @@ -437,3 +437,94 @@ def test_eip712_advanced_filtering(firmware: Firmware, # verify signature addr = recover_message(data_set.data, vrs) assert addr == get_wallet_addr(app_client) + + +def test_eip712_filtering_empty_array(firmware: Firmware, + backend: BackendInterface, + navigator: Navigator, + default_screenshot_path: Path, + test_name: str, + golden_run: bool): + global SNAPS_CONFIG + + app_client = EthAppClient(backend) + if firmware == Firmware.NANOS: + pytest.skip("Not supported on LNS") + + SNAPS_CONFIG = SnapshotsConfig(test_name) + + data = { + "types": { + "EIP712Domain": [ + {"name": "name", "type": "string"}, + {"name": "version", "type": "string"}, + {"name": "chainId", "type": "uint256"}, + {"name": "verifyingContract", "type": "address"}, + ], + "Person": [ + {"name": "name", "type": "string"}, + {"name": "addr", "type": "address"}, + ], + "Message": [ + {"name": "title", "type": "string"}, + {"name": "to", "type": "Person[]"}, + ], + "Root": [ + {"name": "text", "type": "string"}, + {"name": "subtext", "type": "string[]"}, + {"name": "msg_list1", "type": "Message[]"}, + {"name": "msg_list2", "type": "Message[]"}, + ], + }, + "primaryType": "Root", + "domain": { + "name": "test", + "version": "1", + "verifyingContract": "0x0000000000000000000000000000000000000000", + "chainId": 1, + }, + "message": { + "text": "This is a test", + "subtext": [], + "msg_list1": [ + { + "title": "This is a test", + "to": [], + } + ], + "msg_list2": [], + } + } + filters = { + "name": "Empty array filtering", + "fields": { + "text": { + "type": "raw", + "name": "Text", + }, + "subtext.[]": { + "type": "raw", + "name": "Sub-Text", + }, + "msg_list1.[].to.[].addr": { + "type": "raw", + "name": "(1) Recipient addr", + }, + "msg_list2.[].to.[].addr": { + "type": "raw", + "name": "(2) Recipient addr", + }, + } + } + vrs = eip712_new_common(firmware, + navigator, + default_screenshot_path, + app_client, + data, + filters, + False, + golden_run) + + # verify signature + addr = recover_message(data, vrs) + assert addr == get_wallet_addr(app_client)