-
Notifications
You must be signed in to change notification settings - Fork 710
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
parachain-omni-node
binary
#3597
Changes from 1 commit
69bfb80
3aed1f6
1b7e4c0
c9383ba
8955471
aac4673
a3eb65c
80bc7bb
2ed72f9
daa85ee
94cf40f
7d3aed4
3dd444a
2bf9080
40fbf47
67cfd1b
b74e39f
88fd32b
e2142d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#![allow(unused_variables)] | ||
|
||
pub struct FakeRuntime; | ||
use crate::types::{AccountId, Header, Nonce, OpaqueBlock as Block}; | ||
|
||
sp_api::impl_runtime_apis! { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can also manually implement this stuff without this macro, but this macro already does the job easily. |
||
// same block of code as in `minimal/runtime/src/lib.rs`, but replace all functions to be | ||
// `todo!()`. This is only ti provide a declaration of apis to the client, code and should | ||
// someday be removed. Since we only use the wasm executor, this is fine for now. In fact, it | ||
// need not be "complete", it should only require the impls that this node crate needs 🤡 also, | ||
// in general, see https://github.com/paritytech/polkadot-sdk/issues/27. In some sense, this is | ||
// the node software fooling itself. | ||
impl sp_api::Core<Block> for FakeRuntime { | ||
fn version() -> sp_version::RuntimeVersion { | ||
todo!() | ||
} | ||
|
||
fn execute_block(block: Block) { | ||
todo!() | ||
} | ||
|
||
fn initialize_block(header: &Header) -> sp_runtime::ExtrinsicInclusionMode { | ||
todo!() | ||
} | ||
} | ||
|
||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for FakeRuntime { | ||
fn validate_transaction( | ||
_source: sp_runtime::transaction_validity::TransactionSource, | ||
_tx: <Block as sp_runtime::traits::Block>::Extrinsic, | ||
_hash: <Block as sp_runtime::traits::Block>::Hash, | ||
) -> sp_runtime::transaction_validity::TransactionValidity { | ||
todo!() | ||
} | ||
} | ||
|
||
impl sp_block_builder::BlockBuilder<Block> for FakeRuntime { | ||
fn apply_extrinsic( | ||
extrinsic: <Block as sp_runtime::traits::Block>::Extrinsic | ||
) -> sp_runtime::ApplyExtrinsicResult { | ||
todo!() | ||
} | ||
|
||
fn finalize_block() -> <Block as sp_runtime::traits::Block>::Header { | ||
todo!() | ||
} | ||
|
||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as sp_runtime::traits::Block>::Extrinsic> { | ||
todo!() | ||
} | ||
|
||
fn check_inherents( | ||
block: Block, | ||
data: sp_inherents::InherentData, | ||
) -> sp_inherents::CheckInherentsResult { | ||
todo!() | ||
} | ||
} | ||
|
||
impl sp_api::Metadata<Block> for FakeRuntime { | ||
fn metadata() -> sp_core::OpaqueMetadata { | ||
todo!() | ||
} | ||
|
||
fn metadata_at_version(version: u32) -> Option<sp_core::OpaqueMetadata> { | ||
todo!() | ||
} | ||
|
||
fn metadata_versions() -> Vec<u32> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce> for FakeRuntime { | ||
fn account_nonce(account: AccountId) -> Nonce { | ||
todo!(); | ||
} | ||
} | ||
|
||
impl sp_session::SessionKeys<Block> for FakeRuntime { | ||
fn generate_session_keys(_seed: Option<Vec<u8>>) -> Vec<u8> { | ||
Default::default() | ||
} | ||
|
||
fn decode_session_keys( | ||
_encoded: Vec<u8>, | ||
) -> Option<Vec<(Vec<u8>, sp_session::KeyTypeId)>> { | ||
Default::default() | ||
} | ||
} | ||
|
||
impl sp_offchain::OffchainWorkerApi<Block> for FakeRuntime { | ||
fn offchain_worker(header: &<Block as sp_runtime::traits::Block>::Header) { | ||
todo!(); | ||
} | ||
} | ||
|
||
} |
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.
@michalkucharczyk this was my main chain-spec related issue so far, I would have expected it to work without this. Or perhaps the
Default::default
should do this for me.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 API is under some development. The idea is here: #1984 and some PoC: #2714.
This would help here (fetching default is trivial to add).
What I propose is to move predefined genesis configs into runtime (and call them
presets
), and extendGenesisBuilder
runtime API to fetch them.This would allow for functionality mentioned in #2714 (comment).
The reasoning for this is that hand-crafting chain-spec files maybe difficult as the serialization of types can be tricky to guess. Also
default
RuntimeGenesisConfig
is typically useless (e.g. does not contains keys).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.
Actually,
.with_genesis_config_patch(json!({}))
should do the job. (which means empty patch for default config).