Repository navigation
Conversation
Solana port of the EVM DataFeedsStore (SVR included) that receives Data Feeds reports from a CRE DON through the keystone forwarder. - data-feeds-store program: per-feed history ring, SVR paths, proxy configs, descriptions, workflow permissions and generic report callbacks. Non-SVR settings live in the feed account so a non-SVR report passes one store account; SVR paths keep a DataIdConfig. - store: on_report_callback writes each round through to the existing DF1 feed account, rescaled to its decimals, once its writer is the data feeds store authority. Emits CacheRoundSubmitted/Skipped. - chainlink-solana-data-feeds-store crate for CPI reads. - Go bindings for data_feeds_store and the updated store. - TS SDK: StoreFeed listens for CacheRoundSubmitted. - Tests: Anchor spec, and a Go e2e test sending legacy transactions as CRE builds them (2 DF1-backed reports at F=2, 1 store-only report at F=5).
Drop the single forwarder program the store pinned, and its update_forwarder_id instruction. As on EVM, a report is applied only when its sender, workflow owner and workflow name match an allowed workflow, so any number of forwarders (e.g. a separate forwarder program per zone, as CRE mainline uses on Solana) is just more workflow metadata.
The store ships without SVR and without per-feed proxy configs. Both may come back later, SVR through a store version or a bolt-on contract, and proxies live in their own program. - Remove SVR paths: the data ID config account, its instructions, SVR descriptions, the SVR selection, fallback and sync logic, and the visible round exclusivity. Non-zero SVR path bytes in a data ID are reserved and rejected, so IDs keep their layout if SVR is added. - Remove ProxyConfig, the proxy instructions and the proxy and direct reads. - Add a reader interface proxies call: get_latest_round, get_round, get_decimals and get_description, with Borsh return data and 18-decimal answers. NoDataPresent for a missing round. - Drop svr_path_id and is_freshest from OnReportCallbackArgs and the SVR skip reason from the DF1 store callback. SVR can come back as a new callback instruction. - The CPI crate is now the reader client. - Keep FeedData layout (the visible round becomes reserved bytes).
A standalone proxy with a stable address in front of a data feeds store, modelled on Stellar's multi-feed proxy: one proxy serves every feed and the reader passes the data ID. - read(data_id, round_id): the latest or a given round at the store's 18 decimals. read_scaled(data_id, decimals, round_id) rescales the answer, within a per-feed minimum (18 unless an admin lowers it) and failing with RoundsToZero when a non-zero answer would become zero. - Reads call the configured store's reader interface by CPI, after checking the passed program and state are the configured ones. set_store points the proxy at another store, so the proxy address survives a store swap. - Owner and feed admins, two-step ownership, per-feed min decimals. - chainlink-solana-data-feeds-proxy crate for customer programs, and Go bindings. - dummy-receiver gains mock reader instructions for the swap test. - Tests: Anchor spec, and a Go e2e step reading through the proxy on a local validator (about 6.4k compute units for read against 1.5k for a direct store read).
…gram callback signers, CPI events - Accounts key data IDs zero padded to 32 bytes (feed, description PDAs and stored IDs), so a wider data ID format later keeps every account address. Data IDs stay 16 bytes on the wire, in events and in callback arguments, matching the EVM DataFeedsStore. FeedData keeps its size; _reserved0 stays free for an SVR visible round ID. - on_report skips a report with an invalid (zero or SVR) data ID or for an uninitialized feed with an event instead of aborting the batch. Only a malformed payload, a mismatched feed account, callback accounts not passed as configured and a failing callback still abort. - Report callbacks are signed by a callback authority PDA per callback program ([callback_authority, state, program]) instead of the store authority, and only programs the owner allowed (set_callback_program_allowed) can be configured. A callback program can no longer act as another program's signer, e.g. as a DF1 feed's writer. The store authority only holds recoverable tokens and SOL now. on_report no longer takes it. - Events are CPI events (emit_cpi!) in the store and in the DF1 store's report callback, so they survive log truncation. - close_feeds is removed: feeds are never deleted, as on the EVM store. - get_latest_rounds reads up to 31 feeds at once, as the EVM store's getLatestRoundDataBatch. - Account versions are checked on load. Measured in TestDataFeedsStore: F=2 fits 1 report with DF1 write-through (1,143 B) or 2 store-only reports in a legacy transaction; about 5k CU per store-only report and 21k CU per report with DF1 write-through, on top of the forwarder.
- Events are CPI events (emit_cpi!), as in the store. - Feed config PDAs and stored data IDs use the data ID zero padded to 32 bytes, as the store's accounts do, and FeedConfig gets reserved space for later per-feed read settings (e.g. SVR fallback time and sync iterations). - Proxy state and feed config versions are checked on load. - Tests follow the store's new accounts (event authorities, padded feed seeds); the Go e2e test reads through the proxy after the store change.
…version checks on overwrite - on_report reuses one FeedData buffer, the callback account lists and the callback instruction for every report, and serializes events straight into one reused instruction. The bump allocator never frees, so the per-report allocations ran out of the 32KiB heap at about 15 reports (bytemuck zeroed_box panic). Measured now: 22 store-only reports in one on_report use ~103k CU, 20 with DF1 write-through ~389k CU, both within the default heap. - One error enum: Unauthorized was a separate #[error_code] block numbered 6000 like ArrayLengthMismatch and missing from the IDL. It is now StoreError::Unauthorized (6026), so every code is unique and in the IDL; existing codes keep their numbers. - set_callback_program_allowed and set_feed_descriptions refuse to overwrite an existing account with an unknown version. - TestDataFeedsStore measures 12/20/22 store-only and 12/20 DF1-backed reports in a V0 transaction with a lookup table.
…a feed config - One error enum: Unauthorized was a separate #[error_code] block numbered 6000 like InvalidDecimals and missing from the IDL. It is now ProxyError::Unauthorized (6007). - set_min_decimals refuses to rewrite an existing FeedConfig with an unknown version.
…ck config - get_latest_rounds reuses one buffer and reads a never-created feed (its own PDA, still empty) as a zero round; 31 feeds fit in one call. - init_feeds, set_max_stored_reports, set_min_max_answers and the settings instructions reuse one feed buffer and emit through EventEmitter, so 20 feeds fit in one admin instruction. - on_report requires the feed to be writable before calling back, reads the callback's return data without a heap copy and only from the callback program, and treats a non-executable callback program as returning false. - Skip events carry the sender. - Reject a NUL byte in descriptions, invalid data IDs in permission checks, the callback authority in callback accounts, accounts or revert on a disabled callback, the store itself as an allowed callback program, and ring sizes that overflow the account length.
…e proxy - The store and proxy client crates read return data themselves instead of Anchor's Return::get, which panics and accepts data from any program: a missing or foreign answer fails with IncorrectProgramId, a malformed one with InvalidAccountData. - The proxy crate only calls the proxy program it is built for; both crates document that callers pin the store or proxy state they trust. - Proxy docs: round IDs restart after set_store, get_min_decimals needs the feed config to report a lowered minimum, the store is assumed at 18 decimals.
A closed upgradeable program stays executable, so the store still calls it;
the loader refuses ("Program is not deployed") and the transaction aborts
without storing the report. Clearing the callback lets reports land again.
Anyone could initialize a store under this program ID and emit events and feed accounts indistinguishable from ours. initialize now requires the program's upgrade authority (checked through its ProgramData account) and takes a pre-created state account (#[account(zero)], exact size), so it needs no other signer and an MCMS timelock holding the authority can create further stores by proposal. Any number of stores can still be created. anchor test loads workspace programs as upgradeable by the provider wallet.
Same as the store: initialize requires the program's upgrade authority (checked through its ProgramData account) and fills a pre-created state account of the exact size (new error InvalidAccount, 6008), so a timelock holding the authority can create further proxies by proposal.
A feed is now one account: init_feeds takes each feed's description and set_feed_descriptions updates existing feeds in place, so the separate FeedDescription PDA keyed by indexed feed ID is gone. Each data ID, also each instance of a feed, has its own description, as on Stellar and DF1. - FeedData gains description[64] after the settings; earlier offsets are unchanged, the header is 1,440 bytes and the largest ring at creation is 274 rounds - get_description reads the feed account (FeedRead), get_decimals takes the state only - FeedDescriptionSet carries the data ID - the store client crate, Go bindings, specs and e2e test follow
This was referenced Nov 10, 2026
Contributor
✅ API Diff Results -
|
Reshape the store and proxy to the signed-off design decisions: - The proxy owns the feed accounts readers pass (round ring, description, minimum decimals, frozen flag) and trusts one store, its writer, replaced by the owner with set_store (as Stellar's set_cache). Round IDs live in the feed, so they continue across stores: no phase IDs. Reads match Stellar's proxy (latest_round, get_round with decimals, decimals, description, get_min_decimals, get_store); the client crate also decodes feed accounts directly, with no call. - The store keeps the write logic and per-feed write settings (feed_config: specific workflows, answer bounds, writes_disabled, DF1 link), and writes every accepted round of a report into the proxy in one call. - Feeds are created by their first report from a default workflow, as on EVM, the rent paid by the store's vault (the store authority PDA) and created in one proxy call per report. A vault that can't pay skips the report. Setters create missing accounts, the feed admin paying. - Two freezes: frozen proxy feeds refuse reads while writes continue, and writes_disabled skips every workflow's reports while reads continue. - No generic report callbacks: a data ID can be linked to a DF1 feed, which the store writes through DF1's unchanged submit, signed by its df1_writer PDA, after checking everything submit could fail on (skipping DF1 only). The DF1 store program and dummy receiver are back to develop. - The store client crate is removed; reads go through the proxy.
Merge the proxy into the store. Each data ID has one feed account owned by the store, holding its latest round, ring, description, read settings and write settings, which readers pass to the store's reads or decode directly. Keeping the feeds in a separate proxy no longer isolated the store's layout, and its extra accounts cost reports per transaction. - Feeds are created by a feed admin (set_feeds, or any per-feed setter), paying the rent: the forwarder passes every account unsigned, so a report can't pay for one. Reports for unset feeds are skipped. - Reads take the decimals to return, down to a per-feed minimum, as on Stellar. A read freeze and a write freeze per feed. - DF1 write-through calls DF1's unchanged submit, signed by the store's df1_writer PDA, after checking everything that would make it fail; otherwise only the DF1 write is skipped, with a reason. - The client crate moves to chainlink-solana-data-feeds-store, with direct-decode and CPI reads. - Tests assert transactions stay within the 64-account lock limit and use no lookup tables in production paths.
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.
Adds the
data-feeds-storeprogram for Chainlink Data Feeds written by CRE on Solana. This replaces the stacked #1665 (store) and #1668 (proxy).One program. The store is a Solana port of the EVM
DataFeedsStorewithout SVR, and it is also the program readers integrate with: there is no separate proxy. Each data ID has one feed account, PDA["feed", state, data_id], holding its latest round, a ring of past rounds, the description, how it is read (minimum decimals, a read freeze) and how it is written (its own workflows, answer bounds, a write freeze, a DF1 link). Readers pass that one account.Reports. The keystone forwarder delivers DON-signed reports to
on_report. Each report is handled on its own, as on EVM: it is skipped with an event when its data ID is invalid, its feed hasn't been set, its writes are disabled, its workflow isn't allowed (the feed's own list, otherwise the store's default list), or it is future-dated, stale or out of range. The rest of the batch still lands.Feeds are set by a feed admin.
set_feedscreates feeds and sets their descriptions and, optionally, their own workflows; every per-feed setter also creates missing feeds. The admin pays the rent: the forwarder passes every account unsigned, so a report can't pay for a feed. Reports for unset feeds are skipped.Reads match Stellar's proxy:
latest_round(data_id, decimals)andget_round(data_id, round_id, decimals)return the answer at the decimals asked for, down to a per-feed minimum, and fail while the read freeze is set. No phase IDs. Thechainlink-solana-data-feeds-storecrate wraps those calls and can also decode a feed account directly, with no call.DF1 write-through. A data ID linked to a DF1 feed also writes each round there through DF1's unchanged
submit, signed by the store'sdf1_writerPDA. The store first checks everythingsubmitcould fail on, and skips only the DF1 write (with a reason) if any check fails. No generic report callbacks. The DF1storeprogram and dummy receiver are unchanged fromdevelop.Also: only the program's upgrade authority creates stores; Go bindings, Anchor specs and a Go end-to-end test with a real forwarder.
Measured (Go e2e, local validator, every transaction within mainnet's 64-account lock limit, no lookup tables):
on_report: about 211k compute units; 20 store-only: about 94k.set_feedscreating 20 feeds: about 238k compute units.Tests: Rust unit tests,
tests/data-feeds-store.spec.ts, andgo test ./gotests -run 'TestDataFeedsStore$'.