Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

Update Plug with Versioned Doughnut #37

Closed
2 tasks done
mzxyz opened this issue Dec 19, 2019 · 3 comments
Closed
2 tasks done

Update Plug with Versioned Doughnut #37

mzxyz opened this issue Dec 19, 2019 · 3 comments
Assignees

Comments

@mzxyz
Copy link
Contributor

mzxyz commented Dec 19, 2019

  • Refactor Plug to use the new versioned Doughnut enum type
  • May require creating and tagging a new release branch for doughnut-rs (includes Cargo.toml version bump)

This should be part of the Plug and CENNZnet 1.0.0-rc2 releases

@mzxyz
Copy link
Contributor Author

mzxyz commented Dec 23, 2019

Actually this one is more complicated than I though.

pub struct PlugDoughnut<Doughnut: DoughnutApi, Runtime: DoughnutRuntime>(Doughnut, rstd::marker::PhantomData<Runtime>);

In doughnut PRML, Doughnut type has trait bound DoughnutApi, which current versioned doughnut has not implemented.

type Doughnut = prml_doughnut::PlugDoughnut<Doughnut, Runtime>;

So in the runtime implement, there will have problem if we used versioned doughnut directly

@cowboy-bebug
Copy link
Contributor

cowboy-bebug commented Dec 23, 2019

We have trouble with the associated types for DoughnutApi trait because PlugDoughnut struct takes Doughnut: DoughnutApi as type parameter -> we have to impl DoughnutApi trait for the (versioned enum) Doughnut. We're not sure how to go about defining the associated types for Doughnut (whether to make it generic or remove associated types for fixed types).

A task for this is open here: cennznet/doughnut-rs#38

@jordy25519
Copy link
Contributor

I think the DoughnutApi trait should be moved so that it is defined here in Plug instead of doughnut-rs. It should only be implemented for PlugDoughnut which can then handle the version management internally.

@mzxyz mzxyz closed this as completed Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants