Moved EIP712 filtering argument switch from P1 to P2, more in line with other EIP712 APDUs

This commit is contained in:
Alexandre Paillier
2022-08-10 11:47:05 +02:00
parent f278221537
commit 98889e2642
5 changed files with 46 additions and 46 deletions

View File

@@ -41,7 +41,7 @@ class EthereumClient:
def _recv(self) -> RAPDU:
return self._client._last_async_response
def _click_signal_timeout(self, signum: int, frame):
def _click_signal_timeout(self, _signum: int, _frame):
self._client.right_click()
def _enable_click_until_response(self):

View File

@@ -3,24 +3,24 @@ from typing import Iterator
from ethereum_client.eip712 import EIP712FieldType
class InsType(IntEnum):
EIP712_SEND_STRUCT_DEF = 0x1a,
EIP712_SEND_STRUCT_IMPL = 0x1c,
EIP712_SEND_FILTERING = 0x1e,
EIP712_SEND_STRUCT_DEF = 0x1a
EIP712_SEND_STRUCT_IMPL = 0x1c
EIP712_SEND_FILTERING = 0x1e
EIP712_SIGN = 0x0c
class P1Type(IntEnum):
COMPLETE_SEND = 0x00,
PARTIAL_SEND = 0x01,
FILTERING_ACTIVATE = 0x00,
FILTERING_CONTRACT_NAME = 0x0f,
FILTERING_FIELD_NAME = 0xff
COMPLETE_SEND = 0x00
PARTIAL_SEND = 0x01
class P2Type(IntEnum):
STRUCT_NAME = 0x00,
STRUCT_FIELD = 0xff,
ARRAY = 0x0f,
STRUCT_NAME = 0x00
STRUCT_FIELD = 0xff
ARRAY = 0x0f
LEGACY_IMPLEM = 0x00
NEW_IMPLEM = 0x01
FILTERING_ACTIVATE = 0x00
FILTERING_CONTRACT_NAME = 0x0f
FILTERING_FIELD_NAME = 0xff
class EthereumCmdBuilder:
_CLA: int = 0xE0
@@ -139,8 +139,8 @@ class EthereumCmdBuilder:
def eip712_filtering_activate(self):
return self._serialize(InsType.EIP712_SEND_FILTERING,
P1Type.FILTERING_ACTIVATE,
0x00,
P1Type.COMPLETE_SEND,
P2Type.FILTERING_ACTIVATE,
bytearray())
def _eip712_filtering_send_name(self, name: str, sig: bytes) -> bytes:
@@ -153,12 +153,12 @@ class EthereumCmdBuilder:
def eip712_filtering_send_contract_name(self, name: str, sig: bytes) -> bytes:
return self._serialize(InsType.EIP712_SEND_FILTERING,
P1Type.FILTERING_CONTRACT_NAME,
0x00,
P1Type.COMPLETE_SEND,
P2Type.FILTERING_CONTRACT_NAME,
self._eip712_filtering_send_name(name, sig))
def eip712_filtering_send_field_name(self, name: str, sig: bytes) -> bytes:
return self._serialize(InsType.EIP712_SEND_FILTERING,
P1Type.FILTERING_FIELD_NAME,
0x00,
P1Type.COMPLETE_SEND,
P2Type.FILTERING_FIELD_NAME,
self._eip712_filtering_send_name(name, sig))