Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear what type to assign to AccountStore in balances Trait of a runtime module #25

Closed
ltfschoen opened this issue Feb 19, 2020 · 1 comment
Labels
-size-xs [bug] Something isn't working help wanted Extra attention is needed +P1 Highest priority, address as soon as possible [tests]

Comments

@ltfschoen
Copy link
Collaborator

ltfschoen commented Feb 19, 2020

In our blockchain's runtime/src/lib.rs, I have the following (which is consistent with what's shown in https://github.com/paritytech/substrate/blob/master/bin/node-template/runtime/src/lib.rs#L219)

impl balances::Trait for Runtime {
    type AccountStore = System;
    ...

then in a specific runtime module where I want to use balances, I have

impl balances::Trait for Test {
        type AccountStore = ();
        ...
}
...

type System = system::Module<Test>;
pub type Balances = balances::Module<Test>;

But when I run the tests for that runtime module with cargo test -p roaming-accounting-policies, I get error:

error[E0277]: the trait bound `(): sp_api_hidden_includes_decl_storage::hidden_include::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not satisfied
  --> pallets/roaming/roaming-accounting-policies/src/mock.rs:55:2
   |
54 | impl balances::Trait for Test {
   | ----------------------------- in this `impl` item
55 |     type AccountStore = ();
   |     ^^^^^^^^^^^^^^^^^^^^^^^ the trait `sp_api_hidden_includes_decl_storage::hidden_include::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not implemented for `()`

Unfortunately the mock of the node-template's "template" runtime module https://github.com/paritytech/substrate/blob/master/bin/node-template/pallets/template/src/mock.rs doesn't include impl balances::Trait for Test { to show an example of what type should be included.

@ltfschoen ltfschoen changed the title Test Unclear what Systme is used in balances Trait Feb 19, 2020
@ltfschoen ltfschoen changed the title Unclear what Systme is used in balances Trait Unclear what System is used in balances Trait Feb 19, 2020
@ltfschoen ltfschoen changed the title Unclear what System is used in balances Trait Unclear what type to assign to AccountStore in balances Trait of a runtime module Feb 19, 2020
@ltfschoen ltfschoen added +P1 Highest priority, address as soon as possible -size-xs [bug] Something isn't working [tests] help wanted Extra attention is needed labels Feb 19, 2020
@ondratra
Copy link

I found this issue while searching for the same error message. I was able to resolve the issue by doing the following:

impl system::Trait for Test {    
    type AccountData = pallet_balances::AccountData<u64>;
    ...
}

impl pallet_balances::Trait for Test {
    type AccountStore = system::Module<Self>;
    ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-size-xs [bug] Something isn't working help wanted Extra attention is needed +P1 Highest priority, address as soon as possible [tests]
Projects
None yet
Development

No branches or pull requests

2 participants