Crate jam_types

Crate jam_types 

Source
Expand description

JAM types used within the PVM instances (service code and authorizer code).

Macros§

chain_params

Structs§

AnyBytes
Non usage-specific data.
AuthConfig
Authorization parameter.
AuthQueueLen
Number of authorizations in a queue allocated to a core.
AuthTrace
Output data of Is Authorized operation, passed into both Refinement and Accumulation.
AuthWindow
Number of items in the authorization window.
Authorization
Data constituting the Authorization Token in a Work Package.
Authorizer
The authorizer tuple which together identifies a means of determining whether a Work Package is acceptable to execute on a core.
AuthorizerHash
Hash of an encoded Authorizer value.
CodeHash
Hash of PVM program code.
CoreCount
Number of cores in the JAM.
EpochPeriod
The epoch period, defined in number of slots.
ExtrinsicHash
Hash of a piece of extrinsic data.
ExtrinsicSpec
Specification of a single piece of extrinsic data.
FixedVec
Vector type with a fixed length.
HeaderHash
Hash of an encoded block header.
ImportSpec
Import segments specification, which identifies a single exported segment.
InvokeArgs
Args for invoking an inner PVM.
MaxDependencies
Maximum number of dependencies (total of prerequisites and SR lookup entries).
MaxExportSegments
Maximum number of DA segments that a Work Package can produce.
MaxImportSegments
Maximum number of DA segments that a Work Package can require as imports. This is twice the maximum number of imports because each import may require a proof segment.
MaxImports
Maximum number of imports in a Work Package.
MaxTicketsPerBlock
Max tickets allowed to be embedded in each block extrinsic.
MaxWorkItems
Maximum number of Work Items in a Work Package.
Memo
Transfer memo data, included with balance transfers between services.
NoWrap
No-op Wrap.
OpaqueBandersnatchPublic
Plain-old-data struct of the same length as an encoded Bandersnatch public key.
OpaqueBlsPublic
Plain-old-data struct of the same length as an encoded BLS public key.
OpaqueEd25519Public
Plain-old-data struct of the same length as an encoded Ed25519 public key.
OpaqueValKeyset
Plain-old-data struct of the same length and layout to ValKeyset struct. This does not bring in any cryptography.
OpaqueValidatorMetadata
Additional information on a validator, opaque to the actual usage.
PayloadHash
Hash of a Work Item’s WorkPayload.
ProtocolParameters
Baseline parameters for the JAM protocol.
RecentBlockCount
The number of blocks which are kept in the recent block cache. We use a u8 to index into this and therefore it may be no larger than 255.
RefineContext
Various pieces of information helpful to contextualize the Refinement process.
SegmentHash
Hash of a Segment value.
SegmentLen
Number of bytes in a segment. This is fixed.
SegmentSliceLen
Returns the number of bytes in a segment slice.
SegmentTreeRoot
Hash of a segment tree root node.
ServiceInfo
Information concerning a particular service’s state.
TicketsAttemptsNumber
Maximum number of tickets which each validator may create.
TransferRecord
A single deferred transfer of balance and/or data, passed in to the Accumulation logic.
ValCount
Total number of validators in the JAM.
VecMap
An mapping of key/value pairs stored as pairs ordered by their key in a Vec.
VecSet
An set of items stored in order in a Vec.
WorkItem
A definition of work to be done by the Refinement logic of a service and transformed into a WorkOutput for its Accumulation logic.
WorkItemRecord
The result and surrounding context of a single Refinement operation passed in to the Accumulation logic.
WorkItemSummary
Work item summary information used by fetch host call.
WorkOutput
Output data of Refinement operation, passed into Accumulation.
WorkPackageHash
Hash of an encoded Work Package.
WorkPayload
Payload data defining a Work Item.
WrappedWorkPackage
A work-package, a collection of work-items together with authorization and contextual information. This is processed in-core with Is-Authorized and Refine logic to produce a work-report.

Enums§

AccumulateItem
Accumulate item.
FetchKind
Fetch host calls variants identifiers.
PageMode
Page access mode.
PageOperation
Page operation.
RootIdentifier
Reference to a sequence of import segments, which when combined with an index forms a commitment to a specific segment of data.

Constants§

GP_VERSION
Version of the Gray Paper implemented by this and dependent crates.
JAM_COMMON_ERA
Beginning of the Jam “Common Era” (1200 UTC on January 1, 2025), as seconds after the Unix epoch, excluding leap seconds.
MEMO_LEN
Length of a transfer memo in bytes.
PAGE_SIZE
PolkaVM page size in bytes.
POINT_LEN
Number of bytes in an erasure-coding point.
PROVEN_PER_SEGMENT
The maximum number of segments whose justification can be included in a single segment-sized proof-page. Basically just the highest power of 2 which when multiplied by 32 (the size of a hash) leaves enough room from 4104 (the size of a segment) to fit a partial Merkle proof of 6 branches (6 * 32 = 192) plus the overhead for storing the actual number of hashes (should be one byte for PROVEN_PER_SEGMENT < 128). It turns out that this is 2^6 = 64.
SEGMENT_LEN
Number of bytes in a segment. This is fixed.
VALS_PER_CORE
The number of validators on each core.

Traits§

BoundedMap
Trait for vector types which have a bounded length allowing element-wise transformation.
Get
A trait for querying a single value from a type.
MapLike
A data-structure providing the storage and lookup of key/value pairs with exclusive keys.
SetLike
A data-structure providing the storage of non-duplicated items and the querying of their inclusion.
ToAny
ToAtomic
Wrap
A Wrap implementation provides a type constructor which “wraps” a type.

Functions§

auth_queue_len
Number of authorizations in a queue allocated to a core.
availability_timeout
The period in timeslots after which reported but unavailable work may be replaced.
basic_piece_len
Number of bytes in a basic EC piece.
basic_piece_points
Number of points in a piece.
block_gas_limit
The maximum gas which may be used in a single block. At present this is just the product of the maximum gas per work-report and the number of cores. In the future it should probably be more to account for the possibility of always-accumulate services.
core_count
Number of cores in the JAM.
deposit_per_account
deposit_per_byte
deposit_per_item
epoch_period
The epoch period, defined in number of slots.
epoch_tail_start
The length of the contest, defined in number of slots.
max_accumulate_gas
Maximum gas which may be used to Accumulate a single work-report.
max_authorizer_code_size
max_dependencies
Maximum number of dependencies (total of prerequisites and SR lookup entries).
max_export_segments
Maximum number of DA segments that a Work Package can produce.
max_exports
Maximum number of exports in a Work Package.
max_extrinsics
Maximum number of extrinsics in a Work Package.
max_import_segments
Maximum number of DA segments that a Work Package can require as imports. This is twice the maximum number of imports because each import may require a proof segment.
max_imports
Maximum number of imports in a Work Package.
max_input
Maximum size of a Work Package together with all extrinsic data and imported segments.
max_is_authorized_gas
Maximum gas which may be used to Authorize a single work-package.
max_lookup_anchor_age
Maximum age, in blocks, that the lookup anchor may be, taken from the regular anchor.
max_refine_gas
Maximum gas which may be used to Refine a single work-report.
max_report_elective_data
The maximum total size of all unbounded blobs in a work-report. Maximum age, in blocks, that the lookup anchor may be, taken from the regular anchor.
max_service_code_size
max_tickets_per_block
Max tickets allowed to be embedded in each block extrinsic.
max_work_items
Maximum number of Work Items in a Work Package.
min_turnaround_period
Minimum period in blocks between going from becoming Available to Zombie, and then again from Zombie to non-existent.
pieces_per_segment
Returns the number of pieces in a segment.
recent_block_count
The number of blocks which are kept in the recent block cache. We use a u8 to index into this and therefore it may be no larger than 255.
rotation_period
The rotation period, defined in number of slots.
segment_len
Number of bytes in a segment. This is fixed.
segment_slice_len
Returns the number of bytes in a segment slice.
slot_period_sec
Number of seconds in a time slot.
tickets_attempts_number
Maximum number of tickets which each validator may create.
val_count
Total number of validators in the JAM.

Type Aliases§

AuthQueue
A queue of AuthorizerHashs, each of which will be rotated into the authorizer pool for a core.
Balance
Type to represent a balance.
CoreIndex
Type to represent the index of a compute core.
Hash
A basic 256-bit data value.
OpaqueValKeysets
The opaque keys for each validator.
Segment
A segment of data.
ServiceId
Type to represent the index of a service.
SignedGas
Type to represent some gas which may be below zero. This is used primarily for the invoke hostcall API which must be able to return a negative gas amount in case of a gas overrun.
Slot
Type that represents a time slot of six seconds.
TicketAttempt
Index for an attempt at producing a ticket for the right to produce a block.
ValIndex
Type to represent the index of a validator.
WorkItemImportsVec
A sequence of import specifications.
WorkPackage
A work-package, a collection of work-items together with authorization and contextual information. This is processed in-core with Is-Authorized and Refine logic to produce a work-report.