Replay 33 captured BM1366 shares through pool
next-build / build (push) Canceled after 0s

This commit is contained in:
2026-10-15 04:11:00 -06:00
parent a1d8e34390
commit 523ec5fd0b
2 changed files with 34 additions and 25 deletions
+7 -6
View File
@@ -59,12 +59,13 @@ The pool connection applies difficulty and job messages in stream order,
dispatches work to the BM1366 mining session, and tracks up to 32 verified
share submissions by request ID. It counts accepted and rejected pool replies
separately. Continuous scheduling and live pool acceptance remain unverified.
The SDK's strict loopback pool replay test reconstructs the exact first
cv.106 BM1366 captured job from Stratum subscription and notify fields. It
delivers that job through the OS pool client and HAL simulator, replays the
real ASIC nonce, verifies its proof of work independently, and receives a
matching pool ACCEPT. This is host-only evidence for one captured job, not a
stock-firmware boot or a production board adapter.
The SDK's strict loopback pool replay test reconstructs 33 cv.106 BM1366
captured jobs from Stratum subscription and notify fields. It delivers those
jobs through the OS pool client and HAL simulator, replays the real ASIC
nonces, verifies each proof of work independently, and receives 33 matching
pool ACCEPT responses. The 33rd job also exercises the chain reset before
hardware work ID reuse. This is host-only evidence, not a stock-firmware
boot or a production board adapter.
Its cycle helper reads one pool event, drains up to 256 ASIC reports, and sends
verified shares when present. A share reply unanswered for 30 seconds closes
the connection so a caller can reconnect instead of filling the pending
+27 -19
View File
@@ -23,13 +23,17 @@ fn failure(message: impl Into<String>) -> io::Error {
fn main() -> Result<(), Box<dyn Error>> {
let mut args = std::env::args().skip(1);
let socket = args
.next()
.ok_or_else(|| failure("usage: simulator_pool_replay_probe HAL_SOCKET POOL_ADDRESS"))?;
let socket = args.next().ok_or_else(|| {
failure("usage: simulator_pool_replay_probe HAL_SOCKET POOL_ADDRESS [SHARES]")
})?;
let address: SocketAddr = args
.next()
.ok_or_else(|| failure("missing pool address"))?
.parse()?;
let expected_accepts: usize = args.next().map_or(Ok(1), |value| value.parse())?;
if !(1..=64).contains(&expected_accepts) {
return Err(failure("SHARES must be between 1 and 64").into());
}
if args.next().is_some() {
return Err(failure("unexpected argument").into());
}
@@ -50,33 +54,37 @@ fn main() -> Result<(), Box<dyn Error>> {
)
.map_err(|error| failure(format!("pool handshake: {error:?}")))?;
miner.start()?;
let deadline = Instant::now() + Duration::from_secs(10);
let mut saw_work = false;
let mut saw_submit = false;
let deadline = Instant::now() + Duration::from_secs(10 + 2 * expected_accepts as u64);
let mut issued = 0;
let mut submitted = 0;
let mut accepted = 0;
while Instant::now() < deadline {
let (event, reports) = pool
.cycle(&mut miner)
.map_err(|error| failure(format!("mining cycle: {error:?}")))?;
if reports
submitted += reports
.iter()
.any(|report| matches!(report, ReportEvent::Submitted(_)))
{
saw_submit = true;
}
.filter(|report| matches!(report, ReportEvent::Submitted(_)))
.count();
match event {
PoolEvent::Work(work) => {
if work.header != CAPTURED_HEADER {
if issued == 0 && work.header != CAPTURED_HEADER {
return Err(failure("pool job differs from real-silicon capture").into());
}
saw_work = true;
}
PoolEvent::ShareAccepted(_) if saw_work && saw_submit => {
miner.stop()?;
println!("BM1366 real captured nonce accepted by strict loopback pool");
return Ok(());
issued += 1;
}
PoolEvent::ShareAccepted(_) => {
return Err(failure("unattributed pool acceptance").into())
if accepted >= submitted || accepted >= issued {
return Err(failure("unattributed pool acceptance").into());
}
accepted += 1;
if accepted == expected_accepts {
miner.stop()?;
println!(
"BM1366 real captured nonce accepted by strict loopback pool ({accepted} shares)"
);
return Ok(());
}
}
PoolEvent::ShareRejected(_) => return Err(failure("pool rejected share").into()),
_ => {}