Extract PRISM share submission - #77
Open
kiwidream wants to merge 1 commit into
Open
Conversation
This comment has been minimized.
This comment has been minimized.
kiwidream
force-pushed
the
prism-block-candidate-submission
branch
from
July 20, 2026 14:42
ff16f0f to
eb1743c
Compare
kiwidream
force-pushed
the
prism-share-submission
branch
from
July 20, 2026 14:42
cdf110a to
3eafe82
Compare
kiwidream
force-pushed
the
prism-block-candidate-submission
branch
from
July 20, 2026 15:28
eb1743c to
8a9d23f
Compare
kiwidream
force-pushed
the
prism-share-submission
branch
from
July 20, 2026 15:28
3eafe82 to
4b369f0
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4b369f0. Configure here.
kiwidream
force-pushed
the
prism-block-candidate-submission
branch
from
July 20, 2026 15:34
8a9d23f to
b668e77
Compare
kiwidream
force-pushed
the
prism-share-submission
branch
2 times, most recently
from
July 20, 2026 16:02
44e43cc to
af51efe
Compare
kiwidream
force-pushed
the
prism-block-candidate-submission
branch
2 times, most recently
from
July 20, 2026 16:58
894d810 to
c621599
Compare
kiwidream
force-pushed
the
prism-share-submission
branch
from
July 20, 2026 16:58
af51efe to
60b212e
Compare
This was referenced Jul 20, 2026
kiwidream
force-pushed
the
prism-share-submission
branch
from
July 22, 2026 13:50
60b212e to
a87052f
Compare
kiwidream
force-pushed
the
prism-block-candidate-submission
branch
from
July 22, 2026 13:50
c621599 to
76e54d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Position in the stack
PR 5 of 9. Base:
prism-block-candidate-submission. Depends on PR 76. Next: PR 78.Review this PR against its configured base. See the stack guide for the complete order.
Why this slice exists
Stratum submit handling combines parsing, job/tip classification, duplicate identity, difficulty checks, durable share acceptance, and block-candidate routing. Moving those decisions into a dedicated service makes the acknowledgement boundary and rejection reasons testable without coordinator-wide state.
What changes
share_submission.ShareSubmissionServicewith explicit ports for jobs, rejection, ledger append, and candidate enqueue.RecentShareIndexcapped at 50,000 entries.Reading the diff
The roughly 970 additions and 310 deletions consist of the new service, a direct 244-line owner test suite, and coordinator rewiring. The decision logic is relocated rather than duplicated. Review the pure parser/classifier helpers first, then the service acknowledgement path, duplicate index, ports, and coordinator delegate.
Intentional bounded change
At capacity, duplicate tracking now evicts the oldest entries instead of clearing the entire set. This bounds memory while avoiding the large retry-safety gap created by an all-at-once reset. Duplicate identity still uses immutable job worker and header information.
Validation
git diff --checkpassed.Operator impact
No schema or configuration action is introduced by this slice.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Note
Medium Risk
Touches the mining hot path (ack/reject, stale-grace, ledger append, block-candidate routing); behavior is intended to be preserved but duplicate-window eviction changed from full clear to LRU-style eviction at capacity.
Overview
Stratum submit handling moves out of
PrismCoordinatorinto newlab/prism/share_submission.py.handle_submitbecomes a one-line delegate to lazily builtShareSubmissionService, which wires coordinator behavior through explicit ports (reject, control snapshot, ledger, share writer, block-candidate enqueue, etc.).Pure helpers (
parse_submit_request,validate_submit_request,classify_submit_context,classify_submit_work) own wire parsing, job/tip/stale-grace classification, difficulty routing, and share vs async vs synchronous block paths—same rejection reasons and outcomes as before, now unit-tested intests/test_prism_share_submission.py.Duplicate detection shifts from coordinator
_recent_share_lock+ a set that cleared entirely past 50k entries toRecentShareIndex: thread-safe, insertion-ordered, 50k cap with oldest-entry eviction. Reserve/release go through the service;recent_share_keysis a compatibility descriptor over the index.Share-related rejection string constants are centralized in
share_submissionand re-imported by the coordinator.Reviewed by Cursor Bugbot for commit a87052f. Bugbot is set up for automated code reviews on this repo. Configure here.