`stellar contract restore`: tell users whether a restore fits in one transaction, and how many it needs
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- blockchain, cli
Research direction
Start in contract/restore.rs, especially the existing RestoreFootprint transaction construction, --build-only path, and simulate_and_assemble_transaction. First determine how network-configured resource limits can be compared with simulation results; then investigate how per-entry sizes could support grouping keys. Done means the command reports whether the restore fits and, when it does not, a valid transaction plan respecting all resource limits.
Written by the indexing model from the issue text.
Description
What problem does your feature solve?
If you hold a large set of archived entries, there is no way to find out whether restoring them fits in a single transaction. stellar contract restore puts every requested key into one RestoreFootprint footprint and submits it. If that exceeds per-transaction resource limits, the user finds out from a failure and then splits the key set by hand until it works.
This is the part of "can I get this state back, and how" that a user cannot work out on their own. Fee and resource display is already tracked in #2401.
What would you like to see?
A dry-run mode on stellar contract restore that simulates instead of submitting, and answers two questions:
- Does this restore fit within per-transaction resource limits?
- If not, what is the minimum number of restore transactions required, and which keys go in each one?
Something like:
Restore plan (testnet): 3 transactions, 60 entries
Exceeds per-transaction limits:
Disk read entries 60 > 40
Write bytes 124,800 > 66,560
tx 1 24 entries
tx 2 24 entries
tx 3 12 entries
Exact flag, output shape, and approach are up to whoever picks this up. Two requirements: limits come from network config rather than hardcoded values, and the plan has to respect all resource limits at once, not just the first one that trips.
Out of scope
- Rendering resource usage and fees. #2401 covers that for
tx simulateacross every operation type. This issue should build on it, not duplicate it. - Submitting the split sequence. Reporting a plan is the deliverable. Executing it can follow.
Context
The transaction building and simulation plumbing already exists. contract/restore.rs builds the RestoreFootprint transaction and already separates building from submitting via --build-only, and simulate_and_assemble_transaction returns the assembled resources.
Two things to know going in:
- Simulation returns footprint totals, not per-entry sizes, so grouping keys into transactions needs sizes per key from somewhere else.
restore.rscarries the comment// We only support restoring a single entry via this command (which we should fix separately, but). This feature is about large key sets, so that limitation likely needs fixing first.
The limit comparison and a plain fits / does-not-fit answer is a small self-contained first change. The grouping math can follow.
Open question
Nobody currently owns the total XLM cost of an N-transaction restore plan. #2401 gives cost per transaction, and a single simulation cannot give the total for a plan. If users want one number for "what does restoring this key set cost me," it belongs here.
Related
- #2401
stellar tx simulateshould show expected resources usage and fees - #2201
stellar contract restore: if an entry is already restored as of the simulation, we should not submit the tx to the network - #1019 Return simulation budget information even in case of error
- Dominant language
- Rust
- Stars
- 123
- Forks
- 141
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-cli#2384 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stellar/stellar-cli#2347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
stellar/stellar-cli#2723 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stellar/stellar-cli#2722 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
stellar/stellar-cli#2703 ·
All issues in stellar/stellar-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100