Skip to content

Commit 6dde6b9

Browse files
authored
Merge pull request #1354 from jbesraa/2025-01-16-translator-jd-test
Test Translator, JD and miner setup
2 parents 637ed1e + 844fd05 commit 6dde6b9

File tree

14 files changed

+58
-637
lines changed

14 files changed

+58
-637
lines changed

.github/workflows/mg.yaml

+1-35
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ on:
88
- main
99

1010
jobs:
11-
interop-jd-translator:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
16-
- name: Run interop-jd-translator
17-
run: sh ./test/message-generator/test/interop-jd-translator/interop-jd-translator.sh
18-
1911
interop-proxy-with-multi-ups:
2012
runs-on: ubuntu-latest
2113
steps:
@@ -76,26 +68,6 @@ jobs:
7668
- name: Run pool-sri-test-close-channel
7769
run: sh ./test/message-generator/test/pool-sri-test-close-channel/pool-sri-test-close-channel.sh
7870

79-
pool-sri-test-extended_0:
80-
runs-on: ubuntu-latest
81-
steps:
82-
- name: Checkout repository
83-
uses: actions/checkout@v4
84-
- name: Install cargo-llvm-cov
85-
run: cargo install cargo-llvm-cov
86-
- name: Run pool-sri-test-extended_0
87-
run: sh ./test/message-generator/test/pool-sri-test-extended_0/pool-sri-test-extended_0.sh
88-
89-
pool-sri-test-extended_1:
90-
runs-on: ubuntu-latest
91-
steps:
92-
- name: Checkout repository
93-
uses: actions/checkout@v4
94-
- name: Install cargo-llvm-cov
95-
run: cargo install cargo-llvm-cov
96-
- name: Run pool-sri-test-extended_1
97-
run: sh ./test/message-generator/test/pool-sri-test-extended_1/pool-sri-test-extended_1.sh
98-
9971
sv1-test:
10072
runs-on: ubuntu-latest
10173
timeout-minutes: 10
@@ -126,33 +98,27 @@ jobs:
12698
runs-on: ubuntu-latest
12799
if: always()
128100
needs: [
129-
interop-jd-translator,
130101
interop-proxy-with-multi-ups,
131102
interop-proxy-with-multi-ups-extended,
132103
jds-do-not-fail-on-wrong-tsdatasucc,
133104
jds-do-not-stackoverflow-when-no-token,
134105
jds-receive-solution-while-processing-declared-job,
135106
pool-sri-test-1-standard,
136107
pool-sri-test-close-channel,
137-
pool-sri-test-extended_0,
138-
pool-sri-test-extended_1,
139108
sv1-test,
140109
translation-proxy-broke-pool,
141110
translation-proxy-old-share
142111
]
143112
steps:
144113
- name: Aggregate Results
145114
run: |
146-
if [ "${{ needs.interop-jd-translator.result }}" != "success" ] ||
147-
[ "${{ needs.interop-proxy-with-multi-ups.result }}" != "success" ] ||
115+
if [ "${{ needs.interop-proxy-with-multi-ups.result }}" != "success" ] ||
148116
[ "${{ needs.interop-proxy-with-multi-ups-extended.result }}" != "success" ] ||
149117
[ "${{ needs.jds-do-not-fail-on-wrong-tsdatasucc.result }}" != "success" ] ||
150118
[ "${{ needs.jds-do-not-stackoverflow-when-no-token.result }}" != "success" ] ||
151119
[ "${{ needs.jds-receive-solution-while-processing-declared-job.result }}" != "success" ] ||
152120
[ "${{ needs.pool-sri-test-1-standard.result }}" != "success" ] ||
153121
[ "${{ needs.pool-sri-test-close-channel.result }}" != "success" ] ||
154-
[ "${{ needs.pool-sri-test-extended_0.result }}" != "success" ] ||
155-
[ "${{ needs.pool-sri-test-extended_1.result }}" != "success" ] ||
156122
[ "${{ needs.sv1-test.result }}" != "success" ] ||
157123
[ "${{ needs.translation-proxy-broke-pool.result }}" != "success" ] ||
158124
[ "${{ needs.translation-proxy-old-share.result }}" != "success" ]; then

roles/tests-integration/tests/jd_integration.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use sniffer::MessageDirection;
1515
// starting a new jd-client that connects to the same jd-server successfully.
1616
#[tokio::test]
1717
async fn jds_should_not_panic_if_jdc_shutsdown() {
18+
start_tracing();
1819
let (tp, tp_addr) = start_template_provider(None);
1920
let (_pool, pool_addr) = start_pool(Some(tp_addr)).await;
2021
let (_jds, jds_addr) = start_jds(tp.rpc_info()).await;

roles/tests-integration/tests/translator_integration.rs

+53-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
//
55
// Note that it is enough to call `start_tracing()` once in the test suite to enable tracing for
66
// all tests. This is because tracing is a global setting.
7-
use const_sv2::{MESSAGE_TYPE_SETUP_CONNECTION, MESSAGE_TYPE_SUBMIT_SHARES_EXTENDED};
7+
use const_sv2::{
8+
MESSAGE_TYPE_MINING_SET_NEW_PREV_HASH, MESSAGE_TYPE_SETUP_CONNECTION,
9+
MESSAGE_TYPE_SUBMIT_SHARES_EXTENDED, MESSAGE_TYPE_SUBMIT_SHARES_SUCCESS,
10+
};
811
use integration_tests_sv2::{sniffer::*, *};
912
use roles_logic_sv2::parsers::{CommonMessages, Mining, PoolMessages};
1013

@@ -51,3 +54,52 @@ async fn translate_sv1_to_sv2_successfully() {
5154
)
5255
.await;
5356
}
57+
58+
// Test full flow with Translator and Job Declarator. An SV1 mining device is connected to
59+
// Translator and is successfully submitting a share to the pool.
60+
#[tokio::test]
61+
async fn translation_proxy_and_jd() {
62+
let (tp, tp_addr) = start_template_provider(None);
63+
let (_pool, pool_addr) = start_pool(Some(tp_addr)).await;
64+
let (jdc_pool_sniffer, jdc_pool_sniffer_addr) =
65+
start_sniffer("0".to_string(), pool_addr, false, None).await;
66+
let (_jds, jds_addr) = start_jds(tp.rpc_info()).await;
67+
let (_jdc, jdc_addr) = start_jdc(jdc_pool_sniffer_addr, tp_addr, jds_addr).await;
68+
let (_translator, tproxy_addr) = start_sv2_translator(jdc_addr).await;
69+
let _mining_device = start_mining_device_sv1(tproxy_addr, true, None).await;
70+
jdc_pool_sniffer
71+
.wait_for_message_type(MessageDirection::ToUpstream, MESSAGE_TYPE_SETUP_CONNECTION)
72+
.await;
73+
assert_common_message!(
74+
&jdc_pool_sniffer.next_message_from_downstream(),
75+
SetupConnection
76+
);
77+
assert_common_message!(
78+
&jdc_pool_sniffer.next_message_from_upstream(),
79+
SetupConnectionSuccess
80+
);
81+
assert_mining_message!(
82+
&jdc_pool_sniffer.next_message_from_downstream(),
83+
OpenExtendedMiningChannel
84+
);
85+
assert_mining_message!(
86+
&jdc_pool_sniffer.next_message_from_upstream(),
87+
OpenExtendedMiningChannelSuccess
88+
);
89+
assert_mining_message!(
90+
&jdc_pool_sniffer.next_message_from_upstream(),
91+
NewExtendedMiningJob
92+
);
93+
jdc_pool_sniffer
94+
.wait_for_message_type(
95+
MessageDirection::ToUpstream,
96+
MESSAGE_TYPE_SUBMIT_SHARES_EXTENDED,
97+
)
98+
.await;
99+
jdc_pool_sniffer
100+
.wait_for_message_type(
101+
MessageDirection::ToDownstream,
102+
MESSAGE_TYPE_SUBMIT_SHARES_SUCCESS,
103+
)
104+
.await;
105+
}

test/config/interop-jd-translator/jdc-config.toml

-65
This file was deleted.

test/config/interop-jd-translator/jds-config.toml

-20
This file was deleted.

test/config/interop-jd-translator/proxy-config.toml

-34
This file was deleted.

test/config/interop-jd-translator/pool-config.toml test/config/sv1-test/pool-config.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ coinbase_outputs = [
1414
#{ output_script_type = "P2WPKH", output_script_value = "02e13cef1348924c49dd1f708bf38eb79ae4648c16f0301085f37547d1d25e33e0" },
1515
#{ output_script_type = "P2TR", output_script_value = "02e13cef1348924c49dd1f708bf38eb79ae4648c16f0301085f37547d1d25e33e0" },
1616
]
17-
# Pool signature (string to be included in coinbase tx)
17+
# Pool signature (string to be included in coinbase tx)
1818
# e.g. "Foundry USA", "Antpool", "/ViaBTC/Mined by gitgab19", etc
1919
pool_signature = "Stratum v2 SRI Pool - gitgab19"
2020

2121
# Template Provider config
22-
# hosted testnet TP
22+
# hosted testnet TP
2323
tp_address = "75.119.150.111:8442"

0 commit comments

Comments
 (0)