mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
fix(python): fix eth.sign-tx - correct input into rlp.encode()
[no changelog]
This commit is contained in:
parent
d2044d29b6
commit
a38a0b6295
@ -352,29 +352,37 @@ def sign_tx(
|
|||||||
)
|
)
|
||||||
|
|
||||||
to = ethereum.decode_hex(to_address)
|
to = ethereum.decode_hex(to_address)
|
||||||
|
|
||||||
|
# NOTE: rlp.encode needs a list input to iterate through all its items,
|
||||||
|
# it does not work with a tuple
|
||||||
if is_eip1559:
|
if is_eip1559:
|
||||||
transaction = rlp.encode(
|
transaction_items = [
|
||||||
(
|
chain_id,
|
||||||
chain_id,
|
nonce,
|
||||||
nonce,
|
max_priority_fee,
|
||||||
max_priority_fee,
|
max_gas_fee,
|
||||||
max_gas_fee,
|
gas_limit,
|
||||||
gas_limit,
|
to,
|
||||||
to,
|
amount,
|
||||||
amount,
|
data_bytes,
|
||||||
data_bytes,
|
_format_access_list(access_list) if access_list is not None else [],
|
||||||
_format_access_list(access_list) if access_list is not None else [],
|
*sig,
|
||||||
)
|
]
|
||||||
+ sig
|
|
||||||
)
|
|
||||||
elif tx_type is None:
|
elif tx_type is None:
|
||||||
transaction = rlp.encode(
|
transaction_items = [nonce, gas_price, gas_limit, to, amount, data_bytes, *sig]
|
||||||
(nonce, gas_price, gas_limit, to, amount, data_bytes) + sig
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
transaction = rlp.encode(
|
transaction_items = [
|
||||||
(tx_type, nonce, gas_price, gas_limit, to, amount, data_bytes) + sig
|
tx_type,
|
||||||
)
|
nonce,
|
||||||
|
gas_price,
|
||||||
|
gas_limit,
|
||||||
|
to,
|
||||||
|
amount,
|
||||||
|
data_bytes,
|
||||||
|
*sig,
|
||||||
|
]
|
||||||
|
transaction = rlp.encode(transaction_items)
|
||||||
|
|
||||||
if eip2718_type is not None:
|
if eip2718_type is not None:
|
||||||
eip2718_prefix = f"{eip2718_type:02x}"
|
eip2718_prefix = f"{eip2718_type:02x}"
|
||||||
else:
|
else:
|
||||||
|
@ -627,7 +627,7 @@ class PyrightTool:
|
|||||||
"""Transform error object to a string readable by human."""
|
"""Transform error object to a string readable by human."""
|
||||||
file = error["file"]
|
file = error["file"]
|
||||||
message = error["message"]
|
message = error["message"]
|
||||||
rule = error["rule"]
|
rule = error.get("rule", "No specific rule")
|
||||||
line = error["range"]["start"]["line"]
|
line = error["range"]["start"]["line"]
|
||||||
|
|
||||||
# Need to add +1 to the line, as it is zero-based index
|
# Need to add +1 to the line, as it is zero-based index
|
||||||
|
Loading…
Reference in New Issue
Block a user