Skip to content

Commit

Permalink
Add mg test for jdc stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
UnidenifiedUser committed Jan 25, 2024
1 parent 9cf29e6 commit 45010ab
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/config/jds-stack-overflow/jdc-config.toml
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"
11 changes: 11 additions & 0 deletions test/config/jds-stack-overflow/mining-proxy-config.toml
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
13 changes: 13 additions & 0 deletions test/config/jds-stack-overflow/pool-config.toml
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"
49 changes: 49 additions & 0 deletions test/message-generator/mock/jds-mock-no-token.json
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"
}
}
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"
}

0 comments on commit 45010ab

Please sign in to comment.