Skip to content

Commit

Permalink
Merge branch 'master' into merge-q4-working-branch-to-master
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron-zilliqa committed Sep 15, 2023
2 parents e158b26 + 27f31d0 commit 4fb808a
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 56 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Expand Up @@ -14,7 +14,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

ARG SCILLA_VERSION=v0.13.5
ARG SCILLA_VERSION=v0.13.4
ARG SCILLA_IMAGE=zilliqa/scilla:${SCILLA_VERSION}

# Common dependencies of the builder and runner stages.
Expand Down
41 changes: 29 additions & 12 deletions scripts/localdev.py
Expand Up @@ -41,6 +41,12 @@
TESTNET_DIR = os.path.join(ZILLIQA_DIR, "..", "testnet")
KEEP_WORKSPACE = True

def get_progress_arg():
if "NO_COLOR" in os.environ:
return "--progress=plain"
else:
return "--progress=auto"

def is_osx():
return sys.platform == "darwin"

Expand Down Expand Up @@ -503,7 +509,9 @@ def tempo_down(config):
help="Use isolated_server_accounts.json to create accounts when zilliqa is up")
@click.option("--persistence", help="A persistence directory to start the network with. Has no effect without also passing `--key-file`.")
@click.option("--key-file", help="A `.tar.gz` generated by `./testnet.sh back-up auto` containing the keys used to start this network. Has no effect without also passing `--persistence`.")
def up_cmd(ctx, driver, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file):
@click.option("--monitoring", help="Start monitoring - when set to false, skips grafana, prometheus, and tempo", default=True,show_default=True)
@click.option("--chain-id", help="Set the chain id", default=None)
def up_cmd(ctx, driver, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file, monitoring, chain_id):
"""
Build Zilliqa (via a process equivalent to the build-zilliqa & build-scilla commands), write configuration files for a
testnet named localdev, run `localdev/config.sh up`, and start a proxy to allow the user to monitor traffic
Expand All @@ -515,30 +523,33 @@ def up_cmd(ctx, driver, zilliqa_image, testnet_name, isolated_server_accounts, p
else:
adjust_config(config, driver)

up(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file)
up(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file, monitoring, chain_id = chain_id)

def up(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file):
def up(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file, monitoring, chain_id = None):
minikube = get_minikube_ip(config)
write_testnet_configuration(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file)
write_testnet_configuration(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file, chain_id)
localstack_up(config)
grafana_up(config, testnet_name)
if monitoring:
grafana_up(config, testnet_name)
start_testnet(config, testnet_name, persistence)
prometheus_up(config, testnet_name)
tempo_up(config, testnet_name)
if monitoring:
prometheus_up(config, testnet_name)
tempo_up(config, testnet_name)
restart_ingress(config);
print("Ingress restarted; you should be ready to go...");

@click.command("isolated")
@click.option("--enable-evm", is_flag = True, help="Disable the EVM so you can start it yourself - instructions will appear in the log")
@click.option("--disable-evm", is_flag = True, help="Disable the EVM so you can start it yourself - instructions will appear in the log")
@click.option("--block-time-ms", help="Block time in ms", default=10000)
@click.option("--chain-id", help="Set the chain id", default = None)
@click.pass_context
def isolated_cmd(ctx, enable_evm, disable_evm, block_time_ms):
"""
Run an isolated server
"""
config = get_config(ctx)
isolated(config, enable_evm = enable_evm or not disable_evm, block_time_ms = block_time_ms)
isolated(config, enable_evm = enable_evm or not disable_evm, block_time_ms = block_time_ms, chain_id = chain_id)

def xml_get_element(doc, parent, name):
elems = parent.getElementsByTagName(name)
Expand All @@ -563,7 +574,7 @@ def copy_everything_in_dir(src, dest):
if os.path.isfile(full_src):
shutil.copy(full_src, os.path.join(dest, f))

def isolated(config, enable_evm = True, block_time_ms = None):
def isolated(config, enable_evm = True, block_time_ms = None, chain_id = None):
build_native_to_workspace(config)
#workspace = os.path.join(ZILLIQA_DIR, "_localdev", "isolated")
config_file = xml.dom.minidom.parse(os.path.join(ZILLIQA_DIR, "constants.xml"))
Expand All @@ -578,6 +589,8 @@ def isolated(config, enable_evm = True, block_time_ms = None):
xml_replace_element(config_file, config_file.documentElement, "EVM_SERVER_BINARY", "evm-ds/evm-ds")
xml_replace_element(config_file, config_file.documentElement, "EVM_LOG_CONFIG", "evm-ds/log4rs-local.yml")
xml_replace_element(config_file, config_file.documentElement, "EVM_SERVER_SOCKET_PATH", "/tmp/evm-server.sock")
if chain_id is not None:
xml_replace_element(config_file, config_file.documentElement, "CHAIN_ID", chain_id)
# Now assemble an isolated server release.
target_workspace = os.path.join(ZILLIQA_DIR, "_localdev", "isolated")
src_workspace = os.path.join(ZILLIQA_DIR, "_localdev")
Expand Down Expand Up @@ -707,7 +720,7 @@ def stop_testnet(config, testnet_name):
# tediously, testnet.sh has a habit of returning non-zero error codes when eg. the testnet has already been destroyed :-(
run_or_die(config, ["sh", "-c", "echo localdev | ./testnet.sh down"], in_dir=os.path.join(TESTNET_DIR, testnet_name), allow_failure = True)

def write_testnet_configuration(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file):
def write_testnet_configuration(config, zilliqa_image, testnet_name, isolated_server_accounts, persistence, key_file, chain_id = None):
instance_dir = os.path.join(TESTNET_DIR, testnet_name)
minikube_ip = get_minikube_ip(config)

Expand Down Expand Up @@ -750,6 +763,8 @@ def write_testnet_configuration(config, zilliqa_image, testnet_name, isolated_se
xml_replace_element(config_file, config_file.documentElement, "TRACE_ZILLIQA_PORT", "4317")
xml_replace_element(config_file, config_file.documentElement, "TRACE_ZILLIQA_PROVIDER", "OTLPGRPC")
xml_replace_element(config_file, config_file.documentElement, "TRACE_ZILLIQA_MASK", "ALL")
if chain_id is not None:
xml_replace_element(config_file, config_file.documentElement, "CHAIN_ID", chain_id)
output_config = config_file.toprettyxml(newl='')
with open(constants_xml_target_path, 'w') as f:
f.write(output_config)
Expand Down Expand Up @@ -972,7 +987,8 @@ def build_scilla(config, driver, tag):
build_env["DOCKER_BUILDKIT"] = "1"

image_name = "scilla:" + (tag if tag else gen_tag())
run_or_die(config, [config.docker_binary, "build", ".", "-t", image_name, "-f", os.path.join(SCILLA_DIR, "docker", "Dockerfile")], in_dir = SCILLA_DIR, env = build_env,
progress_arg = get_progress_arg()
run_or_die(config, [config.docker_binary, "build", progress_arg, ".", "-t", image_name, "-f", os.path.join(SCILLA_DIR, "docker", "Dockerfile")], in_dir = SCILLA_DIR, env = build_env,
capture_output = False)
return image_name

Expand Down Expand Up @@ -1066,7 +1082,8 @@ def build_zilliqa(config, driver, scilla_image, tag):
build_env["DOCKER_BUILDKIT"] = "1"

image_name = "zilliqa:" + (tag if tag else gen_tag())
run_or_die(config, [config.docker_binary, "build", ".", "--build-arg", f"SCILLA_IMAGE={scilla_image}", "-t", image_name, "-f", os.path.join(ZILLIQA_DIR, "docker", "Dockerfile")], in_dir = ZILLIQA_DIR, env = build_env,
progress_arg = get_progress_arg();
run_or_die(config, [config.docker_binary, "build", progress_arg, ".", "--build-arg", f"SCILLA_IMAGE={scilla_image}", "-t", image_name, "-f", os.path.join(ZILLIQA_DIR, "docker", "Dockerfile")], in_dir = ZILLIQA_DIR, env = build_env,
capture_output = False)
return image_name

Expand Down
7 changes: 3 additions & 4 deletions vcpkg-registry/ports/cryptoutils/vcpkg.json
@@ -1,7 +1,7 @@
{
"name": "cryptoutils",
"version": "9.3",
"port-version": 0,
"version": "8.3.0",
"port-version": 1,
"description": "CryptoUtils",
"homepage": "https://github.com/Zilliqa/cryptoutils",
"dependencies": [
Expand All @@ -12,8 +12,7 @@
{
"name": "vcpkg-cmake-config",
"host": true
},
"openssl"
}
]
}

17 changes: 0 additions & 17 deletions vcpkg-registry/ports/schnorr/fix-compiler-flags.patch

This file was deleted.

21 changes: 12 additions & 9 deletions vcpkg-registry/ports/schnorr/portfile.cmake
Expand Up @@ -4,17 +4,20 @@ vcpkg_from_github(
REF c54f4cadc88234d58bfdf83a4d7348444ea7845d #v8.2.0
SHA512 7f445c407fd1049ab41ad580b91263698af405b6015ec4a33715a40e488459afb5f2a8f06e6db9759b18b4f9ba443e2da746408821931ccd31e4caf4101048a7
HEAD_REF master
PATCHES
fix-compiler-flags.patch
)

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DCMAKE_CXX_STANDARD=20
-DCMAKE_CXX_FLAGS="-Wall -Werror -Wextra -Wno-dev -Wno-deprecated-declarations"
-DCMAKE_C_FLAGS="-Wall -Werror -Wextra -Wno-dev -Wno-deprecated-declarations"
)
if (UNIX AND NOT APPLE)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DCMAKE_CXX_FLAGS=-Wno-dev
-DCMAKE_C_FLAGS=-Wno-dev
)
else()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
)
endif()

vcpkg_cmake_install()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
Expand Down
8 changes: 2 additions & 6 deletions vcpkg-registry/ports/schnorr/vcpkg.json
@@ -1,6 +1,6 @@
{
"name": "schnorr",
"version": "9.3",
"version": "8.2.0",
"port-version": 0,
"description": "Schnorr",
"homepage": "https://github.com/Zilliqa/schnorr",
Expand All @@ -12,10 +12,6 @@
{
"name": "vcpkg-cmake-config",
"host": true
},
"boost-algorithm",
"boost-functional",
"boost-test",
"openssl"
}
]
}
4 changes: 2 additions & 2 deletions vcpkg-registry/versions/baseline.json
Expand Up @@ -2,8 +2,8 @@
"default": {
"g3log": { "baseline": "1.3.4", "port-version": 6 },
"g3sinks": { "baseline": "2.0.1", "port-version": 0 },
"schnorr": { "baseline": "9.3", "port-version": 0 },
"cryptoutils": { "baseline": "9.3", "port-version": 0 },
"schnorr": { "baseline": "8.2.0", "port-version": 0 },
"cryptoutils": { "baseline": "8.3.0", "port-version": 1 },
"libmicrohttpd": { "baseline": "0.9.63", "port-version": 8 },
"opentelemetry-cpp": { "baseline": "1.9.0", "port-version": 1 }
}
Expand Down
4 changes: 2 additions & 2 deletions vcpkg-registry/versions/c-/cryptoutils.json
Expand Up @@ -2,8 +2,8 @@
"versions": [
{
"path": "$/ports/cryptoutils",
"version": "9.3",
"port-version": 0
"version": "8.3.0",
"port-version": 1
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion vcpkg-registry/versions/s-/schnorr.json
Expand Up @@ -2,7 +2,7 @@
"versions": [
{
"path": "$/ports/schnorr",
"version": "9.3",
"version": "8.2.0",
"port-version": 0
}
]
Expand Down
8 changes: 6 additions & 2 deletions vcpkg.json
Expand Up @@ -50,21 +50,25 @@
"name": "jsoncpp",
"version-string": "1.8.1-1"
},
{
"name": "openssl",
"version-string": "1.1.1n"
},
{
"name": "g3log",
"version-string": "1.3.4#6"
},
{
"name": "schnorr",
"version": "9.3"
"version": "8.2.0"
},
{
"name": "g3sinks",
"version": "2.0.1"
},
{
"name": "cryptoutils",
"version": "9.3"
"version": "8.3.0#1"
},
{
"name": "opentelemetry-cpp",
Expand Down

0 comments on commit 4fb808a

Please sign in to comment.