diff --git a/geth-utils/gethutil/mpt/witness/leaf.go b/geth-utils/gethutil/mpt/witness/leaf.go index b34b6565231..308490d6c69 100644 --- a/geth-utils/gethutil/mpt/witness/leaf.go +++ b/geth-utils/gethutil/mpt/witness/leaf.go @@ -493,16 +493,7 @@ func prepareStorageLeafInfo(row []byte, valueIsZero, isPlaceholder bool) ([]byte } else { // [226,160,59,138,106,70,105,186,37,13,38[227,32,161,160,187,239,170,18,88,1,56,188,38,60,149,117,120,38,223,78,36,235,129,201,170,170,170,170,170,170,170,170,170,170,170,170] keyLen = row[1] - 128 - if keyLen+2 > valueLen { - // This happens for StorageDoesNotExist when the trie is empty. In this case, the key - // occupies 33 (33 = 161 - 128) bytes, as in the example below: - // [227 161 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - // Currently, the length for the RLP items is set valueLen = 34, changing this to 35 would - // require significant changes in the circuit. - copy(key, row[keyRlpLen:valueLen]) - } else { - copy(key, row[keyRlpLen:keyLen+2]) - } + copy(key, row[keyRlpLen:keyLen+2]) offset = byte(2) } } diff --git a/geth-utils/src/mpt.rs b/geth-utils/src/mpt.rs index 014d76d4d17..bca30af0e73 100644 --- a/geth-utils/src/mpt.rs +++ b/geth-utils/src/mpt.rs @@ -95,28 +95,12 @@ pub fn get_witness(block_no: u64, mods: &[TrieModification], node_url: &str) -> unsafe { go::FreeString(c_str.as_ptr()) }; + // Note: previously this function returned a Vec of Nodes, but now returning a JSON string + // to avoid imporing zkEVM circuit here (that will create a circular dependency). + // TODO: consider defining Node types in another crate. + json - // let mut nodes: Vec = serde_json::from_str(json).unwrap(); - // - // Add the address and the key to the list of values in the Account and Storage nodes - // for node in nodes.iter_mut() { - // if node.account.is_some() { - // let account = node.account.clone().unwrap(); - // node.values - // .push([vec![148], account.address.to_vec()].concat().into()); - // node.values - // .push([vec![160], account.key.to_vec()].concat().into()); - // } - // if node.storage.is_some() { - // let storage = node.storage.clone().unwrap(); - // node.values - // .push([vec![160], storage.address.to_vec()].concat().into()); - // node.values - // .push([vec![160], storage.key.to_vec()].concat().into()); - // } - // } - // nodes } #[cfg(test)]