Skip to content

Commit

Permalink
xmr: auto-generated intelliJ param comments removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 17, 2018
1 parent a75ef32 commit ca2bd0c
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 167 deletions.
8 changes: 0 additions & 8 deletions src/apps/monero/controller/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ def __init__(self, **kwargs):


def compute_tx_key(spend_key_private, tx_prefix_hash, salt=None, rand_mult=None):
"""
:param spend_key_private:
:param tx_prefix_hash:
:param salt:
:param rand_mult:
:return:
"""
from apps.monero.xmr import crypto

if not salt:
Expand Down
23 changes: 0 additions & 23 deletions src/apps/monero/protocol/tsx_sign_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ def _mem_trace(self, x=None, collect=False):
gc.collect()

def assrt(self, condition, msg=None):
"""
Asserts condition
:param condition:
:param msg:
:return:
"""
if condition:
return
raise ValueError("Assertion error%s" % (" : %s" % msg if msg else ""))
Expand All @@ -123,8 +117,6 @@ def is_terminal(self):
def gen_r(self, use_r=None):
"""
Generates a new transaction key pair.
:param use_r:
:return:
"""
self.r = crypto.random_scalar() if use_r is None else use_r
self.r_pub = crypto.scalarmult_base(self.r)
Expand All @@ -148,8 +140,6 @@ def get_primary_change_address(self):
def check_change(self, outputs):
"""
Checks if the change address is among tx outputs and it is equal to our address.
:param outputs:
:return:
"""
from apps.monero.xmr.sub.addr import addr_eq, get_change_addr_idx

Expand Down Expand Up @@ -545,9 +535,6 @@ def precompute_subaddr(self, account, indices):
Precomputes subaddresses for account (major) and list of indices (minors)
Subaddresses have to be stored in encoded form - unique representation.
Single point can have multiple extended coordinates representation - would not match during subaddress search.
:param account:
:param indices:
:return:
"""
monero.compute_subaddresses(self.creds, account, indices, self.subaddresses)

Expand All @@ -559,9 +546,6 @@ async def set_input(self, src_entr):
If number of inputs is small, in-memory mode is used = alpha, pseudo_outs are kept in the Trezor.
Otherwise pseudo_outs are offloaded with HMAC, alpha is offloaded encrypted under Chacha20Poly1305()
with key derived for exactly this purpose.
:param src_entr:
:return:
"""
from trezor.messages.MoneroTransactionSetInputAck import (
MoneroTransactionSetInputAck
Expand Down Expand Up @@ -747,13 +731,6 @@ async def input_vini(self, src_entr, vini_bin, hmac, pseudo_out, pseudo_out_hmac
Set tx.vin[i] for incremental tx prefix hash computation.
After sorting by key images on host.
Hashes pseudo_out to the final_message.
:param src_entr:
:param vini_bin: tx.vin[i]
:param hmac: HMAC of tx.vin[i]
:param pseudo_out: pseudo_out for the current entry
:param pseudo_out_hmac: hmac of pseudo_out
:return:
"""
from trezor.messages.MoneroTransactionInputViniAck import (
MoneroTransactionInputViniAck
Expand Down
15 changes: 0 additions & 15 deletions src/apps/monero/protocol_lite/lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ def _mem_trace(self, x=None, collect=False):
gc.collect()

def assrt(self, condition, msg=None):
"""
Asserts condition
:param condition:
:param msg:
:return:
"""
if condition:
return
raise ValueError("Assertion error%s" % (" : %s" % msg if msg else ""))
Expand Down Expand Up @@ -619,15 +613,6 @@ async def stealth(self):
return SW_OK

async def dispatch(self, ctx, ins, p1, p2, input):
"""
Main message dispatcher
:param ctx:
:param ins:
:param p1:
:param p2:
:param input:
:return:
"""
self.c_p1 = p1
self.c_p2 = p2
self.c_msg = input
Expand Down
2 changes: 0 additions & 2 deletions src/apps/monero/xmr/bulletproof.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ def __getitem__(self, item):
"""
Returns corresponding 32 byte array.
Creates new memoryview on access.
:param item:
:return:
"""
item = self.idxize(item)
return self.mv[item * 32 : (item + 1) * 32]
Expand Down
13 changes: 0 additions & 13 deletions src/apps/monero/xmr/key_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@


def compute_hash(rr):
"""
Hash over output to ki-sync
:param rr:
:type rr: TransferDetails
:return:
"""
kck = crypto.get_keccak()
kck.update(rr.out_key)
kck.update(rr.tx_pub_key)
Expand All @@ -20,13 +14,6 @@ def compute_hash(rr):


def export_key_image(creds, subaddresses, td):
"""
Key image export
:param creds:
:param subaddresses:
:param td:
:return:
"""
out_key = crypto.decodepoint(td.out_key)
tx_pub_key = crypto.decodepoint(td.tx_pub_key)
additional_tx_pub_keys = []
Expand Down
48 changes: 0 additions & 48 deletions src/apps/monero/xmr/mlsag2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,12 @@


def key_vector(rows):
"""
Empty key vector
:param rows:
:return:
"""
return [None] * rows


def key_matrix(rows, cols):
"""
first index is columns (so slightly backward from math)
:param rows:
:param cols:
:return:
"""
rv = [None] * cols
for i in range(0, cols):
Expand All @@ -30,8 +22,6 @@ def key_matrix(rows, cols):
def scalar_gen_vector(n):
"""
Generates vector of scalars
:param n:
:return:
"""
return [crypto.random_scalar() for i in range(0, n)]

Expand All @@ -45,8 +35,6 @@ def scalar_gen_vector(n):
def hasher_message(message):
"""
Returns incremental hasher for MLSAG
:param message:
:return:
"""
from apps.monero.xmr.sub.keccak_hasher import HashWrapper

Expand All @@ -64,13 +52,6 @@ def hash_point(hasher, point):
def gen_mlsag_assert(pk, xx, kLRki, mscout, index, dsRows):
"""
Conditions check for gen_mlsag_ext.
:param pk:
:param xx:
:param kLRki:
:param mscout:
:param index:
:param dsRows:
:return:
"""
cols = len(pk)
if cols <= 1:
Expand Down Expand Up @@ -99,16 +80,6 @@ def gen_mlsag_assert(pk, xx, kLRki, mscout, index, dsRows):
def gen_mlsag_rows(message, rv, pk, xx, kLRki, index, dsRows, rows, cols):
"""
MLSAG computation - the part with secret keys
:param message:
:param rv:
:param pk:
:param xx:
:param kLRki:
:param index:
:param dsRows:
:param rows:
:param cols:
:return:
"""
Ip = key_vector(dsRows)
rv.II = key_vector(dsRows)
Expand Down Expand Up @@ -152,15 +123,6 @@ def gen_mlsag_rows(message, rv, pk, xx, kLRki, index, dsRows, rows, cols):
def gen_mlsag_ext(message, pk, xx, kLRki, mscout, index, dsRows):
"""
Multilayered Spontaneous Anonymous Group Signatures (MLSAG signatures)
:param message:
:param pk: matrix of points, point form (not encoded)
:param xx:
:param kLRki:
:param mscout:
:param index:
:param dsRows:
:return:
"""
from apps.monero.xmr.serialize_messages.tx_full import MgSig

Expand Down Expand Up @@ -222,16 +184,6 @@ def prove_rct_mg(
This does the MG sig on the "dest" part of the given key matrix, and
the last row is the sum of input commitments from that column - sum output commitments
this shows that sum inputs = sum outputs
:param message:
:param pubs: matrix of CtKeys. points are encoded.
:param in_sk:
:param out_sk:
:param out_pk:
:param kLRki:
:param mscout:
:param index:
:param txn_fee_key:
:return:
"""
cols = len(pubs)
if cols == 0:
Expand Down
8 changes: 0 additions & 8 deletions src/apps/monero/xmr/monero.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,6 @@ def generate_monero_keys(seed):


def generate_sub_address_keys(view_sec, spend_pub, major, minor):
"""
Computes generic public sub-address
:param view_sec:
:param spend_pub:
:param major:
:param minor:
:return: spend public, view public
"""
if major == 0 and minor == 0: # special case, Monero-defined
return spend_pub, crypto.scalarmult_base(view_sec)

Expand Down
33 changes: 0 additions & 33 deletions src/apps/monero/xmr/ring_ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ def prove_range(
Range proof generator.
In order to minimize the memory consumption and CPU usage during transaction generation the returned values
are returned encoded.
:param amount:
:param last_mask:
:param backend_impl: backend implementation, if available
:param decode: decodes output
:param byte_enc: byte encoded
:param rsig: buffer for rsig
:return:
"""
if not backend_impl or not byte_enc or decode:
raise ValueError("Unsupported params")
Expand Down Expand Up @@ -133,14 +125,6 @@ def generate_ring_signature(prefix_hash, image, pubs, sec, sec_idx, test=False):
"""
Generates ring signature with key image.
void crypto_ops::generate_ring_signature()
:param prefix_hash:
:param image:
:param pubs:
:param sec:
:param sec_idx:
:param test:
:return:
"""
from trezor.utils import memcpy

Expand Down Expand Up @@ -206,14 +190,6 @@ def generate_ring_signature(prefix_hash, image, pubs, sec, sec_idx, test=False):


def check_ring_singature(prefix_hash, image, pubs, sig):
"""
Checks ring signature generated with generate_ring_signature
:param prefix_hash:
:param image:
:param pubs:
:param sig:
:return:
"""
from trezor.utils import memcpy

image_unp = crypto.ge_frombytes_vartime(image)
Expand Down Expand Up @@ -260,15 +236,6 @@ def export_key_image(
):
"""
Generates key image for the TXO + signature for the key image
:param creds:
:param subaddresses:
:param pkey:
:param tx_pub_key:
:param additional_tx_pub_keys:
:param out_idx:
:param test:
:param verify:
:return:
"""
from apps.monero.xmr import monero

Expand Down
6 changes: 0 additions & 6 deletions src/apps/monero/xmr/serialize_messages/tx_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ def f_specs(cls):
)

def serialize_rctsig_base(self, ar, inputs, outputs):
"""
Custom serialization
:param ar:
:type ar: x.Archive
:return:
"""
self._msg_field(ar, idx=0)
if self.type == RctType.Null:
return
Expand Down
5 changes: 0 additions & 5 deletions src/apps/monero/xmr/serialize_messages/tx_sig.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ class SignatureArray(ContainerType):


def get_signature_size(msg):
"""
Returns a signature size for the input
:param msg:
:return:
"""
if isinstance(msg, (TxinGen, TxinToScript, TxinToScriptHash)):
return 0
elif isinstance(msg, TxinToKey):
Expand Down
6 changes: 0 additions & 6 deletions src/apps/monero/xmr/sub/addr.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ def classify_subaddresses(tx_dests, change_addr):


def addr_eq(a, b):
"""
Address comparisson. Allocation free.
:param a:
:param b:
:return:
"""
return (
a.spend_public_key == b.spend_public_key
and a.view_public_key == b.view_public_key
Expand Down

0 comments on commit ca2bd0c

Please sign in to comment.