Skip to content

Commit

Permalink
Merge pull request #957 from HorizenOfficial/pc/SDK-1610
Browse files Browse the repository at this point in the history
pc/SDK-1610 - private key selection case insensitive
  • Loading branch information
paolocappelletti authored Nov 20, 2023
2 parents 5f89839 + 8caa47a commit 51ce11d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions qa/sc_evm_eoa2eoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ def run_test(self):
transferred_amount_in_zen)
assert_true(ret, msg)

logging.info("Repeat similar transaction with different case in sender address...")
transferred_amount_in_zen = Decimal('11')
ret, msg, _ = self.makeEoa2Eoa(sc_node_1, sc_node_2, evm_address_sc1.upper(), evm_address_sc2,
transferred_amount_in_zen)
assert_true(ret, msg)

logging.info("Create an EOA to EOA transaction moving some fund from SC1 address to a SC1 different address.")
evm_address_sc1_b = sc_node_1.wallet_createPrivateKeySecp256k1()["result"]["proposition"]["address"]
transferred_amount_in_zen = Decimal('22')
Expand Down Expand Up @@ -163,6 +169,13 @@ def run_test(self):
txJsonResult = sc_node_1.rpc_eth_getTransactionByHash(add_0x_prefix(txHash))['result']
assert_true("chainId" in txJsonResult)

logging.info("Repeat similar transaction with different case in sender address...")
transferred_amount_in_zen = Decimal('15')
ret, msg, txHash = self.makeEoa2Eoa(sc_node_1, sc_node_2, evm_address_sc1.upper(), evm_address_sc2,
transferred_amount_in_zen,
isEIP155=True, print_json_results=False)
assert_true(ret, msg)

# negative cases

logging.info("Create an EOA to EOA transaction moving all the from balance")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ case class AccountTransactionApiRoute(override val settings: RESTApiSettings,

val secret = allAccounts.find(
a => (fromAddress.isEmpty ||
BytesUtils.toHexString(a.asInstanceOf[PrivateKeySecp256k1].publicImage.address.toBytes) == fromAddress.get) &&
BytesUtils.toHexString(a.asInstanceOf[PrivateKeySecp256k1].publicImage.address.toBytes).equalsIgnoreCase(fromAddress.get)) &&
nodeView.getNodeState.getBalance(a.asInstanceOf[PrivateKeySecp256k1].publicImage.address)
.compareTo(txValueInWei) >= 0
)
Expand Down

0 comments on commit 51ce11d

Please sign in to comment.