Skip to content

Error codes for spec-tests#585

Merged
GalRogozinski merged 6 commits intomainfrom
error-codes
Oct 22, 2025
Merged

Error codes for spec-tests#585
GalRogozinski merged 6 commits intomainfrom
error-codes

Conversation

@iurii-ssv
Copy link
Contributor

@iurii-ssv iurii-ssv commented Oct 8, 2025

Resolves #514 to implement error-code-based checks in tests (to replace error-message-based ones),

the general approach I took is:

  • go over all the tests that assert on the expected error message
  • "turn that error-message into an error-code" and assert on the error-code instead (the implementation returns an error that has both code and message, in spec-tests only the error-code is asserted on to allow for updating error-messages without tripping spec-tests - this is mostly useful for upgrading consensus code in https://github.com/ssvlabs/ssv without having to update the mirroring error-messages in this repo)
  • there are some errors that are not checked for by any of the tests, and hence that means those errors are left unchanged (I did not create a corresponding error-code for those) ... I think it's OK for now (if somebody adds a test that needs such an error to have an error-code it would be easy to add following the approach I'm using in this PR)
  • all error-codes are listed in types/error.go file
  • besides the changes to spec-tests (and their corresponding generated .json files), the only other notable change this PR introduces is to split the invalid partial sig slot error (in validatePartialSigMsgForSlot func) into 2 distinct errors invalid partial sig slot and future partial sig msg to be able to differentiate between messages we want to retry vs messages we want to drop (as is implemented in runners: robust message replay ssv#2445)

@iurii-ssv iurii-ssv marked this pull request as draft October 8, 2025 12:31
@iurii-ssv iurii-ssv marked this pull request as ready for review October 8, 2025 17:23
GalRogozinski
GalRogozinski previously approved these changes Oct 16, 2025
Copy link
Contributor

@GalRogozinski GalRogozinski left a comment

Choose a reason for hiding this comment

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

Good job!

@GalRogozinski GalRogozinski requested a review from dknopik October 19, 2025 09:37
y0sher
y0sher previously approved these changes Oct 19, 2025
Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

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

LGTM, but this also means enforcing adding an error code each time an error is added.

@iurii-ssv iurii-ssv dismissed stale reviews from y0sher and GalRogozinski via bb99f70 October 20, 2025 08:26
@y0sher y0sher requested a review from GalRogozinski October 22, 2025 13:03
@GalRogozinski GalRogozinski merged commit 65def99 into main Oct 22, 2025
2 checks passed
@GalRogozinski GalRogozinski deleted the error-codes branch October 22, 2025 13:24
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.

Start using error codes

4 participants