Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
1fd29876
Commit
1fd29876
authored
Aug 25, 2020
by
Cecile Tonglet
Browse files
Merge commit
62cf5b97
(no conflict)
Parent branch: origin/master Forked at:
bf7ccb84
parents
41cb5b5f
62cf5b97
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
1fd29876
This diff is collapsed.
Click to expand it.
node/subsystem-test-helpers/src/lib.rs
View file @
1fd29876
...
...
@@ -275,16 +275,13 @@ pub fn subsystem_test_harness<M, OverseerFactory, Overseer, TestFactory, Test>(
let
overseer
=
overseer_factory
(
handle
);
let
test
=
test_factory
(
context
);
let
timeout
=
Delay
::
new
(
Duration
::
from_secs
(
2
));
futures
::
pin_mut!
(
overseer
,
test
,
timeout
);
futures
::
pin_mut!
(
overseer
,
test
);
futures
::
executor
::
block_on
(
async
move
{
futures
::
select!
{
_
=
overseer
.fuse
()
=>
(),
_
=
test
.fuse
()
=>
(),
_
=
timeout
.fuse
()
=>
panic!
(
"test timed out instead of completing"
),
}
future
::
join
(
overseer
,
test
)
.timeout
(
Duration
::
from_secs
(
2
))
.await
.expect
(
"test timed out instead of completing"
)
});
}
...
...
node/subsystem-util/Cargo.toml
View file @
1fd29876
...
...
@@ -30,3 +30,4 @@ async-trait = "0.1"
futures
=
{
version
=
"0.3.5"
,
features
=
["thread-pool"]
}
parking_lot
=
"0.10.0"
polkadot-node-subsystem-test-helpers
=
{
path
=
"../subsystem-test-helpers"
}
env_logger
=
"0.7.1"
node/subsystem-util/src/lib.rs
View file @
1fd29876
...
...
@@ -611,10 +611,13 @@ impl<Spawner: SpawnNamed, Job: 'static + JobTrait> Jobs<Spawner, Job> {
}
/// Send a message to the appropriate job for this `parent_hash`.
/// Will not return an error if the job is not running.
async
fn
send_msg
(
&
mut
self
,
parent_hash
:
Hash
,
msg
:
Job
::
ToJob
)
->
Result
<
(),
Error
>
{
match
self
.running
.get_mut
(
&
parent_hash
)
{
Some
(
job
)
=>
job
.send_msg
(
msg
)
.await
?
,
None
=>
return
Err
(
Error
::
JobNotFound
(
parent_hash
)),
None
=>
{
// don't bring down the subsystem, this can happen to due a race condition
},
}
Ok
(())
}
...
...
@@ -640,12 +643,17 @@ where
fn
poll_next
(
self
:
Pin
<&
mut
Self
>
,
cx
:
&
mut
task
::
Context
)
->
task
::
Poll
<
Option
<
Self
::
Item
>>
{
// pin-project the outgoing messages
self
.project
()
.outgoing_msgs
.poll_next
(
cx
)
.map
(|
opt
|
{
let
result
=
self
.project
()
.outgoing_msgs
.poll_next
(
cx
)
.map
(|
opt
|
{
opt
.and_then
(|(
stream_yield
,
_
)|
match
stream_yield
{
StreamYield
::
Item
(
msg
)
=>
Some
(
msg
),
StreamYield
::
Finished
(
_
)
=>
None
,
})
})
});
// we don't want the stream to end if the jobs are empty at some point
match
result
{
task
::
Poll
::
Ready
(
None
)
=>
task
::
Poll
::
Pending
,
otherwise
=>
otherwise
,
}
}
}
...
...
@@ -728,7 +736,7 @@ where
loop
{
select!
{
incoming
=
ctx
.recv
()
.fuse
()
=>
if
Self
::
handle_incoming
(
incoming
,
&
mut
jobs
,
&
run_args
,
&
metrics
,
&
mut
err_tx
)
.await
{
break
},
outgoing
=
jobs
.next
()
.fuse
()
=>
if
Self
::
handle_outgoing
(
outgoing
,
&
mut
ctx
,
&
mut
err_tx
)
.await
{
break
}
,
outgoing
=
jobs
.next
()
.fuse
()
=>
Self
::
handle_outgoing
(
outgoing
,
&
mut
ctx
,
&
mut
err_tx
)
.await
,
complete
=>
break
,
}
}
...
...
@@ -838,21 +846,16 @@ where
false
}
// handle an outgoing message.
return true if we should break afterwards.
// handle an outgoing message.
async
fn
handle_outgoing
(
outgoing
:
Option
<
Job
::
FromJob
>
,
ctx
:
&
mut
Context
,
err_tx
:
&
mut
Option
<
mpsc
::
Sender
<
(
Option
<
Hash
>
,
JobsError
<
Job
::
Error
>
)
>>
,
)
->
bool
{
match
outgoing
{
Some
(
msg
)
=>
{
if
let
Err
(
e
)
=
ctx
.send_message
(
msg
.into
())
.await
{
Self
::
fwd_err
(
None
,
Error
::
from
(
e
)
.into
(),
err_tx
)
.await
;
}
}
None
=>
return
true
,
)
{
let
msg
=
outgoing
.expect
(
"the Jobs stream never ends; qed"
);
if
let
Err
(
e
)
=
ctx
.send_message
(
msg
.into
())
.await
{
Self
::
fwd_err
(
None
,
Error
::
from
(
e
)
.into
(),
err_tx
)
.await
;
}
false
}
}
...
...
@@ -982,11 +985,10 @@ mod tests {
channel
::
mpsc
,
executor
,
stream
::{
self
,
StreamExt
},
Future
,
FutureExt
,
SinkExt
,
future
,
Future
,
FutureExt
,
SinkExt
,
};
use
futures_timer
::
Delay
;
use
polkadot_primitives
::
v1
::
Hash
;
use
polkadot_node_subsystem_test_helpers
::{
self
as
test_helpers
,
make_subsystem_context
};
use
polkadot_node_subsystem_test_helpers
::{
self
as
test_helpers
,
make_subsystem_context
,
TimeoutExt
as
_
};
use
std
::{
collections
::
HashMap
,
convert
::
TryFrom
,
pin
::
Pin
,
time
::
Duration
};
// basic usage: in a nutshell, when you want to define a subsystem, just focus on what its jobs do;
...
...
@@ -1140,24 +1142,28 @@ mod tests {
run_args
:
HashMap
<
Hash
,
Vec
<
FromJob
>>
,
test
:
impl
FnOnce
(
OverseerHandle
,
mpsc
::
Receiver
<
(
Option
<
Hash
>
,
JobsError
<
Error
>
)
>
)
->
T
,
)
{
let
_
=
env_logger
::
builder
()
.is_test
(
true
)
.filter
(
None
,
log
::
LevelFilter
::
Trace
,
)
.try_init
();
let
pool
=
sp_core
::
testing
::
TaskExecutor
::
new
();
let
(
context
,
overseer_handle
)
=
make_subsystem_context
(
pool
.clone
());
let
(
err_tx
,
err_rx
)
=
mpsc
::
channel
(
16
);
let
subsystem
=
FakeCandidateSelectionSubsystem
::
run
(
context
,
run_args
,
(),
pool
,
Some
(
err_tx
));
let
test_future
=
test
(
overseer_handle
,
err_rx
);
let
timeout
=
Delay
::
new
(
Duration
::
from_secs
(
2
));
futures
::
pin_mut!
(
test_future
);
futures
::
pin_mut!
(
subsystem
);
futures
::
pin_mut!
(
timeout
);
futures
::
pin_mut!
(
subsystem
,
test_future
);
executor
::
block_on
(
async
move
{
futures
::
select!
{
_
=
test_future
.fuse
()
=>
(),
_
=
subsystem
.fuse
()
=>
(),
_
=
timeout
.fuse
()
=>
panic!
(
"test timed out instead of completing"
),
}
future
::
join
(
subsystem
,
test_future
)
.timeout
(
Duration
::
from_secs
(
2
))
.await
.expect
(
"test timed out instead of completing"
)
});
}
...
...
@@ -1186,6 +1192,10 @@ mod tests {
)))
.await
;
overseer_handle
.send
(
FromOverseer
::
Signal
(
OverseerSignal
::
Conclude
))
.await
;
let
errs
:
Vec
<
_
>
=
err_rx
.collect
()
.await
;
assert_eq!
(
errs
.len
(),
0
);
});
...
...
@@ -1213,6 +1223,44 @@ mod tests {
});
}
#[test]
fn
sending_to_a_non_running_job_do_not_stop_the_subsystem
()
{
let
relay_parent
=
Hash
::
repeat_byte
(
0x01
);
let
mut
run_args
=
HashMap
::
new
();
run_args
.insert
(
relay_parent
.clone
(),
vec!
[
FromJob
::
Test
],
);
test_harness
(
run_args
,
|
mut
overseer_handle
,
err_rx
|
async
move
{
overseer_handle
.send
(
FromOverseer
::
Signal
(
OverseerSignal
::
ActiveLeaves
(
ActiveLeavesUpdate
::
start_work
(
relay_parent
),
)))
.await
;
// send to a non running job
overseer_handle
.send
(
FromOverseer
::
Communication
{
msg
:
Default
::
default
(),
})
.await
;
// the subsystem is still alive
assert_matches!
(
overseer_handle
.recv
()
.await
,
AllMessages
::
CandidateSelection
(
_
)
);
overseer_handle
.send
(
FromOverseer
::
Signal
(
OverseerSignal
::
Conclude
))
.await
;
let
errs
:
Vec
<
_
>
=
err_rx
.collect
()
.await
;
assert_eq!
(
errs
.len
(),
0
);
});
}
#[test]
fn
test_subsystem_impl_and_name_derivation
()
{
let
pool
=
sp_core
::
testing
::
TaskExecutor
::
new
();
...
...
runtime/kusama/src/lib.rs
View file @
1fd29876
...
...
@@ -92,8 +92,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
#[cfg(not(feature
=
"disable-runtime-api"
))]
apis
:
RUNTIME_API_VERSIONS
,
#[cfg(feature
=
"disable-runtime-api"
)]
apis
:
sp_
version
::
create_apis_vec!
[[]],
transaction_version
:
2
,
apis
:
version
::
create_apis_vec!
[[]],
transaction_version
:
3
,
};
/// Native version.
...
...
@@ -424,8 +424,8 @@ parameter_types! {
pub
const
VotingBond
:
Balance
=
5
*
CENTS
;
/// Daily council elections.
pub
const
TermDuration
:
BlockNumber
=
24
*
HOURS
;
pub
const
DesiredMembers
:
u32
=
1
7
;
pub
const
DesiredRunnersUp
:
u32
=
7
;
pub
const
DesiredMembers
:
u32
=
1
9
;
pub
const
DesiredRunnersUp
:
u32
=
19
;
pub
const
ElectionsPhragmenModuleId
:
LockIdentifier
=
*
b"phrelect"
;
}
// Make sure that there are no more than MAX_MEMBERS members elected via phragmen.
...
...
@@ -752,6 +752,9 @@ parameter_types! {
// Additional storage item size of 33 bytes.
pub
const
ProxyDepositFactor
:
Balance
=
deposit
(
0
,
33
);
pub
const
MaxProxies
:
u16
=
32
;
pub
const
AnnouncementDepositBase
:
Balance
=
deposit
(
1
,
8
);
pub
const
AnnouncementDepositFactor
:
Balance
=
deposit
(
0
,
66
);
pub
const
MaxPending
:
u16
=
32
;
}
impl
<
I
:
frame_support
::
traits
::
Instance
>
dummy
::
Trait
<
I
>
for
Runtime
{
}
...
...
@@ -847,7 +850,11 @@ impl pallet_proxy::Trait for Runtime {
type
ProxyDepositBase
=
ProxyDepositBase
;
type
ProxyDepositFactor
=
ProxyDepositFactor
;
type
MaxProxies
=
MaxProxies
;
type
WeightInfo
=
();
type
WeightInfo
=
weights
::
pallet_proxy
::
WeightInfo
;
type
MaxPending
=
MaxPending
;
type
CallHasher
=
BlakeTwo256
;
type
AnnouncementDepositBase
=
AnnouncementDepositBase
;
type
AnnouncementDepositFactor
=
AnnouncementDepositFactor
;
}
pub
struct
CustomOnRuntimeUpgrade
;
...
...
runtime/kusama/src/weights/mod.rs
View file @
1fd29876
...
...
@@ -21,3 +21,4 @@ pub mod pallet_balances;
pub
mod
pallet_democracy
;
pub
mod
pallet_timestamp
;
pub
mod
pallet_utility
;
pub
mod
pallet_proxy
;
runtime/kusama/src/weights/pallet_proxy.rs
0 → 100644
View file @
1fd29876
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot 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 General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5
use
frame_support
::
weights
::{
Weight
,
constants
::
RocksDbWeight
as
DbWeight
};
pub
struct
WeightInfo
;
impl
pallet_proxy
::
WeightInfo
for
WeightInfo
{
fn
proxy
(
p
:
u32
,
)
->
Weight
{
(
26127000
as
Weight
)
.saturating_add
((
214000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
}
fn
proxy_announced
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
55405000
as
Weight
)
.saturating_add
((
774000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
209000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
3
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
remove_announcement
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
35879000
as
Weight
)
.saturating_add
((
783000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
20000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
reject_announcement
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
36097000
as
Weight
)
.saturating_add
((
780000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
12000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
announce
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
53769000
as
Weight
)
.saturating_add
((
675000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
214000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
3
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
add_proxy
(
p
:
u32
,
)
->
Weight
{
(
36082000
as
Weight
)
.saturating_add
((
234000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
remove_proxy
(
p
:
u32
,
)
->
Weight
{
(
32885000
as
Weight
)
.saturating_add
((
267000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
remove_proxies
(
p
:
u32
,
)
->
Weight
{
(
31735000
as
Weight
)
.saturating_add
((
215000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
anonymous
(
p
:
u32
,
)
->
Weight
{
(
50907000
as
Weight
)
.saturating_add
((
61000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
kill_anonymous
(
p
:
u32
,
)
->
Weight
{
(
33926000
as
Weight
)
.saturating_add
((
208000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
}
runtime/polkadot/src/lib.rs
View file @
1fd29876
...
...
@@ -91,8 +91,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
#[cfg(not(feature
=
"disable-runtime-api"
))]
apis
:
RUNTIME_API_VERSIONS
,
#[cfg(feature
=
"disable-runtime-api"
)]
apis
:
sp_
version
::
create_apis_vec!
[[]],
transaction_version
:
4
,
apis
:
version
::
create_apis_vec!
[[]],
transaction_version
:
5
,
};
/// Native version.
...
...
@@ -741,6 +741,9 @@ parameter_types! {
// Additional storage item size of 33 bytes.
pub
const
ProxyDepositFactor
:
Balance
=
deposit
(
0
,
33
);
pub
const
MaxProxies
:
u16
=
32
;
pub
const
AnnouncementDepositBase
:
Balance
=
deposit
(
1
,
8
);
pub
const
AnnouncementDepositFactor
:
Balance
=
deposit
(
0
,
66
);
pub
const
MaxPending
:
u16
=
32
;
}
impl
<
I
:
frame_support
::
traits
::
Instance
>
dummy
::
Trait
<
I
>
for
Runtime
{
}
...
...
@@ -859,7 +862,11 @@ impl pallet_proxy::Trait for Runtime {
type
ProxyDepositBase
=
ProxyDepositBase
;
type
ProxyDepositFactor
=
ProxyDepositFactor
;
type
MaxProxies
=
MaxProxies
;
type
WeightInfo
=
();
type
WeightInfo
=
weights
::
pallet_proxy
::
WeightInfo
;
type
MaxPending
=
MaxPending
;
type
CallHasher
=
BlakeTwo256
;
type
AnnouncementDepositBase
=
AnnouncementDepositBase
;
type
AnnouncementDepositFactor
=
AnnouncementDepositFactor
;
}
pub
struct
CustomOnRuntimeUpgrade
;
...
...
runtime/polkadot/src/weights/mod.rs
View file @
1fd29876
...
...
@@ -21,3 +21,4 @@ pub mod pallet_balances;
pub
mod
pallet_democracy
;
pub
mod
pallet_timestamp
;
pub
mod
pallet_utility
;
pub
mod
pallet_proxy
;
runtime/polkadot/src/weights/pallet_balances.rs
View file @
1fd29876
...
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//
/ Weights for the Balances Pallet
//
! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5
use
frame_support
::
weights
::{
Weight
,
constants
::
RocksDbWeight
as
DbWeight
};
pub
struct
WeightInfo
;
...
...
runtime/polkadot/src/weights/pallet_proxy.rs
0 → 100644
View file @
1fd29876
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot 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 General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5
use
frame_support
::
weights
::{
Weight
,
constants
::
RocksDbWeight
as
DbWeight
};
pub
struct
WeightInfo
;
impl
pallet_proxy
::
WeightInfo
for
WeightInfo
{
fn
proxy
(
p
:
u32
,
)
->
Weight
{
(
26127000
as
Weight
)
.saturating_add
((
214000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
}
fn
proxy_announced
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
55405000
as
Weight
)
.saturating_add
((
774000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
209000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
3
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
remove_announcement
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
35879000
as
Weight
)
.saturating_add
((
783000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
20000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
reject_announcement
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
36097000
as
Weight
)
.saturating_add
((
780000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
12000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
announce
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
53769000
as
Weight
)
.saturating_add
((
675000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
214000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
3
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
add_proxy
(
p
:
u32
,
)
->
Weight
{
(
36082000
as
Weight
)
.saturating_add
((
234000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
remove_proxy
(
p
:
u32
,
)
->
Weight
{
(
32885000
as
Weight
)
.saturating_add
((
267000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
remove_proxies
(
p
:
u32
,
)
->
Weight
{
(
31735000
as
Weight
)
.saturating_add
((
215000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
anonymous
(
p
:
u32
,
)
->
Weight
{
(
50907000
as
Weight
)
.saturating_add
((
61000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
kill_anonymous
(
p
:
u32
,
)
->
Weight
{
(
33926000
as
Weight
)
.saturating_add
((
208000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
}
runtime/westend/src/lib.rs
View file @
1fd29876
...
...
@@ -89,8 +89,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
#[cfg(not(feature
=
"disable-runtime-api"
))]
apis
:
RUNTIME_API_VERSIONS
,
#[cfg(feature
=
"disable-runtime-api"
)]
apis
:
sp_
version
::
create_apis_vec!
[[]],
transaction_version
:
2
,
apis
:
version
::
create_apis_vec!
[[]],
transaction_version
:
3
,
};
/// Native version.
...
...
@@ -543,6 +543,9 @@ parameter_types! {
// Additional storage item size of 33 bytes.
pub
const
ProxyDepositFactor
:
Balance
=
deposit
(
0
,
33
);
pub
const
MaxProxies
:
u16
=
32
;
pub
const
AnnouncementDepositBase
:
Balance
=
deposit
(
1
,
8
);
pub
const
AnnouncementDepositFactor
:
Balance
=
deposit
(
0
,
66
);
pub
const
MaxPending
:
u16
=
32
;
}
/// The type used to represent the kinds of proxying allowed.
...
...
@@ -629,7 +632,11 @@ impl pallet_proxy::Trait for Runtime {
type
ProxyDepositBase
=
ProxyDepositBase
;
type
ProxyDepositFactor
=
ProxyDepositFactor
;
type
MaxProxies
=
MaxProxies
;
type
WeightInfo
=
();
type
WeightInfo
=
weights
::
pallet_proxy
::
WeightInfo
;
type
MaxPending
=
MaxPending
;
type
CallHasher
=
BlakeTwo256
;
type
AnnouncementDepositBase
=
AnnouncementDepositBase
;
type
AnnouncementDepositFactor
=
AnnouncementDepositFactor
;
}
parameter_types!
{
...
...
runtime/westend/src/weights/mod.rs
View file @
1fd29876
...
...
@@ -20,3 +20,4 @@ pub mod frame_system;
pub
mod
pallet_balances
;
pub
mod
pallet_timestamp
;
pub
mod
pallet_utility
;
pub
mod
pallet_proxy
;
runtime/westend/src/weights/pallet_proxy.rs
0 → 100644
View file @
1fd29876
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot 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 General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5
use
frame_support
::
weights
::{
Weight
,
constants
::
RocksDbWeight
as
DbWeight
};
pub
struct
WeightInfo
;
impl
pallet_proxy
::
WeightInfo
for
WeightInfo
{
fn
proxy
(
p
:
u32
,
)
->
Weight
{
(
26127000
as
Weight
)
.saturating_add
((
214000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
}
fn
proxy_announced
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
55405000
as
Weight
)
.saturating_add
((
774000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
209000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
3
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
remove_announcement
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
35879000
as
Weight
)
.saturating_add
((
783000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
20000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
reject_announcement
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
36097000
as
Weight
)
.saturating_add
((
780000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
12000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
2
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
announce
(
a
:
u32
,
p
:
u32
,
)
->
Weight
{
(
53769000
as
Weight
)
.saturating_add
((
675000
as
Weight
)
.saturating_mul
(
a
as
Weight
))
.saturating_add
((
214000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
3
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
2
as
Weight
))
}
fn
add_proxy
(
p
:
u32
,
)
->
Weight
{
(
36082000
as
Weight
)
.saturating_add
((
234000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
remove_proxy
(
p
:
u32
,
)
->
Weight
{
(
32885000
as
Weight
)
.saturating_add
((
267000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.writes
(
1
as
Weight
))
}
fn
remove_proxies
(
p
:
u32
,
)
->
Weight
{
(
31735000
as
Weight
)
.saturating_add
((
215000
as
Weight
)
.saturating_mul
(
p
as
Weight
))
.saturating_add
(
DbWeight
::
get
()
.reads
(
1
as
Weight
))