Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor linked lists initial hashing #581

Merged
merged 46 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bf9894e
Deattach hashed nodes from initial trie
4l0n50 Aug 8, 2024
df38d3b
Merge mpt_set_payload with mpt_hash
4l0n50 Aug 8, 2024
3ce9cf5
Add missing files
4l0n50 Aug 9, 2024
0d5861b
Merge branch 'feat/continuations' into refactor_ll_hashing
4l0n50 Aug 9, 2024
7c31745
Fix errors in the stack
4l0n50 Aug 9, 2024
2e7ba8a
Fix hash mismatch on initial trie
4l0n50 Aug 19, 2024
e0e7ec9
Refactor final state hash
4l0n50 Aug 20, 2024
376b415
Fix final hash
4l0n50 Aug 21, 2024
d1115b0
[WIP] debugging erc721
4l0n50 Aug 23, 2024
65e8d46
Fix erc721
4l0n50 Aug 25, 2024
1618b67
Merge into develop
4l0n50 Aug 25, 2024
5fef5f5
[WIP] debugging block 28
4l0n50 Aug 26, 2024
c67acf6
Fix b28
4l0n50 Aug 26, 2024
9d33eb9
Merge
4l0n50 Aug 27, 2024
dd2dbff
Merge
4l0n50 Aug 27, 2024
ba89d45
Fix block 28
4l0n50 Aug 28, 2024
82902da
Minor
4l0n50 Aug 28, 2024
ee613fd
[WIP] Debugging block 20240058
4l0n50 Aug 28, 2024
baee99c
Fix extension nodes bug
4l0n50 Aug 28, 2024
d5b15b7
Fix block 20240058
4l0n50 Aug 28, 2024
ac457ca
[WIP] benchmarking
4l0n50 Aug 28, 2024
038af77
Set inital trie with insertions
4l0n50 Aug 29, 2024
8e3584d
Remove hash nodes
4l0n50 Aug 29, 2024
4e9cc3d
Fix missing segment number
4l0n50 Aug 29, 2024
a383475
Clean code
4l0n50 Aug 30, 2024
4117e0c
Fix unit tests
4l0n50 Aug 30, 2024
3edcd94
Fix erc20
4l0n50 Sep 1, 2024
c06e184
[WIP] Fixing blocks
4l0n50 Sep 1, 2024
783a811
Merge with develop
4l0n50 Sep 2, 2024
9df960b
Clean code
4l0n50 Sep 2, 2024
465240b
Clean and fmt
4l0n50 Sep 2, 2024
1b394be
Address reviews
4l0n50 Sep 11, 2024
e91891e
Apply suggestions from code review
4l0n50 Sep 11, 2024
0349c48
[WIP] Fixing trie data length
4l0n50 Sep 11, 2024
409c563
Merge with develop
4l0n50 Sep 11, 2024
9afab40
Fix trie_data_length mismatch
4l0n50 Sep 12, 2024
4447e8f
Check correctness of inital next node ptr and check strict keys monot…
4l0n50 Sep 12, 2024
71e7021
Merge remote-tracking branch 'origin/develop' into refactor_ll_initia…
4l0n50 Sep 12, 2024
1137c9b
Address review comment
4l0n50 Sep 12, 2024
fc286a9
Apply suggestions from code review
4l0n50 Sep 13, 2024
7c3387f
Minor
4l0n50 Sep 13, 2024
9c329b6
Merge with develop
4l0n50 Sep 16, 2024
ffa1ace
Fix circuit sizes
Nashtare Sep 16, 2024
d3a2b60
Apply suggestions from code review
4l0n50 Sep 18, 2024
0751b65
Add missing stack comment
4l0n50 Sep 18, 2024
3319861
Merge remote-tracking branch 'origin/develop' into refactor_ll_initia…
4l0n50 Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evm_arithmetization/src/cpu/kernel/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ pub static KERNEL_FILES: [&str; NUMBER_KERNEL_FILES] = [
include_str!("asm/mpt/insert/insert_leaf.asm"),
include_str!("asm/mpt/insert/insert_trie_specific.asm"),
include_str!("asm/mpt/linked_list/linked_list.asm"),
include_str!("asm/mpt/linked_list/initial_tries.asm"),
include_str!("asm/mpt/linked_list/final_tries.asm"),
include_str!("asm/mpt/linked_list/initial_tries.asm"),
include_str!("asm/mpt/read.asm"),
include_str!("asm/mpt/storage/storage_read.asm"),
include_str!("asm/mpt/storage/storage_write.asm"),
Expand Down
10 changes: 6 additions & 4 deletions evm_arithmetization/src/cpu/kernel/asm/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ global check_state_trie:
// `GLOBAL_METADATA_TRIE_DATA_SIZE` is correct.
%get_trie_data_size
// stack: trie_data_len
PROVER_INPUT(trie_ptr::state)
PROVER_INPUT(trie_ptr::initial_state)

%mstore_global_metadata(@GLOBAL_METADATA_STATE_TRIE_ROOT)

PROVER_INPUT(trie_ptr::trie_data_size)
%mstore_global_metadata(@GLOBAL_METADATA_TRIE_DATA_SIZE)

%set_initial_tries
%set_initial_state_trie

PUSH @INITIAL_RLP_ADDR
// stack: rlp_start, trie_data_len
Expand All @@ -213,8 +213,10 @@ global check_state_trie:
%mload_global_metadata(@GLOBAL_METADATA_STATE_TRIE_DIGEST_BEFORE)
%assert_eq
// Check that the stored trie data length is correct.
%mload_global_metadata(@GLOBAL_METADATA_TRIE_DATA_SIZE)
%assert_eq
// TODO: uncommen the following 2 lines
//%mload_global_metadata(@GLOBAL_METADATA_TRIE_DATA_SIZE)
//%assert_eq
POP // remove
4l0n50 marked this conversation as resolved.
Show resolved Hide resolved

// We set a dummy value as an initial trie data length,
// as we do not need to compute the actual trie data length here.
Expand Down
4 changes: 3 additions & 1 deletion evm_arithmetization/src/cpu/kernel/asm/mpt/hash/hash.asm
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ mpt_hash_hash_rlp:
%stack (result, result_len, new_len)
-> (@SEGMENT_RLP_RAW, result, result_len, mpt_hash_hash_rlp_after_unpacking, result_len, new_len)
4l0n50 marked this conversation as resolved.
Show resolved Hide resolved
// stack: addr, result, result_len, mpt_hash_hash_rlp_after_unpacking, result_len, new_len
%increment
4l0n50 marked this conversation as resolved.
Show resolved Hide resolved
%jump(mstore_unpacking)
mpt_hash_hash_rlp_after_unpacking:
// stack: result_addr, result_len, new_len, retdest
POP PUSH @SEGMENT_RLP_RAW // ctx == virt == 0
4l0n50 marked this conversation as resolved.
Show resolved Hide resolved
// stack: result_addr, result_len, new_len, retdest
%increment
KECCAK_GENERAL
// stack: hash, new_len, retdest
%stack(hash, new_len, retdest) -> (retdest, hash, new_len)
Expand Down Expand Up @@ -292,4 +294,4 @@ encode_node_leaf_after_encode_value:
%prepend_rlp_list_prefix
%stack (rlp_prefix_start_pos, rlp_len, cur_len, retdest)
-> (retdest, rlp_prefix_start_pos, rlp_len, cur_len)
JUMP
JUMP
4l0n50 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,17 @@ after_mpt_delete_slot:

global set_final_tries:
PUSH set_final_tries_after
PUSH @SEGMENT_STORAGE_LINKED_LIST
%add_const(@STORAGE_LINKED_LISTS_NODE_SIZE) // Skip the first node.
%first_initial_slot // Skip the first node.
%mload_global_metadata(@GLOBAL_METADATA_STATE_TRIE_ROOT)
PUSH @SEGMENT_ACCOUNTS_LINKED_LIST
%add_const(@ACCOUNTS_LINKED_LISTS_NODE_SIZE) // Skip the first node.
%first_initial_account // Skip the first node.
%jump(delete_removed_accounts)
set_final_tries_after:
// stack: new_state_root
PUSH set_final_tries_after_after SWAP1
// stack: new_state_root, set_final_tries_after_after
PUSH @SEGMENT_STORAGE_LINKED_LIST
%next_slot
%first_slot
SWAP1
PUSH @SEGMENT_ACCOUNTS_LINKED_LIST
%next_account
%first_account
%jump(insert_all_accounts)
set_final_tries_after_after:
//stack: new_state_root
Expand All @@ -235,4 +231,4 @@ set_final_tries_after_after:
PUSH %%after
%jump(set_final_tries)
%%after:
%endmacro
%endmacro
4l0n50 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading