minor changes, whitespace
This commit is contained in:
parent
6a369f79d7
commit
816781ec7a
5 changed files with 38 additions and 16 deletions
|
|
@ -15,7 +15,7 @@ proto.eth.tx.unsigned: Ethereum unsigned transaction class
|
|||
import json
|
||||
|
||||
from ....tx import unsigned as TxBase
|
||||
from ....util import msg, msg_r
|
||||
from ....util import msg, msg_r, die
|
||||
from ....obj import CoinTxID, ETHNonce, Int, HexStr
|
||||
from ....addr import CoinAddr, TokenAddr
|
||||
from ..contract import Token
|
||||
|
|
@ -74,11 +74,18 @@ class Unsigned(Completed, TxBase.Unsigned):
|
|||
|
||||
o = self.txobj
|
||||
|
||||
m = 'mismatch -- a compromised online installation may have altered your serialized data!'
|
||||
assert o['from'] == self.inputs[0].addr, f'from_addr {m}'
|
||||
def do_mismatch_err(io, j, k, desc):
|
||||
m = 'A compromised online installation may have altered your serialized data!'
|
||||
fs = '\n{} mismatch!\n{}\n orig: {}\n serialized: {}'
|
||||
die(3, fs.format(desc.upper(), m, getattr(io[0], k), o[j]))
|
||||
|
||||
if o['from'] != self.inputs[0].addr:
|
||||
do_mismatch_err(self.inputs, 'from', 'addr', 'from-address')
|
||||
if self.outputs:
|
||||
assert o['to'] == self.outputs[0].addr, f'to_addr {m}'
|
||||
assert o['amt'] == self.outputs[0].amt, f'to_amt {m}'
|
||||
if o['to'] != self.outputs[0].addr:
|
||||
do_mismatch_err(self.outputs, 'to', 'addr', 'to-address')
|
||||
if o['amt'] != self.outputs[0].amt:
|
||||
do_mismatch_err(self.outputs, 'amt', 'amt', 'amount')
|
||||
|
||||
msg_r(f'Signing transaction{tx_num_str}...')
|
||||
|
||||
|
|
|
|||
|
|
@ -569,11 +569,16 @@ class CmdTestRunner:
|
|||
cmd if cfg.system # cfg.system is broken for main test group with overlay tree
|
||||
else os.path.relpath(os.path.join(repo_root, cmd_dir, cmd)))
|
||||
|
||||
passthru_opts = (
|
||||
self.passthru_opts if not no_passthru_opts else
|
||||
[] if no_passthru_opts is True else
|
||||
[o for o in self.passthru_opts if o[2:].split('=')[0] not in no_passthru_opts])
|
||||
|
||||
args = (
|
||||
self.pre_args +
|
||||
([] if no_exec_wrapper else ['scripts/exec_wrapper.py']) +
|
||||
[cmd_path] +
|
||||
([] if no_passthru_opts else self.passthru_opts) +
|
||||
passthru_opts +
|
||||
args)
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -692,8 +692,10 @@ class CmdTestAutosign(CmdTestAutosignBase):
|
|||
self.bad_msg_count = 0
|
||||
|
||||
if self.simulate_led:
|
||||
LEDControl.create_dummy_control_files()
|
||||
db = LEDControl.boards['dummy']
|
||||
for fn in (db.control, db.trigger):
|
||||
run(f'sudo rm -f {fn}'.split(), check=True)
|
||||
LEDControl.create_dummy_control_files()
|
||||
usrgrp = {'linux': 'root:root', 'darwin': 'root:wheel'}[sys.platform]
|
||||
for fn in (db.control, db.trigger): # trigger the auto-chmod feature
|
||||
run(f'sudo chmod 644 {fn}'.split(), check=True)
|
||||
|
|
|
|||
|
|
@ -715,13 +715,13 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
|
|||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
t = self.spawn(
|
||||
'mmgen-txsign',
|
||||
self.eth_args
|
||||
+ [f'--coin={self.proto.coin}']
|
||||
+ ['--rpc-host=bad_host'] # ETH signing must work without RPC
|
||||
+ ([], ['--yes'])[ni]
|
||||
+ ([f'--keys-from-file={keyfile}'] if dev_send else [])
|
||||
+ add_args
|
||||
+ [txfile, dfl_words_file])
|
||||
self.eth_args
|
||||
+ [f'--coin={self.proto.coin}']
|
||||
+ ['--rpc-host=bad_host'] # ETH signing must work without RPC
|
||||
+ ([], ['--yes'])[ni]
|
||||
+ ([f'--keys-from-file={keyfile}'] if dev_send else [])
|
||||
+ add_args
|
||||
+ [txfile, dfl_words_file])
|
||||
return self.txsign_ui_common(t, ni=ni, has_label=True)
|
||||
|
||||
def txsend(self, ext='{}.regtest.sigtx', add_args=[], test=False):
|
||||
|
|
@ -1221,9 +1221,16 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
|
|||
def token_bal1(self):
|
||||
return self.token_bal(n='1')
|
||||
|
||||
def token_txcreate(self, args=[], token='', inputs='1', fee='50G', file_desc='Unsigned transaction'):
|
||||
def token_txcreate(
|
||||
self,
|
||||
args = [],
|
||||
token = '',
|
||||
inputs = '1',
|
||||
fee = '50G',
|
||||
file_desc = 'Unsigned transaction'):
|
||||
return self.txcreate_ui_common(
|
||||
self.spawn('mmgen-txcreate', self.eth_args + [f'--token={token}', '-B', f'--fee={fee}'] + args),
|
||||
self.spawn('mmgen-txcreate',
|
||||
self.eth_args + [f'--token={token}', '-B', f'--fee={fee}'] + args),
|
||||
menu = [],
|
||||
inputs = inputs,
|
||||
input_sels_prompt = 'to spend from',
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ class CmdTestRefAltcoin(CmdTestRef, CmdTestBase):
|
|||
t = self.spawn(
|
||||
'mmgen-txsign',
|
||||
['--outdir=test/trash', '--yes', f'--passwd-file={passfile}', dfl_words_file, txfile],
|
||||
no_passthru_opts = ['coin'],
|
||||
extra_desc = f'{proto.coin}{token_desc} {proto.network}')
|
||||
t.read()
|
||||
t.ok()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue