diff --git a/.travis.yml b/.travis.yml index 99ba39c1b..4543db067 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: - pip install -e . - pip install coveralls - yes | pip uninstall neo-boa neocore - - pip install -e git+https://github.com/CityOfZion/neo-boa@development#egg=neo-boa + - pip install -e git+https://github.com/jseagrave21/neo-boa@patch-1#egg=neo-boa - pip install -e git+https://github.com/CityOfZion/neo-python-core@master#egg=neocore env: diff --git a/docs/source/tests.rst b/docs/source/tests.rst index 9ad223da0..1db6d8321 100644 --- a/docs/source/tests.rst +++ b/docs/source/tests.rst @@ -78,7 +78,7 @@ e) Create new wallets only if absolutely necessary. .. code-block:: sh - docker run --rm -d --name neo-privnet-unittest -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp dautt/neo-privnet-unittest:v0.0.xx`` + docker run --rm -d --name neo-privnet-unittest -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp cityofzion/neo-python-privnet-unittest:v0.0.xx 3) Clean the current ``unittest`` chain: @@ -97,7 +97,7 @@ e) Create new wallets only if absolutely necessary. .. code-block:: sh - python prompt.py -u + np-prompt -u 6) Use the following wallets for generating transactions: @@ -131,23 +131,51 @@ In that way we can easily find out all the contracts deploy on the image by runn .. code-block:: sh - docker commit neo-privnet-unittest dautt/neo-privnet-unittest:v0.0.xx+1 + docker commit neo-privnet-unittest cityofzion/neo-python-privnet-unittest:v0.0.xx+1 The reason for this is that we need to keep the image as small as possible. It can inadvertently happen that your image has been accumulating new blocks for days or weeks e.g. while working on implementing the new tests in phases, which unnecessarily increases the image size. Our test fixtures are reset and extracted 20+ times in our build system so any size increase will add a delay * 20 or more. -10) Create the fixtures by incrementing the suffix number (x+1): +10) Stop your current docker container before creating the new fixtures: .. code-block:: sh - notif_fixtures_vx+1.tar.gz - fixtures_vx+1.tar.gz + docker stop neo-privnet-unittest -11) Update the fixture name in the static class variables in the following files +11) Create the fixtures by incrementing the suffix number (x+1): + +**WARNING:** Ensure your fixtures include the following file structure: + +- For fixtures_vx+1.tar.gz: ``fixtures/test_chain`` + +- For notif_fixtures_vx+1.tar.gz: ``fixtures/test_notifications`` + +.. code-block:: sh + + tar -zcvf notif_fixtures_vx+1.tar.gz fixtures + tar -zcvf fixtures_vx+1.tar.gz fixtures + +12) Update the fixture name in the static class variables in the following files .. code-block:: sh neo.Utils.BlockchainFixtureTestCase.py - neo.api.REST.test_rest_api.py -12) Create a new PR with the link to the new image and the newly created fixtures. +13) Create a new PR with the link to the new image and the newly created fixtures. + +14) If you edited any of the fixture wallets, make sure you fully sync your wallet before uploading it to your PR's branch: + +- While the neo-privnet-unittest container is stopped, run ``np-prompt -u`` and open all affected fixture wallets + +- Check to ensure each wallet is 100% synced before closing + +- Update any affected tests + +**NOTE:** During ``make test`` or ``python -m unittest discover neo`` you should not see this warning, which indicates one or more fixture wallets is not fully synced: + +.. code-block:: sh + + [W 181116 16:13:07 Wallet:1063] Wait for your wallet to be synced before doing transactions. + To check enter 'wallet' and look at 'percent_synced', it should be 100. + Also the blockchain should be up to the latest blocks (see Progress). + Issuing 'wallet rebuild' restarts the syncing process. diff --git a/neo/Implementations/Blockchains/LevelDB/test_LevelDBBlockchain.py b/neo/Implementations/Blockchains/LevelDB/test_LevelDBBlockchain.py index 84baee683..f224d3c91 100644 --- a/neo/Implementations/Blockchains/LevelDB/test_LevelDBBlockchain.py +++ b/neo/Implementations/Blockchains/LevelDB/test_LevelDBBlockchain.py @@ -11,7 +11,7 @@ def leveldb_testpath(cls): # test need to be updated whenever we change the fixtures def test_initial_setup(self): - self.assertEqual(self._blockchain.Height, 12349) + self.assertEqual(self._blockchain.Height, 12362) def test_GetBlockHash(self): # test requested block height exceeding blockchain current_height diff --git a/neo/Implementations/Blockchains/LevelDB/tests/test_leveldb.py b/neo/Implementations/Blockchains/LevelDB/tests/test_leveldb.py index cac3eb902..11c0a7dca 100644 --- a/neo/Implementations/Blockchains/LevelDB/tests/test_leveldb.py +++ b/neo/Implementations/Blockchains/LevelDB/tests/test_leveldb.py @@ -11,4 +11,4 @@ def leveldb_testpath(cls): # test need to be updated whenever we change the fixtures def test_a_initial_setup(self): - self.assertEqual(self._blockchain.Height, 12349) + self.assertEqual(self._blockchain.Height, 12362) diff --git a/neo/Implementations/Wallets/peewee/test_user_wallet.py b/neo/Implementations/Wallets/peewee/test_user_wallet.py index 063a6c9ae..33ef97ee6 100644 --- a/neo/Implementations/Wallets/peewee/test_user_wallet.py +++ b/neo/Implementations/Wallets/peewee/test_user_wallet.py @@ -65,7 +65,7 @@ def test_1_initial_setup(self): self.assertEqual(neo_balance_should_be, neo_balance) - self.assertEqual(wallet.WalletHeight, 12351) + self.assertEqual(wallet.WalletHeight, 12363) def test_2_transactions(self): diff --git a/neo/Prompt/Commands/BuildNRun.py b/neo/Prompt/Commands/BuildNRun.py index cda740acb..e98237e20 100644 --- a/neo/Prompt/Commands/BuildNRun.py +++ b/neo/Prompt/Commands/BuildNRun.py @@ -122,7 +122,8 @@ def DoRun(contract_script, arguments, wallet, path, verbose=True, return tx, result, None, None -def TestBuild(script, invoke_args, wallet, plist='05', ret='05', dynamic=False, invoke_attrs=None, owners=None): +def TestBuild(script, invoke_args, wallet, plist='05', ret='05', arguments=[], dynamic=False, invoke_attrs=None, owners=None): + arguments, from_addr = get_from_addr(arguments) properties = ContractPropertyState.HasStorage if dynamic: @@ -133,4 +134,4 @@ def TestBuild(script, invoke_args, wallet, plist='05', ret='05', dynamic=False, script = generate_deploy_script(script, contract_properties=int(properties), parameter_list=plist, return_type=BigInteger.FromBytes(ret)) - return test_deploy_and_invoke(script, invoke_args, wallet, invoke_attrs=invoke_attrs, owners=owners) + return test_deploy_and_invoke(script, invoke_args, wallet, from_addr=from_addr, invoke_attrs=invoke_attrs, owners=owners) diff --git a/neo/Prompt/Commands/Send.py b/neo/Prompt/Commands/Send.py index 89f90c31d..165248730 100755 --- a/neo/Prompt/Commands/Send.py +++ b/neo/Prompt/Commands/Send.py @@ -362,9 +362,10 @@ def parse_and_sign(wallet, jsn): if relayed: print("Relayed Tx: %s " % tx.Hash.ToString()) + return tx else: print("Could not relay tx %s " % tx.Hash.ToString()) - return + return else: print("Transaction initiated, but the signature is incomplete") print(json.dumps(context.ToJson(), separators=(',', ':'))) @@ -374,3 +375,5 @@ def parse_and_sign(wallet, jsn): print("Could not send: %s " % e) traceback.print_stack() traceback.print_exc() + + return diff --git a/neo/Prompt/Commands/tests/test_claim_command.py b/neo/Prompt/Commands/tests/test_claim_command.py index 5e8a15429..b32442a8d 100644 --- a/neo/Prompt/Commands/tests/test_claim_command.py +++ b/neo/Prompt/Commands/tests/test_claim_command.py @@ -65,13 +65,18 @@ def test_1_no_available_claim(self): wallet = self.GetWallet3() + # claim gas + claim_tx, relayed = ClaimGas(wallet, require_password=False) + + self.assertTrue(relayed) + unspents = wallet.FindUnspentCoinsByAsset(self.NEO) - self.assertEqual(1, len(unspents)) + self.assertEqual(2, len(unspents)) unavailable_bonus = wallet.GetUnavailableBonus() - self.assertEqual(Fixed8.FromDecimal(0.0002685), unavailable_bonus) + self.assertEqual(Fixed8.FromDecimal(0.000008), unavailable_bonus) unclaimed_coins = wallet.GetUnclaimedCoins() @@ -91,7 +96,7 @@ def test_2_wallet_with_claimable_gas(self): unavailable_bonus = wallet.GetUnavailableBonus() - self.assertEqual(Fixed8.FromDecimal(0.000601), unavailable_bonus) + self.assertEqual(Fixed8.FromDecimal(0.000653), unavailable_bonus) unclaimed_coins = wallet.GetUnclaimedCoins() diff --git a/neo/Prompt/Commands/tests/test_send_commands.py b/neo/Prompt/Commands/tests/test_send_commands.py index c0dbced8b..d255098d1 100644 --- a/neo/Prompt/Commands/tests/test_send_commands.py +++ b/neo/Prompt/Commands/tests/test_send_commands.py @@ -8,7 +8,7 @@ from neo.Prompt.Commands import Send, Wallet from neo.Prompt.PromptData import PromptData import shutil -from mock import patch +from mock import patch, MagicMock import json from io import StringIO from neo.Prompt.PromptPrinter import pp @@ -23,6 +23,14 @@ class UserWalletTestCase(WalletFixtureTestCase): watch_addr_str = 'AGYaEi3W6ndHPUmW7T12FFfsbQ6DWymkEm' _wallet1 = None + wallet_2_addr = 'AGYaEi3W6ndHPUmW7T12FFfsbQ6DWymkEm' + _wallet2 = None + + wallet_3_addr = 'AZiE7xfyJALW7KmADWtCJXGGcnduYhGiCX' + _wallet3 = None + + wallet_2_and_3_multisig_addr = "Aau2M4UdXxwxLLizDw11eDZRDs5jpXduh8" + @classmethod def GetWallet1(cls, recreate=False): if cls._wallet1 is None or recreate: @@ -31,6 +39,22 @@ def GetWallet1(cls, recreate=False): to_aes_key(UserWalletTestCase.wallet_1_pass())) return cls._wallet1 + @classmethod + def GetWallet2(cls, recreate=False): + if cls._wallet2 is None or recreate: + shutil.copyfile(cls.wallet_2_path(), cls.wallet_2_dest()) + cls._wallet2 = UserWallet.Open(UserWalletTestCase.wallet_2_dest(), + to_aes_key(UserWalletTestCase.wallet_2_pass())) + return cls._wallet2 + + @classmethod + def GetWallet3(cls, recreate=False): + if cls._wallet3 is None or recreate: + shutil.copyfile(cls.wallet_3_path(), cls.wallet_3_dest()) + cls._wallet3 = UserWallet.Open(UserWalletTestCase.wallet_3_dest(), + to_aes_key(UserWalletTestCase.wallet_3_pass())) + return cls._wallet3 + @classmethod def tearDown(cls): PromptData.Wallet = None @@ -39,7 +63,7 @@ def test_send_neo(self): with patch('sys.stdout', new=StringIO()) as mock_print: with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_1_pass()]): PromptData.Wallet = self.GetWallet1(recreate=True) - args = ['send', 'neo', self.watch_addr_str, '50'] + args = ['send', 'neo', self.watch_addr_str, '1'] res = Wallet.CommandWallet().execute(args) @@ -50,7 +74,7 @@ def test_send_gas(self): with patch('sys.stdout', new=StringIO()) as mock_print: with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_1_pass()]): PromptData.Wallet = self.GetWallet1(recreate=True) - args = ['send', 'gas', self.watch_addr_str, '5'] + args = ['send', 'gas', self.watch_addr_str, '1'] res = Wallet.CommandWallet().execute(args) @@ -546,3 +570,112 @@ def test_sendmany_keyboard_interrupt(self): self.assertFalse(res) self.assertIn("Transaction cancelled", mock_print.getvalue()) + + def test_parse_and_sign_good(self): + with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_2_pass()]): + # start the tx from wallet2 + PromptData.Wallet = self.GetWallet2(recreate=True) + args = ['send', 'neo', self.wallet_1_addr, '1', '--from-addr=' + self.wallet_2_and_3_multisig_addr] + + Wallet.CommandWallet().execute(args) + + # now sign the tx with wallet3 + PromptData.Wallet = self.GetWallet3(recreate=True) + jsn = '{"type":"Neo.Core.ContractTransaction","hex":"800000014405fd5ae29ceeb20912776048c544109c8c67c4128c019863eca58cf677ad360000029b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500e1f505000000001cc9c05cefffe6cdd7b182816a9152ec218d2ec09b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc50084d71700000000d1c4904014bfe7d34e9e97370f2cd3a633377cd6","items":{"0xd67c3733a6d32c0f37979e4ed3e7bf144090c4d1":{"script":"522103989f7417da540a8ce00195738249291cba058102a12d2df1b00e2a826d8bd0612103c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e9603452ae","parameters":[{"type":"Signature"},{"type":"Signature"}],"signatures":{"03c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e96034":"b5b32d6b56f3729747380072c722c50b0ee91e930f58a58d49c98c5543e335b70f6a400c8e1f9fa9653f7605ad229974cacfac3143cd355ca900c328b3db6018"}}}}' + args = ['sign', jsn] + + res = Wallet.CommandWallet().execute(args) + + res = res.ToJson() + self.assertTrue(res) + self.assertEqual(res['vout'][0]['value'], "1") # verify the amount + self.assertEqual(res['vout'][0]['address'], self.wallet_1_addr) # verify to_address + self.assertEqual(res['vout'][1]['address'], self.wallet_2_and_3_multisig_addr) # verify from_address + + def test_parse_and_sign_bad_jsn(self): + with patch('sys.stdout', new=StringIO()) as mock_print: + with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_2_pass()]): + # start the tx from wallet2 + PromptData.Wallet = self.GetWallet2(recreate=True) + args = ['send', 'neo', self.wallet_1_addr, '1', '--from-addr=' + self.wallet_2_and_3_multisig_addr] + + Wallet.CommandWallet().execute(args) + + # now sign the tx with wallet3 + PromptData.Wallet = self.GetWallet3(recreate=True) + jsn = 'blah' + args = ['sign', jsn] + + res = Wallet.CommandWallet().execute(args) + + self.assertFalse(res) + self.assertIn("Failed to parse JSON", mock_print.getvalue()) + + def test_parse_and_sign_fails_to_relay(self): + with patch('sys.stdout', new=StringIO()) as mock_print: + with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_2_pass()]): + with patch('neo.Prompt.Commands.Send.NodeLeader.Relay', return_value=False): + # start the tx from wallet2 + PromptData.Wallet = self.GetWallet2(recreate=True) + args = ['send', 'neo', self.wallet_1_addr, '1', '--from-addr=' + self.wallet_2_and_3_multisig_addr] + + Wallet.CommandWallet().execute(args) + + # now sign the tx with wallet3 + PromptData.Wallet = self.GetWallet3(recreate=True) + jsn = '{"type":"Neo.Core.ContractTransaction","hex":"800000014405fd5ae29ceeb20912776048c544109c8c67c4128c019863eca58cf677ad360000029b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500e1f505000000001cc9c05cefffe6cdd7b182816a9152ec218d2ec09b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc50084d71700000000d1c4904014bfe7d34e9e97370f2cd3a633377cd6","items":{"0xd67c3733a6d32c0f37979e4ed3e7bf144090c4d1":{"script":"522103989f7417da540a8ce00195738249291cba058102a12d2df1b00e2a826d8bd0612103c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e9603452ae","parameters":[{"type":"Signature"},{"type":"Signature"}],"signatures":{"03c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e96034":"b5b32d6b56f3729747380072c722c50b0ee91e930f58a58d49c98c5543e335b70f6a400c8e1f9fa9653f7605ad229974cacfac3143cd355ca900c328b3db6018"}}}}' + args = ['sign', jsn] + + res = Wallet.CommandWallet().execute(args) + + self.assertFalse(res) + self.assertIn("Could not relay tx", mock_print.getvalue()) + + def test_parse_and_sign_twice(self): # this test implies there are more signatures needed + with patch('sys.stdout', new=StringIO()) as mock_print: + with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_2_pass()]): + # start the tx from wallet2 + PromptData.Wallet = self.GetWallet2(recreate=True) + args = ['send', 'neo', self.wallet_1_addr, '1', '--from-addr=' + self.wallet_2_and_3_multisig_addr] + + Wallet.CommandWallet().execute(args) + + # now sign the tx with wallet2 again + jsn = '{"type":"Neo.Core.ContractTransaction","hex":"800000014405fd5ae29ceeb20912776048c544109c8c67c4128c019863eca58cf677ad360000029b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500e1f505000000001cc9c05cefffe6cdd7b182816a9152ec218d2ec09b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc50084d71700000000d1c4904014bfe7d34e9e97370f2cd3a633377cd6","items":{"0xd67c3733a6d32c0f37979e4ed3e7bf144090c4d1":{"script":"522103989f7417da540a8ce00195738249291cba058102a12d2df1b00e2a826d8bd0612103c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e9603452ae","parameters":[{"type":"Signature"},{"type":"Signature"}],"signatures":{"03c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e96034":"b5b32d6b56f3729747380072c722c50b0ee91e930f58a58d49c98c5543e335b70f6a400c8e1f9fa9653f7605ad229974cacfac3143cd355ca900c328b3db6018"}}}}' + args = ['sign', jsn] + + res = Wallet.CommandWallet().execute(args) + + self.assertFalse(res) + self.assertIn("Transaction initiated, but the signature is incomplete", mock_print.getvalue()) + + def test_parse_and_sign_exception(self): + with patch('sys.stdout', new=StringIO()) as mock_print: + with patch('neo.Prompt.Commands.Send.prompt', side_effect=[UserWalletTestCase.wallet_2_pass()]): + with patch('neo.Prompt.Commands.Send.traceback'): # mocking traceback module to avoid stacktrace printing during test run + # start the tx from wallet2 + PromptData.Wallet = self.GetWallet2(recreate=True) + args = ['send', 'neo', self.wallet_1_addr, '1', '--from-addr=' + self.wallet_2_and_3_multisig_addr] + + Wallet.CommandWallet().execute(args) + + # mocking wallet to trigger the exception + PromptData.Wallet = MagicMock() + PromptData.Wallet.Sign.side_effect = Exception + jsn = '{"type":"Neo.Core.ContractTransaction","hex":"800000014405fd5ae29ceeb20912776048c544109c8c67c4128c019863eca58cf677ad360000029b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500e1f505000000001cc9c05cefffe6cdd7b182816a9152ec218d2ec09b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc50084d71700000000d1c4904014bfe7d34e9e97370f2cd3a633377cd6","items":{"0xd67c3733a6d32c0f37979e4ed3e7bf144090c4d1":{"script":"522103989f7417da540a8ce00195738249291cba058102a12d2df1b00e2a826d8bd0612103c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e9603452ae","parameters":[{"type":"Signature"},{"type":"Signature"}],"signatures":{"03c46aec8d1ac8cb58fe74764de223d15e7045de67a51d1a4bcecd396918e96034":"b5b32d6b56f3729747380072c722c50b0ee91e930f58a58d49c98c5543e335b70f6a400c8e1f9fa9653f7605ad229974cacfac3143cd355ca900c328b3db6018"}}}}' + args = ['sign', jsn] + + res = Wallet.CommandWallet().execute(args) + + self.assertFalse(res) + self.assertIn("Could not send:", mock_print.getvalue()) + + def test_parse_and_sign_no_args(self): + with patch('sys.stdout', new=StringIO()) as mock_print: + PromptData.Wallet = self.GetWallet2(recreate=True) + args = ['sign'] + + res = Wallet.CommandWallet().execute(args) + + self.assertFalse(res) + self.assertIn("Please specify the required parameter", mock_print.getvalue()) diff --git a/neo/SmartContract/Contract.py b/neo/SmartContract/Contract.py index 8285a93a2..06e5f05cc 100644 --- a/neo/SmartContract/Contract.py +++ b/neo/SmartContract/Contract.py @@ -89,13 +89,13 @@ def Create(redeemScript, parameterList, publicKeyHash): def CreateMultiSigRedeemScript(m, publicKeys): if m < 1: - raise Exception("Minimum required signature count is 1, specified {}.".format(m)) + raise ValueError("Minimum required signature count is 1, specified {}.".format(m)) if m > len(publicKeys): - raise Exception("Invalid public key count. Minimum required signatures is bigger than supplied public keys count.") + raise ValueError("Invalid public key count. Minimum required signatures is bigger than supplied public keys count.") if len(publicKeys) > 1024: - raise Exception("Supplied public key count ({}) exceeds maximum of 1024.".format(len(publicKeys))) + raise ValueError("Supplied public key count ({}) exceeds maximum of 1024.".format(len(publicKeys))) sb = ScriptBuilder() sb.push(m) diff --git a/neo/SmartContract/tests/test_smart_contract.py b/neo/SmartContract/tests/test_smart_contract.py index 6bb273eb8..9b284055a 100644 --- a/neo/SmartContract/tests/test_smart_contract.py +++ b/neo/SmartContract/tests/test_smart_contract.py @@ -14,7 +14,7 @@ def leveldb_testpath(cls): # test need to be updated whenever we change the fixtures def test_a_initial_setup(self): - self.assertEqual(self._blockchain.Height, 12349) + self.assertEqual(self._blockchain.Height, 12362) invb = b'000000007134e5ee56f841bb73dbff969a9ef793c05f175cd386b2f24874a54c441cc0500e6c4e19da72fd4956a28670f36d26e03fd43c1794a1d3a5ad4f738dd48b53f505c7605b992400006b76abd322b7bd0bbe48d3a3f5d10013ab9ffee489706078714f1ea201c3400df8020bf9c22cd865b43b73060be3302abbab95b5f38941ba288cd77b846c9c1edcef1ab9a108f0a2fb8180e88178d3e85e316243054e48b29ced9dde54766340d9efc4f6d78970aba6712688071b862413bd53d58620e87c951aa3eac5c2611cdfecfcf084c12cfbe6cd356ef7726b9b5e93c10b5ffa7dc6e77ae8dc8c7af09240756caac1dad30a93662f36194fe270bb2afe0a557492122027df5f95dc5b1b9d18b169a6a96795019067ba008e5d42250c23886f0807ec20f3c880b2e740d1048b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae0200006b76abd300000000d101de39202f726f6f742f2e6e656f707974686f6e2f436861696e732f556e6974546573742d534d2f636f6e7472616374732f73616d706c65322e70790474657374047465737404746573740474657374000102030702024c725ec56b6a00527ac46a51527ac46a52527ac46a00c3036164649c640d006a51c36a52c3936c7566616a00c3037375629c640d006a51c36a52c3946c7566616a00c3036d756c9c640d006a51c36a52c3956c7566616a00c3036469769c640d006a51c36a52c3966c7566614f6c7566006c756668134e656f2e436f6e74726163742e437265617465001a7118020000000001347fff9221a8caf429279a82906688eb78264c1a9a2791d95ee47b6e095120aa000001e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c600080b5fc5c02000023ba2703c53263e8d6e522dc32203339dcd8eee90141405787dc8c47ba7da02668582b822bb50e1b615546a5f01826967cba603a0744a01aed6c098d809f20ec199a84269aa01ea911564effe7c1b4ad65d71f4ca995a12321031a6c6fbbdf02ca351745fa86b9ba5a9452d785ac4f7fc2b7548ca2a46c4fcf4aac' invbh = b'ac2d9d876bb6ee5cf1d011820409180cda7594b88c94f94a110ce2f5e472294e' diff --git a/neo/Utils/BlockchainFixtureTestCase.py b/neo/Utils/BlockchainFixtureTestCase.py index ef30557a7..218d6a19b 100644 --- a/neo/Utils/BlockchainFixtureTestCase.py +++ b/neo/Utils/BlockchainFixtureTestCase.py @@ -15,11 +15,11 @@ class BlockchainFixtureTestCase(NeoTestCase): - FIXTURE_REMOTE_LOC = 'https://s3.us-east-2.amazonaws.com/cityofzion/fixtures/fixtures_v8.tar.gz' - FIXTURE_FILENAME = os.path.join(settings.DATA_DIR_PATH, 'Chains/fixtures_v8.tar.gz') + FIXTURE_REMOTE_LOC = 'https://s3.us-east-2.amazonaws.com/cityofzion/fixtures/fixtures_v9.tar.gz' + FIXTURE_FILENAME = os.path.join(settings.DATA_DIR_PATH, 'Chains/fixtures_v9.tar.gz') - N_FIXTURE_REMOTE_LOC = 'https://s3.us-east-2.amazonaws.com/cityofzion/fixtures/notif_fixtures_v8.tar.gz' - N_FIXTURE_FILENAME = os.path.join(settings.DATA_DIR_PATH, 'Chains/notif_fixtures_v8.tar.gz') + N_FIXTURE_REMOTE_LOC = 'https://s3.us-east-2.amazonaws.com/cityofzion/fixtures/notif_fixtures_v9.tar.gz' + N_FIXTURE_FILENAME = os.path.join(settings.DATA_DIR_PATH, 'Chains/notif_fixtures_v9.tar.gz') N_NOTIFICATION_DB_NAME = os.path.join(settings.DATA_DIR_PATH, 'fixtures/test_notifications') _blockchain = None diff --git a/neo/Utils/fixtures/neo-test1-w.wallet b/neo/Utils/fixtures/neo-test1-w.wallet index d136a7de8..3e1af06fa 100644 Binary files a/neo/Utils/fixtures/neo-test1-w.wallet and b/neo/Utils/fixtures/neo-test1-w.wallet differ diff --git a/neo/Utils/fixtures/neo-test2-w.wallet b/neo/Utils/fixtures/neo-test2-w.wallet index c88d40497..bb8df1d93 100644 Binary files a/neo/Utils/fixtures/neo-test2-w.wallet and b/neo/Utils/fixtures/neo-test2-w.wallet differ diff --git a/neo/Utils/fixtures/neo-test3-w.wallet b/neo/Utils/fixtures/neo-test3-w.wallet index 6c24176eb..9c1bf29c8 100644 Binary files a/neo/Utils/fixtures/neo-test3-w.wallet and b/neo/Utils/fixtures/neo-test3-w.wallet differ diff --git a/neo/api/JSONRPC/test_json_rpc_api.py b/neo/api/JSONRPC/test_json_rpc_api.py index ff88433af..d8d660591 100644 --- a/neo/api/JSONRPC/test_json_rpc_api.py +++ b/neo/api/JSONRPC/test_json_rpc_api.py @@ -269,7 +269,7 @@ def test_get_bestblockhash(self): req = self._gen_post_rpc_req("getbestblockhash", params=[]) mock_req = mock_post_request(json.dumps(req).encode("utf-8")) res = json.loads(self.app.home(mock_req)) - self.assertEqual(res['result'], '0x62539bdf30ff2567355efb38b1911cc07258710cfab5b50d3e32751618969bcb') + self.assertEqual(res['result'], '0x5f2ffd95918f789c69833f3db2720fdfe94f7383dec5d076d9835342169ecfa2') def test_get_connectioncount(self): # make sure we have a predictable state @@ -748,7 +748,7 @@ def test_valid_multirequest(self): self.assertEqual(type(res), list) self.assertEqual(len(res), 2) - expected_raw_block = '00000000999086db552ba8f84734bddca55b25a8d3d8c5f866f941209169c38d35376e9902c78a8ae8efe7e9d46f76399a9d9449155e861d6849c110ea5f6b7d146a9a8aa4d1305b01000000bd7d9349807816a1be48d3a3f5d10013ab9ffee489706078714f1ea201c340dcbeadb300ff983f40f537ba6d63721cafda183b2cd161801ffb0f8316f100b63dbfbae665bba75fa1a954f14351f91cbf07bf90e60ff79f3e9076bcb1b512184075c25a44184ce92f7d7af1d2f22bee69374dd1bf0327f8956ede0dc23dda90106cf555fb8202fe6db9acda1d0b4fff8fdcd0404daa4b359c73017c7cdb80094640fb383c7016aae89a0a01b3c431a5625340378b95b57f4b71c4427ff1177a786b11b1c8060c075e3234afdd03790764ccd99680ea102890e359ab9050b5b32b2b8b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae010000bd7d934900000000' + expected_raw_block = '00000000999086db552ba8f84734bddca55b25a8d3d8c5f866f941209169c38d35376e9902c78a8ae8efe7e9d46f76399a9d9449155e861d6849c110ea5f6b7d146a9a8aa4d1305b01000000bd7d9349807816a1be48d3a3f5d10013ab9ffee489706078714f1ea201c340dcbeadb300ff983f40f537ba6d63721cafda183b2cd161801ffb0f8316f100b63dbfbae665bba75fa1a954f14351f91cbf07bf90e60ff79f3e9076bcb1b5121840665a065b967ac0bddddd1ed1b9a7c02c7c434e804e6e77d019778b74d6642423401e35dd9d8195d6896322e7ed6922c1eb8b086391b884a6acda2c34b70927f84075c25a44184ce92f7d7af1d2f22bee69374dd1bf0327f8956ede0dc23dda90106cf555fb8202fe6db9acda1d0b4fff8fdcd0404daa4b359c73017c7cdb8009468b532102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd622102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc22103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee69954ae010000bd7d934900000000' self.assertEqual(res[0]['result'], expected_raw_block) expected_verbose_hash = '0x55f745c9098d5d5bdaff9f8f32aad29c904c83d9832b48c16e677d30c7da4273' self.assertEqual(res[1]['result']['hash'], expected_verbose_hash)