Make stratum implementation align with ckpool #560
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
parasitepool/para#560
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
para too strict
else if (nlen < len) { /* Pad with zeros */ }
para: Strictly rejects with InvalidNonce2Length error
if submit.enonce2.len() != expected_extranonce2_size {
// Send error and reject share
}
ckpool: Silently truncates nonce to 8 characters
if (unlikely(nlen > len)) nonce[len] = '\0'; // len = 8
para: Strict hex parsing via Nonce::from_str
ckpool: Ignores invalid version_mask, uses 0
if (version_mask && strlen(version_mask) && validhex(version_mask)) {
// Only parse if valid
}
// Otherwise version_mask32 stays 0, no error
para: Strict deserialization fails on invalid version
ckpool: Accepts missing password (sets to "")
para: Also accepts (via Option)
para too lenient
ckpool: Requires nonce to be at least 8 hex characters
if (unlikely(!nonce || strlen(nonce) < 8 || !validhex(nonce))) {
err = SE_NO_NONCE; // Error if < 8 chars
}
para: Accepts any valid u32 hex (as short as "0")
let nonce = u32::from_str_radix(s, 16)?; // "0", "1", "abc" all valid
ckpool: Strictly rejects odd-length hex
if (!slen || slen % 2) // Rejects odd length
para: Some hex fields accept odd-length (we just fixed subscribe, but nonce/ntime/version still accept odd-length via from_str_radix)
ckpool: Rejects:
para: Accepts any string, only validates as Bitcoin address later
ckpool: Max 64 characters (strndup(pass, 64))
para: No explicit limit
ckpool: Rejects empty nonce strings
para: Would fail parsing but error message differs
Misc
Nonce2/Nonce Length Tolerance
ckpool auto-corrects malformed nonce2 and nonce values from miners:
(
wb->enonce2varlen), ckpool truncates silently. If longer, it alsotruncates.
nonce[len] = '\0'(stratifier.c:6059).para rejects immediately with
InvalidNonce2Lengthifenonce2.len() != expected_extranonce2_size(stratifier.rs:692). Nonce is deserialized witha fixed 4-byte type so invalid lengths fail at parse time.
Some miner firmware (especially older or buggy implementations) may send
slightly wrong lengths. ckpool silently handles this; para rejects the
share.