Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Merge requests
!47
Set manually all weights for ğdev
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Set manually all weights for ğdev
elois-manual-weights
into
master
Overview
0
Commits
4
Pipelines
0
Changes
7
Merged
Éloïs
requested to merge
elois-manual-weights
into
master
2 years ago
Overview
0
Commits
4
Pipelines
0
Changes
7
Expand
Closes
#35 (closed)
0
0
Merge request reports
Viewing commit
59ded47e
Prev
Next
Show latest version
7 files
+
111
−
87
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
59ded47e
fix(weights): define safe manual weights for pallets babe & grandpa
· 59ded47e
Éloïs
authored
2 years ago
runtime/common/src/weights/pallet_babe.rs
0 → 100644
+
51
−
0
Options
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
//! Manual weights for the GRANDPA Pallet in duniter runtimes
//! This file was not auto-generated.
use
frame_support
::{
traits
::
Get
,
weights
::{
constants
::{
WEIGHT_PER_MICROS
,
WEIGHT_PER_NANOS
},
Weight
,
},
};
use
sp_std
::
marker
::
PhantomData
;
/// Weight functions for `pallet_babe`.
pub
struct
WeightInfo
<
T
>
(
PhantomData
<
T
>
);
impl
<
T
:
frame_system
::
Config
>
pallet_babe
::
WeightInfo
for
WeightInfo
<
T
>
{
fn
plan_config_change
()
->
Weight
{
T
::
DbWeight
::
get
()
.writes
(
1
)
}
fn
report_equivocation
(
validator_count
:
u32
)
->
Weight
{
// we take the validator set count from the membership proof to
// calculate the weight but we set a floor of 100 validators.
let
validator_count
=
validator_count
.max
(
100
)
as
u64
;
// checking membership proof
(
35
*
WEIGHT_PER_MICROS
)
.saturating_add
((
175
*
WEIGHT_PER_NANOS
)
.saturating_mul
(
validator_count
))
.saturating_add
(
T
::
DbWeight
::
get
()
.reads
(
5
))
// check equivocation proof
.saturating_add
(
110
*
WEIGHT_PER_MICROS
)
// report offence
.saturating_add
(
110
*
WEIGHT_PER_MICROS
)
.saturating_add
(
T
::
DbWeight
::
get
()
.writes
(
3
))
}
}
Loading