Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compare sub-command to cli #398

Merged
merged 4 commits into from
Oct 1, 2024
Merged

Add compare sub-command to cli #398

merged 4 commits into from
Oct 1, 2024

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Sep 29, 2024

What

Add compare sub-command to cli that compares XDR values returning a -1 for less-than, 0 for equal, and 1 for greater-than.

Example

An ScVal symbol with value "Ed25519" is less than "Policy":

$ stellar-xdr compare \
    --type ScVal \
    <(echo '{"symbol":"Ed25519"}' | stellar-xdr encode --type ScVal) \
    <(echo '{"symbol":"Policy"}' | stellar-xdr encode --type ScVal)
-1

Why

Stellar SDKs are having to write logic for sorting ScVal's specifically, and this tool will help with testing and verifying SDK implementations since the Rust XDR lib can already do the ordering.

@leighmcculloch leighmcculloch marked this pull request as ready for review September 29, 2024 12:16
@leighmcculloch leighmcculloch added this pull request to the merge queue Oct 1, 2024
Merged via the queue into main with commit 27a6456 Oct 1, 2024
11 checks passed
@leighmcculloch leighmcculloch deleted the cmp branch October 1, 2024 01:47
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.

2 participants