Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Factor out common components of demo-runtime and merge into polkadot #101

Closed
wants to merge 7 commits into from

Conversation

gavofyork
Copy link
Member

@gavofyork gavofyork commented Mar 20, 2018

@gavofyork gavofyork added the A3-in_progress Pull request is in progress. No review needed at this stage. label Mar 21, 2018
with_externalities(&mut t, || {
assert_eq!(<Now<TraitImpl>>::get(), 42);
// assert_eq!(Timestamp::NOW.get(), 42);
<public::Callable<TraitImpl>>::set(69).dispatch(&0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work :(

use runtime_support::storage::StorageValue;
use runtime_support::PublicPass;

pub trait Trait {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit weird to call it Trait

}

pub trait Checkable {
type CheckedType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs? hard to follow what this is about. type Checked and trait Check would be more idiomatic


pub trait Dispatchable {
type AccountIdType;
type TxOrderType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise here -- associated type identifiers don't need to be suffixed with "Type"

type PublicAux;
type PrivAux;
}
pub struct Module<T: Trait>(::std::marker::PhantomData<T>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this struct adds nothing to the trait definition on its own, why do we need the Module struct definition in the first place?

pub trait Trait {
type Timestamp: codec::Slicable;
type PublicAux;
type PrivAux;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to me that the only thing which is actually variable here is the timestamp type definition and that the others should follow, while the definition of these PublicAux and PrivAux as associated types implies that it's expected for them to vary while the timestamp type holds.

}

impl<T: Trait> Module<T> {
pub fn get() -> T::Timestamp { <Now<T>>::get() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and if the timestamp were the only generic param here (and we went a little more general than "some serializable type" to get to "some timestamp which can be get and set") the implementation here would still be the same, while still extending to timestamps which are out of storage and being testable without setting up storage context

*/

pub trait Dispatchable {
type AuxType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same typename grumble

@gavofyork gavofyork closed this Mar 27, 2018
@gavofyork gavofyork deleted the gav-dedup-runtime branch March 27, 2018 03:37
JoshOrndorff added a commit to moonbeam-foundation/substrate that referenced this pull request Apr 21, 2021
* attempt to install pallet

* fix syntax

* oaky make it actually compile

* pallet naming convention

* rename pallet

* Document chain ids in readme

* codify new chain ids and prune unused staging parachain config

* update hard-coded specs

* unrelated bug fix: add pallet ethereum genesis config to all specs

* missing commas

* more prettier

* Fix test specs json formating

* correct key name in json specs

* Updates tests for the new chainId 1281

* Update node/standalone/src/chain_spec.rs

Co-authored-by: Alan Sapede <alan@scg-moonbuild-1.dev.purestake.tech>
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* fix xassets all functions

* complete all
helin6 pushed a commit to boolnetwork/substrate that referenced this pull request Jul 25, 2023
* file updates for license recognition

* update rustfmt to use FILE_TEMPLATE
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants