mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
style: uppercase hex constants to conform with black 18.9b0 style
This commit is contained in:
parent
3dad046c12
commit
4fb3acb029
@ -677,7 +677,7 @@ def sign_tx(connect, coin):
|
||||
sequence = click.prompt(
|
||||
"Sequence Number to use (RBF opt-in enabled by default)",
|
||||
type=int,
|
||||
default=0xfffffffd,
|
||||
default=0xFFFFFFFD,
|
||||
)
|
||||
script_type = click.prompt(
|
||||
"Input type",
|
||||
|
@ -74,7 +74,7 @@ except ImportError:
|
||||
def getch():
|
||||
while True:
|
||||
key = msvcrt.getch()
|
||||
if key in (0x00, 0xe0):
|
||||
if key in (0x00, 0xE0):
|
||||
# skip special keys: read the scancode and repeat
|
||||
msvcrt.getch()
|
||||
continue
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import construct as c
|
||||
import pyblake2
|
||||
|
||||
@ -6,7 +5,7 @@ from . import cosi, messages as proto, tools
|
||||
|
||||
|
||||
def bytes_not(data):
|
||||
return bytes(~b & 0xff for b in data)
|
||||
return bytes(~b & 0xFF for b in data)
|
||||
|
||||
|
||||
# fmt: off
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
from . import messages as proto
|
||||
from .protobuf import dict_to_proto
|
||||
from .tools import CallException, dict_from_camelcase, expect, normalize_nfc
|
||||
|
@ -356,7 +356,7 @@ def format_message(
|
||||
def mostly_printable(bytes):
|
||||
if not bytes:
|
||||
return True
|
||||
printable = sum(1 for byte in bytes if 0x20 <= byte <= 0x7e)
|
||||
printable = sum(1 for byte in bytes if 0x20 <= byte <= 0x7E)
|
||||
return printable / len(bytes) > 0.8
|
||||
|
||||
def pformat_value(value: Any, indent: int) -> str:
|
||||
|
@ -336,7 +336,7 @@ def _crc16_checksum(bytes):
|
||||
if c15 ^ bit:
|
||||
crc ^= polynomial
|
||||
|
||||
return crc & 0xffff
|
||||
return crc & 0xFFFF
|
||||
|
||||
|
||||
# ====== Client functions ====== #
|
||||
|
@ -70,4 +70,4 @@ class TestBip32Speed(TrezorTest):
|
||||
print("CACHED TIME", cache_time)
|
||||
|
||||
# Cached time expected to be at least 2x faster
|
||||
assert cache_time <= nocache_time / 2.
|
||||
assert cache_time <= nocache_time / 2.0
|
||||
|
@ -366,8 +366,8 @@ class TestMsgEthereumSigntx(TrezorTest):
|
||||
self.client,
|
||||
n=[0, 0],
|
||||
nonce=123456,
|
||||
gas_price=0xffffffffffffffffffffffffffffffff,
|
||||
gas_limit=0xffffffffffffffffffffffffffffff,
|
||||
gas_price=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
|
||||
gas_limit=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
|
||||
to=TO_ADDR,
|
||||
value=12345678901234567890,
|
||||
)
|
||||
|
@ -33,8 +33,8 @@ class TestMsgOntologySignOntIdAddAttributes(TrezorTest):
|
||||
|
||||
transaction = messages.OntologyTransaction(
|
||||
version=0x00,
|
||||
nonce=0x7f7f1ceb,
|
||||
type=0xd1,
|
||||
nonce=0x7F7F1CEB,
|
||||
type=0xD1,
|
||||
gas_price=500,
|
||||
gas_limit=30000,
|
||||
payer="AGn8JFPGM5S4jkWhTC89Xtz1Y76sPz29Rc",
|
||||
|
@ -33,8 +33,8 @@ class TestMsgOntologySignOntIdRegister(TrezorTest):
|
||||
|
||||
transaction = messages.OntologyTransaction(
|
||||
version=0x00,
|
||||
nonce=0x7f7f1ceb,
|
||||
type=0xd1,
|
||||
nonce=0x7F7F1CEB,
|
||||
type=0xD1,
|
||||
gas_price=500,
|
||||
gas_limit=30000,
|
||||
payer="AGn8JFPGM5S4jkWhTC89Xtz1Y76sPz29Rc",
|
||||
|
@ -31,8 +31,8 @@ class TestMsgOntologySigntx(TrezorTest):
|
||||
|
||||
transaction = messages.OntologyTransaction(
|
||||
version=0x00,
|
||||
nonce=0x7f7f1ceb,
|
||||
type=0xd1,
|
||||
nonce=0x7F7F1CEB,
|
||||
type=0xD1,
|
||||
gas_price=500,
|
||||
gas_limit=30000,
|
||||
payer="AGn8JFPGM5S4jkWhTC89Xtz1Y76sPz29Rc",
|
||||
@ -63,8 +63,8 @@ class TestMsgOntologySigntx(TrezorTest):
|
||||
|
||||
transaction = messages.OntologyTransaction(
|
||||
version=0x00,
|
||||
nonce=0x7f7f1ceb,
|
||||
type=0xd1,
|
||||
nonce=0x7F7F1CEB,
|
||||
type=0xD1,
|
||||
gas_price=500,
|
||||
gas_limit=30000,
|
||||
payer="AGn8JFPGM5S4jkWhTC89Xtz1Y76sPz29Rc",
|
||||
|
@ -31,8 +31,8 @@ class TestMsgOntologySignWithdraw(TrezorTest):
|
||||
|
||||
transaction = messages.OntologyTransaction(
|
||||
version=0x00,
|
||||
nonce=0x7f7f1ceb,
|
||||
type=0xd1,
|
||||
nonce=0x7F7F1CEB,
|
||||
type=0xD1,
|
||||
gas_price=500,
|
||||
gas_limit=30000,
|
||||
payer="AGn8JFPGM5S4jkWhTC89Xtz1Y76sPz29Rc",
|
||||
|
@ -68,7 +68,7 @@ class TestMsgStellarSignTransaction(TrezorTest):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
||||
op = proto.StellarBumpSequenceOp()
|
||||
op.bump_to = 0x7fffffffffffffff
|
||||
op.bump_to = 0x7FFFFFFFFFFFFFFF
|
||||
tx = self._create_msg()
|
||||
|
||||
response = stellar.sign_tx(
|
||||
|
@ -47,7 +47,7 @@ def dump_uvarint(value):
|
||||
def test_dump_uvarint():
|
||||
assert dump_uvarint(0) == b"\x00"
|
||||
assert dump_uvarint(1) == b"\x01"
|
||||
assert dump_uvarint(0xff) == b"\xff\x01"
|
||||
assert dump_uvarint(0xFF) == b"\xff\x01"
|
||||
assert dump_uvarint(123456) == b"\xc0\xc4\x07"
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
@ -57,7 +57,7 @@ def test_dump_uvarint():
|
||||
def test_load_uvarint():
|
||||
assert load_uvarint(b"\x00") == 0
|
||||
assert load_uvarint(b"\x01") == 1
|
||||
assert load_uvarint(b"\xff\x01") == 0xff
|
||||
assert load_uvarint(b"\xff\x01") == 0xFF
|
||||
assert load_uvarint(b"\xc0\xc4\x07") == 123456
|
||||
|
||||
|
||||
|
@ -23,9 +23,9 @@ from . import Transport, TransportException
|
||||
from ..protocol_v1 import ProtocolV1
|
||||
from ..protocol_v2 import ProtocolV2
|
||||
|
||||
DEV_TREZOR1 = (0x534c, 0x0001)
|
||||
DEV_TREZOR2 = (0x1209, 0x53c1)
|
||||
DEV_TREZOR2_BL = (0x1209, 0x53c0)
|
||||
DEV_TREZOR1 = (0x534C, 0x0001)
|
||||
DEV_TREZOR2 = (0x1209, 0x53C1)
|
||||
DEV_TREZOR2_BL = (0x1209, 0x53C0)
|
||||
|
||||
|
||||
class HidHandle:
|
||||
|
@ -24,9 +24,9 @@ from . import Transport, TransportException
|
||||
from ..protocol_v1 import ProtocolV1
|
||||
from ..protocol_v2 import ProtocolV2
|
||||
|
||||
DEV_TREZOR1 = (0x534c, 0x0001)
|
||||
DEV_TREZOR2 = (0x1209, 0x53c1)
|
||||
DEV_TREZOR2_BL = (0x1209, 0x53c0)
|
||||
DEV_TREZOR1 = (0x534C, 0x0001)
|
||||
DEV_TREZOR2 = (0x1209, 0x53C1)
|
||||
DEV_TREZOR2_BL = (0x1209, 0x53C0)
|
||||
|
||||
INTERFACE = 0
|
||||
ENDPOINT = 1
|
||||
|
@ -97,7 +97,7 @@ class TxApiInsight(TxApi):
|
||||
i = t._add_inputs()
|
||||
if "coinbase" in vin.keys():
|
||||
i.prev_hash = b"\0" * 32
|
||||
i.prev_index = 0xffffffff # signed int -1
|
||||
i.prev_index = 0xFFFFFFFF # signed int -1
|
||||
i.script_sig = bytes.fromhex(vin["coinbase"])
|
||||
i.sequence = vin["sequence"]
|
||||
|
||||
@ -111,7 +111,7 @@ class TxApiInsight(TxApi):
|
||||
o = t._add_bin_outputs()
|
||||
o.amount = int(Decimal(vout["value"]) * 100000000)
|
||||
o.script_pubkey = bytes.fromhex(vout["scriptPubKey"]["hex"])
|
||||
if self.bip115 and o.script_pubkey[-1] == 0xb4:
|
||||
if self.bip115 and o.script_pubkey[-1] == 0xB4:
|
||||
# Verify if coin implements replay protection bip115 and script includes checkblockatheight opcode. 0xb4 - is op_code (OP_CHECKBLOCKATHEIGHT)
|
||||
# <OP_32> <32-byte block hash> <OP_3> <3-byte block height> <OP_CHECKBLOCKATHEIGHT>
|
||||
tail = o.script_pubkey[-38:]
|
||||
|
Loading…
Reference in New Issue
Block a user