Skip to content

Commit

Permalink
Merge pull request #172 from tokenika/development
Browse files Browse the repository at this point in the history
Compatibility with EOS v1.8.0
  • Loading branch information
jakub-zarembinski authored Jul 2, 2019
2 parents e1dc0e2 + 1afbf13 commit 5cda4a7
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 139 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
============================
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>`_.
Expand Down
25 changes: 0 additions & 25 deletions config/genesis.json

This file was deleted.

10 changes: 4 additions & 6 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# 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.2.1

* Native compilation and debugging of EOSIO smart contracts.
* Improved startup of the `nodeos` process: better control on stuck conditions that frequently occur.
## New features in v3.3.0

* Compatibility with EOS [v1.8.0](https://github.com/EOSIO/eos/releases/tag/v1.8.0).
6 changes: 5 additions & 1 deletion docs/ReleaseNotesHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* 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.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/tokenika_blogs/vmware_ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/01.InstallingEOSFactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
143 changes: 72 additions & 71 deletions eosfactory/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
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/"
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",\
Expand All @@ -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"])

Expand Down Expand Up @@ -371,50 +372,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.
Expand Down Expand Up @@ -608,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)
Expand Down Expand Up @@ -879,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.
Expand Down Expand Up @@ -1040,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 re.findall(version_pattern, c_cpp_properties):
new = c_cpp_properties.replace(
re.findall(version_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)

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:
Expand Down Expand Up @@ -1147,14 +1156,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:
Expand All @@ -1179,10 +1180,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:
Expand All @@ -1199,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()
Expand Down
Loading

0 comments on commit 5cda4a7

Please sign in to comment.