-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Add support for CommitDiff to efficiently commit small changes in large delegated accounts
#575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
249b1aa to
2f0555f
Compare
0151da0 to
5c25e73
Compare
MagicBlockInstruction::ScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accounts
MagicBlockInstruction::ScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accountsScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accounts
2ae750b to
725f72c
Compare
Manual Deploy AvailableYou can trigger a manual deploy of this PR branch to testnet: Alternative: Comment
Comment updated automatically when the PR is synchronized. |
725f72c to
e5c5e15
Compare
ScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accountsScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accounts
ScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accountsScheduleCommitDiffAndUndelegate to efficiently commit changes in delegated accounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 29
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
magicblock-committor-service/src/tasks/args_task.rs (1)
229-237: reset_commit_id ignores CommitDiff—update both variants.Commit IDs must update for Commit and CommitDiff.
Apply:
- let ArgsTaskType::Commit(commit_task) = &mut self.task_type else { - log::error!("reset_commit_id"); - return; - }; - - commit_task.commit_id = commit_id; + match &mut self.task_type { + ArgsTaskType::Commit(task) | ArgsTaskType::CommitDiff(task) => { + task.commit_id = commit_id; + } + _ => {} + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (28)
Cargo.toml(1 hunks)magicblock-accounts/src/scheduled_commits_processor.rs(3 hunks)magicblock-committor-service/src/tasks/args_task.rs(6 hunks)magicblock-committor-service/src/tasks/mod.rs(1 hunks)magicblock-committor-service/src/tasks/task_builder.rs(3 hunks)magicblock-committor-service/src/tasks/task_visitors/persistor_visitor.rs(1 hunks)magicblock-magic-program-api/src/instruction.rs(1 hunks)magicblock-rpc-client/src/lib.rs(1 hunks)programs/magicblock/src/magic_scheduled_base_intent.rs(7 hunks)programs/magicblock/src/magicblock_processor.rs(4 hunks)programs/magicblock/src/schedule_transactions/process_schedule_commit.rs(2 hunks)programs/magicblock/src/schedule_transactions/process_scheduled_commit_sent.rs(5 hunks)test-integration/Cargo.toml(2 hunks)test-integration/programs/schedulecommit-security/src/lib.rs(2 hunks)test-integration/programs/schedulecommit/src/api.rs(5 hunks)test-integration/programs/schedulecommit/src/lib.rs(9 hunks)test-integration/programs/schedulecommit/src/order_book.rs(1 hunks)test-integration/programs/schedulecommit/src/utils/mod.rs(3 hunks)test-integration/schedulecommit/client/src/schedule_commit_context.rs(6 hunks)test-integration/schedulecommit/client/src/verify.rs(2 hunks)test-integration/schedulecommit/test-scenarios/Cargo.toml(1 hunks)test-integration/schedulecommit/test-scenarios/tests/01_commits.rs(2 hunks)test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs(4 hunks)test-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs(1 hunks)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs(1 hunks)test-integration/test-ledger-restore/tests/08_commit_update.rs(2 hunks)test-integration/test-tools/src/integration_test_context.rs(2 hunks)test-integration/test-tools/src/scheduled_commits.rs(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-26T08:49:31.543Z
Learnt from: taco-paco
PR: magicblock-labs/magicblock-validator#585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
Applied to files:
magicblock-committor-service/src/tasks/args_task.rs
🧬 Code graph analysis (15)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
test-integration/test-ledger-restore/src/lib.rs (1)
setup_validator_with_local_remote(97-119)
test-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs (3)
test-integration/programs/schedulecommit/src/api.rs (1)
schedule_commit_with_payer_cpi_instruction(214-232)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (3)
assert_two_committees_were_committed(68-91)get_context_with_delegated_committees(16-35)assert_feepayer_was_committed(94-113)test-integration/schedulecommit/client/src/verify.rs (1)
fetch_and_verify_commit_result_from_logs(7-14)
test-integration/programs/schedulecommit-security/src/lib.rs (1)
test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
create_schedule_commit_ix(41-66)
magicblock-committor-service/src/tasks/args_task.rs (4)
magicblock-committor-service/src/tasks/mod.rs (2)
instruction(66-66)instruction(249-255)magicblock-committor-service/src/tasks/buffer_task.rs (2)
instruction(65-86)new(37-45)magicblock-committor-service/src/config.rs (1)
local(29-35)magicblock-accounts/src/scheduled_commits_processor.rs (2)
new(66-90)new(420-436)
programs/magicblock/src/magicblock_processor.rs (3)
magicblock-committor-service/src/tasks/args_task.rs (1)
instruction(58-160)programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
process_schedule_commit(34-259)magicblock-committor-program/src/state/changeset.rs (1)
request_undelegation(230-232)
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (4)
test-integration/programs/schedulecommit/src/api.rs (4)
schedule_commit_and_undelegate_cpi_instruction(234-252)schedule_commit_and_undelegate_cpi_with_mod_after_instruction(287-311)schedule_commit_diff_instruction_for_order_book(193-212)update_order_book_instruction(175-191)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (3)
get_context_with_delegated_committees(16-35)assert_one_committee_was_committed(41-65)assert_one_committee_account_was_undelegated_on_chain(190-196)test-integration/schedulecommit/client/src/schedule_commit_context.rs (3)
committees(205-209)ephem_blockhash(322-324)ephem_client(318-320)test-integration/schedulecommit/client/src/verify.rs (1)
fetch_and_verify_order_book_commit_result_from_logs(16-23)
test-integration/programs/schedulecommit/src/api.rs (2)
test-integration/programs/schedulecommit/src/order_book.rs (1)
new(85-94)test-integration/programs/flexi-counter/src/state.rs (1)
pda(32-35)
test-integration/schedulecommit/client/src/verify.rs (2)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
ctx(90-91)test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
ctx(145-146)
magicblock-committor-service/src/tasks/task_builder.rs (2)
magicblock-accounts/src/scheduled_commits_processor.rs (2)
new(66-90)new(420-436)magicblock-committor-service/src/tasks/args_task.rs (1)
new(49-54)
test-integration/programs/schedulecommit/src/lib.rs (2)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
assert_is_signer(30-44)assert_keys_equal(16-28)allocate_account_and_assign_owner(58-106)test-integration/programs/schedulecommit/src/order_book.rs (1)
new(85-94)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (2)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)test-integration/test-committor-service/tests/test_ix_commit_local.rs (1)
base_intent(544-549)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
test-integration/programs/schedulecommit/src/api.rs (3)
init_order_book_instruction(36-54)init_payer_escrow(77-98)init_account_instruction(16-34)
programs/magicblock/src/magic_scheduled_base_intent.rs (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (3)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
ctx(90-91)test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
ctx(145-146)test-integration/schedulecommit/client/src/schedule_commit_context.rs (3)
try_new(72-74)ncommittees(102-121)try_new_random_keys(66-71)
test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
get_context_with_delegated_committees(16-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: run_make_ci_format
- GitHub Check: run_make_ci_test
- GitHub Check: run_make_ci_lint
- GitHub Check: run_make_ci_test
🔇 Additional comments (34)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
55-55: LGTM! Correctly updated to match new function signature.Both call sites properly destructure the new 3-tuple return value. The
_tmpdirbinding is necessary to keep theTempDiralive throughout the function scope, preventing premature cleanup of the temporary directory while the validator is still using it.Also applies to: 170-170
test-integration/programs/schedulecommit/src/utils/mod.rs (2)
53-53: LGTM: Type alignment with Solana API.Changing
sizetou64aligns with Solana'ssystem_instruction::allocateAPI, which expects au64parameter. This improves type consistency and eliminates the need for type conversions downstream.
70-90: LGTM: Clean implementation with helpful debugging.The changes correctly handle the type conversion:
- Line 71: The cast to
usizeis necessary forRent::minimum_balanceand is safe given Solana's practical account size limits.- Lines 75-80: The debug log provides useful visibility into lamport requirements during account allocation.
- Line 90: Passing
sizedirectly asu64tosystem_instruction::allocateis cleaner and aligns with the API signature.test-integration/programs/schedulecommit-security/src/lib.rs (2)
2-2: LGTM: Import addition is correct.The
CommitPolicyimport is necessary for the API change on line 149.
143-150: No action required—the two CPI paths use intentionally different APIs.The review comment's concern about consistency is based on a false premise. The code uses two fundamentally different functions from different modules:
- Path 1 (
schedule_commit_cpi_instruction): A local program API wrapper with a fixed, simplified interface- Path 2 (
create_schedule_commit_ix): An external SDK function with extended configuration options includingCommitPolicyThese are not parallel implementations requiring symmetry. The
schedule_commit_cpi_instructionfunction does not supportCommitPolicyby design—it wraps commit scheduling with hardcoded policy defaults. AddingCommitPolicy::UseFullBytestocreate_schedule_commit_ixis the correct change and requires no corresponding update toschedule_commit_cpi_instruction.Likely an incorrect or invalid review comment.
test-integration/test-tools/src/integration_test_context.rs (1)
167-171: Transaction version configuration is correct and environment-aware.The conditional logic properly handles two distinct RPC endpoints:
- Chain (Solana devnet):
max_supported_transaction_version: Some(0)with 50 retries to handle devnet's known quirk of sometimes returning version responses instead of transaction metadata (noted at line 160-161).- Ephemeral (local validator):
Noneto use default behavior on a controlled, local environment without such quirks.Git history confirms this change is part of the current PR (commit 4c75d78). The code is correctly differentiated for each environment. No changes needed.
test-integration/test-tools/src/scheduled_commits.rs (1)
182-213: LGTM! Clear hierarchical naming for log variables.The renaming from
ephem_logs/chain_logstoephem_logs_l1/ephem_logs_l2improves clarity by establishing a consistent naming convention that reflects the two-level log retrieval hierarchy.magicblock-committor-service/src/tasks/task_visitors/persistor_visitor.rs (1)
29-33: LGTM: CommitDiff included in strategy persistence.Cleanly broadens Commit to CommitDiff without changing strategy semantics.
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (2)
224-230: Diff-aware commit routing is correct; keep logs concise.Choosing StandaloneDiff when request_diff is true is right. Consider demoting the "StandaloneDiff" ic_msg to debug in production builds to reduce log noise.
Also applies to: 233-238
29-32: All call sites properly initialize request_diff—no corrections needed.Verification confirms that every
process_schedule_commit()invocation explicitly sets bothrequest_undelegationandrequest_difffields. All three instruction paths (ScheduleCommit,ScheduleCommitAndUndelegate,ScheduleCommitDiffAndUndelegate) pass values forrequest_diff, withScheduleCommitDiffAndUndelegatecorrectly setting it totrueto trigger theCommitType::StandaloneDiffpath. No uninitialized defaults are used, and no silent routing to full-state commits can occur.programs/magicblock/src/schedule_transactions/process_scheduled_commit_sent.rs (1)
29-30: LGTM: commit_diff added end-to-end with safe logging.Field is carried into printable form and logged only as a flag. Tests initialize the new field.
Also applies to: 44-45, 71-73, 215-217, 254-255
magicblock-committor-service/src/tasks/args_task.rs (1)
197-205: Calibrate compute units for CommitDiff based on diff size.Fixed 65_000 may be inaccurate. Once diff is precomputed, scale CU by diff length/segments or add headroom to avoid CU errors.
Based on learnings
programs/magicblock/src/magicblock_processor.rs (3)
2-2: LGTM: import added is correct.
51-54: ScheduleCommit: explicit request_diff=false is correct.
90-99: New ScheduleCommitDiffAndUndelegate path correctly flips request_diff=true.magicblock-committor-service/src/tasks/task_builder.rs (1)
96-105: Per-account Commit vs CommitDiff task selection is correct.programs/magicblock/src/magic_scheduled_base_intent.rs (6)
104-107: ScheduledBaseIntent::is_commit_diff added — OK.
155-164: MagicBaseIntent::is_commit_diff added — OK.
448-454: CommitType::is_commit_diff implementation — OK.
456-463: Getters updated for StandaloneDiff — OK.Also applies to: 465-473
475-487: is_empty handles StandaloneDiff — OK.
317-323: StandaloneDiff variant already exists and is actively used in the codebase.The review's concern assumes
StandaloneDiffis a new addition that will shift bincode discriminants. However, the variant is already present inprocess_schedule_commit.rs(lines 225–226), indicating it exists before this PR or is not new.If
StandaloneDiffwas already committed to the codebase:
- The bincode discriminant shift already happened (or never was a concern).
- The review comment's warning is outdated or misguided.
If the snippet shows the final state (post-changes) and
StandaloneDiffwas genuinely added in this PR:
- Verify the diff shows it was inserted between existing variants (which would shift discriminants).
- If it was appended after existing variants, discriminants remain stable and no migration is needed.
Critical finding: No backwards compatibility tests, no versioning code, and no serde external tagging exist. If persisted state truly exists and the variant order changed, this is a risk. However, the evidence suggests
StandaloneDiffis not new.Action for developer: Confirm in the PR diff that you are not reordering existing enum variants. If appending new variants after existing ones, bincode compatibility is safe. If inserting between existing variants, migration is required.
test-integration/schedulecommit/test-scenarios/Cargo.toml (1)
19-20: LGTM!The addition of
randandborshas workspace dev-dependencies appropriately supports the new order-book test scenarios introduced in this PR.test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
30-31: LGTM!The addition of deterministic seed
b"magic_schedule_commit"improves test reproducibility by ensuring consistent PDA derivation across test runs.test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (2)
16-35: LGTM!The seed parameter enables deterministic test context initialization, and explicitly driving the
init_committeesanddelegate_committeesworkflow steps with debug logging improves test clarity and observability.
41-47: LGTM!Making
assert_one_committee_was_committedgeneric over typeTwith appropriate trait bounds enables reuse across different account types (MainAccount, OrderBookOwned, etc.) while maintaining type safety.test-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs (2)
23-80: LGTM!The test properly validates that attempting to commit a fee payer without escrowing lamports fails with the expected "DoesNotHaveEscrowAccount" error. The test structure and assertions are appropriate.
83-135: LGTM!The test correctly validates the happy path where fee payer commits succeed when lamports are properly escrowed. The verification flow and assertions comprehensively check that both committees and the fee payer were committed and synchronized.
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (3)
55-56: LGTM!The addition of deterministic seed
b"magic_schedule_commit"ensures reproducible test behavior across runs.
110-164: LGTM!The
commit_and_undelegate_order_book_accounthelper follows the established pattern of other commit helpers in this file, properly constructing the update and schedule-commit-diff instructions sequence.
244-312: Excellent reproducibility design for randomized testing.The test demonstrates best practices for randomized testing:
- Prints the RNG seed for reproducibility
- Includes the seed in assertion failure messages
- Uses seeded RNG (StdRng) for deterministic behavior given a seed
This allows failures to be reproduced by rerunning with the printed seed value.
One optional enhancement: consider adding a way to override the seed via environment variable for easier failure reproduction:
let rng_seed = std::env::var("TEST_RNG_SEED") .ok() .and_then(|s| s.parse::<u64>().ok()) .unwrap_or_else(|| OsRng.next_u64());test-integration/programs/schedulecommit/src/lib.rs (1)
561-571: Use commit_diff for undelegate path; this looks correct.The diff-based commit is invoked when
undelegateis true; good alignment with the new optimization.Please confirm tests cover both diff and full-commit paths (with/without
undelegate).test-integration/programs/schedulecommit/src/order_book.rs (1)
101-116: Bounds/capacity logic is good; but relies on header being valid.Once header init is fixed in
process_init_order_book, these helpers are fine for basic growth semantics.Ensure tests cover:
- Non-zero existing asks/bids followed by additional inserts (to exercise prefix/suffix behavior).
- Capacity exhaustion returning
None.Also applies to: 118-138, 163-184
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
260-267: Seed semantics are correct and consistently applied across the codebase.The verification shows that
delegate_account_cpi_instruction()explicitly branches on two supported canonical seeds:
b"magic_schedule_commit"→ScheduleCommitInstruction::DelegateCpib"order_book"→ScheduleCommitInstruction::DelegateOrderBookAll test utilities and callers supply only these supported seeds. The
delegate_committees()function at lines 260-267 correctly passes&self.user_seed, and all constructors receive only canonical seeds from test callers. PDA derivation and instruction creation use consistent seed semantics.
9c44347 to
693af7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
♻️ Duplicate comments (22)
magicblock-rpc-client/src/lib.rs (1)
430-430: Redundant error prefix persists in log message.The
error!macro already includes ERROR level in its output. The explicit"> ERROR:"prefix creates redundancy and reduces log readability.Apply this diff to remove the redundant prefix:
- error!("> ERROR: {:?}", err); + error!("{:?}", err);Or add context instead:
- error!("> ERROR: {:?}", err); + error!("Transaction processed status failed: {:?}", err);test-integration/test-tools/src/scheduled_commits.rs (2)
198-210: Verbose debug output concern still applies.The past review comment regarding verbose debug output from
println!with{:#?}formatting remains applicable to these new debug statements. Consider making the debug output conditional or using a more compact format.
233-235: Unnecessary clone() on Copy type.The past review comment regarding the redundant
.clone()call onSignature(which implementsCopy) remains applicable. Use*siginstead ofsig.clone().test-integration/test-tools/src/integration_test_context.rs (1)
157-158: Format the panic message withlabel.The panic still prints the literal
rpc_client for [{}] does not exist, so the label never appears when this trips. Please injectlabelinto the message.- let rpc_client = - rpc_client.expect("rpc_client for [{}] does not exist"); + let rpc_client = rpc_client.unwrap_or_else(|| { + panic!("rpc_client for [{}] does not exist", label) + });test-integration/schedulecommit/client/src/verify.rs (1)
16-23: Code duplication: consider the generic implementation suggested in the previous review.This function duplicates
fetch_and_verify_commit_result_from_logsexcept for the type parameter. A generic implementation withT: borsh::BorshDeserializewould eliminate this duplication.test-integration/schedulecommit/client/src/schedule_commit_context.rs (2)
115-118: PDA derivation must match program-side seeds.The PDA is derived using an arbitrary
user_seed, which may not match the on-chain program's expected seeds (e.g.,[b"order_book", book_manager]or[b"magic_schedule_commit", player]). This mismatch will cause transaction failures.
170-203: Validate user_seed explicitly to prevent silent misconfiguration.The implicit
elsebranch will execute for anyuser_seedthat isn'tb"magic_schedule_commit", including invalid values. Add explicit validation to fail fast with a clear error when an unsupported seed is provided.test-integration/programs/schedulecommit/src/api.rs (1)
106-109: Derive delegated PDA with canonical seeds to match on-chain expectations.The PDA is derived using an arbitrary
user_seed, but the on-chain program expects fixed seeds like[b"magic_schedule_commit", player]or[b"order_book", book_manager]. This mismatch will cause thedelegated_accountto not match program-side expectations.Cargo.toml (1)
112-112: CI/CD will fail: local path dependency not available.The path
../delegation-programdoes not exist in the repository or CI environments, causing all builds to fail. Either:
- Revert to a git-based dependency (consistent with the learning about using git branch references)
- Make
delegation-programa workspace member at the correct path- Update CI workflows to checkout the dependency
Verify the intended dependency resolution strategy:
#!/bin/bash # Check if the delegation-program path exists if [ -d "../delegation-program" ]; then echo "✓ Path exists locally" ls -la ../delegation-program/ else echo "✗ Path ../delegation-program does not exist" fi # Check for any git submodule configuration echo "" echo "=== Git submodules ===" git submodule status 2>/dev/null || echo "No submodules configured" # Check recent commits for this dependency change echo "" echo "=== Recent changes to delegation-program dependency ===" git log -n 5 --oneline --all -- Cargo.toml | head -10test-integration/Cargo.toml (1)
40-40: Critical: Local path dependencies will break CI builds.This issue has already been flagged in previous review comments. The local paths
../../ephemeral-rollups-sdk/rust/sdkand../../delegation-programdo not exist in the CI environment and will cause build failures.Also applies to: 60-60
test-integration/programs/schedulecommit/src/lib.rs (4)
302-309: Zero the order-book header immediately after allocation.
OrderBook::newreadsbids_len/asks_lenstraight from account data. Leaving those bytes uninitialized means random counts, which makes the next borrow calculate bogus slices and can walk past the buffer. Please clear the header bytes right after allocation (e.g. borrow data, zero the firstsize_of::<OrderBookHeader>()bytes).Apply this diff:
allocate_account_and_assign_owner(AllocateAndAssignAccountArgs { payer_info: payer, account_info: order_book, owner: &crate::ID, signer_seeds: &[b"order_book", book_manager.key.as_ref(), &[bump]], size: 10 * 1024, })?; + { + let mut data = order_book.try_borrow_mut_data()?; + let header_len = core::mem::size_of::<OrderBookHeader>(); + if data.len() < header_len { + return Err(ProgramError::AccountDataTooSmall); + } + for byte in &mut data[..header_len] { + *byte = 0; + } + } + Ok(())
329-334: Fix the PDA assertion message.The diagnostic still prints
payer.key, so a failing check points at the wrong seed. Swap it forbook_manager.keyas previously requested.Apply this diff:
assert_keys_equal(order_book.key, &pda, || { format!( "PDA for the account ('{}') and for book_manager ('{}') is incorrect", - order_book.key, payer.key + order_book.key, book_manager.key ) })?;
398-403: Update the log label.This path is mutating an existing order book, not initializing one. Please change the
msg!to say “Update order book” (or equivalent) so logs stay accurate.
424-451: Use the right error kind and require the payer to sign.When the accounts slice is the wrong length you must emit
ProgramError::NotEnoughAccountKeys;MissingRequiredSignatureis misleading. More importantly, we still never verifypayer.is_signer, so the CPI can run with an unsigned funder. Addassert_is_signer(payer, "payer")?before the CPI.Apply this diff:
let [payer, order_book_account, magic_context, magic_program] = accounts else { - return Err(ProgramError::MissingRequiredSignature); + return Err(ProgramError::NotEnoughAccountKeys); }; + assert_is_signer(payer, "payer")?; + commit_diff_and_undelegate_accounts( payer, vec![order_book_account], magic_context, magic_program,test-integration/programs/schedulecommit/src/order_book.rs (3)
45-55:deserializestill aliases immutable data mutably (UB).
slice::from_raw_parts_mutonbook_bytesforges a&mut [u8]from shared data, violating Rust’s aliasing rules and instantly triggering undefined behaviour. Please replace this with a safe path—e.g. copy into an owned buffer or implement a parser that reads header/levels straight from the immutable slice.
85-93:OrderBook::newassumes alignment that account data does not guarantee.Casting
header_bytes.as_ptr()to*mut OrderBookHeader(and the level pointer to*mut OrderLevel) requires 4/8‑byte alignment, but Solana account data is byte-aligned. The moment you dereference those pointers you trigger UB. Rework this to treat the buffer as raw bytes and read/write fields withfrom_le_bytes/to_le_bytesinstead of typed references.
140-178: Typed slices over account data remain unsafe.
slice::from_raw_parts(_ as *mut OrderLevel, ...)for bids/asks/buffer helpers creates slices ofOrderLevelout of unaligned memory. That’s the same UB called out earlier. Please keep the backing store as[u8], then decode/encode eachOrderLevelby copying 16 bytes into a local array and usingu64::from_le_bytes/u64::to_le_bytes.magicblock-magic-program-api/src/instruction.rs (1)
111-111: Add documentation for ScheduleCommitDiffAndUndelegate.This issue was already identified in a previous review. The variant lacks documentation while all sibling variants include doc comments describing the instruction purpose and account references.
magicblock-committor-service/src/tasks/args_task.rs (3)
75-103: Stop hard-coding the RPC endpoint in CommitDiff.
ChainConfig::local(ComputeBudgetConfig::new(1_000_000))forces every CommitDiff task to dialhttp://localhost:7799with Processed commitment and re-create an RPC client each timeinstruction()is called. In production that URI does not exist, so we immediately fall back tocommit_stateand never ship a diff; plus every call repeats the network fetch we already warned about. Inject the realChainConfig/RpcClientfrom the service (or precompute/cache the diff during task construction) soinstruction()stays pure and uses the configured endpoint. Prior feedback on this remains unresolved.
115-116: Do not log raw diff payloads.Dumping the entire diff at warn level leaks account data and explodes log volume. Log only bounded metadata (e.g., commit_id, pubkey, diff length) instead.
- log::warn!("DIFF computed: {:?}", args.diff); + log::debug!( + "commit_diff computed: commit_id={} pubkey={} len={}", + value.commit_id, + value.committed_account.pubkey, + args.diff.len() + );
171-173: Remove the CommitDiff panic in optimize().
optimize()is part of the normal pipeline; panicking here will abort the worker whenever a CommitDiff task flows through. ReturnErr(self)(mirroring the other variants) so the caller can fall back cleanly.- ArgsTaskType::CommitDiff(_) => { - panic!("ArgsTaskType::CommitDiff not handled") - } + ArgsTaskType::CommitDiff(_) => Err(self),programs/magicblock/src/magicblock_processor.rs (1)
38-38: Avoid logging entire MagicBlockInstruction payloads.
ic_msg!(..., "{:?}", instruction)dumps the full enum—including the diff bytes you just added—on every invocation. That inflates CU cost and spams logs, an issue we already called out earlier. Drop the log or gate it behind a debug-only feature flag so mainnet builds don’t emit the payload.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (28)
Cargo.toml(1 hunks)magicblock-accounts/src/scheduled_commits_processor.rs(3 hunks)magicblock-committor-service/src/tasks/args_task.rs(6 hunks)magicblock-committor-service/src/tasks/mod.rs(1 hunks)magicblock-committor-service/src/tasks/task_builder.rs(3 hunks)magicblock-committor-service/src/tasks/task_visitors/persistor_visitor.rs(1 hunks)magicblock-magic-program-api/src/instruction.rs(1 hunks)magicblock-rpc-client/src/lib.rs(1 hunks)programs/magicblock/src/magic_scheduled_base_intent.rs(7 hunks)programs/magicblock/src/magicblock_processor.rs(4 hunks)programs/magicblock/src/schedule_transactions/process_schedule_commit.rs(2 hunks)programs/magicblock/src/schedule_transactions/process_scheduled_commit_sent.rs(5 hunks)test-integration/Cargo.toml(2 hunks)test-integration/programs/schedulecommit-security/src/lib.rs(2 hunks)test-integration/programs/schedulecommit/src/api.rs(5 hunks)test-integration/programs/schedulecommit/src/lib.rs(9 hunks)test-integration/programs/schedulecommit/src/order_book.rs(1 hunks)test-integration/programs/schedulecommit/src/utils/mod.rs(3 hunks)test-integration/schedulecommit/client/src/schedule_commit_context.rs(6 hunks)test-integration/schedulecommit/client/src/verify.rs(2 hunks)test-integration/schedulecommit/test-scenarios/Cargo.toml(1 hunks)test-integration/schedulecommit/test-scenarios/tests/01_commits.rs(2 hunks)test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs(4 hunks)test-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs(1 hunks)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs(1 hunks)test-integration/test-ledger-restore/tests/08_commit_update.rs(2 hunks)test-integration/test-tools/src/integration_test_context.rs(2 hunks)test-integration/test-tools/src/scheduled_commits.rs(3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.
Applied to files:
test-integration/test-tools/src/integration_test_context.rstest-integration/programs/schedulecommit/src/utils/mod.rstest-integration/test-ledger-restore/tests/08_commit_update.rstest-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/utils/mod.rsmagicblock-committor-service/src/tasks/args_task.rstest-integration/programs/schedulecommit/src/api.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/programs/schedulecommit/src/order_book.rs
📚 Learning: 2025-10-26T16:54:39.084Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: test-manual/Cargo.toml:0-0
Timestamp: 2025-10-26T16:54:39.084Z
Learning: In the magicblock-validator repository, use git branch references (not commit hashes or tags) for the helius-laserstream dependency to allow automatic updates when the branch is pushed to.
Applied to files:
test-integration/Cargo.tomlCargo.toml
📚 Learning: 2025-10-26T08:49:31.543Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
Applied to files:
magicblock-committor-service/src/tasks/args_task.rs
🧬 Code graph analysis (15)
test-integration/programs/schedulecommit-security/src/lib.rs (1)
test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
create_schedule_commit_ix(41-66)
magicblock-committor-service/src/tasks/task_builder.rs (2)
magicblock-committor-service/src/tasks/args_task.rs (1)
new(49-54)magicblock-accounts/src/scheduled_commits_processor.rs (2)
new(66-90)new(420-436)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (2)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)test-integration/test-committor-service/tests/test_ix_commit_local.rs (1)
base_intent(544-549)
test-integration/schedulecommit/client/src/verify.rs (2)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
ctx(90-91)test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
ctx(145-146)
programs/magicblock/src/magicblock_processor.rs (3)
magicblock-committor-service/src/tasks/args_task.rs (1)
instruction(58-160)programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
process_schedule_commit(34-259)magicblock-committor-program/src/state/changeset.rs (1)
request_undelegation(230-232)
test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
get_context_with_delegated_committees(16-35)
magicblock-committor-service/src/tasks/args_task.rs (3)
magicblock-committor-service/src/tasks/mod.rs (2)
instruction(66-66)instruction(249-255)magicblock-committor-service/src/tasks/buffer_task.rs (1)
instruction(65-86)magicblock-committor-service/src/config.rs (1)
local(29-35)
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (3)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
ctx(90-91)test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
ctx(145-146)test-integration/schedulecommit/client/src/schedule_commit_context.rs (3)
try_new(72-74)ncommittees(102-121)try_new_random_keys(66-71)
programs/magicblock/src/magic_scheduled_base_intent.rs (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (2)
test-integration/programs/schedulecommit/src/api.rs (3)
init_order_book_instruction(36-54)init_payer_escrow(77-98)init_account_instruction(16-34)test-integration/test-tools/src/integration_test_context.rs (1)
try_new(113-115)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
test-integration/test-ledger-restore/src/lib.rs (1)
setup_validator_with_local_remote(97-119)
test-integration/programs/schedulecommit/src/api.rs (2)
test-integration/programs/schedulecommit/src/order_book.rs (1)
new(85-94)test-integration/programs/flexi-counter/src/state.rs (1)
pda(32-35)
test-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs (4)
test-integration/test-runner/bin/run_tests.rs (1)
run_test(777-796)test-integration/programs/schedulecommit/src/api.rs (1)
schedule_commit_with_payer_cpi_instruction(214-232)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (4)
assert_two_committees_synchronized_count(139-169)assert_two_committees_were_committed(68-91)get_context_with_delegated_committees(16-35)assert_feepayer_was_committed(94-113)test-integration/schedulecommit/client/src/verify.rs (1)
fetch_and_verify_commit_result_from_logs(7-14)
test-integration/programs/schedulecommit/src/lib.rs (2)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
assert_is_signer(30-44)assert_keys_equal(16-28)allocate_account_and_assign_owner(58-106)test-integration/programs/schedulecommit/src/order_book.rs (1)
new(85-94)
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (4)
test-integration/programs/schedulecommit/src/api.rs (3)
schedule_commit_and_undelegate_cpi_with_mod_after_instruction(287-311)schedule_commit_diff_instruction_for_order_book(193-212)update_order_book_instruction(175-191)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (3)
get_context_with_delegated_committees(16-35)assert_one_committee_was_committed(41-65)assert_one_committee_account_was_undelegated_on_chain(190-196)test-integration/schedulecommit/client/src/schedule_commit_context.rs (3)
committees(205-209)ephem_blockhash(322-324)ephem_client(318-320)test-integration/schedulecommit/client/src/verify.rs (1)
fetch_and_verify_order_book_commit_result_from_logs(16-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: run_make_ci_test
- GitHub Check: run_make_ci_lint
- GitHub Check: run_make_ci_test
🔇 Additional comments (20)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
49-55: LGTM: Type alignment with Solana API.Changing
sizefromusizetou64correctly aligns with Solana'ssystem_instruction::allocatesignature, which expectsspace: u64.
75-79: LGTM: Helpful debug logging.The added logging for lamport requirements and payer balance aids in troubleshooting account allocation issues during testing.
90-90: Critical fix: Correct system_instruction::allocate signature.The updated call now correctly provides both required arguments (
pubkeyandspace) tosystem_instruction::allocate. The previous implementation appears to have been missing the pubkey argument, which would not match the function signature:pub fn allocate(pubkey: &Pubkey, space: u64) -> Instruction.test-integration/test-tools/src/scheduled_commits.rs (1)
182-213: Variable renaming improves clarity.The renaming of log variables to
ephem_logs_l1andephem_logs_l2clearly distinguishes the two-level log fetching process, and the updated error context at line 206 now correctly references the first-level logs. These changes enhance code readability.test-integration/programs/schedulecommit-security/src/lib.rs (2)
2-2: LGTM!The
CommitPolicyimport is correctly added to support the new argument at line 149.
143-150: Ignore this review comment. The original comment incorrectly assumes thatschedule_commit_cpi_instructionandcreate_schedule_commit_ixshould be consistent, but they are two distinct functions from different crates with different purposes:
schedule_commit_cpi_instruction(fromprogram_schedulecommit::api) is a local CPI helper that does not accept aCommitPolicyparametercreate_schedule_commit_ix(fromephemeral_rollups_sdk::ephem) is an SDK function that acceptsCommitPolicyas a parameterThe two functions have intentionally different signatures. There is no test inconsistency to address.
Likely an incorrect or invalid review comment.
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
55-61: No issues found—code is correct as written.The
TempDirreturned bysetup_validator_with_local_remoteis created specifically for temporary config storage during validator initialization (written instart_magicblock_validator_with_config_structat line 225:fs::write(&config_path, config_toml)). After the validator process is spawned, this directory is no longer needed and is safely dropped. The actual ledger directory is managed separately by the main_tmpdirat line 42 of the test, which persists for the entire test duration. The binding to_tmpdirwith an underscore prefix correctly signals that this return value is intentionally unused beyond validator initialization.test-integration/programs/schedulecommit/src/api.rs (3)
36-54: LGTM!The
init_order_book_instructionfollows the standard instruction builder pattern with appropriate account metadata.
56-75: LGTM!The
grow_order_book_instructioncorrectly constructs the instruction with theadditional_spaceparameter.
175-212: LGTM!Both
update_order_book_instructionandschedule_commit_diff_instruction_for_order_bookfollow correct instruction builder patterns with appropriate account metadata.test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
30-31: LGTM! Deterministic seed ensures reproducible test contexts.The hard-coded seed
b"magic_schedule_commit"provides deterministic PDA derivation and context initialization, which improves test reliability and debugging.Also applies to: 84-85
test-integration/schedulecommit/test-scenarios/tests/03_commits_fee_payer.rs (2)
82-135: LGTM! Fee payer escrow test properly verifies expected behavior.The test correctly verifies that with proper escrow setup, the fee payer commit succeeds and all expected assertions pass.
34-41: Fix struct field destructuring:payer_ephemfield andephem_blockhashretrieval.The code attempts to destructure non-existent struct fields:
- Line 35:
payerfield doesn't exist inScheduleCommitTestContextFields— should bepayer_ephem: payer- Line 39:
ephem_blockhashis not a struct field — must be fetched separately viaephem_client.get_latest_blockhash().unwrap()- Lines 58, 112: Remove dereference (
*) fromephem_blockhashonce correctedSee
01_commits.rs(lines 34, 54) for the correct pattern.Also applies to: 88-95, 112
⛔ Skipped due to learnings
Learnt from: bmuddha Repo: magicblock-labs/magicblock-validator PR: 578 File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27 Timestamp: 2025-10-21T14:00:54.642Z Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579programs/magicblock/src/magic_scheduled_base_intent.rs (3)
104-106: LGTM!The
is_commit_diff()method correctly delegates to the base intent, following the same pattern as the existingis_undelegate()method.
155-163: LGTM!The
is_commit_diff()method correctly handles allMagicBaseIntentvariants, properly delegating to the underlyingCommitTypefor bothCommitandCommitAndUndelegatecases.
458-458: LGTM!The accessor methods correctly handle the new
StandaloneDiffvariant, treating it identically toStandalonesince both containVec<CommittedAccount>.Also applies to: 468-468, 480-482
magicblock-committor-service/src/tasks/task_visitors/persistor_visitor.rs (2)
29-33: LGTM!The match correctly handles both
CommitandCommitDiffvariants identically, as both containCommitTaskand should be persisted the same way.
59-59: ****The review comment is incorrect.
BufferTaskTypeintentionally has only a singleCommitvariant because it represents buffer-based commit operations.CommitDiffis a separate task variant that belongs exclusively toArgsTaskTypeand is handled through a different code path.Evidence:
- ArgsTaskType includes CommitDiff(CommitTask), but BufferTaskType does not
- ArgsTaskType::CommitDiff explicitly panics with "ArgsTaskType::CommitDiff not handled" when attempting conversion, indicating CommitDiff is intentionally not converted to BufferTask
- The refutable pattern at line 59 is safe because BufferTaskType can only ever contain a single variant
No code changes are needed; the refutable pattern is correct as implemented.
Likely an incorrect or invalid review comment.
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (2)
31-31: LGTM!The
request_difffield addition cleanly extends the options structure to control diff-based commit scheduling.
231-238: LGTM!The
commit_actionis correctly used in both the undelegation and non-undelegation paths, enabling diff-based commits for both scenarios while preserving existing semantics.
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs
Outdated
Show resolved
Hide resolved
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs
Outdated
Show resolved
Hide resolved
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs
Show resolved
Hide resolved
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs
Outdated
Show resolved
Hide resolved
693af7f to
99f2e8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (8)
test-integration/Cargo.toml (1)
40-40:⚠️ Path dependency concerns from prior review remain unresolved.The migration from git-based to local path dependencies for
ephemeral-rollups-sdkandmagicblock-delegation-programstill poses the same critical CI/CD risks flagged in the previous review: these paths do not exist in the repository, CI workflows do not clone them, and builds will fail in CI/CD and for contributors without manual setup.The prior review's recommendations still apply:
- Update CI to clone both external repositories, OR
- Switch back to git-based references, OR
- Add clear setup documentation with exact clone commands and relative paths
Also applies to: 60-60
magicblock-committor-service/src/tasks/args_task.rs (2)
228-234:reset_commit_idmust handleCommitDiffvariant.The current implementation only updates the
commit_idforCommittasks and silently returns forCommitDiff. When aCommitDifftask is recycled, the stalecommit_idwill remain, causing desynced submissions.Apply this fix to handle both variants:
fn reset_commit_id(&mut self, commit_id: u64) { - // TODO (snawaz): handle CommitDiff as well? what is it about? - let ArgsTaskType::Commit(commit_task) = &mut self.task_type else { - return; - }; - - commit_task.commit_id = commit_id; + match &mut self.task_type { + ArgsTaskType::Commit(task) | ArgsTaskType::CommitDiff(task) => { + task.commit_id = commit_id; + } + _ => { + // Only Commit and CommitDiff tasks have commit_id + } + } }
74-122: Network I/O insideinstruction()remains a major concern.The
instruction()method performs RPC calls and diff computation on every invocation, which is expensive and risky:
instruction()may be called multiple times (e.g., viainvolved_accounts), multiplying RPC calls- TOCTOU: base-chain account can change between diff calculation and transaction submission
- Coupling to network hinders testing and determinism
Per previous discussion, this is acknowledged as temporary and will be addressed in subsequent PRs. Consider tracking this technical debt.
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
224-228: Consider enhancing observability as previously suggested.The conditional logic correctly selects the commit type based on
request_diff. However, a past review comment suggests improving the log messages to include the number of committed accounts and the flag value for better operational visibility.test-integration/programs/schedulecommit/src/order_book.rs (2)
99-119: Unaligned typed reference toOrderBookHeaderremains a critical issue.Line 114 creates a typed reference
&mut OrderBookHeadervia raw pointer cast. While alignment is asserted at runtime (lines 102-110), Solana account data does not guarantee alignment for arbitrary types. This is undefined behavior if the account data is not aligned toalign_of::<OrderBookHeader>().The assertion will catch misalignment at runtime, but the proper fix is to avoid typed references entirely. Consider reading/writing the header fields as raw bytes using little-endian encoding.
165-178: Typed slices over potentially unaligned memory (OrderLevel).Lines 166 and 173-174 use
slice::from_raw_partsto create typed slices ofOrderLevel(which containsu64fields requiring 8-byte alignment). Account data alignment is not guaranteed by Solana, leading to undefined behavior on read.Per previous review: store levels as raw bytes and provide accessors that read/write fields via
u64::from_le_bytes/to_le_bytes, or use a packed representation without taking references to fields.test-integration/programs/schedulecommit/src/lib.rs (2)
280-311: Critical: OrderBook header is never initialized.After
allocate_account_and_assign_ownerreturns (line 308), the account data contains uninitialized memory. Subsequent calls toOrderBook::newwill read uninitializedbids_lenandasks_lenvalues, causing undefined behavior.Apply this fix immediately after allocation:
allocate_account_and_assign_owner(AllocateAndAssignAccountArgs { payer_info: payer, account_info: order_book, owner: &crate::ID, signer_seeds: &[b"order_book", book_manager.key.as_ref(), &[bump]], size: 10 * 1024, })?; + // Initialize header to zero + let mut data = order_book.try_borrow_mut_data()?; + let header_size = core::mem::size_of::<OrderBookHeader>(); + for b in &mut data[..header_size] { + *b = 0; + } Ok(())
329-334: Incorrect identifier in PDA assertion error message.Line 332 incorrectly references
payer.keyin the error message, which should bebook_manager.keyto accurately reflect the PDA derivation.Apply this fix:
assert_keys_equal(order_book.key, &pda, || { format!( "PDA for the account ('{}') and for book_manager ('{}') is incorrect", - order_book.key, payer.key + order_book.key, book_manager.key ) })?;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
magicblock-committor-service/src/tasks/args_task.rs(6 hunks)programs/magicblock/src/magic_scheduled_base_intent.rs(7 hunks)programs/magicblock/src/magicblock_processor.rs(2 hunks)programs/magicblock/src/schedule_transactions/process_schedule_commit.rs(2 hunks)test-integration/Cargo.toml(4 hunks)test-integration/programs/schedulecommit/Cargo.toml(1 hunks)test-integration/programs/schedulecommit/src/lib.rs(9 hunks)test-integration/programs/schedulecommit/src/order_book.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/tasks/args_task.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/programs/schedulecommit/src/lib.rs
📚 Learning: 2025-10-26T08:49:31.543Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
Applied to files:
magicblock-committor-service/src/tasks/args_task.rs
🧬 Code graph analysis (5)
magicblock-committor-service/src/tasks/args_task.rs (3)
magicblock-committor-service/src/tasks/mod.rs (2)
instruction(66-66)instruction(249-255)magicblock-committor-service/src/tasks/buffer_task.rs (1)
instruction(65-86)magicblock-committor-service/src/config.rs (1)
local(29-35)
programs/magicblock/src/magicblock_processor.rs (1)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
process_schedule_commit(34-258)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (2)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)test-integration/test-committor-service/tests/test_ix_commit_local.rs (1)
base_intent(544-549)
programs/magicblock/src/magic_scheduled_base_intent.rs (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)
test-integration/programs/schedulecommit/src/lib.rs (2)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
assert_is_signer(30-44)assert_keys_equal(16-28)allocate_account_and_assign_owner(58-106)test-integration/programs/schedulecommit/src/order_book.rs (1)
new(99-119)
🔇 Additional comments (11)
test-integration/Cargo.toml (1)
72-72: Now let me check the codebase for actual usage of these dependencies to confirm they are necessary:Based on my verification, I can now generate the rewritten review comment:
Both dependencies are compatible with Solana 2.2 and appropriate for this PR.
rkyv 0.7.45 supports no_std and no_alloc configurations, making it suitable for Solana on-chain programs. It supports no-std builds for targets without a standard library and no-alloc builds for targets where allocations cannot be made. The Solana VM guarantees that account data is byte-aligned to a multiple of 8, which enables rkyv's zero-copy deserialization to function safely on account data. static_assertions 1.1.0 is a stable, widely-adopted crate (225,914,390 downloads all time) providing compile-time assertion macros useful for validating account structure layouts and sizes—a common pattern in Solana programs.
No further verification needed.
test-integration/programs/schedulecommit/Cargo.toml (1)
11-12: LGTM! Dependencies properly support order book implementation.The additions of
rkyvandstatic_assertionsare well-utilized inorder_book.rsfor alignment guarantees and compile-time size/alignment checks.programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
31-31: LGTM! New field enables diff-based commit path.The
request_diffflag properly controls whether to useCommitType::StandaloneDifforCommitType::Standalone, enabling the optimization for large accounts with small changes.programs/magicblock/src/magicblock_processor.rs (2)
44-59: LGTM! Existing instructions properly default to non-diff path.Both
ScheduleCommitandScheduleCommitAndUndelegatecorrectly setrequest_diff: falseto maintain existing behavior.
85-92: LGTM! New instruction variant correctly enables diff-based commit with undelegation.The
ScheduleCommitDiffAndUndelegateinstruction properly sets bothrequest_undelegation: trueandrequest_diff: true, mirroringScheduleCommitAndUndelegatebehavior while enabling the diff optimization.test-integration/programs/schedulecommit/src/order_book.rs (1)
48-75: LGTM! Mutable aliasing UB resolved with aligned copy.The implementation now safely copies the input buffer into
rkyv::AlignedVecbefore creating mutable references, avoiding the undefined behavior from the previous approach. The comment clearly explains the rationale.magicblock-committor-service/src/tasks/args_task.rs (2)
171-172: LGTM! CommitDiff correctly returnsErr(self)in optimize().Returning
Err(self)forCommitDiffis correct since the diff is already optimized by design—it sends only the differences rather than full account data. Converting toBufferTaskwould be counterproductive.Per previous discussion, this is the correct semantic since CommitDiff is already using the most efficient data transfer strategy.
196-203: LGTM! Compute units appropriately set for CommitDiff.The 65,000 compute units for
CommitDiff(vs 70,000 forCommit) reflects the reduced work from transmitting only the diff. This aligns with the test observation showing lower CU usage.Based on learnings: these are compute units per task, and transactions may comprise multiple tasks.
test-integration/programs/schedulecommit/src/lib.rs (3)
203-203: LGTM! Type change tou64is appropriate.Changing
MainAccount::SIZEfromusizetou64aligns with thesizeparameter type inallocate_account_and_assign_owner(line 255) and Solana's account size conventions.
398-414: LGTM! Log message and signer check are correct.Line 402 now uses the accurate log message "Update orderbook", and line 407 properly validates that the payer is a signer before allowing the update.
419-439: LGTM! Handler correctly uses diff-based commit with undelegation.The implementation properly:
- Returns
NotEnoughAccountKeyswhen accounts are missing (line 426)- Validates payer is a signer (line 429)
- Invokes
commit_diff_and_undelegate_accountsfor the optimized diff path (line 431)
99f2e8f to
7eaaa13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
magicblock-committor-service/src/tasks/args_task.rs (1)
228-235: Critical:reset_commit_idsilently ignores CommitDiff tasks.When a
CommitDifftask is recycled, the current code silently returns without updating itscommit_id(line 230-232), leaving stale IDs that will cause:
- Desynchronization with actual commit state
- Failed submissions with wrong nonce
- Data integrity issues
A past review correctly identified this issue.
Apply this fix to handle both
CommitandCommitDiff:fn reset_commit_id(&mut self, commit_id: u64) { - // TODO (snawaz): handle CommitDiff as well? what is it about? - let ArgsTaskType::Commit(commit_task) = &mut self.task_type else { - return; - }; - - commit_task.commit_id = commit_id; + match &mut self.task_type { + ArgsTaskType::Commit(task) | ArgsTaskType::CommitDiff(task) => { + task.commit_id = commit_id; + } + _ => { + // Other task types don't have commit_id + } + } }
♻️ Duplicate comments (7)
programs/magicblock/src/magic_scheduled_base_intent.rs (1)
389-446: CRITICAL: try_from_args cannot construct StandaloneDiff.The
try_from_argsmethod only handlesCommitTypeArgs::StandaloneandCommitTypeArgs::WithBaseActions, but does not handleCommitTypeArgs::StandaloneDiff. This means:
- Code paths using
try_from_args(e.g.,process_schedule_base_intent) cannot constructCommitType::StandaloneDiff- Only
process_schedule_commitcan create it programmatically- Any attempt to deserialize
CommitTypeArgs::StandaloneDifffrom instruction data will failThis creates a critical inconsistency where the
StandaloneDiffvariant cannot be fully utilized across all code paths.The method needs a new match arm similar to:
pub fn try_from_args( args: CommitTypeArgs, context: &ConstructionContext<'_, '_>, ) -> Result<CommitType, InstructionError> { match args { CommitTypeArgs::Standalone(accounts) => { // ... existing code ... Ok(CommitType::Standalone(committed_accounts)) } + CommitTypeArgs::StandaloneDiff(accounts) => { + let committed_accounts_ref = Self::extract_commit_accounts( + &accounts, + context.transaction_context, + )?; + Self::validate_accounts(&committed_accounts_ref, context)?; + let committed_accounts = committed_accounts_ref + .into_iter() + .map(|el| { + let mut committed_account: CommittedAccount = el.into(); + committed_account.account.owner = context + .parent_program_id + .unwrap_or(committed_account.account.owner); + committed_account + }) + .collect(); + Ok(CommitType::StandaloneDiff(committed_accounts)) + } CommitTypeArgs::WithBaseActions { ... } => { // ... existing code ... } } }Based on past review comment.
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
224-228: Add observability logging for commit type selection.The conditional logic correctly selects the commit type, but lacks logging to indicate which path was taken. This makes debugging and auditing more difficult.
Based on past review comment, consider adding:
let commit_action = if opts.request_diff { + ic_msg!( + invoke_context, + "ScheduleCommit: using StandaloneDiff for {} accounts", + committed_accounts.len() + ); CommitType::StandaloneDiff(committed_accounts) } else { + ic_msg!( + invoke_context, + "ScheduleCommit: using Standalone for {} accounts", + committed_accounts.len() + ); CommitType::Standalone(committed_accounts) };magicblock-committor-service/src/tasks/args_task.rs (1)
74-122: Network I/O in instruction() confirmed as unresolved; improve fallback logging.The RPC-in-instruction issue is genuine and remains present despite the past review claiming it was addressed in commit 99f2e8f (which does not exist in the repository).
Confirmed concerns:
instruction() called multiple times per task: The method is invoked from
delivery_preparator.rs(line 377, mapped over cleanup_tasks),tasks/utils.rs(line 58, mapped over tasks), andtask_strategist.rs(line 217, in optimization loop). Each call triggers RPC I/O on the base-chain, multiplying network overhead and creating TOCTOU race conditions.ChainConfig hardcoded locally (line 76): ChainConfig is properly injected into the service/processor but ArgsTask hardcodes
ChainConfig::local()instead of receiving injected config. This remains unresolved.Fallback log incomplete (line 90): The message contains a typo ("commmit_id" with 3 m's) and is missing the
pubkeycontext for debugging. Improve clarity:- log::warn!("Fallback to commit_state and send full-bytes, as rpc failed to fetch the delegated-account from base chain, commmit_id: {} , error: {}", value.commit_id, e); + log::warn!( + "Fallback to commit_state for account {}: RPC fetch failed, commit_id={} - {}", + value.committed_account.pubkey, + value.commit_id, + e + );The architectural concerns about performing RPC I/O during instruction building should be addressed, and the config injection pattern needs to be established.
test-integration/programs/schedulecommit/src/lib.rs (3)
280-311: Header remains uninitialized after allocation—subsequent reads are undefined.After
allocate_account_and_assign_owner, the header fields (bids_len,asks_len) are still uninitialized. Any call toOrderBook::newon this account will read garbage.Apply this fix to zero the header immediately after allocation:
allocate_account_and_assign_owner(AllocateAndAssignAccountArgs { payer_info: payer, account_info: order_book, owner: &crate::ID, signer_seeds: &[b"order_book", book_manager.key.as_ref(), &[bump]], size: 10 * 1024, })?; + // Initialize header to zero + let mut data = order_book.try_borrow_mut_data()?; + data[..core::mem::size_of::<OrderBookHeader>()].fill(0); Ok(())
329-334: Error message references wrong key.The PDA assertion message incorrectly shows
payer.keyinstead ofbook_manager.key, making debugging harder.assert_keys_equal(order_book.key, &pda, || { format!( "PDA for the account ('{}') and for book_manager ('{}') is incorrect", - order_book.key, payer.key + order_book.key, book_manager.key ) })?;
402-402: Inconsistent log message casing.Message says "Update orderbook" but other logs use "OrderBook" with capital letters and space for consistency.
- msg!("Update orderbook"); + msg!("Update order book");test-integration/Cargo.toml (1)
40-40: Local path dependencies will break CI/CD builds.These local path dependencies point to repositories outside the current codebase (
../../ephemeral-rollups-sdkand../../delegation-program) that are not cloned by the CI workflow. This will cause build failures for all contributors and in continuous integration.Choose one of the following solutions:
- Revert to git-based dependencies (recommended for now):
-ephemeral-rollups-sdk = { path = "../../ephemeral-rollups-sdk/rust/sdk"} +ephemeral-rollups-sdk = { git = "https://github.com/magicblock-labs/ephemeral-rollups-sdk.git", rev = "..." }
Update CI to clone required repositories before build steps in
.github/workflows/ci-test-integration.ymlDocument the local setup in README with explicit clone instructions if local paths are intended for development only
Based on learnings: This appears to be a transition to local development setup but lacks the corresponding CI infrastructure updates.
Also applies to: 60-60
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
magicblock-committor-service/src/tasks/args_task.rs(6 hunks)programs/magicblock/src/magic_scheduled_base_intent.rs(7 hunks)programs/magicblock/src/magicblock_processor.rs(2 hunks)programs/magicblock/src/schedule_transactions/process_schedule_commit.rs(2 hunks)test-integration/Cargo.toml(4 hunks)test-integration/programs/schedulecommit/Cargo.toml(1 hunks)test-integration/programs/schedulecommit/src/lib.rs(9 hunks)test-integration/programs/schedulecommit/src/order_book.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/tasks/args_task.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/programs/schedulecommit/src/order_book.rs
📚 Learning: 2025-10-26T08:49:31.543Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
Applied to files:
magicblock-committor-service/src/tasks/args_task.rs
🧬 Code graph analysis (5)
magicblock-committor-service/src/tasks/args_task.rs (4)
magicblock-committor-service/src/tasks/mod.rs (2)
instruction(66-66)instruction(249-255)magicblock-committor-service/src/tasks/buffer_task.rs (2)
instruction(65-86)new(37-45)magicblock-committor-service/src/config.rs (1)
local(29-35)magicblock-accounts/src/scheduled_commits_processor.rs (2)
new(66-90)new(420-436)
programs/magicblock/src/magic_scheduled_base_intent.rs (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)
programs/magicblock/src/magicblock_processor.rs (1)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
process_schedule_commit(34-258)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (2)
magicblock-committor-service/src/tasks/task_builder.rs (1)
committed_accounts(153-156)test-integration/test-committor-service/tests/test_ix_commit_local.rs (1)
base_intent(544-549)
test-integration/programs/schedulecommit/src/lib.rs (2)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
assert_is_signer(30-44)assert_keys_equal(16-28)allocate_account_and_assign_owner(58-106)test-integration/programs/schedulecommit/src/order_book.rs (1)
new(105-125)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: run_make_ci_format
- GitHub Check: run_make_ci_test
- GitHub Check: run_make_ci_test
🔇 Additional comments (14)
programs/magicblock/src/schedule_transactions/process_schedule_commit.rs (1)
29-32: Field addition looks correct.The new
request_difffield is properly scoped aspub(crate)and theDefaulttrait will initialize it tofalse, maintaining backward compatibility.programs/magicblock/src/magicblock_processor.rs (2)
44-51: ScheduleCommit handler correctly configured.The handler properly sets
request_diff: falseto maintain the existing full-commit behavior for standard commits.
85-92: New instruction handler correctly implemented.The
ScheduleCommitDiffAndUndelegatehandler properly enables both undelegation and diff-based commits by setting both flags totrue. The implementation follows the established pattern from the other handlers.programs/magicblock/src/magic_scheduled_base_intent.rs (4)
104-106: Delegation method correctly implemented.The
is_commit_diff()method appropriately delegates to the underlyingbase_intent, following the established pattern for other query methods in this struct.
155-163: Commit diff detection logic is correct.The method correctly returns
falseforBaseActionsand properly delegates to the commit-related variants to determine if differential commits are enabled.
317-327: StandaloneDiff variant added correctly.The new variant follows the same structure as
Standalone, holdingVec<CommittedAccount>. Note that full account data is stored here; the actual diff computation likely occurs downstream during commit processing.
448-484: Accessor methods properly handle StandaloneDiff.All match expressions are now exhaustive and correctly handle the new
StandaloneDiffvariant. Theis_commit_diff()method correctly returnstrueonly forStandaloneDiff, and the accessor methods treat it consistently withStandalone.magicblock-committor-service/src/tasks/args_task.rs (4)
1-24: LGTM: Imports support the CommitDiff feature.All new imports are necessary for the RPC client setup, diff computation, and configuration.
30-30: LGTM: CommitDiff variant added.Reusing
CommitTaskfor theCommitDiffvariant is appropriate since they share the same data requirements.
171-172: LGTM: ReturningErr(self)for CommitDiff is correct.The past review discussion thoroughly analyzed this and concluded that
CommitDiffshould returnErr(self)(no optimization) because:
CommitDiffis already optimized by design—it transmits only the diff (e.g., 286 bytes) vs. full account data (10,240 bytes per your test)- Converting
CommitDifftoBufferTaskwould be counterproductive and defeat its purposeErr(self)correctly signals "no further optimization possible"Suggestion: The TODO on line 171 can be resolved and removed based on the past review's analysis.
199-199: LGTM: Compute units appropriately reduced for CommitDiff.The 65,000 compute unit allocation (5k less than
Commit's 70k) aligns with your test observations and reflects the reduced data processing for diff-based commits.test-integration/programs/schedulecommit/src/lib.rs (1)
419-439: LGTM—signer validation and error handling are now correct.The function now properly returns
NotEnoughAccountKeyswhen the accounts array doesn't match, and validates thatpayeris a signer before proceeding with the CPI call.test-integration/programs/schedulecommit/Cargo.toml (1)
11-12: LGTM—dependencies appropriately support zero-copy OrderBook.The
rkyvcrate providesAlignedVecfor safe buffer allocation, andstatic_assertionsenables compile-time layout verification. Both are correctly utilized inorder_book.rs.test-integration/Cargo.toml (1)
72-72: LGTM—workspace dependencies properly declared.The
rkyvandstatic_assertionscrates are correctly added at the workspace level, enabling their use across integration test crates for zero-copy structures and compile-time assertions.Also applies to: 91-91
7eaaa13 to
c05f313
Compare
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
magicblock-committor-service/src/tasks/args_task.rs (1)
200-206:reset_commit_idmust also handleCommitDifftasks.When a CommitDiff task is recycled, the current code silently returns without updating the commit_id, leaving stale data. This will cause issues if commit IDs need to be refreshed after failures.
🔎 Proposed fix
fn reset_commit_id(&mut self, commit_id: u64) { - let ArgsTaskType::Commit(commit_task) = &mut self.task_type else { - return; - }; - - commit_task.commit_id = commit_id; + match &mut self.task_type { + ArgsTaskType::Commit(task) => { + task.commit_id = commit_id; + } + ArgsTaskType::CommitDiff(task) => { + task.commit_id = commit_id; + } + _ => {} + } }
♻️ Duplicate comments (6)
test-integration/test-tools/src/scheduled_commits.rs (1)
229-231: Verify if debug logging should be removed per past feedback.Past review comments indicated this unconditional
dump_chain_logsloop should be removed (taco-paco) or gated behind a debug flag. The code remains after recent cleanup commits. Confirm whether this is intentionally retained as temporary debugging code or was overlooked during review cleanup.test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
41-47: Unnecessary trait bounds on genericT.The trait bounds
std::fmt::Debug + borsh::BorshDeserialize + PartialEq + Eqare not used by this function. The body only inspectsres.included.len(),res.excluded.len(), andres.included.get(&pda)— none of which require deserializing or comparing values of typeT.🔎 Proposed fix
pub fn assert_one_committee_was_committed<T>( ctx: &ScheduleCommitTestContext, res: &ScheduledCommitResult<T>, is_single_stage: bool, -) where - T: std::fmt::Debug + borsh::BorshDeserialize + PartialEq + Eq, -{ +) {magicblock-committor-service/src/tasks/task_strategist.rs (2)
419-425: Fix typo in comment: "Noti Found" → "Not Found".🔎 Proposed fix
async fn get_base_accounts( &self, _pubkeys: &[Pubkey], ) -> TaskInfoFetcherResult<HashMap<Pubkey, Account>> { - Ok(Default::default()) + Ok(Default::default()) // Account Not Found }
377-377: Minor: Inconsistent system program import usage.Line 439 uses
system_program::id()while line 497 usessystem_program_id(). Consider using one style consistently.test-integration/programs/schedulecommit/src/lib.rs (2)
359-364: Typo in error message: usespayer.keyinstead ofbook_manager.key.The error message references
payer.keybut should referencebook_manager.keysince the PDA is derived frombook_manager.🔎 Proposed fix
assert_keys_equal(order_book.key, &pda, || { format!( "PDA for the account ('{}') and for book_manager ('{}') is incorrect", - order_book.key, payer.key + order_book.key, book_manager.key ) })?;
390-423:process_delegate_order_bookis missing payer signer validation.The handler performs delegation CPI without first verifying that
payeris a signer. While the CPI may fail with a less clear error, an explicit check provides better error messages.🔎 Proposed fix
pub fn process_delegate_order_book( accounts: &[AccountInfo], args: DelegateOrderBookArgs, ) -> Result<(), ProgramError> { msg!("Processing delegate_order_book instruction"); let [payer, order_book, owner_program, buffer, delegation_record, delegation_metadata, delegation_program, system_program] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); }; + assert_is_signer(payer, "payer")?; + let seeds_no_bump = [b"order_book", args.book_manager.as_ref()];
🧹 Nitpick comments (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
153-156: Consider usingremoveinstead ofget().cloned()as noted in the TODO.The TODO is valid - if accounts are guaranteed unique (which they should be since they're PDAs), using
removewould avoid the clone overhead. However, keepingget().cloned()is defensive and won't cause correctness issues.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.locktest-integration/schedulecommit/elfs/dlp.sois excluded by!**/*.so
📒 Files selected for processing (32)
Cargo.tomlmagicblock-committor-service/src/intent_executor/mod.rsmagicblock-committor-service/src/intent_executor/null_task_info_fetcher.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/args_task.rsmagicblock-committor-service/src/tasks/buffer_task.rsmagicblock-committor-service/src/tasks/mod.rsmagicblock-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/Cargo.tomltest-integration/programs/schedulecommit/Cargo.tomltest-integration/programs/schedulecommit/src/api.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/programs/schedulecommit/src/utils/mod.rstest-integration/schedulecommit/client/src/schedule_commit_context.rstest-integration/schedulecommit/client/src/verify.rstest-integration/schedulecommit/test-scenarios/Cargo.tomltest-integration/schedulecommit/test-scenarios/tests/01_commits.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rstest-integration/schedulecommit/test-security/tests/01_invocations.rstest-integration/test-committor-service/Cargo.tomltest-integration/test-committor-service/tests/common.rstest-integration/test-committor-service/tests/test_delivery_preparator.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/test-committor-service/tests/utils/instructions.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-ledger-restore/tests/08_commit_update.rstest-integration/test-tools/src/integration_test_context.rstest-integration/test-tools/src/scheduled_commits.rs
🚧 Files skipped from review as they are similar to previous changes (11)
- Cargo.toml
- test-integration/programs/schedulecommit/Cargo.toml
- magicblock-committor-service/src/intent_executor/mod.rs
- test-integration/schedulecommit/client/src/verify.rs
- test-integration/schedulecommit/test-security/tests/01_invocations.rs
- test-integration/Cargo.toml
- test-integration/test-committor-service/tests/utils/instructions.rs
- test-integration/test-committor-service/tests/test_delivery_preparator.rs
- magicblock-committor-service/src/tasks/buffer_task.rs
- test-integration/programs/schedulecommit/src/api.rs
- test-integration/programs/schedulecommit/src/utils/mod.rs
🧰 Additional context used
🧠 Learnings (21)
📓 Common learnings
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
📚 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:
test-integration/test-ledger-restore/tests/08_commit_update.rsmagicblock-committor-service/src/tasks/task_strategist.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rsmagicblock-committor-service/src/intent_executor/null_task_info_fetcher.rstest-integration/test-tools/src/integration_test_context.rsmagicblock-committor-service/src/tasks/task_builder.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-tools/src/scheduled_commits.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/schedulecommit/client/src/schedule_commit_context.rsmagicblock-committor-service/src/tasks/args_task.rstest-integration/schedulecommit/test-scenarios/tests/01_commits.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.
Applied to files:
test-integration/test-ledger-restore/tests/08_commit_update.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rstest-integration/test-tools/src/integration_test_context.rstest-integration/test-committor-service/tests/utils/transactions.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/test-committor-service/tests/common.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:
test-integration/test-ledger-restore/tests/08_commit_update.rsmagicblock-committor-service/src/tasks/task_strategist.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rsmagicblock-committor-service/src/intent_executor/null_task_info_fetcher.rstest-integration/test-tools/src/integration_test_context.rsmagicblock-committor-service/src/tasks/task_builder.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-tools/src/scheduled_commits.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.
Applied to files:
test-integration/test-ledger-restore/tests/08_commit_update.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/programs/schedulecommit/src/order_book.rsmagicblock-committor-service/src/tasks/mod.rs
📚 Learning: 2025-11-19T12:55:48.931Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-tools/src/validator.rs:193-197
Timestamp: 2025-11-19T12:55:48.931Z
Learning: In the magicblock-validator codebase, when constructing arguments for the light CLI test validator in start_light_validator_with_config (test-integration/test-tools/src/validator.rs), the shlex::split approach is necessary because the light CLI does not handle whitespaces properly in validator arguments. The string concatenation + shlex parsing pattern should not be refactored to direct argument construction in this specific case.
Applied to files:
test-integration/test-ledger-restore/tests/08_commit_update.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-committor-service/src/tasks/task_strategist.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/programs/schedulecommit/src/order_book.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/schedulecommit/client/src/schedule_commit_context.rstest-integration/programs/schedulecommit/src/lib.rsmagicblock-committor-service/src/tasks/args_task.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_builder.rstest-integration/programs/schedulecommit/src/order_book.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/schedulecommit/client/src/schedule_commit_context.rstest-integration/programs/schedulecommit/src/lib.rs
📚 Learning: 2025-10-26T16:53:29.820Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: magicblock-chainlink/src/remote_account_provider/mod.rs:134-0
Timestamp: 2025-10-26T16:53:29.820Z
Learning: In magicblock-chainlink/src/remote_account_provider/mod.rs, the `Endpoint::separate_pubsub_url_and_api_key()` method uses `split_once("?api-key=")` because the api-key parameter is always the only query parameter right after `?`. No additional query parameter parsing is needed for this use case.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.
Applied to files:
test-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/test-committor-service/tests/common.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:
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/schedulecommit/test-scenarios/tests/01_commits.rs
📚 Learning: 2025-11-07T18:19:48.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: test-integration/programs/schedulecommit/Cargo.toml:19-20
Timestamp: 2025-11-07T18:19:48.996Z
Learning: In Solana programs (crates depending on solana-program), the empty feature flags `custom-heap = []` and `custom-panic = []` are standard declarations required to avoid compiler warnings. These should not be flagged as unused features in Cargo.toml files for Solana program crates.
Applied to files:
test-integration/test-committor-service/Cargo.toml
📚 Learning: 2025-11-21T13:56:03.885Z
Learnt from: snawaz
Repo: magicblock-labs/magicblock-validator PR: 575
File: test-integration/programs/schedulecommit/src/utils/mod.rs:71-71
Timestamp: 2025-11-21T13:56:03.885Z
Learning: In Solana programs (BPF runtime), defensive checked conversions to `usize` (e.g., `try_into()`) are unnecessary when casting from `u64`. Solana exclusively runs in 64-bit environments where `usize` is 64 bits, so truncation is not a concern and simple `as usize` casts are appropriate.
Applied to files:
test-integration/programs/schedulecommit/src/order_book.rstest-integration/programs/schedulecommit/src/lib.rs
📚 Learning: 2025-11-20T08:57:07.217Z
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.
Applied to files:
test-integration/test-tools/src/scheduled_commits.rs
📚 Learning: 2025-11-21T11:03:26.756Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 664
File: magicblock-chainlink/src/testing/mod.rs:342-370
Timestamp: 2025-11-21T11:03:26.756Z
Learning: In the magicblock-validator codebase, avoid leaving review comments that merely acknowledge code is correct or well-structured when there is no actionable suggestion, improvement, or issue to flag. Only comment when there is something specific to recommend, fix, or clarify.
Applied to files:
test-integration/test-tools/src/scheduled_commits.rs
📚 Learning: 2025-12-01T16:02:05.367Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.
Applied to files:
magicblock-committor-service/src/tasks/mod.rs
📚 Learning: 2025-11-04T10:48:00.070Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/mod.rs:217-219
Timestamp: 2025-11-04T10:48:00.070Z
Learning: In magicblock-validator, the codebase uses a pattern where types containing non-Send/non-Sync fields (like Rc<RefCell<...>>) are marked with unsafe impl Send when they are guaranteed to be confined to a single thread through careful API design and thread spawning patterns.
Applied to files:
magicblock-committor-service/src/tasks/mod.rs
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.
Applied to files:
test-integration/schedulecommit/test-scenarios/Cargo.tomltest-integration/programs/schedulecommit/src/lib.rs
📚 Learning: 2025-10-26T08:49:31.543Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
Applied to files:
magicblock-committor-service/src/tasks/args_task.rs
🧬 Code graph analysis (11)
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
test-integration/test-ledger-restore/src/lib.rs (1)
setup_validator_with_local_remote(104-118)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (2)
magicblock-committor-service/src/intent_executor/null_task_info_fetcher.rs (1)
get_base_accounts(35-40)test-integration/test-committor-service/tests/common.rs (2)
get_base_accounts(146-163)new(53-56)
test-integration/test-committor-service/tests/test_ix_commit_local.rs (2)
test-integration/test-committor-service/tests/utils/transactions.rs (2)
init_and_delegate_order_book_on_chain(240-298)fund_validator_auth_and_ensure_validator_fees_vault(301-342)test-integration/test-committor-service/tests/utils/mod.rs (1)
ensure_validator_authority(35-44)
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (3)
try_new(72-74)ncommittees(102-121)try_new_random_keys(66-71)
test-integration/test-committor-service/tests/utils/transactions.rs (1)
test-integration/test-committor-service/tests/utils/instructions.rs (2)
init_account_and_delegate_ixs(21-52)init_order_book_account_and_delegate_ixs(61-94)
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (2)
test-integration/programs/schedulecommit/src/api.rs (2)
set_count_instruction(371-379)update_order_book_instruction(197-213)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (2)
get_context_with_delegated_committees(16-35)assert_one_committee_was_committed(41-65)
test-integration/test-committor-service/tests/test_transaction_preparator.rs (4)
test-integration/test-committor-service/tests/common.rs (2)
new(53-56)create_commit_task(175-191)magicblock-committor-service/src/tasks/args_task.rs (1)
new(42-47)magicblock-committor-service/src/tasks/buffer_task.rs (1)
new(40-48)magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
test-integration/programs/schedulecommit/src/api.rs (3)
init_order_book_instruction(51-69)init_payer_escrow(92-113)init_account_instruction(31-49)
test-integration/programs/schedulecommit/src/lib.rs (3)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
assert_is_signer(30-44)assert_keys_equal(16-28)allocate_account_and_assign_owner(58-109)test-integration/test-tools/src/integration_test_context.rs (2)
delegate_account(601-619)try_new(116-118)test-integration/programs/schedulecommit/src/order_book.rs (1)
try_new(109-143)
test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
test-integration/programs/schedulecommit/src/api.rs (2)
pda_and_bump(404-408)schedule_commit_cpi_instruction(177-195)
test-integration/test-committor-service/tests/common.rs (2)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (4)
new(58-65)get_base_accounts(41-44)get_base_accounts(273-290)pubkeys(112-123)magicblock-rpc-client/src/lib.rs (1)
new(243-245)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: run_make_ci_lint
- GitHub Check: run_make_ci_test
- GitHub Check: Build Project
🔇 Additional comments (55)
test-integration/schedulecommit/test-scenarios/Cargo.toml (1)
19-20: Bothrandandborshdev-dependencies are actively used in the test code.randis imported intests/02_commit_and_undelegate.rsfor random number generation (RngCore,SeedableRng), andborshis used intests/utils/mod.rsas a trait bound for deserialization. No issues found.test-integration/test-tools/src/integration_test_context.rs (2)
160-162: LGTM! The format placeholder fix is correct.The error message now properly includes the
labelparameter, so the panic will show which RPC client is missing (e.g., "rpc_client for [chain] does not exist" instead of the literal string "rpc_client for [{}] does not exist").
171-177: LGTM! The conditional transaction version logic is now documented.The added comment clarifies that the chain cluster requires explicit version 0 support while the ephemeral cluster uses default version handling. This makes the conditional logic more maintainable.
test-integration/test-ledger-restore/tests/08_commit_update.rs (1)
55-55: LGTM: Proper TempDir lifetime management.Binding the
TempDirto_tmpdir(rather than discarding with_) correctly keeps the temporary directory alive for the entire function scope, preventing premature cleanup while the validator is running. The underscore prefix appropriately signals that the variable is intentionally unused while maintaining the necessary lifetime. This pattern is consistent with line 42.Also applies to: 170-170
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
16-34: LGTM! UserSeeds parameter threading is correct.The
user_seedparameter is properly propagated totry_newandtry_new_random_keys, consistent with theScheduleCommitTestContextAPI shown in the relevant code snippets.test-integration/test-committor-service/Cargo.toml (1)
26-26: LGTM! Dependency addition follows established patterns.The
program-schedulecommitdev-dependency withfeatures = ["no-entrypoint"]is consistent with other program dependencies in this file and enables the test utilities that referenceprogram_schedulecommittypes (e.g.,UserSeeds, order book instructions).magicblock-committor-service/src/tasks/mod.rs (5)
17-17: LGTM! Import addition for Account type.The
solana_account::Accountimport is required for the newCommitDiffTask.base_accountfield.
32-33: LGTM! TaskBuilderImpl re-export.Re-exporting
TaskBuilderImplfrom the module root provides a cleaner public API surface for callers.
111-117: LGTM! CommitDiffTask struct is well-structured.The struct correctly includes
Debugin its derives (addressing past review feedback) and has the required fields for diff-based commits:
commit_idfor transaction orderingallow_undelegationfor post-commit behaviorcommitted_accountcontaining the current ephemeral statebase_accountfor computing the diff against chain state
34-40: LGTM! TaskType enum expansion.The addition of
Finalize,Undelegate, andActionvariants provides complete coverage of the task type system.
304-445: LGTM! Serialization safety tests.The tests properly exercise all
ArgsTaskTypevariants (Commit, Finalize, Undelegate, BaseAction) andBufferTaskinstruction serialization, ensuring instructions can be round-tripped through bincode.magicblock-committor-service/src/tasks/task_strategist.rs (2)
429-468: LGTM! create_test_commit_task helper properly tests diff scenarios.The helper correctly:
- Creates a
CommittedAccountwith the specified data size- When
diff_len > 0, creates a modifiedbase_accountby wrapping bytes to simulate changes- Uses
TaskBuilderImpl::create_commit_taskto produce the appropriate task type based on whether a base_account is providedThis enables testing both CommitState (no base_account) and CommitDiff (with base_account) paths.
561-621: LGTM! Tests for diff-based commit strategy selection.The new tests properly verify the CommitDiff optimization behavior:
test_build_strategy_does_not_optimize_large_account_but_small_diff: 66KB account with threshold-sized diff stays as Argstest_build_strategy_does_not_optimize_large_account_and_above_threshold_diff: 66KB account with diff just above threshold stays as Argstest_build_strategy_does_optimize_large_account_and_large_diff: 66KB account with 4× threshold diff optimizes to BufferThis validates that the CommitDiff strategy avoids buffer overhead when diffs are small enough to fit in instruction args.
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (2)
40-44: LGTM! Batched get_base_accounts trait method.This addresses the past review suggestion for batched base-account fetching. The method signature enables efficient retrieval of multiple accounts in a single RPC call.
272-290: LGTM! CacheTaskInfoFetcher implementation of get_base_accounts.The implementation correctly:
- Uses
get_multiple_accountsfor efficient batched fetching (reducing RPC round-trips)- Maps errors consistently with other methods using
MagicBlockRpcClientError- Filters out
Nonevalues (accounts that don't exist) and returns only found accounts- Returns a
HashMap<Pubkey, Account>for easy lookup by callersThe pattern matches the
MockTaskInfoFetcherimplementation shown in the relevant code snippets.test-integration/test-committor-service/tests/test_ix_commit_local.rs (4)
34-34: LGTM! Import for order book test utilities.The import enables the new order book mutation tests that exercise the CommitDiff path with real on-chain accounts.
98-121: LGTM! Order book mutation tests for CommitDiff.These tests exercise the CommitDiff path by:
- Creating real on-chain order book accounts via
init_and_delegate_order_book_on_chain- Modifying account data to create diffs of varying sizes
- Verifying the correct commit strategy is selected
The boundary tests (679, 680, 681 bytes) document the exact threshold where the strategy transitions from Args to FromBuffer, which is valuable for understanding and debugging the optimization behavior.
188-251: LGTM! commit_book_order_account helper is well-structured.The helper correctly:
- Initializes and delegates an order book on chain (providing a base account for diff computation)
- Modifies
changed_lenbytes withwrapping_add(1)to create predictable diffs- Sets the owner to
program_schedulecommit::id()for proper account handling- Builds and submits the commit intent with appropriate strategy expectations
This enables end-to-end testing of the CommitDiff optimization with real chain state.
260-408: LGTM! Updated strategy expectations reflect Args-based commit flow.The expectation updates (e.g.,
CommitStrategy::Argsinstead ofFromBufferfor various tests) correctly reflect the new commit planner that favors instruction args when transaction size permits. Tests that still expectFromBufferWithLookupTableare for larger bundles where the optimization correctly falls back to buffers.magicblock-committor-service/src/intent_executor/null_task_info_fetcher.rs (1)
1-41: LGTM! NullTaskInfoFetcher implementation.This is a well-implemented Null Object pattern for testing scenarios that don't require real chain data:
- All fetch methods return empty/default values
get_base_accountsreturns an emptyHashMap, which correctly triggers the CommitState fallback (since no base accounts are found for diff computation)- The implementation is minimal and consistent with the trait contract
This enables unit tests to construct tasks without RPC dependencies.
test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (3)
8-8: LGTM! UserSeeds enum import.Using the
UserSeedsenum instead of raw byte strings (as discussed in past reviews) provides type safety and better self-documentation.
48-51: LGTM! UserSeeds parameter usage.The
UserSeeds::MagicScheduleCommitparameter is correctly passed toget_context_with_delegated_committees, consistent with the updated API.
234-239: LGTM! UserSeeds in delegate_account_cpi_instruction.The
UserSeeds::MagicScheduleCommitparameter is correctly passed todelegate_account_cpi_instruction, ensuring consistent seed usage across init and delegate operations.magicblock-committor-service/src/tasks/task_builder.rs (3)
45-51: LGTM! Clear threshold documentation and reasonable default.The 256-byte threshold is well-documented and provides a sensible boundary between small accounts (where full state transfer is efficient) and larger accounts (where diff-based commits reduce data transfer).
53-83: Task creation logic is correct and cleanly structured.The helper correctly:
- Filters out
base_accountfor small accounts (≤ threshold) to force CommitState- Uses CommitDiff only when both the account exceeds the threshold AND a base_account is available
- Falls back to CommitState when base_account fetch fails or returns None
This ensures CommitDiff is only used when it can provide actual benefit.
113-132: Good use of parallel fetching to minimize latency.Using
tokio::join!to fetch commit IDs and base accounts concurrently is the right approach. This addresses the earlier reviewer feedback about sequential network calls.magicblock-committor-service/src/tasks/args_task.rs (4)
1-6: Clean integration of CommitDiff imports and variant.The new imports from
dlp(CommitDiffArgs,CommitStateArgs,compute_diff) and theCommitDiff(CommitDiffTask)variant are properly structured.Also applies to: 23-23
67-85: Instruction building is correct and efficient.The diff is computed at instruction-building time using the stored
base_account, avoiding any network I/O ininstruction(). This addresses the earlier review concern about RPC calls in this method.
134-146: Acknowledged: Temporary downgrade path for CommitDiff optimization.The TODO clearly documents that CommitDiff is converted back to CommitTask when optimizing to BufferTask because BufferTask doesn't yet support CommitDiff. This is a reasonable interim approach.
170-178: Compute units and task type mapping are consistent.CommitDiff correctly uses the same 70,000 compute units as Commit, and mapping both to
TaskType::Commitis reasonable since they're semantically similar operations. Based on learnings, these compute units represent per-task budgets that sum for multi-task transactions.Also applies to: 185-192
test-integration/test-committor-service/tests/test_transaction_preparator.rs (3)
7-11: Import adjustments align with new task creation API.Replacing direct
CommitTaskusage withTaskBuilderImplensures tests use the same task creation logic as production code.
37-47: Test correctly usesTaskBuilderImpl::create_commit_task.Passing
Noneforbase_accountensures a CommitState task is created (since the account data is small), which is appropriate for this test scenario.
93-102: BufferTask creation pattern is correct.The
.task_type.into()chain correctly extracts theArgsTaskTypeand converts it toBufferTaskTypefor buffer-based task preparation.test-integration/test-committor-service/tests/utils/transactions.rs (2)
124-134: Pragmatic handling of CommitState/CommitDiff in log matching.The inline comment explains the rationale well - CommitDiff is an optimized form chosen by the service, so treating "CommitState" needle as matching either variant avoids widespread test changes.
238-298: New order book delegation helper follows established patterns.The
init_and_delegate_order_book_on_chainfunction mirrors the existinginit_and_delegate_account_on_chainstructure, using the appropriate order-book-specific instructions and account destructuring.test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (4)
56-59: UserSeeds enum provides type-safe seed selection.Using
UserSeeds::MagicScheduleCommitinstead of raw byte slices improves clarity and prevents mismatched seeds.
113-167: Order book commit helper is well-structured.The function correctly:
- Creates context with
UserSeeds::OrderBook- Constructs update and diff instructions
- Sends transaction and returns result for verification
300-362: Excellent test design with reproducible randomness.The test uses
OsRngto generate a seed, thenStdRngfor deterministic generation. Including the seed in assertion messages enables easy reproduction of failures. The order book verification correctly checks both lengths and content equality.
309-309: Keepingprintln!for the seed is correct.As discussed in past comments, this needs to print even when the test fails so the seed can be used for debugging. Using
debug!would hide this critical information.test-integration/test-committor-service/tests/common.rs (2)
116-119: Mock fetcher now properly wraps the RPC client.The
MockTaskInfoFetcher(MagicblockRpcClient)tuple struct andcreate_task_info_fetcherhelper provide clean test infrastructure.Also applies to: 122-122
146-163:get_base_accountsimplementation correctly mirrors production code.The implementation:
- Calls
get_multiple_accountson the RPC client- Maps errors to
TaskInfoFetcherError::MagicBlockRpcClientError- Filters out
Nonevalues (non-existent accounts) and collects into a HashMapThis matches the pattern in
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs.test-integration/schedulecommit/client/src/schedule_commit_context.rs (4)
66-80: Constructor signatures cleanly propagate UserSeeds.Both
try_new_random_keysandtry_newacceptUserSeedsand delegate to the internal constructor, maintaining a clean API.
115-118: PDA derivation uses the correct seed pattern.Using
user_seed.bytes()ensures the PDA derivation matches the on-chain program's expected seeds.
166-208: Instruction generation correctly branches on UserSeeds variant.The match expression:
MagicScheduleCommit→init_account_instructionOrderBook→init_order_book_instructionThe compute budget instructions (1,400,000 units, 10,000 price) are reasonable for complex initialization transactions.
193-206: Tracked: Commented TODO for grow_order_book.The comment explains the 10KB delegation limit and the planned future work. This is acceptable as a tracked limitation.
test-integration/programs/schedulecommit/src/lib.rs (4)
36-41: Order book module and types are properly integrated.The module structure and public exports (
BookUpdate,OrderBookOwned,OrderLevel) along with the newDelegateOrderBookArgsstruct provide a clean API for order book operations.Also applies to: 56-61
310-341:process_init_order_bookcorrectly allocates and assigns ownership.The function:
- Validates payer is a signer
- Derives the expected PDA
- Validates the provided order_book matches the derived PDA
- Allocates 10KB and assigns to this program
Note: Past review flagged missing
book_managersigner check. Sincebook_manageris used in PDA derivation seeds forallocate_account_and_assign_owner, the operation will fail if the account doesn't match, but an explicit early check would provide clearer errors.
449-469:process_schedulecommit_for_orderbookcorrectly validates payer and commits.The handler validates the payer is a signer before calling
commit_and_undelegate_accounts. The lack of PDA/ownership validation was noted in past reviews, but since this is test code and downstream checks exist, it's acceptable.
822-841: Undelegate handling now supports both account types.The match on
data.len()to determine whether to deserialize asMainAccountorOrderBookis a reasonable approach for this test program. Error logging provides visibility into deserialization failures.test-integration/programs/schedulecommit/src/order_book.rs (6)
1-27: LGTM: Struct definitions and compile-time assertions.The
OrderLevelandBookUpdatestructs are well-defined. The use of#[repr(C)]and compile-time assertions ensures predictable layout and catches size/alignment mismatches at build time.
28-53: LGTM: Header and owned representation.The
OrderBookHeaderandOrderBookOwneddesigns are sound. The conversion correctly reverses asks back to their original order (line 50), matching the internal storage invariant.
86-143: LGTM: Safe construction with proper validation.The
try_newconstructor correctly validates alignment (lines 112–123) and capacity bounds (lines 131–136) before creating typed references. These checks prevent the undefined behavior that would arise from unaligned access or out-of-bounds slices inbids()/asks_reversed().
150-187: LGTM: Safe and correct bid/ask insertion.Both
add_bidsandadd_asksproperly check capacity before using unsafe slices. The unsafe helper methods are sound because:
- Bounds are validated by the capacity check
- Uninitialized memory is immediately filled before the slice is returned
- Header lengths are updated atomically
The reverse-order copy in
add_asks(lines 179–183) correctly implements the storage invariant.
189-210: LGTM: Safe accessors protected by constructor invariants.The unsafe
from_raw_partscalls inbids()andasks_reversed()are sound because:
- The constructor validates alignment (lines 112–123) and capacity bounds (lines 131–136)
add_bids/add_asksare the only mutators and maintain the invariantbids_len + asks_len ≤ capacity- Header is private and cannot be corrupted externally
The u32→usize casts are safe in Solana's 64-bit environment.
212-234: LGTM: Private helpers and capacity calculation are sound.The unsafe helper methods (lines 212–227) are correctly scoped as private and called only after capacity validation by their public callers (
add_bids/add_asks), ensuring bounds are valid.The
remaining_capacitycalculation (lines 229–234) performs u32 arithmetic that cannot overflow in practice: Solana's 10MB account limit means at most ~625K entries (10MB ÷ 16 bytes), well belowu32::MAX. The constructor's capacity check (lines 131–136) ensureschecked_subwill not fail.
ea0dc4f to
30ef2fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
magicblock-committor-service/src/tasks/task_strategist.rs (2)
377-379: Minor: Inconsistent system program import usage.Two imports for the same program ID are used inconsistently (line 439 uses
system_program::id(), line 497 usessystem_program_id()). Consider consolidating to one style for consistency.🔎 Suggested consolidation
-use solana_program::system_program; use solana_pubkey::Pubkey; use solana_system_program::id as system_program_id;Then update line 439:
- owner: system_program::id(), + owner: system_program_id(),
419-425: MockInfoFetcher returns empty base accounts—intentional limitation.This mock always returns an empty HashMap, so tests using
TaskBuilderImpl::commit_taskswon't exercise theCommitDiffpath. The unit tests in this file work around this by usingcreate_test_commit_task, which directly providesbase_account. For full integration coverage of the diff path, consider adding tests that use a mock returning actual base account data.
🧹 Nitpick comments (2)
magicblock-committor-service/src/tasks/task_builder.rs (2)
119-125: Minor inconsistency: threshold comparisons differ (>=vs>).Line 122 uses
>= COMMIT_STATE_SIZE_THRESHOLDto filter accounts for base fetching, but line 61 uses> COMMIT_STATE_SIZE_THRESHOLDto decide whether to use the diff. This means a 256-byte account will have its base fetched but won't use it (falling back toCommitState). Not incorrect, but wasteful for the edge case.🔎 Align the comparisons
let diffable_pubkeys = accounts .iter() .filter(|account| { - account.account.data.len() >= COMMIT_STATE_SIZE_THRESHOLD + account.account.data.len() > COMMIT_STATE_SIZE_THRESHOLD })
153-156: TODO is valid; consider addressing in this PR.The note about using
remove()instead ofget().cloned()is a minor optimization. If account pubkeys are guaranteed unique (which they likely are given they represent distinct delegated accounts), usingremove()avoids the clone cost.🔎 Use remove if uniqueness is guaranteed
- // TODO (snawaz): if accounts do not have duplicate, then we can use remove - // instead: - // let base_account = base_accounts.remove(&account.pubkey); - let base_account = base_accounts.get(&account.pubkey).cloned(); + let base_account = base_accounts.remove(&account.pubkey);Note: This requires
base_accountsto bemut.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/test-committor-service/tests/common.rstest-integration/test-committor-service/tests/test_transaction_preparator.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
🧰 Additional context used
🧠 Learnings (9)
📚 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-committor-service/src/tasks/task_builder.rstest-integration/test-committor-service/tests/test_transaction_preparator.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/test-committor-service/tests/common.rs
📚 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-committor-service/src/tasks/task_builder.rstest-integration/test-committor-service/tests/test_transaction_preparator.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.
Applied to files:
magicblock-committor-service/src/tasks/task_builder.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:
test-integration/test-committor-service/tests/test_transaction_preparator.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.
Applied to files:
test-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/test-committor-service/tests/common.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-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.
Applied to files:
test-integration/test-committor-service/tests/common.rs
🧬 Code graph analysis (3)
magicblock-committor-service/src/tasks/task_builder.rs (3)
test-integration/test-committor-service/tests/common.rs (4)
create_commit_task(175-191)fetch_next_commit_ids(126-131)get_base_accounts(146-163)new(53-56)magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (5)
fetch_next_commit_ids(24-27)fetch_next_commit_ids(166-233)get_base_accounts(41-44)get_base_accounts(273-290)new(58-65)magicblock-committor-service/src/tasks/args_task.rs (1)
new(42-47)
test-integration/test-committor-service/tests/test_transaction_preparator.rs (3)
test-integration/test-committor-service/tests/common.rs (2)
new(53-56)create_commit_task(175-191)magicblock-committor-service/src/tasks/buffer_task.rs (1)
new(40-48)magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)
magicblock-committor-service/src/tasks/task_strategist.rs (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Project
- GitHub Check: run_make_ci_lint
- GitHub Check: run_make_ci_test
🔇 Additional comments (10)
magicblock-committor-service/src/tasks/task_strategist.rs (2)
429-467: Well-structured test helper for diff scenarios.The helper correctly creates distinct
base_accountdata whendiff_len > 0, enabling proper testing of bothCommitDiffandCommittask paths. Thewrapping_add(1)approach ensures predictable byte differences for the diff encoding.
561-620: Good test coverage for diff-based optimization boundaries.These tests properly verify the optimization behavior around
COMMIT_STATE_SIZE_THRESHOLD:
- Small diff → Args strategy (no buffer needed)
- Threshold+1 diff → Args strategy (still fits)
- Large diff (4×threshold) → Buffer strategy (too large for args)
This addresses the reviewer concern about missing diff test coverage.
test-integration/test-committor-service/tests/test_transaction_preparator.rs (2)
37-47: Correct migration to TaskBuilderImpl for commit task creation.The test now uses
TaskBuilderImpl::create_commit_taskwithNoneforbase_account, which correctly produces aCommitStatetask for the small 5-byte account data. This aligns with the centralized task creation pattern.
93-102: BufferTask construction correctly extracts task_type from ArgsTask.The pattern
.task_type.into()properly converts theArgsTaskTypefrom the returnedArgsTaskintoBufferTaskTypefor buffer-based execution.magicblock-committor-service/src/tasks/task_builder.rs (3)
45-51: Good documentation for the threshold constant.The comment clearly explains the rationale for choosing 256 bytes as the threshold—sufficient for small accounts with typical integer fields. Making this
pub constenables tests to reference it for boundary testing.
127-138: Good use of parallel fetching.Using
tokio::join!to fetch commit IDs and base accounts concurrently reduces latency compared to sequential calls. Error handling correctly propagates failures from either fetch operation.
54-82: Clean encapsulation of commit task creation logic.The helper correctly:
- Clears
base_accountfor accounts at or below threshold (ensuring small accounts always useCommitState)- Creates
CommitDiffwhenbase_accountis provided for large accounts- Falls back to
CommitotherwiseThis centralizes the decision logic and prevents invalid task states.
test-integration/test-committor-service/tests/common.rs (3)
116-119: Good factory method for test infrastructure.Adding
create_task_info_fetcherimproves code reuse and ensures consistent fetcher creation across tests.
146-163: Correct implementation matching the main TaskInfoFetcher.The implementation correctly:
- Calls RPC to fetch multiple accounts
- Wraps errors into
TaskInfoFetcherError- Filters out
Noneresults (missing accounts)- Returns a
HashMap<Pubkey, Account>This mirrors the
CacheTaskInfoFetcherimplementation intask_info_fetcher.rs, ensuring consistent behavior in tests.
122-122: MockTaskInfoFetcher now carries RPC client for real lookups.The tuple struct change enables
get_base_accountsto perform actual RPC calls, which is appropriate for integration tests that need to verify real account data. Thecreate_task_info_fetcherfactory method abstracts construction.
30ef2fc to
ad52f20
Compare
…fficiently commit changes in delegated accounts
ad52f20 to
333f137
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (11)
magicblock-committor-service/src/tasks/args_task.rs (1)
200-206: CommitDiff tasks cannot be recycled—commit_id is never updated.
reset_commit_idonly handlesArgsTaskType::Commit, returning early for all other variants includingCommitDiff. When aCommitDifftask is recycled, the stalecommit_idremains, causing desync in future submissions.🔎 Proposed fix
- let ArgsTaskType::Commit(commit_task) = &mut self.task_type else { - return; - }; - - commit_task.commit_id = commit_id; + match &mut self.task_type { + ArgsTaskType::Commit(task) | ArgsTaskType::CommitDiff(task) => { + task.commit_id = commit_id; + } + _ => {} + }Based on past review comments.
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
41-47: Remove unused trait bounds.The trait bounds
std::fmt::Debug + borsh::BorshDeserialize + PartialEq + Eqare not used by this function. The function body (lines 48-65) only inspects the structure ofScheduledCommitResultand never deserializes, formats, or compares values of typeT.🔎 Proposed fix
pub fn assert_one_committee_was_committed<T>( ctx: &ScheduleCommitTestContext, res: &ScheduledCommitResult<T>, is_single_stage: bool, -) where - T: std::fmt::Debug + borsh::BorshDeserialize + PartialEq + Eq, -{ +) {Based on past review comments.
test-integration/schedulecommit/client/src/schedule_commit_context.rs (2)
166-169: Consider extracting compute budget constants.The compute unit limit (1,400,000) and price (10,000) are hardcoded. Extracting these as named constants would improve maintainability.
const INIT_COMPUTE_UNIT_LIMIT: u32 = 1_400_000; const INIT_COMPUTE_UNIT_PRICE: u64 = 10_000; let mut ixs = vec![ ComputeBudgetInstruction::set_compute_unit_limit(INIT_COMPUTE_UNIT_LIMIT), ComputeBudgetInstruction::set_compute_unit_price(INIT_COMPUTE_UNIT_PRICE), ];Based on past review comments.
193-206: Remove commented code block.The 14-line commented TODO about growing order books adds noise. Track the account size limitation and future
grow_order_book_instructionfeature in a GitHub issue, then remove this block.Based on past review comments.
test-integration/programs/schedulecommit/src/api.rs (3)
71-90: Authorization inconsistency:book_managershould be a signer.Line 80 marks
book_manageras a non-signer (false), butinit_order_book_instructionrequiresbook_managerto sign (line 59). This creates an authorization inconsistency where:
- Init requires
book_managersignature- Grow allows any payer to resize someone else's order book
If
book_managershould authorize growth (mirroring init semantics), change line 80 to markbook_manageras a signer and add the corresponding validation inprocess_grow_order_book.🔎 Proposed fix
let account_metas = vec![ AccountMeta::new(payer, true), - AccountMeta::new_readonly(book_manager, false), + AccountMeta::new_readonly(book_manager, true), AccountMeta::new(order_book, false), AccountMeta::new_readonly(system_program::id(), false), ];Based on past review comments.
197-213: Missingbook_managerauthorization.The function omits the
book_manageraccount. Since order books are PDAs derived from[b"order_book", book_manager.key], thebook_manageris the conceptual owner. Without validation, anyone can update any order book.Include
book_managerin the account metas and validate authorization on-chain.🔎 Proposed fix
pub fn update_order_book_instruction( payer: Pubkey, + book_manager: Pubkey, order_book: Pubkey, update: BookUpdate, ) -> Instruction { let program_id = crate::id(); let account_metas = vec![ AccountMeta::new(payer, true), + AccountMeta::new_readonly(book_manager, true), AccountMeta::new(order_book, false), ];Based on past review comments.
215-234: Missingbook_managerauthorization.Similar to
update_order_book_instruction, this function omits thebook_manageraccount. Anyone can schedule commits for any order book without proper authorization.🔎 Proposed fix
pub fn schedule_commit_diff_instruction_for_order_book( payer: Pubkey, + book_manager: Pubkey, order_book: Pubkey, magic_program_id: Pubkey, magic_context_id: Pubkey, ) -> Instruction { let program_id = crate::id(); let account_metas = vec![ AccountMeta::new(payer, true), + AccountMeta::new_readonly(book_manager, true), AccountMeta::new(order_book, false), AccountMeta::new(magic_context_id, false), AccountMeta::new_readonly(magic_program_id, false), ];Based on past review comments.
test-integration/programs/schedulecommit/src/lib.rs (3)
307-341: Missing signer validation:book_managermust be verified.Line 318 validates
payeris a signer, but there's no check forbook_manager. The instruction builder (api.rs line 59) marksbook_manageras a signer, but the handler never validates this. Failing late inallocate_account_and_assign_ownerproduces a less clear error than validating up front.🔎 Proposed fix
assert_is_signer(payer, "payer")?; + assert_is_signer(book_manager, "book_manager")?; let (pda, bump) = Pubkey::find_program_address(Based on past review comments.
390-423: Missing signer validation for payer before delegation CPI.The handler calls
delegate_account(which creates accounts and transfers lamports) without validating thatpayeris a signer. The CPI will fail with a less clear error if the payer flag is missing.🔎 Proposed fix
let [payer, order_book, owner_program, buffer, delegation_record, delegation_metadata, delegation_program, system_program] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); }; + assert_is_signer(payer, "payer")?; + let seeds_no_bump = [b"order_book", args.book_manager.as_ref()];Based on past review comments.
449-469: Missing PDA and ownership validation for order_book_account.The handler schedules a commit and undelegate for
order_book_accountwithout verifying:
- The account is the expected PDA derived from
[b"order_book", book_manager.key]- The account is owned by this program
This allows committing arbitrary accounts via this instruction.
Full PDA validation requires
book_managerto be available (either as an additional account or in instruction data) to recompute and verify the PDA. Add explicit validation:
- Include
book_manageraccount or pass its pubkey in instruction data- Recompute PDA with seeds
[b"order_book", book_manager.key.as_ref()]- Assert
order_book_account.key == &pda- Assert
order_book_account.owner == program_idBased on past review comments.
magicblock-committor-service/src/tasks/task_strategist.rs (1)
420-425: Clarify which tests need CommitDiffTask coverage.MockInfoFetcher returning an empty
HashMapprevents tests usingTaskBuilderImpl::commit_tasks(such astest_build_single_stage_mode,test_build_two_stage_mode_no_alts) from exercising the CommitDiffTask path, sincebase_accountwill always beNone. However, the tests at lines 561-620 usecreate_test_commit_taskdirectly, which bypasses MockInfoFetcher and can already construct CommitDiffTask tasks.If the intent is to add integration tests that verify CommitDiffTask creation through the full
commit_tasksflow, update MockInfoFetcher to conditionally return base accounts for accounts aboveCOMMIT_STATE_SIZE_THRESHOLD. Alternatively, add assertions to the existing strategy tests to verify the task type ofoptimized_tasks[0]using the appropriate accessor method (nottask_type()).
🧹 Nitpick comments (3)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (1)
41-45: Batch base-account fetch implementation looks good; consider an empty-slice fast pathThe new
get_base_accountsAPI andCacheTaskInfoFetcherimplementation correctly mirror the existingget_multiple_accountsusage and safely filter outNoneentries into aHashMap.As a small optimization, you could early-return
Ok(HashMap::new())whenpubkeys.is_empty()to avoid an unnecessary RPC call on the hot path where no diffable accounts exist. This is purely a micro-optimization; the current behavior is functionally fine.Also applies to: 273-290
test-integration/test-committor-service/tests/test_ix_commit_local.rs (1)
68-121: Order-book commit strategy tests are well-targeted; consider clarifying the 679/680/681 commentThe new single-account and order-book tests nicely exercise the Args vs FromBuffer strategy boundary and verify we can still commit large (10KB) accounts via args when the diff is small.
One nit: in
test_ix_commit_order_book_change_680_bytes, the comment discusses 679/680 while the call useschanged_len = 681. To make future maintenance easier, it may be worth tightening that comment to explicitly mention 681 as the point where you expect the planner to flip fromArgstoFromBuffer, and briefly restate the encoded-size reasoning there.Also applies to: 188-251
magicblock-committor-service/src/tasks/task_builder.rs (1)
45-52: Align threshold comparisons to avoid unnecessary base-account fetches
create_commit_taskuseslen() > COMMIT_STATE_SIZE_THRESHOLDwhilediffable_pubkeysuseslen() >= COMMIT_STATE_SIZE_THRESHOLD. For an account of exactly 256 bytes, this means:
get_base_accountsis called for that pubkey, butcreate_commit_taskwill ignore any returnedbase_accountand fall back to CommitState.Functionally this is harmless but does introduce an avoidable RPC call. Consider making both checks either
>or>=(matching the comment’s intent) so fetch and usage are consistent.Also applies to: 119-125
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
Cargo.lockis excluded by!**/*.locktest-integration/Cargo.lockis excluded by!**/*.locktest-integration/schedulecommit/elfs/dlp.sois excluded by!**/*.so
📒 Files selected for processing (30)
Cargo.tomlmagicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/args_task.rsmagicblock-committor-service/src/tasks/buffer_task.rsmagicblock-committor-service/src/tasks/mod.rsmagicblock-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/Cargo.tomltest-integration/programs/schedulecommit/Cargo.tomltest-integration/programs/schedulecommit/src/api.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/programs/schedulecommit/src/utils/mod.rstest-integration/schedulecommit/client/src/schedule_commit_context.rstest-integration/schedulecommit/client/src/verify.rstest-integration/schedulecommit/test-scenarios/Cargo.tomltest-integration/schedulecommit/test-scenarios/tests/01_commits.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rstest-integration/schedulecommit/test-security/tests/01_invocations.rstest-integration/test-committor-service/Cargo.tomltest-integration/test-committor-service/tests/common.rstest-integration/test-committor-service/tests/test_delivery_preparator.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/test-committor-service/tests/utils/instructions.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-ledger-restore/tests/08_commit_update.rstest-integration/test-tools/src/integration_test_context.rstest-integration/test-tools/src/scheduled_commits.rs
🚧 Files skipped from review as they are similar to previous changes (12)
- test-integration/test-tools/src/integration_test_context.rs
- test-integration/programs/schedulecommit/Cargo.toml
- test-integration/test-tools/src/scheduled_commits.rs
- test-integration/test-committor-service/tests/test_delivery_preparator.rs
- test-integration/test-ledger-restore/tests/08_commit_update.rs
- test-integration/programs/schedulecommit/src/utils/mod.rs
- magicblock-committor-service/src/tasks/buffer_task.rs
- Cargo.toml
- test-integration/schedulecommit/client/src/verify.rs
- test-integration/test-committor-service/tests/utils/instructions.rs
- test-integration/test-committor-service/Cargo.toml
- test-integration/test-committor-service/tests/test_transaction_preparator.rs
🧰 Additional context used
🧠 Learnings (20)
📚 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-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/test-committor-service/tests/test_ix_commit_local.rsmagicblock-committor-service/src/tasks/task_strategist.rsmagicblock-committor-service/src/tasks/task_builder.rstest-integration/programs/schedulecommit/src/lib.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/programs/schedulecommit/src/api.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_builder.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/schedulecommit/client/src/schedule_commit_context.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/order_book.rs
📚 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-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/schedulecommit/test-scenarios/tests/01_commits.rstest-integration/test-committor-service/tests/test_ix_commit_local.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/Cargo.tomlmagicblock-committor-service/src/tasks/task_builder.rstest-integration/schedulecommit/client/src/schedule_commit_context.rstest-integration/schedulecommit/test-security/tests/01_invocations.rsmagicblock-committor-service/src/tasks/args_task.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/schedulecommit/client/src/schedule_commit_context.rsmagicblock-committor-service/src/tasks/args_task.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/programs/schedulecommit/src/api.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-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/programs/schedulecommit/src/lib.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rsmagicblock-committor-service/src/tasks/mod.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-10-26T16:53:29.820Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: magicblock-chainlink/src/remote_account_provider/mod.rs:134-0
Timestamp: 2025-10-26T16:53:29.820Z
Learning: In magicblock-chainlink/src/remote_account_provider/mod.rs, the `Endpoint::separate_pubsub_url_and_api_key()` method uses `split_once("?api-key=")` because the api-key parameter is always the only query parameter right after `?`. No additional query parameter parsing is needed for this use case.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/Cargo.tomlmagicblock-committor-service/src/tasks/mod.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-committor-service/tests/utils/transactions.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:
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rstest-integration/schedulecommit/test-scenarios/tests/01_commits.rstest-integration/schedulecommit/test-scenarios/tests/utils/mod.rsmagicblock-committor-service/src/tasks/mod.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.
Applied to files:
test-integration/test-committor-service/tests/test_ix_commit_local.rstest-integration/test-committor-service/tests/utils/transactions.rstest-integration/test-committor-service/tests/common.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.
Applied to files:
test-integration/Cargo.tomltest-integration/programs/schedulecommit/src/lib.rstest-integration/schedulecommit/test-scenarios/Cargo.toml
📚 Learning: 2025-11-07T18:19:48.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: test-integration/programs/schedulecommit/Cargo.toml:19-20
Timestamp: 2025-11-07T18:19:48.996Z
Learning: In Solana programs (crates depending on solana-program), the empty feature flags `custom-heap = []` and `custom-panic = []` are standard declarations required to avoid compiler warnings. These should not be flagged as unused features in Cargo.toml files for Solana program crates.
Applied to files:
test-integration/Cargo.toml
📚 Learning: 2025-11-21T13:56:03.885Z
Learnt from: snawaz
Repo: magicblock-labs/magicblock-validator PR: 575
File: test-integration/programs/schedulecommit/src/utils/mod.rs:71-71
Timestamp: 2025-11-21T13:56:03.885Z
Learning: In Solana programs (BPF runtime), defensive checked conversions to `usize` (e.g., `try_into()`) are unnecessary when casting from `u64`. Solana exclusively runs in 64-bit environments where `usize` is 64 bits, so truncation is not a concern and simple `as usize` casts are appropriate.
Applied to files:
test-integration/Cargo.tomltest-integration/programs/schedulecommit/src/lib.rstest-integration/programs/schedulecommit/src/order_book.rs
📚 Learning: 2025-10-26T16:54:39.084Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: test-manual/Cargo.toml:0-0
Timestamp: 2025-10-26T16:54:39.084Z
Learning: In the magicblock-validator repository, use git branch references (not commit hashes or tags) for the helius-laserstream dependency to allow automatic updates when the branch is pushed to.
Applied to files:
test-integration/Cargo.toml
📚 Learning: 2025-11-20T08:57:07.217Z
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.
Applied to files:
test-integration/Cargo.toml
📚 Learning: 2025-11-21T11:03:26.756Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 664
File: magicblock-chainlink/src/testing/mod.rs:342-370
Timestamp: 2025-11-21T11:03:26.756Z
Learning: In the magicblock-validator codebase, avoid leaving review comments that merely acknowledge code is correct or well-structured when there is no actionable suggestion, improvement, or issue to flag. Only comment when there is something specific to recommend, fix, or clarify.
Applied to files:
test-integration/Cargo.toml
📚 Learning: 2025-10-26T08:49:31.543Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 585
File: magicblock-committor-service/src/tasks/buffer_task.rs:111-115
Timestamp: 2025-10-26T08:49:31.543Z
Learning: In the magicblock-committor-service, compute units returned by the `compute_units()` method in task implementations (such as `BufferTask`, `ArgsTask`, etc.) represent the compute budget for a single task. Transactions can comprise multiple tasks, and the total compute budget for a transaction is computed as the sum of the compute units of all tasks included in that transaction.
Applied to files:
magicblock-committor-service/src/tasks/args_task.rs
📚 Learning: 2025-12-01T16:02:05.367Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.
Applied to files:
magicblock-committor-service/src/tasks/mod.rs
📚 Learning: 2025-11-04T10:48:00.070Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/mod.rs:217-219
Timestamp: 2025-11-04T10:48:00.070Z
Learning: In magicblock-validator, the codebase uses a pattern where types containing non-Send/non-Sync fields (like Rc<RefCell<...>>) are marked with unsafe impl Send when they are guaranteed to be confined to a single thread through careful API design and thread spawning patterns.
Applied to files:
magicblock-committor-service/src/tasks/mod.rs
🧬 Code graph analysis (12)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (1)
test-integration/test-committor-service/tests/common.rs (2)
get_base_accounts(146-163)new(53-56)
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (2)
test-integration/programs/schedulecommit/src/api.rs (3)
schedule_commit_diff_instruction_for_order_book(215-234)set_count_instruction(371-379)update_order_book_instruction(197-213)test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (3)
get_context_with_delegated_committees(16-35)assert_one_committee_was_committed(41-65)assert_one_committee_account_was_undelegated_on_chain(190-196)
test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
test-integration/programs/schedulecommit/src/api.rs (2)
pda_and_bump(404-408)schedule_commit_cpi_instruction(177-195)
test-integration/test-committor-service/tests/test_ix_commit_local.rs (3)
test-integration/test-committor-service/tests/utils/transactions.rs (1)
init_and_delegate_order_book_on_chain(240-298)test-integration/test-committor-service/tests/utils/mod.rs (1)
ensure_validator_authority(35-44)magicblock-committor-service/src/service.rs (1)
try_start(262-289)
magicblock-committor-service/src/tasks/task_builder.rs (3)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (5)
fetch_next_commit_ids(24-27)fetch_next_commit_ids(166-233)get_base_accounts(41-44)get_base_accounts(273-290)new(58-65)magicblock-committor-service/src/tasks/args_task.rs (1)
new(42-47)magicblock-committor-service/src/tasks/buffer_task.rs (1)
new(40-48)
test-integration/programs/schedulecommit/src/lib.rs (3)
test-integration/programs/schedulecommit/src/utils/mod.rs (3)
assert_is_signer(30-44)assert_keys_equal(16-28)allocate_account_and_assign_owner(58-109)test-integration/test-tools/src/integration_test_context.rs (2)
delegate_account(601-619)try_new(116-118)test-integration/programs/schedulecommit/src/order_book.rs (1)
try_new(106-140)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (2)
test-integration/programs/schedulecommit/src/api.rs (3)
init_order_book_instruction(51-69)init_payer_escrow(92-113)init_account_instruction(31-49)test-integration/test-tools/src/integration_test_context.rs (1)
try_new(116-118)
test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (2)
try_new(72-74)try_new_random_keys(66-71)
test-integration/schedulecommit/test-scenarios/tests/utils/mod.rs (1)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (3)
try_new(72-74)ncommittees(102-121)try_new_random_keys(66-71)
test-integration/programs/schedulecommit/src/api.rs (1)
test-integration/programs/flexi-counter/src/state.rs (1)
pda(34-37)
test-integration/test-committor-service/tests/utils/transactions.rs (1)
test-integration/test-committor-service/tests/utils/instructions.rs (3)
init_account_and_delegate_ixs(21-52)init_order_book_account_and_delegate_ixs(61-94)init_validator_fees_vault_ix(5-11)
test-integration/test-committor-service/tests/common.rs (1)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (4)
new(58-65)get_base_accounts(41-44)get_base_accounts(273-290)pubkeys(112-123)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: run_make_ci_test
- GitHub Check: run_make_ci_lint
- GitHub Check: Build Project
🔇 Additional comments (8)
test-integration/Cargo.toml (1)
74-74: Dependencies are actively used and appropriately added.The additions of
rkyv = "0.7.45"andstatic_assertions = "1.1.0"to workspace dependencies are correct:
rkyvis actively used intest-integration/programs/schedulecommit/src/order_book.rsfor serialization viarkyv::AlignedVecstatic_assertionsis actively used in the same module for compile-time assertions viaconst_assert- Both are properly referenced as workspace dependencies in the schedulecommit program's Cargo.toml
- Versions are stable and compatible
test-integration/schedulecommit/test-scenarios/Cargo.toml (2)
19-19: LGTM! Appropriate test dependency.Adding
randas a dev-dependency is appropriate for the randomized test scenarios and seeded data generation mentioned in the PR objectives.
20-20: No action needed; borsh version is compatible.The test-scenarios crate does not interact with
magic-domain-programtypes. Addingborsh = { workspace = true }is appropriate for test serialization and uses workspace version 1.5.1, which is compatible with the 1.5.x series used elsewhere in the codebase (including the 1.5.3 pinned inmagicblock-api).Likely an incorrect or invalid review comment.
test-integration/programs/schedulecommit/src/order_book.rs (1)
55-75: Zero‑copyOrderBooklayout and unsafe usage look sound for this test programThe combination of:
repr(C)+const_assert!s on size/alignment,- explicit runtime alignment checks in
try_new,- header bounds check (
bids_len + asks_len <= capacity), and- using
rkyv::AlignedVecin the Borsh pathmakes the typed pointer/slice usages in
bids(),asks_reversed(), and the internal*_with_uninitialized_slotshelpers safe from UB, given Solana’s 10MB account bound.The remaining capacity math and asks/bids layout invariants are consistent with the documented growth model. For a test-only program this is a reasonable and robust design.
Also applies to: 106-140, 186-224, 209-230
magicblock-committor-service/src/tasks/mod.rs (1)
17-17: CommitDiffTask wiring and serialization tests are coherentExposing
TaskBuilderImpland addingCommitDiffTask { …, base_account: Account }integrate cleanly with the existing task/ArgsTask machinery. The serialization tests still cover all Args/Buffer variants (viaCommitTask), and the additional Account import is appropriate for both production and test code. No issues from this module’s changes.Also applies to: 32-33, 111-117, 304-437
test-integration/schedulecommit/test-security/tests/01_invocations.rs (1)
1-1: UserSeeds integration in context setup is correctPassing
UserSeeds::MagicScheduleCommitintoScheduleCommitTestContext::try_new/try_new_random_keysaligns with the new API and makes the seed choice explicit for these security tests. Behavior remains equivalent to the previous hard-coded seed usage.Also applies to: 28-36
test-integration/schedulecommit/test-scenarios/tests/02_commit_and_undelegate.rs (1)
13-19: Order-book CommitDiff flow and randomized regression test look solid
commit_and_undelegate_order_book_accountcorrectly chainsupdate_order_book_instructionwithschedule_commit_diff_instruction_for_order_bookusingUserSeeds::OrderBook, and the huge-order-book test validates that the committedOrderBookOwnedexactly matches the generatedBookUpdate(with a reproducible RNG seed).This gives good end-to-end coverage of the new diff-based order-book path.
Also applies to: 113-167, 300-362
test-integration/schedulecommit/test-scenarios/tests/01_commits.rs (1)
5-11: UserSeeds::MagicScheduleCommit wiring keeps commit tests aligned with new APIUpdating both
get_context_with_delegated_committeescallers anddelegate_account_cpi_instructionto passUserSeeds::MagicScheduleCommitmatches the new API surface and makes the seed choice explicit. The commit/undelegate behavior under test remains the same, just parameterized via the enum.Also applies to: 45-52, 101-107, 222-239
333f137 to
aad2791
Compare
aad2791 to
5050443
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
test-integration/programs/schedulecommit/src/order_book.rs (1)
142-145: Consider failing loudly on capacity exhaustion to maintain test invariants.The current implementation silently ignores failures from
add_bidsandadd_asks, which can leave the order book in a partially updated state if capacity is exhausted mid-update (e.g., bids succeed but asks fail). For test code, this could mask capacity planning issues.Since you stated "It's a test. So let it panic!" in a previous review, consider unwrapping the results to make capacity issues immediately visible:
pub fn update_from(&mut self, updates: BookUpdate) { - self.add_bids(&updates.bids); - self.add_asks(&updates.asks); + self.add_bids(&updates.bids) + .expect("insufficient capacity for bids in update"); + self.add_asks(&updates.asks) + .expect("insufficient capacity for asks in update"); }This ensures test failures are loud rather than leaving the book in an inconsistent state.
🧹 Nitpick comments (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
137-137: Base account fetch errors silently fall back to CommitState.Using
unwrap_or_default()means any error fetching base accounts is silently ignored, and all affected accounts will use CommitState instead of CommitDiff. This matches the PR's intent that CommitDiff is an optimization, not a requirement.Consider adding a debug/warn log when the fallback occurs to aid troubleshooting:
🔎 Optional: Add warning log on fallback
- let base_accounts = base_accounts.unwrap_or_default(); + let base_accounts = match base_accounts { + Ok(accounts) => accounts, + Err(err) => { + log::warn!( + "Failed to fetch base accounts for CommitDiff (intent_id={}): {}; falling back to CommitState", + base_intent.id, err + ); + Default::default() + } + };
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-committor-service/tests/common.rstest-integration/test-committor-service/tests/test_transaction_preparator.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- test-integration/test-committor-service/tests/common.rs
🧰 Additional context used
🧠 Learnings (11)
📚 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-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-committor-service/tests/test_transaction_preparator.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-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-committor-service/tests/test_transaction_preparator.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/programs/schedulecommit/src/order_book.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/programs/schedulecommit/src/order_book.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-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
📚 Learning: 2025-10-26T16:53:29.820Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: magicblock-chainlink/src/remote_account_provider/mod.rs:134-0
Timestamp: 2025-10-26T16:53:29.820Z
Learning: In magicblock-chainlink/src/remote_account_provider/mod.rs, the `Endpoint::separate_pubsub_url_and_api_key()` method uses `split_once("?api-key=")` because the api-key parameter is always the only query parameter right after `?`. No additional query parameter parsing is needed for this use case.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.
Applied to files:
magicblock-committor-service/src/intent_executor/task_info_fetcher.rstest-integration/programs/schedulecommit/src/order_book.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-21T13:56:03.885Z
Learnt from: snawaz
Repo: magicblock-labs/magicblock-validator PR: 575
File: test-integration/programs/schedulecommit/src/utils/mod.rs:71-71
Timestamp: 2025-11-21T13:56:03.885Z
Learning: In Solana programs (BPF runtime), defensive checked conversions to `usize` (e.g., `try_into()`) are unnecessary when casting from `u64`. Solana exclusively runs in 64-bit environments where `usize` is 64 bits, so truncation is not a concern and simple `as usize` casts are appropriate.
Applied to files:
test-integration/programs/schedulecommit/src/order_book.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.
Applied to files:
test-integration/test-committor-service/tests/test_transaction_preparator.rs
🧬 Code graph analysis (4)
magicblock-committor-service/src/tasks/task_builder.rs (2)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (3)
fetch_next_commit_ids(24-27)fetch_next_commit_ids(166-233)new(58-65)magicblock-committor-service/src/tasks/args_task.rs (1)
new(42-47)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (1)
test-integration/test-committor-service/tests/common.rs (2)
get_base_accounts(146-163)new(53-56)
magicblock-committor-service/src/tasks/task_strategist.rs (3)
magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)magicblock-committor-service/src/tasks/args_task.rs (2)
new(42-47)strategy(181-183)magicblock-committor-service/src/tasks/buffer_task.rs (2)
new(40-48)strategy(132-134)
test-integration/test-committor-service/tests/test_transaction_preparator.rs (3)
test-integration/test-committor-service/tests/common.rs (2)
new(53-56)create_commit_task(175-191)magicblock-committor-service/src/tasks/buffer_task.rs (1)
new(40-48)magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Project
- GitHub Check: run_make_ci_lint
- GitHub Check: run_make_ci_test
🔇 Additional comments (12)
test-integration/programs/schedulecommit/src/order_book.rs (1)
1-231: LGTM! Previous critical issues have been successfully addressed.The implementation now includes proper safeguards:
- Alignment validation in
try_new(lines 109-120) prevents UB from unaligned typed references- Capacity bounds checking (lines 128-133) ensures header lengths never exceed backing storage
- Mutable aliasing issue resolved with
mut book_bytesbinding (line 64)The unsafe slice operations in
bids(),asks_reversed(), and the internal helpers are now safe because all invariants are established and validated at construction time intry_new.The remaining_capacity arithmetic is correct given Solana's 10MB account limit, as previously discussed.
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (2)
40-44: Trait method addition looks correct.The new
get_base_accountsmethod extends theTaskInfoFetchertrait to support batch fetching of base accounts for CommitDiff optimization. The signature is appropriate for the use case.
273-290: Implementation is correct and handles missing accounts gracefully.The implementation correctly:
- Fetches accounts in a single batched RPC call
- Filters out
Nonevalues for accounts that don't exist- Maps errors appropriately
One observation: unlike
fetch_metadata_with_retries, this method has no retry logic. Per previous review discussions, base account fetching is treated as best-effort (falling back to CommitState if unavailable), so this is acceptable behavior.test-integration/test-committor-service/tests/test_transaction_preparator.rs (2)
38-43: Test now uses TaskBuilderImpl for task construction.Using
TaskBuilderImpl::create_commit_taskensures the test exercises the actual task creation logic and respects theCOMMIT_STATE_SIZE_THRESHOLDinvariants. PassingNoneforbase_accountcorrectly produces aCommitTask(notCommitDiff) since this test uses small account data.
93-102: TheFrom<ArgsTaskType>implementation forBufferTaskTypeis correctly implemented.The
.task_type.into()pattern extractsArgsTaskTypefrom theArgsTaskand converts it toBufferTaskTypevia theFromimplementation defined inmagicblock-committor-service/src/tasks/buffer_task.rs:68. Since the test usescreate_commit_task()which produces aCommitvariant, the conversion succeeds and constructs valid buffer tasks.magicblock-committor-service/src/tasks/task_builder.rs (3)
45-51: Threshold constant is well-documented.The
COMMIT_STATE_SIZE_THRESHOLDof 256 bytes is a reasonable choice for distinguishing small accounts (that benefit from CommitState's simplicity) from larger accounts (that benefit from CommitDiff's reduced data transfer). The comment clearly explains the rationale.
54-82: Task creation logic correctly implements CommitDiff selection.The method properly:
- Checks if the account size exceeds
COMMIT_STATE_SIZE_THRESHOLDbefore usingbase_account- Creates
CommitDiffTaskonly when a validbase_accountis available for large accounts- Falls back to
CommitTaskfor small accounts or when no base account existsThe
.into()conversion at the end cleanly wraps theArgsTaskTypeinto anArgsTask.
152-158: Task creation loop is correct; TODO for future optimization is valid.The TODO notes that
remove()could be used instead ofget().cloned()if accounts are guaranteed unique, which would avoid cloning. This is a reasonable future optimization but the current implementation is correct and safe.magicblock-committor-service/src/tasks/task_strategist.rs (4)
419-425: MockInfoFetcher correctly returns empty map for base accounts.Returning
Ok(Default::default())simulates the scenario where no base accounts are found on-chain, which causes all commit tasks to use CommitState. This is appropriate for existing tests that don't specifically test CommitDiff behavior.
429-468: Test helper correctly scaffolds diff-based commit task creation.The
create_test_commit_taskhelper:
- Creates a
CommitTaskwhendiff_len == 0(no base account)- Creates a
CommitDiffTaskwhendiff_len > 0by generating a modifiedbase_account- Uses
wrapping_add(1)to create realistic byte differencesThe assertion at line 455 guards against test misconfiguration. This enables comprehensive testing of both commit paths.
561-620: New tests comprehensively cover threshold-based optimization decisions.These tests verify the key optimization scenarios:
- Large account, small diff (line 565): Uses Args strategy because CommitDiff instruction is small
- Large account, threshold+1 diff (line 585): Still uses Args - diff is small enough
- Large account, large diff (line 604): Falls back to Buffer strategy when diff exceeds capacity
The tests exercise the new CommitDiff path through
TaskBuilderImpl::create_commit_taskand verify that the strategy selection correctly considers the encoded instruction size, not just raw data size.
502-517: Existing tests correctly updated withdiff_len=0parameter.All existing tests that previously tested CommitState behavior now explicitly pass
diff_len=0, preserving their original semantics while adapting to the new helper signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
magicblock-committor-service/src/tasks/task_builder.rs (1)
119-125: Minor inconsistency:>=vs>threshold comparison.The
diffable_pubkeysfilter uses>=(line 122:account.account.data.len() >= COMMIT_STATE_SIZE_THRESHOLD), butcreate_commit_taskuses>(line 61:account.account.data.len() > COMMIT_STATE_SIZE_THRESHOLD).This means accounts with exactly 256 bytes will have their base account fetched but then ignored. Consider aligning both comparisons:
🔎 Proposed fix (use consistent `>` comparison)
let diffable_pubkeys = accounts .iter() .filter(|account| { - account.account.data.len() >= COMMIT_STATE_SIZE_THRESHOLD + account.account.data.len() > COMMIT_STATE_SIZE_THRESHOLD }) .map(|account| account.pubkey) .collect::<Vec<_>>();
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rsmagicblock-committor-service/src/tasks/task_builder.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/programs/schedulecommit/src/order_book.rstest-integration/test-committor-service/tests/common.rstest-integration/test-committor-service/tests/test_transaction_preparator.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
- test-integration/programs/schedulecommit/src/order_book.rs
🧰 Additional context used
🧠 Learnings (8)
📚 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-committor-service/src/tasks/task_builder.rstest-integration/test-committor-service/tests/test_transaction_preparator.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/test-committor-service/tests/common.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-committor-service/src/tasks/task_builder.rstest-integration/test-committor-service/tests/test_transaction_preparator.rsmagicblock-committor-service/src/tasks/task_strategist.rstest-integration/test-committor-service/tests/common.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:
test-integration/test-committor-service/tests/test_transaction_preparator.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.
Applied to files:
test-integration/test-committor-service/tests/test_transaction_preparator.rstest-integration/test-committor-service/tests/common.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-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.
Applied to files:
magicblock-committor-service/src/tasks/task_strategist.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.
Applied to files:
test-integration/test-committor-service/tests/common.rs
🧬 Code graph analysis (4)
magicblock-committor-service/src/tasks/task_builder.rs (3)
test-integration/test-committor-service/tests/common.rs (4)
create_commit_task(175-191)fetch_next_commit_ids(126-131)get_base_accounts(146-163)new(53-56)magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (5)
fetch_next_commit_ids(24-27)fetch_next_commit_ids(166-233)get_base_accounts(41-44)get_base_accounts(273-290)new(58-65)magicblock-committor-service/src/tasks/args_task.rs (1)
new(42-47)
test-integration/test-committor-service/tests/test_transaction_preparator.rs (2)
magicblock-committor-service/src/tasks/buffer_task.rs (1)
new(40-48)magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)
magicblock-committor-service/src/tasks/task_strategist.rs (3)
magicblock-committor-service/src/tasks/task_builder.rs (1)
create_commit_task(54-82)magicblock-committor-service/src/tasks/args_task.rs (1)
strategy(181-183)magicblock-committor-service/src/tasks/buffer_task.rs (1)
strategy(132-134)
test-integration/test-committor-service/tests/common.rs (1)
magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (4)
new(58-65)get_base_accounts(41-44)get_base_accounts(273-290)pubkeys(112-123)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: run_make_ci_test
- GitHub Check: Build Project
🔇 Additional comments (19)
test-integration/test-committor-service/tests/test_transaction_preparator.rs (4)
6-11: Import changes look correct.The imports now reflect the shift to using
TaskBuilderImplfor commit task creation. The removal of directCommitTaskimport and addition ofTaskBuilderImplaligns with the PR's goal of centralizing task creation logic.
37-47: Correct usage ofTaskBuilderImpl::create_commit_task.The test properly uses the new task creation API with
Noneforbase_account, which will produce aCommitTask(notCommitDiff) since the account data is small (5 bytes, well below the 256-byte threshold).
93-122: Buffer task construction pattern is correct.The
.task_type.into()pattern properly extractsArgsTaskTypefrom the createdArgsTaskand converts it toBufferTaskTypefor theBufferTask::new_preparation_requiredcall. This aligns with theBufferTask::newsignature shown in the relevant code snippets.
194-215: Consistent task creation pattern maintained.The
BufferTaskconstruction follows the same pattern established in the previous test, ensuring consistency across the test suite.test-integration/test-committor-service/tests/common.rs (4)
13-14: Import additions are correct.The new imports for
TaskInfoFetcherErrorandTaskInfoFetcherResultare required for implementing theget_base_accountstrait method.
115-119: Good helper extraction forMockTaskInfoFetchercreation.Centralizing
MockTaskInfoFetcherconstruction increate_task_info_fetcherreduces duplication and ensures the mock is consistently initialized with the RPC client across all tests.
122-122: Struct change to hold RPC client is appropriate.Converting
MockTaskInfoFetcherto a tuple struct withMagicblockRpcClientis necessary for theget_base_accountsimplementation to make actual RPC calls in integration tests.
146-163:get_base_accountsimplementation mirrors production code correctly.The implementation follows the same pattern as
CacheTaskInfoFetcher::get_base_accountsshown in the relevant code snippets: callingget_multiple_accounts, mapping errors toTaskInfoFetcherError::MagicBlockRpcClientError, and building aHashMapby filtering outNoneresults.magicblock-committor-service/src/tasks/task_strategist.rs (6)
292-292: Debug log removal is good.Past review comments flagged debug
println!statements; this removal addresses that feedback.
377-393: Import additions support new test functionality.The
system_programandCOMMIT_STATE_SIZE_THRESHOLDimports are required for the updated test helper and new threshold-based test scenarios.
419-425: Mock returns empty base accounts, but new tests cover diff path directly.The
MockInfoFetcher::get_base_accountsreturns an empty map, which means tests usingTaskBuilderImpl::commit_taskswon't createCommitDifftasks. However, the new tests (lines 561-620) correctly test the diff path by callingcreate_test_commit_taskdirectly with abase_account, bypassing the fetcher and validatingcreate_commit_tasklogic.
429-468: Test helper correctly supports both CommitState and CommitDiff paths.The
create_test_commit_taskhelper:
- Creates a
CommittedAccountwithdata_sizebytes- When
diff_len > 0, creates abase_accountwith the firstdiff_lenbytes mutated- Passes the appropriate
base_account(Some or None) toTaskBuilderImpl::create_commit_taskThis design allows testing the threshold-based task type selection in
create_commit_task.
561-620: New threshold-based tests validate diff optimization correctly.These tests verify the strategy selection based on diff size:
- Lines 561-578: Large account (66KB) with small diff (256 bytes) →
TaskStrategy::Args(fits in transaction)- Lines 580-598: Large account with diff just above threshold (257 bytes) →
TaskStrategy::Args(still fits)- Lines 600-620: Large account with large diff (1024 bytes) →
TaskStrategy::Buffer(too large, needs buffer)The tests correctly validate that
CommitDifftasks are optimized to buffers only when the encoded diff exceeds transaction size limits.
505-505: Existing tests correctly updated withdiff_len=0.All pre-existing tests now pass
diff_len=0tocreate_test_commit_task, preserving their original behavior of testing theCommitStatepath.magicblock-committor-service/src/tasks/task_builder.rs (5)
9-13: Import additions are appropriate.The new imports for
Account,CommitDiffTask, andCommitTaskare required for thecreate_commit_taskimplementation.
45-51: Threshold constant is well-documented.The
COMMIT_STATE_SIZE_THRESHOLDof 256 bytes is appropriately documented with rationale for the choice. Making itpubenables its use in tests for threshold-based validation.
53-83:create_commit_taskimplementation is correct and clean.The function properly:
- Only considers
base_accountfor accounts larger than the threshold (line 61:>)- Creates
CommitDiffTaskwhenbase_accountis available- Falls back to
CommitTaskotherwise- Converts to
ArgsTaskvia.into()This ensures small accounts always use the simpler
CommitStatepath regardless of whether base data is available.
137-143: Graceful fallback on base account fetch failure.When
get_base_accountsfails, the code logs a warning and falls back to an empty map, causing all tasks to useCommitStateinstead ofCommitDiff. This is appropriate degradation behavior that prioritizes commit success over optimization.
154-164: Task creation loop correctly uses the new API.The loop properly:
- Retrieves
commit_idfrom the fetched map (with expect for invariant violation)- Clones
base_accountfrom the map when available- Delegates to
create_commit_taskfor task type selectionThe TODO about using
remove()instead ofget().cloned()is a reasonable future optimization if account uniqueness can be guaranteed.
5050443 to
252862d
Compare
taco-paco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!

This PR does the following things:
CommitDiff. So now when a commit is scheduled, it triggers eitherCommitStateorCommitDiffin the delegation-program, depending on the account size and theCOMMIT_STATE_SIZE_THRESHOLD.CommitDiffis effectively an optimization that reduces the amount of data transferred when committing small changes in large accounts, which improves performance and reduces costs.args, notbufferaccount.OrderBookaccount (10 KB). I initially wanted to try a few MB, but realized currently that’s not possible yet.CommitDiffwas invoked (in the delegation-program) with onlydiff len = 286whereasdata len = 10240(see first screenshot).diff len = 8(encoding the size of account on ER and the number of offset-pairs), and logs a warning (see second screenshot).Update dlp.so
Updated
test-integration/schedulecommit/elfs/dlp.soto use latest version of DLP withCommitDiffix.Changes in the existing tests.
Two kinds of changes:
Since it is
CommitTaskwhich decides the exact DLP instructionCommitStateorCommitDiff, and many tests which earlier used to get executed asBufferTask, will now be executed asArgsTaskbecause large accounts with small changes can be executed asArgsTaskas long as the transaction size stays within limit. So made the related changes in the tests.For some tests, I made the following change:
It is because now
CommitTask::new()uses blockingRpcClientto fetch account from the base chain, so the tests fail because they run in a single-threaded environment, giving this error:Using
multi_threadwith 2 threads makes the tests work again.Screenshots
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.