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

Merged
ltfschoen merged 24 commits into
masterfrom
luke/fix-build-to-latest-substrate-master
Feb 21, 2020
Merged

test: Relates to #3. Fix unit and integration tests so they actually run (including with CI) and use latest Substrate master branch#29
ltfschoen merged 24 commits into
masterfrom
luke/fix-build-to-latest-substrate-master

Conversation

@ltfschoen

Copy link
Copy Markdown
Collaborator

No description provided.

@ltfschoen

Copy link
Copy Markdown
CollaboratorAuthor

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

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

Copy link
Copy Markdown
CollaboratorAuthor

The issue mentioned in comments above was resolved in commit f128e98

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

Copy link
Copy Markdown
CollaboratorAuthor

Note, relates to rust-lang/rust#69334

@ltfschoenltfschoen mentioned this pull request Feb 21, 2020
@ltfschoen
ltfschoen merged commit 8995181 into masterFeb 21, 2020
@ltfschoen
ltfschoen deleted the luke/fix-build-to-latest-substrate-master branch February 21, 2020 18:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-size-mTask of medium sizehelp wantedExtra attention is needed+P1Highest priority, address as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@ltfschoen