-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add two more validators, providing four nodes in a devnet. #383
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ee9ad3d
Closes #381: Add 2 more validators, providing 4 nodes in the devnet.
vitropy 429823e
update the dev/README
frankiebee 7701721
tests - are failing
frankiebee 33fc49f
Add hostname addressing for `dave`'s and `eve`'s TSS server, too.
vitropy 4a78ac7
Suggest newer Docker CLI habits. Fix typo in stderr output.
vitropy 0c26d63
Mount the `./dev` directory into the devnet containers.
vitropy 41b130c
Merge remote-tracking branch 'origin' into vi/four-nodes
mixmix 0cd6c17
chain to proper chain name
JesseAbram 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
# Docker Compose file for making an Entropy blockchain network. | ||
# Currently, it's intended for LOCAL DEVNET FUNCTIONALITY ONLY. | ||
# Things will get better and more generic, but for the moment | ||
# this iteration is for simplifying the dogfooding and testing | ||
# workflows our engineers use, and trying to cut down on some | ||
# of the more complicated test code that spins up this kind of | ||
# environment for their tests. Eventually, we will converge on | ||
# a more canonical set of environments and configuration files. | ||
--- | ||
name: entropy-devnet-local-four-nodes-4-nodes | ||
|
||
services: | ||
alice-tss-server: | ||
# This pulls from Docker Hub, so you can replace the image tag name | ||
# (the string after the `:` in the `image` key) with whatever tag | ||
# name you'd like to use. Each Docker image is built from a specific | ||
# commit in the `entropy-core` repository. Refer to the wiki page at | ||
# https://github.com/entropyxyz/meta/wiki/Git#conventions for details | ||
# about how Git tags, branches, and commits refer to image tags here. | ||
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:3001:3001/tcp" | ||
command: | ||
- "--alice" | ||
- "--threshold-url" | ||
- "0.0.0.0:3001" | ||
- "--chain-endpoint" | ||
- "ws://alice-chain-node:9944" | ||
- '--no-sync' | ||
|
||
alice-chain-node: | ||
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:9944:9944/tcp" | ||
volumes: | ||
- ${PWD}/dev:/srv/entropy/dev | ||
command: | ||
- "--chain" | ||
- "devnet-local-four-nodes" | ||
- "--alice" | ||
- "--base-path" | ||
- ".entropy/alice" | ||
- "--rpc-port" | ||
- "9944" | ||
- "--rpc-cors" | ||
- "all" | ||
- "--unsafe-rpc-external" # Intentional, for TSS's access. | ||
- "--node-key=0000000000000000000000000000000000000000000000000000000000000001" | ||
- "--tss-server-endpoint" | ||
- "http://alice-tss-server:3001" | ||
|
||
bob-tss-server: | ||
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:3002:3002/tcp" | ||
command: | ||
- "--bob" | ||
- "--threshold-url" | ||
- "0.0.0.0:3002" | ||
- "--chain-endpoint" | ||
- "ws://bob-chain-node:9944" | ||
- '--no-sync' | ||
|
||
# "Bob's chain node." | ||
bob-chain-node: | ||
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:9945:9944/tcp" | ||
volumes: | ||
- ${PWD}/dev:/srv/entropy/dev | ||
command: | ||
- "--chain" | ||
- "devnet-local-four-nodes" | ||
- "--bob" | ||
- "--base-path" | ||
- ".entropy/bob" | ||
- "--rpc-port" | ||
- "9944" | ||
- "--rpc-cors" | ||
- "all" | ||
- "--unsafe-rpc-external" # Intentional, for TSS's access. | ||
- "--bootnodes" | ||
- "/dns4/alice-chain-node/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" | ||
- "--tss-server-endpoint" | ||
- "http://bob-tss-server:3002" | ||
|
||
dave-tss-server: | ||
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:3003:3003/tcp" | ||
command: | ||
- "--dave" | ||
- "--threshold-url" | ||
- "0.0.0.0:3003" | ||
- "--chain-endpoint" | ||
- "ws://dave-chain-node:9944" | ||
- '--no-sync' | ||
|
||
dave-chain-node: | ||
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:9946:9944/tcp" | ||
volumes: | ||
- ${PWD}/dev:/srv/entropy/dev | ||
command: | ||
- "--chain" | ||
- "devnet-local-four-nodes" | ||
- "--dave" | ||
- "--base-path" | ||
- ".entropy/dave" | ||
- "--rpc-port" | ||
- "9944" | ||
- "--rpc-cors" | ||
- "all" | ||
- "--unsafe-rpc-external" # Intentional, for TSS's access. | ||
- "--bootnodes" | ||
- "/dns4/alice-chain-node/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" | ||
- "--tss-server-endpoint" | ||
- "http://dave-tss-server:3003" | ||
|
||
eve-tss-server: | ||
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:3004:3004/tcp" | ||
command: | ||
- "--dave" | ||
- "--threshold-url" | ||
- "0.0.0.0:3004" | ||
- "--chain-endpoint" | ||
- "ws://eve-chain-node:9944" | ||
- '--no-sync' | ||
|
||
eve-chain-node: | ||
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest} | ||
ports: | ||
- "127.0.0.1:9947:9944/tcp" | ||
volumes: | ||
- ${PWD}/dev:/srv/entropy/dev | ||
command: | ||
- "--chain" | ||
- "devnet-local-four-nodes" | ||
- "--eve" | ||
- "--base-path" | ||
- ".entropy/eve" | ||
- "--rpc-port" | ||
- "9944" | ||
- "--rpc-cors" | ||
- "all" | ||
- "--unsafe-rpc-external" # Intentional, for TSS's access. | ||
- "--bootnodes" | ||
- "/dns4/alice-chain-node/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" | ||
- "--tss-server-endpoint" | ||
- "http://eve-tss-server:3004" |
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,64 @@ | ||
import test from 'tape' | ||
import { readFileSync } from 'fs' | ||
import Entropy, { wasmGlobalsReady } from '../src' | ||
import Keyring from '../src/keys' | ||
import * as util from '@polkadot/util' | ||
|
||
import { | ||
sleep, | ||
promiseRunner, | ||
spinNetworkUp, | ||
charlieStashSeed, | ||
charlieStashAddress, | ||
spinNetworkDown, | ||
} from './testing-utils' | ||
|
||
const networkType = 'four-nodes' | ||
|
||
|
||
test('test the four-nodes docker script for subgroups', async (t) => { | ||
const run = promiseRunner(t) | ||
// context: all run does is checks that it runs | ||
await run('network up', spinNetworkUp(networkType)) | ||
|
||
await sleep(process.env.GITHUB_WORKSPACE ? 30_000 * 2 : 5_000 * 2) | ||
|
||
// this gets called after all tests are run | ||
t.teardown(async () => { | ||
await entropy.close() | ||
await spinNetworkDown(networkType).catch((error) => | ||
console.error('Error while spinning network down', error.message) | ||
) | ||
}) | ||
|
||
await run('wasm', wasmGlobalsReady()) | ||
|
||
const keyring = new Keyring({ seed: charlieStashSeed, debug: true }) | ||
let store = keyring.getAccount() | ||
t.equal(store.admin.address, keyring.accounts.registration.pair.address, 'admin account should have an address and for now it should match registrations address') | ||
keyring.accounts.on('account-update', (fullAccount) => { | ||
store = fullAccount | ||
}) | ||
|
||
|
||
const entropy = new Entropy({ | ||
keyring, | ||
endpoint: 'ws://127.0.0.1:9944', | ||
}) | ||
|
||
await run('entropy ready', entropy.ready) | ||
const entries = await run('signingGroups', entropy.substrate.query.stakingExtension.signingGroups.entries()) | ||
|
||
const subGroups = entries.map((group) => { | ||
// aka: subGroup | ||
const keyGroup = group[1] | ||
console.log('') | ||
// omg polkadot type gen is a head ache | ||
// @ts-ignore: next line | ||
return keyGroup.unwrap() | ||
}) | ||
t.equal(subGroups.length, 2, 'expecting 2 subgroups') | ||
t.equal(subGroups[0].length, 2, 'expecting 2 validators per subgroup') | ||
await entropy.close() | ||
t.end() | ||
}) |
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,33 @@ | ||
import { ApiPromise /* WsProvider */ } from '@polkadot/api' | ||
import { execFileSync } from 'child_process' | ||
|
||
export async function spinNetworkUp(networkType = 'two-nodes') { | ||
try { | ||
execFileSync( | ||
'dev/bin/spin-up.sh', | ||
[networkType], | ||
{ shell: true, cwd: process.cwd(), stdio: 'inherit' } // Use shell's search path. | ||
) | ||
} catch (e) { | ||
console.error('Error in spinNetworkUp: ', e.message) | ||
} | ||
} | ||
|
||
export async function spinNetworkDown(networkType = 'two-nodes') { | ||
try { | ||
execFileSync('dev/bin/spin-down.sh', [networkType], { | ||
shell: true, | ||
cwd: process.cwd(), | ||
stdio: 'inherit', | ||
}) | ||
} catch (e) { | ||
console.error('Error in afterAll: ', e.message) | ||
} | ||
} | ||
|
||
// export async function getApi(endpoint = 'ws://127.0.0.1:9944'): Promise<ApiPromise> { | ||
// const wsProvider = new WsProvider(endpoint) | ||
// const api = new ApiPromise({ provider: wsProvider }) | ||
// await api.isReady | ||
// return api | ||
// } |
Oops, something went wrong.
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.
all these need to change to
devnet-local
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.
https://github.com/entropyxyz/entropy-core/blob/master/node/cli/src/command.rs#L80