Dynamic Memory Recycling (DMR) and Resource Leasing of LA

Off-chain Memory Pool

Coprocessor nodes reserve shared RAM areas. During task execution, segments are requested from MemPool.reserve(bytes) on-demand, and after completion, MemPool.release(id) is called to return them. The controller achieves rapid reuse through the LRU algorithm and zero-copy segments, avoiding redundant initialization of large caches.

Fee Formula

memFee = duration × size × ρ

• duration is measured in blocks to avoid timing drift from the operating system;

• size is calculated in KiB and rounded up;

• ρ is adjusted by FeeOracle based on overall idle capacity every 512 blocks. Fees are frozen at the time of task submission and recalculated based on actual usage upon release, with any excess refunded.

Collateral Mapping

Nodes need to add memFee × σ magnitude of LA to the dynamic collateral pool to cover accidental usage or release failures; σ can be fine-tuned by governance within the range of 0.5–1.5. If there are two consecutive timeouts without release, collateral will be deducted, and the memory pool permissions of that node will be disabled for one epoch.

Security Hooks

• MemAudit can randomly sample the hash of shared segments at any time to verify if they correspond to the declared addresses.

• If the hash does not match or the segment has been illegally rewritten, forceClear() is triggered: the core area is retained, while other segments are immediately zeroed out, and the node incurs an additional Slash.

Governance Adjustment

ρ, σ, and LRU parameters are written into GovStore; proposals require LA staking and a 36-hour delay for execution.

An emergency switch is also retained; if memory contamination occurs consecutively, the community can multi-sign to suspend the memory pool and enforce a snapshot cleanup.

Dynamic memory recycling will accurately price the demand for computing power against the time of resource usage, forming a closed-loop of funds in leasing, collateral, and penalties for LA, allowing high-frequency short tasks to fully utilize idle RAM while ensuring safety.

#Lagrange

$LA

@Lagrange Official