Documentation
¶
Index ¶
- Constants
- func BumpIndex(serviceIndex block.ServiceId) block.ServiceId
- func CheckIndex(serviceIndex block.ServiceId, serviceState ServiceState) block.ServiceId
- func DeriveIndex(serviceIndex block.ServiceId, serviceState ServiceState) block.ServiceId
- type CodeWithMetadata
- type DeferredTransfer
- type Memo
- type PreImageMetaKey
- type PreimageHistoricalTimeslots
- type PreimageLength
- type PrivilegedServices
- type ServiceAccount
- func (sa ServiceAccount) AddPreimage(p []byte, currentTimeslot jamtime.Timeslot) error
- func (sa ServiceAccount) Clone() ServiceAccount
- func (sa ServiceAccount) EncodedCodeAndMetadata() []byte
- func (sa ServiceAccount) LookupPreimage(t jamtime.Timeslot, h crypto.Hash) []byte
- func (sa ServiceAccount) ThresholdBalance() uint64
- func (sa ServiceAccount) TotalItems() uint32
- func (sa ServiceAccount) TotalStorageSize() uint64
- type ServiceState
Constants ¶
const ( BasicMinimumBalance = 100 // (BS) The basic minimum balance which all services require. AdditionalMinimumBalancePerItem = 10 // (BI) The additional minimum balance required per item of elective service state. AdditionalMinimumBalancePerOctet = 1 // (BL) The additional minimum balance required per octet of elective service state. TransferMemoSizeBytes = 128 // (WT) Size of the transfer memo in bytes. TotalGasAccumulation = 341_000_000 // GT = 341,000,000: Total gas allocated across all cores for Accumulation )
Variables ¶
This section is empty.
Functions ¶
func CheckIndex ¶
func CheckIndex(serviceIndex block.ServiceId, serviceState ServiceState) block.ServiceId
CheckIndex Equation B.13 (v0.5.4): checks if the identifier is unique across all services
func DeriveIndex ¶
func DeriveIndex(serviceIndex block.ServiceId, serviceState ServiceState) block.ServiceId
Types ¶
type CodeWithMetadata ¶
type DeferredTransfer ¶
type DeferredTransfer struct {
SenderServiceIndex block.ServiceId // sender service index (s)
ReceiverServiceIndex block.ServiceId // receiver service index (d)
Balance uint64 // balance value (a)
Memo Memo // memo (m)
GasLimit uint64 // gas limit (g)
}
DeferredTransfer Equation (12.14 v0.5.0): T ≡ (s ∈ Ns, d ∈ Ns, a ∈ Nb, m ∈ Ym, g ∈ Ng)
type Memo ¶
type Memo [TransferMemoSizeBytes]byte
type PreImageMetaKey ¶
type PreImageMetaKey struct {
Hash crypto.Hash // Hash of the preimage ()
Length PreimageLength // Length (presupposed) of the preimage ()
}
type PreimageLength ¶
type PreimageLength uint32
type PrivilegedServices ¶
type PrivilegedServices struct {
ManagerServiceId block.ServiceId // Manager service ID (m) - the service able to effect an alteration of PrivilegedServices from block to block. Also called Empower service.
AssignServiceId block.ServiceId // Assign service ID (a) - the service able to effect an alteration of the PendingAuthorizersQueues.
DesignateServiceId block.ServiceId // Designate service ID (v) - the service able to effect an alteration of the NextValidators in ValidatorState.
AmountOfGasPerServiceId map[block.ServiceId]uint64 // Amount of gas per service ID (g) - small dictionary containing the indices of services which automatically accumulate in each block together with a basic amount of gas with which each accumulates.
}
type ServiceAccount ¶
type ServiceAccount struct {
// Storage uses a state key for it's key. We have to use the state key
// representation as the key because serializing storage keys is lossy and
// we'd like to be able to deserialize the storage dictionary later. Host
// calls are called by PVM code code with the original storage key. The key
// we end up using is merely an implementation detail. As long as we can
// store and retrieve the key we are fine, we don't need to know the
// original key here.
Storage map[statekey.StateKey][]byte // Dictionary of key-value pairs for storage (s)
PreimageLookup map[crypto.Hash][]byte // Dictionary of preimage lookups (p)
PreimageMeta map[PreImageMetaKey]PreimageHistoricalTimeslots // Metadata for preimageLookup (l) Graypaper 0.6.3 - TODO: There is a MaxTimeslotsForPreimage.
CodeHash crypto.Hash // Hash of the service code (c)
Balance uint64 // Balance of the service (b)
GasLimitForAccumulator uint64 // Gas limit for accumulation (g)
GasLimitOnTransfer uint64 // Gas limit for on_transfer (m)
}
ServiceAccount represents a service account in the JAM state
func (ServiceAccount) AddPreimage ¶
func (sa ServiceAccount) AddPreimage(p []byte, currentTimeslot jamtime.Timeslot) error
AddPreimage adds a preimage to the service account's preimage lookup and metadata (9.6 v0.5.0) ∀a ∈ A, (h ↦ p) ∈ ap ⇒ h = H(p) ∧ {h, |p|} ∈ K(al)
func (ServiceAccount) Clone ¶
func (sa ServiceAccount) Clone() ServiceAccount
Clone returns a deep copy of the service account
func (ServiceAccount) EncodedCodeAndMetadata ¶
func (sa ServiceAccount) EncodedCodeAndMetadata() []byte
EncodedCodeAndMetadata encoded code and metadata as per Equation (9.4 v0.6.3)
func (ServiceAccount) LookupPreimage ¶
LookupPreimage implements the historical lookup function (Λ) as defined in Equation (9.7 v0.5.4).
func (ServiceAccount) ThresholdBalance ¶
func (sa ServiceAccount) ThresholdBalance() uint64
ThresholdBalance (9.8 v0.6.5) ∀a ∈ V(δ): at
func (ServiceAccount) TotalItems ¶
func (sa ServiceAccount) TotalItems() uint32
TotalItems (9.8 v0.6.5) ∀a ∈ V(δ): ai
func (ServiceAccount) TotalStorageSize ¶
func (sa ServiceAccount) TotalStorageSize() uint64
TotalStorageSize (9.8 v0.6.5) ∀a ∈ V(δ): ao
type ServiceState ¶
type ServiceState map[block.ServiceId]ServiceAccount
func (ServiceState) Clone ¶
func (ss ServiceState) Clone() ServiceState