caplin: serialize uint64 beacon API fields as JSON strings#20564
Open
BitWonka wants to merge 1 commit intoerigontech:mainfrom
Open
caplin: serialize uint64 beacon API fields as JSON strings#20564BitWonka wants to merge 1 commit intoerigontech:mainfrom
BitWonka wants to merge 1 commit intoerigontech:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Caplin beacon API JSON serialization to comply with the beacon-APIs spec requirement that Uint64/Gwei fields be encoded as JSON strings (not numbers), addressing parsing failures in spec-compliant clients.
Changes:
- Update multiple Caplin response structs to serialize relevant
uint64fields as JSON strings viajson:",string"tags. - Add regression tests validating JSON output for
DepositRequest,WithdrawalRequest,Pending*queue types, andvalidatorIdentityResponse.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cl/cltypes/solid/withdrawal.go | Encode WithdrawalRequest.Amount and PendingPartialWithdrawal uint64 fields as JSON strings. |
| cl/cltypes/solid/deposits.go | Encode DepositRequest/PendingDeposit uint64 fields as JSON strings. |
| cl/cltypes/solid/consolidation.go | Encode PendingConsolidation indices as JSON strings. |
| cl/beacon/handler/validators.go | Encode validatorIdentityResponse uint64 fields as JSON strings. |
| cl/cltypes/solid/withdrawal_test.go | Regression tests for JSON string serialization of withdrawal-related types. |
| cl/cltypes/solid/deposits_test.go | Regression tests for JSON string serialization of deposit-related types. |
| cl/cltypes/solid/consolidation_test.go | Regression test for JSON string serialization of PendingConsolidation. |
| cl/beacon/handler/validators_test.go | Regression test for JSON string serialization of validatorIdentityResponse. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Fixes caplin: execution_requests uint64 fields returned as JSON numbers, should be strings #20562.
Per the beacon-APIs spec,
Uint64(andGwei, which$refsUint64) fields must be serialized as JSON strings. Several Caplin response types were emitting them as JSON numbers, causing spec-compliant clients to fail parsing.Behavior change: This is a spec-compliance fix. Consumers that were parsing these fields as JSON numbers will need to update, but those scripts were already non-portable, since every other CL client emits strings per spec