pub trait SafeMode {
    type BlockNumber;

    // Required methods
    fn remaining() -> Option<Self::BlockNumber>;
    fn enter(duration: Self::BlockNumber) -> Result<(), SafeModeError>;
    fn extend(duration: Self::BlockNumber) -> Result<(), SafeModeError>;
    fn exit() -> Result<(), SafeModeError>;

    // Provided method
    fn is_entered() -> bool { ... }
}
Expand description

Can put the runtime into a safe mode.

When the runtime entered safe mode, transaction processing for most general transactions is paused.

Required Associated Types§

source

type BlockNumber

Block number type.

Required Methods§

source

fn remaining() -> Option<Self::BlockNumber>

How many more blocks safe mode will stay entered.

If this returns 0, then safe mode will exit in the next block.

source

fn enter(duration: Self::BlockNumber) -> Result<(), SafeModeError>

Enter safe mode for duration blocks.

Should error when already entered with AlreadyEntered.

source

fn extend(duration: Self::BlockNumber) -> Result<(), SafeModeError>

Extend safe mode for duration blocks.

Should error when not entered with AlreadyExited.

source

fn exit() -> Result<(), SafeModeError>

Exit safe mode immediately.

This takes effect already in the same block.

Provided Methods§

source

fn is_entered() -> bool

Whether safe mode is entered.

Implementors§