Repository navigation
Conversation
The Blockfrost OpenAPI spec marks 15 fields of /epochs/latest/parameters
nullable, but BlockfrostProtocolParameters used Schema.optional, which
rejects null — one null failed the whole getProtocolParameters decode.
The 15 fields now use Schema.optionalWith(..., { nullable: true }); the
decoded null reaches transformProtocolParameters, whose existing
?? 0n / || 0 defaults apply. Part 1 of IntersectMBO#569; the native-script rebuild
(part 2) and stale-field removal (part 3) are left out deliberately.
New test: all 15 fields null decode and fall back to the defaults.
Blockfrost file 15/15; full suite 1679 passed / 75 skipped / 0 failed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes part 1 of #569.
Problem
The Blockfrost OpenAPI spec marks 15 fields of
/epochs/latest/parametersasnullable: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_depositandgov_action_deposit.BlockfrostProtocolParametersdeclared them withSchema.optional, which rejectsnull— so a single null from Blockfrost failed the wholegetProtocolParametersdecode with aProviderError.Reproduced first: a parameters payload (the test file's OpenAPI-example fixture) with all 15 fields set to
nullfailsgetProtocolParameterson current main.Fix
Each of the 15 fields is now
Schema.optionalWith(X, { nullable: true }), exactly as #569 prescribes. A decodednullflows intotransformProtocolParameters, whose existing defaults (?? 0n,|| 0, and?.incostModelFromBlockfrost) already handle it — no transform change was needed.Deliberately left out
cbor: null/serialised_size: nulland rebuilding from/scripts/{hash}/json) — a larger change to the script-fetch flow, better reviewed on its own.utxo_cost_per_wordandconsumed_by_txare unread and safe to drop, buttx_indexhas an existing test asserting its exact decode past 2^53 (Blockfrost.test.ts, "decodes tx_index past 2^53 exactly"), so I left that call to the maintainers rather than deleting a deliberate test in a drive-by PR.Tests
nulldecode throughgetProtocolParametersand fall back to the documented defaults (0 / 0n, empty cost models).tsc --noEmitand eslint on the changed files are clean. (Prettier already flags both touched files on unmodified main; I matched the surrounding style instead of reformatting unrelated hunks.)Independent builder — not affiliated with the Cardano Foundation, IOG or Intersect.
@Kshot9000 (https://x.com/kshot9000)
ADA: addr1q8hnl6vl5a6k3rw3n5g3jtte696zcl76kfatzv7gpswa9r0dj7fma6klq55y4ffm7tf0em09udnyhuk4ah92pl5x9jpqjae44v