forked from 0xPolygon/kurtosis-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
agglayer.star
78 lines (72 loc) · 2.83 KB
/
agglayer.star
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
service_package = import_module("./lib/service.star")
databases = import_module("./databases.star")
def run(plan, args):
contract_setup_addresses = service_package.get_contract_setup_addresses(plan, args)
db_configs = databases.get_db_configs(
args["deployment_suffix"], args["sequencer_type"]
)
agglayer_config_artifact = create_agglayer_config_artifact(
plan, args, contract_setup_addresses, db_configs
)
agglayer_keystore_artifact = plan.store_service_files(
name="agglayer-keystore",
service_name="contracts" + args["deployment_suffix"],
src="/opt/zkevm/agglayer.keystore",
)
plan.add_service(
name="agglayer",
config=ServiceConfig(
image=args["agglayer_image"],
ports={
"agglayer": PortSpec(
args["agglayer_port"], application_protocol="http"
),
"prometheus": PortSpec(
args["prometheus_port"], application_protocol="http"
),
},
files={
"/etc/zkevm": Directory(
artifact_names=[
agglayer_config_artifact,
agglayer_keystore_artifact,
]
),
},
entrypoint=[
"/usr/local/bin/agglayer",
],
cmd=["run", "--cfg", "/etc/zkevm/agglayer-config.toml"],
),
)
def create_agglayer_config_artifact(plan, args, contract_setup_addresses, db_configs):
agglayer_config_template = read_file(
src="./templates/bridge-infra/agglayer-config.toml"
)
return plan.render_templates(
name="agglayer-config-artifact",
config={
"agglayer-config.toml": struct(
template=agglayer_config_template,
# TODO: Organize those args.
data={
"deployment_suffix": args["deployment_suffix"],
"global_log_level": args["global_log_level"],
"l1_chain_id": args["l1_chain_id"],
"l1_rpc_url": args["l1_rpc_url"],
"zkevm_l2_keystore_password": args["zkevm_l2_keystore_password"],
"zkevm_l2_proofsigner_address": args[
"zkevm_l2_proofsigner_address"
],
"zkevm_l2_sequencer_address": args["zkevm_l2_sequencer_address"],
# ports
"zkevm_rpc_http_port": args["zkevm_rpc_http_port"],
"agglayer_port": args["agglayer_port"],
"prometheus_port": args["prometheus_port"],
"l2_rpc_name": args["l2_rpc_name"],
}
| contract_setup_addresses
| db_configs,
)
},
)