-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Factor out common components of demo-runtime and merge into polkadot #101
Conversation
with_externalities(&mut t, || { | ||
assert_eq!(<Now<TraitImpl>>::get(), 42); | ||
// assert_eq!(Timestamp::NOW.get(), 42); | ||
<public::Callable<TraitImpl>>::set(69).dispatch(&0); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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>); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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() } |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same typename grumble
* 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>
* fix xassets all functions * complete all
* file updates for license recognition * update rustfmt to use FILE_TEMPLATE
#100