Skip to content

Feat/upgrade sdk v2#70

Merged
GabrielePicco merged 9 commits intomainfrom
feat/upgrade-sdk-v2
Mar 30, 2026
Merged

Feat/upgrade sdk v2#70
GabrielePicco merged 9 commits intomainfrom
feat/upgrade-sdk-v2

Conversation

@GabrielePicco
Copy link
Copy Markdown
Contributor

@GabrielePicco GabrielePicco commented Mar 29, 2026

Summary by CodeRabbit

  • New Features

    • Configure and lock an existing SPL mint via environment variables.
    • Mint tokens to an address with automatic token account creation.
    • Manage transfer queues (setup and crank) with new UI controls and debug info.
  • Documentation

    • Documented env vars for mint and queue keypair usage and local development.
  • Chores

    • Updated SDK dependency.
    • Improved local validator startup, logging, readiness wait, and failure handling.
  • Other

    • Added ignore pattern for TypeScript build artifacts.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 62ed63ca-db72-4eda-8b37-0da2726dbd9b

📥 Commits

Reviewing files that changed from the base of the PR and between 31f607e and a705742.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/test-examples.yml
  • spl-tokens/app/app/README.md
  • spl-tokens/app/app/craco.config.js
  • spl-tokens/app/app/src/App.tsx

Walkthrough

Replaces Solana validator invocation with mb-test-validator in CI, hardens ephemeral validator startup/waiting, adds env-driven SETUP_MINT and queue-keypair build-time injection, updates UI to support configured mint/queue flows and increased airdrop, and bumps ephemeral-rollups-sdk dependency resolution.

Changes

Cohort / File(s) Summary
CI Workflow
\.github/workflows/test-examples.yml
Replaced solana-test-validator with mb-test-validator (--ledger ./my-ledger-1 --reset), adjusted ephemeral validator flags (--lifecycle ephemeral, changed RPC bind to -l "7799"), redirected ephemeral logs to /tmp/ephemeral-validator.log, increased readiness wait to 60s and added timeout failure handling that tails logs and exits.
Ignore Patterns
\.gitignore
Added **/tsconfig.tsbuildinfo to ignore TypeScript incremental build artifacts and ensured trailing newline.
App Source & UI
spl-tokens/app/app/src/App.tsx
Added env-driven SETUP_MINT and SETUP_QUEUE_KEYPAIR/JSON handling and build-time injection support; initialize/reset logic to respect configured mint (forces decimals=6), increased airdrop to 2 SOL, made setup flow wait for validator and thread queue-validator into transfer-queue derivation/init (uses magicFeeVault PDA), and added queue-related UI/actions (mint recipient, queue mint, init queue, start crank) plus related debug/logging.
Build-time Injection
spl-tokens/app/app/craco.config.js
Reads optional SETUP_QUEUE_KEYPAIR file at build time (sync fs read with error on failure) and adds webpack.DefinePlugin entries for SETUP_MINT, SETUP_QUEUE_KEYPAIR, and SETUP_QUEUE_KEYPAIR_JSON.
Documentation
spl-tokens/app/app/README.md
Documented new env variables SETUP_MINT, SETUP_QUEUE_KEYPAIR, and REACT_APP_SETUP_QUEUE_KEYPAIR, and clarified usage for local vs browser-accessible keypair provision.
Dependency Updates
spl-tokens/app/app/package.json, spl-tokens/package.json
Bumped @magicblock-labs/ephemeral-rollups-sdk from exact/local reference to published semver (^0.10.2 / 0.10.2).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • jonasXchen
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Feat/upgrade sdk v2' is vague and generic. It uses non-descriptive formatting (prefix-based) without clarifying what SDK is being upgraded, what version changes are involved, or the scope of changes. Use a more descriptive title that specifies the actual changes, such as 'Upgrade ephemeral-rollups-sdk to v0.10.2 and add SETUP_MINT configuration' to clearly convey the main objectives.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 feat/upgrade-sdk-v2

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.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

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

Project Deployment Actions Updated (UTC)
er-rolldice Ready Ready Preview, Comment Mar 30, 2026 8:47am
magicblock-engine-examples Ready Ready Preview, Comment Mar 30, 2026 8:47am
magicblock-rewards-dashboard Error Error Mar 30, 2026 8:47am
spl-tokens Ready Ready Preview, Comment Mar 30, 2026 8:47am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 178457b9fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5f1096049

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73e4ec2a5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
spl-tokens/app/app/src/App.tsx (1)

863-863: ⚠️ Potential issue | 🟡 Minor

Potential null dereference with non-null assertion.

This line uses non-null assertions (!) on ephemeralConnection.current, but this code runs regardless of whether usesEphemeralConnection is true. While the check at line 747 ensures early return if ephemeral connection is needed but missing, this line executes unconditionally after the transfer. If ephemeralConnection.current is null (e.g., connection failed to initialize), this will throw.

Consider guarding this call:

🛡️ Proposed fix
-            await ephemeralConnection!.current!.getAccountInfo(shuttleWalletAta);
+            if (ephemeralConnection.current) {
+                await ephemeralConnection.current.getAccountInfo(shuttleWalletAta);
+            }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@spl-tokens/app/app/src/App.tsx` at line 863, The call to
ephemeralConnection!.current!.getAccountInfo(shuttleWalletAta) can throw when
ephemeralConnection.current is null; update the code to only call getAccountInfo
when ephemeralConnection.current is present and when usesEphemeralConnection is
true (or otherwise expected to exist). Specifically, check ephemeralConnection
&& ephemeralConnection.current before invoking getAccountInfo (or
early-return/skip this block if usesEphemeralConnection is false), and handle
the null case by skipping the fetch or logging an error; reference the
ephemeralConnection object, its current property, the getAccountInfo call, and
shuttleWalletAta to locate and fix the site.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/test-examples.yml:
- Around line 80-82: The workflow binds services to 127.0.0.1 but the subsequent
test invocation still uses localhost URLs (passed into anchor test), which can
resolve to ::1 and break health checks; update the test endpoint environment
variables and any anchor test invocations (the EPHEMERAL_PROVIDER_ENDPOINT /
EPHEMERAL_WS_ENDPOINT and the anchor test command arguments) to use
"http://127.0.0.1:7799" and "ws://127.0.0.1:7800" (or the matching ports already
used in the remotes/-l settings) so the tests target IPv4 loopback consistently.
Ensure you change the two occurrences that set EPHEMERAL_PROVIDER_ENDPOINT and
EPHEMERAL_WS_ENDPOINT (and any direct "localhost" passed into anchor test) to
the 127.0.0.1 equivalents.
- Around line 88-89: The curl health-check inside the startup loop (the command
calling curl -fsS http://127.0.0.1:7799/health) can hang if the endpoint accepts
TCP but stalls; update that curl invocation to include a connection timeout and
an overall timeout (e.g. --connect-timeout 2 --max-time 5) so each probe has a
per-attempt deadline and the for-loop can progress reliably.

In @.gitignore:
- Line 29: Replace the redundant gitignore pattern '**/**/**.log' with the
simpler equivalent '**/*.log' to match all .log files recursively; locate the
entry containing the string '**/**/**.log' and update it to '**/*.log' for
improved readability and maintainability.

In `@spl-tokens/app/app/README.md`:
- Around line 44-48: The README refers only to SETUP_MINT but the app checks
both process.env.SETUP_MINT and process.env.REACT_APP_SETUP_MINT (see App.tsx /
App component), so update the README to document REACT_APP_SETUP_MINT as the
recommended variable for Create React App builds and explicitly note that
SETUP_MINT may be present only when injected via craco or custom build tooling;
mention both names and clarify which one is used for CRA (REACT_APP_SETUP_MINT)
and which is for craco-injected env (SETUP_MINT).

In `@spl-tokens/app/app/src/App.tsx`:
- Line 1520: The call to eConn.getAccountInfo(shuttleWalletAta) is awaiting a
value that's never used; either remove the call to avoid an unnecessary RPC or
capture/use/log the returned AccountInfo (or add a comment if it's intentionally
for warming/debugging). Update the invocation in App.tsx where
eConn.getAccountInfo(shuttleWalletAta) appears: if you need the info, assign it
to a variable (e.g., const info = await eConn.getAccountInfo(shuttleWalletAta))
and use or log it; otherwise delete the await call or add a clear comment
explaining it's solely for cache-warming to justify the RPC.
- Around line 1150-1156: The airdrop call (ensureAirdropLamports) is commented
out causing potential transaction failures when payer lacks SOL; restore or
replace it with a balance check before proceeding: use
connection.getBalance(payer.publicKey) to compare against the required minimum
(rent + estimated fee, e.g., ~0.11 SOL), and if insufficient call
ensureAirdropLamports(payer.publicKey) or set a user-facing error state and
return early (ensure to clear setIsSubmitting on error); locate this logic
around the block using setIsSubmitting(true), validator.current,
ensureAirdropLamports, connection, and payer.publicKey.
- Around line 882-891: The current logic that schedules retries when
queueValidator is missing can loop forever; add a retry counter (e.g.,
autoSetupRetryCountRef) alongside autoSetupRetryTimeoutRef, increment it each
time you schedule setupAll, and stop scheduling once it reaches a configurable
MAX_AUTO_SETUP_RETRIES; when the limit is reached clear any timeout, surface a
user-facing error state (e.g., set a state like autoSetupError) and stop further
retries, and ensure setupAll.catch still logs the error and resets the
timeout/ref appropriately; update uses of queueValidator,
autoSetupRetryTimeoutRef, and setupAll to incorporate the counter and MAX limit.

---

Outside diff comments:
In `@spl-tokens/app/app/src/App.tsx`:
- Line 863: The call to
ephemeralConnection!.current!.getAccountInfo(shuttleWalletAta) can throw when
ephemeralConnection.current is null; update the code to only call getAccountInfo
when ephemeralConnection.current is present and when usesEphemeralConnection is
true (or otherwise expected to exist). Specifically, check ephemeralConnection
&& ephemeralConnection.current before invoking getAccountInfo (or
early-return/skip this block if usesEphemeralConnection is false), and handle
the null case by skipping the fetch or logging an error; reference the
ephemeralConnection object, its current property, the getAccountInfo call, and
shuttleWalletAta to locate and fix the site.
🪄 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: 694efba7-7c60-412c-bea2-9aa86b93b43b

📥 Commits

Reviewing files that changed from the base of the PR and between cd501ef and 73e4ec2.

⛔ Files ignored due to path filters (3)
  • bolt-counter/package-lock.json is excluded by !**/package-lock.json
  • spl-tokens/app/app/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • spl-tokens/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • .github/workflows/test-examples.yml
  • .gitignore
  • spl-tokens/app/app/README.md
  • spl-tokens/app/app/craco.config.js
  • spl-tokens/app/app/package.json
  • spl-tokens/app/app/src/App.tsx
  • spl-tokens/app/app/tsconfig.tsbuildinfo
  • spl-tokens/package.json

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31f607e2d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
spl-tokens/app/app/src/App.tsx (1)

863-863: 🧹 Nitpick | 🔵 Trivial

Unused getAccountInfo call with non-null assertions.

Similar to other instances in this file, this call awaits but doesn't capture the result. Additionally, the !.current! non-null assertions bypass null checks - consider using the already-validated eConn variable (from line 739) instead for consistency with the rest of the function.

💡 Suggested fix
-            await ephemeralConnection!.current!.getAccountInfo(shuttleWalletAta);
+            // Cache warming / propagation wait
+            await eConn!.getAccountInfo(shuttleWalletAta);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@spl-tokens/app/app/src/App.tsx` at line 863, The awaited call uses non-null
assertions on ephemeralConnection and doesn't capture its result; replace it
with the already-validated connection variable and either use or omit the
returned value: call getAccountInfo on eConn (e.g., const accountInfo = await
eConn.getAccountInfo(shuttleWalletAta)) or remove the await if the result isn't
needed; update the line referencing ephemeralConnection!.current! to use eConn
and handle the returned accountInfo accordingly (or drop the call).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/test-examples.yml:
- Around line 54-56: The workflow removed seeding for the localhost
mb-test-validator so tests that expect pre-existing Magic Block accounts fail;
update the job that runs the mb-test-validator command to seed the equivalent
accounts/programs into ./my-ledger-1 before or as part of startup (for example
by invoking the same seed script or adding the validator flags that load the
snapshot/clone or program/account files) so that the mb-test-validator
invocation (the line with "mb-test-validator --ledger ./my-ledger-1 --reset &")
restores the required accounts; ensure the seeding step targets the same ledger
path and runs prior to tests referenced in
pinocchio-secret-counter/tests/web3js/pinocchio-secret-counter.test.ts,
pinocchio-counter/tests/web3js/pinocchio-counter.test.ts,
pinocchio-counter/tests/kit/pinocchio-counter.test.ts and
oncurve-delegation/tests/web3js/oncurve-delegation.test.ts.
- Around line 75-79: Replace the bare port check using "timeout 60 bash -c
'until curl -s http://localhost:7799 ...' " with a health-probe that uses curl
-f against the service's /health endpoint (e.g., curl -fsS
http://localhost:7799/health) so the loop only succeeds on 2xx responses; update
the command that currently references "curl -s http://localhost:7799" to probe
"/health" and include the -f flag (and -s/-S as desired) so failures return
non‑zero and the readiness loop behaves correctly.

In `@spl-tokens/app/app/src/App.tsx`:
- Around line 1143-1227: After a successful queue setup in handleSetupQueue,
call refreshBalances() to update displayed SOL balances (e.g., invoke
refreshBalances() right after setTransactionSuccess(...) so the UI reflects the
0.1 SOL transfer to the rent PDA); also ensure refreshBalances is included in
the handleSetupQueue dependency array so the callback captures the latest
reference. Reference: handleSetupQueue, setTransactionSuccess, deriveRentPda,
refreshBalances.

---

Outside diff comments:
In `@spl-tokens/app/app/src/App.tsx`:
- Line 863: The awaited call uses non-null assertions on ephemeralConnection and
doesn't capture its result; replace it with the already-validated connection
variable and either use or omit the returned value: call getAccountInfo on eConn
(e.g., const accountInfo = await eConn.getAccountInfo(shuttleWalletAta)) or
remove the await if the result isn't needed; update the line referencing
ephemeralConnection!.current! to use eConn and handle the returned accountInfo
accordingly (or drop the call).
🪄 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: 208ce31d-851b-4193-8dd0-6961aa27a4ae

📥 Commits

Reviewing files that changed from the base of the PR and between 73e4ec2 and 31f607e.

📒 Files selected for processing (2)
  • .github/workflows/test-examples.yml
  • spl-tokens/app/app/src/App.tsx

Comment on lines +54 to +56
mb-test-validator \
--ledger ./my-ledger-1 \
--reset \
--clone mAGicPQYBMvcYveUZA5F5UNNwyHvfYh5xkLS2Fr1mev \
--clone EpJnX7ueXk7fKojBymqmVuCuwyhDQsYcLVL1XMsBbvDX \
--clone 7JrkjmZPprHwtuvtuGTXp9hwfGYFAQLnLeFM52kqAgXg \
--clone noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV \
--clone-upgradeable-program DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh \
--clone Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh \
--clone 5hBR571xnXppuCPveTrctfTU7tJLSN94nq7kv7FRK5Tc \
--clone F72HqCR8nwYsVyeVd38pgKkjXmXFzVAM8rjZZsXWbdE \
--clone vrfkfM4uoisXZQPrFiS2brY4oMkU9EWjyvmvqaFd5AS \
--clone-upgradeable-program Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz \
--clone-upgradeable-program BTWAqWNBmF2TboMh3fxMJfgR16xGHYD7Kgr2dPwbRPBi \
--url https://api.devnet.solana.com &
--reset &
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.

⚠️ Potential issue | 🟠 Major

Restore the localhost validator seeding that the other example suites still depend on.

This now starts from a clean ledger with no replacement for the old clone/snapshot setup, but several localhost-mode tests still reference pre-existing Magic Block accounts: pinocchio-secret-counter/tests/web3js/pinocchio-secret-counter.test.ts:91-105, pinocchio-counter/tests/web3js/pinocchio-counter.test.ts:172-190, pinocchio-counter/tests/kit/pinocchio-counter.test.ts:171-183, and oncurve-delegation/tests/web3js/oncurve-delegation.test.ts:49-52. Re-enabling those jobs will break unless this step seeds the equivalent accounts/programs back into mb-test-validator.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test-examples.yml around lines 54 - 56, The workflow
removed seeding for the localhost mb-test-validator so tests that expect
pre-existing Magic Block accounts fail; update the job that runs the
mb-test-validator command to seed the equivalent accounts/programs into
./my-ledger-1 before or as part of startup (for example by invoking the same
seed script or adding the validator flags that load the snapshot/clone or
program/account files) so that the mb-test-validator invocation (the line with
"mb-test-validator --ledger ./my-ledger-1 --reset &") restores the required
accounts; ensure the seeding step targets the same ledger path and runs prior to
tests referenced in
pinocchio-secret-counter/tests/web3js/pinocchio-secret-counter.test.ts,
pinocchio-counter/tests/web3js/pinocchio-counter.test.ts,
pinocchio-counter/tests/kit/pinocchio-counter.test.ts and
oncurve-delegation/tests/web3js/oncurve-delegation.test.ts.

Comment on lines +75 to +79
timeout 60 bash -c 'until curl -s http://localhost:7799 >/dev/null 2>&1; do sleep 1; done' || {
echo "ephemeral-validator did not become ready within 60 seconds"
cat /tmp/ephemeral-validator.log || true
exit 1
}
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the test-examples.yml file around the flagged lines
cat -n .github/workflows/test-examples.yml | head -100

Repository: magicblock-labs/magicblock-engine-examples

Length of output: 3946


🏁 Script executed:

# Search for the ephemeral-validator implementation
find . -type f -name "*.ts" -o -name "*.js" -o -name "*.go" -o -name "Dockerfile*" | grep -i ephemeral

Repository: magicblock-labs/magicblock-engine-examples

Length of output: 210


🏁 Script executed:

# Look for where port 7800 is used in the codebase
rg "7800|websocket" -i

Repository: magicblock-labs/magicblock-engine-examples

Length of output: 27476


🏁 Script executed:

# Check if there's a /health endpoint mentioned anywhere
rg "/health" -i

Repository: magicblock-labs/magicblock-engine-examples

Length of output: 259


Probe the health endpoint instead of just verifying the port is listening.

curl -s http://localhost:7799 only confirms the listener accepted a request. Without the -f flag, it exits 0 on HTTP 4xx/5xx responses, allowing the loop to advance before the ephemeral validator is actually healthy. The codebase already establishes the pattern of probing /health endpoints (see fullstack-test.sh), which should be used here instead.

Suggested fix
-          timeout 60 bash -c 'until curl -s http://localhost:7799 >/dev/null 2>&1; do sleep 1; done' || {
+          timeout 60 bash -c 'until curl -fsS http://localhost:7799/health >/dev/null 2>&1; do sleep 1; done' || {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
timeout 60 bash -c 'until curl -s http://localhost:7799 >/dev/null 2>&1; do sleep 1; done' || {
echo "ephemeral-validator did not become ready within 60 seconds"
cat /tmp/ephemeral-validator.log || true
exit 1
}
timeout 60 bash -c 'until curl -fsS http://localhost:7799/health >/dev/null 2>&1; do sleep 1; done' || {
echo "ephemeral-validator did not become ready within 60 seconds"
cat /tmp/ephemeral-validator.log || true
exit 1
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/test-examples.yml around lines 75 - 79, Replace the bare
port check using "timeout 60 bash -c 'until curl -s http://localhost:7799 ...' "
with a health-probe that uses curl -f against the service's /health endpoint
(e.g., curl -fsS http://localhost:7799/health) so the loop only succeeds on 2xx
responses; update the command that currently references "curl -s
http://localhost:7799" to probe "/health" and include the -f flag (and -s/-S as
desired) so failures return non‑zero and the readiness loop behaves correctly.

Comment on lines +1143 to +1227
const handleSetupQueue = useCallback(async () => {
setTransactionError(null);
setTransactionSuccess(null);

const payer = accounts[0]?.keypair;
if (!payer) {
setTransactionError('Queue payer not available.');
return;
}

const queueMintText = queueMintAddress.trim();
if (!queueMintText) {
setTransactionError('Queue mint public key is required.');
return;
}

try {
setIsSubmitting(true);
const queueValidator = validator.current;
if (!queueValidator) {
throw new Error('Validator not loaded yet for queue setup');
}

const minimumQueueSetupLamports = LAMPORTS_PER_SOL / 10 + LAMPORTS_PER_SOL / 100;
let payerBalance = await connection.getBalance(payer.publicKey, 'confirmed');
if (payerBalance < minimumQueueSetupLamports) {
await ensureAirdropLamports(connection, payer.publicKey);
payerBalance = await connection.getBalance(payer.publicKey, 'confirmed');
if (payerBalance < minimumQueueSetupLamports) {
setTransactionError('Queue setup requires at least 0.11 SOL in the payer account.');
return;
}
}

const queueMint = new PublicKey(queueMintText);
const [transferQueue] = deriveTransferQueue(queueMint, queueValidator);
const [rentPda] = deriveRentPda();
console.log("Transfer queue:", transferQueue.toBase58());
console.log("Rent pda: ", rentPda.toBase58());

const tx = new Transaction().add(
initTransferQueueIx(
payer.publicKey,
transferQueue,
queueMint,
queueValidator,
),
initRentPdaIx(
payer.publicKey,
rentPda,
),
SystemProgram.transfer({
fromPubkey: payer.publicKey,
toPubkey: rentPda,
lamports: LAMPORTS_PER_SOL / 10,
}),
delegateTransferQueueIx(
transferQueue,
payer.publicKey,
queueMint,
),
);
tx.feePayer = payer.publicKey;

const sig = await sendAndConfirmTransaction(
connection,
tx,
[payer],
{
commitment: 'confirmed',
preflightCommitment: 'confirmed',
skipPreflight: true,
},
);


setTransactionSuccess(
`Queue setup confirmed for ${queueMint.toBase58()}: ${sig.substring(0, 10)}...${sig.substring(sig.length - 10)}`,
);
} catch (e: any) {
setTransactionError(await formatTransactionError(e, connection));
} finally {
setIsSubmitting(false);
}
}, [accounts, connection, ensureAirdropLamports, queueMintAddress]);
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.

🧹 Nitpick | 🔵 Trivial

Consider calling refreshBalances() after queue setup.

The function transfers 0.1 SOL to the rent PDA but doesn't refresh balances afterward. This may leave the displayed SOL balance stale until the next manual refresh.

💡 Suggested fix
             `Queue setup confirmed for ${queueMint.toBase58()}: ${sig.substring(0, 10)}...${sig.substring(sig.length - 10)}`,
         );
+        await refreshBalances();
     } catch (e: any) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@spl-tokens/app/app/src/App.tsx` around lines 1143 - 1227, After a successful
queue setup in handleSetupQueue, call refreshBalances() to update displayed SOL
balances (e.g., invoke refreshBalances() right after setTransactionSuccess(...)
so the UI reflects the 0.1 SOL transfer to the rent PDA); also ensure
refreshBalances is included in the handleSetupQueue dependency array so the
callback captures the latest reference. Reference: handleSetupQueue,
setTransactionSuccess, deriveRentPda, refreshBalances.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a705742047

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +966 to +971
if (!queueValidator) {
if (autoSetupRetryTimeoutRef.current === null) {
autoSetupRetryTimeoutRef.current = setTimeout(() => {
autoSetupRetryTimeoutRef.current = null;
setupAll().catch(console.error);
}, 1000);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Surface setup failure when validator identity never resolves

When validator.current is unset, setupAll exits early and only schedules another delayed retry; it never enters the try/catch path that reports errors. In environments where getIdentity fails permanently (e.g., endpoint/network issue), auto-setup loops forever and clicking Setup appears to do nothing, so users are left without an initialized mint or a clear remediation path.

Useful? React with 👍 / 👎.

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.

1 participant