Skip to content

Commit d3e530a

Browse files
committed
remove strangth from SolverInfo
1 parent b240f98 commit d3e530a

12 files changed

+20
-43
lines changed

chia/_tests/solver/test_solver_service.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import pytest
77
from chia_rs import ConsensusConstants
8-
from chia_rs.sized_ints import uint64
98

109
from chia.protocols.outbound_message import Message
1110
from chia.protocols.solver_protocol import SolverInfo
@@ -23,7 +22,7 @@ async def test_solver_api_methods(blockchain_constants: ConsensusConstants, tmp_
2322
solver = solver_service._node
2423
solver_api = solver_service._api
2524
assert solver_api.ready() is True
26-
test_info = SolverInfo(plot_strength=uint64(1500), partial_proof=b"test_partial_proof_42")
25+
test_info = SolverInfo(partial_proof=b"test_partial_proof_42")
2726
expected_proof = b"test_proof_data_12345"
2827
with patch.object(solver, "solve", return_value=expected_proof):
2928
api_result = await solver_api.solve(test_info)
@@ -49,7 +48,7 @@ async def test_solver_error_handling(
4948
pass # expected
5049
# test solver handles exception in solve method
5150
solver = solver_service._node
52-
test_info = SolverInfo(plot_strength=uint64(1000), partial_proof=b"test_partial_proof_zeros")
51+
test_info = SolverInfo(partial_proof=b"test_partial_proof_zeros")
5352
with patch.object(solver, "solve", side_effect=RuntimeError("test error")):
5453
# solver api should handle exceptions gracefully
5554
result = await solver_service._api.solve(test_info)

chia/_tests/util/network_protocol_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,6 @@
11061106
)
11071107

11081108
# SOLVER PROTOCOL
1109-
solver_info = solver_protocol.SolverInfo(uint64(2), b"partial-proof")
1109+
solver_info = solver_protocol.SolverInfo(partial_proof=b"partial-proof")
11101110

11111111
solver_response = solver_protocol.SolverResponse(b"partial-proof", b"full-proof")
-8 Bytes
Binary file not shown.

chia/_tests/util/protocol_messages_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,7 @@
27152715

27162716
error_with_data_json: dict[str, Any] = {"code": 1, "message": "Unknown", "data": "0x65787472612064617461"}
27172717

2718-
solver_info_json: dict[str, Any] = {"plot_strength": 2, "partial_proof": "0x7061727469616c2d70726f6f66"}
2718+
solver_info_json: dict[str, Any] = {"partial_proof": "0x7061727469616c2d70726f6f66"}
27192719

27202720
solver_response_json: dict[str, Any] = {
27212721
"partial_proof": "0x7061727469616c2d70726f6f66",

chia/cmds/solver_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def solve_quality(
3131
"""Solve a quality string via RPC."""
3232
try:
3333
async with get_any_service_client(SolverRpcClient, ctx.root_path, solver_rpc_port) as (client, _):
34-
response = await client.solve(quality_hex, plot_size, difficulty)
34+
response = await client.solve(quality_hex)
3535
print(json.dumps(response, indent=2))
3636
except Exception as e:
3737
print(f"Failed to solve quality: {e}")

chia/farmer/farmer_api.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,7 @@ async def partial_proofs(self, partial_proof_data: PartialProofsData, peer: WSCh
505505

506506
# Process each quality chain through solver service to get full proofs
507507
for partial_proof in partial_proof_data.partial_proofs:
508-
solver_info = SolverInfo(
509-
plot_strength=partial_proof_data.difficulty,
510-
partial_proof=partial_proof,
511-
)
508+
solver_info = SolverInfo(partial_proof=partial_proof)
512509

513510
try:
514511
# store pending request data for matching with response

chia/harvester/harvester_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def blocking_lookup_v2_partial_proofs(filename: Path, plot_info: PlotInfo) -> Op
124124
partial_proofs = plot_info.prover.get_partial_proofs_for_challenge(sp_challenge_hash)
125125

126126
# If no partial proofs are found, return None
127-
if partial_proofs is None or len(partial_proofs) == 0:
127+
if len(partial_proofs) == 0:
128128
return None
129129

130130
# Get the appropriate difficulty for this plot

chia/protocols/solver_protocol.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22

33
from dataclasses import dataclass
44

5-
from chia_rs.sized_ints import uint64
6-
75
from chia.util.streamable import Streamable, streamable
86

97

108
@streamable
119
@dataclass(frozen=True)
1210
class SolverInfo(Streamable):
13-
plot_strength: uint64
1411
partial_proof: bytes # 16 * k bits blob, k (plot size) can be derived from this
1512

1613

chia/solver/solver.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from chia_rs import ConsensusConstants
1212

1313
from chia.protocols.outbound_message import NodeType
14-
from chia.protocols.solver_protocol import SolverInfo
1514
from chia.rpc.rpc_server import StateChangedProtocol, default_get_connections
1615
from chia.server.server import ChiaServer
1716
from chia.server.ws_connection import WSChiaConnection
@@ -66,8 +65,8 @@ async def manage(self) -> AsyncIterator[None]:
6665
self.executor.shutdown(wait=True)
6766
self.log.info("Solver service shutdown complete")
6867

69-
def solve(self, info: SolverInfo) -> Optional[bytes]:
70-
self.log.debug(f"Solve request: quality={info.partial_proof.hex()}")
68+
def solve(self, partial_proof: bytes) -> Optional[bytes]:
69+
self.log.debug(f"Solve request: quality={partial_proof.hex()}")
7170
# TODO todo_v2_plots implement actualy calling the solver
7271
return None
7372

chia/solver/solver_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ async def solve(
3333
request: SolverInfo,
3434
) -> Optional[Message]:
3535
"""
36-
Solve a V2 plot quality to get the full proof of space.
37-
This is called by the farmer when it receives V2 qualities from harvester.
36+
Solve a V2 plot partial proof to get the full proof of space.
37+
This is called by the farmer when it receives V2 parital proofs from harvester.
3838
"""
3939
if not self.solver.started:
4040
self.log.error("Solver is not started")
4141
return None
4242

43-
self.log.debug(f"Solving quality {request.partial_proof.hex()}with difficulty {request.plot_strength}")
43+
self.log.debug(f"Solving partial {request.partial_proof.hex()}")
4444

4545
try:
46-
proof = self.solver.solve(request)
46+
proof = self.solver.solve(request.partial_proof)
4747
if proof is None:
48-
self.log.warning(f"Solver returned no proof for quality {request.partial_proof.hex()}")
48+
self.log.warning(f"Solver returned no proof for parital {request.partial_proof.hex()}")
4949
return None
5050

51-
self.log.debug(f"Successfully solved quality, returning {len(proof)} byte proof")
51+
self.log.debug(f"Successfully solved partial proof, returning {len(proof)} byte proof")
5252
return make_msg(
5353
ProtocolMessageTypes.solution_response,
5454
SolverResponse(proof=proof, partial_proof=request.partial_proof),
5555
)
5656

5757
except Exception as e:
58-
self.log.error(f"Error solving quality {request.partial_proof.hex()}: {e}")
58+
self.log.error(f"Error solving parital {request.partial_proof.hex()}: {e}")
5959
return None

0 commit comments

Comments
 (0)