-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wanderer
committed
Nov 22, 2016
1 parent
29b4a4a
commit 366cf82
Showing
1 changed file
with
21 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,25 @@ | ||
# Architecture | ||
|
||
This prototype attempts to model Ethereum as three seperate but interlocking | ||
layers. Environment, Kernel, and VM. | ||
``` | ||
+------------------+ | ||
| | | ||
| Environment | | ||
| | | ||
+------------------+ | ||
| | ||
+------------------+ | ||
| | | ||
| Kernal | | ||
| | | ||
+------------------+ | ||
| | ||
interfaces | ||
| | ||
+------------------+ | ||
| | | ||
| VM | | ||
| | | ||
+------------------+ | ||
``` | ||
## VM | ||
|
||
The VM implements [webassembly](https://github.com/WebAssembly/design). Two | ||
sets of intefaces are exposed to it by the kernal. The Kernal Interface and | ||
The Environment Interface. | ||
|
||
## Kernel Interface | ||
|
||
The kernel handles the following | ||
* Interprocess communication | ||
* Intializing the VM and exposes ROM containing code to the VM (codeHandler) | ||
* Exposing the namespace and Intializes the Environment which VM instance exists | ||
(callHandler) | ||
* Provides some built in contracts that facilitates different run levels | ||
(runTx, runBlock) | ||
* Provides resource sharing and limiting via gas | ||
+--------------+ | ||
| | | ||
| Environment | | ||
| | | ||
+--------------+ +--------------------+ | ||
| | +--+ | ||
| +----+ Imports | | | ||
| | +--------------------+ | | ||
+------------+ +------------+ | | +--------------------------+ | ||
| | | | | +--------------------+ | | | | ||
| Kernel +-------+VM Container+---------+ +------+ Sandboxed VM instance | | ||
| | | | | | Imports | | | | | ||
+------------+ +------------+ | +--------------------+ | +--------------------------+ | ||
| | | ||
| +--------------------+ | | ||
| | | | | ||
+----+ Imports +--+ | ||
+--------------------+ | ||
The kernel Interface expose kernal primitives to VM which contain | ||
* IPC (calls) | ||
* Namespace Interface | ||
* GET/PUT/DELETE/ROOT/NEXT - currently implemented as a `Map` | ||
|
||
## Environment Interface | ||
|
||
The Environment Interface expose the following | ||
* blockchain infromation | ||
* current block infromation | ||
* transaction infromation | ||
``` | ||
# Overview | ||
The `Kernel` is modeled to be somewhat like [actors](https://en.wikipedia.org/wiki/Actor_model). Each Kernel/Actor is bound to a segment of code and a state tree on startup. The Kernel provides the top level API. When the kernel recieves a message from another kernel or an external source (signal) it may run that code in a VM container. The container just provides a uniform way to interact with VMs. The container is given an instance of `Evironment`. The `Evironment` contains all the ephemeral state that need for the VM container and instance. Lastly the VM container start and manages the VM instance which is assumed to be sandboxed. The Sandbox communicates to VM container via `Imports` that are exposed to it on the time of creation. |