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

Soroban xdr value overhaul ScVal.Equals fixes #4815

Merged

Conversation

paulbellamy
Copy link
Contributor

@paulbellamy paulbellamy commented Mar 17, 2023

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've updated the relevant CHANGELOG (here for Horizon) if
    needed with deprecations, added features, breaking changes, and DB schema changes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

Fix the ScVal.Equals method for the soroban xdr value overhaul.

Why

Part of stellar/stellar-cli#477
Needed for #4789, because this change gets the xdr package compiling and passing it's own tests.

Known limitations

[TODO or N/A]

@paulbellamy paulbellamy requested a review from 2opremio March 17, 2023 16:07
@@ -51046,7 +51046,7 @@ func (u *ScVal) DecodeFrom(d *xdr.Decoder) (int, error) {
switch ScValType(u.Type) {
case ScValTypeScvBool:
u.B = new(bool)
nTmp, err = d.Decode((*u.B))
nTmp, err = d.Decode(u.B)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you fix this in xdrgen?

Copy link
Contributor Author

@paulbellamy paulbellamy Mar 20, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

There's another problem at:

func (s *DiagnosticEvent) DecodeFrom(d *xdr.Decoder) (int, error) {
	var err error
	var n, nTmp int
	nTmp, err = d.Decode(s.InSuccessfulContractCall)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we simply need to add bool support to xdrgen

Copy link
Contributor

@2opremio 2opremio left a comment

Choose a reason for hiding this comment

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

Couple of questions. Otherwise LGTM

xdr/scval.go Outdated Show resolved Hide resolved
xdr/scval.go Show resolved Hide resolved
@Shaptic
Copy link
Contributor

Shaptic commented Mar 20, 2023

Just to get the cross-reference: this partially closes #4791.

2opremio added a commit that referenced this pull request Mar 27, 2023
* Gofmt

* update xdr to 7356dc237ee0db5626561c129fb3fa4beaabbac6

* Soroban xdr value overhaul ScVal.Equals fixes (#4815)

* Fix a bug in generated xdr for boolean unmarshalling

* Output more helpful message when scval test fails

* Fix equality for xdr ScVal overhaul

* use bytes.equal

* soroban-xdr-next-next: Fix txnbuild tests (#4817)

* soroban-xdr-next-next: Fix XDR bool encoding/decoding (#4818)

* all: Update libs & tests to support `ScVal`ue overhaul. (#4819)

* services/horizon: Add `account_credited`/`debited` effects for SAC events. (#4806)
* Include contract asset balance changes in payments  (#4807)
* all: Bump supported Go versions to 1.19 and 1.20. (#4810)
* Use version 0.7.0 and 8abd3353c728f09ee1c8a2544f67a853e915afc2 of rs-soroban-sdk dependency
* Embed XDR into a separate file for testing

---------

Co-authored-by: shawn <[email protected]>
Co-authored-by: tamirms <[email protected]>

* ingest: Extract diagnostic events in GetOperationEvents() (#4820)

---------

Co-authored-by: Alfonso Acosta <[email protected]>
Co-authored-by: George <[email protected]>
Co-authored-by: shawn <[email protected]>
Co-authored-by: tamirms <[email protected]>
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