Skip to content

allow implementations to use error codes for automated actions#194

Open
plebhash wants to merge 3 commits into
stratum-mining:mainfrom
plebhash:2026-04-30-automated-action-error-codes
Open

allow implementations to use error codes for automated actions#194
plebhash wants to merge 3 commits into
stratum-mining:mainfrom
plebhash:2026-04-30-automated-action-error-codes

Conversation

@plebhash
Copy link
Copy Markdown
Member

as discussed in #165

more specifically, this PR implements suggestion from #165 (comment)

@plebhash
Copy link
Copy Markdown
Member Author

plebhash commented Apr 30, 2026

with the changes on this PR:

  • the spec allows for implementations to take automated actions on error_code strings
  • the spec does not force implementations to use specific error_code strings

so we end up in a situation where different implementations could be aiming for the same error_code string, but still be subject to small typo or encoding issues

while that is hard to avoid without major spec changes, SRI can greatly reduce the room for such scenarios by providing types for commonly-used error_code strings

that will be tackled via stratum-mining/stratum#2142

Comment thread 03-Protocol-Overview.md

The protocol uses string error codes.
The list of error codes can differ between implementations, and thus implementations MUST NOT take any automated action(s) on the basis of an error code.
Implementations MAY use error codes for automated actions. The list of error codes can differ between implementations, and therefore implementations MUST do a logging no-op for unknown error codes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly this seems like a recipe for people complaining about incompatibility. If a pool is rejecting shares, it's important that clients switch to a fallback irrespective of what error message they're getting back.

It's still not really clear to me what automated action we expect clients to take based on errors - the only automated action you can really ever do is switch to a fallback pool and notify the operator somehow, and that needs to be independent of the error code itself.

We should clarify this, at least, to mention that because pools may use different error messages it's critical that clients' fallback behavior is not (materially) impacted by the error string itself.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added 69565f4 with the following sentence:

Essential fallback or recovery behavior MUST NOT rely on receiving a specific error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants