Removed old substitutions in EIP-712 test and renamed it
message JSON directly in test
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"domain": {
|
||||
"chainId": 1,
|
||||
"name": "Token test",
|
||||
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
|
||||
"version": "1"
|
||||
},
|
||||
"message": {
|
||||
"from": "0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa",
|
||||
"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
|
||||
"amount": "117",
|
||||
"token": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
|
||||
},
|
||||
"primaryType": "Transfer",
|
||||
"types": {
|
||||
"EIP712Domain": [
|
||||
{ "name": "name", "type": "string" },
|
||||
{ "name": "version", "type": "string" },
|
||||
{ "name": "chainId", "type": "uint256" },
|
||||
{ "name": "verifyingContract", "type": "address" }
|
||||
],
|
||||
"Transfer": [
|
||||
{ "name": "from", "type": "address" },
|
||||
{ "name": "to", "type": "address" },
|
||||
{ "name": "amount", "type": "uint256" },
|
||||
{ "name": "token", "type": "address" }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 472 B After Width: | Height: | Size: 472 B |
|
After Width: | Height: | Size: 478 B |
|
After Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 770 B |
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 472 B After Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
|
After Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 433 B |
|
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 709 B |
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 774 B |
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 472 B After Width: | Height: | Size: 472 B |
|
After Width: | Height: | Size: 478 B |
|
After Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 770 B |
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 472 B After Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
|
After Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 433 B |
|
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 709 B |
|
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 774 B |
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
@@ -180,12 +180,12 @@ def test_eip712_new(firmware: Firmware,
|
||||
assert recovered_addr == get_wallet_addr(app_client)
|
||||
|
||||
|
||||
def test_eip712_address_substitution(firmware: Firmware,
|
||||
backend: BackendInterface,
|
||||
navigator: Navigator,
|
||||
default_screenshot_path: Path,
|
||||
test_name: str,
|
||||
verbose: bool):
|
||||
def test_eip712_advanced_filtering(firmware: Firmware,
|
||||
backend: BackendInterface,
|
||||
navigator: Navigator,
|
||||
default_screenshot_path: Path,
|
||||
test_name: str,
|
||||
verbose: bool):
|
||||
global SNAPS_CONFIG
|
||||
|
||||
app_client = EthAppClient(backend)
|
||||
@@ -195,25 +195,43 @@ def test_eip712_address_substitution(firmware: Firmware,
|
||||
if verbose:
|
||||
test_name += "_verbose"
|
||||
SNAPS_CONFIG = SnapshotsConfig(test_name)
|
||||
with open(f"{eip712_json_path()}/address_substitution.json", encoding="utf-8") as file:
|
||||
data = json.load(file)
|
||||
|
||||
app_client.provide_token_metadata("DAI",
|
||||
bytes.fromhex(data["message"]["token"][2:]),
|
||||
18,
|
||||
1)
|
||||
|
||||
challenge = ResponseParser.challenge(app_client.get_challenge().data)
|
||||
app_client.provide_domain_name(challenge,
|
||||
"vitalik.eth",
|
||||
bytes.fromhex(data["message"]["to"][2:]))
|
||||
data = {
|
||||
"domain": {
|
||||
"chainId": 1,
|
||||
"name": "Advanced test",
|
||||
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
|
||||
"version": "1"
|
||||
},
|
||||
"message": {
|
||||
"from": "0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa",
|
||||
"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
|
||||
"amount": 117,
|
||||
"token": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
|
||||
},
|
||||
"primaryType": "Transfer",
|
||||
"types": {
|
||||
"EIP712Domain": [
|
||||
{"name": "name", "type": "string"},
|
||||
{"name": "version", "type": "string"},
|
||||
{"name": "chainId", "type": "uint256"},
|
||||
{"name": "verifyingContract", "type": "address"}
|
||||
],
|
||||
"Transfer": [
|
||||
{"name": "from", "type": "address"},
|
||||
{"name": "to", "type": "address"},
|
||||
{"name": "amount", "type": "uint256"},
|
||||
{"name": "token", "type": "address"}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if verbose:
|
||||
settings_toggle(firmware, navigator, [SettingID.VERBOSE_EIP712])
|
||||
filters = None
|
||||
else:
|
||||
filters = {
|
||||
"name": "Token test",
|
||||
"name": "Advanced Filtering",
|
||||
"fields": {
|
||||
"amount": "Amount",
|
||||
"token": "Token",
|
||||
|
||||