Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.1.12 #370

Merged
merged 52 commits into from
Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
9fc90e4
add tcp server and client connections (wip)
marcofavorito Oct 10, 2019
a074b39
add first prototype of TCP connection.
marcofavorito Oct 11, 2019
6a62898
restore oef connection.yaml
marcofavorito Oct 11, 2019
f3bab5b
fix tests.
marcofavorito Oct 11, 2019
37c2d7b
fix code style in test_p2p.
marcofavorito Oct 11, 2019
9c20c37
post pydata meetup demo
dishmop Oct 31, 2019
9300e13
merged with develop
dishmop Oct 31, 2019
7322970
fixed tests
dishmop Oct 31, 2019
7185220
Added tests for crypto - Updated decision_maker_base
Totoual Oct 31, 2019
d09b053
Linting
Totoual Oct 31, 2019
20e81d3
Streamline weather skills with ledger and dialogue management
DavidMinarsch Oct 31, 2019
c486b50
crypt_tests WIP
Totoual Nov 1, 2019
2aa9662
Revert the amount in the settle_transaction
Totoual Nov 1, 2019
4d9a69e
Merge pull request #365 from fetchai/feature/ledger_txs
DavidMinarsch Nov 1, 2019
d584146
Revert sys.exit
Totoual Nov 1, 2019
8bd4cd8
Update docs and minor fixes
DavidMinarsch Nov 1, 2019
cf9edaf
Update the weather_station_example to work with dialogues and strategies
Totoual Nov 1, 2019
96e16a9
Merge pull request #366 from fetchai/feature/docs
DavidMinarsch Nov 1, 2019
9af0497
Merge branch 'tests/test_crypto' of github.com:fetchai/agents-aea int…
DavidMinarsch Nov 1, 2019
136c847
Cleaned unused code based on PR comments
Totoual Nov 1, 2019
d489c15
Changed based on PR Comments
Totoual Nov 1, 2019
25f57a4
Rearrange modules and functions to avoid circular imports and clean up
DavidMinarsch Nov 1, 2019
6a9f2bd
Changes based on the PR's comments
Totoual Nov 1, 2019
99d24ef
Runs entire agent from aea run - fixed a load of bugs
dishmop Nov 1, 2019
f08a0e2
Merge branch 'develop' into feature/carpark_skills
dishmop Nov 1, 2019
ffda709
Merge pull request #367 from fetchai/feature/weather_station_example
DavidMinarsch Nov 1, 2019
2a1f120
Prepare develop for release v0.1.12
DavidMinarsch Nov 1, 2019
4d83516
Commented out the external APIs call
Totoual Nov 1, 2019
934bd34
minor fixes
dishmop Nov 1, 2019
3412e39
Merge branch 'develop' into wip/tcp-connection
marcofavorito Nov 1, 2019
9b97910
Merge pull request #363 from fetchai/feature/carpark_skills
DavidMinarsch Nov 1, 2019
1f91ac3
Merge pull request #368 from fetchai/tests/test_crypto
DavidMinarsch Nov 1, 2019
89d11ac
Remove excessive logging
DavidMinarsch Nov 1, 2019
444fc70
Merge remote changes
DavidMinarsch Nov 1, 2019
728245b
Comment out ledger api tests
DavidMinarsch Nov 1, 2019
1d6ed3f
Merge pull request #369 from fetchai/feature/v0.1.12
DavidMinarsch Nov 1, 2019
94f9cad
remove pending tests.
marcofavorito Nov 1, 2019
68fba68
add envelope serializer.
marcofavorito Nov 1, 2019
704b37e
use dependency-injection in the 'encode' method.
marcofavorito Nov 1, 2019
fd94460
separate protobuf serializer class from default serializer class.
marcofavorito Nov 1, 2019
f59f9f0
Merge branch 'develop' into wip/tcp-connection (release 0.1.12)
marcofavorito Nov 1, 2019
7e8a3e5
fix code style check.
marcofavorito Nov 2, 2019
95fc4cf
add working prototype of TCP connections.
marcofavorito Nov 2, 2019
d636652
remove unix flag parameter to TCPConnection constructor.
marcofavorito Nov 2, 2019
f0c6da9
fix tcp connection implementation and add tests.
marcofavorito Nov 2, 2019
908c09c
fix code checks.
marcofavorito Nov 2, 2019
e1370b0
improve tear down procedure.
marcofavorito Nov 2, 2019
c3f1e54
Merge pull request #371 from fetchai/feature/envelope-serializer
marcofavorito Nov 2, 2019
504d3eb
make tcp server connection work with Python 3.6.
marcofavorito Nov 3, 2019
cfe30cb
remove unused attribute.
marcofavorito Nov 3, 2019
f447e53
Merge pull request #209 from fetchai/wip/tcp-connection
marcofavorito Nov 3, 2019
b1e4403
Update HISTORY.rst
DavidMinarsch Nov 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Release History

- Provides examples and fixes.


0.1.2 (2019-09-16)
-------------------

Expand Down Expand Up @@ -92,3 +91,11 @@ Release History
- Adds ledger integrations for fetch.ai and ethereum
- Adds carpark examples and ledger examples
- Multiple additional minor fixes and changes

0.1.12 (2019-11-01)
-------------------

- Adds TCP connection (server and client)
- Fixes some examples and docs
- Refactors crypto modules and adds additional tests
- Multiple additional minor fixes and changes
2 changes: 1 addition & 1 deletion aea/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
__title__ = 'aea'
__description__ = 'Autonomous Economic Agent framework'
__url__ = 'https://github.com/fetchai/agents-aea.git'
__version__ = '0.1.11'
__version__ = '0.1.12'
__author__ = 'Fetch.AI Limited'
__license__ = 'Apache 2.0'
__copyright__ = '2019 Fetch.AI Limited'
99 changes: 95 additions & 4 deletions aea/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,103 @@
AEAConfigException, _load_env_file
from aea.cli.install import install
from aea.connections.base import Connection
from aea.crypto.helpers import _verify_or_create_private_keys, _verify_ledger_apis_access
from aea.crypto.ledger_apis import LedgerApis
from aea.crypto.wallet import Wallet, DEFAULT
from aea.configurations.loader import ConfigLoader
from aea.configurations.base import AgentConfig, DEFAULT_AEA_CONFIG_FILE, PrivateKeyPathConfig, LedgerAPIConfig
from aea.crypto.ethereum import ETHEREUM
from aea.crypto.fetchai import FETCHAI
from aea.crypto.helpers import _create_default_private_key, _create_fetchai_private_key, _create_ethereum_private_key, DEFAULT_PRIVATE_KEY_FILE, FETCHAI_PRIVATE_KEY_FILE, ETHEREUM_PRIVATE_KEY_FILE, _try_validate_private_key_pem_path, _try_validate_fet_private_key_path, _try_validate_ethereum_private_key_path
from aea.crypto.ledger_apis import LedgerApis, _try_to_instantiate_fetchai_ledger_api, _try_to_instantiate_ethereum_ledger_api, SUPPORTED_LEDGER_APIS
from aea.crypto.wallet import Wallet, DEFAULT, SUPPORTED_CRYPTOS
from aea.mail.base import MailBox


def _verify_or_create_private_keys(ctx: Context) -> None:
"""
Verify or create private keys.

:param ctx: Context
"""
path = Path(DEFAULT_AEA_CONFIG_FILE)
agent_loader = ConfigLoader("aea-config_schema.json", AgentConfig)
fp = open(str(path), mode="r", encoding="utf-8")
aea_conf = agent_loader.load(fp)

for identifier, value in aea_conf.private_key_paths.read_all():
if identifier not in SUPPORTED_CRYPTOS:
ValueError("Unsupported identifier in private key paths.")

default_private_key_config = aea_conf.private_key_paths.read(DEFAULT)
if default_private_key_config is None:
_create_default_private_key()
default_private_key_config = PrivateKeyPathConfig(DEFAULT, DEFAULT_PRIVATE_KEY_FILE)
aea_conf.private_key_paths.create(default_private_key_config.ledger, default_private_key_config)
else:
default_private_key_config = cast(PrivateKeyPathConfig, default_private_key_config)
try:
_try_validate_private_key_pem_path(default_private_key_config.path)
except FileNotFoundError:
logger.error("File {} for private key {} not found.".format(repr(default_private_key_config.path), default_private_key_config.ledger))
sys.exit(1)

fetchai_private_key_config = aea_conf.private_key_paths.read(FETCHAI)
if fetchai_private_key_config is None:
_create_fetchai_private_key()
fetchai_private_key_config = PrivateKeyPathConfig(FETCHAI, FETCHAI_PRIVATE_KEY_FILE)
aea_conf.private_key_paths.create(fetchai_private_key_config.ledger, fetchai_private_key_config)
else:
fetchai_private_key_config = cast(PrivateKeyPathConfig, fetchai_private_key_config)
try:
_try_validate_fet_private_key_path(fetchai_private_key_config.path)
except FileNotFoundError:
logger.error("File {} for private key {} not found.".format(repr(fetchai_private_key_config.path), fetchai_private_key_config.ledger))
sys.exit(1)

ethereum_private_key_config = aea_conf.private_key_paths.read(ETHEREUM)
if ethereum_private_key_config is None:
_create_ethereum_private_key()
ethereum_private_key_config = PrivateKeyPathConfig(ETHEREUM, ETHEREUM_PRIVATE_KEY_FILE)
aea_conf.private_key_paths.create(ethereum_private_key_config.ledger, ethereum_private_key_config)
else:
ethereum_private_key_config = cast(PrivateKeyPathConfig, ethereum_private_key_config)
try:
_try_validate_ethereum_private_key_path(ethereum_private_key_config.path)
except FileNotFoundError:
logger.error("File {} for private key {} not found.".format(repr(ethereum_private_key_config.path), ethereum_private_key_config.ledger))
sys.exit(1)

# update aea config
path = Path(DEFAULT_AEA_CONFIG_FILE)
fp = open(str(path), mode="w", encoding="utf-8")
agent_loader.dump(aea_conf, fp)
ctx.agent_config = aea_conf


def _verify_ledger_apis_access() -> None:
"""Verify access to ledger apis."""
path = Path(DEFAULT_AEA_CONFIG_FILE)
agent_loader = ConfigLoader("aea-config_schema.json", AgentConfig)
fp = open(str(path), mode="r", encoding="utf-8")
aea_conf = agent_loader.load(fp)

for identifier, value in aea_conf.ledger_apis.read_all():
if identifier not in SUPPORTED_LEDGER_APIS:
ValueError("Unsupported identifier in ledger apis.")

fetchai_ledger_api_config = aea_conf.ledger_apis.read(FETCHAI)
if fetchai_ledger_api_config is None:
logger.debug("No fetchai ledger api config specified.")
else:
fetchai_ledger_api_config = cast(LedgerAPIConfig, fetchai_ledger_api_config)
_try_to_instantiate_fetchai_ledger_api(fetchai_ledger_api_config.addr, fetchai_ledger_api_config.port)

ethereum_ledger_config = aea_conf.ledger_apis.read(ETHEREUM)
if ethereum_ledger_config is None:
logger.debug("No ethereum ledger api config specified.")
else:
ethereum_ledger_config = cast(LedgerAPIConfig, ethereum_ledger_config)
_try_to_instantiate_ethereum_ledger_api(ethereum_ledger_config.addr, ethereum_ledger_config.port)


def _setup_connection(connection_name: str, public_key: str, ctx: Context) -> Connection:
"""
Set up a connection.
Expand Down Expand Up @@ -96,7 +187,7 @@ def run(click_context, connection_name: str, env_file: str, install_deps: bool):
agent_name = cast(str, ctx.agent_config.agent_name)

_verify_or_create_private_keys(ctx)
_verify_ledger_apis_access(ctx)
_verify_ledger_apis_access()
private_key_paths = dict([(identifier, config.path) for identifier, config in ctx.agent_config.private_key_paths.read_all()])
ledger_api_configs = dict([(identifier, (config.addr, config.port)) for identifier, config in ctx.agent_config.ledger_apis.read_all()])

Expand Down
20 changes: 20 additions & 0 deletions aea/connections/tcp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""Implementation of a TCP connection."""
Loading