-
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
Support conditional compilation in decl_runtime_apis and frame_support::pallet #1533
Comments
Could you please give concrete examples on what is not working. |
I was trying to get this to compile and then similarly conditionally implement in runtimes: sp_api::decl_runtime_apis! {
pub trait SubspaceApi<RewardAddress: Encode + Decode> {
fn slot_duration() -> SlotDuration;
#[cfg(feature = "pot")]
fn pot_parameters() -> PotParameters;
#[cfg(not(feature = "pot"))]
fn global_randomnesses() -> GlobalRandomnesses;
}
} |
But then you would not know on the node side if these functions are available without calling and the executor screaming about you that the functions are missing. With the PR linked above you can handle this in a much better way. |
I'm working on new incompatible revision of the consensus in the same codebase. I either compile everything with the feature or without, it is 100% expected that a mix of those things will not work together and it was never my expectation that it would. |
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
* splitted Substrate RPC trait * introduce subscription methods * removed commented code * removed commented code
While paritytech/substrate#14709 supposedly added conditional compilation in
impl_runtime_apis
, I can't really leverage that for one of use cases where depending on feature flags provided different parts of pallet and runtime API should be provided.In particular I'm interested in methods of runtime API and storage items in pallet, but ideally all things would be equally supported.
As a workaround right now I put conditional compilation on the whole
decl_runtime_apis
/impl_runtime_apis
, which results in large code duplication and for pallet I have to carry both useful and useless storage items, etc.The text was updated successfully, but these errors were encountered: