Skip to content

Cache item support multiple Payload Hashes - #5422

Merged
denis-chernov-smartcontract merged 4 commits into
mainfrom
DS-4130
Sep 21, 2026
Merged

denis-chernov-smartcontract merged 4 commits into
mainfrom
DS-4130

Conversation

@denis-chernov-smartcontract

@denis-chernov-smartcontract denis-chernov-smartcontract commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Problem

A streams adapter running both HTTP and gRPC transports failed to deliver observations to gRPC subscribers when an asset pair had already been registered over HTTP with a different request payload.

Solution

Allow a single cache item to track all payload hashes registered for the same raw cache key, and fan out observations to every registered hash. Additionally, expose the adapter version on the Go runtime /health endpoint by reading it from the JS adapter's health response.

Changes

  • common/types.go

    • CacheItem now stores PayloadHashes map[[32]byte]struct{} instead of a single PayloadHash.
  • cache/cache.go

    • SetNew seeds the hash set with the first subscriber's hash.
    • Added AddPayloadHash to register additional hashes for an existing raw key.
    • Added PayloadHashesByRawKey to retrieve all hashes for fan-out.
    • Removed the now-redundant PayloadHashByRawKey.
  • server/server.go

    • EnsureSubscription adds the new payload hash when the raw key already exists.
    • The /cache debug endpoint exposes payloadHashes (list) instead of a duplicated single payloadHash.
    • Added SetAdapterVersion and include adapterVersion in the /health response.
  • redcon/redcon.go

    • On each incoming observation, publish to all payload hashes associated with every raw key mapped to the transformed key.
  • main.go

    • waitForEAServer now reads and returns the adapter version from the JS adapter /health response via readAdapterVersion.

Tests

  • Added TestCache_AddPayloadHash to verify multiple hashes are tracked per cache item.
  • Added TestHandleCommand_Eval_FansOutToMultiplePayloadHashes to verify a single observation is delivered to subscribers on different payload hashes.
  • Added TestReadAdapterVersion and TestHealthHandler_AdapterVersion to verify the adapter version is parsed from the JS adapter health response and returned by /health.

@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e9fcfed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@chainlink/blocksize-capital-adapter Patch
@chainlink/token-allocation-adapter Patch
@chainlink/savax-price-adapter Patch
@chainlink/xsushi-price-adapter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@denis-chernov-smartcontract
denis-chernov-smartcontract merged commit fd6df4c into main Sep 21, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants