tokenika / eosfactory

Python-based EOS smart-contract development & testing framework
http://eosfactory.io/
Other
243 stars 62 forks source link

I executed '''python3 tests/01_hello_world.py''' on mac and I got the following error. #115

Closed Jamiejoin closed 5 years ago

Jamiejoin commented 5 years ago

I executed python3 tests/01_hello_world.py on mac and I got the following error.

➜  eosfactory git:(master)  python3 tests/01_hello_world.py

###  SCENARIO:
Create a contract from template, then build and deploy it.

Removing testnet cache for prefix `_127_0_0_1_8888_`
Testnet cache successfully removed.
Local node is stopped [].
...............Local node is stopped [18832].
...............E
======================================================================
ERROR: setUpClass (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/manager.py", line 130, in node_start
    teos.node_probe(verbosity)
  File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/teos.py", line 556, in node_probe
    ''')
eosfactory.core.errors.Error: ERROR:
The local node does not respond.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tests/01_hello_world.py", line 19, in setUpClass
    reset()
  File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/manager.py", line 149, in reset
    clear=True, nodeos_stdout=nodeos_stdout, verbosity=verbosity)
  File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/manager.py", line 133, in node_start
    teos.node_probe(verbosity)
  File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/teos.py", line 556, in node_probe
    ''')
eosfactory.core.errors.Error: ERROR:
The local node does not respond.

----------------------------------------------------------------------
Ran 0 tests in 31.494s

FAILED (errors=1)
stefanzarembinski commented 5 years ago

I guess that the nodeos executable is not satisfied with the command line send by EOSFactory. You can read the command line:

First, open the script tests/01_hello_world.py in an editor. Replace the the line number 19

reset()

with the following three lines:

setup.is_print_command_line = True
reset()
setup.is_print_command_line = False

Next, run the script: python3 tests/01_hello_world.py

You will see in the outputs something like this:

nodeos command line: /usr/bin/nodeos --http-server-address 127.0.0.1:8888 --data-dir /mnt/c/Workspaces/EOS/eosfactory/localnode/ --config-dir /mnt/c/Workspaces/EOS/eosfactory/localnode/ --chain-state-db-size-mb 200 --contracts-console --verbose-http-errors --enable-stale-production --producer-name eosio --signature-provider EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_api_plugin --genesis-json /mnt/c/Workspaces/EOS/eosfactory/localnode/genesis.json --delete-all-blocks

Now, you can try te command line in a bash terminal:

$ /usr/bin/nodeos --http-server-address 127.0.0.1:8888 --data-dir /mnt/c/Workspaces/EOS/eosfactory/localnode/ --config-dir /mnt/c/Workspaces/EOS/eosfactory/localnode/ --chain-state-db-size-mb 200 --contracts-console --verbose-http-errors --enable-stale-production --producer-name eosio --signature-provider EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_api_plugin --genesis-json /mnt/c/Workspaces/EOS/eosfactory/localnode/genesis.json --delete-all-blocks

The nodeos will print an error message. Please, send it to me.

Your feedback prompts me to address problems like yours one. In the next edition of EOSFactory, soon, the issue will be better manageable.

SZ

Jamiejoin commented 5 years ago

I follow the instructions of your prompt and will continue to loop all the time. Below is the pop-up window of my MACOS. (In addition, I am worried about security. When I submit it to github, I will replace some characters with EOS6MRyAjQq8ud7hVNYcfnVxxxxx5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPxxxxxxjxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 )

/usr/local/bin/nodeos --http-server-address 127.0.0.1:8888 --data-dir /Users/li.yun/Documents/Blockchain/eosfactory/localnode/ --config-dir /Users/li.yun/Documents/Blockchain/eosfactory/localnode/ --chain-state-db-size-mb 200 --contracts-console --verbose-http-errors --enable-stale-production --producer-name eosio --signature-provider EOS6MRyAjQq8ud7hVNYcfnVxxxxx5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPxxxxxxjxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_api_plugin --genesis-json /Users/li.yun/Documents/Blockchain/eosfactory/localnode/genesis.json --delete-all-blocks info 2019-01-05T02:31:46.811 thread-0 chain_plugin.cpp:333 plugin_initialize ] initializing chain plugin info 2019-01-05T02:31:46.812 thread-0 chain_plugin.cpp:481 plugin_initialize ] Deleting state database and blocks info 2019-01-05T02:31:46.820 thread-0 chain_plugin.cpp:609 plugin_initialize ] Using genesis state provided in '/Users/li.yun/Documents/Blockchain/eosfactory/localnode/genesis.json' warn 2019-01-05T02:31:46.820 thread-0 chain_plugin.cpp:611 plugin_initialize ] Starting up fresh blockchain with provided genesis state. info 2019-01-05T02:31:46.825 thread-0 http_plugin.cpp:422 plugin_initialize ] configured http to listen on 127.0.0.1:8888 info 2019-01-05T02:31:46.825 thread-0 net_plugin.cpp:2898 plugin_initialize ] Initialize net plugin info 2019-01-05T02:31:46.825 thread-0 net_plugin.cpp:2924 plugin_initialize ] host: 0.0.0.0 port: 9876 info 2019-01-05T02:31:46.826 thread-0 net_plugin.cpp:2995 plugin_initialize ] my node_id is 22db1c627914dd24961790b1898e242b477cd313c79baef9b1270c195403803c info 2019-01-05T02:31:46.826 thread-0 main.cpp:107 main ] nodeos version v1.5.1 info 2019-01-05T02:31:46.826 thread-0 main.cpp:108 main ] eosio root is /Users/li.yun/Library/Application Support info 2019-01-05T02:31:46.826 thread-0 main.cpp:109 main ] nodeos using configuration file /Users/li.yun/Documents/Blockchain/eosfactory/localnode/config.ini info 2019-01-05T02:31:46.826 thread-0 main.cpp:110 main ] nodeos data directory is /Users/li.yun/Documents/Blockchain/eosfactory/localnode/ error 2019-01-05T02:31:46.826 thread-0 controller.cpp:1750 startup ] No head block in fork db, perhaps we need to replay warn 2019-01-05T02:31:46.826 thread-0 controller.cpp:601 initialize_fork_db ] Initializing new blockchain with genesis state info 2019-01-05T02:31:46.856 thread-0 chain_plugin.cpp:724 plugin_startup ] starting chain in read/write mode info 2019-01-05T02:31:46.856 thread-0 chain_plugin.cpp:728 plugin_startup ] Blockchain started; head block is #1, genesis timestamp is 2018-03-02T12:00:00.000 info 2019-01-05T02:31:46.856 thread-0 producer_plugin.cpp:718 plugin_startup ] producer plugin: plugin_startup() begin info 2019-01-05T02:31:46.856 thread-0 producer_plugin.cpp:740 plugin_startup ] Launching block production for 1 producers at 2019-01-05T02:31:46.856. warn 2019-01-05T02:31:46.857 thread-0 transaction_context.cp:108 deadline_timer ] Using polled checktime; deadline timer too inaccurate: min:5us max:2563us mean:581us stddev:721us info 2019-01-05T02:31:46.857 thread-0 producer_plugin.cpp:752 plugin_startup ] producer plugin: plugin_startup() end info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:486 plugin_startup ] start listening for http requests info 2019-01-05T02:31:46.857 thread-0 chain_api_plugin.cpp:77 plugin_startup ] starting chain_api_plugin info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/abi_bin_to_json info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/abi_json_to_bin info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_abi info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_account info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_block info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_block_header_state info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_code info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_code_hash info 2019-01-05T02:31:46.857 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_currency_balance info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_currency_stats info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_info info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_producer_schedule info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_producers info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_raw_abi info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_raw_code_and_abi info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_required_keys info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_scheduled_transactions info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_table_by_scope info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_table_rows info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/get_transaction_id info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/push_block info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/push_transaction info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/chain/push_transactions info 2019-01-05T02:31:46.858 thread-0 history_api_plugin.cpp:38 plugin_startup ] starting history_api_plugin info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/history/get_actions info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/history/get_controlled_accounts info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/history/get_key_accounts info 2019-01-05T02:31:46.858 thread-0 http_plugin.cpp:554 add_handler ] add api url: /v1/history/get_transaction info 2019-01-05T02:31:46.858 thread-0 net_plugin.cpp:3014 plugin_startup ] starting listener, max clients is 25 info 2019-01-05T02:31:47.005 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 000000023792024a... #2 @ 2019-01-05T02:31:47.000 signed by eosio [trxs: 0, lib: 0, confirmed: 0] info 2019-01-05T02:31:47.501 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 000000034a1b1136... #3 @ 2019-01-05T02:31:47.500 signed by eosio [trxs: 0, lib: 2, confirmed: 0] info 2019-01-05T02:31:48.004 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 00000004cd338bcc... #4 @ 2019-01-05T02:31:48.000 signed by eosio [trxs: 0, lib: 3, confirmed: 0] info 2019-01-05T02:31:48.506 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 000000052ea20a45... #5 @ 2019-01-05T02:31:48.500 signed by eosio [trxs: 0, lib: 4, confirmed: 0] info 2019-01-05T02:31:49.003 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 000000065746eca9... #6 @ 2019-01-05T02:31:49.000 signed by eosio [trxs: 0, lib: 5, confirmed: 0] info 2019-01-05T02:31:49.501 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 000000074ecde28a... #7 @ 2019-01-05T02:31:49.500 signed by eosio [trxs: 0, lib: 6, confirmed: 0] info 2019-01-05T02:31:50.003 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 00000008800ce031... #8 @ 2019-01-05T02:31:50.000 signed by eosio [trxs: 0, lib: 7, confirmed: 0] info 2019-01-05T02:31:50.505 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 00000009dc4aed09... #9 @ 2019-01-05T02:31:50.500 signed by eosio [trxs: 0, lib: 8, confirmed: 0] info 2019-01-05T02:31:51.001 thread-0 producer_plugin.cpp:1494 produce_block ] Produced block 0000000a0f1d5990... #10 @ 2019-01-05T02:31:51.000 signed by eosio [trxs: 0, lib: 9, confirmed: 0]

Jamiejoin commented 5 years ago

The above error, I have already solved it. Execute the command brew uninstall --force gettext && brew install gettext

But another error has occurred `######### Created contract project _wslqwjvacdyugodewiyd, originated from template /Users/li.yun/Documents/Blockchain/eosfactory/templates/contracts/01_hello_world. ELocal node is stopped [25147].

====================================================================== ERROR: test_01 (main.Test)

Traceback (most recent call last): File "tests/01_hello_world.py", line 44, in test_01 contract.build() File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/shell/contract.py", line 46, in build self.build_abi() File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/shell/contract.py", line 42, in build_abi teos.ABI(self.contract_dir) File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/teos.py", line 102, in ABI config.eosio_abigen(), File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/config.py", line 134, in eosio_abigen return first_valid_path(eosioabigen) File "/Users/li.yun/Documents/Blockchain/eosfactory/eosfactory/core/config.py", line 294, in first_valid_path '''.format(config_list[0])) eosfactory.core.errors.Error: ERROR: Cannot find any path for 'EOSIO_ABIGEN'.

----------------------------------------------------------------------`

stefanzarembinski commented 5 years ago

Note that there is a new edition of EOSFactory on github: version 2.4. It is cleaned and much better documented. Please, switch to this version.

I guess, that the error, you report, is because do not have eosio.cdt installed. Please, see tutorial Installing EOSFactory. There you can read: Also, we assume that you have installed eosio.cdt v1.41. Binary installation suffices.

stefanzarembinski commented 5 years ago

You write: In addition, I am worried about security ...

I guess, you are surprizes seeing private keys. The exposition of the private keys is not issue of EOSFactory: it result from EOSIO design decisions. This design is that, in your own computer you have to feel safe.

Therefore, you can access your private keys that you keep in your local wallet. However, EOSIO cleos never exports your private keys outside.

stefanzarembinski commented 5 years ago

Back to the EOSIO_ABIGEN issue. Even if you have eosio.cdt installed, it may not include eosio-abigen executable as it is outdated.

The EOSFactory version 2.4 does not use this eosio-abigen. Please, change to 2.4.

Jamiejoin commented 5 years ago

Thank you very much, according to the method you said, the problem has been solved.