From 6959b22bf7c0255f745c0d2f23d48d4c93c2b58b Mon Sep 17 00:00:00 2001 From: fmiguelgarcia Date: Thu, 27 Jul 2023 11:34:32 +0200 Subject: [PATCH] New `BlockDimensions` interface --- base/src/metrics/adapter.rs | 8 ++++---- pallets/system/src/extensions/check_weight.rs | 4 ++-- pallets/system/src/header_builder.rs | 4 ++-- rpc/kate-rpc/src/lib.rs | 3 ++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/base/src/metrics/adapter.rs b/base/src/metrics/adapter.rs index a91a3c06d..631b6e6d9 100644 --- a/base/src/metrics/adapter.rs +++ b/base/src/metrics/adapter.rs @@ -51,8 +51,8 @@ impl Metrics for MetricAdapter { fn block_dims_and_size(&self, block_dims: BlockDimensions, block_len: u32) { #[rustfmt::skip] may_observe!( - general, block_dims_rows, block_dims.rows.0, - general, block_dims_cols, block_dims.cols.0, + general, block_dims_rows, block_dims.rows().0, + general, block_dims_cols, block_dims.cols().0, general, block_len, block_len ); } @@ -84,8 +84,8 @@ impl Metrics for RPCMetricAdapter { fn block_dims_and_size(&self, block_dims: BlockDimensions, block_len: u32) { #[rustfmt::skip] may_observe!( - general, block_dims_rows, block_dims.rows.0, - general, block_dims_cols, block_dims.cols.0, + general, block_dims_rows, block_dims.rows().0, + general, block_dims_cols, block_dims.cols().0, general, block_len, block_len ); } diff --git a/pallets/system/src/extensions/check_weight.rs b/pallets/system/src/extensions/check_weight.rs index c2e8e8a48..4e2fc8df7 100644 --- a/pallets/system/src/extensions/check_weight.rs +++ b/pallets/system/src/extensions/check_weight.rs @@ -109,8 +109,8 @@ where dynamic_block_len.cols, dynamic_block_len.chunk_size(), ) - .size() - .ok_or(InvalidTransaction::Custom(MaxPaddedLenExceeded as u8))?; + .ok_or(InvalidTransaction::Custom(MaxPaddedLenExceeded as u8))? + .size(); let max_padded_len = u32::try_from(max_padded_len) .map_err(|_| InvalidTransaction::Custom(MaxPaddedLenExceeded as u8))?; diff --git a/pallets/system/src/header_builder.rs b/pallets/system/src/header_builder.rs index c4422a6cb..e683d6b30 100644 --- a/pallets/system/src/header_builder.rs +++ b/pallets/system/src/header_builder.rs @@ -139,8 +139,8 @@ pub fn build_extension( .expect("Build commitments cannot fail .qed"); let app_lookup = DataLookup::from_id_and_len_iter(xts_layout.into_iter()) .expect("Extrinsic size cannot overflow .qed"); - let rows = block_dims.rows.0.saturated_into::(); - let cols = block_dims.cols.0.saturated_into::(); + let rows = block_dims.rows().0.saturated_into::(); + let cols = block_dims.cols().0.saturated_into::(); // **NOTE:** Header extension V2 is not yet enable by default. if cfg!(feature = "header_extension_v2") { diff --git a/rpc/kate-rpc/src/lib.rs b/rpc/kate-rpc/src/lib.rs index eff8402cc..98527f993 100644 --- a/rpc/kate-rpc/src/lib.rs +++ b/rpc/kate-rpc/src/lib.rs @@ -367,7 +367,8 @@ where BlockLengthRows(dimensions.rows().get().into()), BlockLengthColumns(dimensions.cols().get().into()), BLOCK_CHUNK_SIZE, - ); + ) + .ok_or_else(|| internal_err!("Block dimensions are invalid"))?; let kc_public_params_raw = self.client