Skip to content

Commit b806682

Browse files
authored
Merge pull request #1561 from plebhash/tproxy-accepts-every-share
remove `translator-proxy-old-share` and revert #910
2 parents 78d5e52 + cad6786 commit b806682

File tree

5 files changed

+20
-156
lines changed

5 files changed

+20
-156
lines changed

.github/workflows/mg.yaml

+2-12
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,6 @@ jobs:
8585
- name: Run translation-proxy-broke-pool
8686
run: sh ./test/message-generator/test/translation-proxy-broke-pool/translation-proxy-broke-pool.sh
8787

88-
translation-proxy-old-share:
89-
runs-on: ubuntu-latest
90-
steps:
91-
- name: Checkout repository
92-
uses: actions/checkout@v4
93-
- name: Run translation-proxy-old-share
94-
run: sh ./test/message-generator/test/translation-proxy-old-share/translation-proxy-old-share.sh
95-
9688
mg-aggregate-results:
9789
name: "Aggregate MG Test Results"
9890
runs-on: ubuntu-latest
@@ -106,8 +98,7 @@ jobs:
10698
pool-sri-test-1-standard,
10799
pool-sri-test-close-channel,
108100
sv1-test,
109-
translation-proxy-broke-pool,
110-
translation-proxy-old-share
101+
translation-proxy-broke-pool
111102
]
112103
steps:
113104
- name: Aggregate Results
@@ -120,8 +111,7 @@ jobs:
120111
[ "${{ needs.pool-sri-test-1-standard.result }}" != "success" ] ||
121112
[ "${{ needs.pool-sri-test-close-channel.result }}" != "success" ] ||
122113
[ "${{ needs.sv1-test.result }}" != "success" ] ||
123-
[ "${{ needs.translation-proxy-broke-pool.result }}" != "success" ] ||
124-
[ "${{ needs.translation-proxy-old-share.result }}" != "success" ]; then
114+
[ "${{ needs.translation-proxy-broke-pool.result }}" != "success" ]; then
125115
echo "One or more jobs failed."
126116
exit 1
127117
else

roles/translator/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ There are two files in `roles/translator/config-examples`:
5555

5656
```bash
5757
cd roles/translator/config-examples/
58-
cargo run -- -c tproxy-config-local-jdc-example.toml
58+
cargo run -- -c tproxy-config-local-jdc-example.toml
59+
60+
### Limitations
61+
62+
The current implementation always replies to Sv1 `mining.submit` with `"result": true`, regardless of whether the share was rejected on Sv2 upstream.

roles/translator/src/lib/downstream_sv1/downstream.rs

+13-26
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub struct Downstream {
6161
extranonce2_len: usize,
6262
pub(super) difficulty_mgmt: DownstreamDifficultyConfig,
6363
pub(super) upstream_difficulty_config: Arc<Mutex<UpstreamDifficultyConfig>>,
64-
last_job_id: String, // we usually receive a String on SV1 messages, no need to cast to u32
6564
}
6665

6766
impl Downstream {
@@ -92,7 +91,6 @@ impl Downstream {
9291
extranonce2_len,
9392
difficulty_mgmt,
9493
upstream_difficulty_config,
95-
last_job_id,
9694
}
9795
}
9896
/// Instantiate a new `Downstream`.
@@ -128,7 +126,6 @@ impl Downstream {
128126
extranonce2_len,
129127
difficulty_mgmt: difficulty_config,
130128
upstream_difficulty_config,
131-
last_job_id: "".to_string(),
132129
}));
133130
let self_ = downstream.clone();
134131

@@ -287,10 +284,6 @@ impl Downstream {
287284

288285
let sv1_mining_notify_msg = last_notify.clone().unwrap();
289286

290-
self_
291-
.safe_lock(|s| s.last_job_id = sv1_mining_notify_msg.clone().job_id)
292-
.unwrap();
293-
294287
let message: json_rpc::Message = sv1_mining_notify_msg.into();
295288
handle_result!(
296289
tx_status_notify,
@@ -314,8 +307,6 @@ impl Downstream {
314307
let sv1_mining_notify_msg = handle_result!(tx_status_notify, res);
315308
let message: json_rpc::Message = sv1_mining_notify_msg.clone().into();
316309

317-
self_.safe_lock(|s| s.last_job_id = sv1_mining_notify_msg.job_id).unwrap();
318-
319310
handle_result!(tx_status_notify, Downstream::send_message_downstream(downstream.clone(), message).await);
320311
},
321312
_ = rx_shutdown.recv().fuse() => {
@@ -538,23 +529,19 @@ impl IsServer<'static> for Downstream {
538529

539530
// TODO: Check if receiving valid shares by adding diff field to Downstream
540531

541-
if request.job_id == self.last_job_id {
542-
let to_send = SubmitShareWithChannelId {
543-
channel_id: self.connection_id,
544-
share: request.clone(),
545-
extranonce: self.extranonce1.clone(),
546-
extranonce2_len: self.extranonce2_len,
547-
version_rolling_mask: self.version_rolling_mask.clone(),
548-
};
549-
550-
self.tx_sv1_bridge
551-
.try_send(DownstreamMessages::SubmitShares(to_send))
552-
.unwrap();
553-
554-
true
555-
} else {
556-
false
557-
}
532+
let to_send = SubmitShareWithChannelId {
533+
channel_id: self.connection_id,
534+
share: request.clone(),
535+
extranonce: self.extranonce1.clone(),
536+
extranonce2_len: self.extranonce2_len,
537+
version_rolling_mask: self.version_rolling_mask.clone(),
538+
};
539+
540+
self.tx_sv1_bridge
541+
.try_send(DownstreamMessages::SubmitShares(to_send))
542+
.unwrap();
543+
544+
true
558545
}
559546

560547
/// Indicates to the server that the client supports the mining.set_extranonce method.

test/message-generator/test/translation-proxy-old-share/translation-proxy-old-share.json

-107
This file was deleted.

test/message-generator/test/translation-proxy-old-share/translation-proxy-old-share.sh

-10
This file was deleted.

0 commit comments

Comments
 (0)