Add data feeds cache, proxy, and common contracts - #161
Conversation
Soroban Contract Test Coverage92.57% line coverage — 18067 / 19517 lines hit
Per-Contract Breakdown
Full file-level coverage report |
|
The five failing Go CI checks (E2E, Go Unit Tests, Integration ×2, Coverage) are pre-existing on main with byte-identical failure signatures — not introduced here: deployment/adapters references CommitteeVerifierClient.GetAllSignatureConfigs, which is absent from the bindings at current main, so every Go job fails at build. All contract-side checks (test-contracts, formatting, generated code) pass. |
Without discriminants Soroban encodes a unit enum as a symbol union; with them it becomes an integer enum (U32 on the wire). The Go bindings generator emits U32 for unit enums, so this one-line change makes the generated find_round encoding correct with no generator changes. Deliberately diverges from the byte-identical port by exactly this declaration; behavior inside the contract is unchanged (26+165 tests pass untouched).
fe0b147 to
76ac73e
Compare
|
Note for reviewers: |
Soroban's contracttype/contractevent/contractimpl macros run before name resolution and record whatever type token is written, so an alias name at an ABI position becomes a dangling UDT reference in the wasm spec (aliases produce no definition entry), breaking every downstream bindings generator. Literal BytesN<N> at those positions makes the spec self-contained. The aliases (DataId, WorkflowName, WorkflowOwner, WasmHash, WorkflowCid, ReportId, WireDataId) remain defined and used everywhere the macros cannot see: domain logic, storage, decode paths, and tests. No behavior change; 200 tests pass. Verified via stellar contract inspect that no alias name appears as a type in either wasm spec.
019b250 to
14b9721
Compare
description() returns an empty string both for an unconfigured feed and for one legitimately configured with an empty description, so it cannot answer whether a feed is registered. is_configured checks the config store directly and avoids deserializing FeedConfig.
- Gate both getters on the feed config, so an unknown id reads as None instead of a derived value or an empty string - Keep the pure byte-7 derivation as decimals_from_id for the FeedConfigSet event - Collapse feed::is_configured into feed::configured, which had an identical body - Map both getters to NoDataPresent in the round proxy, matching how it already treats an absent round
- Store frozen on FeedState, which the round reads already load - Return FeedFrozen from latest_round, get_round, round_range, find_round, decimals and description; is_configured stays readable so a frozen feed is still distinguishable from an unknown one - Keep on_report writing while frozen, and carry the flag across a report so an update cannot thaw a feed - Rebuild the self-upgrade fixtures, since the new FeedState field changes its encoding
- Fold the is_frozen toggle and the is_configured exemption into the two round-trip tests that already set them up - Merge the unknown-id and unreported-id cases into one batch atomicity test - Add a live_feed helper for the repeated configure-and-seed pair - Assert every frozen read the same way, since the return types rule out a shared closure
The mock cache always answers Some for decimals and description, so the real-cache test was the only coverage of their absence branch. Widening it to latest_round and get_round lets one test state the whole contract instead of just the paths the mock cannot reach.
- feed::set_frozen returns bool; contract.rs owns the error decision, so no function in domain/feed.rs errors - Map missing feed state to new NoFeedState (110) instead of FeedNotConfigured, which lied for configured-but-unreported feeds - Drop the no-op event suppression so every successful call emits, matching every other emitter in both contracts - Drop the redundant pre-pass existence check in set_feed_frozen
Summary
contracts/data-feeds/as a self-contained nested cargo workspace.Context
Byte-identical port of the reviewed contracts from
data-feeds-stellar-integration(its PR #1), relocating them to live with the other Stellar contracts. The nested workspace keeps their soroban-sdk 26.1 / stellar-access 0.7.2 pins isolated from the root workspace's soroban-sdk 25.1 — no contract changes, and the root workspace build/CI is untouched (verified:cargo check --workspacedoes not descend into it).Changes
contracts/data-feeds/: data-feeds-cache, data-feeds-proxy, data-feeds-common crates with their own workspaceCargo.toml,Cargo.lock, andrust-toolchain.toml.Testing
cargo test --manifest-path contracts/data-feeds/Cargo.toml --workspace— 165 passed.Notes
*/test_fixtures/are inputs for the upgrade tests.cargo test+fmt --checkundercontracts/data-feeds/).