1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-03 05:12:34 +00:00
trezor-firmware/core/src/apps/monero/signing/step_05_all_inputs_set.py
Dusan Klinec 33c174491f refactor(core/monero): Monero code cleanup
* remove support for HF12 and below
* remove MLSAG support
* clean up monero cryptography naming
* get rid of "optional first argument" pattern, in favor of mandatory argument that is allowed to be None
  (and fix several bugs related to this feature)

Co-authored-by: grdddj <jiri.musil06@seznam.cz>
Co-authored-by: Martin Milata <martin@martinmilata.cz>
Co-authored-by: matejcik <ja@matejcik.cz>
2022-05-16 12:37:24 +02:00

34 lines
966 B
Python

"""
All inputs set. Defining range signature parameters.
If in the applicable offloading mode, generate commitment masks.
"""
from typing import TYPE_CHECKING
from apps.monero import layout
from apps.monero.xmr import crypto
from .state import State
if TYPE_CHECKING:
from trezor.messages import MoneroTransactionAllInputsSetAck
async def all_inputs_set(state: State) -> MoneroTransactionAllInputsSetAck:
state.mem_trace(0)
await layout.transaction_step(state, state.STEP_ALL_IN)
from trezor.messages import MoneroTransactionAllInputsSetAck
if state.last_step != state.STEP_VINI:
raise ValueError("Invalid state transition")
if state.current_input_index != state.input_count - 1:
raise ValueError("Invalid input count")
# The sum of the masks must match the input masks sum.
state.sumout = crypto.Scalar()
state.last_step = state.STEP_ALL_IN
resp = MoneroTransactionAllInputsSetAck()
return resp