Expand description
JAM types used within the PVM instances (service code and authorizer code).
Macros§
Structs§
- AnyBytes
- Non usage-specific data.
- Auth
Config - Authorization parameter.
- Auth
Queue Len - Number of authorizations in a queue allocated to a core.
- Auth
Trace - Output data of Is Authorized operation, passed into both Refinement and Accumulation.
- Auth
Window - 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.
- Authorizer
Hash - Hash of an encoded Authorizer value.
- Code
Hash - Hash of PVM program code.
- Core
Count - Number of cores in the JAM.
- Epoch
Period - The epoch period, defined in number of slots.
- Extrinsic
Hash - Hash of a piece of extrinsic data.
- Extrinsic
Spec - Specification of a single piece of extrinsic data.
- Fixed
Vec - Vector type with a fixed length.
- Header
Hash - Hash of an encoded block header.
- Import
Spec - Import segments specification, which identifies a single exported segment.
- Invoke
Args - Args for invoking an inner PVM.
- MaxDependencies
- Maximum number of dependencies (total of prerequisites and SR lookup entries).
- MaxExport
Segments - Maximum number of DA segments that a Work Package can produce.
- MaxImport
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.
- MaxImports
- Maximum number of imports in a Work Package.
- MaxTickets
PerBlock - Max tickets allowed to be embedded in each block extrinsic.
- MaxWork
Items - Maximum number of Work Items in a Work Package.
- Memo
- Transfer memo data, included with balance transfers between services.
- NoWrap
- No-op
Wrap. - Opaque
Bandersnatch Public - Plain-old-data struct of the same length as an encoded Bandersnatch public key.
- Opaque
BlsPublic - Plain-old-data struct of the same length as an encoded BLS public key.
- Opaque
Ed25519 Public - Plain-old-data struct of the same length as an encoded Ed25519 public key.
- Opaque
ValKeyset - Plain-old-data struct of the same length and layout to
ValKeysetstruct. This does not bring in any cryptography. - Opaque
Validator Metadata - Additional information on a validator, opaque to the actual usage.
- Payload
Hash - Hash of a Work Item’s WorkPayload.
- Protocol
Parameters - Baseline parameters for the JAM protocol.
- Recent
Block Count - The number of blocks which are kept in the recent block cache. We use a
u8to index into this and therefore it may be no larger than 255. - Refine
Context - Various pieces of information helpful to contextualize the Refinement process.
- Segment
Hash - Hash of a Segment value.
- Segment
Len - Number of bytes in a segment. This is fixed.
- Segment
Slice Len - Returns the number of bytes in a segment slice.
- Segment
Tree Root - Hash of a segment tree root node.
- Service
Info - Information concerning a particular service’s state.
- Tickets
Attempts Number - Maximum number of tickets which each validator may create.
- Transfer
Record - 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.
- Work
Item - A definition of work to be done by the Refinement logic of a service and transformed into a WorkOutput for its Accumulation logic.
- Work
Item Record - The result and surrounding context of a single Refinement operation passed in to the Accumulation logic.
- Work
Item Summary - Work item summary information used by fetch host call.
- Work
Output - Output data of Refinement operation, passed into Accumulation.
- Work
Package Hash - Hash of an encoded Work Package.
- Work
Payload - Payload data defining a Work Item.
- Wrapped
Work Package - 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§
- Accumulate
Item - Accumulate item.
- Fetch
Kind - Fetch host calls variants identifiers.
- Page
Mode - Page access mode.
- Page
Operation - Page operation.
- Root
Identifier - 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§
- Bounded
Map - 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
Wrapimplementation 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
AvailabletoZombie, and then again fromZombieto 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
u8to 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§
- Auth
Queue - A queue of AuthorizerHashs, each of which will be rotated into the authorizer pool for a core.
- Balance
- Type to represent a balance.
- Core
Index - Type to represent the index of a compute core.
- Hash
- A basic 256-bit data value.
- Opaque
ValKeysets - The opaque keys for each validator.
- Segment
- A segment of data.
- Service
Id - Type to represent the index of a service.
- Signed
Gas - Type to represent some gas which may be below zero. This is used primarily for the
invokehostcall 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.
- Ticket
Attempt - Index for an attempt at producing a ticket for the right to produce a block.
- ValIndex
- Type to represent the index of a validator.
- Work
Item Imports Vec - A sequence of import specifications.
- Work
Package - 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.