File tree Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ beacon_state :
2+ execution_scripts :
3+ - scripts/keccak-lys/build/main.wasm
4+ shard_pre_state :
5+ exec_env_states :
6+ - " 0000000000000000000000000000000000000000000000000000000000000000"
7+ shard_blocks :
8+ - env : 0
9+ data : " "
10+ - env : 0
11+ data : " "
12+ shard_post_state :
13+ exec_env_states :
14+ - " c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
15+ deposit_receipts : []
Original file line number Diff line number Diff line change 1+ build
Original file line number Diff line number Diff line change 1+ all :
2+ lys main.lys
Original file line number Diff line number Diff line change 1+ # keccak-lys
2+
3+ Sample EE script written in [ Lys] .
4+
5+ ## Build
6+
7+ Install Node.js and npm first. Then install the lys compiler:
8+ ``` shell
9+ npm i -g lys
10+ ```
11+
12+ Finally build the EE via:
13+ ``` shell
14+ lys main.lys
15+ ```
16+
17+ Or simply run ` make ` .
18+
19+ [ Lys ] : https://github.com/lys-lang/lys
Original file line number Diff line number Diff line change 1+ #[extern "env" "loadPreStateRoot"]
2+ fun loadPreStateRoot(ptr: u32): void = panic()
3+
4+ #[extern "env" "eth2_blockDataSize"]
5+ fun blockDataSize(): u32 = panic()
6+
7+ #[extern "env" "eth2_blockDataCopy"]
8+ fun blockDataCopy(ptr: u32, offset: u32, len: u32): void = panic()
9+
10+ #[extern "env" "eth2_savePostStateRoot"]
11+ fun savePostStateRoot(ptr: u32): void = panic()
Original file line number Diff line number Diff line change 1+ import system::hash::keccak
2+
3+ import eth2
4+
5+ #[export]
6+ fun main(): void = {
7+ var len = blockDataSize()
8+ var input = bytes(len)
9+ blockDataCopy(input.ptr, 0 as u32, len)
10+
11+ var k = Keccak()
12+ Keccak.update(k, input)
13+ var ret = Keccak.digest(k)
14+
15+ savePostStateRoot(ret.ptr)
16+ }
You can’t perform that action at this time.
0 commit comments