Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HB Substrate Builder Program - Milestone Review 2 #569

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pallets/bridge-registry/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ pub trait WeightInfo {
fn force_reset_indices() -> Weight;
}

/// <HB SBP Review M2
///
/// The code is running under the release 0.9.39 however the weights are still using weights v1
/// since it is considering only one value (ref time). The output of the CLI should configure the weights
/// to use the `from_parts(ref time,proof size)` fn
///
/// HB SBP Review M2>

/// Weights for pallet_bridge_registry using the Substrate node and recommended hardware.
pub struct WebbWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for WebbWeight<T> {
Expand Down
21 changes: 21 additions & 0 deletions pallets/dkg-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,18 @@ pub mod pallet {
}
}

/// <HB SBP Review M2
///
/// Is the validate_unsigned fn used anywhere? I'm not able to find if this is used in any OCW.
///
/// We detected a vector atack with unsigned transactions from OCW: A malissuous validator might
/// push tempered data and the validators wouldn't be punished for this. Validators are only
/// subject to slashing if they create a block that violates the STF. Creating valid
/// transactions with tampered data would not result in slashing, and therefore the possibility
/// of malicious Validators in this context is real.
///
/// HB SBP Review M2>

#[pallet::validate_unsigned]
impl<T: Config> ValidateUnsigned for Pallet<T> {
type Call = Call<T>;
Expand Down Expand Up @@ -1454,6 +1466,15 @@ pub mod pallet {
}
}

/// <HB SBP Review M2
///
/// I would recommend extracting these functions into it's own file to help the pallet's readability
/// and to reduce the number of lines to this file.
///
/// Here there is a proposal about a code organization for a big pallet like this one:
/// https://github.com/paritytech/substrate/blob/master/frame/assets/src
///
/// HB SBP Review M2>
impl<T: Config> Pallet<T> {
/// Return the current active DKG authority set.
pub fn authority_set() -> AuthoritySet<T::DKGId, T::MaxAuthorities> {
Expand Down
8 changes: 8 additions & 0 deletions pallets/dkg-metadata/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ pub trait WeightInfo {
fn force_unjail_keygen() -> Weight;
}

/// <HB SBP Review M2
///
/// The code is running under the release 0.9.39 however the weights are still using weights v1
/// since it is considering only one value (ref time). The output of the CLI should configure the weights
/// to use the `from_parts(ref time,proof size)` fn
///
/// HB SBP Review M2>

/// Weight functions for `pallet_dkg_metadata`.
pub struct WebbWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for WebbWeight<T> {
Expand Down
11 changes: 11 additions & 0 deletions pallets/dkg-proposal-handler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,17 @@ pub mod pallet {
}
}

/// <HB SBP Review M2
///
/// Is the validate_unsigned fn used anywhere? I'm not able to find if this is used in any OCW.
///
/// We detected a vector atack with unsigned transactions from OCW: A malissuous validator might
/// push tempered data and the validators wouldn't be punished for this. Validators are only
/// subject to slashing if they create a block that violates the STF. Creating valid
/// transactions with tampered data would not result in slashing, and therefore the possibility
/// of malicious Validators in this context is real.
///
/// HB SBP Review M2>
#[pallet::validate_unsigned]
impl<T: Config> ValidateUnsigned for Pallet<T> {
type Call = Call<T>;
Expand Down
9 changes: 9 additions & 0 deletions pallets/dkg-proposal-handler/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ pub trait WeightInfo {
fn submit_signed_proposals(n: u32) -> Weight;
fn force_submit_unsigned_proposal() -> Weight;
}

/// <HB SBP Review M2
///
/// The code is running under the release 0.9.39 however the weights are still using weights v1
/// since it is considering only one value (ref time). The output of the CLI should configure the weights
/// to use the `from_parts(ref time,proof size)` fn
///
/// HB SBP Review M2>

/// Weight functions for `pallet_dkg_proposal_handler`.
pub struct WebbWeight<T>(PhantomData<T>);
impl<T: frame_system::Config>WeightInfo for WebbWeight<T> {
Expand Down
8 changes: 8 additions & 0 deletions pallets/dkg-proposals/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ pub trait WeightInfo {
fn eval_vote_state(_c: u32,) -> Weight;
}

/// <HB SBP Review M2
///
/// The code is running under the release 0.9.39 however the weights are still using weights v1
/// since it is considering only one value (ref time). The output of the CLI should configure the weights
/// to use the `from_parts(ref time,proof size)` fn
///
/// HB SBP Review M2>

/// Weight functions for `pallet_dkg_proposals`.
pub struct WebbWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for WebbWeight<T> {
Expand Down