Skip to content

Commit

Permalink
Merge pull request #193 from valory-xyz/docs/ipfs-hash-tests
Browse files Browse the repository at this point in the history
Docs/ipfs hash tests & fixer script
  • Loading branch information
DavidMinarsch authored Jun 22, 2022
2 parents 9b8c257 + eeb702c commit aaf949e
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 67 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ test-sub-p:

.PHONY: hashes
hashes:
python -m aea.cli hash all
python -m aea.cli hash all --packages-dir=./tests/data/packages
python -m aea.cli hash all
python -m aea.cli hash all --packages-dir=./tests/data/packages

.PHONY: test-all
test-all:
Expand Down Expand Up @@ -191,10 +191,11 @@ security:
generators:
python -m aea.cli generate-all-protocols
python -m aea.cli generate-all-protocols tests/data/packages
python -m aea.cli hash all
python -m aea.cli hash all --packages-dir=./tests/data/packages
python -m aea.cli hash all
python -m aea.cli hash all --packages-dir=./tests/data/packages
python scripts/generate_api_docs.py
python scripts/check_copyright_notice.py
python scripts/fix_doc_ipfs_hashes.py

.PHONY: common-checks
common-checks:
Expand Down
4 changes: 2 additions & 2 deletions docs/echo_demo.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is a simple demo that introduces you to the main components of an AEA.
This is a simple demo that introduces you to the main components of an AEA.

A full break down of the development is covered within the <a href="../quickstart/">Development Quickstart</a>. It is highly recommended that developers begin by following the quick start!

Expand All @@ -7,7 +7,7 @@ This demo assumes you have followed the setup guide.
The fastest way to have your first AEA is to fetch one that already exists!

``` bash
aea fetch open_aea/my_first_aea:0.1.0 --local
aea fetch open_aea/my_first_aea:0.1.0:QmbyFaoHWikC8dHcpdTVboxVnkXX2vMgch4UUXmwCfJhRu --remote
cd my_first_aea
```
### Install AEA dependencies
Expand Down
4 changes: 2 additions & 2 deletions docs/gym-skill.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Follow the <a href="../quickstart/#preliminaries">Preliminaries</a> and <a href=

First, fetch the gym AEA:
``` bash
aea fetch open_aea/gym_aea:0.1.0 --local
aea fetch open_aea/gym_aea:0.1.0:QmddxSr8ZfKgHw5Urdxjdw52yofjLLRgM1AyJvxRaK4V6U --remote
cd gym_aea
aea install
```
Expand All @@ -36,7 +36,7 @@ cd my_gym_aea

### Add the gym skill
``` bash
aea add skill fetchai/gym:0.20.0
aea add skill fetchai/gym:0.20.0:QmdQisuqLhq81NHuas9ALYgP1tw1cZoE3vGueREgG8PgCZ --remote
```

### Set gym connection as default
Expand Down
12 changes: 6 additions & 6 deletions docs/http-connection-and-skill.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description

The HTTP client and HTTP server connections enable an AEA to communicate with external servers, respectively clients, via HTTP.
The HTTP client and HTTP server connections enable an AEA to communicate with external servers, respectively clients, via HTTP.

The HTTP client connection receives request envelops from an agent's skill, translates each into an HTTP request and sends it to a server external to the agent. If it receives an HTTP response from the server within a timeout window, it translates it into a response envelope, and sends this back to the relevant skill inside the agent.

Expand All @@ -12,7 +12,7 @@ The `fetchai/simple_data_request:0.13.0` skill demonstrates a simple use case of

The `HttpRequestBehaviour` in `behaviours.py` periodically sends HTTP envelops to the HTTP client connection. Its `act()` method, periodically called, simply calls `_generate_http_request` which contains the logic for enqueueing an HTTP request envelop.

The `HttpHandler` in `handler.py` is a basic handler for dealing with HTTP response envelops received from the HTTP client connection. In the `handle()` method, the responses are dealt with by the private `_handle_response` method which essentially logs the response and adds the body of the response into the skill's shared state.
The `HttpHandler` in `handler.py` is a basic handler for dealing with HTTP response envelops received from the HTTP client connection. In the `handle()` method, the responses are dealt with by the private `_handle_response` method which essentially logs the response and adds the body of the response into the skill's shared state.

## HTTP Server

Expand All @@ -26,7 +26,7 @@ cd my_aea
Add the http server connection package:

``` bash
aea add connection fetchai/http_server:0.22.0
aea add connection fetchai/http_server:0.22.0:Qmdr2Ajx5BRBJCC6xP8wUNSCMbhStHHZaVgzkoSW6Pvu7S --remote
```

Update the default connection:
Expand All @@ -46,7 +46,7 @@ Ensure the file exists under the specified path!
Create and add a private key:

``` bash
aea generate-key ethereum
aea generate-key ethereum
aea add-key ethereum
```

Expand All @@ -71,7 +71,7 @@ Next implement a basic handler which prints the received envelopes and responds.


Then, replace the content of `handlers.py` with the following code snippet,
after having replaced the placeholder `YOUR_USERNAME` with
after having replaced the placeholder `YOUR_USERNAME` with
the author username (i.e. the output of `aea config get agent.author`):

``` python
Expand Down Expand Up @@ -327,7 +327,7 @@ In our case, this is the `http_echo` that you have just scaffolded.
Its public id will be `<your-author-name>/http_echo:0.1.0`.

``` bash
aea config set vendor.fetchai.connections.http_server.config.target_skill_id "$(aea config get agent.author)/http_echo:0.1.0"
aea config set vendor.fetchai.connections.http_server.config.target_skill_id "$(aea config get agent.author)/http_echo:0.1.0"
```

You can now run the AEA:
Expand Down
14 changes: 7 additions & 7 deletions docs/http-echo-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
The purpose of this demonstration is to show the `open-aea` framework can be used as a HTTP server. More concretely, an AEA with a http server connection and an appropriate skill can be used as a server.


A full break down of the development flow is covered within the <a href="../quickstart/">Development Quickstart</a>.
A full break down of the development flow is covered within the <a href="../quickstart/">Development Quickstart</a>.

It is highly recommended that developers begin by following the quick start!

It is assumed that developers are within a pipenv virtual environment.

A full break down of the development flow is covered within the <a href="../quickstart/">Development Quickstart</a>.
A full break down of the development flow is covered within the <a href="../quickstart/">Development Quickstart</a>.
The easiest way to get started with the http server is to use our pre-built example skill.



``` bash
pipenv shell
aea fetch open_aea/http_echo:0.1.0 --local
aea fetch open_aea/http_echo:0.1.0:QmdyEJWRz4B2PU7ioD17HVVGELihjc4feos6nS2DSL94Rf --remote
cd http_echo
aea generate-key ethereum; aea add-key ethereum
aea run --aev
Expand All @@ -31,10 +31,10 @@ Successfully added connection 'fetchai/http_server:0.22.0'.
Adding skill 'fetchai/http_echo:0.20.0'...
Successfully added skill 'fetchai/http_echo:0.20.0'.
Agent http_echo successfully fetched.
_ _____ _
/ \ | ____| / \
/ _ \ | _| / _ \
/ ___ \ | |___ / ___ \
_ _____ _
/ \ | ____| / \
/ _ \ | _| / _ \
/ ___ \ | |___ / ___ \
/_/ \_\|_____|/_/ \_\

v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions docs/ipfs_registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Packages can be downloaded using both extended public ids and hashes

Add the signing protocol using

`aea add protocol QmdrqznAYpnTWtLvLtLXiyMVr8PRfmj251puWbMZMNBw41`
`aea add protocol QmWdCAiXpeT1tgrcf8uofKdQ6fLxMH77D5jwgQbbMo41df --remote`

Or

`aea add protocol open_aea/signing:1.0.0:QmdrqznAYpnTWtLvLtLXiyMVr8PRfmj251puWbMZMNBw41`
`aea add protocol open_aea/signing:1.0.0:QmWdCAiXpeT1tgrcf8uofKdQ6fLxMH77D5jwgQbbMo41df --remote`

## Publishing agents

Expand Down
18 changes: 9 additions & 9 deletions docs/p2p-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ The `valory/p2p_libp2p:0.26.0` connection allows AEAs to create a peer-to-peer c

<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Currently <code>p2p_libp2p</code> does not support the
<p>Currently <code>p2p_libp2p</code> does not support the
ethereum keys generated by open-aea-ledger-ethereum yet.
This does not affect the agents' ability to interact with the
ethereum ledger and solely necessitates a separate set of
This does not affect the agents' ability to interact with the
ethereum ledger and solely necessitates a separate set of
cosmos keys for establishing the libp2p connection.
</p>
</div>

First, make sure you have installed the crypto plugin
of the target test-net.
of the target test-net.
``` bash
pip install open-aea-ledger-cosmos
pip install open-aea-ledger-ethereum
Expand All @@ -26,7 +26,7 @@ Create one AEA as follows:
``` bash
aea create my_genesis_aea
cd my_genesis_aea
aea add connection valory/p2p_libp2p:0.1.0
aea add connection valory/p2p_libp2p:0.1.0:QmYW7Q5iFN6RwWmHj7wvjUBZfxu3hJN4KvcTWW1AhdKhki --remote
aea config set agent.default_connection valory/p2p_libp2p:0.1.0
aea install
aea build
Expand Down Expand Up @@ -58,7 +58,7 @@ Create a second AEA:
``` bash
aea create my_other_aea
cd my_other_aea
aea add connection valory/p2p_libp2p:0.1.0
aea add connection valory/p2p_libp2p:0.1.0:QmYW7Q5iFN6RwWmHj7wvjUBZfxu3hJN4KvcTWW1AhdKhki --remote
aea config set agent.default_connection valory/p2p_libp2p:0.1.0
aea install
aea build
Expand Down Expand Up @@ -136,7 +136,7 @@ To learn more about how to configure your `valory/p2p_libp2p:0.1.0` connection c

You can run a peer node in _standalone mode_; that is, as a Go process with no dependency on the AEA framework. To facilitate such a deployment, we provide a script
<a href="https://github.com/valory-xyz/open-aea/blob/main/scripts/acn/run_acn_node_standalone.py" target="_blank">`run_acn_node_standalone.py`</a>
and a corresponding
and a corresponding
<a href="https://github.com/valory-xyz/open-aea/blob/main/scripts/acn/Dockerfile" target="_blank">Dockerfile</a>.

First, you need to build the node's binary (`libp2p_node`) either:
Expand All @@ -160,7 +160,7 @@ Next, to run the node binary in standalone mode, it requires values for the foll
- `AEA_P2P_URI`: the local host and port to use by node
- `AEA_P2P_URI_PUBLIC`: the URI under which the peer is publicly reachable
- `AEA_P2P_DELEGATE_URI`: the URI under which the peer receives delegate connections
- `AEA_P2P_ENTRY_URIS`: an optionally supplied list of comma-separated (`,`) entry <a href="https://multiformats.io/multiaddr/" target="_blank">Multiaddrs</a> for the peer to bootstrap
- `AEA_P2P_ENTRY_URIS`: an optionally supplied list of comma-separated (`,`) entry <a href="https://multiformats.io/multiaddr/" target="_blank">Multiaddrs</a> for the peer to bootstrap

The script allows different methods to pass these values to the node:

Expand All @@ -183,7 +183,7 @@ The script allows different methods to pass these values to the node:
--uri-delegate <AEA_P2P_DELEGATE_URI> \
--entry-peers-maddrs <AEA_P2P_ENTRY_URI_1> <AEA_P2P_ENTRY_URI_2> ...
```
or
or
``` bash
docker run -v <node_private_key.txt>:/acn/key.txt -it acn_node_standalone --key-file /acn/key.txt \
--uri <AEA_P2P_URI> --uri-external <AEA_P2P_URI_PUBLIC> \
Expand Down
24 changes: 10 additions & 14 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ The following hints can help:
<ul>
<li>To install Go, follow the official guide, depending on your platform <a href="https://go.dev/doc/install" target="_blank">here</a></li>

<li>Python is already included by default on
<li>Python is already included by default on
many Linux distributions (e.g. Ubuntu), as well as MacOS.
To check you have the right version, open a terminal and run:
To check you have the right version, open a terminal and run:
``` bash
python3 --version
```
Expand All @@ -34,7 +34,7 @@ python3 --version

<li>Ubuntu/Debian systems only: install Python headers,
depending on the Python version you have installed on your machine.
E.g. for Python 3.8:
E.g. for Python 3.8:
``` bash
sudo apt-get install python3.8-dev
```
Expand Down Expand Up @@ -80,16 +80,16 @@ docker pull fetchai/aea-user:latest
To run the image on Linux and MacOs:

``` bash
docker run -it -v $(pwd):/agents --workdir=/agents fetchai/aea-user:latest
docker run -it -v $(pwd):/agents --workdir=/agents fetchai/aea-user:latest
```

And on Windows:

``` bash
docker run -it -v %cd%:/agents --workdir=/agents fetchai/aea-user:latest
docker run -it -v %cd%:/agents --workdir=/agents fetchai/aea-user:latest
```

Once successfully logged into the docker container,
Once successfully logged into the docker container,
you can follow the rest of the guide the same way as if not using docker.
</details>
Expand Down Expand Up @@ -150,20 +150,16 @@ aea init --local
AEAs are composed of components. AEAs and AEA components can be developed by anyone and pushed to an <a href="https://ipfs.io/" target="_blank">IPFS registry</a> for others to use.


To load Valory packages please use <a href="https://subversion.apache.org/packages.html" target="_blank">SVN</a> to checkout the specific folders;
```bash
svn checkout https://github.com/valory-xyz/open-aea/tags/v1.10.0/packages packages
```


## Echo skill demo

This is a simple demo that introduces you to the main components of an AEA.
This is a simple demo that introduces you to the main components of an AEA.

The fastest way to have your first AEA is to fetch one that already exists!

``` bash
aea fetch open_aea/my_first_aea:0.1.0 --local
aea fetch open_aea/my_first_aea:0.1.0:QmbyFaoHWikC8dHcpdTVboxVnkXX2vMgch4UUXmwCfJhRu --remote
cd my_first_aea
```
### Install AEA dependencies
Expand Down Expand Up @@ -259,14 +255,14 @@ cd my_first_aea
<br>
Second, add the stub connection to the project.
``` bash
aea add connection fetchai/stub:0.21.0
aea add connection fetchai/stub:0.21.0:QmektTWmXcjThQd8md8nSYgLapR3Gks3n3WEzwAWQFgc4z --remote
```
<br>
<b>Add the echo skill</b>
<br>
Third, add the echo skill to the project.
``` bash
aea add skill fetchai/echo:0.19.0
aea add skill fetchai/echo:0.19.0:QmReV2qgjE4mkY9n5iwJDoEcv174Sxbjhxo84YZpLyvcR2 --remote
```
This copies the <code>fetchai/echo:0.19.0</code> skill code containing the "behaviours", and "handlers" into the project, ready to run. The identifier of the skill <code>fetchai/echo:0.19.0</code> consists of the name of the author of the skill, followed by the skill name and its version.
</details>
Expand Down
10 changes: 5 additions & 5 deletions docs/registry.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Component Registry

Individual components are stored on the <a href="https://ipfs.io" target="_blank">`IPFS registry`</a>. This registry allows other developer to reuse these components. Anyone case register a new component which is uniquely identifiable by a hash of the contents of the component.
Individual components are stored on the <a href="https://ipfs.io" target="_blank">`IPFS registry`</a>. This registry allows other developer to reuse these components. Anyone case register a new component which is uniquely identifiable by a hash of the contents of the component.

## Creating a Project
We can create a new agent with the bare minimal components as so;
Expand All @@ -12,7 +12,7 @@ Creating project directory './agent'
Creating config file aea-config.yaml
Adding default packages ...
Adding protocol 'open_aea/signing:latest'...
Using registry: ipfs
Using registry: ipfs
Downloading open_aea/signing:latest from IPFS.
Successfully added protocol 'open_aea/signing:1.0.0'.
```
Expand All @@ -22,14 +22,14 @@ Successfully added protocol 'open_aea/signing:1.0.0'.
Once we have an agent, we can add individual components to the agent as so;

```
aea add skill fetchai/echo:0.19.0
aea add skill fetchai/echo:0.19.0:QmReV2qgjE4mkY9n5iwJDoEcv174Sxbjhxo84YZpLyvcR2 --remote
Registry path not provided and local registry `packages` not found in current (.) and parent directory.
Trying remote registry (`--remote`).
Adding skill 'fetchai/echo:latest'...
Using registry: ipfs
Using registry: ipfs
Downloading fetchai/echo:latest from IPFS.
Adding protocol 'fetchai/default:1.0.0'...
Using registry: ipfs
Using registry: ipfs
Downloading fetchai/default:1.0.0 from IPFS.
Successfully added protocol 'fetchai/default:1.0.0'.
Successfully added skill 'fetchai/echo:0.19.0'.
Expand Down
Loading

0 comments on commit aaf949e

Please sign in to comment.