Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parity-bridges-common
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
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
parity
Mirrored projects
parity-bridges-common
Commits
1d06645d
Commit
1d06645d
authored
1 year ago
by
Svyatoslav Nikolsky
Browse files
Options
Downloads
Patches
Plain Diff
fix review comments
parent
21215cd8
Branches
1863
No related merge requests found
Pipeline
#245395
passed with stages
in 18 minutes and 30 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/grandpa/src/lib.rs
+4
-4
4 additions, 4 deletions
modules/grandpa/src/lib.rs
modules/grandpa/src/mock.rs
+1
-1
1 addition, 1 deletion
modules/grandpa/src/mock.rs
modules/grandpa/src/storage_types.rs
+4
-4
4 additions, 4 deletions
modules/grandpa/src/storage_types.rs
with
9 additions
and
9 deletions
modules/grandpa/src/lib.rs
+
4
−
4
View file @
1d06645d
...
...
@@ -192,7 +192,7 @@ pub mod pallet {
ensure!
(
best_finalized_number
<
*
number
,
<
Error
<
T
,
I
>>
::
OldHeader
);
let
authority_set
=
<
CurrentAuthoritySet
<
T
,
I
>>
::
get
();
let
extra
_proof_size
_bytes
=
authority_set
.
extra
_proof_size
_bytes
();
let
unused
_proof_size
=
authority_set
.
unused
_proof_size
();
let
set_id
=
authority_set
.set_id
;
verify_justification
::
<
T
,
I
>
(
&
justification
,
hash
,
*
number
,
authority_set
.into
())
?
;
...
...
@@ -222,9 +222,8 @@ pub mod pallet {
justification
.commit.precommits
.len
()
.saturated_into
(),
justification
.votes_ancestries
.len
()
.saturated_into
(),
);
let
actual_weight
=
pre_dispatch_weight
.set_proof_size
(
pre_dispatch_weight
.proof_size
()
.saturating_sub
(
extra_proof_size_bytes
),
);
let
actual_weight
=
pre_dispatch_weight
.set_proof_size
(
pre_dispatch_weight
.proof_size
()
.saturating_sub
(
unused_proof_size
));
Ok
(
PostDispatchInfo
{
actual_weight
:
Some
(
actual_weight
),
pays_fee
})
}
...
...
@@ -851,6 +850,7 @@ mod tests {
// our test config assumes 2048 max authorities and we are just using couple
let
pre_dispatch_proof_size
=
pre_dispatch_weight
.proof_size
();
let
actual_proof_size
=
result
.unwrap
()
.actual_weight
.unwrap
()
.proof_size
();
assert!
(
actual_proof_size
>
0
);
assert!
(
actual_proof_size
<
pre_dispatch_proof_size
,
"Actual proof size {actual_proof_size} must be less than the pre-dispatch {pre_dispatch_proof_size}"
,
...
...
This diff is collapsed.
Click to expand it.
modules/grandpa/src/mock.rs
+
1
−
1
View file @
1d06645d
...
...
@@ -33,7 +33,7 @@ pub type TestNumber = crate::BridgedBlockNumber<TestRuntime, ()>;
type
Block
=
frame_system
::
mocking
::
MockBlock
<
TestRuntime
>
;
type
UncheckedExtrinsic
=
frame_system
::
mocking
::
MockUncheckedExtrinsic
<
TestRuntime
>
;
pub
const
MAX_BRIDGED_AUTHORITIES
:
u32
=
2048
;
pub
const
MAX_BRIDGED_AUTHORITIES
:
u32
=
5
;
use
crate
as
grandpa
;
...
...
This diff is collapsed.
Click to expand it.
modules/grandpa/src/storage_types.rs
+
4
−
4
View file @
1d06645d
...
...
@@ -53,7 +53,7 @@ impl<T: Config<I>, I: 'static> StoredAuthoritySet<T, I> {
/// Maximal authorities set size is configured by the `MaxBridgedAuthorities` constant from
/// the pallet configuration. The PoV of the call includes the size of maximal authorities
/// count. If the actual size is smaller, we may subtract extra bytes from this component.
pub
fn
extra
_proof_size
_bytes
(
&
self
)
->
u64
{
pub
fn
unused
_proof_size
(
&
self
)
->
u64
{
// we can only safely estimate bytes that are occupied by the authority data itself. We have
// no means here to compute PoV bytes, occupied by extra trie nodes or extra bytes in the
// whole set encoding
...
...
@@ -91,7 +91,7 @@ mod tests {
type
StoredAuthoritySet
=
super
::
StoredAuthoritySet
<
TestRuntime
,
()
>
;
#[test]
fn
extra
_proof_size_
bytes_
works
()
{
fn
unused
_proof_size_works
()
{
let
authority_entry
=
authority_list
()
.pop
()
.unwrap
();
// when we have exactly `MaxBridgedAuthorities` authorities
...
...
@@ -101,7 +101,7 @@ mod tests {
0
,
)
.unwrap
()
.
extra
_proof_size
_bytes
(),
.
unused
_proof_size
(),
0
,
);
...
...
@@ -112,7 +112,7 @@ mod tests {
0
,
)
.unwrap
()
.
extra
_proof_size
_bytes
(),
.
unused
_proof_size
(),
40
,
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment