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,
impl<S> ProtocolUpgrader<S>where
S: StateProvider,
Sourcepub fn new(
config: ProtocolUpgradeConfig,
protocol_upgrade_config_hash: Digest,
tracking_copy: TrackingCopy<<S as StateProvider>::Reader>,
) -> Self
pub fn new( config: ProtocolUpgradeConfig, protocol_upgrade_config_hash: Digest, tracking_copy: TrackingCopy<<S as StateProvider>::Reader>, ) -> Self
Creates new system upgrader instance.
Sourcepub fn upgrade(
self,
pre_state_hash: Digest,
) -> Result<TrackingCopy<<S as StateProvider>::Reader>, ProtocolUpgradeError>
pub fn upgrade( self, pre_state_hash: Digest, ) -> Result<TrackingCopy<<S as StateProvider>::Reader>, ProtocolUpgradeError>
Apply a protocol upgrade.
Sourcepub fn check_next_protocol_version_validity(
&self,
) -> Result<(), ProtocolUpgradeError>
pub fn check_next_protocol_version_validity( &self, ) -> Result<(), ProtocolUpgradeError>
Determine if the next protocol version is a legitimate semver progression.
Sourcepub fn handle_system_hashes(
&mut self,
) -> Result<SystemHashAddresses, ProtocolUpgradeError>
pub fn handle_system_hashes( &mut self, ) -> Result<SystemHashAddresses, ProtocolUpgradeError>
Handle system entities.
Sourcepub fn migrate_or_refresh_system_entities(
&mut self,
system_entity_addresses: &SystemHashAddresses,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn refresh_system_contracts(
&mut self,
system_entity_addresses: &SystemHashAddresses,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn migrate_system_account(
&mut self,
pre_state_hash: Digest,
) -> Result<(), ProtocolUpgradeError>
pub fn migrate_system_account( &mut self, pre_state_hash: Digest, ) -> Result<(), ProtocolUpgradeError>
Migrate the system account to addressable entity if necessary.
Sourcepub fn create_accumulation_purse_if_required(
&mut self,
handle_payment_hash: &HashAddr,
fee_handling: FeeHandling,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn create_accumulation_purse_if_required_by_contract(
&mut self,
handle_payment_hash: &HashAddr,
fee_handling: FeeHandling,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn handle_payment_purse_check(
&mut self,
handle_payment: HashAddr,
mint: HashAddr,
) -> Result<(), ProtocolUpgradeError>
pub fn handle_payment_purse_check( &mut self, handle_payment: HashAddr, mint: HashAddr, ) -> Result<(), ProtocolUpgradeError>
Check payment purse balance.
Sourcepub fn handle_new_gas_hold_config(
&mut self,
mint: HashAddr,
) -> Result<(), ProtocolUpgradeError>
pub fn handle_new_gas_hold_config( &mut self, mint: HashAddr, ) -> Result<(), ProtocolUpgradeError>
Upsert gas hold interval to mint named keys.
Sourcepub fn handle_new_validator_slots(
&mut self,
auction: HashAddr,
) -> Result<(), ProtocolUpgradeError>
pub fn handle_new_validator_slots( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>
Handle new validator slots.
Sourcepub fn handle_new_auction_delay(
&mut self,
auction: HashAddr,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn handle_new_locked_funds_period_millis(
&mut self,
auction: HashAddr,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn handle_new_unbonding_delay(
&mut self,
auction: HashAddr,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn handle_new_round_seigniorage_rate(
&mut self,
mint: HashAddr,
) -> Result<(), ProtocolUpgradeError>
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.
Sourcepub fn handle_unbonds_migration(&mut self) -> Result<(), ProtocolUpgradeError>
pub fn handle_unbonds_migration(&mut self) -> Result<(), ProtocolUpgradeError>
Handle unbonds migration.
Sourcepub fn handle_bids_migration(
&mut self,
validator_minimum: u64,
delegation_minimum: u64,
delegation_maximum: u64,
) -> Result<(), ProtocolUpgradeError>
pub fn handle_bids_migration( &mut self, validator_minimum: u64, delegation_minimum: u64, delegation_maximum: u64, ) -> Result<(), ProtocolUpgradeError>
Handle bids migration.
Sourcepub fn handle_era_info_migration(&mut self) -> Result<(), ProtocolUpgradeError>
pub fn handle_era_info_migration(&mut self) -> Result<(), ProtocolUpgradeError>
Handle era info migration.
Sourcepub fn handle_seignorage_snapshot_migration(
&mut self,
auction: HashAddr,
) -> Result<(), ProtocolUpgradeError>
pub fn handle_seignorage_snapshot_migration( &mut self, auction: HashAddr, ) -> Result<(), ProtocolUpgradeError>
Handle seignorage snapshot migration to new version.
Sourcepub fn handle_global_state_updates(&mut self)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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