Skip to content

ParachainSystem


Calls


authorize_upgrade

See [Pallet::authorize_upgrade].

Attributes

Name Type
code_hash T::Hash
check_version bool

Python

call = substrate.compose_call(
    'ParachainSystem', 'authorize_upgrade', {
    'check_version': 'bool',
    'code_hash': 'scale_info::12',
}
)

enact_authorized_upgrade

See [Pallet::enact_authorized_upgrade].

Attributes

Name Type
code Vec<u8>

Python

call = substrate.compose_call(
    'ParachainSystem', 'enact_authorized_upgrade', {'code': 'Bytes'}
)

set_validation_data

See [Pallet::set_validation_data].

Attributes

Name Type
data ParachainInherentData

Python

call = substrate.compose_call(
    'ParachainSystem', 'set_validation_data', {
    'data': {
        'downward_messages': [
            {
                'msg': 'Bytes',
                'sent_at': 'u32',
            },
        ],
        'horizontal_messages': 'scale_info::99',
        'relay_chain_state': {
            'trie_nodes': 'scale_info::96',
        },
        'validation_data': {
            'max_pov_size': 'u32',
            'parent_head': 'Bytes',
            'relay_parent_number': 'u32',
            'relay_parent_storage_root': 'scale_info::12',
        },
    },
}
)

sudo_send_upward_message

See [Pallet::sudo_send_upward_message].

Attributes

Name Type
message UpwardMessage

Python

call = substrate.compose_call(
    'ParachainSystem', 'sudo_send_upward_message', {'message': 'Bytes'}
)

Events


DownwardMessagesProcessed

Downward messages were processed using the given weight.

Attributes

Name Type Composition
weight_used Weight {'ref_time': 'u64', 'proof_size': 'u64'}
dmq_head relay_chain::Hash scale_info::12

DownwardMessagesReceived

Some downward messages have been received and will be processed.

Attributes

Name Type Composition
count u32 u32

UpgradeAuthorized

An upgrade has been authorized.

Attributes

Name Type Composition
code_hash T::Hash scale_info::12

UpwardMessageSent

An upward message was sent to the relay chain.

Attributes

Name Type Composition
message_hash Option<XcmHash> (None, '[u8; 32]')

ValidationFunctionApplied

The validation function was applied as of the contained relay chain block number.

Attributes

Name Type Composition
relay_chain_block_num RelayChainBlockNumber u32

ValidationFunctionDiscarded

The relay-chain aborted the upgrade process.

Attributes

No attributes


ValidationFunctionStored

The validation function has been scheduled to apply.

Attributes

No attributes


Storage functions


AggregatedUnincludedSegment

Storage field that keeps track of bandwidth used by the unincluded segment along with the latest HRMP watermark. Used for limiting the acceptance of new blocks with respect to relay chain constraints.

Python

result = substrate.query(
    'ParachainSystem', 'AggregatedUnincludedSegment', []
)

Return value

{
    'consumed_go_ahead_signal': (None, ('Abort', 'GoAhead')),
    'hrmp_watermark': (None, 'u32'),
    'used_bandwidth': {
        'hrmp_outgoing': 'scale_info::369',
        'ump_msg_count': 'u32',
        'ump_total_bytes': 'u32',
    },
}

AnnouncedHrmpMessagesPerCandidate

The number of HRMP messages we observed in on_initialize and thus used that number for announcing the weight of on_initialize and on_finalize.

Python

result = substrate.query(
    'ParachainSystem', 'AnnouncedHrmpMessagesPerCandidate', []
)

Return value

'u32'

AuthorizedUpgrade

The next authorized upgrade, if there is one.

Python

result = substrate.query(
    'ParachainSystem', 'AuthorizedUpgrade', []
)

Return value

{'check_version': 'bool', 'code_hash': 'scale_info::12'}

CustomValidationHeadData

A custom head data that should be returned as result of validate_block.

See Pallet::set_custom_validation_head_data for more information.

Python

result = substrate.query(
    'ParachainSystem', 'CustomValidationHeadData', []
)

Return value

'Bytes'

DidSetValidationCode

Were the validation data set to notify the relay chain?

Python

result = substrate.query(
    'ParachainSystem', 'DidSetValidationCode', []
)

Return value

'bool'

HostConfiguration

The parachain host configuration that was obtained from the relay parent.

This field is meant to be updated each block with the validation data inherent. Therefore, before processing of the inherent, e.g. in on_initialize this data may be stale.

This data is also absent from the genesis.

Python

result = substrate.query(
    'ParachainSystem', 'HostConfiguration', []
)

Return value

{
    'async_backing_params': {
        'allowed_ancestry_len': 'u32',
        'max_candidate_depth': 'u32',
    },
    'hrmp_max_message_num_per_candidate': 'u32',
    'max_code_size': 'u32',
    'max_head_data_size': 'u32',
    'max_upward_message_num_per_candidate': 'u32',
    'max_upward_message_size': 'u32',
    'max_upward_queue_count': 'u32',
    'max_upward_queue_size': 'u32',
    'validation_upgrade_cooldown': 'u32',
    'validation_upgrade_delay': 'u32',
}

HrmpOutboundMessages

HRMP messages that were sent in a block.

This will be cleared in on_initialize of each new block.

Python

result = substrate.query(
    'ParachainSystem', 'HrmpOutboundMessages', []
)

Return value

[{'data': 'Bytes', 'recipient': 'u32'}]

HrmpWatermark

HRMP watermark that was set in a block.

This will be cleared in on_initialize of each new block.

Python

result = substrate.query(
    'ParachainSystem', 'HrmpWatermark', []
)

Return value

'u32'

LastDmqMqcHead

The last downward message queue chain head we have observed.

This value is loaded before and saved after processing inbound downward messages carried by the system inherent.

Python

result = substrate.query(
    'ParachainSystem', 'LastDmqMqcHead', []
)

Return value

'scale_info::12'

LastHrmpMqcHeads

The message queue chain heads we have observed per each channel incoming channel.

This value is loaded before and saved after processing inbound downward messages carried by the system inherent.

Python

result = substrate.query(
    'ParachainSystem', 'LastHrmpMqcHeads', []
)

Return value

'scale_info::386'

LastRelayChainBlockNumber

The relay chain block number associated with the last parachain block.

This is updated in on_finalize.

Python

result = substrate.query(
    'ParachainSystem', 'LastRelayChainBlockNumber', []
)

Return value

'u32'

NewValidationCode

Validation code that is set by the parachain and is to be communicated to collator and consequently the relay-chain.

This will be cleared in on_initialize of each new block if no other pallet already set the value.

Python

result = substrate.query(
    'ParachainSystem', 'NewValidationCode', []
)

Return value

'Bytes'

PendingUpwardMessages

Upward messages that are still pending and not yet send to the relay chain.

Python

result = substrate.query(
    'ParachainSystem', 'PendingUpwardMessages', []
)

Return value

['Bytes']

PendingValidationCode

In case of a scheduled upgrade, this storage field contains the validation code to be applied.

As soon as the relay chain gives us the go-ahead signal, we will overwrite the [:code][sp_core::storage::well_known_keys::CODE] which will result the next block process with the new validation code. This concludes the upgrade process.

Python

result = substrate.query(
    'ParachainSystem', 'PendingValidationCode', []
)

Return value

'Bytes'

ProcessedDownwardMessages

Number of downward messages processed in a block.

This will be cleared in on_initialize of each new block.

Python

result = substrate.query(
    'ParachainSystem', 'ProcessedDownwardMessages', []
)

Return value

'u32'

RelayStateProof

The state proof for the last relay parent block.

This field is meant to be updated each block with the validation data inherent. Therefore, before processing of the inherent, e.g. in on_initialize this data may be stale.

This data is also absent from the genesis.

Python

result = substrate.query(
    'ParachainSystem', 'RelayStateProof', []
)

Return value

{'trie_nodes': 'scale_info::96'}

RelevantMessagingState

The snapshot of some state related to messaging relevant to the current parachain as per the relay parent.

This field is meant to be updated each block with the validation data inherent. Therefore, before processing of the inherent, e.g. in on_initialize this data may be stale.

This data is also absent from the genesis.

Python

result = substrate.query(
    'ParachainSystem', 'RelevantMessagingState', []
)

Return value

{
    'dmq_mqc_head': 'scale_info::12',
    'egress_channels': [
        (
            'u32',
            {
                'max_capacity': 'u32',
                'max_message_size': 'u32',
                'max_total_size': 'u32',
                'mqc_head': (None, 'scale_info::12'),
                'msg_count': 'u32',
                'total_size': 'u32',
            },
        ),
    ],
    'ingress_channels': [
        (
            'u32',
            {
                'max_capacity': 'u32',
                'max_message_size': 'u32',
                'max_total_size': 'u32',
                'mqc_head': (None, 'scale_info::12'),
                'msg_count': 'u32',
                'total_size': 'u32',
            },
        ),
    ],
    'relay_dispatch_queue_remaining_capacity': {
        'remaining_count': 'u32',
        'remaining_size': 'u32',
    },
}

ReservedDmpWeightOverride

The weight we reserve at the beginning of the block for processing DMP messages. This overrides the amount set in the Config trait.

Python

result = substrate.query(
    'ParachainSystem', 'ReservedDmpWeightOverride', []
)

Return value

{'proof_size': 'u64', 'ref_time': 'u64'}

ReservedXcmpWeightOverride

The weight we reserve at the beginning of the block for processing XCMP messages. This overrides the amount set in the Config trait.

Python

result = substrate.query(
    'ParachainSystem', 'ReservedXcmpWeightOverride', []
)

Return value

{'proof_size': 'u64', 'ref_time': 'u64'}

UnincludedSegment

Latest included block descendants the runtime accepted. In other words, these are ancestors of the currently executing block which have not been included in the observed relay-chain state.

The segment length is limited by the capacity returned from the [ConsensusHook] configured in the pallet.

Python

result = substrate.query(
    'ParachainSystem', 'UnincludedSegment', []
)

Return value

[
    {
        'consumed_go_ahead_signal': (None, ('Abort', 'GoAhead')),
        'para_head_hash': (None, 'scale_info::12'),
        'used_bandwidth': {
            'hrmp_outgoing': 'scale_info::369',
            'ump_msg_count': 'u32',
            'ump_total_bytes': 'u32',
        },
    },
]

UpgradeGoAhead

Optional upgrade go-ahead signal from the relay-chain.

This storage item is a mirror of the corresponding value for the current parachain from the relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is set after the inherent.

Python

result = substrate.query(
    'ParachainSystem', 'UpgradeGoAhead', []
)

Return value

(None, ('Abort', 'GoAhead'))

UpgradeRestrictionSignal

An option which indicates if the relay-chain restricts signalling a validation code upgrade. In other words, if this is Some and [NewValidationCode] is Some then the produced candidate will be invalid.

This storage item is a mirror of the corresponding value for the current parachain from the relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is set after the inherent.

Python

result = substrate.query(
    'ParachainSystem', 'UpgradeRestrictionSignal', []
)

Return value

(None, ('Present', ))

UpwardDeliveryFeeFactor

The factor to multiply the base delivery fee by for UMP.

Python

result = substrate.query(
    'ParachainSystem', 'UpwardDeliveryFeeFactor', []
)

Return value

'u128'

UpwardMessages

Upward messages that were sent in a block.

This will be cleared in on_initialize of each new block.

Python

result = substrate.query(
    'ParachainSystem', 'UpwardMessages', []
)

Return value

['Bytes']

ValidationData

The [PersistedValidationData] set for this block. This value is expected to be set only once per block and it's never stored in the trie.

Python

result = substrate.query(
    'ParachainSystem', 'ValidationData', []
)

Return value

{
    'max_pov_size': 'u32',
    'parent_head': 'Bytes',
    'relay_parent_number': 'u32',
    'relay_parent_storage_root': 'scale_info::12',
}

Errors


HostConfigurationNotAvailable

The inherent which supplies the host configuration did not run this block.


NotScheduled

No validation function upgrade is currently scheduled.


NothingAuthorized

No code upgrade has been authorized.


OverlappingUpgrades

Attempt to upgrade validation function while existing upgrade pending.


ProhibitedByPolkadot

Polkadot currently prohibits this parachain from upgrading its validation function.


TooBig

The supplied validation function has compiled into a blob larger than Polkadot is willing to run.


Unauthorized

The given code upgrade has not been authorized.


ValidationDataNotAvailable

The inherent which supplies the validation data did not run this block.