Skip to content

soroban-rpc: Migrate Soroban Tools to Soroban RPC - #2

Merged
stellarsaur merged 638 commits into
mainfrom
soroban-tools-migration
Jan 17, 2024
Merged

stellarsaur merged 638 commits into
mainfrom
soroban-tools-migration

Conversation

@stellarsaur

Copy link
Copy Markdown
Contributor

See tracking issue for more context.

This PR migrates soroban-tools in its entirety to soroban-rpc. A follow-up PR will remove all code unnecessary for Soroban RPC.

leighmcculloch and others added 30 commits June 17, 2023 06:10
-  feat: upgrade Freighter; fix "view" calls

- if the transaction only needs to be simulated, then the user doesn't
  need to have Freighter connected. This now uses a default/dummy
  account for such calls, but throws an error if the app author tries to
  `signAndSend` such calls.

- use the new methods from `freighter-api@1.5.0` to avoid popping
  pop-ups over and over every time a view call is invoked

- this version correctly pins the stellar-base version, so we can remove
that from the explicit list of dependencies
* redirect stdout to /dev/null since we don't really care about that output.

* update to align with other repos.
* Add package-based soroban-rpc Dockerfile

### What

This PR adds new soroban-rpc Dockerfile that uses official
SDF deb packages as source of stellar-soroban-rpc and stellar-core

### Why

This Dockerfile will allow us to reuse release packages.
It will also allow us to run more lighweight soroban-rpc deployments
than those using the stellar/quickstart image

* Address PR feedback

* specify amd64 platform explicitly as we currently only support amd64 core
* make STELLAR_CORE_VERSION required to avoid hardcoding versions in the files.
  We will provide version from a dropdown in the build job
* if soroban-rpc version is not provided read it from GitHub and install latest
  package matching the version

---------

Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>
* Add lab token id command

* fix doc

* Keep only the strkey id

* refactoring

---------

Co-authored-by: Paul Bellamy <paul@stellar.org>
* fix(bindings-ts): don't delete existing dirs

- Rename `root-dir` to `output-dir` to clarify the intent
- If `output-dir` already exists, use `output-dir/contract-name` instead

* docs: update auto-generated
* update go dep xdr for preview 10

* update

* soroban-rpc: update code to latest XDR auth and single-function changes (#703)

* WIP

* WIP

* WIP

* Add clarification about events

* Moar progress

* Last compilation fixes

* progress

* Fix another test

* small cleanup

* Fix last test

* Fix more tests

* Fix more tests

* Fix another test

* Update to a working (if not the absolute latest) xdr

* updating xdr in preflight for fees & auth

* pass the min entry expiration into preflight

* rawval and set updates

* Fix udt test wasm

* rustfmt

* Updating txresult move

* use simon's core image build

* Get all rpc unit tests compiling (but not passing)

* fix up cargo toml rs-soroban-sdk import

* Fix ledgerentry test

* Fix getEvents test

* Fix GetTransactionTest

* Upgrade core version for integration tests

* Clean up integration tests

* Change the simulateTransactionResponse API back to make the changeover simpler for now

* Update integration tests expectations for simulateTransaction

* Missed one

---------

Co-authored-by: Paul Bellamy <paul@stellar.org>

* merge with main, and update the go monorepo link.

* soroban-rpc: Adapt Go and Rust code to the latest XDR changes (#724)

* Sync code with the latest XDR changes

* Bump rust and Core dependencies

* Update Rust code to the new sdk and env versions

* Fix test

* Fix ledgerentry tests for new xdr (#725)

* preview10: soroban-cli xdr updates (#722)

* StorageType support

* Fix VecM max lengths

* Fix LedgerKeyNonce conversion

* partial ScStatus -> ScError updates

* Working on updating for new contract code and entry storage

* updating for new xdr

* update rs-soroban-sdk to commit e90db9f8009280516375df6b3ee43a65ff524577

* Updating xdr again

* New token spec location

* Cargo fmt

* Fix binding-generators

* Dig out the new invokeHostFunction return value

* Fix up last of the build

* Clippy shenanigans

* use symbol_short macro

* Set signature_expiration_ledger for sandbox

* fixup! use symbol_short macro

* fixup! Set signature_expiration_ledger for sandbox

* Clean up a vague error

* set expiration on contract codes in sandbox

* Set expiration on contract instances on sandbox

* Handle expired contract code ledger entries in the sandbox

* Include temporary entries from contract read subcommand

* Implement ledger entry expiration bumps in sandbox

* cargo md-gen

* Fix rpc simulateTransaction client tests

* Merge origin/main into soroban-xdr-next (#728)

* soroban-rpc: bug workaround and test fixes (#726)

* updated rs-env and mono repo versions (#741)

* updated rs-env for 0.9. and mono repo with latest xdr gen updates

* review feedback, fix go ref to soroban-xdr-next-next

* update all workspace rs-sdk refs to same in toml

* updated the cargo ver to match the gh ref

* included cargo.lock and deps check fix

* soroban-rpc: Implement preflighting of BumpFootprintExpiration and RestoreFootprint operations (#730)

* sync with main (#744)

* Fix check-dependencies typos (#723)

* Add lab token id command (#693)

* Add lab token id command

* fix doc

* Keep only the strkey id

* refactoring

---------

Co-authored-by: Paul Bellamy <paul@stellar.org>

* fix(bindings-ts): don't delete existing dirs (#733)

* fix(bindings-ts): don't delete existing dirs

- Rename `root-dir` to `output-dir` to clarify the intent
- If `output-dir` already exists, use `output-dir/contract-name` instead

* docs: update auto-generated

* Upgrade wasm-opt to 0.113 (#736)

* fix

* fix

* update

* cargo fmt

---------

Co-authored-by: Alfonso Acosta <alfonso@stellar.org>
Co-authored-by: Vincent Amouret <vincent.amouret@gmail.com>
Co-authored-by: Paul Bellamy <paul@stellar.org>
Co-authored-by: Chad Ostrowski <221614+chadoh@users.noreply.github.com>
Co-authored-by: Brian Anderson <andersrb@gmail.com>

* Fix bug loading contract spec in sandbox when not deployed (#745)

* Fix check-dependencies typos (#723)

* Add lab token id command (#693)

* Add lab token id command

* fix doc

* Keep only the strkey id

* refactoring

---------

Co-authored-by: Paul Bellamy <paul@stellar.org>

* fix(bindings-ts): don't delete existing dirs (#733)

* fix(bindings-ts): don't delete existing dirs

- Rename `root-dir` to `output-dir` to clarify the intent
- If `output-dir` already exists, use `output-dir/contract-name` instead

* docs: update auto-generated

* Upgrade wasm-opt to 0.113 (#736)

* fix

* fix

* update

* cargo fmt

* Fix bug loading contract spec in sandbox when not deployed

* Make fmt

* No more 'set' type to test

* remove unused import

* Fix sandbox contract invoke

* Make test invoke quiet so it doesn't spit out events

* Set default state expiries in the sandbox

* Add a note about a crappy test

---------

Co-authored-by: Alfonso Acosta <alfonso@stellar.org>
Co-authored-by: Vincent Amouret <vincent.amouret@gmail.com>
Co-authored-by: Chad Ostrowski <221614+chadoh@users.noreply.github.com>
Co-authored-by: Brian Anderson <andersrb@gmail.com>
Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>

* soroban-rpc: State Expiration (#695)

* Update go for new xdr

* WIP -- working on extensions

* Implement ExtendLedgerEntry

* Disallow access to expired ledgerEntries

* update go dep

* Include current ledger in expiry

* update ledgerEntry tests for new xdr

* Add unit test for ExtendEntry

* Add test for extending a non-existent ledger entry

* Add tests for expired contract entries

* Test creating and extending in the same batch

* Show expired ledger entries now that core will autobump

* Revert "Show expired ledger entries now that core will autobump"

This reverts commit b1426a770fe6df99efb4db8a7014ea029f7c1644.

* Refactor expiry checking

* Replace assert.NotNil with require.NotNil

* Clearer naming

* better test error checking

* Add validation on upserting ledger entrys that the key matches

* Simplify UpsertLedgerEntry since key is derived from the entry

* Update go dependency to 3f69f56e3743bbd520e4c25f44b8fc49b1b81936

* soroban-rpc: Fix integration test phrasing (#747)

* soroban-rpc: Fix phrasing in an integration test

* fix typo

* Fix: error, enum, union types (#731)

* StorageType support

* Fix VecM max lengths

* Fix LedgerKeyNonce conversion

* partial ScStatus -> ScError updates

* Working on updating for new contract code and entry storage

* updating for new xdr

* update rs-soroban-sdk to commit e90db9f8009280516375df6b3ee43a65ff524577

* Updating xdr again

* New token spec location

* Cargo fmt

* Fix binding-generators

* Dig out the new invokeHostFunction return value

* Fix up last of the build

* Clippy shenanigans

* use symbol_short macro

* Set signature_expiration_ledger for sandbox

* fixup! use symbol_short macro

* fixup! Set signature_expiration_ledger for sandbox

* Clean up a vague error

* set expiration on contract codes in sandbox

* Set expiration on contract instances on sandbox

* Handle expired contract code ledger entries in the sandbox

* Include temporary entries from contract read subcommand

* Implement ledger entry expiration bumps in sandbox

* cargo md-gen

* Fix rpc simulateTransaction client tests

* fix: tuples and enums/unions and new Error type

* chore: pr review

* pull in some fixes

* tuples are friends not food

* fix: update example inputs to instruct a tuple struct

* feat: add tuple struct support

* fix: update to use new bindings out-dir

---------

Co-authored-by: Paul Bellamy <paul@stellar.org>
Co-authored-by: Tyler van der Hoeven <hi@tyvdh.com>

* cargo fmt

* compile: disable the fetch test (#750)

* disable the fetch test, since it's testing it against futurenet.

* update boilerplate test.

* Fix bug in cli lab xdr decode --type parsing (#751)

* soroban-cli: Verify the network passphrase provided matches the server (#754)

* soroban-cli: fix contract deploy (#755)

* Fix return type parsing from soroban-rpc

* soroban-cli: Fix how contract code hashes are calculated

* Fix integration test

* Bump version to 0.9.0 (#758)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* soroban-rpc: Add bump footprint test (#746)

* Bump Core version (#759)

* update (#760)

* soroban-rpc: Restore footprint fixes (#761)

* update e2e tests (#762)

* update

* update

* update package.json to use the official js-soroban-client tag instead of an arbitrary commit hash..

* rollback package changes.

* really rollback.

* soroban-cli: Add super basic `contract bump` and `contract restore` subcommands (#748)

* add contract read --durability filter

* Add soroban contract bump subcommand

* Add soroban contract restore command

* Add support for restoring multiple keys at once

* cargo md-gen

* Clean up an unused error

* Need to increment the account sequence for bump+restore

* no --ledgers-to-expire for restore command

* Support bump+restore commands in preflight+transaction::assemble

* rust fmt

* cargo md-gen

* Require --durability for bump because the default is confusing

* Fix clippy

* cargo md-gen

* soroban-cli: Implement soroban contract read with real rpc support (#756)

* add contract read --durability filter

* Add soroban contract bump subcommand

* Add soroban contract restore command

* Add support for restoring multiple keys at once

* cargo md-gen

* implement soroban contract read with a real network

* Clean up an unused error

* Make fmt

* cargo md-gen

* getLedgerEntries.results can be null

* Need to increment the account sequence for bump+restore

* no --ledgers-to-expire for restore command

* Support bump+restore commands in preflight+transaction::assemble

* rust fmt

* cargo md-gen

* Require --durability for bump because the default is confusing

* Fix clippy

* cargo md-gen

---------

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

* update e2e tests (#765)

* update

* update hash -> 0.9.0

---------

Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>
Co-authored-by: Alfonso Acosta <alfonso@stellar.org>
Co-authored-by: shawn <sreuland@users.noreply.github.com>
Co-authored-by: Vincent Amouret <vincent.amouret@gmail.com>
Co-authored-by: Chad Ostrowski <221614+chadoh@users.noreply.github.com>
Co-authored-by: Brian Anderson <andersrb@gmail.com>
Co-authored-by: Willem Wyndham <willem@ahalabs.dev>
Co-authored-by: Tyler van der Hoeven <hi@tyvdh.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* update

* update

* fix missing
* Add rustc upgrade rule
* Update example git ref since Preview 10 is out
* Soroban-cli: add check if bump+restore op actually worked

* Add better feedback to bump+restore ops

* Manually reformat a line

---------

Co-authored-by: George <Shaptic@users.noreply.github.com>
* Output slightly better errors when account/contract are not found

* make fmt
* update preview-10 depenedencies, including fixed ingestions + updated core.

* update core

* fix soroban-rpc.yml
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>
@stellarsaur stellarsaur self-assigned this Jan 17, 2024
@stellarsaur stellarsaur added the enhancement New feature or request label Jan 17, 2024
@leighmcculloch

leighmcculloch commented Jan 17, 2024 •

Copy link
Copy Markdown
Member

Approved. Make sure when merging this PR that it is merged with a merge commit, and not squashed. Why: To preserve the git commits/shas.

@stellarsaur
stellarsaur merged commit fe8d751 into main Jan 17, 2024
@stellarsaur
stellarsaur deleted the soroban-tools-migration branch January 17, 2024 23:02
karthikiyer56 added a commit that referenced this pull request May 15, 2026
… err

- Persist logger on ColdStoreWriter and ColdStoreReader (previously
  validated as non-nil but never stored or called).
- Log lifecycle events: writer opened, committed (with count),
  commit-failed (warn — caller must Close), aborted-with-partial-
  removed; reader opened and closed at Debug.
- Commit no longer discards w.enc.Close()'s error; it's returned
  alongside the (already-nil) Finish result. Close path already
  joined them via errors.Join — Commit now matches.
- Truncate test: drop dead `_ = crashed` line; add a two-line
  comment naming the intentional fd leak so a reviewer doesn't
  flag it as a bug.

Closes Copilot review comments #1, #2; partial address of #3
(declined the auto-close-on-Finish-error half because it would
break the documented Commit/Close two-phase contract) and #4.
tamirms added a commit that referenced this pull request Jun 15, 2026
…nesis-corner fixes

Follow-up to the design-doc PR addressing the automated review.

gettransaction (#1): size the .idx ledger-seq payload to the window —
payloadWidth = ceil(log2(chunks_per_txhash_index * 10_000) / 8) — instead of
a fixed 3 bytes, so the format never caps chunks_per_txhash_index (3 bytes up
to 1677 chunks, 4 bytes beyond). Capacity references qualified as
default-window figures.

streaming (#2): fix the young-genesis corner case at the root. Add the
chunk-id convention to Geometry — signed ids, chunkID floor-divides so the
earliest_ledger-1 watermark sentinel maps to chunk -1 with
chunkLastLedger(-1) = 1, and the -1 sentinel is never serialized. With it,
deriveCompleteThrough's cold term (highestDurableChunk returns -1 on a fresh
start) and positional term (maxChunk-1 = -1 at chunk 0) degrade to the
pre-genesis sentinel instead of a spurious chunk-0 bound that would resume a
young network past its tip; the startup mid-chunk test reads the sentinel as
a chunk boundary, no special-case guard needed.

Codex finding #3 (earliest_ledger raise path) was a false positive: the doc
consistently frames earliest_ledger movement as a deferred operation gated
behind a future admin command.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
marwen-abid added a commit that referenced this pull request Sep 10, 2026
Use the same accurate fallback for an absent object and an existing pending seed.

Addresses: #936 (comment)
marwen-abid added a commit that referenced this pull request Sep 12, 2026
Use the same accurate fallback for an absent object and an existing pending seed.

Addresses: #936 (comment)
marwen-abid added a commit that referenced this pull request Sep 14, 2026
Use the same accurate fallback for an absent object and an existing pending seed.

Addresses: #936 (comment)
marwen-abid added a commit that referenced this pull request Sep 14, 2026
* bench(perf-eval): add a windowed relay poller for long campaigns

Campaigns outlive one GHA job, so a chain of poll jobs each polls one
bounded window of the campaign budget. The new relay command reports
exactly one of three states per window — ok, fail, or running, where
running hands off to the next poll job — and the workflow gates on the
state output. The launch job seeds RESULT_KEY with a pending marker, so
the object exists for the campaign's whole life and persistent fetch
errors read as a fault, not a slow campaign.

Relay and the existing gather command now share one resultPoller, so the
two S3-protocol consumers cannot drift. Gather gains from the merge:
fail-fast after 10 consecutive fetch errors (an AccessDenied-style fault
no longer spins for the whole RESULTS_TIMEOUT under a misleading timeout
headline) and skipping a pending marker as not-final. 404s stay a
healthy answer for legs, which publish only at the end; only the seeded
relay key treats a persistent 404 as a fault.

Hardening that fell out of making the polling long-running:

- One last-chance fetch when the budget is exhausted, so a verdict
  published between job handoffs or during the final sleep is not lost.
- The poll loop never sleeps past its window.
- Shared env parsing (RequireEnvInts, requirePositive); zero or negative
  POLL_INTERVAL, WINDOW_SECONDS, RESULTS_TIMEOUT, or DEBUG_LOG_EVERY_POLLS
  now fail before any AWS call (the last was a divide-by-zero panic in
  gather).
- VerdictOK/VerdictPending exported next to Result, decoupling the S3
  verdict namespace from the relay-state namespace; the coordinator
  renders a still-pending result through the no-result fallback.
- writeNoVerdictComment no longer emits found=false itself; each caller
  records its own outputs, keeping relay's contract state-only.

Tests pin the state rule (only an exhausted budget turns a verdict-less
window into a failure), env validation, and the new helpers.

* bench(perf-eval): seed the leg result key, fail fast on every absent key

The gha-rpc-ci role has no s3:ListBucket on the results bucket, so
GetObject on a missing key returns 403 AccessDenied, not 404. Legs never
seeded their key, so during a leg's whole run the gatherer read 403 on
every poll — and the new consecutive-error fail-fast killed each leg
after ten polls, minutes into an hour-long run.

Extend the campaign seeding convention to legs: the leg job now writes
the pending marker right after assuming the role (s3:PutObject on the
bucket is already granted), so every poller key exists from the start.
With that invariant uniform, the keySeeded special case is gone: a
persistent 403 or 404 is a seeding or config fault everywhere, and the
fail-fast is valid for legs and campaigns alike. Seeding also makes a
re-run overwrite its predecessor's verdict at launch instead of at
publish time.

* pr-936: #1 test and bound shared result polling

Use fake AWS transports and virtual time to cover polling states, retries, handoff, deadlines, cancellation, and output contracts. Bound result reads and SSM diagnostics, reject invalid protocol data and duration overflow, and count persistent stale reads as faults. Keep retry counts local to each Relay window. RESULTS_FILE defaults remain unchanged; diagnostics follow its directory for isolated tests.

Addresses: #936 (comment)

* pr-936: #2 describe missing final results accurately

Use the same accurate fallback for an absent object and an existing pending seed.

Addresses: #936 (comment)

* bench(perf-eval): preserve older targets and partial reruns

Seed only targets with the shared poller, because historical Gather treats pending as final failure. Keep shared result keys for failed-jobs-only reruns, while rejecting coordinator results from another run or target. Test seeding order and result gates without executing infrastructure steps.

* bench(perf-eval): document and verify polling boundaries

Cover cross-window retry reset, transient body failures, and cancellation in the final fetch. Document the seed requirement, diagnostics bound, and result states; add the changelog entry.

* cleanup and refactor

* address PR comments
cjonas9 added a commit that referenced this pull request Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.