Conversation
src/node.rs
Outdated
| } | ||
|
|
||
| let _ = builder.is_test(true).try_init(); | ||
| pub fn build_logger() -> Logger { |
src/node.rs
Outdated
| pub fn build_node(config: Configuration) -> Result<(TaskManager, RpcHandlers), sc_service::Error> { | ||
| // Channel for the rpc handler to communicate with the authorship task. | ||
| let (command_sink, commands_stream) = futures::channel::mpsc::channel(10); | ||
| pub fn start_node<Block, RuntimeApi, Executor, F>(cli_args: &[&str], spec_factory: F) |
There was a problem hiding this comment.
Why not InternalNode::new?
src/test/deterministic.rs
Outdated
| pub fn new(node: InternalNode<Runtime>) -> Self { | ||
| Self { node } | ||
| impl<Runtime: frame_system::Trait> Deterministic<Runtime> { | ||
| pub fn new(node: InternalNode) -> Self { |
There was a problem hiding this comment.
I kind of preferred when InternalNode had Runtime generic type as well so it was type checked. Now it seems you can create any kind of InternalNode and then attempt to use it as any Runtime when wrapped in Deterministic.
As discussed privately, we might want to introduce some trait that will bound Runtime and the types required to construct InternalNode: Block, RuntimeApi, Executor, ChainSpecFactory so that both are used together.
Fine with this approach for now though.
tests/simple_run.rs
Outdated
|
|
||
| test.produce_blocks(15); | ||
| test.assert_log_line("db", "best = true"); | ||
| // test.assert_log_line("db", "best = true"); |
There was a problem hiding this comment.
Can we make this work again? This is a useful way to test very abstract stuff that might be hard to test otherwise.
tests/simple_run.rs
Outdated
| test.produce_blocks(1); | ||
|
|
||
| let alice = Sr25519Keyring::Alice.pair(); | ||
| let alice = Sr25519Keyring::Charlie.pair(); |
There was a problem hiding this comment.
| let alice = Sr25519Keyring::Charlie.pair(); | |
| let charlie = Sr25519Keyring::Charlie.pair(); |
tests/simple_run.rs
Outdated
| let events = frame_system::Module::<Runtime>::events(); | ||
| log::info!("{:#?}", events); | ||
| ( | ||
| Balances::free_balance(MultiSigner::from(bob.public()).into_account()), |
There was a problem hiding this comment.
Seems we always only use bob.public() or alice.public() can't we get it at the declaration level to simplify the code?
| ) | ||
| }); | ||
|
|
||
| // FIXME: alice' balance doesnt change lmao |
There was a problem hiding this comment.
I guess that's fixed now after swtiching to Charlie?
There was a problem hiding this comment.
nahhh, the problem still persists, I suspect that the balance is cached in the overlay but I have no way of testing this hypothesis.
tomusdrw
left a comment
There was a problem hiding this comment.
looks good, merge at will after fixing the grumbles.
Seems that the offchain test is failing:
thread 'should_run_off_chain_worker' panicked at 'No logs from db module.', /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/macros.rs:16:9
| ] | ||
|
|
||
| [build-dependencies] | ||
| substrate-build-script-utils = { git = "https://github.com/paritytech/substrate.git", branch = "seun-substrate-test-runner" } |
| @@ -0,0 +1,8 @@ | |||
| use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; | |||
There was a problem hiding this comment.
What is this thing doing exactly?
There was a problem hiding this comment.
nothing now that cli has been removed
| type Call = Call; | ||
| /// The lookup mechanism to get account ID from whatever is passed in dispatchers. | ||
| type Lookup = IdentityLookup<AccountId>; | ||
| type Lookup = Indices; |
There was a problem hiding this comment.
Are Indices strictly necessary?
| }) | ||
| .ok()?; | ||
| let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; | ||
| let address = Indices::unlookup(account); |
There was a problem hiding this comment.
Without Indices it should be just let address = account;
There was a problem hiding this comment.
ahh, didn't know that
| let (client, backend, keystore, mut task_manager) = | ||
| new_full_parts::<Node::OpaqueBlock, Node::RuntimeApi, Node::Executor>(&config)?; | ||
| let client = Arc::new(client); | ||
| let import_queue = manual_seal::import_queue(Box::new(client.clone()), &task_manager.spawn_handle(), None); |
There was a problem hiding this comment.
Is there a way to avoid this initialization code? Can we plug into some existing bootstrap?
There was a problem hiding this comment.
well, we're setting up a node with manual seal, there's, unfortunately, no bootstrap available yet for setting up a node.
Adds manual seal and a test runtime, will make it generic over the runtime once we confirm that it works in tests.