You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In `ExternalAccountsManager` ignore nondelegated accounts during
periodic commits
Additionally fixes sqlite INTEGER overflow
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
Updated On: 2025-09-25 12:32:37 UTC
<h3>Summary</h3>
This PR fixes a critical issue in the periodic commit process by
preventing attempts to commit undelegated accounts, which was causing
failures in the `ExternalAccountsManager`.
**Key Changes:**
- **Fixed MESSAGE_ID overflow**: Changed initialization from `u64::MAX -
1` to `(i64::MAX - 1) as u64` to prevent potential overflow issues
- **Added delegation filter**: Introduced `.filter(|(_, _, _, acc)|
acc.is_delegated())` in the periodic commit pipeline to only process
accounts that are actually delegated to the validator
- **Enhanced error logging**: Added intent ID to error messages in the
intent execution engine for better debugging of failed executions
- **Dependency updates**: Updated Cargo.lock with delegation program and
async dependencies
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with careful attention to the delegation
filter logic
- Score reflects a well-targeted fix for a specific delegation issue
with good intent ID logging improvement. The MESSAGE_ID fix addresses a
potential overflow, and the delegation filter prevents inappropriate
commit attempts. Only minor risk is ensuring the is_delegated() method
correctly identifies delegation status
- Pay attention to magicblock-accounts/src/external_accounts_manager.rs
to ensure the delegation filter works correctly in all scenarios
<h3>Important Files Changed</h3>
File Analysis
| Filename | Score
| Overview |
|----------|-------|----------|
| magicblock-accounts/src/external_accounts_manager.rs | 4/5 | Fixed
MESSAGE_ID overflow issue and added delegation filter to prevent
committing undelegated accounts during periodic commits |
|
magicblock-committor-service/src/intent_execution_manager/intent_execution_engine.rs
| 5/5 | Enhanced error logging by adding intent ID to error messages for
better debugging of failed BaseIntent executions |
</details>
<h3>Sequence Diagram</h3>
```mermaid
sequenceDiagram
participant EAM as ExternalAccountsManager
participant IAP as InternalAccountProvider
participant Filter as DelegationFilter
participant Committer as CommitService
Note over EAM: Periodic commit cycle begins
EAM->>EAM: create_scheduled_base_intents()
EAM->>EAM: Initialize MESSAGE_ID with (i64::MAX - 1) as u64
loop For each account to be committed
EAM->>IAP: get_account(pubkey)
IAP-->>EAM: AccountSharedData
Note over EAM,Filter: NEW: Check delegation status
EAM->>Filter: acc.is_delegated()
Filter-->>EAM: true/false
alt Account is delegated
EAM->>EAM: Check if account hash changed
alt Hash changed
EAM->>EAM: Create AccountCommittee
EAM->>Committer: Schedule for commit
end
else Account not delegated
Note over EAM: Skip account (prevents undelegated commit attempts)
end
end
EAM-->>Committer: List of delegated accounts to commit
```
<!-- /greptile_comment -->
0 commit comments