Skip to content

fix: skip unmarshalling empty FinalizedBlocksHashes in cache path#2170

Merged
nimrod-teich merged 1 commit into
mainfrom
fix/empty-finalized-block-hashes-unmarshal
Jan 1, 2026
Merged

fix: skip unmarshalling empty FinalizedBlocksHashes in cache path#2170
nimrod-teich merged 1 commit into
mainfrom
fix/empty-finalized-block-hashes-unmarshal

Conversation

@nimrod-teich

Copy link
Copy Markdown
Contributor

When using smart router with static providers, FinalizedBlocksHashes is empty since static providers don't participate in Lava's finalization protocol. The cache code was attempting to unmarshal empty byte slices which fails with 'expected {} for map'.

This fix adds a length check before attempting to unmarshal, gracefully handling the case where FinalizedBlocksHashes is not populated.

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • read the contribution guide
  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the main branch
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

When using smart router with static providers, FinalizedBlocksHashes
is empty since static providers don't participate in Lava's finalization
protocol. The cache code was attempting to unmarshal empty byte slices
which fails with 'expected {} for map'.

This fix adds a length check before attempting to unmarshal, gracefully
handling the case where FinalizedBlocksHashes is not populated.
@nimrod-teich nimrod-teich merged commit b29650c into main Jan 1, 2026
28 checks passed
@nimrod-teich nimrod-teich deleted the fix/empty-finalized-block-hashes-unmarshal branch January 1, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants