Struct ProtocolUpgrader

Source
pub struct ProtocolUpgrader<S>
where S: StateProvider,
{ /* private fields */ }
Expand description

The system upgrader deals with conducting an actual protocol upgrade.

Implementations§

Source§

impl<S> ProtocolUpgrader<S>
where S: StateProvider,

Source

pub fn new( config: ProtocolUpgradeConfig, protocol_upgrade_config_hash: Digest, tracking_copy: TrackingCopy<<S as StateProvider>::Reader>, ) -> Self

Creates new system upgrader instance.

Source

pub fn upgrade( self, pre_state_hash: Digest, ) -> Result<TrackingCopy<<S as StateProvider>::Reader>, ProtocolUpgradeError>

Apply a protocol upgrade.

Source

pub fn check_next_protocol_version_validity( &self, ) -> Result<(), ProtocolUpgradeError>

Determine if the next protocol version is a legitimate semver progression.

Source

pub fn handle_system_hashes( &mut self, ) -> Result<SystemHashAddresses, ProtocolUpgradeError>

Handle system entities.

Source

pub fn migrate_or_refresh_system_entities( &mut self, system_entity_addresses: &SystemHashAddresses, ) -> Result<(), ProtocolUpgradeError>

Bump major version and/or update the entry points for system contracts.

Source

pub fn refresh_system_contracts( &mut self, system_entity_addresses: &SystemHashAddresses, ) -> Result<(), ProtocolUpgradeError>

Bump major version and/or update the entry points for system contracts.

Source

pub fn migrate_system_account( &mut self, pre_state_hash: Digest, ) -> Result<(), ProtocolUpgradeError>

Migrate the system account to addressable entity if necessary.

Source

pub fn create_accumulation_purse_if_required( &mut self, handle_payment_hash: &HashAddr, fee_handling: FeeHandling, ) -> Result<(), ProtocolUpgradeError>

Creates an accumulation purse in the handle payment system contract if its not present.

This can happen on older networks that did not have support for FeeHandling::Accumulate at the genesis. In such cases we have to check the state of handle payment contract and create an accumulation purse.

Source

pub fn create_accumulation_purse_if_required_by_contract( &mut self, handle_payment_hash: &HashAddr, fee_handling: FeeHandling, ) -> Result<(), ProtocolUpgradeError>

Creates an accumulation purse in the handle payment system contract if its not present.

This can happen on older networks that did not have support for FeeHandling::Accumulate at the genesis. In such cases we have to check the state of handle payment contract and create an accumulation purse.

Source

pub fn handle_payment_purse_check( &mut self, handle_payment: HashAddr, mint: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Check payment purse balance.

Source

pub fn handle_new_gas_hold_config( &mut self, mint: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Upsert gas hold interval to mint named keys.

Source

pub fn handle_new_validator_slots( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Handle new validator slots.

Source

pub fn handle_new_auction_delay( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Applies the necessary changes if a new auction delay is part of the upgrade.

Source

pub fn handle_new_locked_funds_period_millis( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Applies the necessary changes if a new locked funds period is part of the upgrade.

Source

pub fn handle_new_unbonding_delay( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Applies the necessary changes if a new unbonding delay is part of the upgrade.

Source

pub fn handle_new_round_seigniorage_rate( &mut self, mint: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Applies the necessary changes if a new round seigniorage rate is part of the upgrade.

Source

pub fn handle_unbonds_migration(&mut self) -> Result<(), ProtocolUpgradeError>

Handle unbonds migration.

Source

pub fn handle_bids_migration( &mut self, validator_minimum: u64, delegation_minimum: u64, delegation_maximum: u64, ) -> Result<(), ProtocolUpgradeError>

Handle bids migration.

Source

pub fn handle_era_info_migration(&mut self) -> Result<(), ProtocolUpgradeError>

Handle era info migration.

Source

pub fn handle_seignorage_snapshot_migration( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>

Handle seignorage snapshot migration to new version.

Source

pub fn handle_global_state_updates(&mut self)

Handle global state updates.

Auto Trait Implementations§

§

impl<S> Freeze for ProtocolUpgrader<S>

§

impl<S> !RefUnwindSafe for ProtocolUpgrader<S>

§

impl<S> !Send for ProtocolUpgrader<S>

§

impl<S> !Sync for ProtocolUpgrader<S>

§

impl<S> Unpin for ProtocolUpgrader<S>

§

impl<S> !UnwindSafe for ProtocolUpgrader<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more