Skip to content

Commit 777ec06

Browse files
zt-9barnabasbusa
andauthored
feat: Add-blockscout_params (ethereum#838)
fix ethereum#837 the default blockscout image version does not work on my machine. so i added the blockscout_params for blockscout service. now user can customize the image versions they want to use. it contains two params: ```yaml blockscout_params: # blockscout docker image to use # Defaults to the latest image 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" ``` i already tested it on my machine and it worke well. --------- Co-authored-by: Barnabas Busa <[email protected]> Co-authored-by: Barnabas Busa <[email protected]>
1 parent 3ba9e51 commit 777ec06

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,15 @@ additional_services:
634634
- apache
635635
- tracoor
636636

637+
# Configuration place for blockscout explorer - https://github.com/blockscout/blockscout
638+
blockscout_params:
639+
# blockscout docker image to use
640+
# Defaults to blockscout/blockscout:6.8.0
641+
image: "blockscout/blockscout:6.8.0"
642+
# blockscout smart contract verifier image to use
643+
# Defaults to ghcr.io/blockscout/smart-contract-verifier:v1.9.0
644+
verif_image: "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"
645+
637646
# Configuration place for dora the explorer - https://github.com/ethpandaops/dora
638647
dora_params:
639648
# Dora docker image to use

main.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ def run(plan, args={}):
508508
plan.print("Successfully launched beacon metrics gazer")
509509
elif additional_service == "blockscout":
510510
plan.print("Launching blockscout")
511+
blockscout_params = args_with_right_defaults.blockscout_params
511512
blockscout_sc_verif_url = blockscout.launch_blockscout(
512513
plan,
513514
all_el_contexts,
@@ -516,6 +517,7 @@ def run(plan, args={}):
516517
args_with_right_defaults.port_publisher,
517518
index,
518519
args_with_right_defaults.docker_cache_params,
520+
blockscout_params,
519521
)
520522
plan.print("Successfully launched blockscout")
521523
elif additional_service == "dora":

src/blockscout/blockscout_launcher.star

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ shared_utils = import_module("../shared_utils/shared_utils.star")
22
constants = import_module("../package_io/constants.star")
33
postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
44

5-
IMAGE_NAME_BLOCKSCOUT = "blockscout/blockscout:6.8.0"
6-
IMAGE_NAME_BLOCKSCOUT_VERIF = "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"
75
POSTGRES_IMAGE = "library/postgres:alpine"
86

97
SERVICE_NAME_BLOCKSCOUT = "blockscout"
@@ -46,6 +44,7 @@ def launch_blockscout(
4644
port_publisher,
4745
additional_service_index,
4846
docker_cache_params,
47+
blockscout_params,
4948
):
5049
postgres_output = postgres.run(
5150
plan,
@@ -68,6 +67,7 @@ def launch_blockscout(
6867
port_publisher,
6968
additional_service_index,
7069
docker_cache_params,
70+
blockscout_params,
7171
)
7272
verif_service_name = "{}-verif".format(SERVICE_NAME_BLOCKSCOUT)
7373
verif_service = plan.add_service(verif_service_name, config_verif)
@@ -84,6 +84,7 @@ def launch_blockscout(
8484
port_publisher,
8585
additional_service_index,
8686
docker_cache_params,
87+
blockscout_params,
8788
)
8889
blockscout_service = plan.add_service(SERVICE_NAME_BLOCKSCOUT, config_backend)
8990
plan.print(blockscout_service)
@@ -96,7 +97,11 @@ def launch_blockscout(
9697

9798

9899
def get_config_verif(
99-
node_selectors, port_publisher, additional_service_index, docker_cache_params
100+
node_selectors,
101+
port_publisher,
102+
additional_service_index,
103+
docker_cache_params,
104+
blockscout_params,
100105
):
101106
public_ports = shared_utils.get_additional_service_standard_public_port(
102107
port_publisher,
@@ -105,6 +110,7 @@ def get_config_verif(
105110
0,
106111
)
107112

113+
IMAGE_NAME_BLOCKSCOUT_VERIF = blockscout_params.verif_image
108114
return ServiceConfig(
109115
image=shared_utils.docker_cache_image_calc(
110116
docker_cache_params,
@@ -134,6 +140,7 @@ def get_config_backend(
134140
port_publisher,
135141
additional_service_index,
136142
docker_cache_params,
143+
blockscout_params,
137144
):
138145
database_url = "{protocol}://{user}:{password}@{hostname}:{port}/{database}".format(
139146
protocol="postgresql",
@@ -151,6 +158,8 @@ def get_config_backend(
151158
1,
152159
)
153160

161+
IMAGE_NAME_BLOCKSCOUT = blockscout_params.image
162+
154163
return ServiceConfig(
155164
image=shared_utils.docker_cache_image_calc(
156165
docker_cache_params,

src/package_io/input_parser.star

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
7575
"network_params",
7676
"participants",
7777
"mev_params",
78+
"blockscout_params",
7879
"dora_params",
7980
"docker_cache_params",
8081
"assertoor_params",
@@ -92,6 +93,7 @@ def input_parser(plan, input_args):
9293
sanity_check.sanity_check(plan, input_args)
9394
result = parse_network_params(plan, input_args)
9495
# add default eth2 input params
96+
result["blockscout_params"] = get_default_blockscout_params()
9597
result["dora_params"] = get_default_dora_params()
9698
result["docker_cache_params"] = get_default_docker_cache_params()
9799
result["mev_params"] = get_default_mev_params(
@@ -136,6 +138,10 @@ def input_parser(plan, input_args):
136138
if attr not in ATTR_TO_BE_SKIPPED_AT_ROOT and attr in input_args:
137139
result[attr] = value
138140
# custom eth2 attributes config
141+
elif attr == "blockscout_params":
142+
for sub_attr in input_args["blockscout_params"]:
143+
sub_value = input_args["blockscout_params"][sub_attr]
144+
result["blockscout_params"][sub_attr] = sub_value
139145
elif attr == "dora_params":
140146
for sub_attr in input_args["dora_params"]:
141147
sub_value = input_args["dora_params"][sub_attr]
@@ -355,6 +361,10 @@ def input_parser(plan, input_args):
355361
)
356362
if result["mev_params"]
357363
else None,
364+
blockscout_params=struct(
365+
image=result["blockscout_params"]["image"],
366+
verif_image=result["blockscout_params"]["verif_image"],
367+
),
358368
dora_params=struct(
359369
image=result["dora_params"]["image"],
360370
env=result["dora_params"]["env"],
@@ -999,6 +1009,13 @@ def default_participant():
9991009
}
10001010

10011011

1012+
def get_default_blockscout_params():
1013+
return {
1014+
"image": "blockscout/blockscout:6.8.0",
1015+
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:v1.9.0",
1016+
}
1017+
1018+
10021019
def get_default_dora_params():
10031020
return {
10041021
"image": "ethpandaops/dora:latest",

src/package_io/sanity_check.star

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ SUBCATEGORY_PARAMS = {
171171
"devnet_repo",
172172
"prefunded_accounts",
173173
],
174+
"blockscout_params": [
175+
"image",
176+
"verif_image",
177+
],
174178
"dora_params": [
175179
"image",
176180
"env",

0 commit comments

Comments
 (0)