Switch format for RPC proofs_of_inclusion for DL offers

This commit is contained in:
Matt Hauff 2022-08-08 11:12:24 -05:00
parent 2f75afb7c0
commit f22a7e0d7c
No known key found for this signature in database
GPG Key ID: 3CBA6CFC81A00E46
2 changed files with 11 additions and 12 deletions

View File

@ -1272,10 +1272,9 @@ class DataLayerWallet:
asserted_root: Optional[str] = None
proofs_of_inclusion = []
for value in values:
for root in solver["proofs_of_inclusion"].info:
proof: Tuple[int, List[bytes32]] = tuple( # type: ignore
solver["proofs_of_inclusion"][root]
)
for proof_of_inclusion in solver["proofs_of_inclusion"]:
root = proof_of_inclusion[0]
proof = tuple(proof_of_inclusion[1:])
if simplify_merkle_proof(value, proof) == bytes32.from_hexstr(root):
proofs_of_inclusion.append(proof)
if asserted_root is None:

View File

@ -143,10 +143,10 @@ async def test_dl_offers(wallets_prefarm: Any, trusted: bool) -> None:
},
],
},
"proofs_of_inclusion": {
maker_root.hex(): [str(maker_proof[0]), ["0x" + sibling.hex() for sibling in maker_proof[1]]],
taker_root.hex(): [str(taker_proof[0]), ["0x" + sibling.hex() for sibling in taker_proof[1]]],
},
"proofs_of_inclusion": [
[maker_root.hex(), str(maker_proof[0]), ["0x" + sibling.hex() for sibling in maker_proof[1]]],
[taker_root.hex(), str(taker_proof[0]), ["0x" + sibling.hex() for sibling in taker_proof[1]]],
],
}
),
fee=uint64(2000000000000),
@ -411,10 +411,10 @@ async def test_multiple_dl_offers(wallets_prefarm: Any, trusted: bool) -> None:
},
],
},
"proofs_of_inclusion": {
maker_root.hex(): [str(maker_proof[0]), ["0x" + sibling.hex() for sibling in maker_proof[1]]],
taker_root.hex(): [str(taker_proof[0]), ["0x" + sibling.hex() for sibling in taker_proof[1]]],
},
"proofs_of_inclusion": [
[maker_root.hex(), str(maker_proof[0]), ["0x" + sibling.hex() for sibling in maker_proof[1]]],
[taker_root.hex(), str(taker_proof[0]), ["0x" + sibling.hex() for sibling in taker_proof[1]]],
],
}
),
fee=uint64(2000000000000),