Skip to content

Fix broken code in the choosing-the-right-storage guide - #2835

Open
kaankacar wants to merge 1 commit into
mainfrom
docs-agent/1841-storage-guide-snippets
Open

Fix broken code in the choosing-the-right-storage guide#2835
kaankacar wants to merge 1 commit into
mainfrom
docs-agent/1841-storage-guide-snippets

Conversation

@kaankacar

Copy link
Copy Markdown
Contributor

🤖 Automated message from Kaan's Automated Triage Bot.

The temporary storage snippet on this guide could not compile, and its expiry check was inverted: it returned a bid's value after the bid expired, and 0 while the bid was still valid. This fixes that check and the compile errors around it, and adds the two missing SDK imports in the persistent and instance snippets. Prose, links and the storage table are unchanged.

Refs #1841

I checked every construct against soroban-sdk v26.1.1 source, because cargo is not available in my environment. storage().temporary().get() returns Option<V> (soroban-sdk/src/storage.rs:458) and Ledger::sequence() returns u32 (ledger.rs:65). Two #[contractimpl] blocks on one contract are legal, so the second block stays as it is (lib.rs:447).

I used "Refs", not "Closes". The issue asks for a full guide review, and two prose claims stay unverified: that the instance entry size limit can never go down, and the relative order of the "Cost" column. Please close #1841 if you read this as the review being done.

The temporary storage snippet could not compile. It called `e.ledger()`
twice while its `Env` parameter is named `env`, declared no
`AuctionContract` type for the `impl` block, took a `Symbol` where
`DataKey::Bid` holds an `Address`, returned `i64` for an `i128` bid value,
and annotated `storage().temporary().get()` as `Bid` when it returns
`Option<Bid>`.

The same snippet also had its expiry check inverted. It returned the bid
value when `expiration_ledger_seq` had already passed, and 0 while the bid
was still valid, which is the opposite of what its own comments describe.

The persistent and instance snippets were missing the `contract` and
`contracttype` imports that they use.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes compilation errors and inverted expiry logic in the storage guide’s Soroban Rust examples.

Changes:

  • Adds missing SDK imports and contract declaration.
  • Corrects temporary bid types, environment access, and expiry handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Preview builds for PRs by SDF employees.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update guide: How to choose the right storage for your use case

2 participants