Skip to content

Commit

Permalink
xmr: sign cleanup, comments
Browse files Browse the repository at this point in the history
- state cleanup, comments added, unused code removed
  • Loading branch information
ph4r05 committed Oct 3, 2018
1 parent 164a7d6 commit 9e3be78
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 21 deletions.
9 changes: 2 additions & 7 deletions src/apps/monero/protocol/signing/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,15 @@ def __init__(self, ctx):
self.tx_priv = None
self.tx_pub = None

self.multi_sig = False
self.need_additional_txkeys = False
self.use_bulletproof = False
self.use_rct = True
self.use_simple_rct = False
self.input_count = 0
self.output_count = 0
self.output_change = None
self.mixin = 0
self.fee = 0
self.account_idx = 0
self.account_idx = 0 # wallet sub-address major index

self.additional_tx_private_keys = []
self.additional_tx_public_keys = []
Expand All @@ -73,8 +71,6 @@ def __init__(self, ctx):
self.summary_inputs_money = 0
self.summary_outs_money = 0
self.input_secrets = []
self.input_alphas = []
self.input_pseudo_outs = []
self.output_sk_masks = []
self.output_pk_masks = [] # commitments
self.output_amounts = []
Expand All @@ -90,8 +86,7 @@ def __init__(self, ctx):
self.tx_prefix_hasher = None
self.tx_prefix_hash = None
self.full_message_hasher = None
self.full_message = None
self.exp_tx_prefix_hash = None
self.full_message = None # pre-MLSAG hash
self._init()

def _init(self):
Expand Down
4 changes: 2 additions & 2 deletions src/apps/monero/protocol/signing/step_01_init_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ async def init_transaction(
state.mixin = tsx_data.mixin
state.fee = tsx_data.fee
state.account_idx = tsx_data.account
state.multi_sig = tsx_data.is_multisig
state.exp_tx_prefix_hash = tsx_data.exp_tx_prefix_hash
if tsx_data.is_multisig:
raise NotImplementedError("Multisig is not implemented")

# Ensure change is correct
_check_change(state, tsx_data.outputs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def tsx_inputs_permutation(state: State, permutation: list):
Set permutation on the inputs - sorted by key image on host.
"""
if len(permutation) != state.input_count:
raise ValueError('Invalid permutation size')
raise ValueError("Invalid permutation size")
_check_permutation(permutation)

state.source_permutation = permutation
Expand Down
3 changes: 2 additions & 1 deletion src/apps/monero/protocol/signing/step_05_all_in_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ async def all_in_set(state: State, rsig_data): # todo: rsig_data not used?
if not state.rsig_offload:
return resp

# Simple offloading - generate random masks that sum to the input mask sum.
# Simple range proof offloading
# Generate random commitment masks that sum to the input mask sum.
tmp_buff = bytearray(32)
rsig_data.mask = bytearray(32 * state.output_count)
state.sumout = crypto.sc_init(0)
Expand Down
3 changes: 1 addition & 2 deletions src/apps/monero/protocol/signing/step_07_all_out1_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

from .state import State

from apps.monero.controller import misc
from apps.monero.layout import confirms
from apps.monero.xmr import common, crypto
from apps.monero.xmr import crypto


async def all_out1_set(state: State):
Expand Down
8 changes: 0 additions & 8 deletions src/apps/monero/protocol/signing/step_08_mlsag_done.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ async def mlsag_done(state: State):
# state.state.set_final_message_done() todo needed?
await confirms.transaction_step(state.ctx, state.STEP_MLSAG)

_ecdh_info(state)
_out_pk(state)
state.full_message_hasher.rctsig_base_done()
state.current_output_index = -1
Expand All @@ -27,13 +26,6 @@ async def mlsag_done(state: State):
return MoneroTransactionMlsagDoneAck(full_message_hash=state.full_message)


def _ecdh_info(state: State): # todo why is it here? remove
"""
Sets ecdh info for the incremental hashing mlsag.
"""
pass


def _out_pk(state: State):
"""
Sets out_pk for the incremental hashing mlsag.
Expand Down

0 comments on commit 9e3be78

Please sign in to comment.