Prevent no_std websocket request-id panic when id is missing#314
Draft
Copilot wants to merge 2 commits into
Draft
Prevent no_std websocket request-id panic when id is missing#314Copilot wants to merge 2 commits into
id is missing#314Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix panic in get_random_id for no_std builds
Prevent no_std websocket request-id panic when May 24, 2026
id is missing
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.
High Level Overview of Change
no_stdwebsocket requests could panic whenidwas omitted:set_request_idhitunimplemented!()andrequest_implunwrappedid. This change converts that path to explicit error handling and removes the panic source.XRPLClient::set_request_idno_std behaviorunimplemented!()branch fornot(feature = "std").no_std, missingidis now left unchanged instead of panicking.No_std websocket request path
unwrap()onrequest.get_common_fields().idwith a checked path returningXRPLWebSocketException::InvalidMessage.Regression coverage
no_stdunit test verifyingset_request_iddoes not panic and does not synthesize an ID.Context of Change
The bug was in the no_std websocket request flow: request IDs are auto-generated only in
std, but no_std code still assumed an ID exists and panicked at runtime if callers did not pre-set one. This update makes no_std behavior deterministic and non-panicking by surfacing a normal client error.Type of Change
Before / After
Before (
no_std):After (
no_std):Test Plan
Added unit coverage for
no_stdrequest ID handling insrc/asynch/clients/client.rs:set_request_id_no_std_does_not_panic_or_generate_id