Skip to content

Commit

Permalink
Merge pull request #480 from LedgerHQ/fbe/fix_python_client_job_trigger
Browse files Browse the repository at this point in the history
Fix python-client github job trigger
  • Loading branch information
fbeutin-ledger authored Oct 27, 2023
2 parents 379ccc0 + a82b61f commit 4cca4b7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
- develop
- master
paths:
- ./client/**
- client/**
- .github/workflows/python-client.yml
pull_request:
paths:
- ./client/**
- client/**
- .github/workflows/python-client.yml

jobs:
Expand Down
18 changes: 11 additions & 7 deletions client/src/ledger_app_clients/ethereum/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import IntEnum
from ragger.backend import BackendInterface
from ragger.utils import RAPDU
from typing import List, Optional
from typing import List, Optional, Union

from .command_builder import CommandBuilder
from .eip712 import EIP712FieldType
Expand All @@ -13,13 +13,16 @@
WEI_IN_ETH = 1e+18
GWEI_IN_ETH = 1e+9


class TxData:
selector: bytes
parameters: list[bytes]

def __init__(self, selector: bytes, params: list[bytes]):
self.selector = selector
self.parameters = params


class StatusWord(IntEnum):
OK = 0x9000
ERROR_NO_INFO = 0x6a00
Expand All @@ -30,6 +33,7 @@ class StatusWord(IntEnum):
CONDITION_NOT_SATISFIED = 0x6985
REF_DATA_NOT_FOUND = 0x6a88


class DomainNameTag(IntEnum):
STRUCTURE_TYPE = 0x01
STRUCTURE_VERSION = 0x02
Expand Down Expand Up @@ -121,7 +125,7 @@ def _sign_common(self,
gas_limit: int,
destination: bytes,
amount: float,
data: TxData):
data: Optional[TxData]):
tx.append(int(gas_price * GWEI_IN_ETH))
tx.append(gas_limit)
tx.append(destination)
Expand All @@ -143,8 +147,8 @@ def sign_legacy(self,
destination: bytes,
amount: float,
chain_id: int,
data: TxData = None):
tx = list()
data: Optional[TxData] = None):
tx: List[Union[int, bytes]] = list()
tx.append(nonce)
tx = self._sign_common(tx, gas_price, gas_limit, destination, amount, data)
tx.append(chain_id)
Expand All @@ -161,9 +165,9 @@ def sign_1559(self,
gas_limit: int,
destination: bytes,
amount: float,
data: TxData = None,
access_list = list()):
tx = list()
data: Optional[TxData] = None,
access_list=list()):
tx: List[Union[int, bytes]] = list()
tx.append(chain_id)
tx.append(nonce)
tx.append(int(max_prio_gas_price * GWEI_IN_ETH))
Expand Down
4 changes: 2 additions & 2 deletions client/src/ledger_app_clients/ethereum/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ def eip712_filtering_show_field(self, name: str, sig: bytes) -> bytes:
P2Type.FILTERING_FIELD_NAME,
self._eip712_filtering_send_name(name, sig))

def set_external_plugin(self, plugin_name: str, contract_address: bytes, method_selelector: bytes, sig: bytes) -> bytes:
def set_external_plugin(self, plugin_name: str, contract_address: bytes, selector: bytes, sig: bytes) -> bytes:
data = bytearray()
data.append(len(plugin_name))
data += self._string_to_bytes(plugin_name)
data += contract_address
data += method_selelector
data += selector
data += sig

return self._serialize(InsType.EXTERNAL_PLUGIN_SETUP,
Expand Down
1 change: 1 addition & 0 deletions client/src/ledger_app_clients/ethereum/response_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def challenge(data: bytes) -> int:
assert len(data) == 4
return int.from_bytes(data, "big")


def pk_addr(data: bytes, has_chaincode: bool = False):
idx = 0

Expand Down
1 change: 1 addition & 0 deletions client/src/ledger_app_clients/ethereum/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sha3


def get_selector_from_function(fn: str) -> bytes:
return sha3.keccak_256(fn.encode()).digest()[0:4]

0 comments on commit 4cca4b7

Please sign in to comment.