|
7 | 7 |
|
8 | 8 | from pyjamaz.exceptions import BlockValidationError |
9 | 9 |
|
10 | | -from jamcodec.types import H256, U32, Option, Vec, Array, U8, U16, Bool, H512, Bytes, BitArray, Tuple |
| 10 | +from jamcodec.types import H256, U32, Option, Vec, Array, U8, U16, Bool, H512, Bytes, BitArray, Tuple, VarInt64 |
11 | 11 | from pyjamaz.graypaper_constants import VALIDATOR_COUNT, EPOCH_TIMESLOTS, CORE_COUNT |
12 | 12 | from pyjamaz.hashing import blake2b_256_hash |
13 | 13 | from pyjamaz.models.common import WorkReport, TicketBody, ValidatorData |
@@ -44,19 +44,15 @@ class TicketEnvelope(Serializable): |
44 | 44 |
|
45 | 45 | Attributes |
46 | 46 | ---------- |
47 | | - attempt: U8 |
| 47 | + attempt: VarInt64 |
48 | 48 | GP-0.7.2-eq:6.29 (e) | An entry index |
49 | 49 | signature: Array(U8,784) |
50 | 50 | GP-0.7.2-eq:6.29 (p) | Proof of a ticket's validity |
51 | 51 | """ |
52 | | - attempt: int = field(metadata={'codec': U8}) |
| 52 | + attempt: int = field(metadata={'codec': VarInt64}) |
53 | 53 | signature: bytes = field(metadata={'codec': Array(U8, 784)}) |
54 | 54 |
|
55 | 55 | def __post_init__(self): |
56 | | - # Validate that attempt is a valid U8 integer |
57 | | - if not isinstance(self.attempt, int) or not (0 <= self.attempt <= 255): |
58 | | - raise BlockValidationError("Attempt must be an integer between 0 and 255") |
59 | | - |
60 | 56 | # Validate that signature is a valid ByteArray784 |
61 | 57 | if not isinstance(self.signature, (bytes, bytearray)) or len(self.signature) != 784: |
62 | 58 | raise BlockValidationError("Signature must be a bytes object of length 784") |
|
0 commit comments