mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Remove TransientValidationData (#2272)
* collation-generation: use persisted validation data * node: remote FullValidationData API * runtime: remove FullValidationData API * backing tests: use persisted validation data * FullCandidateReceipt: use persisted validation data This is not a big change since this type is not used anywhere * Remove ValidationData and TransientValidationData Also update the guide
This commit is contained in:
@@ -17,8 +17,7 @@
|
||||
//! Utilities that don't belong to any particular module but may draw
|
||||
//! on all modules.
|
||||
|
||||
use sp_runtime::traits::Saturating;
|
||||
use primitives::v1::{Id as ParaId, PersistedValidationData, TransientValidationData, Hash};
|
||||
use primitives::v1::{Id as ParaId, PersistedValidationData, Hash};
|
||||
|
||||
use crate::{configuration, paras, dmp, hrmp};
|
||||
|
||||
@@ -42,36 +41,3 @@ pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>(
|
||||
max_pov_size: config.max_pov_size,
|
||||
})
|
||||
}
|
||||
|
||||
/// Make the transient validation data for a particular parachain and a specified relay-parent.
|
||||
///
|
||||
/// This ties together the storage of several modules.
|
||||
pub fn make_transient_validation_data<T: paras::Config + dmp::Config>(
|
||||
para_id: ParaId,
|
||||
relay_parent_number: T::BlockNumber,
|
||||
) -> Option<TransientValidationData<T::BlockNumber>> {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
|
||||
let freq = config.validation_upgrade_frequency;
|
||||
let delay = config.validation_upgrade_delay;
|
||||
|
||||
let last_code_upgrade = <paras::Module<T>>::last_code_upgrade(para_id, true);
|
||||
let can_upgrade_code = last_code_upgrade.map_or(
|
||||
true,
|
||||
|l| { l <= relay_parent_number && relay_parent_number.saturating_sub(l) >= freq },
|
||||
);
|
||||
|
||||
let code_upgrade_allowed = if can_upgrade_code {
|
||||
Some(relay_parent_number + delay)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Some(TransientValidationData {
|
||||
max_code_size: config.max_code_size,
|
||||
max_head_data_size: config.max_head_data_size,
|
||||
balance: 0,
|
||||
code_upgrade_allowed,
|
||||
dmq_length: <dmp::Module<T>>::dmq_length(para_id),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user