Skip to content

Handle ALT extend invalid instruction data#1287

Merged
GabrielePicco merged 5 commits into
masterfrom
fix/table-mania-alt-fallback
Jun 4, 2026
Merged

Handle ALT extend invalid instruction data#1287
GabrielePicco merged 5 commits into
masterfrom
fix/table-mania-alt-fallback

Conversation

@GabrielePicco
Copy link
Copy Markdown
Collaborator

@GabrielePicco GabrielePicco commented Jun 3, 2026

Summary

Problem: Table Mania retried the same active lookup table when an ALT extend transaction failed with InstructionError(2, InvalidInstructionData). That could keep replaying the same rejected extend path and let committor preparation fail instead of moving the reservation forward.

Solution: classify InvalidInstructionData at the existing-table ALT extend instruction, skip the normal retry path for that table, and create a fresh lookup table with a minimal one-key init payload. Other extend failures still use the existing bounded retry behavior.

Summary by CodeRabbit

  • Improvements

    • Enhanced lookup table extension with improved error detection and resilience mechanisms
    • Added automatic retry and fallback strategies when table extension encounters specific errors
  • Chores

    • Updated dependencies for error handling capabilities

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Warning

Review limit reached

@GabrielePicco, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 49 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 826e1661-5cc5-468c-8f35-b4b6bda1010a

📥 Commits

Reviewing files that changed from the base of the PR and between 88a8802 and 9bc5254.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • magicblock-table-mania/src/lookup_table_rc.rs
  • magicblock-table-mania/src/manager.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/table-mania-alt-fallback

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.

@GabrielePicco GabrielePicco requested a review from thlorenz June 3, 2026 17:09
@GabrielePicco GabrielePicco marked this pull request as ready for review June 3, 2026 17:10
@GabrielePicco
Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 2

🤖 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 `@magicblock-table-mania/src/manager.rs`:
- Around line 393-397: The code treats any InvalidInstructionData at
EXTEND_LOOKUP_TABLE_INSTRUCTION_INDEX as ExtendTableErrorAction::CreateNewTable
without reducing the retry budget, which can cause many tiny tables to be
created; add a small cap (e.g. MAX_CONSECUTIVE_FORCED_NEW_TABLES constant) and
track a consecutive_create_new_table counter in the loop that handles extend
errors (the same area using err.is_sent_transaction_invalid_instruction_data_at
and ExtendTableErrorAction::CreateNewTable); when the counter exceeds the cap,
change the fallback behavior to a bounded alternative (e.g. treat as
BubbleExtend/other ExtendTableErrorAction or return a hard error) and reset the
counter when a different error or a successful extend occurs, and ensure
FALLBACK_NEW_TABLE_INIT_PUBKEYS/remaining logic is respected so we don’t consume
all remaining pubkeys by repeated forced-new-table creations.
- Line 288: The variable extend_errors in reserve_new_pubkeys currently
accumulates across all tables/iterations causing a global retry budget; change
its scope/behavior so the retry budget is per-table or per-attempt: either move
the declaration/initialization of extend_errors inside the per-table loop (or
inside the retry loop that wraps calls like extend_table or extend_pubkeys) or
reset extend_errors to 0 whenever successful progress is made (e.g., after a
successful extend operation in reserve_new_pubkeys and related loops). Update
any related loops (the sections around the other extend logic mentioned) to
follow the same per-table/per-attempt reset so transient failures on different
tables do not aggregate and abort the whole reservation.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3a17c1a0-8987-4465-b9f9-f3e97e6096e2

📥 Commits

Reviewing files that changed from the base of the PR and between 8ee6832 and 88a8802.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • magicblock-table-mania/Cargo.toml
  • magicblock-table-mania/src/error.rs
  • magicblock-table-mania/src/manager.rs

Comment thread magicblock-table-mania/src/manager.rs
Comment thread magicblock-table-mania/src/manager.rs
Copy link
Copy Markdown
Collaborator

@thlorenz thlorenz left a comment

Choose a reason for hiding this comment

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

LGTM with a minor concern. You can decide if that is an issue or not:

This fallback only skips the failed table for the current reservation attempt. Since the table is not marked non-extendable, it can be selected again later if it becomes active_tables.last() again, e.g. after the fallback table is released while the original table still has reservations. Should we persistently quarantine/mark the table as no-longer-extendable after InvalidInstructionData, while still allowing it to satisfy existing lookups?

If it is ok to try to extend the same table again in the future and then end up in the same fallback then it is not an issue, but wanted to point it ou.


Step-by-step details of the issue:

  1. reserve_new_pubkeys only attempts to extend active_tables.last() when that table is not full.

    • See magicblock-table-mania/src/manager.rs:300-303.
  2. When extending Table A fails with InvalidInstructionData, the PR sets force_new_table = true.

    • See magicblock-table-mania/src/manager.rs:317-324.
  3. force_new_table is only a local variable for the current loop iteration.

    • It is initialized on each iteration at magicblock-table-mania/src/manager.rs:294.
    • Nothing is stored on Table A to indicate that future extends should be skipped.
  4. The fallback then creates Table B and pushes it to active_tables.

    • See magicblock-table-mania/src/manager.rs:376-377.
  5. Immediately after this, future reservations will try Table B first because it is now active_tables.last().

  6. However, Table A remains active and is not marked full/non-extendable.

    • Fullness is based only on local pubkey count: magicblock-table-mania/src/lookup_table_rc.rs:350-357.
  7. If Table B is later released while Table A still has reservations, release_pubkeys can remove B from active_tables and keep A.

    • See magicblock-table-mania/src/manager.rs:552-563.
  8. At that point, active_tables may become [A] again.

  9. Since A is still not full locally and is again active_tables.last(), a new reservation can try to extend A again.

  10. So the fallback avoids retrying A only in the immediate flow, but does not persistently prevent future attempts to extend A.

@GabrielePicco
Copy link
Copy Markdown
Collaborator Author

mark the table as no-longer-extendable after InvalidInstructionData

Fair point, added a table.mark_non_extendable() on this case

@GabrielePicco GabrielePicco enabled auto-merge (squash) June 4, 2026 08:13
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: 460bae6ec1

ℹ️ 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 thread magicblock-table-mania/src/manager.rs Outdated
@GabrielePicco GabrielePicco merged commit 001ec80 into master Jun 4, 2026
33 checks passed
@GabrielePicco GabrielePicco deleted the fix/table-mania-alt-fallback branch June 4, 2026 08:50
thlorenz added a commit that referenced this pull request Jun 5, 2026
* master:
  fix: reject short account responses (#1290)
  fix: wait for pubsub listeners before reconnect (#1253)
  fix: retry failed program subscriptions (#1268)
  release: 0.12.0 (#1299)
  Ignore compute unit price in processor fees (#1298)
  Recover recent pending intents on restart (#1296)
  chore: adjust log level (#1297)
  release: v0.11.4 (#1292)
  fix(scheduler): remove block subscription in the scheduler (#1293)
  fix(committor): race-condition on cleanup (#1291)
  Handle ALT extend invalid instruction data (#1287)
  fix: use provided compute limits instead of defaults (#1289)
  feat: snapshot accountsdb even in the replica mode (#1282)
  feat: added vrf ephemeral test queue, delegation record and metadata for mb-test-validator (#1281)
  fix: use wire size (1232), not encoded size (1644), for tx fit checks! (#1285)
  chore: simplify, rename out_of_order_slot and add a comment (#1284)
  fix: execute post-delegation actions after clone (#1278)
  Handle oversized single-stage committor transactions (#1277)
  Reduce committor RPC confirmation calls (#1271)
  fix: preserve streams on optimize failure (#1273)
thlorenz added a commit that referenced this pull request Jun 5, 2026
* master:
  fix: reject short account responses (#1290)
  fix: wait for pubsub listeners before reconnect (#1253)
  fix: retry failed program subscriptions (#1268)
  release: 0.12.0 (#1299)
  Ignore compute unit price in processor fees (#1298)
  Recover recent pending intents on restart (#1296)
  chore: adjust log level (#1297)
  release: v0.11.4 (#1292)
  fix(scheduler): remove block subscription in the scheduler (#1293)
  fix(committor): race-condition on cleanup (#1291)
  Handle ALT extend invalid instruction data (#1287)
  fix: use provided compute limits instead of defaults (#1289)
  feat: snapshot accountsdb even in the replica mode (#1282)
  feat: added vrf ephemeral test queue, delegation record and metadata for mb-test-validator (#1281)
  fix: use wire size (1232), not encoded size (1644), for tx fit checks! (#1285)
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.

2 participants