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

xdr: changes for auth and removal of mutli-invoke (wip) #4900

Conversation

chowbao
Copy link
Contributor

@chowbao chowbao commented Jun 5, 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

#4895
Updates to support auth and removal of multi-invoke

  • xdr changes up to stellar/stellar-xdr@de264d8
  • Core version 19.11.1-1328.cfa6a8918.focal~authchanges
  • All instances of InvokeHostFunctions changed to InvokeHostFunction with only single HostFunction
  • txnbuild updates
    • Added Auth []xdr.SorobanAuthorizationEntry to InvokeHostFunction struct
  • Ingest
    • Replace GetOperationEvents with GetDiagnosticEvents to return diagnostic events
  • Update Horizon operation_processor_tests for new InvokeHostFunction format
  • sac_test updated to use ResultMetaXdr to get the InvokeHostFunction return ScVal

Why

Updates needed for preview 10

Known limitations

[TODO or N/A]

@chowbao chowbao requested a review from tsachiherman June 5, 2023 20:36
@chowbao
Copy link
Contributor Author

chowbao commented Jun 5, 2023

@tsachiherman I pulled in the xdr changes needed to update the generated xdr.
I did this basically by updating/copying from stellar-xdr. Is there anything else y'all usually do to update xdr changes?

Currently trying to get/build the new stellar-core image

Next will try to update the horizon ingest processors

@@ -22,6 +22,7 @@ codegen-units = 1
lto = true

[workspace.dependencies.soroban-sdk]
version = "0.8.0"
# TODO: Does a new version need to be released to update to 8a7d2c3c8c5bc1664ab38f977ff947cc2a26d694
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tsachiherman Unsure if there is any change needed to https://github.com/stellar/rs-soroban-sdk to update the version.
From looking at this these changes are just used to generate wasm testdata

@@ -15,7 +15,7 @@ xdr/Stellar-internal.x \
xdr/Stellar-contract-config-setting.x

XDRGEN_COMMIT=80e38ef2a96489f6b501d4db3a350406e5aa3bab
XDRNEXT_COMMIT=2f16687fdf6f4bcfb56805e2035f69997f4b34c4
XDRNEXT_COMMIT=de264d81ea87dfaa19e089b60fed8eb0219b2ab4
Copy link
Contributor

Choose a reason for hiding this comment

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

@chowbao , did you run make xdr-update after this change to create the updates on .x files and generated code, or did you manually copy those .x over and run generate, probably is same end result, was just curious which approach.

Copy link
Contributor Author

@chowbao chowbao Jun 12, 2023

Choose a reason for hiding this comment

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

Yeah I updated the XDRNEXT_COMMIT then ran make xdr-update. I guess copying the files would have worked too but I still would have had to run like make xdr to get the generated xdr

@@ -1122,7 +1122,7 @@ func (s *AssetStatsProcessorTestSuiteLedger) TestUpdateContractIDError() {

s.Assert().EqualError(
s.processor.Commit(s.ctx),
"attempting to set contract id b729e13867d5c4b2d161574e00854fd41bbba3e3b0e31d36c64904414a862fa7 but row credit_alphanum4/EUR/GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H already has contract id set: 6645621141097c0f88b99360ce267c3396bcfd8cfdbe9c462b0dc167b72ecdc4",
"attempting to set contract id 67b1f192e30d8cd56dcb103c783cfee753588a434ad1092ef8a39375c9738bab but row credit_alphanum4/EUR/GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H already has contract id set: c9cd6bbf712cfd4e086f0e25f90722c1af24416c0303728ad4527a6967ddc51b",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if these changes to the contract Ids are correct or not. These were all updated to the results from running the tests

git = "https://github.com/stellar/rs-soroban-sdk"
rev = "090f5c88e8f8b67f4d02010665aedfea6ee43db3"
rev = "8a7d2c3c8c5bc1664ab38f977ff947cc2a26d694"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently not able to cargo build due to rs-soroban-sdk differences

@tsachiherman tsachiherman changed the base branch from soroban-xdr-next to soroban-xdr-next-next June 13, 2023 18:14
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

rebasing to soroban-xdr-next-next so that we can keep working on this one while doing changes to soroban-rpc.

@tsachiherman tsachiherman marked this pull request as ready for review June 13, 2023 18:17
@tsachiherman tsachiherman merged commit 67d249d into stellar:soroban-xdr-next-next Jun 13, 2023
tsachiherman added a commit that referenced this pull request Jul 11, 2023
* all: enforce simplified Golang code (#4852)

* Update completed sprint on issue/pr closed (#4857)

* Bump core image to latest stable release v19.10.0

* Add a simple test for asset case sorting in ascii (#4876)

* services/horizon: Suppress Core timeout error (#4860)

Suppress Core timeout error when ingestion state machine is in build state.

* Update CHANGELOG.md for latest release (#4828)

* Bump core image to latest release v19.11.0 (#4885)

* services/horizon: Protect 'currentState' variable using Mutex to prevent race condition. (#4889)

* services/horizon: Update default for  --captive-core-use-db to true (#4877)

* 4856: Update default for  --captive-core-use-db to true
* Update CHANGELOG.md

* xdr: changes for auth and removal of mutli-invoke (wip) (#4900)

* updated core git ref for tests (#4879)

* update toml to support LIMIT_TX_QUEUE_SOURCE_ACCOUNT (#4882)

* horizon/ingest/processors: SAC storage entry by different key name (#4884)

* services/horizon: Reenable InvokeHostFunction integration tests (#4887)

* horizon: 4446/supress core timeout error (#4894)

* services/horizon: Suppress Core timeout error (#4860)
* services/horizon: Protect 'currentState' variable using Mutex to prevent race condition. (#4889)
* services/horizon: Modify the tests due to changes in the Begin function signature.

* xdr: changes for auth and removal of mutli-invoke (wip)

* services/horizon: Reenable SAC integration tests (#4891)

* services/horizon: optionally add soroban-rpc to integration tests (#4892)

* Update core image

* Update stellar-xdr next commit

* Update horizon ingestion

* update txnbuild

* Updates

* Update fmt

* fix txnbuild tests

* updates

* Update horizon tests

* add ingest test

* Update operation processor test

* Update tests

* Update tests

* Remove sac test changes to resolve merge conflicts for now

* Formatting

* 4902 Add mutex for concurrent access in GetLatestLedgerSequence (#4903)

* Update tests

* Update sac test

* update tests

---------

Co-authored-by: shawn <sreuland@users.noreply.github.com>
Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>
Co-authored-by: Alfonso Acosta <alfonso@stellar.org>
Co-authored-by: urvisavla <urvi.savla@stellar.org>

* services/horizon: Improve error handling for when stellar-core crashes (#4893)

* Parse LIMIT_TX_QUEUE_SOURCE_ACCOUNT in core config

* updated changelog for 2.26.0 release notes

* Pinning and updates golang and ubuntu images

* xdr: update per 7b403105 (#4923)

* Simplify ScError.Equals

* Add missing case for ScVal.Equals

* Add LedgerEntry.SetContractData and LedgerEntry.SetContractCode methods

* xdr updates

* fix formatting

* update

* update transfer_event_xdr.bin

* update

* update

* update

* bugfix

* update

* update

* update

* handle nil entries

* fix few linting issues

* additional linting

* Fix missing err check

* fix missing nil check

* Minor code checker fix

* Fix minor naming

* fix hard-coded values.

* warn and don't set expiration ledger

* Warn and don't set expirationLedger

* update new xdr

* update per peer review.

* Add effect for bumpFootprintExpirationOp

* Fix govet-caught bug

* update per 7b403105788e33044e089c4c2f957df8ddabaca8

* update fmt

* fix unit test

* Update core image

---------

Co-authored-by: Paul Bellamy <paul@stellar.org>
Co-authored-by: Simon Chow <simon.chow@stellar.org>

* services/horizon: Fix ledger endpoint url in HAL (#4928)

* Don't crash on LedgerCloseMetaV2 ingestion (#4927)

* xdr: update per xdr version e372df9 (#4930)

* update

* update

* update

* bugfix

* update

* update per linter

* update per peer review.

* Update to use 19.11.1-1349.fae91b092.focal~soroban

* Goreplay middleware (#4932)

* tools/goreplay-middleware: Add goreplay middleware
* Fix linter errors

---------
Co-authored-by: Bartek Nowotarski <bartek@nowotarski.info>

* Update to final core preview 10 image

* all: Fix improper use of errors.Wrap (#4926)

* all: Fix improper use of errors.Wrap

`errors.Wrap` method returns nil if the first argument passed is also nil.
If `errors.Wrap` is copied from a condition like `if err != nil` to another
one which  also returns `errors.Wrap` but does not overwrite `err` before
the returned value will always be `nil`.

* Update services/horizon/internal/db2/history/claimable_balances.go

Co-authored-by: George <Shaptic@users.noreply.github.com>

---------

Co-authored-by: George <Shaptic@users.noreply.github.com>
Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>

* fix apt repo reference to focal now (#4929)

* LedgerChangeReader: Support State Expiration & Eviction (#4941)

* Simplify ScError.Equals

* Add missing case for ScVal.Equals

* Add LedgerEntry.SetContractData and LedgerEntry.SetContractCode methods

* update generated xdr to 0f5e556

* Add LedgerCloseMetaV2 support

* Update ledgerTransaction.GetOperationEvents

* Make LedgerChangeReader emit evictions

* Fixing up after merge

* Add test for LedgerChangeReader extensions and evictions

* Fix typo

* Add xdr.LedgerEntryData.ExpirationLedgerSeq helper

* review feedback

* merge latest master to soroban-xdr-next-next (#4937)

* all: enforce simplified Golang code (#4852)

* Update completed sprint on issue/pr closed (#4857)

* Bump core image to latest stable release v19.10.0

* Add a simple test for asset case sorting in ascii (#4876)

* services/horizon: Suppress Core timeout error (#4860)

Suppress Core timeout error when ingestion state machine is in build state.

* Update CHANGELOG.md for latest release (#4828)

* Bump core image to latest release v19.11.0 (#4885)

* services/horizon: Protect 'currentState' variable using Mutex to prevent race condition. (#4889)

* services/horizon: Update default for  --captive-core-use-db to true (#4877)

* 4856: Update default for  --captive-core-use-db to true
* Update CHANGELOG.md

* services/horizon: Improve error handling for when stellar-core crashes (#4893)

* Parse LIMIT_TX_QUEUE_SOURCE_ACCOUNT in core config

* updated changelog for 2.26.0 release notes

* Pinning and updates golang and ubuntu images

* services/horizon: Fix ledger endpoint url in HAL (#4928)

* Goreplay middleware (#4932)

* tools/goreplay-middleware: Add goreplay middleware
* Fix linter errors

---------
Co-authored-by: Bartek Nowotarski <bartek@nowotarski.info>

* all: Fix improper use of errors.Wrap (#4926)

* all: Fix improper use of errors.Wrap

`errors.Wrap` method returns nil if the first argument passed is also nil.
If `errors.Wrap` is copied from a condition like `if err != nil` to another
one which  also returns `errors.Wrap` but does not overwrite `err` before
the returned value will always be `nil`.

* Update services/horizon/internal/db2/history/claimable_balances.go

Co-authored-by: George <Shaptic@users.noreply.github.com>

---------

Co-authored-by: George <Shaptic@users.noreply.github.com>
Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>

* fix apt repo reference to focal now (#4929)

* fixed go fmt on bindata

* fixed merge conflict snippet

* fixed manual merge commit omition

---------

Co-authored-by: Alfonso Acosta <alfonso@stellar.org>
Co-authored-by: Paul Bellamy <paul@stellar.org>
Co-authored-by: Mehmet <119539688+mbsdf@users.noreply.github.com>
Co-authored-by: mlo <marta.lohova@gmail.com>
Co-authored-by: urvisavla <urvi.savla@stellar.org>
Co-authored-by: stellarsaur <126507441+stellarsaur@users.noreply.github.com>
Co-authored-by: Molly Karcher <molly@stellar.org>
Co-authored-by: Bartek Nowotarski <bartek@nowotarski.info>
Co-authored-by: George <Shaptic@users.noreply.github.com>
Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>

* Refactor `xdr.LedgerEntry.LedgerKey` method (#4942)

* Simplify ScError.Equals

* Add missing case for ScVal.Equals

* Add LedgerEntry.SetContractData and LedgerEntry.SetContractCode methods

* update generated xdr to 0f5e556

* Add LedgerCloseMetaV2 support

* Update ledgerTransaction.GetOperationEvents

* Make LedgerChangeReader emit evictions

* Fixing up after merge

* Add test for LedgerChangeReader extensions and evictions

* Fix typo

* Add xdr.LedgerEntryData.ExpirationLedgerSeq helper

* review feedback

* Refactor LedgerEntry.LedgerKey method to avoid panics, and only have a single copy

* Fix govet.sh

* Fixing govet

* Fix bug

* Remove unneeded code bits

* s/marshalling/marshaling

* Review feedback

* integration tests: Add horizon test support for new bump/restore footprint ops (#4944)

* use the new core image for local integration tests

* Add bump/restoreFootprint ops to the horizon reingestion integration tests

* services/horizon: Remove command line flag --remote-captive-core-url (#4940)

* txnbuild: Make bump and restore footprint soroban operations (#4946)

* integration tests: fix integration tests for preview 10 (#4938)

this pr fixes the invokehostfunciton_test only, sac_test and contract event tests will be addressed in separate, follow-onw pr.

* fix sac tests for preview 10 data model (#4951)

* fix merge issue.

---------

Co-authored-by: Alfonso Acosta <alfonso@stellar.org>
Co-authored-by: Paul Bellamy <paul@stellar.org>
Co-authored-by: Mehmet <119539688+mbsdf@users.noreply.github.com>
Co-authored-by: mlo <marta.lohova@gmail.com>
Co-authored-by: urvisavla <urvi.savla@stellar.org>
Co-authored-by: stellarsaur <126507441+stellarsaur@users.noreply.github.com>
Co-authored-by: chowbao <simon.chow765@gmail.com>
Co-authored-by: shawn <sreuland@users.noreply.github.com>
Co-authored-by: Molly Karcher <molly@stellar.org>
Co-authored-by: Shawn Reuland <shawn@stellar.org>
Co-authored-by: Simon Chow <simon.chow@stellar.org>
Co-authored-by: Bartek Nowotarski <bartek@nowotarski.info>
Co-authored-by: George <Shaptic@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants