This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Introduce flag to enable sentry nodes to participate in grandpa gossip #3018
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# 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. | ||
# Validator B can reach validator A via sentry node A and vice versa. | ||
# | ||
# | ||
# Usage: | ||
# | ||
# 1. Build `target/debug/substrate` binary: `cargo build` | ||
# | ||
# 2. Start networks and containers: `sudo docker-compose -f scripts/sentry-node/docker-compose.yml up` | ||
# | ||
# 3. Reach: | ||
# - polkadot/apps on localhost:3000 | ||
# - validator-a: localhost:9944 | ||
# - validator-b: localhost:9945 | ||
# - sentry-a: localhost:9946 | ||
|
||
version: "3.7" | ||
services: | ||
|
||
validator-a: | ||
ports: | ||
- "9944:9944" | ||
volumes: | ||
- ../../target/debug/substrate:/usr/local/bin/substrate | ||
image: parity/substrate | ||
networks: | ||
- network-a | ||
command: | ||
# Local node id: QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR | ||
- "--node-key" | ||
- "0000000000000000000000000000000000000000000000000000000000000001" | ||
- "--base-path" | ||
- "/tmp/alice" | ||
- "--chain=local" | ||
- "--key" | ||
- "//Alice" | ||
- "--port" | ||
- "30333" | ||
- "--validator" | ||
- "--name" | ||
- "AlicesNode" | ||
- "--bootnodes" | ||
- "/dns4/validator-b/tcp/30333/p2p/QmSVnNf9HwVMT1Y4cK1P6aoJcEZjmoTXpjKBmAABLMnZEk" | ||
# Not only bind to localhost. | ||
- "--ws-external" | ||
- "--rpc-external" | ||
# - "--log" | ||
# - "sub-libp2p=trace" | ||
# - "--log" | ||
# - "afg=trace" | ||
- "--no-telemetry" | ||
- "--rpc-cors" | ||
- "all" | ||
|
||
sentry-a: | ||
image: parity/substrate | ||
ports: | ||
- "9946:9944" | ||
volumes: | ||
- ../../target/debug/substrate:/usr/local/bin/substrate | ||
networks: | ||
- network-a | ||
- internet | ||
command: | ||
# Local node id: QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi | ||
- "--node-key" | ||
- "0000000000000000000000000000000000000000000000000000000000000003" | ||
- "--base-path" | ||
- "/tmp/sentry" | ||
- "--chain=local" | ||
# Don't configure a key, as sentry-a is not a validator. | ||
# - "--key" | ||
# - "//Charlie" | ||
- "--port" | ||
- "30333" | ||
# sentry-a is not a validator. | ||
# - "--validator" | ||
- "--name" | ||
- "CharliesNode" | ||
- "--bootnodes" | ||
- "/dns4/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" | ||
- "--bootnodes" | ||
- "/dns4/validator-b/tcp/30333/p2p/QmSVnNf9HwVMT1Y4cK1P6aoJcEZjmoTXpjKBmAABLMnZEk" | ||
- "--no-telemetry" | ||
- "--rpc-cors" | ||
- "all" | ||
# Not only bind to localhost. | ||
- "--ws-external" | ||
- "--rpc-external" | ||
# Make sure sentry-a still participates as a grandpa voter to forward | ||
# grandpa finality gossip messages. | ||
- "--grandpa-voter" | ||
|
||
validator-b: | ||
image: parity/substrate | ||
ports: | ||
- "9945:9944" | ||
volumes: | ||
- ../../target/debug/substrate:/usr/local/bin/substrate | ||
networks: | ||
- internet | ||
command: | ||
# Local node id: QmSVnNf9HwVMT1Y4cK1P6aoJcEZjmoTXpjKBmAABLMnZEk | ||
- "--node-key" | ||
- "0000000000000000000000000000000000000000000000000000000000000002" | ||
- "--base-path" | ||
- "/tmp/bob" | ||
- "--chain=local" | ||
- "--key" | ||
- "//Bob" | ||
- "--port" | ||
- "30333" | ||
- "--validator" | ||
- "--name" | ||
- "BobsNode" | ||
- "--bootnodes" | ||
- "/dns4/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR" | ||
- "--no-telemetry" | ||
- "--rpc-cors" | ||
- "all" | ||
# Not only bind to localhost. | ||
- "--ws-external" | ||
- "--rpc-external" | ||
|
||
ui: | ||
image: polkadot-js/apps | ||
ports: | ||
- "3000:80" | ||
|
||
networks: | ||
network-a: | ||
internet: |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use
--reserved-nodes
here instead? Same for the other nodes configs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding some more details @andresilva?
If I understand correctly, validator addresses can change at runtime. Thus if the address of validator-b changes, sentry-a would need to be restarted. I would suggest only interconnecting validator-a and sentry-a as reserved nodes and sentry-a and validator-b as bootstrap nodes, given that a and b are controlled by different entities.
What do you think?
On a side note, I am currently looking into how a user can tell a validator node to keep x amount of connections open to other validator nodes. As the validator address set can change at runtime, these long-lived connections would also be adjusted along the way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this config
A
connects toB
(through bootnodes). The sentry connects toA
andB
, andB
also tries to connect withA
.My understanding is that in a real scenario the validator nodes that are using a sentry will only be connected to the sentry (or multiple sentries). So I think in this config
Validator-A
should setSentry-A
as a reserved node (so that it only connects to this node), and the rest of the nodes (Sentry-A
andValidator-B
) can add everyone as bootnode (even thoughValidator-B
won't be able to connect toValidator-A
).