Skip to content

test: Relates to #3. Fix unit and integration tests so they actually run (including with CI) and use latest Substrate master branch #29

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

Merged
merged 24 commits into from
Feb 21, 2020

Conversation

ltfschoen
Copy link
Collaborator

No description provided.

@ltfschoen
Copy link
Collaborator Author

When I run my integration tests (with 'node-runtime') and one of my runtime module pallet's unit tests (with 'roaming-operators')

cargo test -p node-runtime && cargo test -p roaming-operators

I get error


error[E0277]: the trait bound `(): frame_support::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not satisfied
  --> runtime/tests/cli_integration_tests_mining_tokens.rs:96:9
   |
95 |     impl balances::Trait for Test {
   |     ----------------------------- in this `impl` item
96 |         type AccountStore = ();
   |         ^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_support::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not implemented for `()`

error[E0277]: the trait bound `(): frame_support::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not satisfied
   --> runtime/tests/cli_integration_tests_roaming.rs:138:9
    |
137 |     impl balances::Trait for Test {
    |     ----------------------------- in this `impl` item
138 |         type AccountStore = ();
    |         ^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_support::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not implemented for `()`

error[E0277]: the trait bound `(): frame_support::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not satisfied
  --> runtime/tests/cli_integration_tests_mining_hardware.rs:96:9
   |
95 |     impl balances::Trait for Test {
   |     ----------------------------- in this `impl` item
96 |         type AccountStore = ();
   |         ^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_support::traits::StoredMap<u64, pallet_balances::AccountData<u64>>` is not implemented for `()`

error: aborting due to previous error

I've tried different strategies, such as changing it to such as replacing it with as suggested here https://matrix.to/#/!HzySYSaIhtyWrwiwEV:matrix.org/$158210368377009vQnzC:matrix.parity.io?via=matrix.parity.io&via=matrix.org&via=web3.foundation

In my runtime/lib.rs, I have the following:

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

But if I replace it with the following:

impl balances::Trait for Runtime {
  ...
  type AccountStore = balances::AccountData<u64>;

Then I get error:

error[E0277]: the trait bound `pallet_balances::AccountData<u64>: sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap<sp_api_hidden_includes_construct_runtime::hidden_include::sp_runtime::AccountId32, pallet_balances::AccountData<u128>>` is not satisfied
   --> /Users/ls/code/src/DataHighway-com/node/runtime/src/lib.rs:275:6
    |
274 | impl balances::Trait for Runtime {
    | -------------------------------- in this `impl` item
275 |      type AccountStore = balances::AccountData<u64>;
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap<sp_api_hidden_includes_construct_runtime::hidden_include::sp_runtime::AccountId32, pallet_balances::AccountData<u128>>` is not implemented for `pallet_balances::AccountData<u64>`

So I changed it from u64 to u128, since it indicates it should be either u128 or u32:

impl balances::Trait for Runtime {
    ...
    type AccountStore = balances::AccountData<u128>;

But then I get error:

error[E0277]: the trait bound `pallet_balances::AccountData<u128>: sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap<sp_api_hidden_includes_construct_runtime::hidden_include::sp_runtime::AccountId32, pallet_balances::AccountData<u128>>` is not satisfied
   --> /Users/ls/code/src/DataHighway-com/node/runtime/src/lib.rs:275:5
    |
274 | impl balances::Trait for Runtime {
    | -------------------------------- in this `impl` item
275 |     type AccountStore = balances::AccountData<u128>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap<sp_api_hidden_includes_construct_runtime::hidden_include::sp_runtime::AccountId32, pallet_balances::AccountData<u128>>` is not implemented for `pallet_balances::AccountData<u128>`

So I looked in Substrate's frame/balances/src/lib.rs file, where the type is type AccountStore: StoredMap<Self::AccountId, AccountData<Self::Balance>>;.

Then I updated it to be:

use frame_support::traits::{StoredMap};
...
impl balances::Trait for Runtime {
    ...
    type AccountStore = StoredMap<AccountId, balances::AccountData<Balance>>;

But that gave error:

error[E0277]: the size for values of type `(dyn sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap<sp_api_hidden_includes_construct_runtime::hidden_include::sp_runtime::AccountId32, pallet_balances::AccountData<u128>> + 'static)` cannot be known at compilation time
   --> /Users/ls/code/src/DataHighway-com/node/runtime/src/lib.rs:277:5
    |
276 | impl balances::Trait for Runtime {
    | -------------------------------- in this `impl` item
277 |     type AccountStore = StoredMap<AccountId, balances::AccountData<Balance>>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `core::marker::Sized` is not implemented for `(dyn sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap<sp_api_hidden_includes_construct_runtime::hidden_include::sp_runtime::AccountId32, pallet_balances::AccountData<u128>> + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>

error[E0038]: the trait `sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap` cannot be made into an object
   --> /Users/ls/code/src/DataHighway-com/node/runtime/src/lib.rs:277:5
    |
277 |     type AccountStore = StoredMap<AccountId, balances::AccountData<Balance>>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `sp_api_hidden_includes_construct_runtime::hidden_include::traits::StoredMap` cannot be made into an object
    |
    = note: the trait cannot be made into an object because associated function `get` has no `self` parameter
    = note: the trait cannot be made into an object because associated function `is_explicit` has no `self` parameter
    = note: the trait cannot be made into an object because associated function `mutate` has no `self` parameter
    = note: the trait cannot be made into an object because associated function `mutate_exists` has no `self` parameter
    = note: the trait cannot be made into an object because associated function `try_mutate_exists` has no `self` parameter
    = note: the trait cannot be made into an object because associated function `insert` has no `self` parameter
    = note: the trait cannot be made into an object because associated function `remove` has no `self` parameter

error: aborting due to 2 previous errors

@ltfschoen ltfschoen added +P1 Highest priority, address as soon as possible -size-s help wanted Extra attention is needed labels Feb 20, 2020
@ltfschoen ltfschoen mentioned this pull request Feb 20, 2020
@ltfschoen
Copy link
Collaborator Author

The issue mentioned in comments above was resolved in commit f128e98

@ltfschoen ltfschoen changed the title WIP: Try to pass tests using latest Substrate master branch test: Relates to #3. Try to pass tests using latest Substrate master branch Feb 21, 2020
@ltfschoen ltfschoen changed the title test: Relates to #3. Try to pass tests using latest Substrate master branch test: Relates to #3. Fix test so they actually run and use latest Substrate master branch Feb 21, 2020
@ltfschoen ltfschoen changed the title test: Relates to #3. Fix test so they actually run and use latest Substrate master branch test: Relates to #3. Fix unit and integration tests so they actually run (including with CI) and use latest Substrate master branch Feb 21, 2020
@ltfschoen ltfschoen added -size-m Task of medium size and removed -size-s labels Feb 21, 2020
@ltfschoen
Copy link
Collaborator Author

Note, relates to rust-lang/rust#69334

@ltfschoen ltfschoen mentioned this pull request Feb 21, 2020
@ltfschoen ltfschoen merged commit 8995181 into master Feb 21, 2020
@ltfschoen ltfschoen deleted the luke/fix-build-to-latest-substrate-master branch February 21, 2020 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-size-m Task of medium size help wanted Extra attention is needed +P1 Highest priority, address as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant