Skip to content

caplin: serialize uint64 beacon API fields as JSON strings#20564

Open
BitWonka wants to merge 1 commit intoerigontech:mainfrom
BitWonka:fix-beacon-api-uint64-json-strings
Open

caplin: serialize uint64 beacon API fields as JSON strings#20564
BitWonka wants to merge 1 commit intoerigontech:mainfrom
BitWonka:fix-beacon-api-uint64-json-strings

Conversation

@BitWonka
Copy link
Copy Markdown

Summary

  • Fixes caplin: execution_requests uint64 fields returned as JSON numbers, should be strings #20562.

  • Per the beacon-APIs spec, Uint64 (and Gwei, which $refs Uint64) 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 uint64 fields as JSON strings via json:",string" tags.
  • Add regression tests validating JSON output for DepositRequest, WithdrawalRequest, Pending* queue types, and validatorIdentityResponse.

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.

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.

caplin: execution_requests uint64 fields returned as JSON numbers, should be strings

2 participants