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

fix: parse XDR Result to JSON; encode RawVal return types #541

Merged
merged 3 commits into from
Mar 31, 2023

Conversation

chadoh
Copy link
Contributor

@chadoh chadoh commented Mar 29, 2023

What

Two new tests show some errors that revealed themselves while adding CLI tests:

Why

These tests expose real problems that have existed in soroban-cli's main branch since updating to the latest XDR definitions

Known limitations

N/A

chadoh and others added 2 commits March 29, 2023 15:04
The test here copies the logic of [the errors
example](https://github.com/stellar/soroban-examples/blob/main/errors/src/lib.rs),
showing that valid `Ok` results were not being correctly parsed to JSON.

Co-authored-by: Willem Wyndham <[email protected]>
Copy link
Contributor

@paulbellamy paulbellamy left a comment

Choose a reason for hiding this comment

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

Approved, as this is strictly better than what we have, and we can do a follow-up PR to address val != ScVal::Void && output == ScType::Val case.

cmd/soroban-cli/src/strval.rs Show resolved Hide resolved
@willemneal
Copy link
Member

The reason that we we used both was for the UDT cases. That is JSON -> ScVal for Enums and Structs differs than if we use ScVal -> JSON

@paulbellamy paulbellamy enabled auto-merge (squash) March 31, 2023 19:10
@paulbellamy paulbellamy merged commit 4ffd829 into stellar:main Mar 31, 2023
@chadoh chadoh deleted the fix/xdr-result-to-json branch March 31, 2023 19:56
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