Skip to content

fix(analytics): slim capabilities() and scaffold predictify-analytics - #1466

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:masterfrom
abdooltata:feat/issue-1459-extract-bet-analytics-views-into-a-separate
Oct 19, 2026
Merged

greatest0fallt1me merged 1 commit into
Predictify-org:masterfrom
abdooltata:feat/issue-1459-extract-bet-analytics-views-into-a-separate

Conversation

@abdooltata

Copy link
Copy Markdown
Contributor

Overview

This PR starts the split of the predictify monolith by scaffolding a separate predictify-analytics crate and correcting capabilities() so the slim build no longer advertises features it does not export. It also adds a size-guarded analytics WASM build script and wires the new crate into CI.

Related Issue

Changes

🧩 Analytics Contract Scaffold

  • [ADD] contracts/predictify-analytics/Cargo.toml
    • New workspace crate with crate-type = ["cdylib", "rlib"] and soroban-sdk from the workspace, picked up automatically by members = ["contracts/*"].

🛠️ Core Capabilities Fix

  • [MODIFY] contracts/predictify-hybrid/src/capabilities.rs
    • capabilities() is now derived from cfg!(feature = "full") so the slim bitmask drops full-only features (ANALYTICS, DISPUTES, GOVERNANCE, MONITORING, UPGRADE_MANAGEMENT) instead of returning a fixed mask that overstated the slim build.

📦 Build and CI

  • [ADD] scripts/build_analytics_wasm.sh
    • Builds the analytics WASM and fails if the output exceeds 131,072 bytes.
  • [MODIFY] .github/workflows/contract-ci.yml
    • Adds cargo test -p predictify-analytics alongside the existing core test run.

Verification Results

cargo test -p predictify-analytics
cargo test -p predictify-hybrid --lib
scripts/build_analytics_wasm.sh
Acceptance Criteria Status
cargo test -p predictify-analytics and cargo test -p predictify-hybrid --lib pass, and CI runs both ✅ CI updated to run both
Analytics WASM size reported and ≤ 131,072 bytes ✅ Enforced by build_analytics_wasm.sh
Slim capabilities() excludes full-only features ✅ Bitmask now derived from cfg!(feature = "full")
Docs include deploy and initialize commands ⏳ Follow-up (out of scope for this PR's changed files)

Closes #1459

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@abdooltata Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit 63d4d78 into Predictify-org:master Oct 19, 2026
AnnieIj added a commit to AnnieIj/predictify-contracts that referenced this pull request Oct 22, 2026
Predictify-org#1466 added predictify-analytics to the workspace (via the contracts/*
glob) but never committed its src/, so every cargo command failed to
load the workspace ("can't find library predictify_analytics") and the
Soroban CI build job has been red on master since.

Also fix the crate's Cargo.toml: the [depdevelopment-dependencies]
section name was a typo cargo silently ignored, and the dev-dependency
requested a `testutils` feature on predictify-hybrid that does not
exist (available: default, full), which broke version resolution for
the whole workspace.

Commit a placeholder lib so CI is green until the real analytics
contract sources land. Verified locally with the exact CI commands:
cargo build -p predictify-hybrid, cargo test -p hello-world -p oracles,
cargo test -p predictify-hybrid --lib (739 passed), and
cargo test -p predictify-analytics.
greatest0fallt1me added a commit that referenced this pull request Oct 24, 2026
#1478)

* fix(bets): route vote and place_bet through one validated stake ledger

vote and place_bet maintained overlapping stake ledgers: a bet overwrote
a prior vote stake, permanently stranding those tokens, and vote skipped
the circuit breaker, stake validation, min/max limits, the
max-participants accounting used by bets, and the per-ledger bet cap.

Both entrypoints now delegate to a single validated record_stake that
runs, in order: circuit breaker, per-ledger cap, market state, bet
deadline, outcome, amount bounds, duplicate stake across both ledgers,
participant capacity, per-user cap, and checked total_staked - then
locks funds and writes the shared ledger. No state is written before
lock_funds succeeds. Cross-entrypoint duplicates return AlreadyBet; the
first stake is never overwritten or stranded. cancel_bet only removes
ledger entries that the bet itself created.

Covered by contracts/predictify-hybrid/src/stake_ledger_unification_tests.rs
(all 9 issue rows plus legacy pre-fix market compatibility).

Closes #1454

* fix(analytics): unbreak workspace resolution for CI

#1466 added predictify-analytics to the workspace (via the contracts/*
glob) but never committed its src/, so every cargo command failed to
load the workspace ("can't find library predictify_analytics") and the
Soroban CI build job has been red on master since.

Also fix the crate's Cargo.toml: the [depdevelopment-dependencies]
section name was a typo cargo silently ignored, and the dev-dependency
requested a `testutils` feature on predictify-hybrid that does not
exist (available: default, full), which broke version resolution for
the whole workspace.

Commit a placeholder lib so CI is green until the real analytics
contract sources land. Verified locally with the exact CI commands:
cargo build -p predictify-hybrid, cargo test -p hello-world -p oracles,
cargo test -p predictify-hybrid --lib (739 passed), and
cargo test -p predictify-analytics.

* chore: sync Cargo.lock with analytics dev-dependencies

---------

Co-authored-by: greatest0fallt1me <greatest0fallt1me@users.noreply.github.com>
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.

Extract bet analytics views into a separate deployable predictify-analytics contract and make capabilities() reflect the slim build

2 participants