Commit 3d01b50b authored by luxq's avatar luxq

add bunnyfinder service.

parent 485ac616
......@@ -706,6 +706,8 @@ def run(plan, args={}):
bunnyfinder.launch_bunnyfinder(
plan,
bunnyfinder_config_template,
all_participants,
args_with_right_defaults.participants,
network_params,
bunnyfinder_params,
global_node_selectors,
......
......@@ -5,8 +5,6 @@ SERVICE_NAME = "bunnyfinder"
HTTP_PORT_ID = "http"
HTTP_PORT_NUMBER = 19000
SWAG_PORT_ID = "http"
SWAG_PORT_NUMBER = 19001
BUNNYFINDER_CONFIG_FILENAME = "bunnyfinder-config.yaml"
......@@ -27,22 +25,45 @@ USED_PORTS = {
)
}
def launch_bunnyfinder(
plan,
config_template,
participant_contexts,
participant_configs,
network_params,
bunnyfinder_params,
global_node_selectors,
):
# check bunnyfinder_params.dbconnect is set an valid value
if bunnyfinder_params.dbconnect is None or bunnyfinder_params.dbconnect == "":
fail(
"dbconnect is required in bunnyfinder_params"
)
participant = participant_contexts[0]
(
full_name,
cl_client,
el_client,
participant_config,
) = shared_utils.get_client_names(
participant, 0, participant_contexts, participant_configs
)
el_http_url = "http://{0}:{1}".format(
el_client.ip_addr,
el_client.rpc_port_num,
)
template_data = new_config_template_data(
HTTP_PORT_NUMBER,
cl_client.beacon_http_url,
el_http_url,
bunnyfinder_params,
)
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[
BUNNYFINDER_CONFIG_FILENAME
......@@ -80,10 +101,12 @@ def get_config(
ports=USED_PORTS,
files={
BUNNYFINDER_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
BUNNYFINDER_TESTS_MOUNT_DIRPATH_ON_SERVICE: tests_config_artifacts_name,
VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE: VALIDATOR_RANGES_ARTIFACT_NAME,
},
cmd=["--config", config_file_path],
cmd=["--config", config_file_path,
"--strategy", bunnyfinder_params.strategy,
"--duration-per-strategy-run", bunnyfinder_params.duration_per_strategy,
"--max-hack-idx", bunnyfinder_params.max_malicious_idx,
"--min-hack-idx", bunnyfinder_params.min_malicious_idx,],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
......@@ -94,10 +117,13 @@ def get_config(
def new_config_template_data(
listen_port_num,
beacon_http_url,
execution_http_url,
bunnyfinder_params,
):
strategy = bunnyfinder_params.strategy
return {
"DBConnect": bunnyfinder_params.dbconnect,
"ListenPortNum": listen_port_num,
"Strategy": strategy,
"CL_HTTP_URL": beacon_http_url,
"EL_HTTP_URL": execution_http_url,
}
......@@ -466,6 +466,10 @@ def input_parser(plan, input_args):
bunnyfinder_params=struct(
image=result["bunnyfinder_params"]["image"],
strategy=result["bunnyfinder_params"]["strategy"],
dbconnect=result["bunnyfinder_params"]["dbconnect"],
duration_per_strategy=result["bunnyfinder_params"]["duration_per_strategy"],
min_malicious_idx=result["bunnyfinder_params"]["min_malicious_idx"],
max_malicious_idx=result["bunnyfinder_params"]["max_malicious_idx"],
),
additional_services=result["additional_services"],
wait_for_finalization=result["wait_for_finalization"],
......@@ -1207,6 +1211,10 @@ def get_default_bunnyfinder_params():
return {
"image": "tscel/bunnyfinder:latest",
"strategy": "random",
"dbconnect": "",
"duration_per_strategy": 60,
"min_malicious_idx": 0,
"max_malicious_idx": 20,
}
......
......@@ -257,6 +257,10 @@ SUBCATEGORY_PARAMS = {
"bunnyfinder_params": [
"image",
"strategy",
"dbconnect",
"duration_per_strategy",
"max_malicious_idx",
"min_malicious_idx",
],
"port_publisher": [
"nat_exit_ip",
......
http_port = {{ .ListenPortNum }} # rpc port, rest api port is http_port+1.
execute_rpc = "{{ .EL_HTTP_URL }}"
beacon_rpc = "{{ .CL_HTTP_URL }}"
dbconnect = "{{ .DBConnect }}"
reward_file = "/root/reward.csv"
swag_host = "127.0.0.1:12100"
endpoints:
{{ range $client := .ClientInfo }}
- name: "{{ $client.Name }}"
consensusUrl: "{{ $client.CL_HTTP_URL }}"
executionUrl: "http://{{ $client.ELIPAddr }}:{{ $client.ELPortNum }}"
{{- if .ELSnooperEnabled }}
executionSnooperUrl: "{{ $client.ELSnooperUrl }}"
{{- end }}
{{- if .CLSnooperEnabled }}
consensusSnooperUrl: "{{ $client.CLSnooperUrl }}"
{{- end }}
{{- end }}
web:
server:
host: "0.0.0.0"
port: 8080
frontend:
enabled: true
debug: true
pprof: true
api:
enabled: true
database:
engine: "sqlite"
sqlite:
file: "/assertoor-database.sqlite"
validatorNames:
inventoryYaml: "/validator-ranges/validator-ranges.yaml"
globalVars:
walletPrivkey: "850643a0224065ecce3882673c21f56bcf6eef86274cc21cadff15930b59fc8c"
clientPairNames:
{{- range $client := .ClientInfo }}
- "{{ $client.Name }}"
{{- end }}
validatorPairNames: {{ if eq (len .ValidatorClientInfo) 0 }}[]{{ end }}
{{- range $client := .ValidatorClientInfo }}
- "{{ $client.Name }}"
{{- end }}
elSnooperClientPairNames: {{ if eq (len .ElSnooperClientInfo) 0 }}[]{{ end }}
{{- range $client := .ElSnooperClientInfo }}
- "{{ $client.Name }}"
{{- end }}
clSnooperClientPairNames: {{ if eq (len .ClSnooperClientInfo) 0 }}[]{{ end }}
{{- range $client := .ClSnooperClientInfo }}
- "{{ $client.Name }}"
{{- end }}
externalTests:
{{- if .RunStabilityCheck }}
- file: /tests/stability-check.yaml
{{- end }}
{{- if .RunBlockProposalCheck }}
- file: /tests/block-proposal-check.yaml
{{- end }}
{{- if .RunTransactionTest }}
- file: /tests/eoa-transactions-test.yaml
{{- end }}
{{- if .RunBlobTransactionTest }}
- file: /tests/blob-transactions-test.yaml
{{- end }}
{{- if .RunOpcodesTransactionTest }}
- file: /tests/all-opcodes-transaction-test.yaml
{{- end }}
{{- if .RunLifecycleTest }}
- file: /tests/validator-lifecycle-test.yaml
{{- end }}
{{- range $test := .AdditionalTests }}
- {{ $test }}
{{- end }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment