!5348itz/bond-slash-refund-3.22.0 → developfa49ce7462

3.22.0 bond-slash refunds in migrate20to21

AI-generatedEverything on this page was written by an AI agent from the diff: the summaries, the narration, the diagrams, the flags and the glossary. It can be wrong or incomplete, so check it against the code before you rely on it.

2commits
5files
998lines changed
243lines to read
3slash events
544providers paid
135,169RUNE refunded

Where the diff is

One event's refund

2-minute explainer

What changed

Three events

TRON, ETH, BTC; refund = 2 × pool RUNE credit.

TRON 2,237ETH 106,676BTC 26,256 RUNE

Two legs, two guards

Pool drift and Reserve coverage soft-skip with an event.

pool legAsgard→ReserveReserve checkpay providers

Isolation and toggles

Own cache ctx per event; tcso failure still skips all.

TRON toggleETH alwaysBTC toggle

No vault gate

Diverges from 19to20: pool only, premise pinned off-chain.

✗ vault-solvency gate✗ vault coin writes✓ drift + Reserve guards

LUVI and tests

Only BTC.BTC declares a write-down (−3.2e-6).

TRON +1.68e-4ETH +2.75e-4BTC −3.2e-6

State + upgrade

Migration

v20→v21

Mainnet only: after the tcso batch, reverse three slash pool legs and pay 544 bond-provider refunds from the Reserve, each event in its own cache context.

Code toggles

  • newtronSlashRefundEnabled322true
  • newbtcSlashRefundEnabled322true
  • newLUVI migration/20to21 BTC.BTC MaxDrop1e-5

State written

Pool (TRON.TRX, ETH.ETH, BTC.BTC)
+ BalanceAsset ++ BalanceRune −
Module balances
+ Asgard → Reserve+ Reserve → 544 accounts

Line by line · every changed logic line, narrated

5:06runtime
8code chapters
100%logic lines narrated (764/764)
7flagged spots
speed

Chapters

What to check

Ask an AI about this change

Chat assistantClaude, ChatGPT, … (reads a link)

Coding agentClaude Code, Cursor, … (reads the repo)

The context file is context.md. Use Copy with context for an AI that can't open links; it pastes the whole file in.

Glossary

Asgard
The module holding pooled RUNE; freed pool RUNE moves from it to the Reserve.
Board 1088
A separate re-pay plan that may restore the BTC pool; reason for the BTC toggle.
Bond provider
An address that supplies part of a node's bond; refunds go to them pro rata as liquid RUNE.
Bond slash
Penalty taking RUNE from a node's bond, here for outbounds wrongly judged unpaid; part also went to the pool.
Cache context
A scratch copy of state; written only on commit(), discarded on error.
LUVI
Liquidity-unit value index; a migration gate that fails on undeclared per-pool LP value drops. luvi_migration.go ↗
Pool leg
The slash's pool effect: asset debited, RUNE added. The refund reverses it. slash refund ↗
Reserve
The protocol's RUNE reserve module; it pays the refunds.
tcso
The treasury recipient reimbursed by the existing 20to21 batch that runs before the refunds. migration_20to21_gaia.go ↗