-
Notifications
You must be signed in to change notification settings - Fork 2k
/
harvester_protocol.py
75 lines (53 loc) · 1.33 KB
/
harvester_protocol.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from dataclasses import dataclass
from blspy import PrependSignature, PublicKey
from src.types.proof_of_space import ProofOfSpace
from src.types.sized_bytes import bytes32
from src.util.cbor_message import cbor_message
from src.util.ints import uint8
from src.util.streamable import List
"""
Protocol between harvester and farmer.
"""
@dataclass(frozen=True)
@cbor_message
class HarvesterHandshake:
pool_pubkeys: List[PublicKey]
@dataclass(frozen=True)
@cbor_message
class NewChallenge:
challenge_hash: bytes32
@dataclass(frozen=True)
@cbor_message
class ChallengeResponse:
challenge_hash: bytes32
quality: bytes32
plot_size: uint8
@dataclass(frozen=True)
@cbor_message
class RequestProofOfSpace:
quality: bytes32
@dataclass(frozen=True)
@cbor_message
class RespondProofOfSpace:
quality: bytes32
proof: ProofOfSpace
@dataclass(frozen=True)
@cbor_message
class RequestHeaderSignature:
quality: bytes32
header_hash: bytes32
@dataclass(frozen=True)
@cbor_message
class RespondHeaderSignature:
quality: bytes32
header_hash_signature: PrependSignature
@dataclass(frozen=True)
@cbor_message
class RequestPartialProof:
quality: bytes32
farmer_target_hash: bytes32
@dataclass(frozen=True)
@cbor_message
class RespondPartialProof:
quality: bytes32
farmer_target_signature: PrependSignature