Unverified Commit 91bd0ba7 authored by Pierre Krieger's avatar Pierre Krieger Committed by GitHub
Browse files

Companion for substrate#8079 (#2408)

* Companion for substrate#8079

* More changes

* "Update Substrate"

Co-authored-by: parity-processbot <>
parent 357af6cf
Pipeline #124108 passed with stages
in 34 minutes and 35 seconds
......@@ -9,5 +9,5 @@ assignees: ''
- It would help if you submit info about the system you are running, e.g.: operating system, kernel version, amount of available memory and swap, etc.
- Logs could be very helpful. If possible, submit the whole log. Please format it as ```code blocks```.
- Describe the role your node plays, e.g. validator, sentry, full node or light client.
- Describe the role your node plays, e.g. validator, full node or light client.
- Any command-line options were passed?
This diff is collapsed.
# Docker compose file to simulate a sentry node setup.
#
#
# Setup:
#
# Validator A is not supposed to be connected to the public internet. Instead it
# connects to a sentry node (sentry-a) which connects to the public internet.
#
#
# Usage:
#
# 1. Build `target/release/substrate` binary: `cargo build --release`
#
# 2. Start networks and containers: `sudo docker-compose -f scripts/sentry-node/docker-compose.yml up`
#
# 3. Reach:
# - validator-a: localhost:9944
# - sentry-a: localhost:9946
version: "3.7"
services:
validator:
ports:
- "9944:9944"
# volumes:
# - ../../target/release/substrate:/usr/local/bin/substrate
image: parity/polkadot
networks:
- network-a
environment:
- VALIDATOR_NODE_KEY
- VALIDATOR_BASE_PATH
- VALIDATOR_CHAIN
- VALIDATOR_PORT
- VALIDATOR_NAME
- VALIDATOR_RESERVED_NODES
command:
# Local node id: QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR
- "--node-key"
- "${VALIDATOR_NODE_KEY:-0000000000000000000000000000000000000000000000000000000000000001}"
- "--base-path"
- "${VALIDATOR_BASE_PATH:-/tmp/alice}"
- "--chain=${VALIDATOR_CHAIN:-local}"
- "--port"
- "${VALIDATOR_PORT:-30333}"
- "--validator"
- "--name"
- "${VALIDATOR_NANE:-AlicesNode}"
- "--reserved-nodes"
- "${VALIDATOR_RESERVED_NODES:-/dns/sentry/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi}"
# Not only bind to localhost.
- "--ws-external"
- "--rpc-external"
# - "--log"
# - "sub-libp2p=trace"
# - "--log"
# - "afg=trace"
- "--no-telemetry"
- "--rpc-cors"
- "all"
sentry:
image: parity/polkadot
ports:
- "9946:9944"
# volumes:
# - ../../target/release/substrate:/usr/local/bin/substrate
networks:
- network-a
- internet
environment:
- SENTRY_NODE_KEY
- SENTRY_BASE_PATH
- SENTRY_CHAIN
- SENTRY_PORT
- SENTRY_NAME
- SENTRY_BOOTNODES
command:
# Local node id: QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi
- "--node-key"
- "${SENTRY_NODE_KEY:-0000000000000000000000000000000000000000000000000000000000000003}"
- "--base-path"
- "${SENTRY_BASE_PATH:-/tmp/charlies}"
- "--chain=${SENTRY_CHAIN:-local}"
# Don't configure a key, as sentry is not a validator.
- "--port"
- "${SENTRY_PORT:-30333}"
# sentry-a is not a validator.
# - "--validator"
- "--name"
- "${SENTRY_NAME:-CharliesNode}"
- "--bootnodes"
- "${SENTRY_BOOTNODES:-/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR}"
- "--no-telemetry"
- "--rpc-cors"
- "all"
# Not only bind to localhost.
- "--ws-external"
- "--rpc-external"
networks:
network-a:
internet:
......@@ -70,10 +70,7 @@ impl From<sc_network::ObservedRole> for ObservedRole {
match role {
sc_network::ObservedRole::Light => ObservedRole::Light,
sc_network::ObservedRole::Authority => ObservedRole::Authority,
sc_network::ObservedRole::Full
| sc_network::ObservedRole::OurSentry
| sc_network::ObservedRole::OurGuardedAuthority
=> ObservedRole::Full,
sc_network::ObservedRole::Full => ObservedRole::Full,
}
}
}
......
......@@ -788,7 +788,7 @@ pub fn new_full<RuntimeApi, Executor>(
name: Some(name),
observer_enabled: false,
keystore: keystore_opt,
is_authority: role.is_network_authority(),
is_authority: role.is_authority(),
};
let enable_grandpa = !disable_grandpa;
......
......@@ -112,7 +112,7 @@ pub fn node_config(
let base_path = BasePath::new_temp_dir().expect("could not create temporary directory");
let root = base_path.path();
let role = if is_validator {
Role::Authority { sentry_nodes: Vec::new() }
Role::Authority
} else {
Role::Full
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment