icondev

> hyperconnect the world _

ICON is a scalable smart contract enabled blockchain platform with a long-term goal of interoperability between enterprise and public blockchains. Our goal is to Hyperconnect the World, and by combining groundbreaking technology, a strong community, and relentless growth strategies we believe this goal is reachable.

Get Started     Subscribe to our mailing list
Ask A Question

Questions

0

Can't get tbears to work properly

It seems to start properly, but I get some messages I don't know what to make of. When I try to run <tbears lastblock> I get a servererror. Any suggestions? $ tbears start Traceback (most recent call last): File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_service.py", line 183, in <module> main() File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_service.py", line 153, in main icon_service.serve(config=conf) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_service.py", line 78, in serve self._inner_service = IconScoreInnerService(amqp_target, self._icon_score_queue_name, conf=config) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/earlgrey/message_queue_service.py", line 39, in __init__ self._task = self.__class__.TaskType(**task_kwargs) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_inner_service.py", line 48, in __init__ self._open() File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_inner_service.py", line 56, in _open self._icon_service_engine.open(self._conf) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_service_engine.py", line 165, in open conf[ConfigKey.PREP_REGISTRATION_FEE]) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/icon_service_engine.py", line 209, in _open_component_context rc_socket_path) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/iiss/engine.py", line 83, in open self._init_reward_calc_proxy(log_dir, data_path, socket_path) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/iiss/engine.py", line 110, in _init_reward_calc_proxy self._reward_calc_proxy.open(log_dir=log_dir, sock_path=socket_path, iiss_db_path=data_path) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/iiss/reward_calc/ipc/reward_calc_proxy.py", line 65, in open self.start_reward_calc(log_dir=log_dir, sock_path=sock_path, iiss_db_path=iiss_db_path) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconservice/iiss/reward_calc/ipc/reward_calc_proxy.py", line 315, in start_reward_calc self._reward_calc = Popen(cmd.split(" ")) File "/usr/lib64/python3.7/subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "/usr/lib64/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'icon_rc': 'icon_rc' sys:1: RuntimeWarning: coroutine 'start_unix_server' was never awaited [2019-10-21 22:56:36 +0200] [5800] [INFO] Starting gunicorn 19.9.0 [2019-10-21 22:56:36 +0200] [5800] [INFO] Listening at: http://0.0.0.0:9000 (5800) [2019-10-21 22:56:36 +0200] [5800] [INFO] Using worker: sanic.worker.GunicornWorker [2019-10-21 22:56:36 +0200] [5811] [INFO] Booting worker with pid: 5811 [2019-10-21 22:56:36 +0200] [5818] [INFO] Booting worker with pid: 5818 [2019-10-21 22:56:36 +0200] [5825] [INFO] Booting worker with pid: 5825 [2019-10-21 22:56:36 +0200] [5832] [INFO] Booting worker with pid: 5832 [2019-10-21 22:56:36 +0200] [5839] [INFO] Booting worker with pid: 5839 [2019-10-21 22:56:36 +0200] [5846] [INFO] Booting worker with pid: 5846 [2019-10-21 22:56:36 +0200] [5853] [INFO] Booting worker with pid: 5853 [2019-10-21 22:56:36 +0200] [5860] [INFO] Booting worker with pid: 5860 [2019-10-21 22:56:36 +0200] [5867] [INFO] Booting worker with pid: 5867 [2019-10-21 22:56:36 +0200] [5874] [INFO] Booting worker with pid: 5874 [2019-10-21 22:56:36 +0200] [5881] [INFO] Booting worker with pid: 5881 [2019-10-21 22:56:36 +0200] [5888] [INFO] Booting worker with pid: 5888 [2019-10-21 22:56:36 +0200] [5895] [INFO] Booting worker with pid: 5895 [2019-10-21 22:56:36 +0200] [5902] [INFO] Booting worker with pid: 5902 [2019-10-21 22:56:37 +0200] [5909] [INFO] Booting worker with pid: 5909 [2019-10-21 22:56:37 +0200] [5916] [INFO] Booting worker with pid: 5916 [2019-10-21 22:56:37 +0200] [5923] [INFO] Booting worker with pid: 5923 Started tbears service successfully When trying to get the last block I get: $ tbears lastblock ERROR:root:can't convert negative int to unsigned Traceback (most recent call last): File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/earlgrey/message_queue_task.py", line 43, in _wrapper return await asyncio.coroutine(func)(*args, **kwargs) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/tbears/block_manager/channel_service.py", line 93, in get_block block_data_json = block.get_last_block() File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/tbears/block_manager/block.py", line 231, in get_last_block self.block_height.to_bytes(DEFAULT_BYTE_SIZE, DATA_BYTE_ORDER)) OverflowError: can't convert negative int to unsigned ERROR:root:can't convert negative int to unsigned ERROR:jsonrpcserver.request:Traceback (most recent call last): File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/jsonrpcserver/request.py", line 39, in handle_exceptions yield File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/jsonrpcserver/async_request.py", line 21, in call result = await callable_(*(self.args or []), **(self.kwargs or {})) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconrpcserver/dispatcher/v3/icx.py", line 205, in icx_getLastBlock channel_name=channel) File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/iconrpcserver/utils/json_rpc.py", line 145, in get_block_by_params tx_data_filter=tx_data_filter File "/home/skyvell/development/environments/icondev/lib/python3.7/site-packages/earlgrey/message_queue_stub.py", line 131, in _call_async_rpc raise result earlgrey.message_queue_task.MessageQueueException: can't convert negative int to unsigned { "jsonrpc": "2.0", "error": { "code": -32000, "message": "Server error" }, "id": 1 }

Posted by Ted Skyvell 27 days ago

5
ANSWERED

Pip fails to build libsecp256k1 when installing iconservice

I'm having trouble installing Iconservice. I'm on an arch linux system. What I've tried: - Installed libsecp256k1 from official arch linux repository (https://www.archlinux.org/packages/community/x86_64/libsecp256k1/). - Build and install libsecp256k1 from source (https://github.com/bitcoin-core/secp256k1). It still fails. I'm not sure how to post code. Can't find any buttons? If someone can tell me how, I will edit accordingly. Output when installing iconservice: $ pip install iconservice Collecting iconservice Using cached https://files.pythonhosted.org/packages/b5/13/acf09186570dc30b807d45acfd6733b3c6ee97c29838fb751383948b8d27/iconservice-1.4.3-py3-none-any.whl Requirement already satisfied: iso3166 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from iconservice) (1.0) Requirement already satisfied: earlgrey>=0.0.4 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from iconservice) (0.0.4) Collecting secp256k1==0.13.2 (from iconservice) Using cached https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz Requirement already satisfied: msgpack in /home/skyvell/anaconda3/lib/python3.7/site-packages (from iconservice) (0.6.1) Collecting setproctitle==1.1.10 (from iconservice) Using cached https://files.pythonhosted.org/packages/5a/0d/dc0d2234aacba6cf1a729964383e3452c52096dc695581248b548786f2b3/setproctitle-1.1.10.tar.gz Requirement already satisfied: plyvel>=1.0.5 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from iconservice) (1.1.0) Requirement already satisfied: iconcommons>=1.0.5 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from iconservice) (1.1.2) Requirement already satisfied: aio-pika==3.0.1 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from earlgrey>=0.0.4->iconservice) (3.0.1) Requirement already satisfied: pika==0.12.0 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from earlgrey>=0.0.4->iconservice) (0.12.0) Requirement already satisfied: cffi>=1.3.0 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from secp256k1==0.13.2->iconservice) (1.12.3) Requirement already satisfied: yarl in /home/skyvell/anaconda3/lib/python3.7/site-packages (from aio-pika==3.0.1->earlgrey>=0.0.4->iconservice) (1.3.0) Requirement already satisfied: shortuuid in /home/skyvell/anaconda3/lib/python3.7/site-packages (from aio-pika==3.0.1->earlgrey>=0.0.4->iconservice) (0.5.0) Requirement already satisfied: pycparser in /home/skyvell/anaconda3/lib/python3.7/site-packages (from cffi>=1.3.0->secp256k1==0.13.2->iconservice) (2.19) Requirement already satisfied: idna>=2.0 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from yarl->aio-pika==3.0.1->earlgrey>=0.0.4->iconservice) (2.8) Requirement already satisfied: multidict>=4.0 in /home/skyvell/anaconda3/lib/python3.7/site-packages (from yarl->aio-pika==3.0.1->earlgrey>=0.0.4->iconservice) (4.5.2) Building wheels for collected packages: secp256k1, setproctitle Building wheel for secp256k1 (setup.py) ... error ERROR: Complete output from command /home/skyvell/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-2ns1c47n/secp256k1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ay0pxy2x --python-tag cp37: ERROR: 1.6.3 Installed libsecp256k1 is unusable falling back to bundled version. Using bundled libsecp256k1 running bdist_wheel The [wheel] section is deprecated. Use [bdist_wheel] instead. running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/secp256k1 copying secp256k1/__main__.py -> build/lib.linux-x86_64-3.7/secp256k1 copying secp256k1/__init__.py -> build/lib.linux-x86_64-3.7/secp256k1 running build_ext generating cffi module 'build/temp.linux-x86_64-3.7/_libsecp256k1.c' creating build/temp.linux-x86_64-3.7 building '_libsecp256k1' extension creating build/temp.linux-x86_64-3.7/build creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7 gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/skyvell/anaconda3/include/python3.7m -c build/temp.linux-x86_64-3.7/_libsecp256k1.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o gcc -pthread -shared -B /home/skyvell/anaconda3/compiler_compat -L/home/skyvell/anaconda3/lib -Wl,-rpath=/home/skyvell/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o -lsecp256k1 -o build/lib.linux-x86_64-3.7/secp256k1/_libsecp256k1.cpython-37m-x86_64-linux-gnu.so /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: file not recognized: file format not recognized collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for secp256k1 Running setup.py clean for secp256k1 Building wheel for setproctitle (setup.py) ... error ERROR: Complete output from command /home/skyvell/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-2ns1c47n/setproctitle/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-6vkrs8ow --python-tag cp37: ERROR: running bdist_wheel running build running build_ext building 'setproctitle' extension creating build creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/src gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/skyvell/anaconda3/include/python3.7m -c src/setproctitle.c -o build/temp.linux-x86_64-3.7/src/setproctitle.o gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/skyvell/anaconda3/include/python3.7m -c src/spt_debug.c -o build/temp.linux-x86_64-3.7/src/spt_debug.o gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/skyvell/anaconda3/include/python3.7m -c src/spt_setup.c -o build/temp.linux-x86_64-3.7/src/spt_setup.o gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/skyvell/anaconda3/include/python3.7m -c src/spt_status.c -o build/temp.linux-x86_64-3.7/src/spt_status.o gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPT_VERSION=1.1.10 -DHAVE_SYS_PRCTL_H=1 -I/home/skyvell/anaconda3/include/python3.7m -c src/spt_strlcpy.c -o build/temp.linux-x86_64-3.7/src/spt_strlcpy.o creating build/lib.linux-x86_64-3.7 gcc -pthread -shared -B /home/skyvell/anaconda3/compiler_compat -L/home/skyvell/anaconda3/lib -Wl,-rpath=/home/skyvell/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/src/setproctitle.o build/temp.linux-x86_64-3.7/src/spt_debug.o build/temp.linux-x86_64-3.7/src/spt_setup.o build/temp.linux-x86_64-3.7/src/spt_status.o build/temp.linux-x86_64-3.7/src/spt_strlcpy.o -o build/lib.linux-x86_64-3.7/setproctitle.cpython-37m-x86_64-linux-gnu.so /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/src/setproctitle.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/src/setproctitle.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/src/setproctitle.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/src/setproctitle.o: unable to initialize decompress status for section .debug_info build/temp.linux-x86_64-3.7/src/setproctitle.o: file not recognized: file format not recognized collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Failed building wheel for setproctitle Running setup.py clean for setproctitle Failed to build secp256k1 setproctitle Installing collected packages: secp256k1, setproctitle, iconservice Running setup.py install for secp256k1 ... error ERROR: Complete output from command /home/skyvell/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-2ns1c47n/secp256k1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-z6v65zy9/install-record.txt --single-version-externally-managed --compile: ERROR: 1.6.3 Installed libsecp256k1 is unusable falling back to bundled version. Using bundled libsecp256k1 running install running build running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/secp256k1 copying secp256k1/__main__.py -> build/lib.linux-x86_64-3.7/secp256k1 copying secp256k1/__init__.py -> build/lib.linux-x86_64-3.7/secp256k1 running build_ext generating cffi module 'build/temp.linux-x86_64-3.7/_libsecp256k1.c' creating build/temp.linux-x86_64-3.7 building '_libsecp256k1' extension creating build/temp.linux-x86_64-3.7/build creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7 gcc -pthread -B /home/skyvell/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/skyvell/anaconda3/include/python3.7m -c build/temp.linux-x86_64-3.7/_libsecp256k1.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o gcc -pthread -shared -B /home/skyvell/anaconda3/compiler_compat -L/home/skyvell/anaconda3/lib -Wl,-rpath=/home/skyvell/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o -lsecp256k1 -o build/lib.linux-x86_64-3.7/secp256k1/_libsecp256k1.cpython-37m-x86_64-linux-gnu.so /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info /home/skyvell/anaconda3/compiler_compat/ld: build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: unable to initialize decompress status for section .debug_info build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o: file not recognized: file format not recognized collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 ---------------------------------------- ERROR: Command "/home/skyvell/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-2ns1c47n/secp256k1/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-z6v65zy9/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-2ns1c47n/secp256k1/

Posted by Ted Skyvell 2 months ago

2
ANSWERED

i cant start icon,need help.

hi teamer, i cant start node, $ pip list | grep "icon" iconcommons 1.1.2 iconrpcserver 1.3.1.1 iconsdk 1.0.7 iconservice 1.4.3 $ pip list | grep "loopchain" loopchain 2.2.1.4 /root/loopchain-2.2.1.4 errors: when start loopchain: py3.6 ~/loopchain-2.2.1.4# ./loopchain.py peer -r 127.0.0.1:7100 -o conf/mainnet/loopchain_conf.json Traceback (most recent call last): File "./loopchain.py", line 18, in <module> from loopchain.__main__ import main File "/root/loopchain-2.2.1.4/loopchain/__init__.py", line 16, in <module> from .launcher import * File "/root/loopchain-2.2.1.4/loopchain/launcher.py", line 85 print(f"not supported service type &#123;args.service_type&#125;\ncheck loopchain help.\n") ^ SyntaxError: invalid syntax then change env to py3.7: :~/loopchain-2.2.1.4# ./loopchain.py peer -r 127.0.0.1:7100 -o conf/mainnet/loopchain_conf.json Traceback (most recent call last): File "./loopchain.py", line 18, in <module> from loopchain.__main__ import main File "/root/loopchain-2.2.1.4/loopchain/__init__.py", line 16, in <module> from .launcher import * File "/root/loopchain-2.2.1.4/loopchain/launcher.py", line 24, in <module> import loopchain.utils as util File "/root/loopchain-2.2.1.4/loopchain/utils/__init__.py", line 39, in <module> from loopchain.protos import loopchain_pb2, message_code File "/root/loopchain-2.2.1.4/loopchain/protos/__init__.py", line 22, in <module> from .loopchain_pb2 import * ModuleNotFoundError: No module named 'loopchain.protos.loopchain_pb2' start iconservice iconservice start -c conf/mainnet/iconservice_conf.json Traceback (most recent call last): File "/opt/py3/bin/iconservice", line 10, in <module> sys.exit(main()) File "/opt/py3/lib/python3.6/site-packages/iconservice/icon_service_cli.py", line 99, in main Logger.load_config(conf) File "/opt/py3/lib/python3.6/site-packages/iconcommons/logger/logger.py", line 41, in load_config IconLoggerUtil.apply_config(icon_logger, config) File "/opt/py3/lib/python3.6/site-packages/iconcommons/logger/icon_logger_util.py", line 139, in apply_config cls._apply_config(logger, log_config) File "/opt/py3/lib/python3.6/site-packages/iconcommons/logger/icon_logger_util.py", line 179, in _apply_config log_config.rotate_config.backup_count) File "/opt/py3/lib/python3.6/site-packages/iconcommons/logger/icon_logger_util.py", line 233, in make_period_and_bytes_file_handler backupCount=backup_count) File "/opt/py3/lib/python3.6/site-packages/iconcommons/logger/icon_period_and_bytes_file_handler.py", line 28, in __init__ super().__init__(filename, mode, encoding, delay) File "/usr/lib/python3.6/logging/handlers.py", line 57, in __init__ logging.FileHandler.__init__(self, filename, mode, encoding, delay) File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__ StreamHandler.__init__(self, self._open()) File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open return open(self.baseFilename, self.mode, encoding=self.encoding) IsADirectoryError: [Errno 21] Is a directory: '/root/loopchain-2.2.1.4' cat conf/mainnet/iconservice_conf.json &#123; "log": &#123; "logger": "iconservice", "colorLog": true, "level": "warning", "outputType": "console|file", "rotate": &#123; "type": "period|bytes", "period": "daily", "interval": 1, "backupCount": 10, "maxBytes": 50000000 &#125; &#125;, "builtinScoreOwner": "hx677133298ed5319607a321a38169031a8867085c", "service": &#123; "fee": true, "audit": true, "deployerWhiteList": false, "scorePackageValidator": false &#125; &#125; cat conf/mainnet/iconrpcserver_conf.json &#123; "log": &#123; "logger": "iconrpcserver", "colorLog": true, "level": "warning", "filePath": "./log/mainnet/icon_dex/iconrpcserver.log", "outputType": "console|file", "rotate": &#123; "type": "period|bytes", "period": "daily", "interval": 1, "backupCount": 10, "maxBytes": 50000000 &#125; &#125;, "gunicornWorkerCount": 1, "redirectProtocol": "https" &#125; cat conf/mainnet/loopchain_conf.json &#123; "CHANNEL_OPTION" : &#123; "icon_dex": &#123; "block_versions": &#123; "0.1a": 0 &#125;, "hash_versions": &#123; "genesis": 0, "0x2": 1, "0x3": 1 &#125;, "load_cert": false, "consensus_cert_use": false, "tx_cert_use": false, "key_load_type": 0 &#125; &#125;, "PRIVATE_PATH": "./my_keystore.json", "RUN_ICON_IN_LAUNCHER": true, "PORT_PEER": 7200, "AMQP_KEY": "7200", "DEFAULT_STORAGE_PATH": ".storage_mainnet", "ALLOW_MAKE_EMPTY_BLOCK": false, "SUBSCRIBE_USE_HTTPS": true, "LOOPCHAIN_LOG_LEVEL": "INFO", "LOG_FILE_LOCATION": "./log/mainnet/icon_dex" &#125;

Posted by Altery 2 months ago

0

Tbears unit test fails if using ArrayDB Wrapper

Hey guys! I got a question regarding unit testing with tbears by extending the ScoreTestCase class: Somehow, I always get the error Ā«AttributeError: 'NoneType' object has no attribute 'revision'Ā» when I try to use the ArrayDB wrapper of the state database. Using ArrayDB works fine when interacting with my SCORE via e.g. the python sdk. If I replace the ArrayDB wrapper with an VarDB wrapper, as in the official tutorial (https://www.icondev.io/docs/writing-score), it also works. There's an internal error as the context object isn't initialized for some reason. I'm working inside the tbears docker container provided by the icon-foundation. The tbears version in the docker container is v1.2.2 ************************************************************************************************ The error output I get is the following: root@6c04f4cc76c4:/work/simple_scores# tbears test simple_score2 EE ====================================================================== ERROR: test_get_value_and_set_value (simple_score2.tests.test_unit_simple_score2.TestSimple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/work/simple_scores/simple_score2/tests/test_unit_simple_score2.py", line 29, in test_get_value_and_set_value self.assertEqual(self.score2.getValue(), '') File "/usr/local/lib/python3.7/site-packages/tbears/libs/scoretest/patch/score_patcher.py", line 71, in patched result = method(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_score_base.py", line 259, in wrapper res = func(calling_obj, *args, **kwargs) File "/work/simple_scores/simple_score2/simple_score2.py", line 35, in getValue return self.value.get() File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 265, in get return self[index] File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 307, in __getitem return ArrayDB._get(self._db, self.__get_size(), index, self.__value_type) File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 268, in __get_size if self.__is_defective_revision(): File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 318, in __is_defective_revision revision = context.revision AttributeError: 'NoneType' object has no attribute 'revision' ====================================================================== ERROR: test_set_value (simple_score2.tests.test_unit_simple_score2.TestSimple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/work/simple_scores/simple_score2/tests/test_unit_simple_score2.py", line 21, in test_set_value self.score2.setValue(str_value) File "/usr/local/lib/python3.7/site-packages/tbears/libs/scoretest/patch/score_patcher.py", line 71, in patched result = method(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_score_base.py", line 259, in __wrapper res = func(calling_obj, *args, **kwargs) File "/work/simple_scores/simple_score2/simple_score2.py", line 39, in setValue self.value.put(value) # <----------------------------------------------------------- and with self.value.set(value) File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 238, in put size: int = self.__get_size() File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 268, in __get_size if self.__is_defective_revision(): File "/usr/local/lib/python3.7/site-packages/iconservice/iconscore/icon_container_db.py", line 318, in __is_defective_revision revision = context.revision AttributeError: 'NoneType' object has no attribute 'revision' ---------------------------------------------------------------------- Ran 2 tests in 0.019s FAILED (errors=2) ************************************************************************************************ The SCORE from the tutorial that I modified is this one: from iconservice import * class SimpleScore2(IconScoreBase): def init(self, db: IconScoreDatabase) -> None: super().init(db) self.value = ArrayDB("value1", db, value_type=str) # <-------------------------------- it works with self.value = VarDB("value1", db, value_type=str) #self.score_address = VarDB("score_address", db, value_type=Address) @eventlog(indexed=0) def SetValue(self, value: str): pass @eventlog(indexed=1) def SetSCOREValue(self, value: str): pass def on_install(self) -> None: #def on_install(self, score_address: 'Address') -> None: super().on_install() ##self.score_address.set(score_address) def on_update(self, value: str) -> None: super().on_update() #self.value.set(value) @external(readonly=True) def getValue(self) -> str: return self.value.get() @external def setValue(self, value: str): self.value.put(value) # <----------------------------------------------------------- and with self.value.set(value) self.SetValue(value) ************************************************************************************************ The testing file to test the file from the tutorial that I modified is this one: from iconservice import Address from iconservice.base.exception import DatabaseException from tbears.libs.scoretest.score_test_case import ScoreTestCase from ..simple_score2 import SimpleScore2 class TestSimple(ScoreTestCase): def setUp(self): super().setUp() #self.mock_score_address = Address.from_string(f"cx{'1234'*10}") self.score2 = self.get_score_instance(SimpleScore2, self.test_account1) #self.score2 = self.get_score_instance(SimpleScore2, self.test_account1, on_install_params={'score_address': self.mock_score_address}) """ self.test_account3 = Address.from_string(f"hx{'12345'*8}") self.test_account4 = Address.from_string(f"hx{'1234'*10}") account_info = { self.test_account3: 10 21, self.test_account4: 10 21} self.initialize_accounts(account_info) """ def test_set_value(self): str_value = 'string_value' self.score2.setValue(str_value) # assert event log called with specified arguments self.score2.SetValue.assert_called_with(str_value) self.assertEqual(self.score2.getValue(), str_value) def test_get_value_and_set_value(self): # at first, value is empty string self.assertEqual(self.score2.getValue(), '') str_value = 'strValue' self.score2.setValue(str_value) self.assertEqual(self.score2.getValue(), str_value) ************************************************************************************************ I wanted to include the files in a zip file. Unfortunately I can't upload one here. I posted the same question in the ICON Dev telegram chat. Thankfully Spl3n tried out the files, had the same issues and advised me to post my problem here. For now, I'll just use IntegrationTests only, as there aren't any problems with the IconIntegrateTestBase class.

Posted by Paul Plessing 2 months ago