mod surface_evidence

module surface_evidence

Source-keyed relaxation-surface rewards exchanged between chains. Transferable relaxation-surface rewards keyed by the measured source.

Moments pool only inside one source descriptor region and one declared proposal and quench condition. Descriptor schema, quench schema, the entering incumbent gap, and charged block work delimit that transfer. A perturbed relaxation input is not a source. A checkpoint whose block interval differs from the held block is not a source. Peer replies keep the key they were credited under.

Variables

const MIN_TRANSFER_OBSERVATIONS: u64

Observations below this count stay on the uninformative local prior.

Structs and Unions

struct SourceTransferKey

Measured source environment and the declared proposal and quench conditions.

descriptor_schema: String

Descriptor schema name for the occupied validated minimum.

descriptor_version: u32

Descriptor schema version.

region: u64

Attraction region of the occupied validated source.

proposal: String

Declared proposal condition.

quench_schema: String

Declared quench schema.

block: usize

Declared hops per held block. A different interval is a different key.

struct SurfaceEvidenceBook

Cumulative snapshots per source key and producer.

Implementations

impl SurfaceEvidenceBook

Functions

fn arms(&self) -> usize

Number of arms.

fn attribute_source<'a>(occupied: &'a SourceTransferKey, _perturbed: &SourceTransferKey, checkpoint: Option<(usize, &SourceTransferKey)>) -> Result<&'a SourceTransferKey, &'static str>

The occupied validated source, never the perturbed relaxation input.

A checkpoint is that source only when its interval is the declared block.

fn decision_allocator(&self, key: &SourceTransferKey) -> Option<DepthAllocator>

Posterior used for transfer. Sparse and unresolved keys stay uninformative.

fn exchange(&mut self, message: SurfaceEvidenceMessage) -> Result<SurfaceEvidenceMessage, &'static str>

Replace this producer’s snapshot and return other producers on the same key.

The reply keeps message.key. The caller’s current region is not read.

fn means(&self, key: &SourceTransferKey) -> Option<Vec<f64>>

Arithmetic means for one source, or None while that context is sparse.

fn moments(&self, key: &SourceTransferKey) -> Vec<RewardMoments>

Merged moments for one source. Missing keys are uninformative.

fn new(n_arms: usize) -> Self

Empty book for n_arms surfaces, plain arm first.

fn observe(&mut self, producer: u32, key: &SourceTransferKey, arm: usize, reward: f64, incumbent_gap: f64, charged_work: u64) -> Result<(), &'static str>

Record one finite rewarded block under the source key it names.

fn pooled_means(&self, descriptor_schema: &str, descriptor_version: u32, proposal: &str, quench_schema: &str, block: usize) -> Vec<f64>

Means pooled across regions that share proposal, quench, and block.

This is the unconditioned aggregate the source key exists to avoid.

struct SurfaceEvidenceMessage

One producer’s cumulative arm rewards for a single source key.

producer: u32

Producer that credited the block. Replies do not rewrite this.

key: SourceTransferKey

Source captured when the held block opened.

arms: Vec<RewardMoments>

Cumulative moments per arm, plain surface first.

incumbent_gap: f64

Entering incumbent gap carried with the block.

charged_work: u64

Charged objective work of the block. Zero is unresolved.

Implementations

impl SurfaceEvidenceMessage

Functions

fn validate(&self, n_arms: usize) -> Result<(), &'static str>

Schema, gap, and charged work must all be present before transfer.