diff --git a/roles/translator/config-examples/tproxy-config-local-jdc-example.toml b/roles/translator/config-examples/tproxy-config-local-jdc-example.toml index 5fe4a8eebd..ce11ca19ef 100644 --- a/roles/translator/config-examples/tproxy-config-local-jdc-example.toml +++ b/roles/translator/config-examples/tproxy-config-local-jdc-example.toml @@ -25,7 +25,7 @@ min_extranonce2_size = 8 # Difficulty params [downstream_difficulty_config] # hashes/s of the weakest miner that will be connecting (e.g.: 10 Th/s = 10_000_000_000_000.0) -min_individual_miner_hashrate=10_000_000_000_000.0 +min_individual_miner_hashrate=10_000_000.0 # target number of shares per minute the miner should be sending shares_per_minute = 6.0 @@ -33,4 +33,4 @@ shares_per_minute = 6.0 # interval in seconds to elapse before updating channel hashrate with the pool channel_diff_update_interval = 60 # estimated accumulated hashrate of all downstream miners (e.g.: 10 Th/s = 10_000_000_000_000.0) -channel_nominal_hashrate = 10_000_000_000_000.0 +channel_nominal_hashrate = 10_000_000.0 diff --git a/test/config/change-upstream/jdc-config-local-example-change-upstream.toml b/test/config/change-upstream/jdc-config-local-example-change-upstream.toml new file mode 100644 index 0000000000..3d50d4d38d --- /dev/null +++ b/test/config/change-upstream/jdc-config-local-example-change-upstream.toml @@ -0,0 +1,70 @@ +# SRI JDC config +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 + +# Template Provider config +# Local TP (this is pointing to localhost so you must run a TP locally for this configuration to work) +tp_address = "127.0.0.1:8442" +# Hosted testnet TP +# tp_address = "75.119.150.111:8442" + +# Solo Mining config +# List of coinbase outputs used to build the coinbase tx in case of Solo Mining (as last-resort solution of the pools fallback system) +# ! Put your Extended Public Key or Script as output_script_value ! +# ! Right now only one output is supported, so comment all the ones you don't need ! +# For P2PK, P2PKH, P2WPKH, P2TR a public key is needed. For P2SH and P2WSH, a redeem script is needed. +coinbase_outputs = [ + #{ output_script_type = "P2PK", output_script_value = "0372c47307e5b75ce365daf835f226d246c5a7a92fe24395018d5552123354f086" }, + #{ output_script_type = "P2PKH", output_script_value = "0372c47307e5b75ce365daf835f226d246c5a7a92fe24395018d5552123354f086" }, + #{ output_script_type = "P2SH", output_script_value = "00142ef89234bc95136eb9e6fee9d32722ebd8c1f0ab" }, + #{ output_script_type = "P2WSH", output_script_value = "00142ef89234bc95136eb9e6fee9d32722ebd8c1f0ab" }, + { output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, + #{ output_script_type = "P2TR", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, +] + +[timeout] +unit = "secs" +value = 1 + +# List of upstreams (JDS) used as backup endpoints +# In case of shares refused by the JDS, the fallback system will propose the same job to the next upstream in this list +[[upstreams]] +authority_pubkey = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" +pool_address = "127.0.0.1:44254" +jd_address = "127.0.0.1:34264" +# Pool signature (string to be included in coinbase tx) +pool_signature = "Stratum v2 SRI Pool" +[[upstreams]] +authority_pubkey = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" +pool_address = "127.0.0.1:34254" +jd_address = "127.0.0.1:34264" +# Pool signature (string to be included in coinbase tx) +pool_signature = "Stratum v2 SRI Pool" + +# [[upstreams]] +# authority_pubkey = "2di19GHYQnAZJmEpoUeP7C3Eg9TCcksHr23rZCC83dvUiZgiDL" +# pool_address = "127.0.0.1:34254" +# jd_address = "127.0.0.1:34264" +# Pool signature (string to be included in coinbase tx) +# pool_signature = "Stratum v2 SRI Pool" diff --git a/test/config/change-upstream/jds-config-hosted-example-pool-rejecting-shares.toml b/test/config/change-upstream/jds-config-hosted-example-pool-rejecting-shares.toml new file mode 100644 index 0000000000..c8a75ef0f3 --- /dev/null +++ b/test/config/change-upstream/jds-config-hosted-example-pool-rejecting-shares.toml @@ -0,0 +1,28 @@ +# SRI Pool config +authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" +authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n" +cert_validity_sec = 3600 + +# 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 ! +# For P2PK, P2PKH, P2WPKH, P2TR a public key is needed. For P2SH and P2WSH, a redeem script is needed. +coinbase_outputs = [ + #{ output_script_type = "P2PK", output_script_value = "0372c47307e5b75ce365daf835f226d246c5a7a92fe24395018d5552123354f086" }, + #{ output_script_type = "P2PKH", output_script_value = "0372c47307e5b75ce365daf835f226d246c5a7a92fe24395018d5552123354f086" }, + #{ output_script_type = "P2SH", output_script_value = "00142ef89234bc95136eb9e6fee9d32722ebd8c1f0ab" }, + #{ output_script_type = "P2WSH", output_script_value = "00142ef89234bc95136eb9e6fee9d32722ebd8c1f0ab" }, + { output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, + #{ output_script_type = "P2TR", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, +] + +# SRI Pool JD config +listen_jd_address = "0.0.0.0:34264" +# RPC config for mempool (it can be also the same TP if correctly configured) +core_rpc_url = "http://127.0.0.1" +core_rpc_port = 18332 +core_rpc_user = "username" +core_rpc_pass = "password" +# Time interval used for JDS mempool update +[mempool_update_interval] +unit = "secs" +value = 1 diff --git a/test/config/change-upstream/pool-config-local-tp-example.toml b/test/config/change-upstream/pool-config-local-tp-example.toml new file mode 100644 index 0000000000..edc69b3c18 --- /dev/null +++ b/test/config/change-upstream/pool-config-local-tp-example.toml @@ -0,0 +1,25 @@ +# SRI Pool config +authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" +authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n" +cert_validity_sec = 3600 +test_only_listen_adress_plain = "0.0.0.0:34250" +listen_address = "0.0.0.0:34254" + +# 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 ! +# For P2PK, P2PKH, P2WPKH, P2TR a public key is needed. For P2SH and P2WSH, a redeem script is needed. +coinbase_outputs = [ + #{ output_script_type = "P2PK", output_script_value = "0372c47307e5b75ce365daf835f226d246c5a7a92fe24395018d5552123354f086" }, + #{ output_script_type = "P2PKH", output_script_value = "0372c47307e5b75ce365daf835f226d246c5a7a92fe24395018d5552123354f086" }, + #{ output_script_type = "P2SH", output_script_value = "00142ef89234bc95136eb9e6fee9d32722ebd8c1f0ab" }, + #{ output_script_type = "P2WSH", output_script_value = "00142ef89234bc95136eb9e6fee9d32722ebd8c1f0ab" }, + { output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, + #{ output_script_type = "P2TR", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, +] + +# Pool signature (string to be included in coinbase tx) +pool_signature = "Stratum v2 SRI Pool" + +# Template Provider config +# Local TP (this is pointing to localhost so you must run a TP locally for this configuration to work) +tp_address = "127.0.0.1:8442" diff --git a/test/config/change-upstream/tproxy-config-local-jdc-example.toml b/test/config/change-upstream/tproxy-config-local-jdc-example.toml new file mode 100644 index 0000000000..8ad73f217a --- /dev/null +++ b/test/config/change-upstream/tproxy-config-local-jdc-example.toml @@ -0,0 +1,38 @@ +# Braiins Pool Upstream Connection +# upstream_authority_pubkey = "u95GEReVMjK6k5YqiSFNqqTnKU4ypU2Wm8awa6tmbmDmk1bWt" +# upstream_address = "18.196.32.109" +# upstream_port = 3336 + +# Local SRI JDC Upstream Connection +upstream_address = "127.0.0.1" +upstream_port = 34265 +upstream_authority_pubkey = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" + +# Local Mining Device Downstream Connection +downstream_address = "0.0.0.0" +downstream_port = 34255 + +# 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 + +# Difficulty params +[downstream_difficulty_config] +# hashes/s of the weakest miner that will be connecting +min_individual_miner_hashrate=18_000_000.0 +# minimum number of shares needed before a mining.set_difficulty is sent for updating targets +miner_num_submits_before_update=5 +# target number of shares per minute the miner should be sending +shares_per_minute = 100.0 + +[upstream_difficulty_config] +# interval in seconds to elapse before updating channel hashrate with the pool +channel_diff_update_interval = 60 +# estimated accumulated hashrate of all downstream miners +channel_nominal_hashrate = 18_000_000.0 diff --git a/test/message-generator/test/change-upstream/change-upstream.json b/test/message-generator/test/change-upstream/change-upstream.json new file mode 100644 index 0000000000..72b69497a0 --- /dev/null +++ b/test/message-generator/test/change-upstream/change-upstream.json @@ -0,0 +1,120 @@ +{ + "version": "2", + "doc": [ + "This test does", + "Acts like a pool that refuses share with JobDeclatarion", + "Waits for SetupConnection", + "Sends a SetupConnection.Success and waits that a SetCustomMiningJob is received", + "Sends a SetCustomMiningJob.Success and waits that UpdateChannel is received", + "Waits that SubmitShare is received", + "Responds with SubmitShare.Error" + ], + "frame_builders": [ + { + "type": "automatic", + "message_id": "test/message-generator/messages/mining_messages.json::open_extended_mining_channel_success" + }, + { + "type": "automatic", + "message_id": "test/message-generator/messages/common_messages.json::setup_connection_success_tproxy" + }, + { + "type": "automatic", + "message_id": "test/message-generator/messages/mining_messages.json::set_custom_mining_job_success" + }, + { + "type": "automatic", + "message_id": "test/message-generator/messages/mining_messages.json::submit_shares_error" + } + ], + "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_tproxy"], + "role": "server", + "results": [ + { + "type": "match_message_type", + "value": "0x13" + } + ], + "actiondoc": "This action sends SetupConnection.Success and check that a OpenExtendedfMiningChannel is received" + }, + { + "message_ids": ["open_extended_mining_channel_success"], + "role": "server", + "results": [ + { + "type": "get_message_field", + "value": [ + "MiningProtocol", + "SetCustomMiningJob", + [ + [ + "request_id", + "custom_job_req_id" + ] + ] + ] + } + ], + "actiondoc": "This action sends open_extended_mining_channel_success, and a wait for a SetCustomMiningJoband get the req id" + }, + { + "message_ids": ["set_custom_mining_job_success"], + "role": "server", + "results": [ + { + "type": "match_message_type", + "value": "0x16" + } + ], + "actiondoc": "This action sends a SetCustomMiningJob.Success and check that UpdateChannel is received" + }, + { + "message_ids": [], + "role": "server", + "results": [ + { + "type": "match_message_type", + "value": "0x1b" + } + ], + "actiondoc": "This action check submit_shares is received" + }, + { + "message_ids": ["submit_shares_error"], + "role": "server", + "results": [], + "actiondoc": "This action a submit_shares_error" + } + ], + "setup_commands": [ + ], + "execution_commands": [ + ], + "cleanup_commands": [ + { + "command": "sleep", + "args": ["100000000000"], + "conditions": "None" + } + ], + "role": "server", + "upstream": { + "ip": "127.0.0.1", + "port": 44254, + "pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72", + "secret_key": "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n" + } +}