feat: add sealed bid auction example#115
Conversation
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (5)
WalkthroughAdds a new "sealed-auction" Anchor program example implementing a private first-price sealed-bid auction with SPL Token escrow on ephemeral rollups, including on-chain program logic, state/error definitions, an extensive test suite, build configuration, documentation, and registration in repository scripts/README. ChangesSealed Auction Example
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sealed-auction/anchor/Anchor.toml`:
- Around line 21-29: The test genesis entries in Anchor.toml are depending on
fixtures from the binary-prediction example, unlike the rest of the project’s
local fixture usage. Update the [[test.genesis]] program paths so sealed-auction
uses its own fixture binaries, or move the shared .so files into a common
fixture location if they are meant to be reused. Keep the existing genesis
addresses and adjust only the fixture source references in Anchor.toml.
In `@sealed-auction/anchor/package.json`:
- Line 11: The Anchor TypeScript client version in package.json is out of sync
with the Anchor CLI/toolchain pinned in Anchor.toml. Update the
sealed-auction/anchor dependency on `@coral-xyz/anchor` from the 0.32.x line to
the 1.0.x client line, or otherwise make the CLI and TS client versions match,
so the generated IDL and instruction serialization remain compatible.
In `@sealed-auction/anchor/programs/sealed-auction/src/error.rs`:
- Around line 7-8: The `DeadlineInPast` error in `error.rs` is being reused by
`end_auction` for the opposite condition (`now < deadline_ts`), so its meaning
and message are misleading. Add a separate error variant with a name that
matches the “auction still open / deadline not passed” case, update the
`end_auction` check in `lib.rs` to use that variant, and keep `DeadlineInPast`
reserved for actual past-deadline validation.
In `@sealed-auction/anchor/programs/sealed-auction/src/lib.rs`:
- Around line 600-678: The ephemeral SPL token instruction discriminators are
hardcoded in init_ephemeral_ata and delegate_ephemeral_ata, which makes the
intent opaque and easy to mistype. Introduce named constants for the
discriminators used by these helpers, then replace the raw vec![0] and vec![4]
values with those constants in the instruction data construction. Keep the
change localized to the init_ephemeral_ata and delegate_ephemeral_ata functions
so the instruction encoding remains explicit and maintainable.
- Around line 365-401: The finalize flow in finalize currently moves the auction
to Settled too early, which prevents settle_winning_bid and claim_refund from
running because they still expect Ended. Update finalize to only allow lot
claiming after all bids are closed, following the same pattern used by
undelegate_auction, and keep the auction in the correct pre-settlement state
until the seller’s bid settlement and refunds can complete. Use the existing
symbols finalize, settle_winning_bid, claim_refund, and AuctionStatus to locate
and adjust the state transition guard.
In `@sealed-auction/anchor/programs/sealed-auction/src/state.rs`:
- Around line 27-35: The Bid.refunded field is currently dead because it is only
read in claim_refund via require! but never written anywhere; update the refund
flow around claim_refund and close_ephemeral_bid to either remove refunded and
its check entirely, or set bid.refunded to true before the account is closed if
you want an explicit guard. Use the Bid struct in state.rs and the
claim_refund/close_ephemeral_bid handlers to keep the state model consistent.
In `@sealed-auction/anchor/tests/sealed-auction.ts`:
- Around line 122-127: The deadline-based tests are using local wall-clock time
in `sleepUntilUnixTimestamp` and fixture setup, which can drift from Solana
`Clock` and make the on-chain deadline assertions flaky. Update the test helpers
to derive waiting/deadline values from validator block time instead of
`Date.now()`, and adjust `createBaseAuctionFixture` so `deadlineTs` comes from
the chain clock rather than the runner clock. Keep the fix centered around the
`sleepUntilUnixTimestamp` helper and the deadline initialization/assertions in
the sealed auction tests, including the empty-auction path.
- Around line 308-316: Update requireLocalE2e in sealed-auction tests so live ER
runs do not fall back to ctx.skip() when explicitly requested. The current logic
only throws localE2eSkipReason when RUN_E2E is set, but RUN_SEALED_AUCTION_LIVE
should also be treated as an explicit request and fail fast if localE2eAvailable
is false. Check the existing RUN_E2E / live-test gating in requireLocalE2e and
make the skip path unreachable for explicitly requested live coverage.
- Around line 755-826: The bid submission loop is using the
auctioneer-authenticated ER connection for both `placeBid` transactions, so
bidder isolation is not actually being tested. Update the logic around
`authenticatedErConnection`, `privateErProvider`, `privateErProgram`, and the
`placeBid` loop to create and use a bidder-specific authenticated connection for
each bidder inside the loop, then submit each bid through that bidder’s own
provider/program instance instead of reusing the auctioneer connection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 31c0d387-c7ed-4326-bdd4-b24225c63629
⛔ Files ignored due to path filters (2)
sealed-auction/anchor/Cargo.lockis excluded by!**/*.locksealed-auction/anchor/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (12)
README.mdscripts/projects.shsealed-auction/README.mdsealed-auction/anchor/Anchor.tomlsealed-auction/anchor/Cargo.tomlsealed-auction/anchor/package.jsonsealed-auction/anchor/programs/sealed-auction/Cargo.tomlsealed-auction/anchor/programs/sealed-auction/src/error.rssealed-auction/anchor/programs/sealed-auction/src/lib.rssealed-auction/anchor/programs/sealed-auction/src/state.rssealed-auction/anchor/tests/sealed-auction.tssealed-auction/anchor/tsconfig.json
|
lgtm! only thing is the test for rps is failing. |
great, thanks. sometimes the tests fail due to failure in installing the solana platform tools. i just restarted it so that should make it work |
Closes: #114
Summary
Testing
anchor build./node_modules/.bin/tsc --noEmit -p tsconfig.jsonyarn lintyarn test:localRUN_SEALED_AUCTION_LIVE=1 NO_DNA=1 EXACT_MATCH=1 ./scripts/test-locally.sh sealed-auctionBreaking Changes
None.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation