Skip to content

Blockfrost: nullable protocol parameters and native scripts fail to decode #569

Description

@solidsnakedev

Blockfrost responses that the provider schemas reject, found by checking the official OpenAPI spec (blockfrost/openapi at 05c6d61).

  1. Nullable protocol parameters. The spec marks 15 fields of /epochs/latest/parameters as nullable: max_val_size, cost_models, cost_models_raw, price_mem, price_step, max_tx_ex_mem, max_tx_ex_steps, max_block_ex_mem, max_block_ex_steps, collateral_percent, max_collateral_inputs, coins_per_utxo_size, min_fee_ref_script_cost_per_byte, drep_deposit and gov_action_deposit (src/schemas/epochs/epoch_param_content.yaml). The schema (packages/evolution/src/sdk/provider/internal/Blockfrost.ts:29-50) uses Schema.optional, which rejects null, so one null fails getProtocolParameters. Fix: Schema.optionalWith(X, { nullable: true }). The existing defaults then keep working.
  2. Native scripts. /scripts/{hash}/cbor returns cbor: null for timelock scripts (src/schemas/scripts/script_cbor.yaml:3-6), and /scripts/{hash} returns serialised_size: null for them (script.yaml:12-16). The SDK requires both (BlockfrostEffect.ts:175,182), so native reference scripts on UTxOs silently become scriptRef: undefined. Fix: accept null, and rebuild native scripts from /scripts/{hash}/json.
  3. Stale fields. The spec has no utxo_cost_per_word (Blockfrost.ts:30), deprecates tx_index (:71), and leaves consumed_by_tx (:124) out of its required list. The SDK reads none of them. Fix: remove them from the schemas.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions