Skip to content

Commit

Permalink
remove ProofOfInclusion.as_program() (#19305)
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky authored Feb 22, 2025
1 parent a8724f0 commit 849eef1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
40 changes: 0 additions & 40 deletions chia/_tests/core/data_layer/test_data_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,25 +783,6 @@ async def test_proof_of_inclusion_by_hash_no_ancestors(data_store: DataStore, st
assert proof == ProofOfInclusion(node_hash=node.hash, layers=[])


@pytest.mark.anyio
async def test_proof_of_inclusion_by_hash_program(data_store: DataStore, store_id: bytes32) -> None:
"""The proof of inclusion program has the expected Python equivalence."""

await add_01234567_example(data_store=data_store, store_id=store_id)
node = await data_store.get_node_by_key(key=b"\x04", store_id=store_id)

proof = await data_store.get_proof_of_inclusion_by_hash(node_hash=node.hash, store_id=store_id)

assert proof.as_program() == [
b"\x04",
[
bytes32.fromhex("fb66fe539b3eb2020dfbfadfd601fa318521292b41f04c2057c16fca6b947ca1"),
bytes32.fromhex("6d3af8d93db948e8b6aa4386958e137c6be8bab726db86789594b3588b35adcd"),
bytes32.fromhex("c852ecd8fb61549a0a42f9eb9dde65e6c94a01934dbd9c1d35ab94e2a0ae58e2"),
],
]


@pytest.mark.anyio
async def test_proof_of_inclusion_by_hash_equals_by_key(data_store: DataStore, store_id: bytes32) -> None:
"""The proof of inclusion is equal between hash and key requests."""
Expand All @@ -815,27 +796,6 @@ async def test_proof_of_inclusion_by_hash_equals_by_key(data_store: DataStore, s
assert proof_by_hash == proof_by_key


@pytest.mark.anyio
async def test_proof_of_inclusion_by_hash_bytes(data_store: DataStore, store_id: bytes32) -> None:
"""The proof of inclusion provided by the data store is able to be converted to a
program and subsequently to bytes.
"""
await add_01234567_example(data_store=data_store, store_id=store_id)
node = await data_store.get_node_by_key(key=b"\x04", store_id=store_id)

proof = await data_store.get_proof_of_inclusion_by_hash(node_hash=node.hash, store_id=store_id)

expected = (
b"\xff\x04\xff\xff\xa0\xfbf\xfeS\x9b>\xb2\x02\r\xfb\xfa\xdf\xd6\x01\xfa1\x85!)"
b"+A\xf0L W\xc1o\xcak\x94|\xa1\xff\xa0m:\xf8\xd9=\xb9H\xe8\xb6\xaaC\x86\x95"
b"\x8e\x13|k\xe8\xba\xb7&\xdb\x86x\x95\x94\xb3X\x8b5\xad\xcd\xff\xa0\xc8R\xec"
b"\xd8\xfbaT\x9a\nB\xf9\xeb\x9d\xdee\xe6\xc9J\x01\x93M\xbd\x9c\x1d5\xab\x94"
b"\xe2\xa0\xaeX\xe2\x80\x80"
)

assert bytes(proof.as_program()) == expected


# @pytest.mark.anyio
# async def test_create_first_pair(data_store: DataStore, store_id: bytes) -> None:
# key = SExp.to([1, 2])
Expand Down
3 changes: 0 additions & 3 deletions chia/data_layer/data_layer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ def sibling_sides_integer(self) -> int:
def sibling_hashes(self) -> list[bytes32]:
return [layer.other_hash for layer in self.layers]

def as_program(self) -> Program:
return Program.to([self.sibling_sides_integer(), self.sibling_hashes()])

def valid(self) -> bool:
existing_hash = self.node_hash

Expand Down

0 comments on commit 849eef1

Please sign in to comment.