Skip to content
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

feat: update blockscout with new frontend #843

Merged
merged 14 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,11 +637,14 @@ additional_services:
# Configuration place for blockscout explorer - https://github.com/blockscout/blockscout
blockscout_params:
# blockscout docker image to use
# Defaults to blockscout/blockscout:6.8.0
image: "blockscout/blockscout:6.8.0"
# Defaults to blockscout/blockscout:latest
image: "blockscout/blockscout:latest"
# blockscout smart contract verifier image to use
# Defaults to ghcr.io/blockscout/smart-contract-verifier:v1.9.0
verif_image: "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"
# Defaults to ghcr.io/blockscout/smart-contract-verifier:latest
verif_image: "ghcr.io/blockscout/smart-contract-verifier:latest"
# Frontend image
# Defaults to ghcr.io/blockscout/frontend:latest
frontend_image: "ghcr.io/blockscout/frontend:latest"

# Configuration place for dora the explorer - https://github.com/ethpandaops/dora
dora_params:
Expand Down
4 changes: 2 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ def run(plan, args={}):
plan.print("Successfully launched beacon metrics gazer")
elif additional_service == "blockscout":
plan.print("Launching blockscout")
blockscout_params = args_with_right_defaults.blockscout_params
blockscout_sc_verif_url = blockscout.launch_blockscout(
plan,
all_el_contexts,
Expand All @@ -517,7 +516,8 @@ def run(plan, args={}):
args_with_right_defaults.port_publisher,
index,
args_with_right_defaults.docker_cache_params,
blockscout_params,
args_with_right_defaults.blockscout_params,
network_params,
)
plan.print("Successfully launched blockscout")
elif additional_service == "dora":
Expand Down
71 changes: 64 additions & 7 deletions src/blockscout/blockscout_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
POSTGRES_IMAGE = "library/postgres:alpine"

SERVICE_NAME_BLOCKSCOUT = "blockscout"

SERVICE_NAME_FRONTEND = "blockscout-frontend"
HTTP_PORT_NUMBER = 4000
HTTP_PORT_NUMBER_VERIF = 8050

HTTP_PORT_NUMBER_FRONTEND = 3000
BLOCKSCOUT_MIN_CPU = 100
BLOCKSCOUT_MAX_CPU = 1000
BLOCKSCOUT_MIN_MEMORY = 1024
Expand All @@ -35,6 +35,14 @@ VERIF_USED_PORTS = {
)
}

FRONTEND_USED_PORTS = {
constants.HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER_FRONTEND,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
)
}


def launch_blockscout(
plan,
Expand All @@ -45,6 +53,7 @@ def launch_blockscout(
additional_service_index,
docker_cache_params,
blockscout_params,
network_params,
):
postgres_output = postgres.run(
plan,
Expand Down Expand Up @@ -93,6 +102,16 @@ def launch_blockscout(
blockscout_service.hostname, blockscout_service.ports["http"].number
)

config_frontend = get_config_frontend(
plan,
el_client_rpc_url,
docker_cache_params,
blockscout_params,
network_params,
global_node_selectors,
blockscout_service,
)
plan.add_service(SERVICE_NAME_FRONTEND, config_frontend)
return blockscout_url


Expand All @@ -110,11 +129,10 @@ def get_config_verif(
0,
)

IMAGE_NAME_BLOCKSCOUT_VERIF = blockscout_params.verif_image
return ServiceConfig(
image=shared_utils.docker_cache_image_calc(
docker_cache_params,
IMAGE_NAME_BLOCKSCOUT_VERIF,
blockscout_params.verif_image,
),
ports=VERIF_USED_PORTS,
public_ports=public_ports,
Expand Down Expand Up @@ -158,12 +176,10 @@ def get_config_backend(
1,
)

IMAGE_NAME_BLOCKSCOUT = blockscout_params.image

return ServiceConfig(
image=shared_utils.docker_cache_image_calc(
docker_cache_params,
IMAGE_NAME_BLOCKSCOUT,
blockscout_params.image,
),
ports=USED_PORTS,
public_ports=public_ports,
Expand Down Expand Up @@ -197,3 +213,44 @@ def get_config_backend(
max_memory=BLOCKSCOUT_MAX_MEMORY,
node_selectors=node_selectors,
)


def get_config_frontend(
plan,
el_client_rpc_url,
docker_cache_params,
blockscout_params,
network_params,
node_selectors,
blockscout_service,
):
return ServiceConfig(
image=shared_utils.docker_cache_image_calc(
docker_cache_params,
blockscout_params.frontend_image,
),
ports=FRONTEND_USED_PORTS,
env_vars={
"NEXT_PUBLIC_API_PROTOCOL": "http",
"NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL": "ws",
"NEXT_PUBLIC_NETWORK_NAME": "Kurtosis",
"NEXT_PUBLIC_NETWORK_ID": network_params.network_id,
"NEXT_PUBLIC_NETWORK_RPC_URL": el_client_rpc_url,
"NEXT_PUBLIC_APP_HOST": "0.0.0.0",
"NEXT_PUBLIC_API_HOST": blockscout_service.ip_address
+ ":"
+ str(blockscout_service.ports["http"].number),
"NEXT_PUBLIC_AD_BANNER_PROVIDER": "none",
"NEXT_PUBLIC_AD_TEXT_PROVIDER": "none",
"NEXT_PUBLIC_IS_TESTNET": "true",
"NEXT_PUBLIC_GAS_TRACKER_ENABLED": "true",
"NEXT_PUBLIC_HAS_BEACON_CHAIN": "true",
"NEXT_PUBLIC_NETWORK_VERIFICATION_TYPE": "validation",
"NEXT_PUBLIC_NETWORK_ICON": "https://ethpandaops.io/logo.png",
},
min_cpu=BLOCKSCOUT_MIN_CPU,
max_cpu=BLOCKSCOUT_MAX_CPU,
min_memory=BLOCKSCOUT_MIN_MEMORY,
max_memory=BLOCKSCOUT_MAX_MEMORY,
node_selectors=node_selectors,
)
93 changes: 42 additions & 51 deletions src/el/reth/reth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -141,40 +141,42 @@ def get_config(

used_ports = shared_utils.get_port_specs(used_port_assignments)

cmd = [
"{0}".format(
"/usr/local/bin/mev" if launcher.builder_type == "mev-rs" else "reth"
),
"node",
"-{0}".format(log_level),
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--chain={0}".format(
launcher.network
if launcher.network in constants.PUBLIC_NETWORKS
else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json"
),
"--http",
"--http.port={0}".format(RPC_PORT_NUM),
"--http.addr=0.0.0.0",
"--http.corsdomain=*",
# WARNING: The admin info endpoint is enabled so that we can easily get ENR/enode, which means
# that users should NOT store private information in these Kurtosis nodes!
"--http.api=admin,net,eth,web3,debug,txpool,trace{0}".format(
",flashbots" if launcher.builder_type == "flashbots" else ""
),
"--ws",
"--ws.addr=0.0.0.0",
"--ws.port={0}".format(WS_PORT_NUM),
"--ws.api=net,eth",
"--ws.origins=*",
"--nat=extip:" + port_publisher.nat_exit_ip,
"--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM),
"--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER,
"--authrpc.addr=0.0.0.0",
"--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM),
"--discovery.port={0}".format(discovery_port),
"--port={0}".format(discovery_port),
]
cmd = []

if launcher.builder_type == "mev-rs":
cmd.append("build")

cmd.extend(
[
"node",
"-{0}".format(log_level),
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--chain={0}".format(
launcher.network
if launcher.network in constants.PUBLIC_NETWORKS
else constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json"
),
"--http",
"--http.port={0}".format(RPC_PORT_NUM),
"--http.addr=0.0.0.0",
"--http.corsdomain=*",
"--http.api=admin,net,eth,web3,debug,txpool,trace{0}".format(
",flashbots" if launcher.builder_type == "flashbots" else ""
),
"--ws",
"--ws.addr=0.0.0.0",
"--ws.port={0}".format(WS_PORT_NUM),
"--ws.api=net,eth",
"--ws.origins=*",
"--nat=extip:" + port_publisher.nat_exit_ip,
"--authrpc.port={0}".format(ENGINE_RPC_PORT_NUM),
"--authrpc.jwtsecret=" + constants.JWT_MOUNT_PATH_ON_CONTAINER,
"--authrpc.addr=0.0.0.0",
"--metrics=0.0.0.0:{0}".format(METRICS_PORT_NUM),
"--discovery.port={0}".format(discovery_port),
"--port={0}".format(discovery_port),
]
)

if launcher.network == constants.NETWORK_NAME.kurtosis:
if len(existing_el_clients) > 0:
Expand Down Expand Up @@ -216,29 +218,22 @@ def get_config(
constants.EL_TYPE.reth + "_volume_size"
],
)
cmd_str = " ".join(cmd)
env_vars = {
"RETH_CMD": cmd_str,
}
entrypoint_args = ["sh", "-c"]
env_vars = env_vars | participant.el_extra_env_vars
env_vars = {}
image = participant.el_image
rbuilder_cmd = []
if launcher.builder_type == "mev-rs":
files[
mev_rs_builder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE
] = mev_rs_builder.MEV_BUILDER_FILES_ARTIFACT_NAME
elif launcher.builder_type == "flashbots":
image = constants.DEFAULT_FLASHBOTS_BUILDER_IMAGE
cl_client_name = service_name.split("-")[4]
cmd.append("--engine.legacy")
cmd_str = " ".join(cmd)
cmd.append("--engine.experimental")
cmd.append("--rbuilder.config=" + flashbots_rbuilder.MEV_FILE_PATH_ON_CONTAINER)
files[
flashbots_rbuilder.MEV_BUILDER_MOUNT_DIRPATH_ON_SERVICE
] = flashbots_rbuilder.MEV_BUILDER_FILES_ARTIFACT_NAME
env_vars["RETH_CMD"] = cmd_str
env_vars.update(
{
"RBUILDER_CONFIG": flashbots_rbuilder.MEV_FILE_PATH_ON_CONTAINER,
"CL_ENDPOINT": "http://cl-{0}-{1}-{2}:{3}".format(
participant_index + 1,
cl_client_name,
Expand All @@ -247,19 +242,15 @@ def get_config(
),
}
)
image = constants.DEFAULT_FLASHBOTS_BUILDER_IMAGE
cmd_str = "./app/entrypoint.sh"
entrypoint_args = []

config_args = {
"image": image,
"ports": used_ports,
"public_ports": public_ports,
"cmd": [cmd_str],
"cmd": cmd,
"files": files,
"entrypoint": entrypoint_args,
"private_ip_address_placeholder": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"env_vars": env_vars,
"env_vars": env_vars | participant.el_extra_env_vars,
"labels": shared_utils.label_maker(
client=constants.EL_TYPE.reth,
client_type=constants.CLIENT_TYPES.el,
Expand Down
2 changes: 1 addition & 1 deletion src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ COMMIT_BOOST_MEV_TYPE = "commit-boost"

DEFAULT_SNOOPER_IMAGE = "ethpandaops/rpc-snooper:latest"
DEFAULT_FLASHBOTS_RELAY_IMAGE = "flashbots/mev-boost-relay:0.29.2a3"
DEFAULT_FLASHBOTS_BUILDER_IMAGE = "ethpandaops/rbuilder:develop"
DEFAULT_FLASHBOTS_BUILDER_IMAGE = "ethpandaops/reth-rbuilder:develop"
DEFAULT_FLASHBOTS_MEV_BOOST_IMAGE = "flashbots/mev-boost"
DEFAULT_MEV_RS_IMAGE = "ethpandaops/mev-rs:main"
DEFAULT_MEV_RS_IMAGE_MINIMAL = "ethpandaops/mev-rs:main-minimal"
Expand Down
8 changes: 5 additions & 3 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ def input_parser(plan, input_args):
blockscout_params=struct(
image=result["blockscout_params"]["image"],
verif_image=result["blockscout_params"]["verif_image"],
frontend_image=result["blockscout_params"]["frontend_image"],
),
dora_params=struct(
image=result["dora_params"]["image"],
Expand Down Expand Up @@ -1011,8 +1012,9 @@ def default_participant():

def get_default_blockscout_params():
return {
"image": "blockscout/blockscout:6.8.0",
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:v1.9.0",
"image": "blockscout/blockscout:latest",
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:latest",
"frontend_image": "ghcr.io/blockscout/frontend:latest",
}


Expand Down Expand Up @@ -1303,7 +1305,7 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ

if mev_type == constants.MEV_RS_MEV_TYPE:
mev_participant = default_participant()
mev_participant["el_type"] = constants.EL_TYPE.reth
mev_participant["el_type"] = "reth-builder"
mev_participant.update(
{
"el_image": parsed_arguments_dict["mev_params"]["mev_builder_image"],
Expand Down
1 change: 1 addition & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ SUBCATEGORY_PARAMS = {
"blockscout_params": [
"image",
"verif_image",
"frontend_image",
],
"dora_params": [
"image",
Expand Down
Loading