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

Feat/comms behaviour protocol #210

Merged
merged 43 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
de28de7
feat(comms): init new network behaviour protocol
elenaf9 Apr 19, 2021
f8bc8c9
feat(comms): integrate mdns + relay to behaviour
elenaf9 Apr 23, 2021
d5fbf6b
feat(comms): peer connection and addrs management
elenaf9 Apr 24, 2021
e633fa7
feat(comms): send Res from outbound handshake via channel
elenaf9 Apr 27, 2021
0d95863
feat(comms): remove events for outbound responses
elenaf9 Apr 30, 2021
756f3db
feat(comms): rename types
elenaf9 May 4, 2021
749c8b0
feat(comms): add firewall, manage pending requests
elenaf9 May 7, 2021
609dd7f
chore(comms): update libp2p v0.37 -> v0.38
elenaf9 May 21, 2021
a45d418
test(comms): add firewall tests
elenaf9 May 21, 2021
8e3af02
feat(comms): manage peer addresses and relays
elenaf9 May 24, 2021
1aefc2d
fix(comms): no implicit fallback for using relays
elenaf9 May 27, 2021
753aabd
test(comms): addresses, dialing and using relays
elenaf9 May 27, 2021
6740ade
feat(comms): clean code
elenaf9 Jun 3, 2021
1c644a2
feat(comms): add interface for the comms-library
elenaf9 Jun 3, 2021
bb04d1a
feat(comms): interface: publish network events
elenaf9 Jun 8, 2021
ff421e6
fix(comms): fix no-default-features, fix interface
elenaf9 Jun 8, 2021
17fcc70
test(comms): test dialing via interface
elenaf9 Jun 8, 2021
e0fd5d9
fix(workflows): temp check comms-refactor folder
elenaf9 Jun 8, 2021
5852852
feat(comms): add Errs, move types mod to interface
elenaf9 Jun 10, 2021
0e19adb
docs(comms): add documentation, clean code
elenaf9 Jun 18, 2021
cfb7264
Merge branch 'dev' of github.com:iotaledger/stronghold.rs into feat/c…
elenaf9 Jun 21, 2021
7c6847e
feat(comms): add Builder for ShCommunication
elenaf9 Jun 21, 2021
b634dc2
fix(comms): extend / fix docs, clean code
elenaf9 Jun 22, 2021
6c9ff5d
feat(comms): return Outbound Err via Response Chan
elenaf9 Jun 23, 2021
9aefd77
feat(comms): add outbound failure for shutdown
elenaf9 Jun 24, 2021
c08b66f
feat(comms): use concurrent hashmap in interface
elenaf9 Jun 30, 2021
0efbfe3
fix(comms): use wasm_timer in handler
elenaf9 Jul 2, 2021
3075df6
feat(comms): refactor interface
elenaf9 Jul 8, 2021
49df5e3
fix(comms): fix listeners
elenaf9 Jul 9, 2021
96ea60c
feat(comms): Use Fn in FW-Rule to approve Requests
elenaf9 Jul 9, 2021
f19130d
Merge branch 'dev' of github.com:iotaledger/stronghold.rs into feat/c…
elenaf9 Jul 10, 2021
d758286
feat(comms): clean code, firewall types
elenaf9 Jul 13, 2021
3614bbc
feat(comms): actix CommunicationActor draft
elenaf9 Jul 14, 2021
5a21c45
feat(comms): ARegistry as Service; add impl_handler macro
elenaf9 Jul 15, 2021
442f846
feat(comms): Executor config, fix start_listening
elenaf9 Jul 20, 2021
dc18c19
refactor(p2p): rename library communication -> p2p
elenaf9 Jul 27, 2021
d93c9f6
feat(p2p): wrap channel for inbound requests/ events
elenaf9 Jul 28, 2021
1298fd6
Merge branch 'dev' of github.com:iotaledger/stronghold.rs into HEAD
elenaf9 Aug 25, 2021
dbcd9a3
feat(p2p): integrate Network-Actor into Stronghold
elenaf9 Aug 12, 2021
ceeeee0
fix(comms): remove outdated stronghold-comms crate
elenaf9 Aug 13, 2021
98e455d
fix(p2p): fix documentation
elenaf9 Aug 25, 2021
4e7c1c9
fix(covector): remove comms library from covector
elenaf9 Aug 25, 2021
7b0d58b
fix(p2p): clean code
elenaf9 Aug 25, 2021
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
7 changes: 0 additions & 7 deletions .changes/comms-stop-listening.md

This file was deleted.

6 changes: 3 additions & 3 deletions .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
"stronghold-utils"
]
},
"stronghold-communication": {
"path": "./communication/",
"stronghold-p2p": {
"path": "./p2p/",
"manager": "rust",
"dependencies": [
"stronghold-utils"
Expand All @@ -106,7 +106,7 @@
"manager": "rust",
"dependencies": [
"stronghold-engine",
"stronghold-communication",
"stronghold-p2p",
"stronghold-utils",
"stronghold-runtime"
]
Expand Down
1 change: 0 additions & 1 deletion .changes/fuzzer.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
"stronghold-communication": minor
"stronghold-engine": patch
---

Expand Down
4 changes: 2 additions & 2 deletions .changes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
| ---- | ------- | -------- | ------- | ----------------- |
| iota-stronghold | The Client | Rust | Yes | Yes |
| stronghold-engine | The Engine | Rust | Yes | Yes |
| stronghold-communication | Communication Subsystem | Rust | Yes | No |
| stronghold-p2p | Communication Subsystem | Rust | Yes | No |
| runtime | Secure Zone | Rust | Yes | No |
| vault | Engine's memory Store | Rust | No | No |
| snapshot | Engine's Persistence | Rust | No | No |
| store | Engine's Readable Storage Interface | Rust | No | No |
| communication-macros | Communication macros | Rust | No | No |
| stronghold-derive | Stronghold Procedural Macros | Rust | No | No |
| stronghold-utils | Reoccuring Patterns, and Utilities for Testing | Rust | No | No |

As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend it represents the overall change for our sanity.
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ updates:
open-pull-requests-limit: 3

- package-ecosystem: "cargo"
directory: "/communication"
directory: "/p2p"
schedule:
interval: "daily"
open-pull-requests-limit: 3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
project: [engine, client, products/commandline, derive, utils, communication]
project: [engine, client, products/commandline, derive, utils, p2p]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
project: [engine, client, products/commandline, derive, utils, communication]
project: [engine, client, products/commandline, derive, utils, p2p]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
project: [engine, client, products/commandline, derive, utils, communication]
project: [engine, client, products/commandline, derive, utils, p2p]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [
"engine",
"engine/runtime",
"client",
"communication",
"p2p",
"utils",
"derive"
]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
There are four main components of Stronghold:
1. **Client**: The high-level interface to Stronghold (prefers Riker, functional integration also available)
2. **Engine**: Combines a persistence store (Snapshot) with an in-memory state interface (Vault), a read/write key:value system (Store) and memory protection services (Runtime).
3. **Communication**: Enables Strongholds in different processes or on different devices to communicate with each other securely.
3. **P2P**: Enables Strongholds in different processes or on different devices to communicate with each other securely.

## 3rd Party Independent Security Audit
In April of 2021, F-Secure performed a security assessment of the core crates of IOTA Stronghold and found nothing of concern. This is not an explicit declaration of fitness or freedom of error, but it is an indicator of the high quality of the code. You may review [the audit here](https://github.com/iotaledger/stronghold.rs/blob/dev/documentation/docs/meta/Audit.pdf).
Expand Down
16 changes: 12 additions & 4 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ zeroize = "1.1"
zeroize_derive = "1.0"
anyhow = "1.0"
thiserror = "1.0"
futures = { version = "0.3", optional = true }
actix = "0.12"

[dependencies.stronghold_engine]
Expand All @@ -39,17 +40,19 @@ features = [
"chacha"
]

[dependencies.stronghold-communication]
path = "../communication"

[dependencies.stronghold-p2p]
path = "../p2p"
version = "0.3"
optional = true
version = "0.4.1"

[dependencies.stronghold-utils]
path = "../utils"
version = "0.3"

[features]
communication = [ "stronghold-communication" ]
p2p = ["stronghold-p2p", "futures"]


[dev-dependencies]
hex = "0.4.2"
Expand All @@ -58,6 +61,11 @@ clap = { version = "3.0.0-beta.1", features = [ "yaml" ] }
rand = "0.8.3"
tokio = {version = "1.9", features = ["rt-multi-thread"] }

[[example]]
name = "p2p"
required-features = ["p2p"]


[[bench]]
name = "benchmark"
harness = false
Expand Down
115 changes: 0 additions & 115 deletions client/examples/comm/main.rs

This file was deleted.

27 changes: 14 additions & 13 deletions client/examples/comm/README.md → client/examples/p2p/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Stronghold Communication Example
# Stronghold P2P-Network Example


The communication examples show the networking capabilities of stronghold.
The network examples show the p2p-networking capabilities of stronghold.
Some are just "one-shot" examples to show what is possible with stronghold in an easy way

## Quickstart

Run following command to show sample output for the communications example:
Run following command to show sample output for the network example:

```
cargo run --features communication comm
```sh
cargo run --features p2p p2p
```

This will display some helpful output

```
Stronghold Example Communications
Example to show stronghold's communication capabilities
```sh
Stronghold Example P2P-Network
Example to show stronghold's p2p-networking capabilities

USAGE:
comm [actor-path] <SUBCOMMAND>
Expand All @@ -36,24 +35,26 @@ SUBCOMMANDS:
swarm-info Displays information on this node
```


## Listen for connections

To start stronghold to listen for remote peer connections, you can run

```no_run
cargo run --features communication --example comm listen --multiaddr "/ip4/127.0.0.1/tcp/7001"
cargo run --features p2p --example p2p listen --multiaddr "/ip4/127.0.0.1/tcp/7001"
```

## Show swarm info

To show info on neighbouring peers you can run

```no_run
cargo run --features communication --example comm swarm-info
cargo run --features p2p --example p2p swarm-info
```

## Add Peer(s)

Peers can also be added by running

```no_run
cargo run --features communication --example comm
cargo run --features p2p --example p2p
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use clap::{Clap, Subcommand};

#[derive(Clap, Debug)]
#[clap(
name = "Stronghold Example Communications",
about = "Example to show stronghold's communication capabilities"
name = "Stronghold Example P2p-Network",
about = "Example to show stronghold's p2p-network capabilities"
)]
pub struct ExampleApp {
#[clap(subcommand)]
Expand All @@ -19,15 +19,15 @@ pub struct ExampleApp {

#[derive(Debug, Subcommand)]
pub enum Commands {
#[cfg(feature = "communication")]
#[cfg(feature = "p2p")]
#[clap(alias = "peers", about = "Lists all peers.")]
Peers {},

#[cfg(feature = "communication")]
#[cfg(feature = "p2p")]
#[clap(alias = "swarm-info", about = "Displays information on this node")]
SwarmInfo {},

#[cfg(feature = "communication")]
#[cfg(feature = "p2p")]
#[clap(about = "Start listening on multiaddress.")]
Listen {
#[clap(
Expand Down
Loading