Skip to content

feat: private counter#77

Merged
jonasXchen merged 14 commits into
mainfrom
jonasXchen/private-counter
Apr 24, 2026
Merged

feat: private counter#77
jonasXchen merged 14 commits into
mainfrom
jonasXchen/private-counter

Conversation

@jonasXchen
Copy link
Copy Markdown
Collaborator

@jonasXchen jonasXchen commented Apr 24, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Private counter mode with ephemeral rollup integration for delegated counter operations
    • Public/private mode switching with delegation and undelegation controls
    • Enhanced counter state management syncing across multiple environments
  • Updates

    • Upgraded core SDK dependencies and Anchor package versions
    • Improved TypeScript compiler configuration for better compatibility
    • Refined wallet provider endpoint defaults

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
er-rolldice Ready Ready Preview, Comment Apr 24, 2026 11:48pm
magicblock-engine-examples Ready Ready Preview, Comment Apr 24, 2026 11:48pm
magicblock-rewards-dashboard Ready Ready Preview, Comment Apr 24, 2026 11:48pm
spl-tokens Ready Ready Preview, Comment Apr 24, 2026 11:48pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR restructures the anchor-counter example into separate public and private counter programs with a rewritten React frontend, upgrades ephemeral-rollups-sdk dependencies across projects, and transitions to MagicIntentBundleBuilder for commitment operations. It introduces new private delegation flows and test infrastructure while updating related example projects.

Changes

Cohort / File(s) Summary
Program Restructuring
anchor-counter/programs/private-counter/*, anchor-counter/programs/public-counter/Cargo.toml, anchor-counter/programs/public-counter/src/lib.rs
Splits counter into public-counter (renamed from anchor-counter) and new private-counter programs. Private-counter adds permission-based delegation, ephemeral state transitions, and magic intent bundle commits. Both programs refactored to use MagicIntentBundleBuilder instead of direct account helpers.
Frontend Rewrite
anchor-counter/app/app/src/App.tsx (deleted), anchor-counter/app/src/App.tsx, anchor-counter/app/src/components/Square.tsx, anchor-counter/app/src/index.css
Replaces legacy App component with new implementation supporting both public and private delegation modes. Adds ephemeral counter state syncing, TEE auth token fetching, temp keypair management, and delegation UI. Extends Square component with loading/placeholder states and adds CSS for toggle controls and loader animations.
Frontend Configuration & Cleanup
anchor-counter/app/Anchor.toml, anchor-counter/app/package.json, anchor-counter/app/tsconfig.json, anchor-counter/app/src/components/Wallet.tsx, anchor-counter/app/LICENSE, anchor-counter/app/README.md, anchor-counter/app/app/*
Updates Anchor config from localnet to devnet, removes token-minter program mappings, upgrades Anchor/SDK dependencies. Changes default RPC endpoint, replaces tsconfig with stricter settings, simplifies README, removes legacy LICENSE, and deletes nested app subdirectory files.
Test Infrastructure
anchor-counter/tests/private-counter.ts, anchor-counter/tests/public-counter.ts, anchor-counter/tests/advanced-magic.ts
Introduces new end-to-end test for private counter with ER delegation and permission flows. Refactors existing tests to target renamed public-counter program, adds error handling for balance fetches, and updates provider initialization patterns.
Repository Maintenance
anchor-counter/.gitignore, anchor-counter/package.json, anchor-counter/target/deploy/*, anchor-counter/target/idl/*
Updates gitignore for magicblock-test-storage, adds bs58/tweetnacl dependencies, removes stale keypair and IDL files.
Related Examples Updates
anchor-rock-paper-scissor/programs/.../Cargo.toml, anchor-rock-paper-scissor/programs/.../src/lib.rs, rewards-delegated-vrf/Anchor.toml, rewards-delegated-vrf/programs/.../Cargo.toml, rewards-delegated-vrf/programs/.../src/instructions/undelegate_reward_list.rs
Upgrades ephemeral-rollups-sdk across projects (rock-paper-scissor 0.8.0→0.11.0, rewards 0.10.5→0.11.1), updates rock-paper-scissor program ID, adds method signature change for commit operations, and updates reward delegation imports.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 78.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: private counter' directly and clearly describes the main change: adding a new private counter program alongside the existing public counter, as evidenced by the addition of the private-counter program directory with full implementation and corresponding UI/test updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonasXchen/private-counter

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants