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§


type BlockNumber

Block number type.

Required Methods§


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.


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

Enter safe mode for duration blocks.

Should error when already entered with AlreadyEntered.


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

Extend safe mode for duration blocks.

Should error when not entered with AlreadyExited.


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

Exit safe mode immediately.

This takes effect already in the same block.

Provided Methods§


fn is_entered() -> bool

Whether safe mode is entered.

Object Safety§

This trait is not object safe.