Skip to content

Commit

Permalink
style: change function parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
pik694 committed Nov 7, 2019
1 parent 21ce73b commit dd53831
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plasma_framework/python_tests/plasma_core/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def serialize(cls, obj):
tx_sedes = rlp.sedes.List(sedes_list)
return tx_sedes.serialize(tx_elems)

def sign(self, index, account, verifyingContract=None):
msg_hash = hash_struct(self, verifyingContract=verifyingContract)
def sign(self, index, account, verifying_contract=None):
msg_hash = hash_struct(self, verifying_contract=verifying_contract)
sig = account.key.sign_msg_hash(msg_hash)
self.signatures[index] = _amend_signature(sig.to_bytes())
self._signers[index] = sig.recover_public_key_from_msg_hash(
Expand Down
2 changes: 1 addition & 1 deletion plasma_framework/python_tests/testlang/testlang.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def spend_utxo(self, input_ids, accounts, outputs=None, metadata=None, force_inv
inputs = [decode_utxo_id(input_id) for input_id in input_ids]
spend_tx = Transaction(inputs=inputs, outputs=outputs, metadata=metadata)
for i in range(0, len(inputs)):
spend_tx.sign(i, accounts[i], verifyingContract=self.root_chain.plasma_framework)
spend_tx.sign(i, accounts[i], verifying_contract=self.root_chain.plasma_framework)
blknum = self.submit_block([spend_tx], force_invalid=force_invalid)
spend_id = encode_utxo_id(blknum, 0, 0)
return spend_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_challenge_standard_exit_wrong_oindex_should_fail(testlang):

spend_tx = Transaction(inputs=[decode_utxo_id(deposit_id)],
outputs=[(alice.address, NULL_ADDRESS, alice_money), (bob.address, NULL_ADDRESS, bob_money)])
spend_tx.sign(0, alice, verifyingContract=testlang.root_chain.plasma_framework)
spend_tx.sign(0, alice, verifying_contract=testlang.root_chain.plasma_framework)
blknum = testlang.submit_block([spend_tx])
alice_utxo = encode_utxo_id(blknum, 0, 0)
bob_utxo = encode_utxo_id(blknum, 0, 1)
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_challenge_standard_exit_with_in_flight_exit_tx_should_succeed(testlang)
spend_id = testlang.spend_utxo([deposit_id], [owner], outputs=[(owner.address, NULL_ADDRESS, amount)])

ife_tx = Transaction(inputs=[decode_utxo_id(spend_id)], outputs=[(owner.address, NULL_ADDRESS, amount)])
ife_tx.sign(0, owner, verifyingContract=testlang.root_chain.plasma_framework)
ife_tx.sign(0, owner, verifying_contract=testlang.root_chain.plasma_framework)

(encoded_spend, encoded_inputs, proofs, signatures) = testlang.get_in_flight_exit_info(None, spend_tx=ife_tx)
bond = testlang.root_chain.inFlightExitBond()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_start_standard_exit_wrong_oindex_should_fail(testlang):

spend_tx = Transaction(inputs=[decode_utxo_id(deposit_id)],
outputs=[(alice.address, NULL_ADDRESS, alice_money), (bob.address, NULL_ADDRESS, bob_money)])
spend_tx.sign(0, alice, verifyingContract=testlang.root_chain)
spend_tx.sign(0, alice, verifying_contract=testlang.root_chain)
blknum = testlang.submit_block([spend_tx])
alice_utxo = encode_utxo_id(blknum, 0, 0)
bob_utxo = encode_utxo_id(blknum, 0, 1)
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_old_signature_scheme_does_not_work_any_longer(testlang, utxo):
testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, old_signature)

# sanity check: let's provide new schema signature for a challenge
new_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifyingContract=testlang.root_chain)).to_bytes()
new_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifying_contract=testlang.root_chain)).to_bytes()
testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, new_signature)


Expand All @@ -260,12 +260,12 @@ def test_signature_scheme_respects_verifying_contract(testlang, utxo):

spend_tx = Transaction(inputs=[decode_utxo_id(spend_id)], outputs=outputs)

bad_contract_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifyingContract=None)).to_bytes()
bad_contract_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifying_contract=None)).to_bytes()

# challenge will fail on signature verification
with pytest.raises(TransactionFailed):
testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, bad_contract_signature)

# sanity check
proper_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifyingContract=testlang.root_chain)).to_bytes()
proper_signature = alice.key.sign_msg_hash(hash_struct(spend_tx, verifying_contract=testlang.root_chain)).to_bytes()
testlang.root_chain.challengeStandardExit(exit_id, spend_tx.encoded, 0, proper_signature)

0 comments on commit dd53831

Please sign in to comment.