-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0c0c54
commit 69cb867
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
test/testdata/deployednettemplates/recipes/scenario1s-p2p/Makefile
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,23 @@ | ||
# scenario1s is scenario1 but smaller, (100 nodes, 100 wallets) -> (20 nodes, 20 wallets), each algod gets single tenancy on a smaller ec2 instance | ||
PARAMS=-w 20 -R 8 -N 20 -n 20 --npn-algod-nodes 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json | ||
|
||
.PHONY: copy-configs clean all | ||
|
||
all: net.json genesis.json topology.json | ||
|
||
copy-configs: | ||
python3 copy-node-configs.py | ||
|
||
net.json: copy-configs node.json nonPartNode.json relay.json ${GOPATH}/bin/netgoal Makefile | ||
netgoal generate -t net -r /tmp/wat -o net.json ${PARAMS} | ||
|
||
genesis.json: ${GOPATH}/bin/netgoal Makefile | ||
netgoal generate -t genesis -r /tmp/wat -o genesis.l.json ${PARAMS} | ||
jq '.LastPartKeyRound=5000|.NetworkName="s1s-p2p"|.ConsensusProtocol="future"' < genesis.l.json > genesis.json | ||
rm genesis.l.json | ||
|
||
topology.json: ../scenario1s/gen_topology.py | ||
python3 ../scenario1s/gen_topology.py | ||
|
||
clean: | ||
rm -f net.json genesis.json node.json nonPartNode.json relay.json topology.json |
16 changes: 16 additions & 0 deletions
16
test/testdata/deployednettemplates/recipes/scenario1s-p2p/README.md
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,16 @@ | ||
# Scenario1s for P2P testing | ||
|
||
This is a copy of scenario1s with the following changes in nodes configuration: | ||
1. All nodes get `"EnableP2P": true` into their config. | ||
1. All relays additionally get `"P2PBootstrap": true` to their netgoal config. | ||
|
||
## Build | ||
|
||
```sh | ||
export GOPATH=~/go | ||
make | ||
``` | ||
|
||
## Run | ||
|
||
Run as usual cluster test scenario with algonet. |
52 changes: 52 additions & 0 deletions
52
test/testdata/deployednettemplates/recipes/scenario1s-p2p/copy-node-configs.py
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,52 @@ | ||
""" | ||
Copies node.json, relay.json and nonPartNode.json from scenario1s: | ||
1. Append \"EnableP2P\": true to all configs | ||
2. Set P2PBootstrap: true to relay.json | ||
""" | ||
|
||
import json | ||
import os | ||
|
||
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
SCENARIO1S_DIR = os.path.join(CURRENT_DIR, "..", "scenario1s") | ||
|
||
def main(): | ||
"""main""" | ||
with open(os.path.join(SCENARIO1S_DIR, "node.json"), "r") as f: | ||
node = json.load(f) | ||
with open(os.path.join(SCENARIO1S_DIR, "relay.json"), "r") as f: | ||
relay = json.load(f) | ||
with open(os.path.join(SCENARIO1S_DIR, "nonPartNode.json"), "r") as f: | ||
non_part_node = json.load(f) | ||
|
||
# make all relays P2PBootstrap'able | ||
relay["P2PBootstrap"] = True | ||
|
||
# enable P2P for all configs | ||
for config in (node, relay, non_part_node): | ||
override = config.get("ConfigJSONOverride") | ||
if override: | ||
override_json = json.loads(override) | ||
override_json["EnableP2P"] = True | ||
config["ConfigJSONOverride"] = json.dumps(override_json) | ||
altconfigs = config.get("AltConfigs", []) | ||
if altconfigs: | ||
for i, altconfig in enumerate(altconfigs): | ||
override = altconfig.get("ConfigJSONOverride") | ||
if override: | ||
override_json = json.loads(override) | ||
override_json["EnableP2P"] = True | ||
altconfigs[i]["ConfigJSONOverride"] = json.dumps(override_json) | ||
config["AltConfigs"] = altconfigs | ||
|
||
with open("node.json", "w") as f: | ||
json.dump(node, f, indent=4) | ||
with open("relay.json", "w") as f: | ||
json.dump(relay, f, indent=4) | ||
with open("nonPartNode.json", "w") as f: | ||
json.dump(non_part_node, f, indent=4) | ||
|
||
print("Done!") | ||
|
||
if __name__ == '__main__': | ||
main() |
7 changes: 7 additions & 0 deletions
7
test/testdata/deployednettemplates/recipes/scenario1s-p2p/recipe.json
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,7 @@ | ||
{ | ||
"GenesisFile":"genesis.json", | ||
"NetworkFile":"net.json", | ||
"ConfigFile": "../../configs/reference.json", | ||
"HostTemplatesFile": "../../hosttemplates/hosttemplates.json", | ||
"TopologyFile": "topology.json" | ||
} |