Skip to content

Commit

Permalink
Merge branch 'long_lived/datalayer_merkle_blob' into separate_key_and…
Browse files Browse the repository at this point in the history
…_value_id_types
  • Loading branch information
altendky committed Jan 24, 2025
2 parents ca8ce10 + b484368 commit cfd08e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions chia/_tests/core/data_layer/test_merkle_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ def generate_kvid(seed: int) -> tuple[KeyId, ValueId]:
return KeyId(kv_ids[0]), ValueId(kv_ids[1])


def generate_hash(seed: int) -> bytes:
def generate_hash(seed: int) -> bytes32:
seed_bytes = seed.to_bytes(8, byteorder="big", signed=True)
hash_obj = hashlib.sha256(seed_bytes)
return hash_obj.digest()
return bytes32(hash_obj.digest())


def test_insert_delete_loads_all_keys() -> None:
Expand Down Expand Up @@ -339,7 +339,7 @@ def test_proof_of_inclusion_merkle_blob() -> None:
num_deletes = 1 + repeats * 10

kv_ids: list[tuple[KeyId, ValueId]] = []
hashes: list[bytes] = []
hashes: list[bytes32] = []
for _ in range(num_inserts):
seed += 1
key, value = generate_kvid(seed)
Expand Down
2 changes: 1 addition & 1 deletion chia/data_layer/data_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ async def insert_batch(
last_action[hash] = change["action"]

batch_keys_values: list[tuple[KeyId, ValueId]] = []
batch_hashes: list[bytes] = []
batch_hashes: list[bytes32] = []

for change in changelist:
if change["action"] == "insert":
Expand Down
2 changes: 1 addition & 1 deletion chia/data_layer/util/merkle_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ def get_nodes_with_indexes(self, index: TreeIndex = TreeIndex(0)) -> list[tuple[

return this + left_nodes + right_nodes

def batch_insert(self, keys_values: list[tuple[KeyId, ValueId]], hashes: list[bytes]) -> None:
def batch_insert(self, keys_values: list[tuple[KeyId, ValueId]], hashes: list[bytes32]) -> None:
indexes: list[TreeIndex] = []

if len(self.key_to_index) <= 1:
Expand Down

0 comments on commit cfd08e2

Please sign in to comment.