Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
23852196
Commit
23852196
authored
Sep 03, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation on the statehash VM status code
parent
b3ab3ce9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
cannon-fault-proof-vm.md
specs/cannon-fault-proof-vm.md
+29
-0
No files found.
specs/cannon-fault-proof-vm.md
View file @
23852196
...
...
@@ -6,6 +6,7 @@
-
[
Overview
](
#overview
)
-
[
State
](
#state
)
-
[
State Hash
](
#state-hash
)
-
[
Memory
](
#memory
)
-
[
Heap
](
#heap
)
-
[
Delay Slots
](
#delay-slots
)
...
...
@@ -53,6 +54,34 @@ It consists of the following fields:
The state is represented by packing the above fields, in order, into a 226-byte buffer.
### State Hash
The state hash is computed by hashing the 226-byte state buffer with the Keccak256 hash function
and then setting the high-order byte to the respective VM status.
The VM status can be derived from the state's
`exited`
and
`exitCode`
fields.
```
rs
enum
VmStatus
{
Valid
=
0
,
Invalid
=
1
,
Panic
=
2
,
Unfinished
=
3
,
}
fn
vm_status
(
exit_code
:
u8
,
exited
:
bool
)
->
u8
{
if
exited
{
match
exit_code
{
0
=>
VmStatus
::
Valid
,
1
=>
VmStatus
::
Invalid
,
_
=>
VmStatus
::
Panic
,
}
}
else
{
VmStatus
::
Unfinished
}
}
```
## Memory
Memory is represented as a binary merkle tree.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment