-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tproxy: HexError(OddLength)
in mining.subscribe
#896
Comments
also, it took me some time to figure out how to reproduce this bug deterministically. this issue is a good place to register my findings here are instructions to reproduce the (potential) bug via
|
I'm also backtracing the bug to find the root cause: inside
which calls stratum/roles/translator/src/lib/downstream_sv1/downstream.rs Lines 375 to 381 in 24b8b1d
which calls stratum/protocols/v1/src/lib.rs Line 77 in 24b8b1d
the issue seems to be in the stratum/protocols/v1/src/methods/mod.rs Lines 142 to 146 in 24b8b1d
the nested stratum/protocols/v1/src/methods/mod.rs Lines 214 to 229 in 24b8b1d
the nested stratum/protocols/v1/src/methods/client_to_server.rs Lines 313 to 342 in 24b8b1d
|
after going through the backtrace above, it seems the root cause of the issue is this specific line:
it is calling if
so the question here is: on an improvement to our tProxy implementation is to make it clear to the user that the provided [JString(a), JString(b)] => {
+ if b.len() % 2 == 1 {
+ tracing::error!("Make sure the provided extranonce is a valid hex string. Beware that faulty SV1 firmware could send invalid extranonces with odd string length");
+ }
(a.into(), Some(Extranonce::try_from(hex::decode(b)?)?))
} |
hey @nikicat I just re-read #851 (comment)
Did you see this with:
Tying back to the question I asked on my comment above (which is outside the scope of my SV1 knowledge):
Or in other words, does this situation ( |
as a potential answer to my question from the above comments:
if the |
@nikicat confirmed to me that this behavior was generated from a real machine. It is probably running crazy firmware that is not compliant with SV1 spec. |
closed via #851 |
Not sure that we should accept odd len string. 1 byte is always 2 char so how is possible to have an odd len string? You assume a leading 0 that is not in the string, where is the 0? I would rather close the connection since invalid coinbase means invalid block. (for example when the extranonce end up being 1 byte shorter or longer). If we are 100% that this can not happen, and we want to accept odd len string, we should document why is ok to accept odd len string. |
I think one way to be 100% sure is to reproduce this scenario via MG and check if it results on an invalid block.
@Fi3 would you agree with this approach? |
yep make sense |
ok I changed my mind... even though I'm 100% in favor of writing as many MG tests as possible, I don't think it's worth the effort on this issue. From my research listed above, this is an impossible situation on a protocol level, and @Fi3 seems to be in agreement with this. Even if this happens on real ASICs (@nikicat mentioned https://www.miningrigrentals.com), this seems to be a fault on firmware side that could potentially end up in invalid blocks, so I agree it should be rejected by tProxy. I propose we revert #851 via #952 and finally close this issue. |
@nikicat we appreciate your contribution, I hope this doesn't take your motivation away if you still want to help SRI, I have a suggestion on this comment: #896 (comment) feel free to turn it into a new PR |
closed via #952 |
Hello, it's a little frustrating that fixing this bug took less time than the discussion about whether the fix should be accepted.
So, if you are not willing to accept such changes, what in your opinion is a "true fix" for my or similar cases? As you understand, I can't force miner owners to somehow "fix" their miners (I suppose they can't even if they wanted to). Should it be a (separate from Stratum) translation proxy that fixes "broken" stratum v1 messages? Or should it be just a more permissive fork of Stratum (this is my actual solution)? I just want to know your policy and plans so I can better allocate my time on this project. |
I wrote a proposal on this comment: #896 (comment) I understand your frustration, but from an objectively technical standpoint, a Proxy that allows for shares on invalid blocks is not a sane implementation of the protocol economically speaking, the fact that there is faulty SV1 firmware in the wild is a market inefficiency, and you should re-evaluate on whether miningrigrentals.com is meeting your business needs. My advice is that you give them this feedback and look for alternatives.
if that is all you need, just drop a ckpool-solo. It's been around for ages and I already mined a bunch of |
As far as I can tell all produced blocks are valid with this patch.
From my point of view, they work fine - I've got a bunch of testnet3 (and later testnet4) BTC for a reasonable price of several bucks. |
I'll look through it, thanks. But, taking into account that it's written in C and the time I've spent with the Stratum codebase, I think it's currently easier for me to continue working with Stratum. |
recently we had PR #851 by @nikicat
I noticed we didn't have an issue here on github to track this (potential) bug
The text was updated successfully, but these errors were encountered: