Skip to content

Commit

Permalink
add MG test for #912
Browse files Browse the repository at this point in the history
  • Loading branch information
plebhash committed Jul 9, 2024
1 parent 92a6fbf commit 71e2e4e
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/config/jds-receive-block-missing-txs/jds-config.toml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"version": "2",
"doc": [
"This test does",
"Mock JDC",
"Send SetupConnection and await for SetupConnection.Success",
"Send AllocateMiningJobToken and await for AllocateMiningJobToken.Success",
"Send DeclareMiningJob and await for ProvideMissingTransactions",
"Send SubmitSolution and xxx"
],
"job_declaration_messages": [
{
"message": {
"type": "AllocateMiningJobToken",
"user_identifier": "",
"request_id": 0,
"coinbase_tx_outputs": []
},
"id": "allocate_mining_job_token"
},
{
"message": {
"type": "DeclareMiningJob",
"request_id": 0,
"mining_job_token": [1, 0, 0, 0],
"version": 0,
"coinbase_prefix": [2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 55, 2, 128, 121, 0, 83, 116, 114, 97, 116, 117, 109, 32, 118, 50, 32, 83, 82, 73, 32, 80, 111, 111, 108],
"coinbase_suffix": [255, 255, 255, 255, 2, 168, 247, 5, 42, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, 170, 33, 169, 237, 226, 201, 13, 62, 213, 94, 164, 53, 216, 76, 246, 14, 110, 125, 255, 48, 66, 12, 220, 90, 217, 209, 75, 129, 37, 185, 117, 116, 254, 30, 81, 159, 1, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"tx_short_hash_nonce": 0,
"tx_short_hash_list": [[95, 135, 113, 8, 147, 179]],
"tx_hash_list_hash": [133, 189, 184, 91, 252, 203, 225, 42, 233, 16, 77, 119, 76, 134, 93, 189, 192, 159, 221, 130, 150, 196, 18, 32, 54, 212, 138, 255, 57, 63, 118, 74],
"excess_data": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"id": "declare_mining_job"
},
{
"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": "allocate_mining_job_token"
},
{
"type": "automatic",
"message_id": "declare_mining_job"
},
{
"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": ["allocate_mining_job_token"],
"role": "client",
"results": [
{
"type": "match_message_type",
"value": "0x51"
}
],
"actiondoc": "This action sends AllocateMiningJobToken and awaits for a AllocateMiningJobToken.Success"
},
{
"message_ids": ["declare_mining_job"],
"role": "client",
"results": [
{
"type": "match_message_type",
"value": "0x55"
}
],
"actiondoc": "This action sends DeclareMiningJob and awaits for a ProvideMissingTransactions"
},
{
"message_ids": ["submit_solution"],
"role": "client",
"results": [
{
"type": "sustain_connection"
}
],
"actiondoc": "This action sends SubmitSolution and awaits for xxx"
}
],
"setup_commands": [],
"execution_commands": [],
"cleanup_commands": [],
"role": "client",
"downstream": {
"ip": "127.0.0.1",
"port": 34264,
"pub_key": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"version": "2",
"doc": [
"This test does",
"Launch real JDS",
"Mock a JDC that sends SubmitSolution before ProvideMissingTransactionsSuccess"
],
"frame_builders": [
],
"actions": [
],
"setup_commands": [
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"jd_server",
"--",
"-c",
"../test/config/jds-receive-block-missing-txs/jds-config.toml"
],
"conditions": {
"WithConditions": {
"conditions": [
{
"output_string": "JD INITIALIZED",
"output_location": "StdOut",
"late_condition": false,
"condition": true
}
],
"timer_secs": 300,
"warn_no_panic": false
}
}
},
{
"command": "cargo",
"args": [
"run",
"../../test/message-generator/mock/jdc-mock-for-jds-receive-block-missing-txs.json"
],

"conditions": {
"WithConditions": {
"conditions": [
{
"output_string": "TEST FAIL",
"output_location": "StdErr",
"condition": false,
"late_condition": false
}
],
"timer_secs": 600,
"warn_no_panic": true
}
}
},
{
"command": "sleep",
"args": ["1000"],
"conditions": "None"
}
],
"execution_commands": [
],
"cleanup_commands": [
{
"command": "pkill",
"args": ["-f", "jd_server", "-SIGINT"],
"late_condition": false,
"conditions": "None"
}
],
"role": "none"
}
Original file line number Diff line number Diff line change
@@ -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-receive-block-missing-txs/jds-receive-block-missing-txs.json || { echo 'mg test failed' ; exit 1; }

sleep 10

0 comments on commit 71e2e4e

Please sign in to comment.