Skip to content

[BFT-A][R4] Persist canonical CBE curve state and restart reconstruction inputs #1926

@umwelt

Description

@umwelt

Title

[BFT-A][R4] Persist canonical CBE curve state and restart reconstruction inputs

Category

  • R4 Crash Safety

Authoritative Inputs

  • CBE Bonding Curve — Rust Implementation Specification sections 2 and 10

Problem

The current issue assumed a broader native storage model with oracle records and treasury entry maps. The new docs define a narrower curve-state contract centered on EconomicState, AccountState, fixed-width transactions, and deterministic reconstruction.

Current Behavior

Curve state is still fragmented across generalized token, registry, pricing, and nonce state. There is no dedicated persisted source of truth for the exact mutable state required by the docs.

Required Behavior

Persist the canonical curve protocol state needed for deterministic restart and replay:

  • EconomicState { s_c, reserve_balance, treasury_balance, graduated }
  • AccountState { key_id, balance_cbe, balance_sov, next_nonce }
  • immutable band/config inputs required by the runtime model

This issue is about canonical persisted state and reconstruction boundaries. It is not the place to invent extra storage-format requirements that are not specified by these docs.

Safety Impact

If the curve state is reconstructed from fragmented generalized stores, restart and replay can diverge from the documented execution model.

Proposed Fix

Introduce a dedicated persisted curve-state path and make restart reconstruction depend on it.

Dependencies

Acceptance Criteria

  • Canonical persisted curve state exists for documented mutable state
  • Restart reconstruction can rebuild curve state directly from persisted data
  • No generalized token/pricing state remains authoritative for documented curve state
  • Persisted state boundaries are explicit in code and tests

Test Plan

  • Persist/load round-trip tests for curve/account state
  • Restart equivalence tests
  • Cross-node replay reconstruction tests for curve state

Cleanup After

  • Stop using generalized token/oracle stores as the source of truth for curve supply/reserve/treasury/nonce state

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions