Skip to content

fix: resolve snapshot versioning, view replay parity, config bundle hash, and single-address init (#511, #512, #513, #514) - #533

Open
Fatimasanusi wants to merge 1 commit into
ApexChainx:mainfrom
Fatimasanusi:issues-511-512-513-514
Open

fix: resolve snapshot versioning, view replay parity, config bundle hash, and single-address init (#511, #512, #513, #514)#533
Fatimasanusi wants to merge 1 commit into
ApexChainx:mainfrom
Fatimasanusi:issues-511-512-513-514

Conversation

@Fatimasanusi

Copy link
Copy Markdown

Summary

Resolves four technical debt issues (#511, #512, #513, and #514) in apexchainx_calculator to improve SLA snapshot schema tracking, calculation view consistency, single-RPC backend bootstrapping, and role initialization documentation.

Closes #511
Closes #512
Closes #513
Closes #514


Key Changes

1. SLAConfigSnapshot Versioning (#511)

  • Introduced CONFIG_SNAPSHOT_SCHEMA_VERSION ("v1") and CONFIG_SNAPSHOT_SCHEMA_FIELD_COUNT (2) constants in lib.rs.
  • Replaced hardcoded version literals across canonical and custom snapshot builder methods.
  • Added a CI-backed sentinel test test_config_snapshot_schema_field_count_sentinel in schema_migration_tests.rs.

2. Read-Only Duplicate & Replay Policy for calculate_sla_view (#512)

  • Refactored calculate_sla_view (in calculation.rs and lib.rs) to inspect storage history read-only before computing math.
  • Returns Err(SLAError::DuplicateOutageInput) on conflicting duplicate entries and replays the stored result on matching inputs.
  • Ensures 100% side-effect-free execution (no storage state writes, no event emissions).

3. ConfigBundle Hash Bootstrapping (#513)

  • Added pub config_version_hash: u64 to ConfigBundle struct.
  • Updated get_config_bundle() to compute and include the configuration hash.
  • Updated API stability guardrail field count for ConfigBundle from 2 to 3 in api_stability.rs.

4. Single-Address Deployment Documentation & Test Coverage (#514)

  • Documented single-address / merged-role deployment mode (admin == operator) in initialize() doc comments.
  • Added unit test test_initialize_single_address_merged_roles covering single-key initialization and subsequent role invocations.

Verification Plan

  • Unit tests added/updated for single-address init, ConfigBundle hash integrity, view replay/duplicate conflict handling, and snapshot versioning.
  • ABI stability field count assertions pass in api_stability.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment