Skip to content

fix(sdk): context-provider failures still attributed to nodes or reported as transient #5777

Open

Description

@shumkov

#5769 stops a context provider's configuration error (ContextProviderError::Config) from being retried on other nodes and from banning them. It covers no provider at all, quorum-key lookups, the verifier's direct contract and token-configuration lookups, Drive's contract lookups, and the activation-height callback.

These are the places left where a context provider's own failure is still attributed to a node, or reported as transient, although no other node can change it. I found them by going through every provider call in drive-proof-verifier and rs-sdk. They predate #5769 and were left out of it to keep that PR's scope.

  1. Quorum-key fetch in rs-sdk. In Sdk::verify_fetching_quorum_key (packages/rs-sdk/src/sdk/quorum_key.rs), any error from ContextProvider::fetch_quorum_public_key other than QuorumSourceUnavailable is turned into text inside ContextProviderError::QuorumSourceUnavailable (Err(error) => unavailable(error.to_string())). A Config error from a provider's fetch therefore bans no node, but it is reported as a quorum source outage:

    • the retry loop steps over the node briefly and asks another one;
    • FFI maps it to NetworkError;
    • wasm-sdk marks it retriable;
    • Error::is_transient_protocol_version_refusal treats it as transient.

    A configuration error should keep its type here, as it does on the synchronous lookup path.

  2. Non-Config provider failures on the verifier paths. These still become a retryable Error::Proof that bans the responding node:

    • Generic, DataContractFailure and TokenConfigurationFailure from get_data_contract / get_token_configuration (direct, or through Drive's contract lookup as ErrorRetrievingContract text);
    • AsyncError;
    • a non-Config failure of get_platform_activation_height (as MissingContextRequirement text).

    Some of these may be transient on the provider's side and some are local. Decide per variant which should spare the node; v5.1-dev already maps a direct DataContractFailure to Error::ContextProviderError.

  3. The public DataContractProvider::as_contract_lookup_fn adapter (packages/rs-context-provider/src/provider.rs) still turns every provider error into text inside drive::Error::Proof(ErrorRetrievingContract). drive-proof-verifier no longer uses it after fix(sdk): stop banning nodes for proofs the SDK's context provider cannot verify #5769: it keeps a Config error aside itself (with_contract_lookup). Other users of the trait still lose the error's type. Consider deprecating the adapter, or giving it a way to report the typed error.

Shipped providers (TrustedHttpContextProvider, the FFI CallbackContextProvider, wasm-sdk's WasmContext) mostly don't return these errors from these methods today. Custom providers can.

Activity

  1. added this to the v5.1.0 milestone on Nov 5, 2026
  2. shumkov commented on Nov 9, 2026

    @shumkov
    CollaboratorAuthor

    Two more #5769 leftovers, found by CodeRabbit on the forward merge #5818. The code is the same on v5.0-dev and v5.1-dev.

    1. A kept Config error replaces a verification failure it did not cause. with_contract_lookup (packages/rs-drive-proof-verifier/src/proof.rs) reports a kept Config error whenever the verification then fails (ProviderMisconfiguration::in_place_of_failure). It does not check whether the failed lookup caused that failure. A moderator's document deletion is proved by its removal record without the contract (verify_contract_document_deletion_execution, which keeps the lookup's result and goes on without it). With carries_owner_balance, the proof's owner-balance part is verified after the record. So if:

      • the provider's contract lookup fails with Config,
      • the removal record verifies, and
      • the owner-balance part fails because the node sent a bad proof,

      then the request ends with the provider's Config error, not Proof. It is not retried on another node, whose proof could verify without the contract, and the node that sent the bad proof is not banned. The provider error should replace only a failure the lookup caused. For example, keep the error aside only while Drive returns the lookup's own ErrorRetrievingContract error, or have Drive say whether the failed lookup decided the result.

    2. Test coverage. should_keep_a_verification_that_succeeds_after_a_failed_contract_lookup returns Ok(7) from a closure that never calls Drive. It would still pass if removal-record verification started refusing a deletion when the lookup fails. A test with a real deletion proof and a provider whose lookup returns Config would cover the path item 4 is about.

    Source: #5818 (comment) and CodeRabbit's review of #5818.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions