Skip to content

Add a script for converting frozen ledger key settings to hex. - #5246

Merged
dmkozh merged 1 commit into
stellar:masterfrom
dmkozh:cap77_script
Apr 25, 2026
Merged

dmkozh merged 1 commit into
stellar:masterfrom
dmkozh:cap77_script

Conversation

@dmkozh

@dmkozh dmkozh commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Description

Add a script for converting frozen ledger key settings to hex.

Most systems use base64 XDR encoding, so chances are the keys to freeze will be base64. However, the settings update parser expects hex encoding for the bytes fields. Instead of making the parser more sophisticated and ambiguous (as hex is technically valid base64), just use a converter script.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

Most systems use base64 XDR encoding, so chances are the keys to freeze will be base64. However, the settings update parser expects hex encoding for the bytes fields. Instead of making the parser more sophisticated and ambiguous (as hex is technically valid base64), just use a converter script.
Copilot AI review requested due to automatic review settings April 24, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a helper script under scripts/ to convert frozen-ledger-key settings JSON fields from base64-encoded XDR bytes to lowercase hex, intended to match the settings upgrade JSON parser’s expected encoding.

Changes:

  • Introduces scripts/frozen_keys_base64_to_hex.py, a CLI tool that scans a settings JSON document and rewrites selected key lists to hex in-place.

Comment thread scripts/frozen_keys_base64_to_hex.py Resolved
Comment thread scripts/frozen_keys_base64_to_hex.py Resolved
Comment thread scripts/frozen_keys_base64_to_hex.py Resolved
@dmkozh
dmkozh requested a review from anupsdf April 24, 2026 18:15

@anupsdf anupsdf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I tested locally and it works.
Only possible improvement could be to guard against re-runs i.e. make it idempotent

@dmkozh

dmkozh commented Apr 25, 2026

Copy link
Copy Markdown
Contributor Author

Only possible improvement could be to guard against re-runs i.e. make it idempotent

It already is, we check for 2 leading 0 bytes - these will never be present in base64, and always be present in hex for the LedgerKey XDR.

@dmkozh
dmkozh added this pull request to the merge queue Apr 25, 2026
Merged via the queue into stellar:master with commit cc4b64d Apr 25, 2026
71 checks passed
@dmkozh
dmkozh deleted the cap77_script branch April 25, 2026 00:59
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.

3 participants