work

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxSizeServiceCode          = 4_000_000 // WC = 4,000,000: The maximum size of service code in octets.
	MaxNumberOfImports          = 3_072     // WM = 3,072: The maximum number of imports in a work-package
	MaxNumberOfExports                      // WX =  3,072: The maximum number of exports in a work-package
	MaxNumberOfItems            = 16        // I = 16: The maximum amount of work items in a package.
	MaxNumberOfDependencyItems  = 8         //J = 8 : The maximum sum of dependency items in a work-report
	MaxNumberOfExtrinsics       = 128       // T = 128: The maximum number of extrinsics in a work-package.
	SegmentsPerPage             = 64
	MaxSizeOfEncodedWorkPackage = 12 * 1 << 20  // WB = 12*2^20 = 12MB: The maximum size of an encoded work-package together with its extrinsic data and import implications, in octets.
	MaxAllocatedGasRefine       = 5_000_000_000 // GR = 5,000,000,000: The gas allocated to invoke a work-package’s Refine logic.
)

Variables

This section is empty.

Functions

func ZeroPadding

func ZeroPadding(x []byte, n uint) []byte

ZeroPadding Pn(. . . ) The octet-array zero-padding function (14.17 v0.5.2)

Types

type Extrinsic

type Extrinsic struct {
	Hash   crypto.Hash
	Length uint32
}

type ImportedSegment

type ImportedSegment struct {
	Hash  crypto.Hash
	Index uint16
}

type Item

type Item struct {
	ServiceId          block.ServiceId   // s ∈ N_S
	CodeHash           crypto.Hash       // h ∈ H
	Payload            []byte            // y ∈ Y
	GasLimitRefine     uint64            // g ∈ N_G
	GasLimitAccumulate uint64            // a ∈ N_G
	ImportedSegments   []ImportedSegment // i ∈ ⟦{H ∪ (H⊞), N}⟧
	Extrinsics         []Extrinsic       // x ∈ ⟦(H, N)⟧
	ExportedSegments   uint16            // e ∈ N
}

Item represents I (14.2 v0.5.4)

func (*Item) Size

func (w *Item) Size() uint64

func (*Item) ToWorkResult

func (w *Item) ToWorkResult(output block.WorkResultOutputOrError, gasUsed uint64) block.WorkResult

ToWorkResult item-to-result function C (14.8 v0.5.4)

type Package

type Package struct {
	AuthorizationToken []byte                  // j ∈ Y
	AuthorizerService  uint32                  // h ∈ N_S
	AuthCodeHash       crypto.Hash             // u ∈ H
	Parameterization   []byte                  // p ∈ Y
	Context            block.RefinementContext // x ∈ X
	WorkItems          []Item                  // w ∈ ⟦I⟧
}

Package represents P (14.2 v0.5.4)

func (*Package) ComputeAuthorizerHashes

func (wp *Package) ComputeAuthorizerHashes(
	serviceState service.ServiceState,
) (authorizationCode []byte, impliedAuthorizerHash crypto.Hash, err error)

ComputeAuthorizerHashes (14.9 v0.5.4)

func (*Package) GetAuthorizationCode

func (wp *Package) GetAuthorizationCode(serviceState service.ServiceState) ([]byte, error)

GetAuthorizationCode E(↕pm, pc) = Λ(δ[p.h], (p.x)^t, p.u) (14.9 v0.6.3)

func (*Package) ValidateGas

func (wp *Package) ValidateGas() error

ValidateGas (14.7 v0.5.4)

func (*Package) ValidateLimits

func (wp *Package) ValidateLimits() error

ValidateLimits (14.4 v0.6.3)

func (*Package) ValidateSize

func (wp *Package) ValidateSize() error

ValidateSize (14.5 v0.5.4)

type PackageBundle

type PackageBundle struct {
	// contains filtered or unexported fields
}

PackageBundle represents the auditable bundle

func (*PackageBundle) EncodedPackage

func (b *PackageBundle) EncodedPackage() ([]byte, error)

EncodedPackage returns the encoded package from cache if present, if not marshals it

func (*PackageBundle) ItemImportedSegments

func (b *PackageBundle) ItemImportedSegments(itemIndex int) ([]Segment, error)

ItemImportedSegments holds the actual segments for a work-item or the result of S(w ∈ I)

func (*PackageBundle) MarshalJAM

func (b *PackageBundle) MarshalJAM() ([]byte, error)

MarshalJAM returns the encoded bundle from cache if present and if not marshals the entire bundle and keeps it cached

func (*PackageBundle) Package

func (b *PackageBundle) Package() Package

func (*PackageBundle) UnmarshalJAM

func (b *PackageBundle) UnmarshalJAM(reader io.Reader) error

type PackageBundleBuilder

type PackageBundleBuilder struct {
	// contains filtered or unexported fields
}

func NewPackageBundleBuilder

func NewPackageBundleBuilder(pkg Package, segmentRootLookup map[crypto.Hash]crypto.Hash, importedSegments map[crypto.Hash][]Segment, extrinsics []byte) (*PackageBundleBuilder, error)

func (*PackageBundleBuilder) Build

func (b *PackageBundleBuilder) Build() (bundle *PackageBundle, err error)

type Segment

type Segment [common.SizeOfSegment]byte

Segment (G)

type SegmentRootLookup

type SegmentRootLookup map[crypto.Hash]crypto.Hash

func (SegmentRootLookup) Lookup

func (l SegmentRootLookup) Lookup(hash crypto.Hash) crypto.Hash

Lookup L(r ∈ H ∪ H⊞) ≡ r if r ∈ H; l[h] if r = h⊞ (14.12)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL