Skip to content

Commit

Permalink
explicitly checking EOS authorization key, style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
grdddj committed Nov 3, 2021
1 parent 8fcd268 commit f44c03a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 4 additions & 1 deletion core/src/apps/eos/writers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from trezor import wire

from apps.common.writers import (
write_bytes_fixed,
write_bytes_unchecked,
Expand Down Expand Up @@ -35,7 +37,8 @@ def write_auth(w: Writer, auth: EosAuthorization) -> None:
write_uint32_le(w, auth.threshold)
write_uvarint(w, len(auth.keys))
for key in auth.keys:
assert key.key is not None
if key.key is None:
raise wire.DataError("Key must be provided explicitly.")
write_uvarint(w, key.type)
write_bytes_fixed(w, key.key, 33)
write_uint16_le(w, key.weight)
Expand Down
14 changes: 5 additions & 9 deletions core/src/apps/nem/mosaic/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,11 @@ async def require_confirm_properties(

# levy
if definition.levy:
assert (
definition.levy_address is not None
) # nem.validators._validate_mosaic_creation
assert (
definition.levy_namespace is not None
) # nem.validators._validate_mosaic_creation
assert (
definition.levy_mosaic is not None
) # nem.validators._validate_mosaic_creation
# asserts below checked in nem.validators._validate_mosaic_creation
assert definition.levy_address is not None
assert definition.levy_namespace is not None
assert definition.levy_mosaic is not None

properties.append(("Levy recipient:", definition.levy_address))

properties.append(("Levy fee:", str(definition.fee)))
Expand Down

0 comments on commit f44c03a

Please sign in to comment.