Skip to content

sgns::account::BurnConfig

Genesis-seeded, in-memory-cached, quorum-updatable BURN_BASIS_POINTS value. Delegates ALL signature/quorum logic to SecureCrdt/SecureCrdtRegistry – no bespoke signature/quorum logic exists here (mirrors TPR-03 precedent).

#include <BurnConfig.hpp>

Inherits from std::enable_shared_from_this< BurnConfig >

Public Types

Name
using std::function< void(uint64_t)> RefreshCallback
using std::function< std::vector< uint8_t >(const std::vector< uint8_t > &)> SignCallback

Public Functions

Name
BurnConfig(std::shared_ptr< sgns::securecrdt::SecureCrdt > secure_crdt, std::shared_ptr< sgns::crdt::GlobalDB > db, std::shared_ptr< sgns::trustedpeer::TrustedPeerRegistry > trusted_peer_registry, uint64_t quorum_threshold, std::shared_ptr< sgns::GeniusAccount > account, sgns::crdt::HierarchicalKey base_key)
~BurnConfig()
outcome::result< sgns::securecrdt::CandidateId > OnTrustedPeerGenesisConfirmed()
outcome::result< std::vector< sgns::securecrdt::CandidateId > > ListPendingBurnCandidates() const
outcome::result< sgns::securecrdt::CandidateId > ProposeBurnCandidate(uint64_t basis_points)
outcome::result< sgns::securecrdt::CandidateId > ApproveBurnCandidate(const sgns::securecrdt::CandidateId & candidate_id)
outcome::result< bool > TryActivateBurnCandidate(const sgns::securecrdt::CandidateId & candidate_id)
bool IsEconomicallyReady() const
std::shared_ptr< const ConfirmedBurnValueProvider > GetConfirmedValueProvider() const
uint64_t GetCachedBasisPoints() const
Returns the currently-cached, quorum-confirmed basis-points value (relaxed atomic load) – no live CRDT read.
void RegisterRefreshCallback(RefreshCallback cb)
Registers a callback invoked whenever the cached basis-points value changes as a result of a fresh quorum-re-derivation.
void Unregister()
Unregisters this instance's signer-set-source from SecureCrdtRegistry (test-fixture teardown helper).
outcome::result< std::shared_ptr< BurnConfig > > New(std::shared_ptr< sgns::securecrdt::SecureCrdt > secure_crdt, std::shared_ptr< sgns::crdt::GlobalDB > db, std::shared_ptr< sgns::trustedpeer::TrustedPeerRegistry > trusted_peer_registry, uint64_t quorum_threshold, std::shared_ptr< sgns::GeniusAccount > account, sgns::crdt::HierarchicalKey base_key =sgns::crdt::HierarchicalKey("burn-config"))
Constructs a BurnConfig, registers its signer-set-source and CRDT change-callback, and auto-seeds the genesis default exactly once if eligible.
outcome::result< std::shared_ptr< BurnConfig > > NewProduction(std::shared_ptr< sgns::securecrdt::SecureCrdt > secure_crdt, std::shared_ptr< sgns::trustedpeer::TrustedPeerRegistry > trusted_peer_registry, std::shared_ptr< sgns::trustedpeer::TrustStateStore > trust_store, std::string local_signer_address, SignCallback sign_callback, std::string candidate_domain ="burn-config")
std::optional< sgns::securecrdt::CandidateCore > BurnCandidateCore(const sgns::trustedpeer::ConfirmedBurnState & candidate, const std::string & domain ="burn-config")

Public Attributes

Name
constexpr uint64_t GENESIS_DEFAULT_BASIS_POINTS
Known genesis default burn-basis-points value (BURN-03 pre-quorum fallback).

Public Types Documentation

using RefreshCallback

using sgns::account::BurnConfig::RefreshCallback =  std::function<void( uint64_t )>;

using SignCallback

using sgns::account::BurnConfig::SignCallback =  std::function<std::vector<uint8_t>( const std::vector<uint8_t> & )>;

Public Functions Documentation

function BurnConfig

BurnConfig(
    std::shared_ptr< sgns::securecrdt::SecureCrdt > secure_crdt,
    std::shared_ptr< sgns::crdt::GlobalDB > db,
    std::shared_ptr< sgns::trustedpeer::TrustedPeerRegistry > trusted_peer_registry,
    uint64_t quorum_threshold,
    std::shared_ptr< sgns::GeniusAccount > account,
    sgns::crdt::HierarchicalKey base_key
)

function ~BurnConfig

~BurnConfig()

function OnTrustedPeerGenesisConfirmed

outcome::result< sgns::securecrdt::CandidateId > OnTrustedPeerGenesisConfirmed()

function ListPendingBurnCandidates

outcome::result< std::vector< sgns::securecrdt::CandidateId > > ListPendingBurnCandidates() const

function ProposeBurnCandidate

outcome::result< sgns::securecrdt::CandidateId > ProposeBurnCandidate(
    uint64_t basis_points
)

function ApproveBurnCandidate

outcome::result< sgns::securecrdt::CandidateId > ApproveBurnCandidate(
    const sgns::securecrdt::CandidateId & candidate_id
)

function TryActivateBurnCandidate

outcome::result< bool > TryActivateBurnCandidate(
    const sgns::securecrdt::CandidateId & candidate_id
)

function IsEconomicallyReady

bool IsEconomicallyReady() const

function GetConfirmedValueProvider

std::shared_ptr< const ConfirmedBurnValueProvider > GetConfirmedValueProvider() const

function GetCachedBasisPoints

uint64_t GetCachedBasisPoints() const

Returns the currently-cached, quorum-confirmed basis-points value (relaxed atomic load) – no live CRDT read.

Return: Cached basis-points value.

function RegisterRefreshCallback

void RegisterRefreshCallback(
    RefreshCallback cb
)

Registers a callback invoked whenever the cached basis-points value changes as a result of a fresh quorum-re-derivation.

Parameters:

  • cb Callback receiving the new basis-points value.

function Unregister

void Unregister()

Unregisters this instance's signer-set-source from SecureCrdtRegistry (test-fixture teardown helper).

function New

static outcome::result< std::shared_ptr< BurnConfig > > New(
    std::shared_ptr< sgns::securecrdt::SecureCrdt > secure_crdt,
    std::shared_ptr< sgns::crdt::GlobalDB > db,
    std::shared_ptr< sgns::trustedpeer::TrustedPeerRegistry > trusted_peer_registry,
    uint64_t quorum_threshold,
    std::shared_ptr< sgns::GeniusAccount > account,
    sgns::crdt::HierarchicalKey base_key =sgns::crdt::HierarchicalKey("burn-config")
)

Constructs a BurnConfig, registers its signer-set-source and CRDT change-callback, and auto-seeds the genesis default exactly once if eligible.

Parameters:

  • secure_crdt SecureCrdt wrapper to delegate propose/sign/ quorum operations to.
  • db GlobalDB instance (needed directly for RegisterNewElementCallback).
  • trusted_peer_registry Signer-set source (D-05).
  • quorum_threshold Quorum threshold to enforce.
  • account This node's account (genesis auto-seed signing).
  • base_key Registered CRDT key this instance owns.

Return: outcome::success(instance) on success, or outcome::failure(SecureCrdt::Error::QUORUM_THRESHOLD_BELOW_FLOOR) if quorum_threshold is below the majority-safety floor for the current trusted-peer set size (D-07) – construction FAILS, no instance is produced.

function NewProduction

static outcome::result< std::shared_ptr< BurnConfig > > NewProduction(
    std::shared_ptr< sgns::securecrdt::SecureCrdt > secure_crdt,
    std::shared_ptr< sgns::trustedpeer::TrustedPeerRegistry > trusted_peer_registry,
    std::shared_ptr< sgns::trustedpeer::TrustStateStore > trust_store,
    std::string local_signer_address,
    SignCallback sign_callback,
    std::string candidate_domain ="burn-config"
)

function BurnCandidateCore

static std::optional< sgns::securecrdt::CandidateCore > BurnCandidateCore(
    const sgns::trustedpeer::ConfirmedBurnState & candidate,
    const std::string & domain ="burn-config"
)

Public Attributes Documentation

variable GENESIS_DEFAULT_BASIS_POINTS

static constexpr uint64_t GENESIS_DEFAULT_BASIS_POINTS = 100;

Known genesis default burn-basis-points value (BURN-03 pre-quorum fallback).


Updated on 2026-10-10 at 04:54:21 +0000