This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add serialization-control enum for RPC Options #27676
Merged
CriesofCarrots
merged 11 commits into
solana-labs:master
from
CriesofCarrots:tx-meta-serde
Sep 14, 2022
Merged
Add serialization-control enum for RPC Options #27676
CriesofCarrots
merged 11 commits into
solana-labs:master
from
CriesofCarrots:tx-meta-serde
Sep 14, 2022
Conversation
This file contains 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
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
from
September 8, 2022 19:59
b14e2a2
to
70f6492
Compare
@jstarry can you please take a look? Interested in feedback on direction and the api interface, as well as any bikeshedding. I used the new enum for a couple fields in |
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
3 times, most recently
from
September 8, 2022 23:48
1877241
to
e655277
Compare
jstarry
reviewed
Sep 12, 2022
CriesofCarrots
commented
Sep 13, 2022
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
from
September 13, 2022 16:35
fff8b45
to
5bbc93c
Compare
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
4 times, most recently
from
September 14, 2022 01:36
09d2174
to
aeb16ee
Compare
jstarry
reviewed
Sep 14, 2022
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
2 times, most recently
from
September 14, 2022 05:33
6d567ba
to
ca87aff
Compare
jstarry
reviewed
Sep 14, 2022
jstarry
reviewed
Sep 14, 2022
jstarry
reviewed
Sep 14, 2022
jstarry
reviewed
Sep 14, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add tests which enforce the expected json responses of relevant rpc responses?
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
from
September 14, 2022 18:07
ca87aff
to
2eaa98b
Compare
CriesofCarrots
force-pushed
the
tx-meta-serde
branch
from
September 14, 2022 19:10
2eaa98b
to
d364eb9
Compare
Please see first two commits. The tests pass both before and after the other commits in this PR. |
jstarry
approved these changes
Sep 14, 2022
mergify bot
pushed a commit
that referenced
this pull request
Sep 14, 2022
* Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07) # Conflicts: # cli-output/src/display.rs # client/src/mock_sender.rs # transaction-status/src/lib.rs
mergify bot
pushed a commit
that referenced
this pull request
Sep 14, 2022
* Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07)
CriesofCarrots
pushed a commit
that referenced
this pull request
Sep 14, 2022
* Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07)
CriesofCarrots
pushed a commit
to CriesofCarrots/solana
that referenced
this pull request
Sep 14, 2022
* Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07) # Conflicts: # cli-output/src/display.rs # client/src/mock_sender.rs # transaction-status/src/lib.rs
mergify bot
added a commit
that referenced
this pull request
Sep 15, 2022
) * Add serialization-control enum for RPC Options (#27676) * Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07) * Appease incorrect nightly lint Co-authored-by: Tyera Eulberg <[email protected]>
mergify bot
added a commit
that referenced
this pull request
Sep 15, 2022
) * Add serialization-control enum for RPC Options (#27676) * Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07) # Conflicts: # cli-output/src/display.rs # client/src/mock_sender.rs # transaction-status/src/lib.rs * Fix conflicts Co-authored-by: Tyera Eulberg <[email protected]>
CriesofCarrots
pushed a commit
that referenced
this pull request
Sep 15, 2022
) * Add serialization-control enum for RPC Options (#27676) * Add test to verify output when deserializing/reserializing empty fields * Add test to verify serialization from UiTransactionStatusMeta constructors * Add OptionSerializer * Use OptionSerializer for inner_instructions * Use OptionSerializer for loaded_addresses * Remove Default variant, use into instead * Add as_ref implementation * Use OptionSerializer for log_messages and rewards * Use OptionSerializer for token_balances * Use OptionSerializer for return_data * Use OptionSerializer for compute_units_consumed (cherry picked from commit 360ca07) # Conflicts: # cli-output/src/display.rs # client/src/mock_sender.rs # transaction-status/src/lib.rs * Fix conflicts
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
As per #27601 (comment), it would be helpful to have complete control over the serialization of optional fields for JSON-RPC responses.
Summary of Changes
Add OptionSerializer enum and custom Serialize implementation to support skipping, serializing the type default, and serializing None for the same field in different contexts.