diff options
| author | Antonio Navarro Perez <antnavper@gmail.com> | 2024-01-18 12:10:53 +0100 |
|---|---|---|
| committer | Antonio Navarro Perez <antnavper@gmail.com> | 2024-01-18 12:10:53 +0100 |
| commit | 46fcbbb4392e2fdd3d92a95cea7efea6d2335fad (patch) | |
| tree | 7d3837438d8bd82ac9441562e83d16bdef141803 | |
| parent | f4a895a7de195b2077544d0deaa7ca98a18c55c2 (diff) | |
Remove vm state management
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
| -rw-r--r-- | docs/proposals/PIP-000.md | 4 | ||||
| -rw-r--r-- | docs/proposals/PIP-001.md | 94 | ||||
| -rw-r--r-- | docs/proposals/README.md | 3 |
3 files changed, 3 insertions, 98 deletions
diff --git a/docs/proposals/PIP-000.md b/docs/proposals/PIP-000.md index 35dea1d..67b0c3d 100644 --- a/docs/proposals/PIP-000.md +++ b/docs/proposals/PIP-000.md @@ -5,9 +5,9 @@ | ENIP | 0 | | Title | PIP Template | | Author | Antonio Navarro | -| Status | Draft | +| Status | Accepted | | Created | 2024-01-15 | -| Updated | 2024-01-15 | +| Updated | 2024-01-18 | | Target version | optional | ## Abstract diff --git a/docs/proposals/PIP-001.md b/docs/proposals/PIP-001.md deleted file mode 100644 index c916a07..0000000 --- a/docs/proposals/PIP-001.md +++ /dev/null @@ -1,94 +0,0 @@ -# Fetch and Restore VM State Interfaces - -| Field | Value | -| --- | --- | -| ENIP | 1 | -| Title | Fetch and Restore VM State Interfaces | -| Author | Antonio Navarro | -| Status | Draft | -| Created | 2024-01-15 | -| Updated | 2024-01-15 | - -## Abstract - -This proposal introduces interfaces for saving and restoring the state of a parscan VM, a crucial feature for a variety of use cases. -We aim to provide a detailed description of these interfaces, focusing on their integration into the VM. -This will enable functionalities like snapshotting the VM state and tracking new and removed operations from the stack, offering greater control and flexibility in VM management. - -## Rationale - -There is an essential need to efficiently store and manage the state of VMs. -Different scenarios might require either a complete copy of the current state or an understanding of the changes made, facilitating storage in various formats like Merkle Trees, CRDTs, or others. -This functionality is critical for ensuring data consistency, enabling state recovery, and supporting complex computing tasks that require VM state manipulation. - -## Specification - -### Snapshotting - -The snapshot interface aims to simplify the process of serializing and deserializing VM states. -It includes: - -```go - -// SnapshotValue is a serializable, simpler representation of *reflect.Value -type SnapshotValue struct { - Kind Kind - Value *any -} - -// Snapshot contains all needed data to continue previously halted VM execution. -type Snapshot struct { - FramePointer, InstructionPointer int64 - InstructionCounter int64 - Values []*SnapshotValue -} - -// Snapshotter will be implemented by the VM to make it possible to get and load Snapshots into it. This interface might not really be needed, only the methods on the VM. -type Snapshotter interface { - // Take halts VM execution and generates a *Snapshot from it. - Take(context.Context) (*Snapshot, error) - - // Load halts VM execution and load the provided *Snapshot to it. - Load(context.Context, *Snapshot) error -} - -``` - -This interface halts execution to ensure consistency during state capture and restoration. -Note: VM version compatibility is critical as any changes to generated OP codes might impact state execution. - -### Possible solution: OP Step Parser - -The OP Step Parser will allow tracking changes on the VM stack, communicating these changes to an external entity. -This entity, in conjunction with the Snapshotter, will determine the data segments that require updating. - -```go - -// Implementation details to be added. - -``` - -### Possible solution: track changes made on memory internally on the VM - -To maintain optimum VM performance, an alternative is to track memory changes internally within the VM, incorporating these into the Snapshot output. - -```go - -// Implementation details to be added. - -``` - - -## Alternatives - -While no other alternatives were identified, a thorough review was conducted to ensure the proposed solutions are the most effective and efficient for the intended purpose. - -## Impact - -The implementation of these interfaces is expected to marginally affect VM performance. -However, precise benchmarking is needed to quantify the impact. -The anticipated benefits in terms of improved state management and recovery capabilities are significant and are expected to outweigh the performance costs. - -## References - -[Actual GnoVM implementation](https://github.com/gnolang/gno). diff --git a/docs/proposals/README.md b/docs/proposals/README.md index a4f3517..2addbeb 100644 --- a/docs/proposals/README.md +++ b/docs/proposals/README.md @@ -8,5 +8,4 @@ This is the index of Parscan Improvement Proposals, known as PIPs. | Number | Status | Title | | ------ | -------- |----------------------------------------------------------------------| -| 0 | Draft | [PIP Template](PIP-000.md) | -| 1 | Draft | [Fetch and Restore VM State Interfaces](PIP-001.md) | +| 0 | Accepted | [PIP Template](PIP-000.md) | |
