forked from stratum-mining/stratum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Fi3/AddMgTestJdcStackOverflow
Add mg test for jdc stack overflow
- Loading branch information
Showing
5 changed files
with
263 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
downstream_address = "0.0.0.0" | ||
downstream_port = 34265 | ||
|
||
max_supported_version = 2 | ||
min_supported_version = 2 | ||
|
||
min_extranonce2_size = 8 | ||
|
||
withhold = false | ||
|
||
authority_public_key = "3VANfft6ei6jQq1At7d8nmiZzVhBFS4CiQujdgim1ign" | ||
authority_secret_key = "7qbpUjScc865jyX2kiB4NVJANoC7GA7TAJupdzXWkc62" | ||
cert_validity_sec = 3600 | ||
|
||
retry = 10 | ||
|
||
tp_address = "75.119.150.111:8442" | ||
tp_authority_pub_key = "3VANfft6ei6jQq1At7d8nmiZzVhBFS4CiQujdgim1ign" | ||
|
||
coinbase_outputs = [ | ||
{ output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, | ||
] | ||
|
||
[timeout] | ||
unit = "secs" | ||
value = 1 | ||
|
||
[[upstreams]] | ||
authority_pubkey = "3VANfft6ei6jQq1At7d8nmiZzVhBFS4CiQujdgim1ign" | ||
pool_address = "127.0.0.1:34254" | ||
jd_address = "127.0.0.1:34264" | ||
pool_signature = "Stratum v2 SRI Pool" |
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,11 @@ | ||
upstreams = [ | ||
{ channel_kind = "Extended", address = "127.0.0.1", port = 34265, pub_key = "3VANfft6ei6jQq1At7d8nmiZzVhBFS4CiQujdgim1ign"}, | ||
] | ||
listen_address = "127.0.0.1" | ||
listen_mining_port = 34255 | ||
max_supported_version = 2 | ||
min_supported_version = 2 | ||
downstream_share_per_minute = 100 | ||
coinbase_reward_sat = 5_000_000_000 | ||
expected_total_downstream_hr = 10_000 | ||
reconnect = false |
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,13 @@ | ||
listen_address = "127.0.0.1:34254" | ||
tp_address = "75.119.150.111:8442" | ||
authority_public_key = "3VANfft6ei6jQq1At7d8nmiZzVhBFS4CiQujdgim1ign" | ||
authority_secret_key = "7qbpUjScc865jyX2kiB4NVJANoC7GA7TAJupdzXWkc62" | ||
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" |
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,49 @@ | ||
{ | ||
"version": "2", | ||
"doc": [ | ||
"This test does", | ||
"Mock a JDS", | ||
"Start listen to the port 34264", | ||
"Receive setup_connection", | ||
"Sends setup_connection_success", | ||
"Receive new token", | ||
"Hand leaving the connection opened" | ||
], | ||
"frame_builders": [ | ||
{ | ||
"type": "automatic", | ||
"message_id": "test/message-generator/messages/common_messages.json::setup_connection_success_tproxy" | ||
} | ||
], | ||
"actions": [ | ||
{ | ||
"message_ids": ["setup_connection_success_tproxy"], | ||
"role": "server", | ||
"results": [ | ||
{ | ||
"type": "match_message_type", | ||
"value": "0x00" | ||
} | ||
], | ||
"actiondoc": "This action checks that a Setupconnection message is received" | ||
} | ||
], | ||
"setup_commands": [ | ||
], | ||
"execution_commands": [ | ||
], | ||
"cleanup_commands": [ | ||
{ | ||
"command": "sleep", | ||
"args": ["10000000"], | ||
"conditions": "None" | ||
} | ||
], | ||
"role": "server", | ||
"upstream": { | ||
"ip": "127.0.0.1", | ||
"port": 34264, | ||
"pub_key": "3VANfft6ei6jQq1At7d8nmiZzVhBFS4CiQujdgim1ign", | ||
"secret_key": "7qbpUjScc865jyX2kiB4NVJANoC7GA7TAJupdzXWkc62" | ||
} | ||
} |
158 changes: 158 additions & 0 deletions
158
test/message-generator/test/jds-do-not-stackoverflow-when-no-token.json
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,158 @@ | ||
{ | ||
"version": "2", | ||
"doc": [ | ||
"This test does", | ||
"Launch a jds mock on 34264", | ||
"Launch a pool on 34254", | ||
"Launch jdc on 34265", | ||
"Launch a mining proxy", | ||
"Run a mining device", | ||
"Wait 10 seconds and verify that jdc do not panic" | ||
], | ||
"frame_builders": [ | ||
], | ||
"actions": [ | ||
], | ||
"setup_commands": [ | ||
{ | ||
"command": "cargo", | ||
"args": [ | ||
"run", | ||
"../../test/message-generator/mock/jds-mock-no-token.json" | ||
], | ||
|
||
"conditions": { | ||
"WithConditions": { | ||
"conditions": [ | ||
{ | ||
"output_string": "Running `target/debug/message_generator_sv2 ../../test/message-generator/mock/jds-mock-no-token.json`", | ||
"output_location": "StdErr", | ||
"condition": true, | ||
"late_condition": false | ||
} | ||
], | ||
"timer_secs": 600, | ||
"warn_no_panic": false | ||
} | ||
} | ||
}, | ||
{ | ||
"command": "cargo", | ||
"args": [ | ||
"llvm-cov", | ||
"--no-report", | ||
"run", | ||
"-p", | ||
"pool_sv2", | ||
"--", | ||
"-c", | ||
"../test/config/jds-stack-overflow/pool-config.toml" | ||
], | ||
"conditions": { | ||
"WithConditions": { | ||
"conditions": [ | ||
{ | ||
"output_string": "Listening for encrypted connection on:", | ||
"output_location": "StdOut", | ||
"condition": true, | ||
"late_condition": false | ||
} | ||
], | ||
"timer_secs": 600, | ||
"warn_no_panic": false | ||
} | ||
} | ||
}, | ||
{ | ||
"command": "cargo", | ||
"args": [ | ||
"llvm-cov", | ||
"--no-report", | ||
"run", | ||
"-p", | ||
"jd_client", | ||
"--", | ||
"-c", | ||
"../test/config/jds-stack-overflow/jdc-config.toml" | ||
], | ||
"conditions": { | ||
"WithConditions": { | ||
"conditions": [ | ||
{ | ||
"output_string": "Listening for downstream mining connections on", | ||
"output_location": "StdOut", | ||
"condition": true, | ||
"late_condition": false | ||
}, | ||
{ | ||
"output_string": "thread 'tokio-runtime-worker' has overflowed its stack", | ||
"output_location": "StdErr", | ||
"condition": false, | ||
"late_condition": true | ||
} | ||
], | ||
"timer_secs": 600, | ||
"warn_no_panic": false | ||
} | ||
} | ||
}, | ||
{ | ||
"command": "cargo", | ||
"args": [ | ||
"llvm-cov", | ||
"--no-report", | ||
"run", | ||
"-p", | ||
"mining_proxy_sv2", | ||
"--", | ||
"-c", | ||
"../test/config/jds-stack-overflow/mining-proxy-config.toml" | ||
], | ||
"conditions": { | ||
"WithConditions": { | ||
"conditions": [ | ||
{ | ||
"output_string": "Listening for downstream mining connections on 127.0.0.1:34255", | ||
"output_location": "StdOut", | ||
"condition": true, | ||
"late_condition": false | ||
} | ||
], | ||
"timer_secs": 30, | ||
"warn_no_panic": false | ||
} | ||
} | ||
}, | ||
{ | ||
"command": "sleep", | ||
"args": ["10000"], | ||
"conditions": "None" | ||
} | ||
|
||
], | ||
"execution_commands": [ | ||
], | ||
"cleanup_commands": [ | ||
{ | ||
"command": "pkill", | ||
"args": ["-f", "pool_sv2", "-SIGINT"], | ||
"conditions": "None" | ||
}, | ||
{ | ||
"command": "pkill", | ||
"args": ["-f", "jd_server", "-SIGINT"], | ||
"conditions": "None" | ||
}, | ||
{ | ||
"command": "pkill", | ||
"args": ["-f", "jd_client", "-SIGINT"], | ||
"conditions": "None" | ||
}, | ||
{ | ||
"command": "pkill", | ||
"args": ["-f", "mining_proxy_sv2", "-SIGINT"], | ||
"conditions": "None" | ||
} | ||
], | ||
"role": "none" | ||
} |