jam_types/
lib.rs

1//! JAM types used within the PVM instances (service code and authorizer code).
2
3#![cfg_attr(not(feature = "std"), no_std)]
4
5extern crate alloc;
6
7#[doc(hidden)]
8#[cfg(not(feature = "std"))]
9pub use core::{
10	clone::Clone,
11	cmp::{Eq, PartialEq},
12	fmt,
13	fmt::Debug,
14	option::Option,
15	prelude::rust_2021::derive,
16	result::Result,
17};
18
19#[doc(hidden)]
20pub use scale::{Decode, Encode, MaxEncodedLen};
21
22#[doc(hidden)]
23#[cfg(not(feature = "std"))]
24pub use alloc::vec::Vec;
25#[doc(hidden)]
26pub use bounded_collections::BoundedVec;
27#[doc(hidden)]
28#[cfg(feature = "std")]
29pub use std::vec::Vec;
30
31mod fixed_vec;
32mod program_blob;
33mod simple;
34mod simple_result_code;
35mod types;
36mod vec_map;
37mod vec_set;
38
39mod opaque;
40
41pub use fixed_vec::{BoundedMap, FixedVec};
42pub use simple::{
43	AuthOutput, AuthParam, AuthQueue, Authorization, AuthorizerHash, Balance, CodeHash, CoreIndex,
44	ExtrinsicHash, Gas, Hash, HeaderHash, Memo, OpaqueBandersnatchPublic, OpaqueEd25519Public,
45	OpaqueValidatorMetadata, PayloadHash, Segment, SegmentHash, SegmentTreeRoot, ServiceId, Slot,
46	ValIndex, WorkOutput, WorkPackageHash, WorkPayload, AUTH_QUEUE_LEN, CHUNKS_PER_SEGMENT,
47	CHUNK_LEN, CHUNK_POINTS, MAX_IMPORTS, MAX_WORK_ITEMS, MEMO_LEN, MIN_TURNAROUND_PERIOD,
48	POINT_LEN, SEGMENT_LEN, VAL_COUNT,
49};
50pub use vec_map::{MapLike, VecMap};
51pub use vec_set::{SetLike, VecSet};
52
53pub use types::{
54	AccumulateItem, Authorizer, ExtrinsicSpec, GenericWorkItem, GenericWorkItems,
55	GenericWorkPackage, ImportSpec, OpaqueValKeyset, OpaqueValKeysets, PackageInfo, RefineContext,
56	RootIdentifier, ServiceInfo, TransferRecord, WorkItem, WorkItemImportsVec, WorkPackage,
57};
58
59#[doc(hidden)]
60pub use simple::{
61	AccumulateRootHash, AnyHash, AnyVec, Bundle, Code, DoubleBalance, DoubleGas, MerkleNodeHash,
62	MmrPeakHash, StateRootHash, WorkReportHash, MAX_DEPENDENCIES, MAX_EXPORTS, MAX_INPUT,
63	SEGMENT_SLICE_LEN, VAL_SUPER_MAJORITY,
64};
65
66// Internal use: here and `jam-node` crates.
67#[doc(hidden)]
68pub mod hex;
69
70// Internal use: `jam-node` and `jam-pvm-builder` crates.
71#[doc(hidden)]
72pub use simple_result_code::{InvokeOutcomeCode, SimpleResult, SimpleResultCode, LOWEST_ERROR};
73
74// Internal use: `jam-node` and/or `jam-pvm-common` crates.
75// TODO: Anything only used in one or the other should be moved to the respective crate.
76#[doc(hidden)]
77pub use types::{
78	AccumulateParams, FatWorkItem, FatWorkPackage, OnTransferParams, OnTransferParamsRef,
79	RefWorkItem, RefWorkPackage, RefineParams, RefineParamsRef, WorkError, WorkItems, WorkResult,
80};
81
82// TODO: Remove this into jam-pvm-builder
83#[doc(hidden)]
84pub use program_blob::ProgramBlob;
85
86// TODO: Split out anything which is strictly needed for `jam-pvm-common` and for the rest, move to
87// `jam-node`
88mod pvm;
89#[doc(hidden)]
90pub use pvm::*;