chore(minibf): update blockfrost-openapi to v0.1.83 - #801
Conversation
WalkthroughUpdated blockfrost-openapi dependency from 0.1.75 to 0.1.83. Converted floating-point numeric types to integers in network era construction. Introduced structured offchain pool metadata handling with concurrent fetching capability. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant PoolService as Pool Service
participant OnChain as On-Chain Data
participant Blockfrost as Blockfrost API
participant MetaBuilder as Metadata Builder
Caller->>PoolService: Request all_extended pools
par Concurrent Metadata Retrieval
PoolService->>OnChain: Fetch on-chain pool metadata
PoolService->>Blockfrost: Fetch offchain metadata for each pool
and
OnChain-->>PoolService: On-chain data
Blockfrost-->>PoolService: Offchain metadata (url, hash, ticker, etc.)
end
PoolService->>MetaBuilder: Combine sources
alt Offchain metadata available
MetaBuilder->>MetaBuilder: Merge on-chain + offchain fields
else Offchain metadata missing
MetaBuilder->>MetaBuilder: Apply defaults
end
MetaBuilder-->>PoolService: PoolListExtendedInnerMetadata
PoolService-->>Caller: Return extended pool list
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
crates/minibf/src/routes/pools.rs (1)
148-163: Consider populating theerrorfield when offchain metadata fetch fails.When
fetched_metadataisNonebutonchain.urlexists (lines 159-163), theerrorfield remainsNoneviaDefault::default(). This makes it impossible for API consumers to distinguish between:
- Metadata URL exists but fetch failed/timed out
- No metadata URL configured
If this distinction is valuable, consider tracking fetch failures:
- None => PoolListExtendedInnerMetadata { - url: Some(onchain.url.clone()), - hash: Some(hex::encode(&*onchain.hash)), - ..Default::default() - }, + None => PoolListExtendedInnerMetadata { + url: Some(onchain.url.clone()), + hash: Some(hex::encode(&*onchain.hash)), + error: Some("Failed to fetch offchain metadata".to_string()), + ..Default::default() + },crates/minibf/src/routes/network.rs (1)
153-174: Verify the u64 to i32 casts won't overflow.The time delta values (
start_delta,end_delta) areu64but cast toi32usingas i32. This performs a truncating cast that could silently produce incorrect values if the delta exceedsi32::MAX(~68 years).For Cardano's current age (~8 years), this is safe, but consider using saturating or checked conversion for robustness.
previous.end = Box::new(NetworkErasInnerEnd { - time: start_delta as i32, + time: i32::try_from(start_delta).unwrap_or(i32::MAX), slot: era.start.slot as i32, epoch: era.start.epoch as i32, });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
crates/minibf/Cargo.toml(1 hunks)crates/minibf/src/routes/network.rs(4 hunks)crates/minibf/src/routes/pools.rs(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
crates/minibf/src/routes/pools.rs (1)
crates/minibf/src/mapping.rs (1)
bech32_pool(104-106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Test (ubuntu-latest)
- GitHub Check: Test (windows-latest)
- GitHub Check: Test (macos-14)
- GitHub Check: Test (macos-13)
🔇 Additional comments (7)
crates/minibf/src/routes/pools.rs (3)
10-10: LGTM on the new import.The
PoolListExtendedInnerMetadataimport aligns with the structured metadata handling introduced in this change.
121-138: Good use of concurrent fetching.The
join_allpattern efficiently fetches offchain metadata in parallel. The 5-second timeout per request (line 45) is reasonable.Consider whether unbounded concurrent requests could cause issues with rate limiting or resource exhaustion when processing many pools. If the pool count is typically bounded by pagination, this should be fine.
175-181: Minor formatting improvements.The added blank lines improve readability around the stake calculation logic.
crates/minibf/src/routes/network.rs (3)
46-62: LGTM on the integer type conversion for mainnet Byron era.The hardcoded values for mainnet Byron era (time, slot_length) are now integers, matching the updated blockfrost-openapi API.
70-86: Preprod configuration correctly updated.The integer conversions mirror the mainnet pattern and values are within safe bounds.
94-134: Preview network configuration looks correct.The multiple cloned eras for preview (handling skipped eras) and the integer type conversions are appropriate. With
end_epoch = 0, the time calculations safely result in 0.crates/minibf/Cargo.toml (1)
25-25: Dependency update verified and safe to merge.The blockfrost-openapi version 0.1.83 is legitimate (released 2025-11-25), not yanked, and no security advisories were found. The bump from 0.1.75 aligns with the type changes in network.rs and pools.rs.
Summary by CodeRabbit
New Features
Chores
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.