-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Block and State deserialization (#40)
* Add BlockHeader deserialization * Add Block deserialization * Add TODO in main for visibility * Remove model.Address * Add Account deserialization * Add State deserialization * Undo remove tx from mock block
- Loading branch information
1 parent
21626dd
commit 1e11218
Showing
43 changed files
with
1,136 additions
and
1,359 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version: "0.2" | ||
# Suggestions can sometimes take longer on CI machines, | ||
# leading to inconsistent results. | ||
suggestionsTimeout: 5000 # ms |
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 |
---|---|---|
|
@@ -20,6 +20,8 @@ runtimes: | |
system_version: allowed | ||
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) | ||
lint: | ||
disabled: | ||
- codespell | ||
files: | ||
- name: cairo | ||
extensions: | ||
|
@@ -53,13 +55,13 @@ lint: | |
read_output_from: stdout | ||
run_linter_from: workspace | ||
enabled: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- cairo@SYSTEM | ||
- [email protected] | ||
- clippy@SYSTEM | ||
- [email protected] | ||
- git-diff-check | ||
- [email protected] | ||
- [email protected] | ||
|
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,23 +1,19 @@ | ||
%builtins output | ||
%builtins pedersen output | ||
|
||
from starkware.cairo.common.memcpy import memcpy | ||
from starkware.cairo.common.cairo_builtins import HashBuiltin | ||
|
||
from src.model import model | ||
|
||
func main{output_ptr: felt*}() { | ||
tempvar block_info: model.BlockInfo* = cast(nondet %{ segments.add() %}, model.BlockInfo*); | ||
%{ block_info %} | ||
|
||
assert [output_ptr] = block_info.coinbase; | ||
assert [output_ptr + 1] = block_info.timestamp; | ||
assert [output_ptr + 2] = block_info.number; | ||
assert [output_ptr + 3] = block_info.prev_randao.low; | ||
assert [output_ptr + 4] = block_info.prev_randao.high; | ||
assert [output_ptr + 5] = block_info.gas_limit; | ||
assert [output_ptr + 6] = block_info.chain_id; | ||
assert [output_ptr + 7] = block_info.base_fee; | ||
|
||
let output_ptr = output_ptr + 8; | ||
|
||
func main{pedersen_ptr: HashBuiltin*, output_ptr: felt*}() { | ||
%{ dict_manager %} | ||
tempvar block: model.Block*; | ||
tempvar state: model.State*; | ||
%{ block %} | ||
%{ state %} | ||
// TODO: Compute initial state root hash and compare with block.parent_hash | ||
// TODO: Loop through transactions and apply them to the initial state | ||
// TODO: Compute the state root hash after applying all transactions | ||
// TODO: Compare the final state root hash with block.state_root | ||
return (); | ||
} |
Oops, something went wrong.