From bb4cc104b250db07c315be4a3284fed3c0c078db Mon Sep 17 00:00:00 2001 From: Kailas Date: Tue, 11 Jul 2023 18:30:22 +0530 Subject: [PATCH] update size per tx (#174) * update size per tx * fixes on tests * up spec_version * bump node version * empty disk on runner machine (cherry picked from commit 35bb82797cd4ae6b16938a25c7b50d2fc7e12e97) --------- Co-authored-by: Leouarz --- .github/workflows/default.yml | 7 ++ Cargo.lock | 2 +- avail-subxt/examples/max_block_submit.rs | 4 +- node/Cargo.toml | 2 +- pallets/dactr/src/benchmarking.rs | 2 +- pallets/dactr/src/mock.rs | 2 +- pallets/dactr/src/weights.rs | 139 ++++++++++++----------- pallets/mocked_runtime/src/lib.rs | 2 +- runtime/src/constants.rs | 2 +- runtime/src/lib.rs | 2 +- 10 files changed, 86 insertions(+), 78 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index ed2c77db5..93557fb5b 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -155,6 +155,13 @@ jobs: - name: Generate test code coverage report run: | + df -h + sudo apt-get autoremove + sudo apt-get clean + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" cargo +stable install --force grcov grcov . -s . --binary-path ./target/release/ -t lcov --branch --ignore-not-existing -o lcov.info diff --git a/Cargo.lock b/Cargo.lock index 36a8e15f0..b9a12db9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1699,7 +1699,7 @@ dependencies = [ [[package]] name = "data-avail" -version = "1.6.1" +version = "1.6.2" dependencies = [ "async-trait", "avail-base", diff --git a/avail-subxt/examples/max_block_submit.rs b/avail-subxt/examples/max_block_submit.rs index 6eb77e5a2..d9d760066 100644 --- a/avail-subxt/examples/max_block_submit.rs +++ b/avail-subxt/examples/max_block_submit.rs @@ -13,7 +13,7 @@ use subxt::tx::PairSigner; /// This example attempts to submit data to fill the entire block. Note that this doesn't guarantee /// that the block will be filled, but if you submit more than a full block, then it will spill over -/// to the next block. The limit for the transaction is currently set to 16 kB, and limit for the block +/// to the next block. The limit for the transaction is currently set to 512 kB, and limit for the block /// is 2 MB, so this means 128 data transactions are needed to fill the block. Depending on the network, /// it may not be possible to transfer so many in 20 s (the default block time) @@ -24,7 +24,7 @@ async fn main() -> Result<()> { let signer = PairSigner::new(AccountKeyring::Alice.pair()); let size: usize = 2 * 1024 * 1024; - let max_size: usize = 16 * 1024; + let max_size: usize = 512 * 1024; let num_chunks = size / max_size; let extrinsic_params = AvailExtrinsicParams::new_with_app_id(1.into()); let start = Instant::now(); diff --git a/node/Cargo.toml b/node/Cargo.toml index a15b0e0e9..e58e0d0da 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data-avail" -version = "1.6.1" +version = "1.6.2" description = "Avail Node" authors = ["Anonymous"] homepage = "https://www.availproject.org/" diff --git a/pallets/dactr/src/benchmarking.rs b/pallets/dactr/src/benchmarking.rs index 19a6091d2..1965f5cf1 100644 --- a/pallets/dactr/src/benchmarking.rs +++ b/pallets/dactr/src/benchmarking.rs @@ -137,7 +137,7 @@ where let rows = BlockLengthRows(prev_power_of_two(rows)); let cols = BlockLengthColumns(cols); - let mut nb_tx = 128; // Value set depending on MaxAppDataLength (16 kb) to reach 2 mb + let mut nb_tx = 4; // Value set depending on MaxAppDataLength (512 kb) to reach 2 mb let max_tx: u32 = rows.0 * cols.0 * (BLOCK_CHUNK_SIZE - 2) / data_length; if nb_tx > max_tx { nb_tx = max_tx; diff --git a/pallets/dactr/src/mock.rs b/pallets/dactr/src/mock.rs index 2807f5534..67c449ea9 100644 --- a/pallets/dactr/src/mock.rs +++ b/pallets/dactr/src/mock.rs @@ -108,7 +108,7 @@ impl pallet_balances::Config for Test { parameter_types! { pub const MaxAppKeyLength: u32 = 32; - pub const MaxAppDataLength: u32 = 16 * 1024; // 16 Kb + pub const MaxAppDataLength: u32 = 512 * 1024; // 512 Kb pub const MinBlockRows: BlockLengthRows = BlockLengthRows(32); pub const MaxBlockRows: BlockLengthRows = BlockLengthRows(1024); pub const MinBlockCols: BlockLengthColumns = BlockLengthColumns(32); diff --git a/pallets/dactr/src/weights.rs b/pallets/dactr/src/weights.rs index 73836d5c4..d7f23e301 100644 --- a/pallets/dactr/src/weights.rs +++ b/pallets/dactr/src/weights.rs @@ -18,20 +18,19 @@ //! Autogenerated weights for da_control //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-06-28, STEPS: `20`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `ip-172-31-12-189`, CPU: `Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: 2023-07-01, STEPS: `50`, REPEAT: 25, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `ip-172-31-5-24`, CPU: `Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz` +//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: // ./target/release/data-avail // benchmark // pallet // --chain=dev -// --steps=20 -// --repeat=10 +// --steps=50 +// --repeat=25 // --log=warn -// --execution=wasm -// --wasm-execution=compiled +// --execution=native // --template=./.maintain/frame-weight-template.hbs // --header=./HEADER-APACHE2 // --pallet=da-control @@ -64,58 +63,59 @@ impl WeightInfo for SubstrateWeight { // Storage: DataAvailability AppKeys (r:1 w:1) // Storage: DataAvailability NextAppId (r:1 w:1) fn create_application_key() -> Weight { - // Minimum execution time: 45_904 nanoseconds. - Weight::from_ref_time(46_315_000_u64) + // Minimum execution time: 26_706 nanoseconds. + Weight::from_ref_time(27_653_000_u64) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } - // Storage: System DynamicBlockLength (r:0 w:1) + // Storage: System DynamicBlockLength (r:1 w:1) fn submit_block_length_proposal() -> Weight { - // Minimum execution time: 31_242 nanoseconds. - Weight::from_ref_time(31_768_000_u64) + // Minimum execution time: 22_841 nanoseconds. + Weight::from_ref_time(23_486_000_u64) + .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// The range of component `i` is `[1, 16384]`. + /// The range of component `i` is `[1, 524288]`. fn submit_data(i: u32, ) -> Weight { - // Minimum execution time: 29_620 nanoseconds. - Weight::from_ref_time(30_987_273_u64) - // Standard Error: 202 - .saturating_add(Weight::from_ref_time(1_679_u64).saturating_mul(i as u64)) + // Minimum execution time: 17_107 nanoseconds. + Weight::from_ref_time(9_816_023_u64) + // Standard Error: 1 + .saturating_add(Weight::from_ref_time(287_u64).saturating_mul(i as u64)) } - /// The range of component `i` is `[0, 16384]`. + /// The range of component `i` is `[0, 524288]`. fn data_root(i: u32, ) -> Weight { - // Minimum execution time: 1_700 nanoseconds. - Weight::from_ref_time(6_651_755_u64) - // Standard Error: 148 - .saturating_add(Weight::from_ref_time(6_118_u64).saturating_mul(i as u64)) + // Minimum execution time: 609 nanoseconds. + Weight::from_ref_time(672_000_u64) + // Standard Error: 12 + .saturating_add(Weight::from_ref_time(4_321_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_32(i: u32, ) -> Weight { - // Minimum execution time: 134_714_802 nanoseconds. - Weight::from_ref_time(134_923_916_000_u64) - // Standard Error: 116_719_651 - .saturating_add(Weight::from_ref_time(2_309_348_154_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_674_133 nanoseconds. + Weight::from_ref_time(1_782_369_000_u64) + // Standard Error: 33_902_431 + .saturating_add(Weight::from_ref_time(214_276_156_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_64(i: u32, ) -> Weight { - // Minimum execution time: 144_361_245 nanoseconds. - Weight::from_ref_time(144_363_046_000_u64) - // Standard Error: 136_215_557 - .saturating_add(Weight::from_ref_time(2_757_470_293_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_669_019 nanoseconds. + Weight::from_ref_time(1_742_205_000_u64) + // Standard Error: 46_184_424 + .saturating_add(Weight::from_ref_time(2_679_720_641_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_128(i: u32, ) -> Weight { - // Minimum execution time: 237_290_099 nanoseconds. - Weight::from_ref_time(237_708_267_000_u64) - // Standard Error: 354_962_399 - .saturating_add(Weight::from_ref_time(5_292_984_038_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_843_601 nanoseconds. + Weight::from_ref_time(1_942_890_000_u64) + // Standard Error: 43_871_963 + .saturating_add(Weight::from_ref_time(4_222_032_369_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_256(i: u32, ) -> Weight { - // Minimum execution time: 449_926_490 nanoseconds. - Weight::from_ref_time(441_894_373_974_u64) - // Standard Error: 664_849_055 - .saturating_add(Weight::from_ref_time(8_712_777_718_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_864_952 nanoseconds. + Weight::from_ref_time(459_958_961_086_u64) + // Standard Error: 102_554_927 + .saturating_add(Weight::from_ref_time(5_707_004_205_u64).saturating_mul(i as u64)) } } @@ -124,57 +124,58 @@ impl WeightInfo for () { // Storage: DataAvailability AppKeys (r:1 w:1) // Storage: DataAvailability NextAppId (r:1 w:1) fn create_application_key() -> Weight { - // Minimum execution time: 45_904 nanoseconds. - Weight::from_ref_time(46_315_000_u64) + // Minimum execution time: 26_706 nanoseconds. + Weight::from_ref_time(27_653_000_u64) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } - // Storage: System DynamicBlockLength (r:0 w:1) + // Storage: System DynamicBlockLength (r:1 w:1) fn submit_block_length_proposal() -> Weight { - // Minimum execution time: 31_242 nanoseconds. - Weight::from_ref_time(31_768_000_u64) + // Minimum execution time: 22_841 nanoseconds. + Weight::from_ref_time(23_486_000_u64) + .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// The range of component `i` is `[1, 16384]`. + /// The range of component `i` is `[1, 524288]`. fn submit_data(i: u32, ) -> Weight { - // Minimum execution time: 29_620 nanoseconds. - Weight::from_ref_time(30_987_273_u64) - // Standard Error: 202 - .saturating_add(Weight::from_ref_time(1_679_u64).saturating_mul(i as u64)) + // Minimum execution time: 17_107 nanoseconds. + Weight::from_ref_time(9_816_023_u64) + // Standard Error: 1 + .saturating_add(Weight::from_ref_time(287_u64).saturating_mul(i as u64)) } - /// The range of component `i` is `[0, 16384]`. + /// The range of component `i` is `[0, 524288]`. fn data_root(i: u32, ) -> Weight { - // Minimum execution time: 1_700 nanoseconds. - Weight::from_ref_time(6_651_755_u64) - // Standard Error: 148 - .saturating_add(Weight::from_ref_time(6_118_u64).saturating_mul(i as u64)) + // Minimum execution time: 609 nanoseconds. + Weight::from_ref_time(672_000_u64) + // Standard Error: 12 + .saturating_add(Weight::from_ref_time(4_321_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_32(i: u32, ) -> Weight { - // Minimum execution time: 134_714_802 nanoseconds. - Weight::from_ref_time(134_923_916_000_u64) - // Standard Error: 116_719_651 - .saturating_add(Weight::from_ref_time(2_309_348_154_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_674_133 nanoseconds. + Weight::from_ref_time(1_782_369_000_u64) + // Standard Error: 33_902_431 + .saturating_add(Weight::from_ref_time(214_276_156_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_64(i: u32, ) -> Weight { - // Minimum execution time: 144_361_245 nanoseconds. - Weight::from_ref_time(144_363_046_000_u64) - // Standard Error: 136_215_557 - .saturating_add(Weight::from_ref_time(2_757_470_293_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_669_019 nanoseconds. + Weight::from_ref_time(1_742_205_000_u64) + // Standard Error: 46_184_424 + .saturating_add(Weight::from_ref_time(2_679_720_641_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_128(i: u32, ) -> Weight { - // Minimum execution time: 237_290_099 nanoseconds. - Weight::from_ref_time(237_708_267_000_u64) - // Standard Error: 354_962_399 - .saturating_add(Weight::from_ref_time(5_292_984_038_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_843_601 nanoseconds. + Weight::from_ref_time(1_942_890_000_u64) + // Standard Error: 43_871_963 + .saturating_add(Weight::from_ref_time(4_222_032_369_u64).saturating_mul(i as u64)) } /// The range of component `i` is `[32, 1024]`. fn commitment_builder_256(i: u32, ) -> Weight { - // Minimum execution time: 449_926_490 nanoseconds. - Weight::from_ref_time(441_894_373_974_u64) - // Standard Error: 664_849_055 - .saturating_add(Weight::from_ref_time(8_712_777_718_u64).saturating_mul(i as u64)) + // Minimum execution time: 1_864_952 nanoseconds. + Weight::from_ref_time(459_958_961_086_u64) + // Standard Error: 102_554_927 + .saturating_add(Weight::from_ref_time(5_707_004_205_u64).saturating_mul(i as u64)) } } diff --git a/pallets/mocked_runtime/src/lib.rs b/pallets/mocked_runtime/src/lib.rs index 027a9307c..a66e8411d 100644 --- a/pallets/mocked_runtime/src/lib.rs +++ b/pallets/mocked_runtime/src/lib.rs @@ -109,7 +109,7 @@ parameter_types! { // DA Control pub const MaxAppKeyLength :u32 = 64; - pub const MaxAppDataLength :u32 = 16 * 1024; // 16 Kb + pub const MaxAppDataLength :u32 = 512 * 1024; // 512 Kb pub const MinBlockRows: BlockLengthRows = BlockLengthRows(32); pub const MaxBlockRows: BlockLengthRows = BlockLengthRows(1024); pub const MinBlockCols: BlockLengthColumns = BlockLengthColumns(32); diff --git a/runtime/src/constants.rs b/runtime/src/constants.rs index e843b5d8c..324886ad0 100644 --- a/runtime/src/constants.rs +++ b/runtime/src/constants.rs @@ -459,7 +459,7 @@ pub mod da { pub const MaxBlockCols: BlockLengthColumns = kate::config::MAX_BLOCK_COLUMNS; } pub type MaxAppKeyLength = ConstU32<64>; - pub type MaxAppDataLength = ConstU32<16_384>; // 16 Kb + pub type MaxAppDataLength = ConstU32<524_288>; // 512 Kb } pub mod nomad { diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index a8d9c04e9..db1712bd6 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -123,7 +123,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 10, + spec_version: 11, impl_version: 0, apis: apis::runtime_api_versions(), transaction_version: 1,