Skip to content

starknet_transaction_prover: make RPC error spec test exhaustive via enum#14051

Open
avi-starkware wants to merge 1 commit into
avi/privacy/tls-tests-v2from
avi/privacy/exhaustive-error-spec-test-v2
Open

starknet_transaction_prover: make RPC error spec test exhaustive via enum#14051
avi-starkware wants to merge 1 commit into
avi/privacy/tls-tests-v2from
avi/privacy/exhaustive-error-spec-test-v2

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

Replaces the ad-hoc test_cases vec in test_error_responses_match_spec
with a KnownRpcError test-only enum whose spec_key and
sample_error_object matches are exhaustive — adding a new variant
forces both matches to be updated, and the bidirectional set-equality
check between KnownRpcError::ALL and the spec's components/errors
keys guarantees the enum and the OpenRPC spec stay in sync.

Drops the pre-existing 'TODO(Avi): Add an error enum to make this
test exhaustive' tag.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

avi-starkware commented May 17, 2026

@cursor
Copy link
Copy Markdown

cursor Bot commented May 17, 2026

PR Summary

Low Risk
Test-only refactor in rpc_spec_test.rs; no production RPC or error handling behavior changes.

Overview
Refactors test_error_responses_match_spec so OpenRPC error coverage is driven by a test-only KnownRpcError enum instead of a hand-maintained test_cases vector.

Each variant maps to a spec key via spec_key() and to a sample ErrorObjectOwned via sample_error_object(); exhaustive matches mean adding a new RPC error requires updating those methods and listing the variant in KnownRpcError::ALL. The test still checks each sample against SpecError::from_spec, and now also enforces bidirectional sync between KnownRpcError keys and SPEC_ERRORS (with a guard against duplicate keys in ALL). The old TODO about making the test exhaustive is removed.

Reviewed by Cursor Bugbot for commit 93accf4. Bugbot is set up for automated code reviews on this repo. Configure here.

@avi-starkware avi-starkware force-pushed the avi/privacy/tls-tests-v2 branch from b062874 to 1d6f06e Compare May 17, 2026 17:39
@avi-starkware avi-starkware force-pushed the avi/privacy/exhaustive-error-spec-test-v2 branch 2 times, most recently from 3457808 to ac2d30f Compare May 17, 2026 19:07
@avi-starkware avi-starkware force-pushed the avi/privacy/tls-tests-v2 branch from 1d6f06e to 6377a5b Compare May 17, 2026 19:07
@avi-starkware avi-starkware force-pushed the avi/privacy/exhaustive-error-spec-test-v2 branch from ac2d30f to cb3ebef Compare May 20, 2026 08:33
@avi-starkware avi-starkware force-pushed the avi/privacy/tls-tests-v2 branch from 6377a5b to 6a4087a Compare May 20, 2026 08:33
…enum

Replaces the ad-hoc test_cases vec in test_error_responses_match_spec
with a KnownRpcError test-only enum whose spec_key and
sample_error_object matches are exhaustive — adding a new variant
forces both matches to be updated, and the bidirectional set-equality
check between KnownRpcError::ALL and the spec's components/errors
keys guarantees the enum and the OpenRPC spec stay in sync.

Drops the pre-existing 'TODO(Avi): Add an error enum to make this
test exhaustive' tag.
@avi-starkware avi-starkware force-pushed the avi/privacy/exhaustive-error-spec-test-v2 branch from cb3ebef to 93accf4 Compare May 31, 2026 10:39
@avi-starkware avi-starkware force-pushed the avi/privacy/tls-tests-v2 branch from 6a4087a to 44827d2 Compare May 31, 2026 10:39
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.

2 participants