Skip to content

feat: remove noop dependency - #721

Merged
GabrielePicco merged 4 commits into
masterfrom
dode/remove-noop-dep
Dec 5, 2025
Merged

GabrielePicco merged 4 commits into
masterfrom
dode/remove-noop-dep

Conversation

@Dodecahedr0x

@Dodecahedr0x Dodecahedr0x commented Dec 4, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #563

Removes the dependency on an external noop program in favor of a noop magic program instruction.

Summary by CodeRabbit

  • New Features

    • Added a no-op instruction type that carries a numeric payload and is accepted by the processor.
  • Tests

    • Simplified test setup by removing noop-transaction workarounds and directly querying the latest ephemeral blockhash.
  • Chores

    • Removed the separate noop program and related test helpers from test configs and test tooling.
  • Bug Fixes / Stability

    • Added a short wait after task cancellation to ensure state changes are observed reliably.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 4, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new public enum variant Noop(u64) to MagicBlockInstruction and a helper InstructionUtils::noop_instruction(u64) to construct it. Replaces manual noop construction in the task scheduler and tests with the helper (using an atomic counter for unique payloads). The runtime processor now accepts Noop(_) and returns success. Removes the NOOP_PROGRAM_ID constant and the noop program entry from test configs. Tests obtain ephemeral blockhashes directly from the test context instead of sending noop transactions. A short sleep was added after CancelTask in one test to allow synchronization.

Possibly related PRs

  • feat: cranked commits #656 — modifies MagicBlockInstruction variants and instruction_utils, creating a direct code-level overlap with the added Noop(u64) variant and noop helper.

Suggested reviewers

  • GabrielePicco
  • thlorenz
  • bmuddha

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR successfully addresses issue #563 by replacing external noop program dependency with a built-in MagicBlockInstruction::Noop variant, eliminating deployment requirements.
Out of Scope Changes check ✅ Passed All changes are directly aligned with removing the noop dependency. Updates to test infrastructure, instruction handling, and blockhash retrieval are necessary consequences of the refactoring.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dode/remove-noop-dep

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78f489d and 32510b5.

📒 Files selected for processing (1)
  • magicblock-task-scheduler/tests/service.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 650
File: magicblock-chainlink/src/submux/subscription_task.rs:13-99
Timestamp: 2025-11-20T08:57:07.217Z
Learning: In the magicblock-validator repository, avoid posting review comments that merely confirm code is correct or matches intended behavior without providing actionable feedback, suggestions for improvement, or identifying potential issues. Such confirmatory comments are considered unhelpful noise by the maintainers.
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • magicblock-task-scheduler/tests/service.rs
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • magicblock-task-scheduler/tests/service.rs
📚 Learning: 2025-11-07T13:09:52.253Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.

Applied to files:

  • magicblock-task-scheduler/tests/service.rs
📚 Learning: 2025-11-07T14:20:31.457Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

Applied to files:

  • magicblock-task-scheduler/tests/service.rs
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • magicblock-task-scheduler/tests/service.rs

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.

@github-actions

github-actions Bot commented Dec 4, 2025 •

Copy link
Copy Markdown
Contributor

Manual Deploy Available

You can trigger a manual deploy of this PR branch to testnet:

Deploy to Testnet 🚀

Alternative: Comment /deploy on this PR to trigger deployment directly.

⚠️ Note: Manual deploy requires authorization. Only authorized users can trigger deployments.

Comment updated automatically when the PR is synchronized.

@Dodecahedr0x

Copy link
Copy Markdown
Contributor Author

@lucacillario this removes the need to upload the noop program when deploying

@bmuddha bmuddha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, please also remove noop program from test-kit

// -----------------
// Noop
// -----------------
pub fn noop(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: Not sure why this is even needed? It's not used anywhere

@Dodecahedr0x Dodecahedr0x Dec 4, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Repeated the style of util functions having ix and tx but agreed, addressed in 78f489d

@Dodecahedr0x

Copy link
Copy Markdown
Contributor Author

The noop program is already removed from test-kit

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e15e640 and 78f489d.

📒 Files selected for processing (1)
  • programs/magicblock/src/utils/instruction_utils.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 650
File: magicblock-chainlink/src/submux/subscription_task.rs:13-99
Timestamp: 2025-11-20T08:57:07.217Z
Learning: In the magicblock-validator repository, avoid posting review comments that merely confirm code is correct or matches intended behavior without providing actionable feedback, suggestions for improvement, or identifying potential issues. Such confirmatory comments are considered unhelpful noise by the maintainers.
🧬 Code graph analysis (1)
programs/magicblock/src/utils/instruction_utils.rs (1)
magicblock-task-scheduler/src/service.rs (1)
  • noop_instruction (315-318)

Comment on lines +281 to +290
// -----------------
// Noop
// -----------------
pub fn noop_instruction(data: u64) -> Instruction {
Instruction::new_with_bincode(
crate::id(),
&MagicBlockInstruction::Noop(data),
vec![],
)
}

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

Clarify noop_instruction semantics with a short doc comment

The implementation looks fine, but the intent of data and the empty account metas isn’t obvious to a reader unfamiliar with the Noop variant. A brief doc comment would make it clear that the payload is just a nonce/uniqueness seed and that the processor ignores it and expects no accounts.

You could do something like:

-    // -----------------
-    // Noop
-    // -----------------
-    pub fn noop_instruction(data: u64) -> Instruction {
+    // -----------------
+    // Noop
+    // -----------------
+    /// Creates a MagicBlock `Noop` instruction.
+    ///
+    /// `data` is an arbitrary nonce used only to make the instruction
+    /// unique; it is ignored by the on-chain processor and no accounts
+    /// are required for this instruction.
+    pub fn noop_instruction(data: u64) -> Instruction {
         Instruction::new_with_bincode(
             crate::id(),
             &MagicBlockInstruction::Noop(data),
             vec![],
         )
     }

This should help future callers understand how to use this helper correctly without having to inspect the processor logic. Based on learnings, avoiding pure LGTM comments.

📝 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
// -----------------
// Noop
// -----------------
pub fn noop_instruction(data: u64) -> Instruction {
Instruction::new_with_bincode(
crate::id(),
&MagicBlockInstruction::Noop(data),
vec![],
)
}
// -----------------
// Noop
// -----------------
/// Creates a MagicBlock `Noop` instruction.
///
/// `data` is an arbitrary nonce used only to make the instruction
/// unique; it is ignored by the on-chain processor and no accounts
/// are required for this instruction.
pub fn noop_instruction(data: u64) -> Instruction {
Instruction::new_with_bincode(
crate::id(),
&MagicBlockInstruction::Noop(data),
vec![],
)
}
🤖 Prompt for AI Agents
In programs/magicblock/src/utils/instruction_utils.rs around lines 281 to 290,
the noop_instruction helper lacks documentation explaining the semantics of its
`data` parameter and the empty account vec; add a short doc comment above the
function that states: the `data` argument is a payload used only as a
nonce/uniqueness seed (ignored by the processor), the Noop variant does not
require or use any account metas so the returned Instruction intentionally has
an empty account list, and callers should not expect any on-chain effects —
update the comment to be concise and place it directly above the pub fn
noop_instruction signature.

@GabrielePicco
GabrielePicco merged commit d2ff908 into master Dec 5, 2025
18 checks passed
@GabrielePicco
GabrielePicco deleted the dode/remove-noop-dep branch December 5, 2025 17:05
Dodecahedr0x added a commit that referenced this pull request Dec 8, 2025
Dodecahedr0x added a commit that referenced this pull request Dec 8, 2025
thlorenz added a commit that referenced this pull request Dec 9, 2025
* master:
  chore: remove solana-sdk from workspace (#733)
  Feat: patched rocksdb to 0.23.0 (#692)
  fix: prune program cache on each slot transition (#736)
  Hotfix/disable frequency commits (#735)
  feat: remove noop dependency (#721)
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.

Load noop program by default

3 participants