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
Proposal: Revisiting Account Data Modification Persistence in MagicBlock Validator
Background
The MagicBlock validator introduces a unique mechanism for account management: selective, on-demand cloning of accounts from the base Solana chain. This ensures that all accounts required by any transaction executed on the MagicBlock validator are present and up-to-date before execution.
Currently, the Solana Virtual Machine (SVM) facilitates this cloning process. Account insertions and updates to AccountsDB are performed via standard Solana transactions. This approach serves two primary purposes:
Auditability: Enables comprehensive tracing of account modification history, including changes that originated on-chain and were never directly modified by the MagicBlock validator.
Verifiability and Replayability: By recording all account states as they existed during transaction execution, the system supports reliable ledger replay and verification.
Current Challenges
Despite its benefits, the current implementation faces several limitations:
Transaction Encoding Limitations: Not all account states can be encoded within a single transaction, necessitating an additional layer of indirection.
Stashing Mechanism: To address this, account states to be written to AccountsDB are temporarily "stashed" in memory (and in the RocksDB ledger). These states are later extracted and applied during transaction execution via a built-in program capable of bypassing the SVM's sandboxing restrictions.
Complexity and Overhead: This design introduces several issues:
Custom Sandbox Escape Logic: Special logic is required to circumvent SVM sandboxing, increasing code complexity and maintenance burden.
Convoluted Data Flow: The stashing mechanism complicates the control and data flow, making the system harder to reason about and debug.
Resource Inefficiency: Writing to the ledger incurs non-trivial CPU and disk usage costs, impacting overall system performance.
Motivation for Change
As part of the ongoing ledger rewrite initiative (MIMD-0007), it is timely to reevaluate the current approach to handling account data modifications. The goals are to:
Simplify Control and Data Flows: Reduce system complexity by eliminating unnecessary indirection and custom logic.
Improve Performance: Minimize CPU and disk overhead associated with account state persistence.
Enhance Transaction Throughput: Streamline account data handling to support higher transaction volumes and lower latency.
Proposed Direction
We propose a comprehensive review and redesign of the account data modification persistence mechanism within the MagicBlock validator. Key considerations include:
Direct Account State Management: Explore alternatives to the current stashing and extraction process, potentially enabling more direct and efficient updates to AccountsDB.
Sandboxing Model Reassessment: Investigate whether the need for custom sandbox escape logic can be eliminated
Maintain Auditability and Replayability: Ensure that any new approach continues to support full traceability and reliable ledger replay.
Potential solution
One possible solution might be to use account state diff, which is encoded in transaction itself. Considering that accounts in solana are small on average, and state diffs are even smaller, then it's safe to assume that in most cases that diff can be encoded into a single transaction. This has several advantages:
No need to stash anything, the entire state necessary for transaction execution is already included in transaction itself
Smaller size of data written to the ledger, as most of the diffs can be encoded in less than 100 bytes.
Faster transaction execution due to absence of extra stashing/extraction steps
In rare cases when state diff exceeds the transaction size limit, it can be split between multiple transactions, which will run in sequence before any other transaction that refers to the account in question.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal: Revisiting Account Data Modification Persistence in MagicBlock Validator
Background
The MagicBlock validator introduces a unique mechanism for account management: selective, on-demand cloning of accounts from the base Solana chain. This ensures that all accounts required by any transaction executed on the MagicBlock validator are present and up-to-date before execution.
Currently, the Solana Virtual Machine (SVM) facilitates this cloning process. Account insertions and updates to
AccountsDB
are performed via standard Solana transactions. This approach serves two primary purposes:Current Challenges
Despite its benefits, the current implementation faces several limitations:
AccountsDB
are temporarily "stashed" in memory (and in the RocksDB ledger). These states are later extracted and applied during transaction execution via a built-in program capable of bypassing the SVM's sandboxing restrictions.Motivation for Change
As part of the ongoing ledger rewrite initiative (MIMD-0007), it is timely to reevaluate the current approach to handling account data modifications. The goals are to:
Proposed Direction
We propose a comprehensive review and redesign of the account data modification persistence mechanism within the MagicBlock validator. Key considerations include:
AccountsDB
.Potential solution
One possible solution might be to use account state diff, which is encoded in transaction itself. Considering that accounts in solana are small on average, and state diffs are even smaller, then it's safe to assume that in most cases that diff can be encoded into a single transaction. This has several advantages:
In rare cases when state diff exceeds the transaction size limit, it can be split between multiple transactions, which will run in sequence before any other transaction that refers to the account in question.
Beta Was this translation helpful? Give feedback.
All reactions