JAR: Join-Accumulate Refine

12.3. Refinement🔗

Refinement transforms a work item into a work result by running the service's refine code in the JAVM.

🔗structure
Jar.Services.RefineContext : Type
Jar.Services.RefineContext : Type

Refine host call context: tracks exported segments during refinement.

Constructor

Jar.Services.RefineContext.mk

Fields

payload : ByteArray

Work item payload (accessible via fetch mode 2).

imports : Array ByteArray

Resolved import segment data (accessible via fetch mode 3).

exports : Array ByteArray

Exported segments accumulated during refinement.

exportOffset : Nat

Export offset for global segment indexing.

🔗def
Jar.Services.ImportResolver : Type
Jar.Services.ImportResolver : Type

Import segment resolver: given a segment root hash and index, returns the reconstructed segment data (4104 bytes). In a full node, this retrieves erasure-coded chunks from the DA layer and reconstructs via Reed-Solomon. GP §14.2.

🔗def
Jar.Services.refine [Jar.JarConfig] (serviceCode payload : ByteArray) (gasLimit : Jar.Gas) (imports : Array ByteArray) : Jar.WorkResult × Jar.Gas
Jar.Services.refine [Jar.JarConfig] (serviceCode payload : ByteArray) (gasLimit : Jar.Gas) (imports : Array ByteArray) : Jar.WorkResult × Jar.Gas

Ψ_R : Refine invocation. GP §14. Executes a work-item's refinement code in the PVM with host call dispatch. Returns (result, gas_used, exported_segments).