jam_types/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! JAM types used within the PVM instances (service code and authorizer code).

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

#[doc(hidden)]
#[cfg(not(feature = "std"))]
pub use core::{
	clone::Clone,
	cmp::{Eq, PartialEq},
	fmt,
	fmt::Debug,
	option::Option,
	prelude::rust_2021::derive,
	result::Result,
};

#[doc(hidden)]
pub use scale::{Decode, Encode, MaxEncodedLen};

#[doc(hidden)]
#[cfg(not(feature = "std"))]
pub use alloc::vec::Vec;
#[doc(hidden)]
pub use bounded_collections::BoundedVec;
#[doc(hidden)]
#[cfg(feature = "std")]
pub use std::vec::Vec;

mod fixed_vec;
mod program_blob;
mod simple;
mod simple_result_code;
mod types;
mod vec_map;
mod vec_set;

mod opaque;

pub use fixed_vec::{BoundedMap, FixedVec};
pub use simple::{
	AuthOutput, AuthParam, AuthQueue, Authorization, AuthorizerHash, Balance, CodeHash, CoreIndex,
	ExtrinsicHash, Gas, Hash, HeaderHash, Memo, OpaqueBandersnatchPublic, OpaqueEd25519Public,
	OpaqueValidatorMetadata, PayloadHash, Segment, SegmentHash, SegmentTreeRoot, ServiceId, Slot,
	ValIndex, WorkOutput, WorkPackageHash, WorkPayload, AUTH_QUEUE_LEN, CHUNKS_PER_SEGMENT,
	CHUNK_LEN, CHUNK_POINTS, MAX_IMPORTS, MAX_WORK_ITEMS, MEMO_LEN, MIN_TURNAROUND_PERIOD,
	POINT_LEN, SEGMENT_LEN, VAL_COUNT,
};
pub use vec_map::{MapLike, VecMap};
pub use vec_set::{SetLike, VecSet};

pub use types::{
	AccumulateItem, Authorizer, ExtrinsicSpec, GenericWorkItem, GenericWorkItems,
	GenericWorkPackage, ImportSpec, OpaqueValKeyset, OpaqueValKeysets, PackageInfo, RefineContext,
	RootIdentifier, ServiceInfo, TransferRecord, WorkItem, WorkItemImportsVec, WorkPackage,
};

#[doc(hidden)]
pub use simple::{
	AccumulateRootHash, AnyHash, AnyVec, Bundle, Code, DoubleBalance, DoubleGas, MerkleNodeHash,
	MmrPeakHash, StateRootHash, WorkReportHash, MAX_DEPENDENCIES, MAX_EXPORTS, MAX_INPUT,
	SEGMENT_SLICE_LEN, VAL_SUPER_MAJORITY,
};

// Internal use: here and `jam-node` crates.
#[doc(hidden)]
pub mod hex;

// Internal use: `jam-node` and `jam-pvm-builder` crates.
#[doc(hidden)]
pub use simple_result_code::{InvokeOutcomeCode, SimpleResult, SimpleResultCode, LOWEST_ERROR};

// Internal use: `jam-node` and/or `jam-pvm-common` crates.
// TODO: Anything only used in one or the other should be moved to the respective crate.
#[doc(hidden)]
pub use types::{
	AccumulateParams, FatWorkItem, FatWorkPackage, OnTransferParams, OnTransferParamsRef,
	RefWorkItem, RefWorkPackage, RefineParams, RefineParamsRef, WorkError, WorkItems, WorkResult,
};

// TODO: Remove this into jam-pvm-builder
#[doc(hidden)]
pub use program_blob::ProgramBlob;

// TODO: Split out anything which is strictly needed for `jam-pvm-common` and for the rest, move to
// `jam-node`
mod pvm;
#[doc(hidden)]
pub use pvm::*;