Skip to content

Sudo


Calls


remove_key

Permanently removes the sudo key.

This cannot be un-done.

Attributes

No attributes

Python

call = substrate.compose_call(
    'Sudo', 'remove_key', {}
)

set_key

Authenticates the current sudo key and sets the given AccountId (new) as the new sudo key.

Attributes

Name Type
new AccountIdLookupOf<T>

Python

call = substrate.compose_call(
    'Sudo', 'set_key', {
    'new': {
        'Address20': '[u8; 20]',
        'Address32': '[u8; 32]',
        'Id': 'AccountId',
        'Index': (),
        'Raw': 'Bytes',
    },
}
)

sudo

Authenticates the sudo key and dispatches a function call with Root origin.

Attributes

Name Type
call Box<<T as Config>::RuntimeCall>

Python

call = substrate.compose_call(
    'Sudo', 'sudo', {'call': 'Call'}
)

sudo_as

Authenticates the sudo key and dispatches a function call with Signed origin from a given account.

The dispatch origin for this call must be Signed.

Attributes

Name Type
who AccountIdLookupOf<T>
call Box<<T as Config>::RuntimeCall>

Python

call = substrate.compose_call(
    'Sudo', 'sudo_as', {
    'call': 'Call',
    'who': {
        'Address20': '[u8; 20]',
        'Address32': '[u8; 32]',
        'Id': 'AccountId',
        'Index': (),
        'Raw': 'Bytes',
    },
}
)

sudo_unchecked_weight

Authenticates the sudo key and dispatches a function call with Root origin. This function does not check the weight of the call, and instead allows the Sudo user to specify the weight of the call.

The dispatch origin for this call must be Signed.

Attributes

Name Type
call Box<<T as Config>::RuntimeCall>
weight Weight

Python

call = substrate.compose_call(
    'Sudo', 'sudo_unchecked_weight', {
    'call': 'Call',
    'weight': {
        'proof_size': 'u64',
        'ref_time': 'u64',
    },
}
)

Events


KeyChanged

The sudo key has been updated.

Attributes

Name Type Composition
old Option<T::AccountId> (None, 'AccountId')
new T::AccountId AccountId

KeyRemoved

The key was permanently removed.

Attributes

No attributes


Sudid

A sudo call just took place.

Attributes

Name Type Composition
sudo_result DispatchResult {'Ok': (), 'Err': {'Other': None, 'CannotLookup': None, 'BadOrigin': None, 'Module': {'index': 'u8', 'error': '[u8; 4]'}, 'ConsumerRemaining': None, 'NoProviders': None, 'TooManyConsumers': None, 'Token': ('FundsUnavailable', 'OnlyProvider', 'BelowMinimum', 'CannotCreate', 'UnknownAsset', 'Frozen', 'Unsupported', 'CannotCreateHold', 'NotExpendable', 'Blocked'), 'Arithmetic': ('Underflow', 'Overflow', 'DivisionByZero'), 'Transactional': ('LimitReached', 'NoLayer'), 'Exhausted': None, 'Corruption': None, 'Unavailable': None, 'RootNotAllowed': None}}

SudoAsDone

A sudo_as call just took place.

Attributes

Name Type Composition
sudo_result DispatchResult {'Ok': (), 'Err': {'Other': None, 'CannotLookup': None, 'BadOrigin': None, 'Module': {'index': 'u8', 'error': '[u8; 4]'}, 'ConsumerRemaining': None, 'NoProviders': None, 'TooManyConsumers': None, 'Token': ('FundsUnavailable', 'OnlyProvider', 'BelowMinimum', 'CannotCreate', 'UnknownAsset', 'Frozen', 'Unsupported', 'CannotCreateHold', 'NotExpendable', 'Blocked'), 'Arithmetic': ('Underflow', 'Overflow', 'DivisionByZero'), 'Transactional': ('LimitReached', 'NoLayer'), 'Exhausted': None, 'Corruption': None, 'Unavailable': None, 'RootNotAllowed': None}}

Storage functions


Key

The AccountId of the sudo key.

Python

result = substrate.query(
    'Sudo', 'Key', []
)

Return value

'AccountId'

Errors


RequireSudo

Sender must be the Sudo account.