Skip to content

PhalaRegistry


Calls


add_pruntime

See [Pallet::add_pruntime].

Attributes

Name Type
pruntime_hash Vec<u8>

Python

call = substrate.compose_call(
    'PhalaRegistry', 'add_pruntime', {'pruntime_hash': 'Bytes'}
)

add_relaychain_genesis_block_hash

See [Pallet::add_relaychain_genesis_block_hash].

Attributes

Name Type
genesis_block_hash H256

Python

call = substrate.compose_call(
    'PhalaRegistry', 'add_relaychain_genesis_block_hash', {
    'genesis_block_hash': 'scale_info::12',
}
)

force_register_topic_pubkey

See [Pallet::force_register_topic_pubkey].

Attributes

Name Type
topic Vec<u8>
pubkey Vec<u8>

Python

call = substrate.compose_call(
    'PhalaRegistry', 'force_register_topic_pubkey', {'pubkey': 'Bytes', 'topic': 'Bytes'}
)

force_register_worker

See [Pallet::force_register_worker].

Attributes

Name Type
pubkey WorkerPublicKey
ecdh_pubkey EcdhPublicKey
operator Option<T::AccountId>

Python

call = substrate.compose_call(
    'PhalaRegistry', 'force_register_worker', {
    'ecdh_pubkey': '[u8; 32]',
    'operator': (None, 'AccountId'),
    'pubkey': '[u8; 32]',
}
)

force_set_benchmark_duration

See [Pallet::force_set_benchmark_duration].

Attributes

Name Type
value u32

Python

call = substrate.compose_call(
    'PhalaRegistry', 'force_set_benchmark_duration', {'value': 'u32'}
)

register_gatekeeper

See [Pallet::register_gatekeeper].

Attributes

Name Type
gatekeeper WorkerPublicKey

Python

call = substrate.compose_call(
    'PhalaRegistry', 'register_gatekeeper', {'gatekeeper': '[u8; 32]'}
)

register_worker

See [Pallet::register_worker].

Attributes

Name Type
pruntime_info WorkerRegistrationInfo<T::AccountId>
attestation Attestation

Python

call = substrate.compose_call(
    'PhalaRegistry', 'register_worker', {
    'attestation': {
        'SgxIas': {
            'ra_report': 'Bytes',
            'raw_signing_cert': 'Bytes',
            'signature': 'Bytes',
        },
    },
    'pruntime_info': {
        'ecdh_pubkey': '[u8; 32]',
        'features': ['u32'],
        'genesis_block_hash': 'scale_info::12',
        'machine_id': 'Bytes',
        'operator': (
            None,
            'AccountId',
        ),
        'pubkey': '[u8; 32]',
        'version': 'u32',
    },
}
)

register_worker_v2

See [Pallet::register_worker_v2].

Attributes

Name Type
pruntime_info WorkerRegistrationInfoV2<T::AccountId>
attestation Option<AttestationReport>

Python

call = substrate.compose_call(
    'PhalaRegistry', 'register_worker_v2', {
    'attestation': (
        None,
        {
            'SgxIas': {
                'ra_report': 'Bytes',
                'raw_signing_cert': 'Bytes',
                'signature': 'Bytes',
            },
        },
    ),
    'pruntime_info': {
        'ecdh_pubkey': '[u8; 32]',
        'features': ['u32'],
        'genesis_block_hash': 'scale_info::12',
        'machine_id': 'Bytes',
        'max_consensus_version': 'u32',
        'operator': (
            None,
            'AccountId',
        ),
        'para_id': 'u32',
        'pubkey': '[u8; 32]',
        'version': 'u32',
    },
}
)

remove_pruntime

See [Pallet::remove_pruntime].

Attributes

Name Type
pruntime_hash Vec<u8>

Python

call = substrate.compose_call(
    'PhalaRegistry', 'remove_pruntime', {'pruntime_hash': 'Bytes'}
)

remove_relaychain_genesis_block_hash

See [Pallet::remove_relaychain_genesis_block_hash].

Attributes

Name Type
genesis_block_hash H256

Python

call = substrate.compose_call(
    'PhalaRegistry', 'remove_relaychain_genesis_block_hash', {
    'genesis_block_hash': 'scale_info::12',
}
)

rotate_master_key

See [Pallet::rotate_master_key].

Attributes

No attributes

Python

call = substrate.compose_call(
    'PhalaRegistry', 'rotate_master_key', {}
)

set_minimum_pruntime_version

See [Pallet::set_minimum_pruntime_version].

Attributes

Name Type
major u32
minor u32
patch u32

Python

call = substrate.compose_call(
    'PhalaRegistry', 'set_minimum_pruntime_version', {
    'major': 'u32',
    'minor': 'u32',
    'patch': 'u32',
}
)

set_pruntime_consensus_version

See [Pallet::set_pruntime_consensus_version].

Attributes

Name Type
version u32

Python

call = substrate.compose_call(
    'PhalaRegistry', 'set_pruntime_consensus_version', {'version': 'u32'}
)

unregister_gatekeeper

See [Pallet::unregister_gatekeeper].

Attributes

Name Type
gatekeeper WorkerPublicKey

Python

call = substrate.compose_call(
    'PhalaRegistry', 'unregister_gatekeeper', {'gatekeeper': '[u8; 32]'}
)

update_worker_endpoint

See [Pallet::update_worker_endpoint].

Attributes

Name Type
endpoint_payload WorkerEndpointPayload
signature Vec<u8>

Python

call = substrate.compose_call(
    'PhalaRegistry', 'update_worker_endpoint', {
    'endpoint_payload': {
        'pubkey': '[u8; 32]',
        'signing_time': 'u64',
        'versioned_endpoints': {
            'V1': ['Str'],
        },
    },
    'signature': 'Bytes',
}
)

Events


GatekeeperAdded

A new Gatekeeper is enabled on the blockchain

Attributes

Name Type Composition
pubkey WorkerPublicKey [u8; 32]

GatekeeperLaunched

Attributes

No attributes


GatekeeperRemoved

Attributes

Name Type Composition
pubkey WorkerPublicKey [u8; 32]

InitialScoreSet

Attributes

Name Type Composition
pubkey WorkerPublicKey [u8; 32]
init_score u32 u32

MasterKeyRotated

Attributes

Name Type Composition
rotation_id u64 u64
master_pubkey MasterPublicKey [u8; 32]

MasterKeyRotationFailed

Attributes

Name Type Composition
rotation_lock Option<u64> (None, 'u64')
gatekeeper_rotation_id u64 u64

MinimumPRuntimeVersionChangedTo

Attributes

Name Type Composition
None u32 u32
None u32 u32
None u32 u32

PRuntimeConsensusVersionChangedTo

Attributes

Name Type Composition
None u32 u32

WorkerAdded

Attributes

Name Type Composition
pubkey WorkerPublicKey [u8; 32]
attestation_provider Option<AttestationProvider> (None, ('Root', 'Ias', 'Dcap'))
confidence_level u8 u8

WorkerUpdated

Attributes

Name Type Composition
pubkey WorkerPublicKey [u8; 32]
attestation_provider Option<AttestationProvider> (None, ('Root', 'Ias', 'Dcap'))
confidence_level u8 u8

Storage functions


BenchmarkDuration

The number of blocks to run the benchmark

Python

result = substrate.query(
    'PhalaRegistry', 'BenchmarkDuration', []
)

Return value

'u32'

ClusterKeys

Python

result = substrate.query(
    'PhalaRegistry', 'ClusterKeys', ['scale_info::12']
)

Return value

'[u8; 32]'

ContractKeys

Mapping from contract address to pubkey

Python

result = substrate.query(
    'PhalaRegistry', 'ContractKeys', ['scale_info::12']
)

Return value

'[u8; 32]'

Endpoints

Mapping from worker pubkey to Phala Network identity

Python

result = substrate.query(
    'PhalaRegistry', 'Endpoints', ['[u8; 32]']
)

Return value

{'V1': ['Str']}

Gatekeeper

Gatekeeper pubkey list

Python

result = substrate.query(
    'PhalaRegistry', 'Gatekeeper', []
)

Return value

['[u8; 32]']

GatekeeperLaunchedAt

The block number and unix timestamp when the gatekeeper is launched

Python

result = substrate.query(
    'PhalaRegistry', 'GatekeeperLaunchedAt', []
)

Return value

('u32', 'u64')

GatekeeperMasterPubkey

Gatekeeper master pubkey

Python

result = substrate.query(
    'PhalaRegistry', 'GatekeeperMasterPubkey', []
)

Return value

'[u8; 32]'

MasterKeyRotationLock

Current rotation info including rotation id

Only one rotation process is allowed at one time. Since the rotation request is broadcasted to all gatekeepers, it should be finished only if there is one functional gatekeeper.

Python

result = substrate.query(
    'PhalaRegistry', 'MasterKeyRotationLock', []
)

Return value

(None, 'u64')

MaxKnownPRuntimeConsensusVersion

The max consensus version that pruntime has report via register_worker

Python

result = substrate.query(
    'PhalaRegistry', 'MaxKnownPRuntimeConsensusVersion', []
)

Return value

{'count': 'u32', 'version': 'u32'}

MinimumPRuntimeVersion

PRuntimes whoes version less than MinimumPRuntimeVersion would be forced to quit.

Python

result = substrate.query(
    'PhalaRegistry', 'MinimumPRuntimeVersion', []
)

Return value

('u32', 'u32', 'u32')

PRuntimeAddedAt

The effective height of pRuntime binary

Python

result = substrate.query(
    'PhalaRegistry', 'PRuntimeAddedAt', ['Bytes']
)

Return value

'u32'

PRuntimeAllowList

Allow list of pRuntime binary digest

Only pRuntime within the list can register.

Python

result = substrate.query(
    'PhalaRegistry', 'PRuntimeAllowList', []
)

Return value

['Bytes']

PRuntimeConsensusVersion

The consensus version used by pruntime. PRuntimes would switch some code path according the current consensus version.

Python

result = substrate.query(
    'PhalaRegistry', 'PRuntimeConsensusVersion', []
)

Return value

'u32'

RelaychainGenesisBlockHashAllowList

Allow list of relaychain genesis

Only genesis within the list can do register.

Python

result = substrate.query(
    'PhalaRegistry', 'RelaychainGenesisBlockHashAllowList', []
)

Return value

['scale_info::12']

RotationCounter

The rotation counter starting from 1, it always equals to the latest rotation id. The totation id 0 is reserved for the first master key before we introduce the rotation.

Python

result = substrate.query(
    'PhalaRegistry', 'RotationCounter', []
)

Return value

'u64'

TempWorkersIterKey

Allow list of pRuntime binary digest

Only pRuntime within the list can register.

Python

result = substrate.query(
    'PhalaRegistry', 'TempWorkersIterKey', []
)

Return value

(None, 'Bytes')

TopicKey

Pubkey for secret topics.

Python

result = substrate.query(
    'PhalaRegistry', 'TopicKey', ['Bytes']
)

Return value

'Bytes'

WorkerAddedAt

The first time registered block number for each worker.

Python

result = substrate.query(
    'PhalaRegistry', 'WorkerAddedAt', ['[u8; 32]']
)

Return value

'u32'

Workers

Mapping from worker pubkey to WorkerInfo

Python

result = substrate.query(
    'PhalaRegistry', 'Workers', ['[u8; 32]']
)

Return value

{
    'attestation_provider': (None, ('Root', 'Ias', 'Dcap')),
    'confidence_level': 'u8',
    'ecdh_pubkey': '[u8; 32]',
    'features': ['u32'],
    'initial_score': (None, 'u32'),
    'last_updated': 'u64',
    'operator': (None, 'AccountId'),
    'pubkey': '[u8; 32]',
    'runtime_version': 'u32',
}

Constants


NoneAttestationEnabled

Enable None Attestation, SHOULD BE SET TO FALSE ON PRODUCTION !!!

Value

False

Python

constant = substrate.get_constant('PhalaRegistry', 'NoneAttestationEnabled')

VerifyPRuntime

Verify attestation

SHOULD NOT SET TO FALSE ON PRODUCTION!!!

Value

True

Python

constant = substrate.get_constant('PhalaRegistry', 'VerifyPRuntime')

VerifyRelaychainGenesisBlockHash

Verify relaychain genesis

SHOULD NOT SET TO FALSE ON PRODUCTION!!!

Value

True

Python

constant = substrate.get_constant('PhalaRegistry', 'VerifyRelaychainGenesisBlockHash')

Errors


BadIASReport


CannotHandleUnknownMessage


CannotRemoveLastGatekeeper


GenesisBlockHashAlreadyExists


GenesisBlockHashNotFound


GenesisBlockHashRejected


InvalidBenchReport


InvalidConsensusVersion


InvalidEndpointSigningTime


InvalidGatekeeper


InvalidIASSigningCert


InvalidInput


InvalidMasterPubkey


InvalidPubKey


InvalidQuoteStatus


InvalidReport


InvalidRotatedMasterPubkey


InvalidRuntimeInfo


InvalidRuntimeInfoHash


InvalidSender


InvalidSignature


InvalidSignatureLength


MalformedSignature


MasterKeyInRotation


MasterKeyMismatch


MasterKeyUninitialized


NoneAttestationDisabled


NotImplemented


NotMigrationRoot

Migration root not authorized


OutdatedIASReport


PRuntimeAlreadyExists


PRuntimeNotFound


PRuntimeRejected


ParachainIdMismatch


UnknownCluster


UnknownContract


UnknownQuoteBodyFormat


WorkerNotFound