Skip to content

Commit da8c90e

Browse files
committed
update network protocol tests
1 parent a86fa01 commit da8c90e

6 files changed

+390
-315
lines changed

chia/_tests/util/build_network_protocol_files.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ def visit_farmer_protocol(visitor: Callable[[Any, str], None]) -> None:
3333
visitor(request_signed_values, "request_signed_values")
3434
visitor(farming_info, "farming_info")
3535
visitor(signed_values, "signed_values")
36+
visitor(partial_proof, "partial_proof")
37+
38+
39+
def visit_solver_protocol(visitor: Callable[[Any, str], None]) -> None:
40+
visitor(solver_info, "solver_info")
41+
visitor(solver_response, "solver_response")
3642

3743

3844
def visit_full_node(visitor: Callable[[Any, str], None]) -> None:
@@ -170,6 +176,7 @@ def visit_all_messages(visitor: Callable[[Any, str], None]) -> None:
170176
visit_pool_protocol(visitor)
171177
visit_timelord_protocol(visitor)
172178
visit_shared_protocol(visitor)
179+
visit_solver_protocol(visitor)
173180

174181

175182
def get_protocol_bytes() -> bytes:

chia/_tests/util/network_protocol_data.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
harvester_protocol,
3838
introducer_protocol,
3939
pool_protocol,
40+
solver_protocol,
4041
timelord_protocol,
4142
wallet_protocol,
4243
)
@@ -150,6 +151,27 @@
150151
),
151152
)
152153

154+
partial_proof = harvester_protocol.PartialProofsData(
155+
bytes32.fromhex("42743566108589c11bb3811b347900b6351fd3e25bad6c956c0bf1c05a4d93fb"),
156+
bytes32.fromhex("8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a"),
157+
"plot-filename",
158+
[b"partial-proof1", b"partial-proof2"],
159+
uint8(4),
160+
uint8(32),
161+
uint64(100000),
162+
G1Element.from_bytes(
163+
bytes.fromhex(
164+
"a04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c"
165+
),
166+
),
167+
bytes32.fromhex("91240fbacdf93b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a"),
168+
G1Element.from_bytes(
169+
bytes.fromhex(
170+
"a04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c"
171+
),
172+
),
173+
)
174+
153175

154176
# FULL NODE PROTOCOL.
155177
new_peak = full_node_protocol.NewPeak(
@@ -1082,3 +1104,8 @@
10821104
uint32(386395693),
10831105
uint8(224),
10841106
)
1107+
1108+
# SOLVER PROTOCOL
1109+
solver_info = solver_protocol.SolverInfo(uint64(2), b"partial-proof")
1110+
1111+
solver_response = solver_protocol.SolverResponse(b"partial-proof", b"full-proof")
329 Bytes
Binary file not shown.

chia/_tests/util/protocol_messages_json.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@
6565
"foliage_transaction_block_signature": "0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
6666
}
6767

68+
partial_proof_json: dict[str, Any] = {
69+
"challenge_hash": "0x42743566108589c11bb3811b347900b6351fd3e25bad6c956c0bf1c05a4d93fb",
70+
"sp_hash": "0x8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a",
71+
"plot_identifier": "plot-filename",
72+
"partial_proofs": ["0x7061727469616c2d70726f6f6631", "0x7061727469616c2d70726f6f6632"],
73+
"signage_point_index": 4,
74+
"plot_size": 32,
75+
"difficulty": 100000,
76+
"pool_public_key": "0xa04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c",
77+
"pool_contract_puzzle_hash": "0x91240fbacdf93b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a",
78+
"plot_public_key": "0xa04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c",
79+
}
80+
6881
new_peak_json: dict[str, Any] = {
6982
"header_hash": "0x8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deae9f8ddb00528721493f7a",
7083
"height": 2653549198,
@@ -2701,3 +2714,10 @@
27012714
error_without_data_json: dict[str, Any] = {"code": 1, "message": "Unknown", "data": None}
27022715

27032716
error_with_data_json: dict[str, Any] = {"code": 1, "message": "Unknown", "data": "0x65787472612064617461"}
2717+
2718+
solver_info_json: dict[str, Any] = {"plot_difficulty": 2, "partial_proof": "0x7061727469616c2d70726f6f66"}
2719+
2720+
solver_response_json: dict[str, Any] = {
2721+
"partial_proof": "0x7061727469616c2d70726f6f66",
2722+
"proof": "0x66756c6c2d70726f6f66",
2723+
}

0 commit comments

Comments
 (0)