Skip to content
Snippets Groups Projects
Unverified Commit 8aeaced0 authored by bgallois's avatar bgallois
Browse files

remove proof_size restriction

parent 985075ea
No related branches found
No related tags found
1 merge request!268Fix #232
Pipeline #37264 failed
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use crate::{Balance, BlockNumber}; use crate::{Balance, BlockNumber};
use frame_support::weights::Weight;
use sp_runtime::Perbill; use sp_runtime::Perbill;
pub use crate::weights::paritydb_weights::constants::ParityDbWeight as DbWeight; pub use crate::weights::paritydb_weights::constants::ParityDbWeight as DbWeight;
...@@ -61,32 +60,3 @@ pub const fn deposit(items: u32, bytes: u32) -> Balance { ...@@ -61,32 +60,3 @@ pub const fn deposit(items: u32, bytes: u32) -> Balance {
// Maximal weight proportion of normal extrinsics per block // Maximal weight proportion of normal extrinsics per block
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
// WEIGHTS CONSTANTS //
// Block weights limits
pub fn block_weights(
expected_block_weight: Weight,
normal_ratio: sp_arithmetic::Perbill,
) -> frame_system::limits::BlockWeights {
let base_weight = crate::weights::extrinsic_weights::ExtrinsicBaseWeight::get();
let normal_weight = normal_ratio * expected_block_weight;
frame_system::limits::BlockWeights::builder()
.base_block(crate::weights::block_weights::BlockExecutionWeight::get())
.for_class(frame_support::dispatch::DispatchClass::all(), |weights| {
weights.base_extrinsic = base_weight;
})
.for_class(frame_support::dispatch::DispatchClass::Normal, |weights| {
weights.max_total = normal_weight.into();
})
.for_class(
frame_support::dispatch::DispatchClass::Operational,
|weights| {
weights.max_total = expected_block_weight.into();
weights.reserved = (expected_block_weight - normal_weight).into();
},
)
.avg_block_initialization(sp_arithmetic::Perbill::from_percent(10))
.build()
.expect("Fatal error: invalid BlockWeights configuration")
}
...@@ -22,8 +22,7 @@ use sp_runtime::transaction_validity::TransactionPriority; ...@@ -22,8 +22,7 @@ use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 2400; pub const BlockHashCount: BlockNumber = 2400;
/// We allow for 2 seconds of compute with a 6 second average block time. /// We allow for 2 seconds of compute with a 6 second average block time.
pub BlockWeights: frame_system::limits::BlockWeights = block_weights((Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, 0) * 2) pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::with_sensible_defaults(Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2u64, u64::MAX), NORMAL_DISPATCH_RATIO);
.set_proof_size(5 * 1024 * 1024), NORMAL_DISPATCH_RATIO);
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub const SS58Prefix: u16 = 4450; pub const SS58Prefix: u16 = 4450;
......
...@@ -24,8 +24,7 @@ use sp_runtime::transaction_validity::TransactionPriority; ...@@ -24,8 +24,7 @@ use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 2400; pub const BlockHashCount: BlockNumber = 2400;
/// We allow for 2 seconds of compute with a 6 second average block time. /// We allow for 2 seconds of compute with a 6 second average block time.
pub BlockWeights: frame_system::limits::BlockWeights = block_weights((Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, 0) * 2) pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::with_sensible_defaults(Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2u64, u64::MAX), NORMAL_DISPATCH_RATIO);
.set_proof_size(5 * 1024 * 1024), NORMAL_DISPATCH_RATIO);
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub const SS58Prefix: u16 = 42; pub const SS58Prefix: u16 = 42;
......
...@@ -22,8 +22,7 @@ use sp_runtime::transaction_validity::TransactionPriority; ...@@ -22,8 +22,7 @@ use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 2400; pub const BlockHashCount: BlockNumber = 2400;
/// We allow for 2 seconds of compute with a 6 second average block time. /// We allow for 2 seconds of compute with a 6 second average block time.
pub BlockWeights: frame_system::limits::BlockWeights = block_weights((Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, 0) * 2) pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::with_sensible_defaults(Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2u64, u64::MAX), NORMAL_DISPATCH_RATIO);
.set_proof_size(5 * 1024 * 1024), NORMAL_DISPATCH_RATIO);
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub const SS58Prefix: u16 = 42; pub const SS58Prefix: u16 = 42;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment