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

MG Test on quick templates #1026

Closed
42 changes: 42 additions & 0 deletions test/config/jdc-quick-template-update/jdc-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Local Mining Device Downstream Connection
downstream_address = "127.0.0.1"
downstream_port = 34265

# Version support
max_supported_version = 2
min_supported_version = 2

# Minimum extranonce2 size for downstream
# Max value: 16 (leaves 0 bytes for search space splitting of downstreams)
# Max value for CGminer: 8
# Min value: 2
min_extranonce2_size = 8

# Withhold
withhold = false

# Auth keys for open encrypted connection downstream
authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n"
cert_validity_sec = 3600

# How many time the JDC try to reinitialize itself after a failure
retry = 10

tp_address = "127.0.0.1:8442"
tp_authority_pub_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"


coinbase_outputs = [
{ output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" },
]

[timeout]
unit = "secs"
value = 1

[[upstreams]]
authority_pubkey = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
pool_address = "127.0.0.1:34254"
jd_address = "127.0.0.1:34264"
pool_signature = "Stratum v2 SRI Pool"
14 changes: 14 additions & 0 deletions test/config/pool-config-local-tp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
listen_address = "127.0.0.1:34254"
tp_address = "127.0.0.1:8442"
listen_jd_address = "127.0.0.1:34264"
authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n"
cert_validity_sec = 3600
test_only_listen_adress_plain = "0.0.0.0:34250"
# list of coinbase outputs used to build the coinbase tx
# ! right now only one output is supported, so comment all the ones you don't need !
coinbase_outputs = [
{ output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" },
]
# Pool signature (string to be included in coinbase tx)
pool_signature = "Stratum v2 SRI Pool"
24 changes: 24 additions & 0 deletions test/message-generator/messages/common_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
},
"id": "setup_connection_mining_hom"
},
{
"message": {
"type": "SetupConnection",
"protocol": 0,
"min_version": 2,
"max_version": 2,
"flags": 4,
"endpoint_host": "",
"endpoint_port": 0,
"vendor": "",
"hardware_version": "",
"firmware": "",
"device_id": ""
},
"id": "setup_connection_tproxy"
},
{
"message": {
"type": "SetupConnection",
Expand Down Expand Up @@ -71,6 +87,14 @@
"used_version": 2
},
"id": "setup_connection_success_tproxy"
},
{
"message": {
"type": "SetupConnectionSuccess",
"flags": 1,
"used_version": 2
},
"id": "setup_connection_success_jds_to_jdc"
}

]
Expand Down
172 changes: 172 additions & 0 deletions test/message-generator/mock/jds-mock-quick-templates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"version": "2",
"doc": [
"This test does",
"Mock a JDS",
"Start listen to the port 34264",
"Receive SetupConnection and reply SetupConnection.Success",
"(template1) Await for AllocateMiningJobToken and reply AllocateMiningJobToken.Success",
"(template2) Await for AllocateMiningJobToken and reply AllocateMiningJobToken.Success",
"(template1) Await for DeclareMiningJob and reply DeclareMiningJob.Success",
"(template2) Await for DeclareMiningJob and reply DeclareMiningJob.Success"
],
"job_declaration_messages": [
{
"message": {
"type": "AllocateMiningJobTokenSuccess",
"request_id":0,
"new_mining_job_token":[],
"mining_job_token": [0, 0, 0, 0],
"coinbase_output":[0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 20, 235, 225, 183, 220, 194, 147, 204, 170, 14, 231, 67, 168, 111, 137, 223, 130, 88, 194, 8, 252],
"coinbase_output_max_additional_size": 100,
"async_mining_allowed": false
},
"replace_fields": [["request_id","request_id_0"]],
"id": "allocate_mining_job_token_success_0"
},
{
"message": {
"type": "AllocateMiningJobTokenSuccess",
"request_id":1,
"new_mining_job_token":[],
"mining_job_token": [1, 0, 0, 0],
"coinbase_output":[0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 20, 235, 225, 183, 220, 194, 147, 204, 170, 14, 231, 67, 168, 111, 137, 223, 130, 88, 194, 8, 252],
"coinbase_output_max_additional_size": 100,
"async_mining_allowed": false
},
"replace_fields": [["request_id","request_id_1"]],
"id": "allocate_mining_job_token_success_1"
},
{
"message": {
"type": "DeclareMiningJobSuccess",
"request_id": 0,
"new_mining_job_token": [0, 0, 0, 0]
},
"id": "declare_mining_job_success_0"
},
{
"message": {
"type": "DeclareMiningJobSuccess",
"request_id": 1,
"new_mining_job_token": [1, 0, 0, 0]
},
"id": "declare_mining_job_success_1"
}
],
"frame_builders": [
{
"type": "automatic",
"message_id": "allocate_mining_job_token_success_0"
},
{
"type": "automatic",
"message_id": "allocate_mining_job_token_success_1"
},
{
"type": "automatic",
"message_id": "declare_mining_job_success_0"
},
{
"type": "automatic",
"message_id": "declare_mining_job_success_1"
},
{
"type": "automatic",
"message_id": "test/message-generator/messages/common_messages.json::setup_connection_success_tproxy"
},
{
"type": "automatic",
"message_id": "test/message-generator/messages/common_messages.json::setup_connection_success_jds_to_jdc"
}
],
"actions": [
{
"message_ids": [],
"role": "server",
"results": [
{
"type": "match_message_type",
"value": "0x00"
}
],
"actiondoc": "This action checks that a SetupConnection message is received,"
},
{
"message_ids": ["setup_connection_success_jds_to_jdc"],
"role": "server",
"results": [],
"actiondoc": "This action sends back a SetupConnection.Success (setup_connection_success_jds_to_jdc) "
},
{
"message_ids": [],
"role": "server",
"results": [
{
"type": "get_message_field",
"value": [
"JobDeclarationProtocol",
"AllocateMiningJobToken",
[
[
"request_id",
"request_id_0"
]
]
]
}
],
"actiondoc": "This action checks receives allocate mining job"
},
{
"message_ids": ["allocate_mining_job_token_success_0"],
"role": "server",
"results": [],
"actiondoc": "This action sends back a AllocateMiningJobToken.Success (allocate_mining_job_token_success_0)"
},
{
"message_ids": [],
"role": "server",
"results": [
{
"type": "get_message_field",
"value": [
"JobDeclarationProtocol",
"AllocateMiningJobToken",
[
[
"request_id",
"request_id_1"
]
]
]
}
],
"actiondoc": "This action receives allocate mining job"
},
{
"message_ids": ["allocate_mining_job_token_success_1"],
"role": "server",
"results": [],
"actiondoc": "This action sends back a AllocateMiningJobToken.Success (allocate_mining_job_token_success_1)"
}
Shourya742 marked this conversation as resolved.
Show resolved Hide resolved
],
"setup_commands": [
],
"execution_commands": [
],
"cleanup_commands": [
{
"command": "sleep",
"args": ["10000"],
"conditions": "None"
}
],
"role": "server",
"upstream": {
"ip": "127.0.0.1",
"port": 34264,
"pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72",
"secret_key": "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n"
}
}
Loading
Loading