Compare commits

...
Author SHA1 Message Date
zramsay bcf6564cec huh 2023-09-11 14:04:57 -04:00
dborehamandDavid Boreham 626cc17373 Update copyright messages (#530)
Co-authored-by: David Boreham <david@bozemanpas.com>
2023-09-10 13:28:26 -06:00
dboreham c30c779535 Pass through auth token to plugeth container builds (#529) 2023-09-08 15:37:59 -06:00
prathamesh0andnabarun 3011a485ee Update mobymask-v2 stack with pubsub option (#527)
* Add steps to force rebuild and persist peers_ids volume

* Update mobymask-v2 stack with pubsub option

* Update watcher-ts version

---------

Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
2023-09-06 14:48:32 +05:30
dboreham d505664781 Fix bug in deploy setup (#526) 2023-09-04 19:33:36 -06:00
dboreham 4197d39b0c Fix lint errors (#525) 2023-09-04 15:23:22 -06:00
dboreham 8dcebe3737 Configure laconicd initial peers (#524)
* Configure initial peers through deploy create command

* Re-write config file
2023-09-04 15:13:23 -06:00
32 changed files with 118 additions and 47 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+2 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@@ -86,6 +86,7 @@ def command(ctx, include, exclude, force_rebuild, extra_build_args):
# TODO: make this configurable # TODO: make this configurable
container_build_env = { container_build_env = {
"CERC_NPM_REGISTRY_URL": get_npm_registry_url(), "CERC_NPM_REGISTRY_URL": get_npm_registry_url(),
"CERC_GO_AUTH_TOKEN": config("CERC_GO_AUTH_TOKEN", default=""),
"CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default=""), "CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default=""),
"CERC_REPO_BASE_DIR": dev_root_path, "CERC_REPO_BASE_DIR": dev_root_path,
"CERC_CONTAINER_BASE_DIR": container_build_dir, "CERC_CONTAINER_BASE_DIR": container_build_dir,
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2023 Cerc # Copyright © 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@@ -14,7 +14,8 @@ services:
CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL} CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL}
CERC_RELAY_NODES: ${CERC_RELAY_NODES} CERC_RELAY_NODES: ${CERC_RELAY_NODES}
CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS}
CERC_RELEASE: "v0.1.6" CERC_PUBSUB: ${CERC_PUBSUB}
CERC_RELEASE: "v0.1.7"
CERC_USE_NPM: true CERC_USE_NPM: true
CERC_CONFIG_FILE: "src/config.json" CERC_CONFIG_FILE: "src/config.json"
working_dir: /scripts working_dir: /scripts
@@ -48,7 +49,8 @@ services:
CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL} CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL}
CERC_RELAY_NODES: ${CERC_RELAY_NODES} CERC_RELAY_NODES: ${CERC_RELAY_NODES}
CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS}
CERC_RELEASE: "v0.1.6-lxdao-0.1.1" CERC_PUBSUB: ${CERC_PUBSUB}
CERC_RELEASE: "v0.1.7-lxdao-0.1.1"
CERC_USE_NPM: false CERC_USE_NPM: false
CERC_CONFIG_FILE: "src/utils/config.json" CERC_CONFIG_FILE: "src/utils/config.json"
working_dir: /scripts working_dir: /scripts
@@ -84,6 +84,7 @@ services:
CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER} CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER}
CERC_RELAY_PEERS: ${CERC_RELAY_PEERS} CERC_RELAY_PEERS: ${CERC_RELAY_PEERS}
CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS}
CERC_PUBSUB: ${CERC_PUBSUB}
CERC_RELAY_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN} CERC_RELAY_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN}
CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS} CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS}
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
@@ -8,6 +8,7 @@ CERC_CHAIN_ID="${CERC_CHAIN_ID:-${DEFAULT_CERC_CHAIN_ID}}"
CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}" CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}"
CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}"
CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}"
CERC_APP_WATCHER_URL="${CERC_APP_WATCHER_URL:-${DEFAULT_CERC_APP_WATCHER_URL}}" CERC_APP_WATCHER_URL="${CERC_APP_WATCHER_URL:-${DEFAULT_CERC_APP_WATCHER_URL}}"
# If not set (or []), check the mounted volume for relay peer id # If not set (or []), check the mounted volume for relay peer id
@@ -41,7 +42,8 @@ jq --arg address "$CERC_DEPLOYED_CONTRACT" \
--argjson chainId "$CERC_CHAIN_ID" \ --argjson chainId "$CERC_CHAIN_ID" \
--argjson relayNodes "$CERC_RELAY_NODES" \ --argjson relayNodes "$CERC_RELAY_NODES" \
--argjson denyMultiaddrs "$CERC_DENY_MULTIADDRS" \ --argjson denyMultiaddrs "$CERC_DENY_MULTIADDRS" \
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes | .peer.denyMultiaddrs = $denyMultiaddrs' \ --arg pubsub "$CERC_PUBSUB" \
'.address = $address | .chainId = $chainId | .relayNodes = $relayNodes | .peer.denyMultiaddrs = $denyMultiaddrs | .peer.pubsub = $pubsub' \
/app/src/mobymask-app-config.json > /app/${CERC_CONFIG_FILE} /app/src/mobymask-app-config.json > /app/${CERC_CONFIG_FILE}
if [ "${CERC_USE_NPM}" = "true" ]; then if [ "${CERC_USE_NPM}" = "true" ]; then
@@ -27,3 +27,6 @@ DEFAULT_CERC_RELAY_NODES=[]
# Set of multiaddrs to be avoided while dialling # Set of multiaddrs to be avoided while dialling
DEFAULT_CERC_DENY_MULTIADDRS=[] DEFAULT_CERC_DENY_MULTIADDRS=[]
# Type of pubsub to be used
DEFAULT_CERC_PUBSUB=""
@@ -9,6 +9,7 @@ CERC_L1_ACCOUNTS_CSV_URL="${CERC_L1_ACCOUNTS_CSV_URL:-${DEFAULT_CERC_L1_ACCOUNTS
CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}" CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}"
CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}"
CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}"
CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN}}" CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN}}"
CERC_ENABLE_PEER_L2_TXS="${CERC_ENABLE_PEER_L2_TXS:-${DEFAULT_CERC_ENABLE_PEER_L2_TXS}}" CERC_ENABLE_PEER_L2_TXS="${CERC_ENABLE_PEER_L2_TXS:-${DEFAULT_CERC_ENABLE_PEER_L2_TXS}}"
CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
@@ -50,6 +51,7 @@ WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
sed -E "s|REPLACE_WITH_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \ sed -E "s|REPLACE_WITH_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \
s|REPLACE_WITH_CERC_DENY_MULTIADDRS|${CERC_DENY_MULTIADDRS}|g; \ s|REPLACE_WITH_CERC_DENY_MULTIADDRS|${CERC_DENY_MULTIADDRS}|g; \
s/REPLACE_WITH_CERC_PUBSUB/${CERC_PUBSUB}/g; \
s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \ s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \
s|REPLACE_WITH_CERC_RELAY_MULTIADDR|${CERC_RELAY_MULTIADDR}|g; \ s|REPLACE_WITH_CERC_RELAY_MULTIADDR|${CERC_RELAY_MULTIADDR}|g; \
s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \ s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \
@@ -30,6 +30,7 @@
denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS
peerIdFile = './peers/relay-id.json' peerIdFile = './peers/relay-id.json'
announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN' announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN'
pubsub = 'REPLACE_WITH_CERC_PUBSUB'
enableDebugInfo = true enableDebugInfo = true
[server.p2p.peer] [server.p2p.peer]
@@ -37,6 +38,7 @@
pubSubTopic = 'mobymask' pubSubTopic = 'mobymask'
denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS
peerIdFile = './peers/peer-id.json' peerIdFile = './peers/peer-id.json'
pubsub = 'REPLACE_WITH_CERC_PUBSUB'
enableDebugInfo = true enableDebugInfo = true
enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS
@@ -1,4 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/plugeth-statediff # Build cerc/plugeth-statediff
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
docker build -t cerc/plugeth-statediff:local ${build_command_args} ${CERC_REPO_BASE_DIR}/plugeth-statediff # This container build currently requires access to private dependencies in gitea
# so we check that the necessary access token has been supplied here, then pass it o the build
if [[ -z "${CERC_GO_AUTH_TOKEN}" ]]; then
echo "ERROR: CERC_GO_AUTH_TOKEN is not set" >&2
exit 1
fi
docker build -t cerc/plugeth-statediff:local ${build_command_args} --build-arg GIT_VDBTO_TOKEN=${CERC_GO_AUTH_TOKEN} ${CERC_REPO_BASE_DIR}/plugeth-statediff
@@ -1,4 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build cerc/plugeth # Build cerc/plugeth
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
docker build -t cerc/plugeth:local ${build_command_args} ${CERC_REPO_BASE_DIR}/plugeth # This container build currently requires access to private dependencies in gitea
# so we check that the necessary access token has been supplied here, then pass it o the build
if [[ -z "${CERC_GO_AUTH_TOKEN}" ]]; then
echo "ERROR: CERC_GO_AUTH_TOKEN is not set" >&2
exit 1
fi
docker build -t cerc/plugeth:local ${build_command_args} --build-arg GIT_VDBTO_TOKEN=${CERC_GO_AUTH_TOKEN} ${CERC_REPO_BASE_DIR}/plugeth
@@ -6,4 +6,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505 # See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/watcher-erc20:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/watcher-ts docker build -t cerc/watcher-erc20:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/erc20-watcher-ts
+1 -1
View File
@@ -4,7 +4,7 @@ repos:
- github.com/cerc-io/go-ethereum - github.com/cerc-io/go-ethereum
- github.com/cerc-io/ipld-eth-db - github.com/cerc-io/ipld-eth-db
- github.com/cerc-io/ipld-eth-server - github.com/cerc-io/ipld-eth-server
- github.com/cerc-io/watcher-ts - github.com/cerc-io/erc20-watcher-ts
- github.com/dboreham/foundry - github.com/dboreham/foundry
containers: containers:
- cerc/foundry - cerc/foundry
@@ -18,6 +18,11 @@ Build the container images:
```bash ```bash
laconic-so --stack fixturenet-optimism build-containers laconic-so --stack fixturenet-optimism build-containers
# If redeploying with changes in the stack containers
laconic-so --stack fixturenet-optimism build-containers --force-rebuild
# If errors are thrown during build, old images used by this stack would have to be deleted
``` ```
Note: this will take >10 mins depending on the specs of your machine, and **requires** 16GB of memory or greater. Note: this will take >10 mins depending on the specs of your machine, and **requires** 16GB of memory or greater.
@@ -12,6 +12,7 @@ See `stacks/fixturenet-eth/README.md` for more information.
* cerc/tx-spammer * cerc/tx-spammer
## Deploy the stack ## Deploy the stack
Note: since some Go dependencies are currently private, `CERC_GO_AUTH_TOKEN` must be set to a valid Gitea access token before running the `build-containers` command.
``` ```
$ laconic-so --stack fixturenet-plugeth-tx setup-repositories $ laconic-so --stack fixturenet-plugeth-tx setup-repositories
$ laconic-so --stack fixturenet-plugeth-tx build-containers $ laconic-so --stack fixturenet-plugeth-tx build-containers
@@ -1,4 +1,4 @@
# Copyright © 2023 Cerc # Copyright © 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@@ -14,7 +14,7 @@
# along with this program. If not, see <http:#www.gnu.org/licenses/>. # along with this program. If not, see <http:#www.gnu.org/licenses/>.
from app.util import get_yaml from app.util import get_yaml
from app.deploy_types import DeployCommandContext, LaconicStackSetupCommand from app.deploy_types import DeployCommandContext, LaconicStackSetupCommand, DeploymentContext
from app.stack_state import State from app.stack_state import State
from app.deploy_util import VolumeMapping, run_container_command from app.deploy_util import VolumeMapping, run_container_command
from app.command_types import CommandOptions from app.command_types import CommandOptions
@@ -110,17 +110,22 @@ def _remove_persistent_peers(options: CommandOptions, network_dir: Path):
output_file.write(config_file_content) output_file.write(config_file_content)
def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCommand, extra_args): def _insert_persistent_peers(options: CommandOptions, config_dir: Path, new_persistent_peers: str):
config_file_path = config_dir.joinpath("config.toml")
if not config_file_path.exists():
print("Error: config.toml not found")
sys.exit(1)
with open(config_file_path, "r") as input_file:
config_file_content = input_file.read()
persistent_peers_pattern = '^persistent_peers = ""'
replace_with = f"persistent_peers = \"{new_persistent_peers}\""
config_file_content = re.sub(persistent_peers_pattern, replace_with, config_file_content, flags=re.MULTILINE)
with open(config_file_path, "w") as output_file:
output_file.write(config_file_content)
options = command_context.cluster_context.options
currency = "stake" # Does this need to be a parameter?
if options.debug:
print(f"parameters: {parameters}")
def _phase_from_params(parameters):
phase = SetupPhase.ILLEGAL phase = SetupPhase.ILLEGAL
if parameters.initialize_network: if parameters.initialize_network:
if parameters.join_network or parameters.create_network: if parameters.join_network or parameters.create_network:
print("Can't supply --join-network or --create-network with --initialize-network") print("Can't supply --join-network or --create-network with --initialize-network")
@@ -143,6 +148,19 @@ def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCo
print("Can't supply --initialize-network or --join-network with --create-network") print("Can't supply --initialize-network or --join-network with --create-network")
sys.exit(1) sys.exit(1)
phase = SetupPhase.CREATE phase = SetupPhase.CREATE
return phase
def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCommand, extra_args):
options = command_context.cluster_context.options
currency = "stake" # Does this need to be a parameter?
if options.debug:
print(f"parameters: {parameters}")
phase = _phase_from_params(parameters)
network_dir = Path(parameters.network_dir).absolute() network_dir = Path(parameters.network_dir).absolute()
laconicd_home_path_in_container = "/laconicd-home" laconicd_home_path_in_container = "/laconicd-home"
@@ -184,20 +202,22 @@ def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCo
f"laconicd add-genesis-account {parameters.key_name} 12900000000000000000000{currency}\ f"laconicd add-genesis-account {parameters.key_name} 12900000000000000000000{currency}\
--home {laconicd_home_path_in_container} --keyring-backend test", --home {laconicd_home_path_in_container} --keyring-backend test",
mounts) mounts)
print(f"Command output: {output2}") if options.debug:
print(f"Command output: {output2}")
output3, status3 = run_container_command( output3, status3 = run_container_command(
command_context, command_context,
"laconicd", "laconicd",
f"laconicd gentx {parameters.key_name} 90000000000{currency} --home {laconicd_home_path_in_container}\ f"laconicd gentx {parameters.key_name} 90000000000{currency} --home {laconicd_home_path_in_container}\
--chain-id {chain_id} --keyring-backend test", --chain-id {chain_id} --keyring-backend test",
mounts) mounts)
print(f"Command output: {output3}") if options.debug:
print(f"Command output: {output3}")
output4, status4 = run_container_command( output4, status4 = run_container_command(
command_context, command_context,
"laconicd", "laconicd",
f"laconicd keys show {parameters.key_name} -a --home {laconicd_home_path_in_container} --keyring-backend test", f"laconicd keys show {parameters.key_name} -a --home {laconicd_home_path_in_container} --keyring-backend test",
mounts) mounts)
print(f"Command output: {output4}") print(f"Node validator address: {output4}")
elif phase == SetupPhase.CREATE: elif phase == SetupPhase.CREATE:
if not os.path.exists(network_dir): if not os.path.exists(network_dir):
@@ -216,6 +236,9 @@ def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCo
copyfile(genesis_file_path, os.path.join(network_dir, "config", os.path.basename(genesis_file_path))) copyfile(genesis_file_path, os.path.join(network_dir, "config", os.path.basename(genesis_file_path)))
else: else:
# We're generating the genesis file # We're generating the genesis file
if not parameters.gentx_file_list:
print("Error: --gentx-files must be supplied")
sys.exit(1)
# First look in the supplied gentx files for the other nodes' keys # First look in the supplied gentx files for the other nodes' keys
other_node_keys = _get_node_keys_from_gentx_files(options, parameters.gentx_file_list) other_node_keys = _get_node_keys_from_gentx_files(options, parameters.gentx_file_list)
# Add those keys to our genesis, with balances we determine here (why?) # Add those keys to our genesis, with balances we determine here (why?)
@@ -223,13 +246,15 @@ def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCo
outputk, statusk = run_container_command( outputk, statusk = run_container_command(
command_context, "laconicd", f"laconicd add-genesis-account {other_node_key} 12900000000000000000000{currency}\ command_context, "laconicd", f"laconicd add-genesis-account {other_node_key} 12900000000000000000000{currency}\
--home {laconicd_home_path_in_container} --keyring-backend test", mounts) --home {laconicd_home_path_in_container} --keyring-backend test", mounts)
print(f"Command output: {outputk}") if options.debug:
print(f"Command output: {outputk}")
# Copy the gentx json files into our network dir # Copy the gentx json files into our network dir
_copy_gentx_files(options, network_dir, parameters.gentx_file_list) _copy_gentx_files(options, network_dir, parameters.gentx_file_list)
# Now we can run collect-gentxs # Now we can run collect-gentxs
output1, status1 = run_container_command( output1, status1 = run_container_command(
command_context, "laconicd", f"laconicd collect-gentxs --home {laconicd_home_path_in_container}", mounts) command_context, "laconicd", f"laconicd collect-gentxs --home {laconicd_home_path_in_container}", mounts)
print(f"Command output: {output1}") if options.debug:
print(f"Command output: {output1}")
print(f"Generated genesis file, please copy to other nodes as required: \ print(f"Generated genesis file, please copy to other nodes as required: \
{os.path.join(network_dir, 'config', 'genesis.json')}") {os.path.join(network_dir, 'config', 'genesis.json')}")
# Last thing, collect-gentxs puts a likely bogus set of persistent_peers in config.toml so we remove that now # Last thing, collect-gentxs puts a likely bogus set of persistent_peers in config.toml so we remove that now
@@ -237,15 +262,15 @@ def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCo
# In both cases we validate the genesis file now # In both cases we validate the genesis file now
output2, status1 = run_container_command( output2, status1 = run_container_command(
command_context, "laconicd", f"laconicd validate-genesis --home {laconicd_home_path_in_container}", mounts) command_context, "laconicd", f"laconicd validate-genesis --home {laconicd_home_path_in_container}", mounts)
print(f"Command output: {output2}") print(f"validate-genesis result: {output2}")
else: else:
print("Illegal parameters supplied") print("Illegal parameters supplied")
sys.exit(1) sys.exit(1)
def create(command_context: DeployCommandContext, extra_args): def create(context: DeploymentContext, extra_args):
network_dir = extra_args network_dir = extra_args[0]
if network_dir is None: if network_dir is None:
print("Error: --network-dir must be supplied") print("Error: --network-dir must be supplied")
sys.exit(1) sys.exit(1)
@@ -263,11 +288,15 @@ def create(command_context: DeployCommandContext, extra_args):
sys.exit(1) sys.exit(1)
# Copy the network directory contents into our deployment # Copy the network directory contents into our deployment
# TODO: change this to work with non local paths # TODO: change this to work with non local paths
deployment_config_dir = command_context.deployment_dir.joinpath("data", "laconicd-config") deployment_config_dir = context.deployment_dir.joinpath("data", "laconicd-config")
copytree(config_dir_path, deployment_config_dir, dirs_exist_ok=True) copytree(config_dir_path, deployment_config_dir, dirs_exist_ok=True)
# If supplied, add the initial persistent peers to the config file
if extra_args[1]:
initial_persistent_peers = extra_args[1]
_insert_persistent_peers(context.command_context.cluster_context.options, deployment_config_dir, initial_persistent_peers)
# Copy the data directory contents into our deployment # Copy the data directory contents into our deployment
# TODO: change this to work with non local paths # TODO: change this to work with non local paths
deployment_data_dir = command_context.deployment_dir.joinpath("data", "laconicd-data") deployment_data_dir = context.deployment_dir.joinpath("data", "laconicd-data")
copytree(data_dir_path, deployment_data_dir, dirs_exist_ok=True) copytree(data_dir_path, deployment_data_dir, dirs_exist_ok=True)
@@ -60,6 +60,9 @@ Create and update an env file to be used in the next step ([defaults](../../conf
# (Optional) Set of multiaddrs to be avoided while dialling # (Optional) Set of multiaddrs to be avoided while dialling
CERC_DENY_MULTIADDRS=[] CERC_DENY_MULTIADDRS=[]
# (Optional) Type of pubsub to be used
CERC_PUBSUB=""
# Set to false for disabling watcher peer to send txs to L2 # Set to false for disabling watcher peer to send txs to L2
CERC_ENABLE_PEER_L2_TXS=true CERC_ENABLE_PEER_L2_TXS=true
@@ -119,4 +122,8 @@ docker volume ls -q --filter "name=mobymask_v2"
# Remove all the listed volumes # Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2") docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
# WARNING: To avoid changing peer ids for the watcher, `peers_ids` volume can be persisted
# To delete all volumes except for `peers_ids`
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2" | grep -v "peers_ids$")
``` ```
+2 -2
View File
@@ -6,8 +6,8 @@ repos:
- github.com/dboreham/foundry - github.com/dboreham/foundry
- github.com/ethereum-optimism/optimism@v1.0.4 - github.com/ethereum-optimism/optimism@v1.0.4
- github.com/ethereum-optimism/op-geth@v1.101105.2 - github.com/ethereum-optimism/op-geth@v1.101105.2
- github.com/cerc-io/watcher-ts@v0.2.55 - github.com/cerc-io/watcher-ts@v0.2.56
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.1.2 - github.com/cerc-io/mobymask-v2-watcher-ts@v0.1.3
- github.com/cerc-io/MobyMask@v0.1.3 - github.com/cerc-io/MobyMask@v0.1.3
- github.com/cerc-io/mobymask-ui - github.com/cerc-io/mobymask-ui
containers: containers:
+3
View File
@@ -45,6 +45,9 @@ Create and update an env file to be used in the next step ([defaults](../../conf
# L2 Chain ID used by mobymask web-app for L2 txs # L2 Chain ID used by mobymask web-app for L2 txs
CERC_CHAIN_ID=42069 CERC_CHAIN_ID=42069
# (Optional) Type of pubsub to be used ("floodsub" | "gossipsub")
CERC_PUBSUB=""
``` ```
* NOTE: If watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port * NOTE: If watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2023 Cerc # Copyright © 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+4 -3
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@@ -238,8 +238,9 @@ def init(ctx, output, map_ports_to_host):
@click.option("--deployment-dir", help="Create deployment files in this directory") @click.option("--deployment-dir", help="Create deployment files in this directory")
# TODO: Hack # TODO: Hack
@click.option("--network-dir", help="Network configuration supplied in this directory") @click.option("--network-dir", help="Network configuration supplied in this directory")
@click.option("--initial-peers", help="Initial set of persistent peers")
@click.pass_context @click.pass_context
def create(ctx, spec_file, deployment_dir, network_dir): def create(ctx, spec_file, deployment_dir, network_dir, initial_peers):
# This function fails with a useful error message if the file doens't exist # This function fails with a useful error message if the file doens't exist
parsed_spec = get_parsed_deployment_spec(spec_file) parsed_spec = get_parsed_deployment_spec(spec_file)
stack_name = parsed_spec['stack'] stack_name = parsed_spec['stack']
@@ -287,7 +288,7 @@ def create(ctx, spec_file, deployment_dir, network_dir):
deployment_command_context = ctx.obj deployment_command_context = ctx.obj
deployment_command_context.stack = stack_name deployment_command_context.stack = stack_name
deployment_context = DeploymentContext(Path(deployment_dir), deployment_command_context) deployment_context = DeploymentContext(Path(deployment_dir), deployment_command_context)
call_stack_deploy_create(deployment_context, network_dir) call_stack_deploy_create(deployment_context, [network_dir, initial_peers])
# TODO: this code should be in the stack .py files but # TODO: this code should be in the stack .py files but
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2023 Cerc # Copyright © 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2023 Cerc # Copyright © 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright © 2022 Cerc # Copyright © 2022, 2023 Vulcanize
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by