or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Corrupted Staking ledgers
walkthrough and recovery
Call::restore_ledger()
Possible corruption states
Note: per ledger (two ledgers may be affected)
bond_extra
Refresher
The main issue is a combination of:
set_controller
assumes the stash can become a controller (and not overlap with other ledgers);Thus, a ledger (and all data that is keyed based on the ledger state e.g. lock) may be overwritten.
Double bonded ledger
This is not a corrupted state (but latent until
v1.1.3
)Ledger_Ab
will get corrupted if stashB
callsset_controller
.Case 1: Corrupted Ledger
To fix in this case:
Ledger_Ab
(fetchledger.total
from staking lock of A)A
to stash (Bonded(A) = A
)Case 2: Corrupted and killed
To fix in this case:
StakingLock(A)
Ledger_Bb
with amount before killLedger_Bb
with same amount as the lockNote that in this case, we need to provide explicitly the
ledger.amount
/ lock of the new restored ledger (that data is not on-chain anymore).Case 3: Corrupted and killed (other)
To fix in this case:
Ledger(A)
withledger.total = StakingLock(A)
Case 4: Corrupted with
bond_extra
To fix in this case:
Ledger_A.total == StakingLock(A)
Ledger_B.total == StakingLock(B)
Call::restore_ledger()
Called with a
stash
,maybe_total
andmaybe_controller
as inputs.(stash, ledger)
tuple state. May be one ofOk(LedgerIntegrityState::Ok)
Ok(LedgerIntegrityState::Corrupted)
Ok(LedgerIntegrityState::LockCorrupted)
Err(BadState)
https://github.com/paritytech/polkadot-sdk/pull/3706
Status in Polkadot and Kusama
Reports https://hackmd.io/Dsa2tvhISNSs7zcqriTaxQ?view