diff --git a/chia/_tests/util/build_network_protocol_files.py b/chia/_tests/util/build_network_protocol_files.py index 8e2f6b34c217..4de90f8478ae 100644 --- a/chia/_tests/util/build_network_protocol_files.py +++ b/chia/_tests/util/build_network_protocol_files.py @@ -33,6 +33,12 @@ def visit_farmer_protocol(visitor: Callable[[Any, str], None]) -> None: visitor(request_signed_values, "request_signed_values") visitor(farming_info, "farming_info") visitor(signed_values, "signed_values") + visitor(partial_proof, "partial_proof") + + +def visit_solver_protocol(visitor: Callable[[Any, str], None]) -> None: + visitor(solver_info, "solver_info") + visitor(solver_response, "solver_response") def visit_full_node(visitor: Callable[[Any, str], None]) -> None: @@ -170,6 +176,7 @@ def visit_all_messages(visitor: Callable[[Any, str], None]) -> None: visit_pool_protocol(visitor) visit_timelord_protocol(visitor) visit_shared_protocol(visitor) + visit_solver_protocol(visitor) def get_protocol_bytes() -> bytes: diff --git a/chia/_tests/util/network_protocol_data.py b/chia/_tests/util/network_protocol_data.py index 7e0ca731697c..90ecbffb5af0 100644 --- a/chia/_tests/util/network_protocol_data.py +++ b/chia/_tests/util/network_protocol_data.py @@ -37,6 +37,7 @@ harvester_protocol, introducer_protocol, pool_protocol, + solver_protocol, timelord_protocol, wallet_protocol, ) @@ -150,6 +151,27 @@ ), ) +partial_proof = harvester_protocol.PartialProofsData( + bytes32.fromhex("42743566108589c11bb3811b347900b6351fd3e25bad6c956c0bf1c05a4d93fb"), + bytes32.fromhex("8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a"), + "plot-filename", + [b"partial-proof1", b"partial-proof2"], + uint8(4), + uint8(32), + uint64(100000), + G1Element.from_bytes( + bytes.fromhex( + "a04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c" + ), + ), + bytes32.fromhex("91240fbacdf93b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a"), + G1Element.from_bytes( + bytes.fromhex( + "a04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c" + ), + ), +) + # FULL NODE PROTOCOL. new_peak = full_node_protocol.NewPeak( @@ -1082,3 +1104,8 @@ uint32(386395693), uint8(224), ) + +# SOLVER PROTOCOL +solver_info = solver_protocol.SolverInfo(uint64(2), b"partial-proof") + +solver_response = solver_protocol.SolverResponse(b"partial-proof", b"full-proof") diff --git a/chia/_tests/util/protocol_messages_bytes-v1.0 b/chia/_tests/util/protocol_messages_bytes-v1.0 index 0d9160933489..cc64c54d471f 100644 Binary files a/chia/_tests/util/protocol_messages_bytes-v1.0 and b/chia/_tests/util/protocol_messages_bytes-v1.0 differ diff --git a/chia/_tests/util/protocol_messages_json.py b/chia/_tests/util/protocol_messages_json.py index c89601f7c90e..33bb23dd7b91 100644 --- a/chia/_tests/util/protocol_messages_json.py +++ b/chia/_tests/util/protocol_messages_json.py @@ -65,6 +65,19 @@ "foliage_transaction_block_signature": "0xc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", } +partial_proof_json: dict[str, Any] = { + "challenge_hash": "0x42743566108589c11bb3811b347900b6351fd3e25bad6c956c0bf1c05a4d93fb", + "sp_hash": "0x8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a", + "plot_identifier": "plot-filename", + "partial_proofs": ["0x7061727469616c2d70726f6f6631", "0x7061727469616c2d70726f6f6632"], + "signage_point_index": 4, + "plot_size": 32, + "difficulty": 100000, + "pool_public_key": "0xa04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c", + "pool_contract_puzzle_hash": "0x91240fbacdf93b44c0571caa74fd99f163d4c5d7deaedac87125528721493f7a", + "plot_public_key": "0xa04c6b5ac7dfb935f6feecfdd72348ccf1d4be4fe7e26acf271ea3b7d308da61e0a308f7a62495328a81f5147b66634c", +} + new_peak_json: dict[str, Any] = { "header_hash": "0x8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deae9f8ddb00528721493f7a", "height": 2653549198, @@ -2701,3 +2714,10 @@ error_without_data_json: dict[str, Any] = {"code": 1, "message": "Unknown", "data": None} error_with_data_json: dict[str, Any] = {"code": 1, "message": "Unknown", "data": "0x65787472612064617461"} + +solver_info_json: dict[str, Any] = {"plot_difficulty": 2, "partial_proof": "0x7061727469616c2d70726f6f66"} + +solver_response_json: dict[str, Any] = { + "partial_proof": "0x7061727469616c2d70726f6f66", + "proof": "0x66756c6c2d70726f6f66", +} diff --git a/chia/_tests/util/test_network_protocol_files.py b/chia/_tests/util/test_network_protocol_files.py index 071a263e8366..279a45f2008c 100644 --- a/chia/_tests/util/test_network_protocol_files.py +++ b/chia/_tests/util/test_network_protocol_files.py @@ -51,528 +51,543 @@ def test_protocol_bytes() -> None: assert bytes(message_4) == bytes(signed_values) message_bytes, input_bytes = parse_blob(input_bytes) - message_5 = type(new_peak).from_bytes(message_bytes) - assert message_5 == new_peak - assert bytes(message_5) == bytes(new_peak) + message_5 = type(partial_proof).from_bytes(message_bytes) + assert message_5 == partial_proof + assert bytes(message_5) == bytes(partial_proof) message_bytes, input_bytes = parse_blob(input_bytes) - message_6 = type(new_transaction).from_bytes(message_bytes) - assert message_6 == new_transaction - assert bytes(message_6) == bytes(new_transaction) + message_6 = type(new_peak).from_bytes(message_bytes) + assert message_6 == new_peak + assert bytes(message_6) == bytes(new_peak) message_bytes, input_bytes = parse_blob(input_bytes) - message_7 = type(request_transaction).from_bytes(message_bytes) - assert message_7 == request_transaction - assert bytes(message_7) == bytes(request_transaction) + message_7 = type(new_transaction).from_bytes(message_bytes) + assert message_7 == new_transaction + assert bytes(message_7) == bytes(new_transaction) message_bytes, input_bytes = parse_blob(input_bytes) - message_8 = type(respond_transaction).from_bytes(message_bytes) - assert message_8 == respond_transaction - assert bytes(message_8) == bytes(respond_transaction) + message_8 = type(request_transaction).from_bytes(message_bytes) + assert message_8 == request_transaction + assert bytes(message_8) == bytes(request_transaction) message_bytes, input_bytes = parse_blob(input_bytes) - message_9 = type(request_proof_of_weight).from_bytes(message_bytes) - assert message_9 == request_proof_of_weight - assert bytes(message_9) == bytes(request_proof_of_weight) + message_9 = type(respond_transaction).from_bytes(message_bytes) + assert message_9 == respond_transaction + assert bytes(message_9) == bytes(respond_transaction) message_bytes, input_bytes = parse_blob(input_bytes) - message_10 = type(respond_proof_of_weight).from_bytes(message_bytes) - assert message_10 == respond_proof_of_weight - assert bytes(message_10) == bytes(respond_proof_of_weight) + message_10 = type(request_proof_of_weight).from_bytes(message_bytes) + assert message_10 == request_proof_of_weight + assert bytes(message_10) == bytes(request_proof_of_weight) message_bytes, input_bytes = parse_blob(input_bytes) - message_11 = type(request_block).from_bytes(message_bytes) - assert message_11 == request_block - assert bytes(message_11) == bytes(request_block) + message_11 = type(respond_proof_of_weight).from_bytes(message_bytes) + assert message_11 == respond_proof_of_weight + assert bytes(message_11) == bytes(respond_proof_of_weight) message_bytes, input_bytes = parse_blob(input_bytes) - message_12 = type(reject_block).from_bytes(message_bytes) - assert message_12 == reject_block - assert bytes(message_12) == bytes(reject_block) + message_12 = type(request_block).from_bytes(message_bytes) + assert message_12 == request_block + assert bytes(message_12) == bytes(request_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_13 = type(request_blocks).from_bytes(message_bytes) - assert message_13 == request_blocks - assert bytes(message_13) == bytes(request_blocks) + message_13 = type(reject_block).from_bytes(message_bytes) + assert message_13 == reject_block + assert bytes(message_13) == bytes(reject_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_14 = type(respond_blocks).from_bytes(message_bytes) - assert message_14 == respond_blocks - assert bytes(message_14) == bytes(respond_blocks) + message_14 = type(request_blocks).from_bytes(message_bytes) + assert message_14 == request_blocks + assert bytes(message_14) == bytes(request_blocks) message_bytes, input_bytes = parse_blob(input_bytes) - message_15 = type(reject_blocks).from_bytes(message_bytes) - assert message_15 == reject_blocks - assert bytes(message_15) == bytes(reject_blocks) + message_15 = type(respond_blocks).from_bytes(message_bytes) + assert message_15 == respond_blocks + assert bytes(message_15) == bytes(respond_blocks) message_bytes, input_bytes = parse_blob(input_bytes) - message_16 = type(respond_block).from_bytes(message_bytes) - assert message_16 == respond_block - assert bytes(message_16) == bytes(respond_block) + message_16 = type(reject_blocks).from_bytes(message_bytes) + assert message_16 == reject_blocks + assert bytes(message_16) == bytes(reject_blocks) message_bytes, input_bytes = parse_blob(input_bytes) - message_17 = type(new_unfinished_block).from_bytes(message_bytes) - assert message_17 == new_unfinished_block - assert bytes(message_17) == bytes(new_unfinished_block) + message_17 = type(respond_block).from_bytes(message_bytes) + assert message_17 == respond_block + assert bytes(message_17) == bytes(respond_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_18 = type(request_unfinished_block).from_bytes(message_bytes) - assert message_18 == request_unfinished_block - assert bytes(message_18) == bytes(request_unfinished_block) + message_18 = type(new_unfinished_block).from_bytes(message_bytes) + assert message_18 == new_unfinished_block + assert bytes(message_18) == bytes(new_unfinished_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_19 = type(respond_unfinished_block).from_bytes(message_bytes) - assert message_19 == respond_unfinished_block - assert bytes(message_19) == bytes(respond_unfinished_block) + message_19 = type(request_unfinished_block).from_bytes(message_bytes) + assert message_19 == request_unfinished_block + assert bytes(message_19) == bytes(request_unfinished_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_20 = type(new_signage_point_or_end_of_subslot).from_bytes(message_bytes) - assert message_20 == new_signage_point_or_end_of_subslot - assert bytes(message_20) == bytes(new_signage_point_or_end_of_subslot) + message_20 = type(respond_unfinished_block).from_bytes(message_bytes) + assert message_20 == respond_unfinished_block + assert bytes(message_20) == bytes(respond_unfinished_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_21 = type(request_signage_point_or_end_of_subslot).from_bytes(message_bytes) - assert message_21 == request_signage_point_or_end_of_subslot - assert bytes(message_21) == bytes(request_signage_point_or_end_of_subslot) + message_21 = type(new_signage_point_or_end_of_subslot).from_bytes(message_bytes) + assert message_21 == new_signage_point_or_end_of_subslot + assert bytes(message_21) == bytes(new_signage_point_or_end_of_subslot) message_bytes, input_bytes = parse_blob(input_bytes) - message_22 = type(respond_signage_point).from_bytes(message_bytes) - assert message_22 == respond_signage_point - assert bytes(message_22) == bytes(respond_signage_point) + message_22 = type(request_signage_point_or_end_of_subslot).from_bytes(message_bytes) + assert message_22 == request_signage_point_or_end_of_subslot + assert bytes(message_22) == bytes(request_signage_point_or_end_of_subslot) message_bytes, input_bytes = parse_blob(input_bytes) - message_23 = type(respond_end_of_subslot).from_bytes(message_bytes) - assert message_23 == respond_end_of_subslot - assert bytes(message_23) == bytes(respond_end_of_subslot) + message_23 = type(respond_signage_point).from_bytes(message_bytes) + assert message_23 == respond_signage_point + assert bytes(message_23) == bytes(respond_signage_point) message_bytes, input_bytes = parse_blob(input_bytes) - message_24 = type(request_mempool_transaction).from_bytes(message_bytes) - assert message_24 == request_mempool_transaction - assert bytes(message_24) == bytes(request_mempool_transaction) + message_24 = type(respond_end_of_subslot).from_bytes(message_bytes) + assert message_24 == respond_end_of_subslot + assert bytes(message_24) == bytes(respond_end_of_subslot) message_bytes, input_bytes = parse_blob(input_bytes) - message_25 = type(new_compact_vdf).from_bytes(message_bytes) - assert message_25 == new_compact_vdf - assert bytes(message_25) == bytes(new_compact_vdf) + message_25 = type(request_mempool_transaction).from_bytes(message_bytes) + assert message_25 == request_mempool_transaction + assert bytes(message_25) == bytes(request_mempool_transaction) message_bytes, input_bytes = parse_blob(input_bytes) - message_26 = type(request_compact_vdf).from_bytes(message_bytes) - assert message_26 == request_compact_vdf - assert bytes(message_26) == bytes(request_compact_vdf) + message_26 = type(new_compact_vdf).from_bytes(message_bytes) + assert message_26 == new_compact_vdf + assert bytes(message_26) == bytes(new_compact_vdf) message_bytes, input_bytes = parse_blob(input_bytes) - message_27 = type(respond_compact_vdf).from_bytes(message_bytes) - assert message_27 == respond_compact_vdf - assert bytes(message_27) == bytes(respond_compact_vdf) + message_27 = type(request_compact_vdf).from_bytes(message_bytes) + assert message_27 == request_compact_vdf + assert bytes(message_27) == bytes(request_compact_vdf) message_bytes, input_bytes = parse_blob(input_bytes) - message_28 = type(request_peers).from_bytes(message_bytes) - assert message_28 == request_peers - assert bytes(message_28) == bytes(request_peers) + message_28 = type(respond_compact_vdf).from_bytes(message_bytes) + assert message_28 == respond_compact_vdf + assert bytes(message_28) == bytes(respond_compact_vdf) message_bytes, input_bytes = parse_blob(input_bytes) - message_29 = type(respond_peers).from_bytes(message_bytes) - assert message_29 == respond_peers - assert bytes(message_29) == bytes(respond_peers) + message_29 = type(request_peers).from_bytes(message_bytes) + assert message_29 == request_peers + assert bytes(message_29) == bytes(request_peers) message_bytes, input_bytes = parse_blob(input_bytes) - message_30 = type(new_unfinished_block2).from_bytes(message_bytes) - assert message_30 == new_unfinished_block2 - assert bytes(message_30) == bytes(new_unfinished_block2) + message_30 = type(respond_peers).from_bytes(message_bytes) + assert message_30 == respond_peers + assert bytes(message_30) == bytes(respond_peers) message_bytes, input_bytes = parse_blob(input_bytes) - message_31 = type(request_unfinished_block2).from_bytes(message_bytes) - assert message_31 == request_unfinished_block2 - assert bytes(message_31) == bytes(request_unfinished_block2) + message_31 = type(new_unfinished_block2).from_bytes(message_bytes) + assert message_31 == new_unfinished_block2 + assert bytes(message_31) == bytes(new_unfinished_block2) message_bytes, input_bytes = parse_blob(input_bytes) - message_32 = type(request_puzzle_solution).from_bytes(message_bytes) - assert message_32 == request_puzzle_solution - assert bytes(message_32) == bytes(request_puzzle_solution) + message_32 = type(request_unfinished_block2).from_bytes(message_bytes) + assert message_32 == request_unfinished_block2 + assert bytes(message_32) == bytes(request_unfinished_block2) message_bytes, input_bytes = parse_blob(input_bytes) - message_33 = type(puzzle_solution_response).from_bytes(message_bytes) - assert message_33 == puzzle_solution_response - assert bytes(message_33) == bytes(puzzle_solution_response) + message_33 = type(request_puzzle_solution).from_bytes(message_bytes) + assert message_33 == request_puzzle_solution + assert bytes(message_33) == bytes(request_puzzle_solution) message_bytes, input_bytes = parse_blob(input_bytes) - message_34 = type(respond_puzzle_solution).from_bytes(message_bytes) - assert message_34 == respond_puzzle_solution - assert bytes(message_34) == bytes(respond_puzzle_solution) + message_34 = type(puzzle_solution_response).from_bytes(message_bytes) + assert message_34 == puzzle_solution_response + assert bytes(message_34) == bytes(puzzle_solution_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_35 = type(reject_puzzle_solution).from_bytes(message_bytes) - assert message_35 == reject_puzzle_solution - assert bytes(message_35) == bytes(reject_puzzle_solution) + message_35 = type(respond_puzzle_solution).from_bytes(message_bytes) + assert message_35 == respond_puzzle_solution + assert bytes(message_35) == bytes(respond_puzzle_solution) message_bytes, input_bytes = parse_blob(input_bytes) - message_36 = type(send_transaction).from_bytes(message_bytes) - assert message_36 == send_transaction - assert bytes(message_36) == bytes(send_transaction) + message_36 = type(reject_puzzle_solution).from_bytes(message_bytes) + assert message_36 == reject_puzzle_solution + assert bytes(message_36) == bytes(reject_puzzle_solution) message_bytes, input_bytes = parse_blob(input_bytes) - message_37 = type(transaction_ack).from_bytes(message_bytes) - assert message_37 == transaction_ack - assert bytes(message_37) == bytes(transaction_ack) + message_37 = type(send_transaction).from_bytes(message_bytes) + assert message_37 == send_transaction + assert bytes(message_37) == bytes(send_transaction) message_bytes, input_bytes = parse_blob(input_bytes) - message_38 = type(new_peak_wallet).from_bytes(message_bytes) - assert message_38 == new_peak_wallet - assert bytes(message_38) == bytes(new_peak_wallet) + message_38 = type(transaction_ack).from_bytes(message_bytes) + assert message_38 == transaction_ack + assert bytes(message_38) == bytes(transaction_ack) message_bytes, input_bytes = parse_blob(input_bytes) - message_39 = type(request_block_header).from_bytes(message_bytes) - assert message_39 == request_block_header - assert bytes(message_39) == bytes(request_block_header) + message_39 = type(new_peak_wallet).from_bytes(message_bytes) + assert message_39 == new_peak_wallet + assert bytes(message_39) == bytes(new_peak_wallet) message_bytes, input_bytes = parse_blob(input_bytes) - message_40 = type(request_block_headers).from_bytes(message_bytes) - assert message_40 == request_block_headers - assert bytes(message_40) == bytes(request_block_headers) + message_40 = type(request_block_header).from_bytes(message_bytes) + assert message_40 == request_block_header + assert bytes(message_40) == bytes(request_block_header) message_bytes, input_bytes = parse_blob(input_bytes) - message_41 = type(respond_header_block).from_bytes(message_bytes) - assert message_41 == respond_header_block - assert bytes(message_41) == bytes(respond_header_block) + message_41 = type(request_block_headers).from_bytes(message_bytes) + assert message_41 == request_block_headers + assert bytes(message_41) == bytes(request_block_headers) message_bytes, input_bytes = parse_blob(input_bytes) - message_42 = type(respond_block_headers).from_bytes(message_bytes) - assert message_42 == respond_block_headers - assert bytes(message_42) == bytes(respond_block_headers) + message_42 = type(respond_header_block).from_bytes(message_bytes) + assert message_42 == respond_header_block + assert bytes(message_42) == bytes(respond_header_block) message_bytes, input_bytes = parse_blob(input_bytes) - message_43 = type(reject_header_request).from_bytes(message_bytes) - assert message_43 == reject_header_request - assert bytes(message_43) == bytes(reject_header_request) + message_43 = type(respond_block_headers).from_bytes(message_bytes) + assert message_43 == respond_block_headers + assert bytes(message_43) == bytes(respond_block_headers) message_bytes, input_bytes = parse_blob(input_bytes) - message_44 = type(request_removals).from_bytes(message_bytes) - assert message_44 == request_removals - assert bytes(message_44) == bytes(request_removals) + message_44 = type(reject_header_request).from_bytes(message_bytes) + assert message_44 == reject_header_request + assert bytes(message_44) == bytes(reject_header_request) message_bytes, input_bytes = parse_blob(input_bytes) - message_45 = type(respond_removals).from_bytes(message_bytes) - assert message_45 == respond_removals - assert bytes(message_45) == bytes(respond_removals) + message_45 = type(request_removals).from_bytes(message_bytes) + assert message_45 == request_removals + assert bytes(message_45) == bytes(request_removals) message_bytes, input_bytes = parse_blob(input_bytes) - message_46 = type(reject_removals_request).from_bytes(message_bytes) - assert message_46 == reject_removals_request - assert bytes(message_46) == bytes(reject_removals_request) + message_46 = type(respond_removals).from_bytes(message_bytes) + assert message_46 == respond_removals + assert bytes(message_46) == bytes(respond_removals) message_bytes, input_bytes = parse_blob(input_bytes) - message_47 = type(request_additions).from_bytes(message_bytes) - assert message_47 == request_additions - assert bytes(message_47) == bytes(request_additions) + message_47 = type(reject_removals_request).from_bytes(message_bytes) + assert message_47 == reject_removals_request + assert bytes(message_47) == bytes(reject_removals_request) message_bytes, input_bytes = parse_blob(input_bytes) - message_48 = type(respond_additions).from_bytes(message_bytes) - assert message_48 == respond_additions - assert bytes(message_48) == bytes(respond_additions) + message_48 = type(request_additions).from_bytes(message_bytes) + assert message_48 == request_additions + assert bytes(message_48) == bytes(request_additions) message_bytes, input_bytes = parse_blob(input_bytes) - message_49 = type(reject_additions).from_bytes(message_bytes) - assert message_49 == reject_additions - assert bytes(message_49) == bytes(reject_additions) + message_49 = type(respond_additions).from_bytes(message_bytes) + assert message_49 == respond_additions + assert bytes(message_49) == bytes(respond_additions) message_bytes, input_bytes = parse_blob(input_bytes) - message_50 = type(request_header_blocks).from_bytes(message_bytes) - assert message_50 == request_header_blocks - assert bytes(message_50) == bytes(request_header_blocks) + message_50 = type(reject_additions).from_bytes(message_bytes) + assert message_50 == reject_additions + assert bytes(message_50) == bytes(reject_additions) message_bytes, input_bytes = parse_blob(input_bytes) - message_51 = type(reject_header_blocks).from_bytes(message_bytes) - assert message_51 == reject_header_blocks - assert bytes(message_51) == bytes(reject_header_blocks) + message_51 = type(request_header_blocks).from_bytes(message_bytes) + assert message_51 == request_header_blocks + assert bytes(message_51) == bytes(request_header_blocks) message_bytes, input_bytes = parse_blob(input_bytes) - message_52 = type(respond_header_blocks).from_bytes(message_bytes) - assert message_52 == respond_header_blocks - assert bytes(message_52) == bytes(respond_header_blocks) + message_52 = type(reject_header_blocks).from_bytes(message_bytes) + assert message_52 == reject_header_blocks + assert bytes(message_52) == bytes(reject_header_blocks) message_bytes, input_bytes = parse_blob(input_bytes) - message_53 = type(coin_state).from_bytes(message_bytes) - assert message_53 == coin_state - assert bytes(message_53) == bytes(coin_state) + message_53 = type(respond_header_blocks).from_bytes(message_bytes) + assert message_53 == respond_header_blocks + assert bytes(message_53) == bytes(respond_header_blocks) message_bytes, input_bytes = parse_blob(input_bytes) - message_54 = type(register_for_ph_updates).from_bytes(message_bytes) - assert message_54 == register_for_ph_updates - assert bytes(message_54) == bytes(register_for_ph_updates) + message_54 = type(coin_state).from_bytes(message_bytes) + assert message_54 == coin_state + assert bytes(message_54) == bytes(coin_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_55 = type(reject_block_headers).from_bytes(message_bytes) - assert message_55 == reject_block_headers - assert bytes(message_55) == bytes(reject_block_headers) + message_55 = type(register_for_ph_updates).from_bytes(message_bytes) + assert message_55 == register_for_ph_updates + assert bytes(message_55) == bytes(register_for_ph_updates) message_bytes, input_bytes = parse_blob(input_bytes) - message_56 = type(respond_to_ph_updates).from_bytes(message_bytes) - assert message_56 == respond_to_ph_updates - assert bytes(message_56) == bytes(respond_to_ph_updates) + message_56 = type(reject_block_headers).from_bytes(message_bytes) + assert message_56 == reject_block_headers + assert bytes(message_56) == bytes(reject_block_headers) message_bytes, input_bytes = parse_blob(input_bytes) - message_57 = type(register_for_coin_updates).from_bytes(message_bytes) - assert message_57 == register_for_coin_updates - assert bytes(message_57) == bytes(register_for_coin_updates) + message_57 = type(respond_to_ph_updates).from_bytes(message_bytes) + assert message_57 == respond_to_ph_updates + assert bytes(message_57) == bytes(respond_to_ph_updates) message_bytes, input_bytes = parse_blob(input_bytes) - message_58 = type(respond_to_coin_updates).from_bytes(message_bytes) - assert message_58 == respond_to_coin_updates - assert bytes(message_58) == bytes(respond_to_coin_updates) + message_58 = type(register_for_coin_updates).from_bytes(message_bytes) + assert message_58 == register_for_coin_updates + assert bytes(message_58) == bytes(register_for_coin_updates) message_bytes, input_bytes = parse_blob(input_bytes) - message_59 = type(coin_state_update).from_bytes(message_bytes) - assert message_59 == coin_state_update - assert bytes(message_59) == bytes(coin_state_update) + message_59 = type(respond_to_coin_updates).from_bytes(message_bytes) + assert message_59 == respond_to_coin_updates + assert bytes(message_59) == bytes(respond_to_coin_updates) message_bytes, input_bytes = parse_blob(input_bytes) - message_60 = type(request_children).from_bytes(message_bytes) - assert message_60 == request_children - assert bytes(message_60) == bytes(request_children) + message_60 = type(coin_state_update).from_bytes(message_bytes) + assert message_60 == coin_state_update + assert bytes(message_60) == bytes(coin_state_update) message_bytes, input_bytes = parse_blob(input_bytes) - message_61 = type(respond_children).from_bytes(message_bytes) - assert message_61 == respond_children - assert bytes(message_61) == bytes(respond_children) + message_61 = type(request_children).from_bytes(message_bytes) + assert message_61 == request_children + assert bytes(message_61) == bytes(request_children) message_bytes, input_bytes = parse_blob(input_bytes) - message_62 = type(request_ses_info).from_bytes(message_bytes) - assert message_62 == request_ses_info - assert bytes(message_62) == bytes(request_ses_info) + message_62 = type(respond_children).from_bytes(message_bytes) + assert message_62 == respond_children + assert bytes(message_62) == bytes(respond_children) message_bytes, input_bytes = parse_blob(input_bytes) - message_63 = type(respond_ses_info).from_bytes(message_bytes) - assert message_63 == respond_ses_info - assert bytes(message_63) == bytes(respond_ses_info) + message_63 = type(request_ses_info).from_bytes(message_bytes) + assert message_63 == request_ses_info + assert bytes(message_63) == bytes(request_ses_info) message_bytes, input_bytes = parse_blob(input_bytes) - message_64 = type(coin_state_filters).from_bytes(message_bytes) - assert message_64 == coin_state_filters - assert bytes(message_64) == bytes(coin_state_filters) + message_64 = type(respond_ses_info).from_bytes(message_bytes) + assert message_64 == respond_ses_info + assert bytes(message_64) == bytes(respond_ses_info) message_bytes, input_bytes = parse_blob(input_bytes) - message_65 = type(request_remove_puzzle_subscriptions).from_bytes(message_bytes) - assert message_65 == request_remove_puzzle_subscriptions - assert bytes(message_65) == bytes(request_remove_puzzle_subscriptions) + message_65 = type(coin_state_filters).from_bytes(message_bytes) + assert message_65 == coin_state_filters + assert bytes(message_65) == bytes(coin_state_filters) message_bytes, input_bytes = parse_blob(input_bytes) - message_66 = type(respond_remove_puzzle_subscriptions).from_bytes(message_bytes) - assert message_66 == respond_remove_puzzle_subscriptions - assert bytes(message_66) == bytes(respond_remove_puzzle_subscriptions) + message_66 = type(request_remove_puzzle_subscriptions).from_bytes(message_bytes) + assert message_66 == request_remove_puzzle_subscriptions + assert bytes(message_66) == bytes(request_remove_puzzle_subscriptions) message_bytes, input_bytes = parse_blob(input_bytes) - message_67 = type(request_remove_coin_subscriptions).from_bytes(message_bytes) - assert message_67 == request_remove_coin_subscriptions - assert bytes(message_67) == bytes(request_remove_coin_subscriptions) + message_67 = type(respond_remove_puzzle_subscriptions).from_bytes(message_bytes) + assert message_67 == respond_remove_puzzle_subscriptions + assert bytes(message_67) == bytes(respond_remove_puzzle_subscriptions) message_bytes, input_bytes = parse_blob(input_bytes) - message_68 = type(respond_remove_coin_subscriptions).from_bytes(message_bytes) - assert message_68 == respond_remove_coin_subscriptions - assert bytes(message_68) == bytes(respond_remove_coin_subscriptions) + message_68 = type(request_remove_coin_subscriptions).from_bytes(message_bytes) + assert message_68 == request_remove_coin_subscriptions + assert bytes(message_68) == bytes(request_remove_coin_subscriptions) message_bytes, input_bytes = parse_blob(input_bytes) - message_69 = type(request_puzzle_state).from_bytes(message_bytes) - assert message_69 == request_puzzle_state - assert bytes(message_69) == bytes(request_puzzle_state) + message_69 = type(respond_remove_coin_subscriptions).from_bytes(message_bytes) + assert message_69 == respond_remove_coin_subscriptions + assert bytes(message_69) == bytes(respond_remove_coin_subscriptions) message_bytes, input_bytes = parse_blob(input_bytes) - message_70 = type(reject_puzzle_state).from_bytes(message_bytes) - assert message_70 == reject_puzzle_state - assert bytes(message_70) == bytes(reject_puzzle_state) + message_70 = type(request_puzzle_state).from_bytes(message_bytes) + assert message_70 == request_puzzle_state + assert bytes(message_70) == bytes(request_puzzle_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_71 = type(respond_puzzle_state).from_bytes(message_bytes) - assert message_71 == respond_puzzle_state - assert bytes(message_71) == bytes(respond_puzzle_state) + message_71 = type(reject_puzzle_state).from_bytes(message_bytes) + assert message_71 == reject_puzzle_state + assert bytes(message_71) == bytes(reject_puzzle_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_72 = type(request_coin_state).from_bytes(message_bytes) - assert message_72 == request_coin_state - assert bytes(message_72) == bytes(request_coin_state) + message_72 = type(respond_puzzle_state).from_bytes(message_bytes) + assert message_72 == respond_puzzle_state + assert bytes(message_72) == bytes(respond_puzzle_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_73 = type(respond_coin_state).from_bytes(message_bytes) - assert message_73 == respond_coin_state - assert bytes(message_73) == bytes(respond_coin_state) + message_73 = type(request_coin_state).from_bytes(message_bytes) + assert message_73 == request_coin_state + assert bytes(message_73) == bytes(request_coin_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_74 = type(reject_coin_state).from_bytes(message_bytes) - assert message_74 == reject_coin_state - assert bytes(message_74) == bytes(reject_coin_state) + message_74 = type(respond_coin_state).from_bytes(message_bytes) + assert message_74 == respond_coin_state + assert bytes(message_74) == bytes(respond_coin_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_75 = type(request_cost_info).from_bytes(message_bytes) - assert message_75 == request_cost_info - assert bytes(message_75) == bytes(request_cost_info) + message_75 = type(reject_coin_state).from_bytes(message_bytes) + assert message_75 == reject_coin_state + assert bytes(message_75) == bytes(reject_coin_state) message_bytes, input_bytes = parse_blob(input_bytes) - message_76 = type(respond_cost_info).from_bytes(message_bytes) - assert message_76 == respond_cost_info - assert bytes(message_76) == bytes(respond_cost_info) + message_76 = type(request_cost_info).from_bytes(message_bytes) + assert message_76 == request_cost_info + assert bytes(message_76) == bytes(request_cost_info) message_bytes, input_bytes = parse_blob(input_bytes) - message_77 = type(pool_difficulty).from_bytes(message_bytes) - assert message_77 == pool_difficulty - assert bytes(message_77) == bytes(pool_difficulty) + message_77 = type(respond_cost_info).from_bytes(message_bytes) + assert message_77 == respond_cost_info + assert bytes(message_77) == bytes(respond_cost_info) message_bytes, input_bytes = parse_blob(input_bytes) - message_78 = type(harvester_handhsake).from_bytes(message_bytes) - assert message_78 == harvester_handhsake - assert bytes(message_78) == bytes(harvester_handhsake) + message_78 = type(pool_difficulty).from_bytes(message_bytes) + assert message_78 == pool_difficulty + assert bytes(message_78) == bytes(pool_difficulty) message_bytes, input_bytes = parse_blob(input_bytes) - message_79 = type(new_signage_point_harvester).from_bytes(message_bytes) - assert message_79 == new_signage_point_harvester - assert bytes(message_79) == bytes(new_signage_point_harvester) + message_79 = type(harvester_handhsake).from_bytes(message_bytes) + assert message_79 == harvester_handhsake + assert bytes(message_79) == bytes(harvester_handhsake) message_bytes, input_bytes = parse_blob(input_bytes) - message_80 = type(new_proof_of_space).from_bytes(message_bytes) - assert message_80 == new_proof_of_space - assert bytes(message_80) == bytes(new_proof_of_space) + message_80 = type(new_signage_point_harvester).from_bytes(message_bytes) + assert message_80 == new_signage_point_harvester + assert bytes(message_80) == bytes(new_signage_point_harvester) message_bytes, input_bytes = parse_blob(input_bytes) - message_81 = type(request_signatures).from_bytes(message_bytes) - assert message_81 == request_signatures - assert bytes(message_81) == bytes(request_signatures) + message_81 = type(new_proof_of_space).from_bytes(message_bytes) + assert message_81 == new_proof_of_space + assert bytes(message_81) == bytes(new_proof_of_space) message_bytes, input_bytes = parse_blob(input_bytes) - message_82 = type(respond_signatures).from_bytes(message_bytes) - assert message_82 == respond_signatures - assert bytes(message_82) == bytes(respond_signatures) + message_82 = type(request_signatures).from_bytes(message_bytes) + assert message_82 == request_signatures + assert bytes(message_82) == bytes(request_signatures) message_bytes, input_bytes = parse_blob(input_bytes) - message_83 = type(plot).from_bytes(message_bytes) - assert message_83 == plot - assert bytes(message_83) == bytes(plot) + message_83 = type(respond_signatures).from_bytes(message_bytes) + assert message_83 == respond_signatures + assert bytes(message_83) == bytes(respond_signatures) message_bytes, input_bytes = parse_blob(input_bytes) - message_84 = type(request_plots).from_bytes(message_bytes) - assert message_84 == request_plots - assert bytes(message_84) == bytes(request_plots) + message_84 = type(plot).from_bytes(message_bytes) + assert message_84 == plot + assert bytes(message_84) == bytes(plot) message_bytes, input_bytes = parse_blob(input_bytes) - message_85 = type(respond_plots).from_bytes(message_bytes) - assert message_85 == respond_plots - assert bytes(message_85) == bytes(respond_plots) + message_85 = type(request_plots).from_bytes(message_bytes) + assert message_85 == request_plots + assert bytes(message_85) == bytes(request_plots) message_bytes, input_bytes = parse_blob(input_bytes) - message_86 = type(request_peers_introducer).from_bytes(message_bytes) - assert message_86 == request_peers_introducer - assert bytes(message_86) == bytes(request_peers_introducer) + message_86 = type(respond_plots).from_bytes(message_bytes) + assert message_86 == respond_plots + assert bytes(message_86) == bytes(respond_plots) message_bytes, input_bytes = parse_blob(input_bytes) - message_87 = type(respond_peers_introducer).from_bytes(message_bytes) - assert message_87 == respond_peers_introducer - assert bytes(message_87) == bytes(respond_peers_introducer) + message_87 = type(request_peers_introducer).from_bytes(message_bytes) + assert message_87 == request_peers_introducer + assert bytes(message_87) == bytes(request_peers_introducer) message_bytes, input_bytes = parse_blob(input_bytes) - message_88 = type(authentication_payload).from_bytes(message_bytes) - assert message_88 == authentication_payload - assert bytes(message_88) == bytes(authentication_payload) + message_88 = type(respond_peers_introducer).from_bytes(message_bytes) + assert message_88 == respond_peers_introducer + assert bytes(message_88) == bytes(respond_peers_introducer) message_bytes, input_bytes = parse_blob(input_bytes) - message_89 = type(get_pool_info_response).from_bytes(message_bytes) - assert message_89 == get_pool_info_response - assert bytes(message_89) == bytes(get_pool_info_response) + message_89 = type(authentication_payload).from_bytes(message_bytes) + assert message_89 == authentication_payload + assert bytes(message_89) == bytes(authentication_payload) message_bytes, input_bytes = parse_blob(input_bytes) - message_90 = type(post_partial_payload).from_bytes(message_bytes) - assert message_90 == post_partial_payload - assert bytes(message_90) == bytes(post_partial_payload) + message_90 = type(get_pool_info_response).from_bytes(message_bytes) + assert message_90 == get_pool_info_response + assert bytes(message_90) == bytes(get_pool_info_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_91 = type(post_partial_request).from_bytes(message_bytes) - assert message_91 == post_partial_request - assert bytes(message_91) == bytes(post_partial_request) + message_91 = type(post_partial_payload).from_bytes(message_bytes) + assert message_91 == post_partial_payload + assert bytes(message_91) == bytes(post_partial_payload) message_bytes, input_bytes = parse_blob(input_bytes) - message_92 = type(post_partial_response).from_bytes(message_bytes) - assert message_92 == post_partial_response - assert bytes(message_92) == bytes(post_partial_response) + message_92 = type(post_partial_request).from_bytes(message_bytes) + assert message_92 == post_partial_request + assert bytes(message_92) == bytes(post_partial_request) message_bytes, input_bytes = parse_blob(input_bytes) - message_93 = type(get_farmer_response).from_bytes(message_bytes) - assert message_93 == get_farmer_response - assert bytes(message_93) == bytes(get_farmer_response) + message_93 = type(post_partial_response).from_bytes(message_bytes) + assert message_93 == post_partial_response + assert bytes(message_93) == bytes(post_partial_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_94 = type(post_farmer_payload).from_bytes(message_bytes) - assert message_94 == post_farmer_payload - assert bytes(message_94) == bytes(post_farmer_payload) + message_94 = type(get_farmer_response).from_bytes(message_bytes) + assert message_94 == get_farmer_response + assert bytes(message_94) == bytes(get_farmer_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_95 = type(post_farmer_request).from_bytes(message_bytes) - assert message_95 == post_farmer_request - assert bytes(message_95) == bytes(post_farmer_request) + message_95 = type(post_farmer_payload).from_bytes(message_bytes) + assert message_95 == post_farmer_payload + assert bytes(message_95) == bytes(post_farmer_payload) message_bytes, input_bytes = parse_blob(input_bytes) - message_96 = type(post_farmer_response).from_bytes(message_bytes) - assert message_96 == post_farmer_response - assert bytes(message_96) == bytes(post_farmer_response) + message_96 = type(post_farmer_request).from_bytes(message_bytes) + assert message_96 == post_farmer_request + assert bytes(message_96) == bytes(post_farmer_request) message_bytes, input_bytes = parse_blob(input_bytes) - message_97 = type(put_farmer_payload).from_bytes(message_bytes) - assert message_97 == put_farmer_payload - assert bytes(message_97) == bytes(put_farmer_payload) + message_97 = type(post_farmer_response).from_bytes(message_bytes) + assert message_97 == post_farmer_response + assert bytes(message_97) == bytes(post_farmer_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_98 = type(put_farmer_request).from_bytes(message_bytes) - assert message_98 == put_farmer_request - assert bytes(message_98) == bytes(put_farmer_request) + message_98 = type(put_farmer_payload).from_bytes(message_bytes) + assert message_98 == put_farmer_payload + assert bytes(message_98) == bytes(put_farmer_payload) message_bytes, input_bytes = parse_blob(input_bytes) - message_99 = type(put_farmer_response).from_bytes(message_bytes) - assert message_99 == put_farmer_response - assert bytes(message_99) == bytes(put_farmer_response) + message_99 = type(put_farmer_request).from_bytes(message_bytes) + assert message_99 == put_farmer_request + assert bytes(message_99) == bytes(put_farmer_request) message_bytes, input_bytes = parse_blob(input_bytes) - message_100 = type(error_response).from_bytes(message_bytes) - assert message_100 == error_response - assert bytes(message_100) == bytes(error_response) + message_100 = type(put_farmer_response).from_bytes(message_bytes) + assert message_100 == put_farmer_response + assert bytes(message_100) == bytes(put_farmer_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_101 = type(new_peak_timelord).from_bytes(message_bytes) - assert message_101 == new_peak_timelord - assert bytes(message_101) == bytes(new_peak_timelord) + message_101 = type(error_response).from_bytes(message_bytes) + assert message_101 == error_response + assert bytes(message_101) == bytes(error_response) message_bytes, input_bytes = parse_blob(input_bytes) - message_102 = type(new_unfinished_block_timelord).from_bytes(message_bytes) - assert message_102 == new_unfinished_block_timelord - assert bytes(message_102) == bytes(new_unfinished_block_timelord) + message_102 = type(new_peak_timelord).from_bytes(message_bytes) + assert message_102 == new_peak_timelord + assert bytes(message_102) == bytes(new_peak_timelord) message_bytes, input_bytes = parse_blob(input_bytes) - message_103 = type(new_infusion_point_vdf).from_bytes(message_bytes) - assert message_103 == new_infusion_point_vdf - assert bytes(message_103) == bytes(new_infusion_point_vdf) + message_103 = type(new_unfinished_block_timelord).from_bytes(message_bytes) + assert message_103 == new_unfinished_block_timelord + assert bytes(message_103) == bytes(new_unfinished_block_timelord) message_bytes, input_bytes = parse_blob(input_bytes) - message_104 = type(new_signage_point_vdf).from_bytes(message_bytes) - assert message_104 == new_signage_point_vdf - assert bytes(message_104) == bytes(new_signage_point_vdf) + message_104 = type(new_infusion_point_vdf).from_bytes(message_bytes) + assert message_104 == new_infusion_point_vdf + assert bytes(message_104) == bytes(new_infusion_point_vdf) message_bytes, input_bytes = parse_blob(input_bytes) - message_105 = type(new_end_of_sub_slot_bundle).from_bytes(message_bytes) - assert message_105 == new_end_of_sub_slot_bundle - assert bytes(message_105) == bytes(new_end_of_sub_slot_bundle) + message_105 = type(new_signage_point_vdf).from_bytes(message_bytes) + assert message_105 == new_signage_point_vdf + assert bytes(message_105) == bytes(new_signage_point_vdf) message_bytes, input_bytes = parse_blob(input_bytes) - message_106 = type(request_compact_proof_of_time).from_bytes(message_bytes) - assert message_106 == request_compact_proof_of_time - assert bytes(message_106) == bytes(request_compact_proof_of_time) + message_106 = type(new_end_of_sub_slot_bundle).from_bytes(message_bytes) + assert message_106 == new_end_of_sub_slot_bundle + assert bytes(message_106) == bytes(new_end_of_sub_slot_bundle) message_bytes, input_bytes = parse_blob(input_bytes) - message_107 = type(respond_compact_proof_of_time).from_bytes(message_bytes) - assert message_107 == respond_compact_proof_of_time - assert bytes(message_107) == bytes(respond_compact_proof_of_time) + message_107 = type(request_compact_proof_of_time).from_bytes(message_bytes) + assert message_107 == request_compact_proof_of_time + assert bytes(message_107) == bytes(request_compact_proof_of_time) message_bytes, input_bytes = parse_blob(input_bytes) - message_108 = type(error_without_data).from_bytes(message_bytes) - assert message_108 == error_without_data - assert bytes(message_108) == bytes(error_without_data) + message_108 = type(respond_compact_proof_of_time).from_bytes(message_bytes) + assert message_108 == respond_compact_proof_of_time + assert bytes(message_108) == bytes(respond_compact_proof_of_time) message_bytes, input_bytes = parse_blob(input_bytes) - message_109 = type(error_with_data).from_bytes(message_bytes) - assert message_109 == error_with_data - assert bytes(message_109) == bytes(error_with_data) + message_109 = type(error_without_data).from_bytes(message_bytes) + assert message_109 == error_without_data + assert bytes(message_109) == bytes(error_without_data) + + message_bytes, input_bytes = parse_blob(input_bytes) + message_110 = type(error_with_data).from_bytes(message_bytes) + assert message_110 == error_with_data + assert bytes(message_110) == bytes(error_with_data) + + message_bytes, input_bytes = parse_blob(input_bytes) + message_111 = type(solver_info).from_bytes(message_bytes) + assert message_111 == solver_info + assert bytes(message_111) == bytes(solver_info) + + message_bytes, input_bytes = parse_blob(input_bytes) + message_112 = type(solver_response).from_bytes(message_bytes) + assert message_112 == solver_response + assert bytes(message_112) == bytes(solver_response) assert input_bytes == b"" diff --git a/chia/_tests/util/test_network_protocol_json.py b/chia/_tests/util/test_network_protocol_json.py index 3acb9240a83e..cea4321ed030 100644 --- a/chia/_tests/util/test_network_protocol_json.py +++ b/chia/_tests/util/test_network_protocol_json.py @@ -18,6 +18,8 @@ def test_protocol_json() -> None: assert type(farming_info).from_json_dict(farming_info_json) == farming_info assert str(signed_values_json) == str(signed_values.to_json_dict()) assert type(signed_values).from_json_dict(signed_values_json) == signed_values + assert str(partial_proof_json) == str(partial_proof.to_json_dict()) + assert type(partial_proof).from_json_dict(partial_proof_json) == partial_proof assert str(new_peak_json) == str(new_peak.to_json_dict()) assert type(new_peak).from_json_dict(new_peak_json) == new_peak assert str(new_transaction_json) == str(new_transaction.to_json_dict()) @@ -265,3 +267,7 @@ def test_protocol_json() -> None: assert type(error_without_data).from_json_dict(error_without_data_json) == error_without_data assert str(error_with_data_json) == str(error_with_data.to_json_dict()) assert type(error_with_data).from_json_dict(error_with_data_json) == error_with_data + assert str(solver_info_json) == str(solver_info.to_json_dict()) + assert type(solver_info).from_json_dict(solver_info_json) == solver_info + assert str(solver_response_json) == str(solver_response.to_json_dict()) + assert type(solver_response).from_json_dict(solver_response_json) == solver_response