This commit is contained in:
4l0n50 2024-01-08 14:36:12 +01:00
commit 7fc6b86d8a
6 changed files with 5 additions and 13 deletions

View File

@ -15,9 +15,6 @@ global main:
%shift_table_init
// Encode constant nodes
%initialize_rlp_segment
// Encode constant nodes
%initialize_rlp_segment
// Initialize the state, transaction and receipt trie root pointers.
PROVER_INPUT(trie_ptr::state)

View File

@ -105,7 +105,7 @@ after_packed_small_rlp:
// indicating where the data lives within @SEGMENT_RLP_RAW.
//
// Pre stack: node_type, node_ptr, encode_value, cur_len, retdest
// Post stack: result_ptr, result_len
// Post stack: result_ptr, result_len, cur_len
encode_node:
// stack: node_type, node_ptr, encode_value, cur_len, retdest
// Increment node_ptr, so it points to the node payload instead of its type.
@ -197,7 +197,7 @@ encode_node_branch_prepend_prefix:
// If result_len != 32, result is raw RLP, with an appropriate RLP prefix already.
SWAP1 DUP1 %sub_const(32) %jumpi(%%unpack)
// Otherwise, result is a hash, and we need to add the prefix 0x80 + 32 = 160.
// stack: result_len, result, cur_len, rlp_pos, rlp_start, node_payload_ptr, encode_value, cur_len, retdest
// stack: result_len, result, cur_len, rlp_pos, rlp_start, node_payload_ptr, encode_value, retdest
PUSH 160
DUP5 // rlp_pos
%mstore_rlp

View File

@ -3,9 +3,6 @@
global mpt_hash_state_trie:
// stack: cur_len, retdest
PUSH encode_account
PUSH debug_before_encoding_child
PUSH mpt_delete
%pop2
%mload_global_metadata(@GLOBAL_METADATA_STATE_TRIE_ROOT)
// stack: node_ptr, encode_account, cur_len, retdest
%jump(mpt_hash)

View File

@ -1174,7 +1174,7 @@ impl<'a> Interpreter<'a> {
self.generation_state.registers.context = context;
}
/// Writes the encoding of 0 to position @
/// Writes the encoding of 0 to position @ENCODED_EMPTY_NODE_POS
pub(crate) fn initialize_rlp_segment(&mut self) {
self.generation_state.memory.set(
MemoryAddress {

View File

@ -12,12 +12,11 @@ use crate::cpu::kernel::tests::mpt::{
};
use crate::generation::mpt::AccountRlp;
use crate::generation::TrieInputs;
use crate::util::u256_to_usize;
use crate::Node;
#[test]
fn mpt_insert_empty() -> Result<()> {
test_state_trie(Default::default(), nibbles_64(0xDEF), test_account_2())
test_state_trie(Default::default(), nibbles_64(0xABC), test_account_2())
}
#[test]
@ -234,7 +233,6 @@ fn test_state_trie(
let hash = H256::from_uint(&interpreter.stack()[1]);
state_trie.insert(k, rlp::encode(&account).to_vec());
let expected_state_trie_hash = state_trie.hash();
assert_eq!(hash, expected_state_trie_hash);

View File

@ -35,7 +35,7 @@ pub mod mpt;
pub(crate) mod prover_input;
pub(crate) mod rlp;
pub(crate) mod state;
pub(crate) mod trie_extractor;
mod trie_extractor;
use self::mpt::{load_all_mpts, TrieRootPtrs};
use crate::witness::util::mem_write_log;