Skip to content

Commit

Permalink
update size per tx (#174)
Browse files Browse the repository at this point in the history
* update size per tx

* fixes on tests

* up spec_version

* bump node version

* empty disk on runner machine

(cherry picked from commit 35bb827)

---------

Co-authored-by: Leouarz <[email protected]>
  • Loading branch information
kroos47 and Leouarz authored Jul 11, 2023
1 parent ee9dcad commit bb4cc10
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 78 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions avail-subxt/examples/max_block_submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
2 changes: 1 addition & 1 deletion pallets/dactr/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pallets/dactr/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
139 changes: 70 additions & 69 deletions pallets/dactr/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,58 +63,59 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
}
}

Expand All @@ -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))
}
}
2 changes: 1 addition & 1 deletion pallets/mocked_runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bb4cc10

Please sign in to comment.