Skip to content

Commit

Permalink
pyclient: test case for sending mix requests from the wrong address
Browse files Browse the repository at this point in the history
  • Loading branch information
dtebbs committed Feb 18, 2020
1 parent 8485e1b commit ec99ba0
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pyClient/test_commands/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,35 @@ def charlie_corrupt_bob_deposit(
assert(result_corrupt2 is None), \
"Charlie managed to corrupt Bob's deposit the second time!"

# Case3: Charlie uses the correct mix data, but attempts to send the mix
# call from his own address (thereby receiving the output).
result_corrupt3 = None
try:
joinsplit_sig_bob = joinsplit.joinsplit_sign(
joinsplit_keypair,
bob_eth_address,
pk_sender,
ciphertexts,
proof_json)
tx_hash = zeth_client.mix(
pk_sender,
ciphertexts[0],
ciphertexts[1],
proof_json,
joinsplit_keypair.vk,
joinsplit_sig_bob,
charlie_eth_address,
Web3.toWei(BOB_DEPOSIT_ETH, 'ether'),
DEFAULT_MIX_GAS_WEI)
result_corrupt3 = \
wait_for_tx_update_mk_tree(zeth_client, mk_tree, tx_hash)
except Exception as e:
print(
f"Charlie's third corruption attempt" +
f" successfully rejected! (msg: {e})"
)
assert(result_corrupt3 is None), \
"Charlie managed to corrupt Bob's deposit the third time!"
# ### ATTACK BLOCK

# Bob transaction is finally mined
Expand Down

0 comments on commit ec99ba0

Please sign in to comment.