Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## [Unreleased]

### Changed
- **Removed the orphaned `history_snapshot` module.** `NormalizedSnapshot`/`normalize_history` were documented as a dashboard aggregate but were never exposed by a contract method and were not `#[contracttype]`, so no backend could obtain them. The dashboard surface is now explicitly `get_stats` (cumulative aggregate) alongside `get_severity_telemetry` (per-severity weekly windows); the module, its `lib.rs` registration, and its ownership list entries were removed (#467)
- **Fuzz targets now assert the contract's documented semantics, not just panic-freedom.** `compute_result` and `validate_config` previously ran the function and let libFuzzer watch for a crash; on code guarded throughout by `checked_mul`/`checked_neg` that finds essentially nothing, and a semantic regression (e.g. treating `mttr == threshold` as a violation) would have left the nightly job green. Both targets now compare every input against `apexchainx_calculator::spec` and fail on any disagreement. Each target header states what it asserts and what it does not; `docs/FUZZING_GUARANTEES.md` states the suite-wide guarantees and the policy for resolving an implementation-vs-documentation conflict
- **`ts/historyPagination.ts` capped pages at 50 where the contract caps at 200** (`history::MAX_PAGE_SIZE`, #409), so a backend paging with `limit = 200` received 50 entries and — because the mirror also derived `hasMore` from the returned length — could conclude history had ended. It also coerced `limit = 0` up to 1, returning an entry where the contract returns an empty page, and reported `hasMore: false` where the contract reports `true`. The helper now imports the contract-generated `MAX_PAGE_SIZE` and mirrors `end = min(offset + limit, total)` / `hasMore = end < total` exactly
- **`ts/configVersionHash.ts` computed an unrelated hash.** It ran djb2 over a canonical JSON serialisation of a snapshot whose fields (`penaltyBps`, `rewardBps`) do not exist on the contract, so a backend comparing it against `get_config_version_hash` would have seen a mismatch on every call. It now reproduces the contract's polynomial rolling hash exactly, in `BigInt` `u64` arithmetic, and is asserted equal to a contract-recorded value
Expand Down
148 changes: 0 additions & 148 deletions apexchainx_calculator/src/history_snapshot.rs

This file was deleted.

7 changes: 6 additions & 1 deletion apexchainx_calculator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ mod event_schema;
pub mod fuzz_spec;
pub mod governance;
pub mod history;
pub mod history_snapshot;
pub mod metadata;
pub mod metrics;
/// Parity checker: compares current `compute_result` against the locked-in
Expand Down Expand Up @@ -2099,6 +2098,12 @@ impl SLACalculatorContract {
// -------------------------------------------------------------------

/// Returns the cumulative SLA performance statistics.
///
/// This is the contract's dashboard aggregate: together with
/// `get_severity_telemetry` (per-severity weekly windows) it is the
/// supported surface for dashboard telemetry. Cumulative totals here
/// subsume the windowed view; consumers that need a windowed summary
/// should read `get_severity_telemetry` rather than re-scan history.
pub fn get_stats(env: Env) -> Result<SLAStats, SLAError> {
Self::check_version(&env)?;
env.storage()
Expand Down
5 changes: 2 additions & 3 deletions docs/MODULE_OWNERSHIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ reviewers and merge bottlenecks are reduced.
| **Contract Core** | Contract Core reviewers | `apexchainx_calculator/src/lib.rs`, `calculation.rs`, `config.rs`, core types and entrypoints |
| **Contract Governance** | Contract Core reviewers | `governance.rs`, `config_freeze.rs`, role management, pause/unpause |
| **Contract Infrastructure** | Contract Core reviewers | `storage_version.rs`, `version_negotiation.rs`, `deployment_policy.rs`, `cross_contract_safety.rs` |
| **Contract Data Layer** | Contract Core reviewers | `history.rs`, `history_snapshot.rs`, `config_metadata.rs`, `config_bundle.rs`, `metadata.rs` |
| **Contract Data Layer** | Contract Core reviewers | `history.rs`, `config_metadata.rs`, `config_bundle.rs`, `metadata.rs` |
| **Event System** | Contract Core reviewers | `event.rs`, `event_schema.rs`, `event_correlation.rs`, event test modules |
| **Audit & Telemetry** | Contract Core reviewers | `audit_state.rs`, `error_responses.rs` |
| **Testing** | Contract Core reviewers | `tests.rs`, `fuzz_tests.rs`, fuzz targets, property tests |
Expand Down Expand Up @@ -62,7 +62,6 @@ All paths are relative to `apexchainx_calculator/src/`.
| `config_freeze.rs` | Contract Governance | `freeze_config`, `unfreeze_config`, `is_config_frozen` | **Medium** |
| `metadata.rs` | Contract Governance | `pause`, `unpause`, `is_paused`, `get_pause_info`, `require_not_paused` | **High** |
| `history.rs` | Contract Data Layer | `get_history`, `prune_history`, `prune_history_by_age`, `get_history_page`, `get_history_page_with_meta`, `get_history_by_outage`, `get_latest_by_outage`, `get_config_count`, `set_retention_limit`, `get_retention_limit` | **High** |
| `history_snapshot.rs` | Contract Data Layer | `normalize_history` | **Medium** |
| `config_metadata.rs` | Contract Data Layer | `record_config_update`, `get_last_config_update` | **Medium** |
| `config_bundle.rs` | Contract Data Layer | (composed types for `get_config_bundle`) | **Low** |
| `audit_state.rs` | Audit & Telemetry | (composed types for `get_full_audit_state`) | **Low** |
Expand Down Expand Up @@ -257,7 +256,7 @@ All paths relative to `.github/workflows/`.
| `calculation.rs`, `config.rs` | 1 reviewer from Contract Core |
| `governance.rs`, `config_freeze.rs` | 1 reviewer from Contract Governance |
| `storage_version.rs`, `version_negotiation.rs`, `cross_contract_safety.rs` | 1 reviewer from Contract Infrastructure |
| `history.rs`, `history_snapshot.rs`, `config_metadata.rs` | 1 reviewer from Contract Data Layer |
| `history.rs`, `config_metadata.rs` | 1 reviewer from Contract Data Layer |
| `event.rs`, `event_schema.rs`, `event_correlation.rs` | 1 reviewer from Event System |
| Any `.github/workflows/*.yml` | 1 reviewer from DevOps |
| Any `docs/*.md` | 1 reviewer from Docs |
Expand Down
Loading