From 7e77306b07e29523db3d08fa8759eeb97e88f076 Mon Sep 17 00:00:00 2001 From: Stefan Zarembinski Date: Mon, 1 Jul 2019 14:20:31 +0200 Subject: [PATCH 1/4] nodeos 1.8.0 --- config/genesis.json | 25 ----------------- eosfactory/core/config.py | 56 --------------------------------------- eosfactory/core/teos.py | 23 +--------------- 3 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 config/genesis.json diff --git a/config/genesis.json b/config/genesis.json deleted file mode 100644 index efe0bc66..00000000 --- a/config/genesis.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "initial_timestamp": "2018-03-02T12:00:00.000", - "initial_key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", - "initial_configuration": { - "max_block_net_usage": 1048576, - "target_block_net_usage_pct": 1000, - "max_transaction_net_usage": 524288, - "base_per_transaction_net_usage": 12, - "net_usage_leeway": 500, - "context_free_discount_net_usage_num": 20, - "context_free_discount_net_usage_den": 100, - "max_block_cpu_usage": 100000, - "target_block_cpu_usage_pct": 500, - "max_transaction_cpu_usage": 50000, - "min_transaction_cpu_usage": 100, - "max_transaction_lifetime": 3600, - "deferred_trx_expiration_window": 600, - "max_transaction_delay": 3888000, - "max_inline_action_size": 4096, - "max_inline_action_depth": 4, - "max_authority_depth": 6, - "max_generated_transaction_count": 16 - }, - "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000" - } \ No newline at end of file diff --git a/eosfactory/core/config.py b/eosfactory/core/config.py index af577197..702a1af4 100644 --- a/eosfactory/core/config.py +++ b/eosfactory/core/config.py @@ -371,50 +371,6 @@ def eosio_key_public(): return config_value_checked(key_public_) -def data_dir(): - '''Directory containing runtime data of *nodeos*. - - It may be changed with - *LOCAL_NODE_DATA_DIR* entry in the *config.json* file, - see :func:`.current_config`. - ''' - return first_valid_path(data_dir_) - - -def nodeos_config_dir(): - '''Directory containing configuration files such as config.ini. - - It may be changed with - *LOCAL_NODE_CONFIG_DIR* entry in the *config.json* file, - see :func:`.current_config`. - ''' - path = first_valid_path(config_dir_, raise_error=False) - if path: - return path - - return config_dir() - - -def genesis_json(): - '''File to read Genesis State from. - - It may be changed with - *EOSIO_GENESIS_JSON* entry in the *config.json* file, - see :func:`.current_config`. - ''' - path = first_valid_path(genesis_json_, raise_error=False) - if not path: - path = os.path.join(config_dir(), "genesis.json") - if not os.path.exists(path): - raise errors.Error(''' -Cannot find any path for '{}'. -Tried: -{} - '''.format(genesis_json_[0], genesis_json_[1]), translate=False) - - return path - - def chain_state_db_size_mb(): '''The size of the buffer of the local node. @@ -1147,14 +1103,6 @@ def current_config(contract_dir=None, dont_set_workspace=False): map[keosd_wallet_dir_[0]] = keosd_wallet_dir() except: map[keosd_wallet_dir_[0]] = None - try: - map[data_dir_[0]] = data_dir() - except: - map[data_dir_[0]] = None - try: - map[config_dir_[0]] = nodeos_config_dir() - except: - map[config_dir_[0]] = None try: map[cli_exe_[0]] = cli_exe() except: @@ -1179,10 +1127,6 @@ def current_config(contract_dir=None, dont_set_workspace=False): map[eosio_cpp_includes_[0]] = eosio_cpp_includes() except: map[eosio_cpp_includes_[0]] = None - try: - map[genesis_json_[0]] = genesis_json() - except: - map[genesis_json_[0]] = None try: map[includes_[0]] = eoside_includes_dir() except: diff --git a/eosfactory/core/teos.py b/eosfactory/core/teos.py index 7dbd6f4c..c407b149 100644 --- a/eosfactory/core/teos.py +++ b/eosfactory/core/teos.py @@ -596,21 +596,6 @@ def get_include_dir(source_dir): def args(clear=False): - try: - data_dir = config.data_dir() - except: - data_dir = None - - try: - config_dir = config.nodeos_config_dir() - except: - config_dir = None - - try: - genesis_json = config.genesis_json() - except: - genesis_json = None - args_ = [ "--http-server-address", config.http_server_address(), "--chain-state-db-size-mb", config.chain_state_db_size_mb(), @@ -623,18 +608,12 @@ def args(clear=False): "--plugin eosio::producer_plugin", "--plugin eosio::chain_api_plugin", "--plugin eosio::http_plugin", - "--plugin eosio::history_api_plugin" + # "--plugin eosio::history_api_plugin" ] - if config_dir: - args_.extend(["--config-dir", config_dir]) - if data_dir: - args_.extend(["--data-dir", data_dir]) if clear: node_stop() args_.extend(["--delete-all-blocks"]) - if genesis_json: - args_.extend(["--genesis-json", genesis_json]) return args_ From 79e473b012df19b8e969d8e30ca60be8b626a0d9 Mon Sep 17 00:00:00 2001 From: Stefan Zarembinski Date: Mon, 1 Jul 2019 14:40:49 +0200 Subject: [PATCH 2/4] v3.3.0 --- README.md | 2 +- README.rst | 2 +- docs/ReleaseNotes.md | 11 ++++++----- docs/ReleaseNotesHistory.md | 6 +++++- docs/conf.py | 2 +- docs/tokenika_blogs/vmware_ubuntu.md | 4 ++-- docs/tutorials/01.InstallingEOSFactory.md | 16 ++++++++-------- eosfactory/core/config.py | 4 ++-- 8 files changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index bbc334fb..1fb184ed 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Welcome to EOSFactory v3.2.1 +# Welcome to EOSFactory v3.3.0 [EOSFactory](http://eosfactory.io/) is a Python-based [EOS](https://eos.io) smart-contract development & testing framework, created by [Tokenika](https://tokenika.io). diff --git a/README.rst b/README.rst index d862c8ef..b6fa1964 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ ============================ -Welcome to EOSFactory v3.2.1 +Welcome to EOSFactory v3.3.0 ============================ `EOSFactory `_ is a Python-based `EOS `_ smart-contract development & testing framework, created by `Tokenika `_. diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 674cd209..f26e0ef9 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -1,11 +1,12 @@ -# Release Notes - v3.2.1 +# Release Notes - v3.3.0 ## Compatibility -EOSFactory [v3.2.1](https://github.com/tokenika/eosfactory/releases/tag/v3.2.1) is compatible with EOS [v1.7.1](https://github.com/EOSIO/eos/releases/tag/v1.7.1) and EOSIO.CDT [v1.6.1](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.6.1). +EOSFactory [v3.3.0](https://github.com/tokenika/eosfactory/releases/tag/v3.3.0) is compatible with EOS [v1.8.0](https://github.com/EOSIO/eos/releases/tag/v1.8.0) and EOSIO.CDT [v1.6.1](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.6.1). + +## New features in v3.3.0 + +* Compatibility with https://github.com/EOSIO/eos/releases/tag/v1.8.0. -## New features in v3.2.1 -* Native compilation and debugging of EOSIO smart contracts. -* Improved startup of the `nodeos` process: better control on stuck conditions that frequently occur. diff --git a/docs/ReleaseNotesHistory.md b/docs/ReleaseNotesHistory.md index 39d72afc..06737131 100644 --- a/docs/ReleaseNotesHistory.md +++ b/docs/ReleaseNotesHistory.md @@ -90,4 +90,8 @@ * Support for distribution of EOSIO smart-contract projects. * Release 3.1.3 on 23 May 2019 - * Corrected the account method `set_account_permission` so that it supports adding and removing `eosio.code` permission. \ No newline at end of file + * Corrected the account method `set_account_permission` so that it supports adding and removing `eosio.code` permission. + +* Release 3.2.0 on 24 June 2019 + * Native compilation and debugging of EOSIO smart contracts. + * Improved startup of the `nodeos` process: better control on stuck conditions that frequently occur. \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index f4da673f..c0a77d87 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ # The short X.Y version version = '' # The full version, including alpha/beta/rc tags -release = '3.2.1' +release = '3.3.0' # -- General configuration --------------------------------------------------- diff --git a/docs/tokenika_blogs/vmware_ubuntu.md b/docs/tokenika_blogs/vmware_ubuntu.md index 306d9156..7124edbe 100644 --- a/docs/tokenika_blogs/vmware_ubuntu.md +++ b/docs/tokenika_blogs/vmware_ubuntu.md @@ -57,8 +57,8 @@ pip3 install wheel ```bash sudo apt remove eosio -wget https://github.com/eosio/eos/releases/download/v1.7.1/eosio_1.7.1-1-ubuntu-18.04_amd64.deb -sudo apt install ./eosio_1.7.1-1-ubuntu-18.04_amd64.deb +wget https://github.com/eosio/eos/releases/download/v1.8.0/eosio_1.8.0-1-ubuntu-18.04_amd64.deb +sudo apt install ./eosio_1.8.0-1-ubuntu-18.04_amd64.deb sudo apt remove eosio.cdt wget wget https://github.com/eosio/eosio.cdt/releases/download/v1.6.1/eosio.cdt_1.6.1-1_amd64.deb diff --git a/docs/tutorials/01.InstallingEOSFactory.md b/docs/tutorials/01.InstallingEOSFactory.md index 43102d71..ea668551 100644 --- a/docs/tutorials/01.InstallingEOSFactory.md +++ b/docs/tutorials/01.InstallingEOSFactory.md @@ -10,7 +10,7 @@ We've tested *EOSFactory* on the following platforms: ## General prerequisites -We assume that you have successfully installed [*EOSIO*](https://github.com/EOSIO/eos) v1.7.1 on your machine. Binary installation suffices. +We assume that you have successfully installed [*EOSIO*](https://github.com/EOSIO/eos) v1.8.0 on your machine. Binary installation suffices. >**NOTE:** On *MacOS* [Brew](https://brew.sh/) is required for the EOSIO instalation. @@ -95,9 +95,9 @@ python3 -m eosfactory.config The correct output should be similar to this: ```bash -EOSFactory version 3.2.1. +EOSFactory version 3.3.0. Dependencies: -https://github.com/EOSIO/eos version 1.7.1 +https://github.com/EOSIO/eos version 1.8.0 https://github.com/EOSIO/eosio.cdt version 1.6.1 Python version 3.5 or higher @@ -156,9 +156,9 @@ python3 -m eosfactory.config In the printout, you'll see a note about the nature of the active package: ```bash -EOSFactory version 3.2.1. +EOSFactory version 3.3.0. Dependencies: -https://github.com/EOSIO/eos version 1.7.1 +https://github.com/EOSIO/eos version 1.8.0 https://github.com/EOSIO/eosio.cdt version 1.6.1 Python version 3.5 or higher @@ -224,9 +224,9 @@ python3 -m eosfactory.config As a result, you should get data similar to this: ```bash -EOSFactory version 3.2.1. +EOSFactory version 3.3.0. Dependencies: -https://github.com/EOSIO/eos version 1.7.1 +https://github.com/EOSIO/eos version 1.8.0 https://github.com/EOSIO/eosio.cdt version 1.6.1 Python version 3.5 or higher @@ -256,7 +256,7 @@ The current configuration of EOSFactory: "EOSIO_KEY_PUBLIC": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", "EOSIO_SHARED_MEMORY_SIZE_MB": "300", "EOSIO_VERSION": [ - "1.7.1" + "1.8.0" ], "EOS_FACTORY_DIR": "/mnt/c/Workspaces/EOS/eosfactory", "INCLUDE": "/mnt/c/Workspaces/EOS/eosfactory/includes", diff --git a/eosfactory/core/config.py b/eosfactory/core/config.py index 702a1af4..9d1f1f6a 100644 --- a/eosfactory/core/config.py +++ b/eosfactory/core/config.py @@ -11,8 +11,8 @@ import eosfactory.core.utils as utils -VERSION = "3.2.1" -EOSIO_VERSION = "1.7.1" +VERSION = "3.3.0" +EOSIO_VERSION = "1.8.0" EOSIO_CDT_VERSION = "1.6.1" PYTHON_VERSION = "3.5 or higher" EOSFACTORY_DIR = "eosfactory/" From 262af1ad578f849e164bf32bcf7aafb4b1f29126 Mon Sep 17 00:00:00 2001 From: Stefan Zarembinski Date: Tue, 2 Jul 2019 15:26:57 +0200 Subject: [PATCH 3/4] added safety measures --- eosfactory/core/config.py | 83 +++++++++++++++++++++++++++++++++------ eosfactory/core/teos.py | 9 ++++- eosfactory/core/vscode.py | 2 +- 3 files changed, 79 insertions(+), 15 deletions(-) diff --git a/eosfactory/core/config.py b/eosfactory/core/config.py index 9d1f1f6a..b27adfbb 100644 --- a/eosfactory/core/config.py +++ b/eosfactory/core/config.py @@ -18,7 +18,8 @@ EOSFACTORY_DIR = "eosfactory/" TMP = "/tmp/eosfactory/" SETUPTOOLS_NAME = "eosfactory_tokenika" -VERSION_PATTERN = r".+/eosio\.cdt/(\d\.\d\.\d)/.*$" +EOSIO_CDT_PATTERN = r".+/eosio\.cdt/(\d\.\d\.\d)/.*" +UBUNTU_PATTERN = r"\s*\"(.*CanonicalGroupLimited.Ubuntu.*/LocalState/rootfs)/.*" BUILD = "build" IGNORE_FILE = ".eosideignore" IGNORE_LIST = [".vscode/ipch/*", ".vscode/settings.json", ".vscode/tasks.json",\ @@ -39,13 +40,13 @@ []) node_address_ = ("LOCAL_NODE_ADDRESS", [LOCALHOST_HTTP_ADDRESS]) wallet_address_ = ("WALLET_MANAGER_ADDRESS", [LOCALHOST_HTTP_ADDRESS]) + genesis_json_ = ("EOSIO_GENESIS_JSON", ["/home/cartman/.local/share/eosio/nodeos/config/genesis.json"]) -data_dir_ = ("LOCAL_NODE_DATA_DIR", - ["/home/cartman/.local/share/eosio/nodeos/data/"]) -config_dir_ = ("LOCAL_NODE_CONFIG_DIR", [None]) -# config_dir_ = ("LOCAL_NODE_CONFIG_DIR", -# ["/home/cartman/.local/share/eosio/nodeos/config/"]) +nodeos_config_dir_ = ("NODEOS_CONFIG_DIR", [None]) +nodeos_data_dir_ = ("NODEOS_DATA_DIR", [None]) +nodeos_options_ = ("NODEOS_OPTIONS", []) + keosd_wallet_dir_ = ("KEOSD_WALLET_DIR", ["${HOME}/eosio-wallet/"]) chain_state_db_size_mb_ = ("EOSIO_SHARED_MEMORY_SIZE_MB", ["300"]) @@ -564,7 +565,7 @@ def eosio_cdt_root(): 'eosio-cpp' does not response. ''') - version_pattern = re.compile(VERSION_PATTERN) + version_pattern = re.compile(EOSIO_CDT_PATTERN) tested = [] for path in eosio_cdt_root_[1]: tested.append(path) @@ -835,6 +836,47 @@ def first_valid_path(config_list, find_file=None, raise_error=True): else: return None +def nodeos_data_dir(): + '''Directory containing runtime data of *nodeos*. + + It may be changed with + *NODEOS_DATA_DIR* entry in the *config.json* file, + see :func:`.current_config`. + ''' + return nodeos_data_dir_[1][0] + + +def nodeos_config_dir(): + '''Directory containing configuration files such as config.ini. + + It may be changed with + *NODEOS_CONFIG_DIR* entry in the *config.json* file, + see :func:`.current_config`. + ''' + return nodeos_config_dir_[1][0] + + +def nodeos_options(): + ''' + ''' + return nodeos_options_[1] + + +def genesis_json(): + '''File to read Genesis State from. + + It may be changed with + *EOSIO_GENESIS_JSON* entry in the *config.json* file, + see :func:`.current_config`. + ''' + path = first_valid_path(genesis_json_, raise_error=False) + if not path: + path = os.path.join(config_dir(), "genesis.json") + if not os.path.exists(path): + return None + + return path + def contract_dir(contract_dir_hint): '''Given a hint, determine the contract root directory. @@ -996,16 +1038,27 @@ def wasm_file(contract_dir_hint): return files[0] -def update_eosio_cpp_includes(c_cpp_properties_path): +def update_vscode(c_cpp_properties_path): c_cpp_properties_path = utils.wslMapWindowsLinux(c_cpp_properties_path) with open(c_cpp_properties_path) as f: c_cpp_properties = f.read() - version_pattern = re.compile(VERSION_PATTERN) + pattern = re.compile(EOSIO_CDT_PATTERN) + + if re.findall(pattern, c_cpp_properties): + new = c_cpp_properties.replace(re.findall( + pattern, c_cpp_properties)[0], eosio_cpp_version()[0]) + + if not new == c_cpp_properties: + with open(c_cpp_properties_path,'w') as f: + f.write(new) - if re.findall(version_pattern, c_cpp_properties): - new = c_cpp_properties.replace( - re.findall(version_pattern, c_cpp_properties)[0], eosio_cpp_version()[0]) + pattern = re.compile(UBUNTU_PATTERN) + root = wsl_root() + if root: + if re.findall(pattern, c_cpp_properties): + new = c_cpp_properties.replace( + re.findall(pattern, c_cpp_properties)[0], root) if not new == c_cpp_properties: with open(c_cpp_properties_path,'w') as f: @@ -1143,7 +1196,11 @@ def current_config(contract_dir=None, dont_set_workspace=False): map[TEMPLATE_DIR[0]] = template_dir() except: map[TEMPLATE_DIR[0]] = None - + + map[genesis_json_[0]] = genesis_json() + map[nodeos_config_dir_[0]] = nodeos_config_dir() + map[nodeos_data_dir_[0]] = nodeos_data_dir() + map[nodeos_options_[0]] = nodeos_options() map["EOSIO_VERSION"] = eosio_version() map["EOSIO_CDT_VERSION"] = eosio_cpp_version() diff --git a/eosfactory/core/teos.py b/eosfactory/core/teos.py index c407b149..312a44a7 100644 --- a/eosfactory/core/teos.py +++ b/eosfactory/core/teos.py @@ -608,12 +608,19 @@ def args(clear=False): "--plugin eosio::producer_plugin", "--plugin eosio::chain_api_plugin", "--plugin eosio::http_plugin", - # "--plugin eosio::history_api_plugin" ] + if config.nodeos_config_dir(): + args_.extend(["--config-dir", config.nodeos_config_dir()]) + if config.nodeos_data_dir(): + args_.extend(["--data-dir", config.nodeos_data_dir()]) + if config.nodeos_options(): + args_.extend(nodeos_options()) if clear: node_stop() args_.extend(["--delete-all-blocks"]) + if config.genesis_json(): + args_.extend(["--genesis-json", config.genesis_json()]) return args_ diff --git a/eosfactory/core/vscode.py b/eosfactory/core/vscode.py index 10556b3e..ece5d870 100644 --- a/eosfactory/core/vscode.py +++ b/eosfactory/core/vscode.py @@ -220,7 +220,7 @@ def c_cpp_properties(): def main(c_cpp_properties_path=None): if c_cpp_properties_path: - config.update_eosio_cpp_includes(c_cpp_properties_path) + config.update_vscode(c_cpp_properties_path) else: print(c_cpp_properties()) From 1afbf133112c2030a7dc32df9e344eee91e4e000 Mon Sep 17 00:00:00 2001 From: jakub-zarembinski Date: Tue, 2 Jul 2019 19:46:33 +0200 Subject: [PATCH 4/4] Update ReleaseNotes.md --- docs/ReleaseNotes.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index f26e0ef9..2524f1b8 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -6,7 +6,4 @@ EOSFactory [v3.3.0](https://github.com/tokenika/eosfactory/releases/tag/v3.3.0) ## New features in v3.3.0 -* Compatibility with https://github.com/EOSIO/eos/releases/tag/v1.8.0. - - - +* Compatibility with EOS [v1.8.0](https://github.com/EOSIO/eos/releases/tag/v1.8.0).