Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ddorgan
polkadot
Commits
d517dbeb
Commit
d517dbeb
authored
Oct 03, 2019
by
thiolliere
Committed by
Gavin Wood
Oct 03, 2019
Browse files
update (#457)
parent
5002af98
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
d517dbeb
This diff is collapsed.
Click to expand it.
cli/src/lib.rs
View file @
d517dbeb
...
...
@@ -116,12 +116,12 @@ pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where
}
.map_err
(|
e
|
format!
(
"{:?}"
,
e
))
}),
cli
::
ParseAndPrepare
::
BuildSpec
(
cmd
)
=>
cmd
.run
(
load_spec
),
cli
::
ParseAndPrepare
::
ExportBlocks
(
cmd
)
=>
cmd
.run_with_builder
::
<
(),
_
,
_
,
_
,
_
,
_
>
(|
config
|
cli
::
ParseAndPrepare
::
ExportBlocks
(
cmd
)
=>
cmd
.run_with_builder
::
<
(),
_
,
_
,
_
,
_
,
_
,
_
>
(|
config
|
Ok
(
service
::
new_chain_ops
(
config
)
?
),
load_spec
,
worker
),
cli
::
ParseAndPrepare
::
ImportBlocks
(
cmd
)
=>
cmd
.run_with_builder
::
<
(),
_
,
_
,
_
,
_
,
_
>
(|
config
|
cli
::
ParseAndPrepare
::
ImportBlocks
(
cmd
)
=>
cmd
.run_with_builder
::
<
(),
_
,
_
,
_
,
_
,
_
,
_
>
(|
config
|
Ok
(
service
::
new_chain_ops
(
config
)
?
),
load_spec
,
worker
),
cli
::
ParseAndPrepare
::
PurgeChain
(
cmd
)
=>
cmd
.run
(
load_spec
),
cli
::
ParseAndPrepare
::
RevertChain
(
cmd
)
=>
cmd
.run_with_builder
::
<
(),
_
,
_
,
_
,
_
>
(|
config
|
cli
::
ParseAndPrepare
::
RevertChain
(
cmd
)
=>
cmd
.run_with_builder
::
<
(),
_
,
_
,
_
,
_
,
_
>
(|
config
|
Ok
(
service
::
new_chain_ops
(
config
)
?
),
load_spec
),
cli
::
ParseAndPrepare
::
CustomCommand
(
PolkadotSubCommands
::
ValidationWorker
(
args
))
=>
{
service
::
run_validation_worker
(
&
args
.mem_id
)
?
;
...
...
runtime/src/claims.rs
View file @
d517dbeb
...
...
@@ -363,7 +363,7 @@ mod tests {
with_externalities
(
&
mut
new_test_ext
(),
||
{
assert_eq!
(
Claims
::
total
(),
100
);
assert_eq!
(
Claims
::
claims
(
&
alice_eth
()),
Some
(
100
));
assert_eq!
(
Claims
::
claims
(
&
Default
::
default
()),
None
);
assert_eq!
(
Claims
::
claims
(
&
EthereumAddress
::
default
()),
None
);
});
}
...
...
runtime/src/lib.rs
View file @
d517dbeb
...
...
@@ -46,7 +46,7 @@ use sr_primitives::{
};
use
version
::
RuntimeVersion
;
use
grandpa
::{
AuthorityId
as
GrandpaId
,
fg_primitives
};
use
babe_primitives
::
AuthorityId
as
BabeId
;
use
babe_primitives
::
{
AuthorityId
as
BabeId
,
AuthoritySignature
as
BabeSignature
}
;
use
elections
::
VoteIndex
;
#[cfg(any(feature
=
"std"
,
test))]
use
version
::
NativeVersion
;
...
...
@@ -56,7 +56,7 @@ use srml_support::{
parameter_types
,
construct_runtime
,
traits
::{
SplitTwoWays
,
Currency
}
};
use
authority_discovery_primitives
::{
AuthorityId
as
EncodedAuthorityId
,
Signature
as
EncodedSignature
};
use
im_online
::
sr25519
::
{
AuthorityId
as
ImOnlineId
,
AuthoritySignature
as
ImOnlineSignature
}
;
use
im_online
::
sr25519
::
AuthorityId
as
ImOnlineId
;
use
system
::
offchain
::
TransactionSubmitter
;
#[cfg(feature
=
"std"
)]
...
...
@@ -444,7 +444,9 @@ impl im_online::Trait for Runtime {
type
ReportUnresponsiveness
=
();
}
impl
authority_discovery
::
Trait
for
Runtime
{}
impl
authority_discovery
::
Trait
for
Runtime
{
type
AuthorityId
=
BabeId
;
}
impl
grandpa
::
Trait
for
Runtime
{
type
Event
=
Event
;
...
...
@@ -702,17 +704,18 @@ impl_runtime_apis! {
}
fn
verify
(
payload
:
&
Vec
<
u8
>
,
signature
:
&
EncodedSignature
,
authority_id
:
&
EncodedAuthorityId
)
->
bool
{
let
signature
=
match
ImOnlin
eSignature
::
decode
(
&
mut
&
signature
.0
[
..
])
{
let
signature
=
match
Bab
eSignature
::
decode
(
&
mut
&
signature
.0
[
..
])
{
Ok
(
s
)
=>
s
,
_
=>
return
false
,
};
let
authority_id
=
match
ImOnlin
eId
::
decode
(
&
mut
&
authority_id
.0
[
..
])
{
let
authority_id
=
match
Bab
eId
::
decode
(
&
mut
&
authority_id
.0
[
..
])
{
Ok
(
id
)
=>
id
,
_
=>
return
false
,
};
AuthorityDiscovery
::
verify
(
payload
,
signature
,
authority_id
)
}
}
...
...
runtime/src/parachains.rs
View file @
d517dbeb
...
...
@@ -265,7 +265,7 @@ fn build<T: Trait>(config: &GenesisConfig<T>) {
// no ingress -- a chain cannot be routed to until it is live.
Code
::
insert
(
&
id
,
&
code
);
Heads
::
insert
(
&
id
,
&
genesis
);
<
Watermarks
<
T
>>
::
insert
(
&
id
,
&
sr_primitives
::
traits
::
Z
er
o
::
zero
());
<
Watermarks
<
T
>>
::
insert
(
&
id
,
&
T
::
BlockNumb
er
::
zero
());
}
}
...
...
@@ -1487,8 +1487,8 @@ mod tests {
with_externalities
(
&
mut
new_test_ext
(
parachains
),
||
{
assert_eq!
(
Parachains
::
active_parachains
(),
vec!
[
5u32
.into
(),
100u32
.into
()]);
assert_eq!
(
Parachains
::
parachain_code
(
&
5u32
.into
(
)),
Some
(
vec!
[
1
,
2
,
3
]));
assert_eq!
(
Parachains
::
parachain_code
(
&
100u32
.into
(
)),
Some
(
vec!
[
4
,
5
,
6
]));
assert_eq!
(
Parachains
::
parachain_code
(
ParaId
::
from
(
5u32
)),
Some
(
vec!
[
1
,
2
,
3
]));
assert_eq!
(
Parachains
::
parachain_code
(
ParaId
::
from
(
100u32
)),
Some
(
vec!
[
4
,
5
,
6
]));
});
}
...
...
@@ -1502,18 +1502,18 @@ mod tests {
with_externalities
(
&
mut
new_test_ext
(
parachains
),
||
{
assert_eq!
(
Parachains
::
active_parachains
(),
vec!
[
5u32
.into
(),
100u32
.into
()]);
assert_eq!
(
Parachains
::
parachain_code
(
&
5u32
.into
(
)),
Some
(
vec!
[
1
,
2
,
3
]));
assert_eq!
(
Parachains
::
parachain_code
(
&
100u32
.into
(
)),
Some
(
vec!
[
4
,
5
,
6
]));
assert_eq!
(
Parachains
::
parachain_code
(
ParaId
::
from
(
5u32
)),
Some
(
vec!
[
1
,
2
,
3
]));
assert_eq!
(
Parachains
::
parachain_code
(
ParaId
::
from
(
100u32
)),
Some
(
vec!
[
4
,
5
,
6
]));
assert_ok!
(
Parachains
::
register_parachain
(
Origin
::
ROOT
,
99u32
.into
(),
vec!
[
7
,
8
,
9
],
vec!
[
1
,
1
,
1
]));
assert_eq!
(
Parachains
::
active_parachains
(),
vec!
[
5u32
.into
(),
99u32
.into
(),
100u32
.into
()]);
assert_eq!
(
Parachains
::
parachain_code
(
&
99u32
.into
(
)),
Some
(
vec!
[
7
,
8
,
9
]));
assert_eq!
(
Parachains
::
parachain_code
(
ParaId
::
from
(
99u32
)),
Some
(
vec!
[
7
,
8
,
9
]));
assert_ok!
(
Parachains
::
deregister_parachain
(
Origin
::
ROOT
,
5u32
.into
()));
assert_eq!
(
Parachains
::
active_parachains
(),
vec!
[
99u32
.into
(),
100u32
.into
()]);
assert_eq!
(
Parachains
::
parachain_code
(
&
5u32
.into
(
)),
None
);
assert_eq!
(
Parachains
::
parachain_code
(
ParaId
::
from
(
5u32
)),
None
);
});
}
...
...
runtime/src/slots.rs
View file @
d517dbeb
...
...
@@ -1033,7 +1033,7 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
onboard_queue
(
1
),
vec!
[
0
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
0
.into
(
)),
assert_eq!
(
Slots
::
onboarding
(
ParaId
::
from
(
0
)),
Some
((
1
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
1
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
1
);
...
...
@@ -1052,7 +1052,7 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
1
);
assert_eq!
(
Slots
::
deposits
(
&
0
.into
(
))[
0
],
0
);
assert_eq!
(
Slots
::
deposits
(
ParaId
::
from
(
0
))[
0
],
0
);
run_to_block
(
50
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
0
);
...
...
@@ -1069,7 +1069,7 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
1
);
assert_eq!
(
Slots
::
deposits
(
&
0
.into
(
))[
0
],
0
);
assert_eq!
(
Slots
::
deposits
(
ParaId
::
from
(
0
))[
0
],
0
);
run_to_block
(
49
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
1
);
...
...
@@ -1152,17 +1152,17 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
onboard_queue
(
1
),
vec!
[
0
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
0
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
0
)),
Some
((
1
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
1
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
onboard_queue
(
2
),
vec!
[
1
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
1
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
1
)),
Some
((
2
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
2
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
onboard_queue
(
4
),
vec!
[
2
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
2
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
2
)),
Some
((
4
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
3
,
sub
:
0
})))
);
});
...
...
@@ -1200,26 +1200,26 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
onboard_queue
(
1
),
vec!
[
0
.into
(),
3
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
0
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
0
)),
Some
((
1
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
1
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
onboarding
(
&
3
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
3
)),
Some
((
1
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
4
,
sub
:
1
})))
);
assert_eq!
(
Slots
::
onboard_queue
(
2
),
vec!
[
1
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
1
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
1
)),
Some
((
2
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
2
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
onboard_queue
(
3
),
vec!
[
4
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
4
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
4
)),
Some
((
3
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
5
,
sub
:
1
})))
);
assert_eq!
(
Slots
::
onboard_queue
(
4
),
vec!
[
2
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
2
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
2
)),
Some
((
4
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
3
,
sub
:
0
})))
);
...
...
@@ -1324,13 +1324,13 @@ mod tests {
assert_ok!
(
Slots
::
bid_renew
(
Origin
::
signed
(
ParaId
::
from
(
0
)
.into_account
()),
2
,
2
,
2
,
3
));
run_to_block
(
20
);
assert_eq!
(
Balances
::
free_balance
(
&
ParaId
::
from
(
0
)
.into_account
()),
2
);
assert_eq!
(
Balances
::
free_balance
::
<
u64
>
(
ParaId
::
from
(
0
)
.into_account
()),
2
);
assert_ok!
(
Slots
::
new_auction
(
Origin
::
ROOT
,
5
,
2
));
assert_ok!
(
Slots
::
bid_renew
(
Origin
::
signed
(
ParaId
::
from
(
0
)
.into_account
()),
3
,
3
,
3
,
4
));
run_to_block
(
30
);
assert_eq!
(
Balances
::
free_balance
(
&
ParaId
::
from
(
0
)
.into_account
()),
1
);
assert_eq!
(
Balances
::
free_balance
::
<
u64
>
(
ParaId
::
from
(
0
)
.into_account
()),
1
);
});
}
...
...
@@ -1347,8 +1347,8 @@ mod tests {
assert_eq!
(
Slots
::
onboard_queue
(
2
),
vec!
[]);
assert_eq!
(
Slots
::
onboard_queue
(
3
),
vec!
[]);
assert_eq!
(
Slots
::
onboard_queue
(
4
),
vec!
[
0
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
0
.into
(
)),
assert_eq!
(
Slots
::
onboarding
(
ParaId
::
from
(
0
)),
Some
((
4
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
1
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
5
);
...
...
@@ -1374,7 +1374,7 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
onboard_queue
(
1
),
vec!
[
0
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
0
.into
(
)),
Slots
::
onboarding
(
ParaId
::
from
(
0
)),
Some
((
1
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
5
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
5
);
...
...
@@ -1401,8 +1401,8 @@ mod tests {
run_to_block
(
9
);
assert_eq!
(
Slots
::
onboard_queue
(
1
),
vec!
[
0
.into
()]);
assert_eq!
(
Slots
::
onboarding
(
&
0
.into
(
)),
assert_eq!
(
Slots
::
onboarding
(
ParaId
::
from
(
0
)),
Some
((
1
,
IncomingParachain
::
Unset
(
NewBidder
{
who
:
3
,
sub
:
0
})))
);
assert_eq!
(
Slots
::
deposit_held
(
&
0
.into
()),
3
);
...
...
service/src/lib.rs
View file @
d517dbeb
...
...
@@ -67,7 +67,7 @@ impl Default for CustomConfiguration {
}
/// Chain API type for the transaction pool.
pub
type
TxChainApi
<
Backend
,
Executor
>
=
transaction_pool
::
ChainApi
<
pub
type
TxChainApi
<
Backend
,
Executor
>
=
transaction_pool
::
Full
ChainApi
<
client
::
Client
<
Backend
,
Executor
,
Block
,
RuntimeApi
>
,
Block
,
>
;
...
...
@@ -87,7 +87,7 @@ macro_rules! new_full_start {
Ok
(
client
::
LongestChain
::
new
(
backend
.clone
()))
})
?
.with_transaction_pool
(|
config
,
client
|
Ok
(
transaction_pool
::
txpool
::
Pool
::
new
(
config
,
transaction_pool
::
ChainApi
::
new
(
client
)))
Ok
(
transaction_pool
::
txpool
::
Pool
::
new
(
config
,
transaction_pool
::
Full
ChainApi
::
new
(
client
)))
)
?
.with_import_queue
(|
_config
,
client
,
mut
select_chain
,
_
|
{
let
select_chain
=
select_chain
.take
()
...
...
@@ -338,7 +338,7 @@ pub fn new_light(config: Configuration<CustomConfiguration, GenesisConfig>)
Ok
(
LongestChain
::
new
(
backend
.clone
()))
})
?
.with_transaction_pool
(|
config
,
client
|
Ok
(
TransactionPool
::
new
(
config
,
transaction_pool
::
ChainApi
::
new
(
client
)))
Ok
(
TransactionPool
::
new
(
config
,
transaction_pool
::
Full
ChainApi
::
new
(
client
)))
)
?
.with_import_queue_and_fprb
(|
_config
,
client
,
backend
,
fetcher
,
_select_chain
,
_
|
{
let
fetch_checker
=
fetcher
...
...
test-parachains/adder/Cargo.toml
View file @
d517dbeb
...
...
@@ -8,7 +8,7 @@ build = "build.rs"
[dependencies]
parachain
=
{
package
=
"polkadot-parachain"
,
path
=
"../../parachain/"
,
default-features
=
false
,
features
=
[
"wasm-api"
]
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"
~
1.0.0"
,
default-features
=
false
,
features
=
["derive"]
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.0.0"
,
default-features
=
false
,
features
=
["derive"]
}
tiny-keccak
=
"1.5.0"
dlmalloc
=
{
version
=
"0.1.3"
,
features
=
[
"global"
]
}
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment