jam.types.work.report module
Work report types for the JAM protocol.
- class jam.types.work.report.WorkExecResult(initial: Dict[str, Codable[T]] | Codable[T])[source]
Bases:
ChoiceWork execution result choice.
- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Choice, int]
Decode choice from buffer.
- Parameters:
types – List of possible types for this choice
buffer – Source buffer
offset – Starting offset
- Returns:
Tuple of (decoded value, bytes read)
- Raises:
DecodeError – If buffer is invalid or too short
ValueError – If types list is empty
- class jam.types.work.report.WorkResult(service_id: U32, code_hash: ByteArray32, payload_hash: ByteArray32, accumulate_gas: U64, result: WorkExecResult)[source]
-
Work result structure.
- code_hash: ByteArray32
- payload_hash: ByteArray32
- result: WorkExecResult
- __init__(service_id: U32, code_hash: ByteArray32, payload_hash: ByteArray32, accumulate_gas: U64, result: WorkExecResult) None
Initialize the Codable.
- Parameters:
codec – Optional codec to use for encoding/decoding
enc_sequence – Optional function that returns sequence of fields to encode
- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[T, int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.work.report.WorkPackageSpec(hash: ByteArray32, length: U32, erasure_root: ByteArray32, exports_root: ByteArray32, exports_count: U16)[source]
-
Work package specification structure.
- hash: ByteArray32
- erasure_root: ByteArray32
- exports_root: ByteArray32
- __init__(hash: ByteArray32, length: U32, erasure_root: ByteArray32, exports_root: ByteArray32, exports_count: U16) None
Initialize the Codable.
- Parameters:
codec – Optional codec to use for encoding/decoding
enc_sequence – Optional function that returns sequence of fields to encode
- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[T, int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.work.report.SegmentRootLookupItem(work_package_hash: ByteArray32, segment_tree_root: ByteArray32)[source]
-
Segment root lookup item structure.
- work_package_hash: ByteArray32
- segment_tree_root: ByteArray32
- __init__(work_package_hash: ByteArray32, segment_tree_root: ByteArray32) None
Initialize the Codable.
- Parameters:
codec – Optional codec to use for encoding/decoding
enc_sequence – Optional function that returns sequence of fields to encode
- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[T, int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.work.report.SegmentRootLookup(initial: Sequence[T] = [], codec: Codec[T] | None = None)[source]
Bases:
Vector[SegmentRootLookupItem]- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Vector[T], int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.work.report.WorkResults(initial: Sequence[T] = [], codec: Codec[T] | None = None)[source]
Bases:
Vector[WorkResult]- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Vector[T], int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing
- class jam.types.work.report.WorkReport(package_spec: WorkPackageSpec, context: RefineContext, core_index: U16, authorizer_hash: ByteArray32, auth_output: Bytes, segment_root_lookup: SegmentRootLookup, results: WorkResults)[source]
-
Work report structure.
- package_spec: WorkPackageSpec
- context: RefineContext
- authorizer_hash: ByteArray32
- segment_root_lookup: SegmentRootLookup
- results: WorkResults
- __init__(package_spec: WorkPackageSpec, context: RefineContext, core_index: U16, authorizer_hash: ByteArray32, auth_output: Bytes, segment_root_lookup: SegmentRootLookup, results: WorkResults) None
Initialize the Codable.
- Parameters:
codec – Optional codec to use for encoding/decoding
enc_sequence – Optional function that returns sequence of fields to encode
- static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[T, int]
Decode from buffer. Must be implemented by subclasses or added via decorator.
- Parameters:
buffer – Buffer to decode from
offset – Starting position in buffer
- Returns:
The decoded value
Number of bytes read
- Return type:
Tuple containing