Skip to content

Security


Calls


insert_parachain_error

Insert a new parachain error.

# Arguments

  • origin - the dispatch origin of this call (must be Root)
  • error_code - the error code to insert

# Weight: O(1)

Attributes

Name Type
error_code ErrorCode

Python

call = substrate.compose_call(
    'Security', 'insert_parachain_error', {
    'error_code': (
        'None',
        'OracleOffline',
    ),
}
)

remove_parachain_error

Remove a parachain error.

# Arguments

  • origin - the dispatch origin of this call (must be Root)
  • error_code - the error code to remove

# Weight: O(1)

Attributes

Name Type
error_code ErrorCode

Python

call = substrate.compose_call(
    'Security', 'remove_parachain_error', {
    'error_code': (
        'None',
        'OracleOffline',
    ),
}
)

set_parachain_status

Set the parachain status code.

# Arguments

  • origin - the dispatch origin of this call (must be Root)
  • status_code - the status code to set

# Weight: O(1)

Attributes

Name Type
status_code StatusCode

Python

call = substrate.compose_call(
    'Security', 'set_parachain_status', {
    'status_code': (
        'Running',
        'Error',
        'Shutdown',
    ),
}
)

Events


RecoverFromErrors

Attributes

Name Type Composition
new_status StatusCode ('Running', 'Error', 'Shutdown')
cleared_errors Vec<ErrorCode> [('None', 'OracleOffline')]

UpdateActiveBlock

Attributes

Name Type Composition
block_number T::BlockNumber u32

Storage functions


ActiveBlockCount

Like frame_system::block_number, but this one only increments if the parachain status is RUNNING. This variable is used to keep track of durations, such as the issue/redeem/replace expiry. If the parachain is not RUNNING, no payment proofs can be submitted, and it wouldn't be fair to punish the user/vault. By using this variable we ensure that they have sufficient time to submit their proof.

Python

result = substrate.query(
    'Security', 'ActiveBlockCount', []
)

Return value

'u32'

Errors

Set of ErrorCodes, indicating the reason for an "Error" ParachainStatus.

Python

result = substrate.query(
    'Security', 'Errors', []
)

Return value

'scale_info::576'

Nonce

Integer increment-only counter, used to prevent collisions when generating identifiers for e.g. issue, redeem or replace requests.

Python

result = substrate.query(
    'Security', 'Nonce', []
)

Return value

'scale_info::551'

ParachainStatus

Integer/Enum defining the current state of the Spacewalk-Parachain.

Python

result = substrate.query(
    'Security', 'ParachainStatus', []
)

Return value

('Running', 'Error', 'Shutdown')

Errors


ParachainNotRunning

Parachain is not running.