Skip to content
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

Cleanup bolierplate code when DisabledValidators runtime api call is released #1940

Open
Tracked by #784
tdimitrov opened this issue Oct 19, 2023 · 0 comments
Open
Tracked by #784

Comments

@tdimitrov
Copy link
Contributor

tdimitrov commented Oct 19, 2023

When DisabledValidators runtime api is released (atm at target version 8) remove the boilerplate code from:

  • backing
    // TODO: https://github.com/paritytech/polkadot-sdk/issues/1940
    // Once runtime ver `DISABLED_VALIDATORS_RUNTIME_REQUIREMENT` is released remove this `if`
    // statement, add `request_from_runtime` call to the `try_join!` call above and use
    // `try_runtime_api!` to get `disabled_validators`
    let disabled_validators = if has_required_runtime(
    ctx.sender(),
    parent,
    RuntimeApiRequest::DISABLED_VALIDATORS_RUNTIME_REQUIREMENT,
    )
    .await
    {
    let disabled_validators = request_from_runtime(parent, ctx.sender(), |tx| {
    RuntimeApiRequest::DisabledValidators(tx)
    })
    .await
    .await
    .map_err(Error::JoinMultiple)?;
    let disabled_validators = try_runtime_api!(disabled_validators);
    disabled_validators
    } else {
    gum::debug!(target: LOG_TARGET, "Runtime doesn't support `DisabledValidators` - continuing with an empty disabled validators set");
    vec![]
    };
  • subsystem-util
    // TODO: https://github.com/paritytech/polkadot-sdk/issues/1940
    // When `DisabledValidators` is released remove this `if`` and add a
    // `request_disabled_validators` call in the `try_join!` call above
    let disabled_validators = if has_required_runtime(
    sender,
    parent,
    RuntimeApiRequest::DISABLED_VALIDATORS_RUNTIME_REQUIREMENT,
    )
    .await
    {
    request_disabled_validators(parent, sender).await.await??
    } else {
    vec![]
    };
    Self::construct(&validators, &disabled_validators, signing_context, keystore)
    }
  • helper in subsystem-util/vstaging
    /// Returns disabled validators list if the runtime supports it. Otherwise logs a debug messages and
    /// returns an empty vec.
    /// Once runtime ver `DISABLED_VALIDATORS_RUNTIME_REQUIREMENT` is released remove this function and
    /// replace all usages with `request_disabled_validators`
    /// TODO: https://github.com/paritytech/polkadot-sdk/issues/1940
    pub async fn get_disabled_validators_with_fallback<Sender: SubsystemSender<RuntimeApiMessage>>(
    sender: &mut Sender,
    relay_parent: Hash,
    ) -> Result<Vec<ValidatorIndex>, Error> {
    let disabled_validators = if has_required_runtime(
    sender,
    relay_parent,
    RuntimeApiRequest::DISABLED_VALIDATORS_RUNTIME_REQUIREMENT,
    )
    .await
    {
    request_disabled_validators(relay_parent, sender)
    .await
    .await
    .map_err(Error::Oneshot)??
    } else {
    gum::debug!(target: LOG_TARGET, "Runtime doesn't support `DisabledValidators` - continuing with an empty disabled validators set");
    vec![]
    };
    Ok(disabled_validators)
    }
@Overkillus Overkillus moved this to Backlog in parachains team board Dec 14, 2023
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 26, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 27, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
bkchr pushed a commit that referenced this issue Apr 10, 2024
* + failing test: previous_nonces_are_selected_if_reorg_happens_at_target_chain

* maybe fix for the issue?

* another fix

* previous_nonces_are_selected_if_reorg_happens_at_target_chain for MessageDeliveryStrategy

* remove commented code

* spelling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants