-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add light-beaconchain-explorer (#125)
Changelog picked up from commits here: feat: add light-beaconchain-explorer
- Loading branch information
1 parent
1cb1a92
commit 83e01a1
Showing
5 changed files
with
157 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") | ||
|
||
|
||
SERVICE_NAME = "light-beaconchain" | ||
IMAGE_NAME = "pk910/light-beaconchain-explorer:latest" | ||
|
||
HTTP_PORT_ID = "http" | ||
HTTP_PORT_NUMBER = 8080 | ||
|
||
LIGHT_BEACONCHAIN_CONFIG_FILENAME = "light-beaconchain-config.yaml" | ||
|
||
LIGHT_BEACONCHAIN_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config" | ||
|
||
VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE = "/validator-ranges" | ||
VALIDATOR_RANGES_ARTIFACT_NAME = "validator-ranges" | ||
|
||
CL_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/cl-genesis-data" | ||
CL_CONFIG_ARTIFACT_NAME = "cl-genesis-data" | ||
|
||
|
||
USED_PORTS = { | ||
HTTP_PORT_ID:shared_utils.new_port_spec(HTTP_PORT_NUMBER, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL) | ||
} | ||
|
||
|
||
def launch_light_beacon( | ||
plan, | ||
config_template, | ||
cl_client_contexts, | ||
): | ||
|
||
cl_client_info = [] | ||
cl_client_info.append(new_cl_client_info(cl_client_contexts[0].ip_addr, cl_client_contexts[0].http_port_num, cl_client_contexts[0].beacon_service_name)) | ||
|
||
template_data = new_config_template_data(HTTP_PORT_NUMBER, cl_client_info) | ||
|
||
template_and_data = shared_utils.new_template_and_data(config_template, template_data) | ||
template_and_data_by_rel_dest_filepath = {} | ||
template_and_data_by_rel_dest_filepath[LIGHT_BEACONCHAIN_CONFIG_FILENAME] = template_and_data | ||
|
||
config_files_artifact_name = plan.render_templates(template_and_data_by_rel_dest_filepath, "light-beaconchain-config") | ||
|
||
config = get_config(config_files_artifact_name) | ||
|
||
plan.add_service(SERVICE_NAME, config) | ||
|
||
def get_config(config_files_artifact_name): | ||
config_file_path = shared_utils.path_join(LIGHT_BEACONCHAIN_CONFIG_MOUNT_DIRPATH_ON_SERVICE, LIGHT_BEACONCHAIN_CONFIG_FILENAME) | ||
return ServiceConfig( | ||
image = IMAGE_NAME, | ||
ports = USED_PORTS, | ||
files = { | ||
LIGHT_BEACONCHAIN_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name, | ||
VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE: VALIDATOR_RANGES_ARTIFACT_NAME, | ||
CL_CONFIG_MOUNT_DIRPATH_ON_SERVICE: CL_CONFIG_ARTIFACT_NAME | ||
|
||
}, | ||
cmd = [ | ||
"-config", | ||
config_file_path | ||
] | ||
) | ||
|
||
|
||
def new_config_template_data(listen_port_num, cl_client_info): | ||
return { | ||
"ListenPortNum": listen_port_num, | ||
"CLClientInfo": cl_client_info, | ||
} | ||
|
||
|
||
def new_cl_client_info(ip_addr, port_num, service_name): | ||
return { | ||
"IPAddr": ip_addr, | ||
"PortNum": port_num, | ||
"Name": service_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
logging: | ||
outputLevel: "info" | ||
#outputStderr: false | ||
|
||
#filePath: "explorer.log" | ||
#fileLevel: "warn" | ||
|
||
# Chain network configuration | ||
chain: | ||
name: "kurtosis-testnet" | ||
configPath: "/cl-genesis-data/output/config.yaml" | ||
displayName: "Kurtosis Testnet" | ||
|
||
# HTTP Server configuration | ||
server: | ||
host: "0.0.0.0" # Address to listen on | ||
port: "8080" # Port to listen on | ||
|
||
frontend: | ||
enabled: true # Enable or disable to web frontend | ||
debug: false | ||
minimize: false # minimize html templates | ||
|
||
# Name of the site, displayed in the title tag | ||
siteName: "Beaconchain Light" | ||
siteSubtitle: "Kurtosis Testnet" | ||
|
||
# link to EL Explorer | ||
ethExplorerLink: "" | ||
|
||
# file or inventory url to load validator names from | ||
validatorNamesYaml: "/validator-ranges/validator-ranges.yaml" | ||
|
||
beaconapi: | ||
# CL Client RPC | ||
{{ range $clClient := .CLClientInfo }} | ||
endpoint: "http://{{ $clClient.IPAddr }}:{{ $clClient.PortNum }}" | ||
{{- end }} | ||
# local cache for page models | ||
localCacheSize: 100 # 100MB | ||
|
||
# remote cache for page models | ||
redisCacheAddr: "" | ||
redisCachePrefix: "" | ||
|
||
# indexer keeps track of the latest epochs in memory. | ||
indexer: | ||
# number of epochs to load on startup | ||
prepopulateEpochs: 2 | ||
|
||
# max number of epochs to keep in memory | ||
inMemoryEpochs: 3 | ||
|
||
# epoch processing delay (should be >= 2) | ||
epochProcessingDelay: 2 | ||
|
||
# disable synchronizing and everything that writes to the db (indexer just maintains local cache) | ||
disableIndexWriter: false | ||
|
||
# number of seconds to wait between each epoch (don't overload CL client) | ||
syncEpochCooldown: 2 | ||
|
||
|
||
database: | ||
engine: "sqlite" | ||
sqlite: | ||
file: ":memory:" |