diff --git a/test/config/jds-submit-solution/jds-config.toml b/test/config/jds-submit-solution/jds-config.toml new file mode 100644 index 0000000000..ab3c134e65 --- /dev/null +++ b/test/config/jds-submit-solution/jds-config.toml @@ -0,0 +1,20 @@ +# SRI Pool config +authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" +authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n" +cert_validity_sec = 3600 + +# list of compressed or uncompressed pubkeys for coinbase payout (only supports 1 item in the array at this point) +coinbase_outputs = [ + { output_script_type = "P2WPKH", output_script_value = "036adc3bdf21e6f9a0f0fb0066bf517e5b7909ed1563d6958a10993849a7554075" }, +] + +listen_jd_address = "127.0.0.1:34264" + +core_rpc_url = "http://75.119.150.111" +core_rpc_port = 48332 +core_rpc_user = "username" +core_rpc_pass = "password" +# Time interval used for JDS mempool update +[mempool_update_interval] +unit = "secs" +value = 1 \ No newline at end of file diff --git a/test/message-generator/mock/jdc-mock-submit-solution.json b/test/message-generator/mock/jdc-mock-submit-solution.json new file mode 100644 index 0000000000..b01c3faeed --- /dev/null +++ b/test/message-generator/mock/jdc-mock-submit-solution.json @@ -0,0 +1,65 @@ +{ + "version": "2", + "doc": [ + "This test does", + "Mock JDC", + "Send SetupConnection and await for SetupConnection.Success", + "Send SubmitSolution and xxx" + ], + "job_declaration_messages": [ + { + "message": { + "type": "SubmitSolution", + "extranonce": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0], + "prev_hash": [184, 103, 138, 88, 153, 105, 236, 29, 123, 246, 107, 203, 1, 33, 10, 122, 188, 139, 218, 141, 62, 177, 158, 101, 125, 92, 214, 150, 199, 220, 29, 8], + "ntime": 0, + "nonce": 0, + "nbits": 0, + "version": 0 + }, + "id": "submit_solution" + } + ], + "frame_builders": [ + { + "type": "automatic", + "message_id": "test/message-generator/messages/common_messages.json::setup_connection_job_declarator" + }, + { + "type": "automatic", + "message_id": "submit_solution" + } + ], + "actions": [ + { + "message_ids": ["setup_connection_job_declarator"], + "role": "client", + "results": [ + { + "type": "match_message_type", + "value": "0x01" + } + ], + "actiondoc": "This action sends SetupConnection and awaits for a SetupConnection.Success" + }, + { + "message_ids": ["submit_solution"], + "role": "client", + "results": [ + { + "type": "close_connection" + } + ], + "actiondoc": "This action sends SubmitSolution and awaits for closed connection" + } + ], + "setup_commands": [], + "execution_commands": [], + "cleanup_commands": [], + "role": "client", + "downstream": { + "ip": "127.0.0.1", + "port": 34264, + "pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72" + } +} \ No newline at end of file diff --git a/test/message-generator/test/jds-submit-solution/jds-submit-solution.json b/test/message-generator/test/jds-submit-solution/jds-submit-solution.json new file mode 100644 index 0000000000..21253cd42a --- /dev/null +++ b/test/message-generator/test/jds-submit-solution/jds-submit-solution.json @@ -0,0 +1,80 @@ +{ + "version": "2", + "doc": [ + "This test does", + "Launch real JDS", + "Mock a JDC that sends a SubmitSolution" + ], + "frame_builders": [ + ], + "actions": [ + ], + "setup_commands": [ + { + "command": "cargo", + "args": [ + "llvm-cov", + "--no-report", + "run", + "-p", + "jd_server", + "--", + "-c", + "../test/config/jds-submit-solution/jds-config.toml" + ], + "conditions": { + "WithConditions": { + "conditions": [ + { + "output_string": "JD INITIALIZED", + "output_location": "StdOut", + "late_condition": false, + "condition": true + } + ], + "timer_secs": 10, + "warn_no_panic": false + } + } + }, + { + "command": "cargo", + "args": [ + "run", + "../../test/message-generator/mock/jdc-mock-submit-solution.json" + ], + + "conditions": { + "WithConditions": { + "conditions": [ + { + "output_string": "", + "output_location": "StdErr", + "condition": true, + "late_condition": false + } + ], + "timer_secs": 600, + "warn_no_panic": false + } + } + } + ], + "execution_commands": [ + ], + "cleanup_commands": [ + { + "command": "pkill", + "args": ["-f", "jd_server", "-SIGINT"], + "late_condition": false, + "conditions": "None" + } + ], + "role": "server", + "upstream": { + "ip": "127.0.0.1", + "port": 34265, + "pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72", + "secret_key": "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n" + } +} diff --git a/test/message-generator/test/jds-submit-solution/jds-submit-solution.sh b/test/message-generator/test/jds-submit-solution/jds-submit-solution.sh new file mode 100755 index 0000000000..c21ba6898f --- /dev/null +++ b/test/message-generator/test/jds-submit-solution/jds-submit-solution.sh @@ -0,0 +1,9 @@ +cd roles +cargo llvm-cov --no-report -p jd_server + +cd ../utils/message-generator/ +cargo build + +RUST_LOG=debug cargo run ../../test/message-generator/test/jds-submit-solution/jds-submit-solution.json || { echo 'mg test failed' ; exit 1; } + +sleep 10