Skip to content

Commit

Permalink
feat: enable IFE input challenging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pik694 committed Dec 11, 2019
1 parent bcc2de4 commit 86c4c14
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
9 changes: 7 additions & 2 deletions plasma_framework/python_tests/testlang/testlang.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ def piggyback_in_flight_exit_output(self, tx_id, output_index, account, bond=Non
def find_shared_input(tx_a, tx_b):
tx_a_input_index = 0
tx_b_input_index = 0
for i in range(0, 4):
for j in range(0, 4):
for i in range(len(tx_a.inputs)):
for j in range(len(tx_b.inputs)):
tx_a_input = tx_a.inputs[i].identifier
tx_b_input = tx_b.inputs[j].identifier
if tx_a_input == tx_b_input and tx_a_input != 0:
Expand Down Expand Up @@ -472,8 +472,13 @@ def challenge_in_flight_exit_input_spent(self, in_flight_tx_id, spend_tx_id, key
spend_tx = self.child_chain.get_transaction(spend_tx_id)
(in_flight_tx_input_index, spend_tx_input_index) = self.find_shared_input(in_flight_tx, spend_tx)
signature = spend_tx.signatures[spend_tx_input_index]

shared_input_identifier = in_flight_tx.inputs[in_flight_tx_input_index].identifier
shared_input_tx = self.child_chain.get_transaction(shared_input_identifier)

self.root_chain.challengeInFlightExitInputSpent(in_flight_tx.encoded, in_flight_tx_input_index,
spend_tx.encoded, spend_tx_input_index, signature,
shared_input_tx.encoded, shared_input_identifier,
**{'from': key.address})

def challenge_in_flight_exit_output_spent(self, in_flight_tx_id, spending_tx_id, output_index, key):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from eth_tester.exceptions import TransactionFailed
from plasma_core.constants import NULL_ADDRESS

pytestmark = pytest.mark.skip("WIP: moving tests to plasma framework")

# should succeed even when phase 2 of in-flight exit is over
@pytest.mark.parametrize("period", [1, 2, 4])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,24 @@ def challengeInFlightExitInputSpent(self, in_flight_tx,
in_flight_tx_input_index,
spending_tx,
spending_tx_input_index,
spending_tx_sig):
raise NotImplementedError
spending_tx_sig,
input_tx,
input_tx_txo_pos,
**kwargs):

spending_tx_witness = spending_tx_sig

args = (
in_flight_tx,
in_flight_tx_input_index,
spending_tx,
spending_tx_input_index,
spending_tx_witness,
input_tx,
input_tx_txo_pos
)

self.payment_exit_game.challengeInFlightExitInputSpent(args, **kwargs)

def challengeInFlightExitOutputSpent(self, in_flight_tx,
in_flight_tx_output_pos,
Expand Down

0 comments on commit 86c4c14

Please sign in to comment.