Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/token-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdean-digicatapult committed Sep 18, 2023
2 parents 01db5da + 9ab3dfc commit 8ae2924
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 107 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ jobs:
SCCACHE_CACHE_SIZE: "1G"
BINDGEN_EXTRA_CLANG_ARGS: ${{ matrix.architectures.bindgenExtraClangArgs }}
run: |
cargo build --release --target ${{ matrix.architectures.target-tupl }}
cargo build --profile=production --target ${{ matrix.architectures.target-tupl }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dscp-node-${{ matrix.architectures.arch }}
path: |
./target/${{ matrix.architectures.target-tupl }}/release/dscp-node
./target/${{ matrix.architectures.target-tupl }}/release/wbuild/dscp-node-runtime/dscp_node_runtime.compact.wasm
./target/${{ matrix.architectures.target-tupl }}/production/dscp-node
./target/${{ matrix.architectures.target-tupl }}/production/wbuild/dscp-node-runtime/dscp_node_runtime.compact.wasm
build-release:
name: Build release
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
- name: Build release version
uses: softprops/action-gh-release@v1
with:
token: '${{ secrets.GITHUB_TOKEN }}'
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: ${{ needs.get-version.outputs.version }}
name: ${{ needs.get-version.outputs.version }}
prerelease: ${{ needs.get-version.outputs.is_prerelease == 'true' }}
Expand All @@ -193,7 +193,7 @@ jobs:
if: ${{ needs.get-version.outputs.is_prerelease != 'true' }}
uses: softprops/action-gh-release@v1
with:
token: '${{ secrets.GITHUB_TOKEN }}'
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: latest
name: Latest ${{ needs.get-version.outputs.version }}
prerelease: false
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ panic = 'unwind'

[workspace]
members = ['node', 'pallets/*', 'runtime']

[profile.production]
inherits = "release"
lto = true
codegen-units = 1
42 changes: 22 additions & 20 deletions pallets/process-validation/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//! Autogenerated weights for `pallet_process_validation`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-05-15, STEPS: `2`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-09-06, STEPS: `50`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `GVXM3KTWQY.local`, CPU: `<UNKNOWN>`
//! HOSTNAME: `ip-172-31-22-93.eu-west-2.compute.internal`, CPU: `AMD EPYC 7571`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// ./target/release/dscp-node
// ./target/production/dscp-node
// benchmark
// pallet
// --pallet
Expand All @@ -18,7 +18,9 @@
// --repeat
// 1000
// --output
// ./weights/
// pallets/process-validation/src/weights.rs
// --steps
// 50

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -44,13 +46,13 @@ impl<T: frame_system::Config + Config> ValidateProcessWeights<u32> for Substrate
/// The range of component `r` is `[1, 101]`.
fn validate_process(r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `131 + r * (14 ±0)`
// Measured: `136 + r * (14 ±0)`
// Estimated: `18813`
// Minimum execution time: 5_000_000 picoseconds.
Weight::from_parts(5_837_220, 0)
// Minimum execution time: 10_850_000 picoseconds.
Weight::from_parts(14_536_328, 0)
.saturating_add(Weight::from_parts(0, 18813))
// Standard Error: 126
.saturating_add(Weight::from_parts(80_780, 0).saturating_mul(r.into()))
// Standard Error: 157
.saturating_add(Weight::from_parts(138_656, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: ProcessValidation ProcessModel (r:1 w:0)
Expand All @@ -59,8 +61,8 @@ impl<T: frame_system::Config + Config> ValidateProcessWeights<u32> for Substrate
// Proof Size summary in bytes:
// Measured: `146`
// Estimated: `18813`
// Minimum execution time: 5_000_000 picoseconds.
Weight::from_parts(6_000_000, 0)
// Minimum execution time: 11_040_000 picoseconds.
Weight::from_parts(11_350_000, 0)
.saturating_add(Weight::from_parts(0, 18813))
.saturating_add(T::DbWeight::get().reads(1))
}
Expand All @@ -70,8 +72,8 @@ impl<T: frame_system::Config + Config> ValidateProcessWeights<u32> for Substrate
// Proof Size summary in bytes:
// Measured: `1550`
// Estimated: `18813`
// Minimum execution time: 13_000_000 picoseconds.
Weight::from_parts(14_000_000, 0)
// Minimum execution time: 27_901_000 picoseconds.
Weight::from_parts(28_460_000, 0)
.saturating_add(Weight::from_parts(0, 18813))
.saturating_add(T::DbWeight::get().reads(1))
}
Expand All @@ -87,11 +89,11 @@ impl<T: frame_system::Config + Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `131`
// Estimated: `18813`
// Minimum execution time: 9_000_000 picoseconds.
Weight::from_parts(9_870_000, 0)
// Minimum execution time: 22_721_000 picoseconds.
Weight::from_parts(25_992_796, 0)
.saturating_add(Weight::from_parts(0, 18813))
// Standard Error: 0
.saturating_add(Weight::from_parts(130_000, 0).saturating_mul(r.into()))
// Standard Error: 129
.saturating_add(Weight::from_parts(261_326, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
Expand All @@ -103,8 +105,8 @@ impl<T: frame_system::Config + Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `189`
// Estimated: `18813`
// Minimum execution time: 13_000_000 picoseconds.
Weight::from_parts(14_000_000, 0)
// Minimum execution time: 29_020_000 picoseconds.
Weight::from_parts(29_660_000, 0)
.saturating_add(Weight::from_parts(0, 18813))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
Expand All @@ -118,4 +120,4 @@ impl WeightInfo for () {
fn disable_process() -> Weight {
Weight::from_parts(0, 0)
}
}
}
47 changes: 24 additions & 23 deletions pallets/symmetric-key/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//! Autogenerated weights for `pallet_symmetric_key`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-05-15, STEPS: `2`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-09-06, STEPS: `50`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `GVXM3KTWQY.local`, CPU: `<UNKNOWN>`
//! HOSTNAME: `ip-172-31-22-93.eu-west-2.compute.internal`, CPU: `AMD EPYC 7571`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// ./target/release/dscp-node
// ./target/production/dscp-node
// benchmark
// pallet
// --pallet
Expand All @@ -18,7 +18,9 @@
// --repeat
// 1000
// --output
// ./weights/
// pallets/symmetric-key/src/weights.rs
// --steps
// 50

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -34,6 +36,7 @@ pub trait WeightInfo {
fn rotate_key() -> Weight;
}

/// Weight functions for `pallet_symmetric_key`.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: IpfsKey Key (r:0 w:1)
Expand All @@ -42,27 +45,25 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_000_000 picoseconds.
Weight::from_parts(4_000_000, 0)
// Minimum execution time: 8_440_000 picoseconds.
Weight::from_parts(9_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Babe NextRandomness (r:1 w:0)
/// Proof: Babe NextRandomness (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
/// Storage: Babe EpochStart (r:1 w:0)
/// Proof: Babe EpochStart (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: IpfsKey Key (r:0 w:1)
/// Proof: IpfsKey Key (max_values: Some(1), max_size: Some(33), added: 528, mode: MaxEncodedLen)
fn rotate_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `132`
// Estimated: `1517`
// Minimum execution time: 5_000_000 picoseconds.
Weight::from_parts(6_000_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0)
/// Proof: RandomnessCollectiveFlip RandomMaterial (max_values: Some(1), max_size: Some(2594), added: 3089, mode: MaxEncodedLen)
/// Storage: IpfsKey Key (r:0 w:1)
/// Proof: IpfsKey Key (max_values: Some(1), max_size: Some(33), added: 528, mode: MaxEncodedLen)
fn rotate_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `6`
// Estimated: `4079`
// Minimum execution time: 11_340_000 picoseconds.
Weight::from_parts(11_910_000, 0)
.saturating_add(Weight::from_parts(0, 4079))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}

impl WeightInfo for () {
Expand All @@ -72,4 +73,4 @@ impl WeightInfo for () {
fn rotate_key() -> Weight {
Weight::from_parts(0, 0)
}
}
}
30 changes: 16 additions & 14 deletions pallets/utxo-nft/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//! Autogenerated weights for `pallet_utxo_nft`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-05-15, STEPS: `2`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-09-07, STEPS: `50`, REPEAT: `1000`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `GVXM3KTWQY.local`, CPU: `<UNKNOWN>`
//! HOSTNAME: `ip-172-31-22-93.eu-west-2.compute.internal`, CPU: `AMD EPYC 7571`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
// ./target/release/dscp-node
// ./target/production/dscp-node
// benchmark
// pallet
// --pallet
Expand All @@ -18,7 +18,9 @@
// --repeat
// 1000
// --output
// ./weights/
// pallets/utxo-nft/src/weights.rs
// --steps
// 50

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand Down Expand Up @@ -47,16 +49,16 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `i` is `[1, 10]`.
/// The range of component `o` is `[1, 10]`.
fn run_process(i: u32, o: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `250 + i * (132 ±0)`
// Estimated: `18813 + i * (9436 ±0)`
// Minimum execution time: 36_000_000 picoseconds.
Weight::from_parts(18_093_555, 0)
// Proof Size summary in bytes:
// Measured: `254 + i * (132 ±0)`
// Estimated: `18813 + i * (9436 ±0)`
// Minimum execution time: 77_721_000 picoseconds.
Weight::from_parts(39_519_277, 0)
.saturating_add(Weight::from_parts(0, 18813))
// Standard Error: 8_352
.saturating_add(Weight::from_parts(4_982_666, 0).saturating_mul(i.into()))
// Standard Error: 8_352
.saturating_add(Weight::from_parts(1_561_777, 0).saturating_mul(o.into()))
// Standard Error: 2_272
.saturating_add(Weight::from_parts(9_148_646, 0).saturating_mul(i.into()))
// Standard Error: 2_272
.saturating_add(Weight::from_parts(3_105_724, 0).saturating_mul(o.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(T::DbWeight::get().writes(4))
Expand Down Expand Up @@ -86,4 +88,4 @@ impl WeightInfo for () {
fn delete_token() -> Weight {
Weight::from_parts(1, 1)
}
}
}
44 changes: 0 additions & 44 deletions runtime/src/constants.rs

This file was deleted.

2 changes: 2 additions & 0 deletions runtime/src/constants/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod time;
pub mod weights;
42 changes: 42 additions & 0 deletions runtime/src/constants/time.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use crate::{BlockNumber, Moment};

/// Since BABE is probabilistic this is the average expected block time that
/// we are targeting. Blocks will be produced at a minimum duration defined
/// by `SLOT_DURATION`, but some slots will not be allocated to any
/// authority and hence no block will be produced. We expect to have this
/// block time on average following the defined slot duration and the value
/// of `c` configured for BABE (where `1 - c` represents the probability of
/// a slot being empty).
/// This value is only used indirectly to define the unit constants below
/// that are expressed in blocks. The rest of the code should use
/// `SLOT_DURATION` instead (like the Timestamp pallet for calculating the
/// minimum period).
///
/// If using BABE with secondary slots (default) then all of the slots will
/// always be assigned, in which case `MILLISECS_PER_BLOCK` and
/// `SLOT_DURATION` should have the same value.
///
/// <https://research.web3.foundation/en/latest/polkadot/block-production/Babe.html#-6.-practical-results>
pub const MILLISECS_PER_BLOCK: Moment = 6000;
pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
// Attempting to do so will brick block production.
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;

// 1 in 4 blocks (on average, not counting collisions) will be primary BABE blocks.
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);

// NOTE: Currently it is not possible to change the epoch duration after the chain has started.
// Attempting to do so will brick block production.
pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
pub const EPOCH_DURATION_IN_SLOTS: u64 = {
const SLOT_FILL_RATE: f64 = MILLISECS_PER_BLOCK as f64 / SLOT_DURATION as f64;

(EPOCH_DURATION_IN_BLOCKS as f64 * SLOT_FILL_RATE) as u64
};

// These time units are defined in number of blocks.
pub const MINUTES: BlockNumber = 60 / (SECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
Loading

0 comments on commit 8ae2924

Please sign in to comment.