Rewrite client handling (#1531)

* Rewrite client handling

We are supporting muliple polkadot-like chains and all have different
client types. This pr reworks the client handling by having all of them
in one enum combined. Besides that, there is added a special trait
`ExecuteWithClient` to use the internal client.

* Apply suggestions from code review

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* Up the versions

* Fix Cargo.lock

* Fix merge conflict

* ......................

* ....v2

* yep

* I'm dumb...

* Browser lol

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
Bastian Köcher
2020-08-04 14:53:47 +02:00
committed by GitHub
parent 07a9d2de3f
commit c01aa8bae8
10 changed files with 365 additions and 382 deletions
@@ -89,8 +89,11 @@ impl ParachainContext for AdderContext {
let encoded_head = HeadData(next_head.encode());
let encoded_body = BlockData(next_body.encode());
println!("Created collation for #{}, post-state={}",
next_head.number, next_body.state.overflowing_add(next_body.add).0);
println!(
"Created collation for #{}, post-state={}",
next_head.number,
next_body.state.overflowing_add(next_body.add).0,
);
db.insert(next_head.clone(), next_body);
ready(Some((encoded_body, encoded_head)))
@@ -100,9 +103,9 @@ impl ParachainContext for AdderContext {
impl BuildParachainContext for AdderContext {
type ParachainContext = Self;
fn build<Client, SP>(
fn build<SP>(
self,
_: Arc<Client>,
_: collator::Client,
_: SP,
network: impl Network + Clone + 'static,
) -> Result<Self::ParachainContext, ()> {