owned this note
owned this note
Published
Linked with GitHub
# Kusama corrupted ledgers recovery
We outline the i) [current state](#Current-state) of the corrupted ledgers; 2) [steps to recover](#Recovery-steps) all corrupted and double bonded ledgers; 3) the [state after the recovery](#State-after-recovery) (i.e. executing the recovery referendum).
## Current state
Instructions to re-run the report in [github/polkadot-js-report](https://github.com/gpestana/polkadot-js-report).
**TL;DR**: The solution to restore the corrupted ledgers and bonds in Polkadot consists of caling the following extrinsics:
1. `Staking.restore_ledger(ESGsxFePah1qb96ooTU4QJMxMKUG7NZvgTig3eJxP9f3wLa, None, None, None)`
2. `Staking.restore_ledger(DggTJdwWEbPS4gERc3SRQL4heQufMeayrZGDpjHNC1iEiui, None, None)`
3. `Staking.restore_ledger(Du2LiHk1D1kAoaQ8wsx5jiNEG5CNRQEg6xME5iYtGkeQAJP, None, None)`
```
> Starting report of corrupted ledgers
- Kusama
- block 0x31b4b5aa80b5cc41c0437070a17fbba7eff0697cd02825a2021e4cdb37e5e564
- at Tue Jul 16 2024 13:31:01 GMT+0200 (Central European Summer Time)
🔬 #ledgers: 26643, #bonded: 26646, #payee: 26646
🙈 🙉 🙊 Duplicate controller found: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv | stash 1: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv | stash 2: ESGsxFePah1qb96ooTU4QJMxMKUG7NZvgTig3eJxP9f3wLa
⚙️ ⚙️ ⚙️ is_validator controller: false | stash1 false | stash 2: false
🙈 🙉 🙊 Duplicate controller found: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm | stash 1: DggTJdwWEbPS4gERc3SRQL4heQufMeayrZGDpjHNC1iEiui | stash 2: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm
⚙️ ⚙️ ⚙️ is_validator controller: false | stash1 false | stash 2: false
🙈 🙉 🙊 Duplicate controller found: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt | stash 1: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt | stash 2: Du2LiHk1D1kAoaQ8wsx5jiNEG5CNRQEg6xME5iYtGkeQAJP
⚙️ ⚙️ ⚙️ is_validator controller: false | stash1 false | stash 2: false
🎯 🎯 🎯 status for recovery for [controller: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv, stash: EjCZyoEmMkjVL7xcLdfEP6RpcoozE7VTSFxVuq1BX8TY65v]: ledger.stash: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv, ledger.total: 14900815334460, lock: 0
🎯 🎯 🎯 status for recovery for [controller: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt, stash: EjCZyoEmMkjVL7xcLdfEP6RpcoozE7VTSFxVuq1BX8TY65v]: ledger.stash: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt, ledger.total: 580168928467555, lock: 0
🎯 🎯 🎯 status for recovery for [controller: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm, stash: EjCZyoEmMkjVL7xcLdfEP6RpcoozE7VTSFxVuq1BX8TY65v]: ledger.stash: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm, ledger.total: 900000000000000, lock: 0
🎯 🎯 🎯 status for recovery for [controller: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv, stash: ESGsxFePah1qb96ooTU4QJMxMKUG7NZvgTig3eJxP9f3wLa]: ledger.stash: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv, ledger.total: 14900815334460, lock: 3696202520
🎯 🎯 🎯 status for recovery for [controller: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt, stash: Du2LiHk1D1kAoaQ8wsx5jiNEG5CNRQEg6xME5iYtGkeQAJP]: ledger.stash: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt, ledger.total: 580168928467555, lock: 741524914
🎯 🎯 🎯 status for recovery for [controller: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm, stash: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm]: ledger.stash: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm, ledger.total: 900000000000000, lock: 0
‼️ stash.lock != ledger total for [controller: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv, stash: EjCZyoEmMkjVL7xcLdfEP6RpcoozE7VTSFxVuq1BX8TY65v]: ledger.stash: EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv, ledger.total: 14900815334460, lock: 0
‼️ stash.lock != ledger total for [controller: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt, stash: EjCZyoEmMkjVL7xcLdfEP6RpcoozE7VTSFxVuq1BX8TY65v]: ledger.stash: E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt, ledger.total: 580168928467555, lock: 0
‼️ stash.lock != ledger total for [controller: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm, stash: EjCZyoEmMkjVL7xcLdfEP6RpcoozE7VTSFxVuq1BX8TY65v]: ledger.stash: EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm, ledger.total: 900000000000000, lock: 0
⚫ None ledgers, i.e. 'Ledger(bonded_controller) = None'
none ledger with pair (controller: DFxvhrm1at9kvjRTAcSNKfiXyygHJMZcTf2BT1uJbTkMvSx, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7012b8dfc2b39bf2dd5a8c9bfe3df728c83660a5c3c5f9f7f89a5b897f50d53ffb)
none ledger with pair (controller: EG5xEDKMUkbeNH8aprjVKSnPFdZNRW2kShWsy4Lfxg8273f, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7018cd693190ba358fbfc1356eb81bb69ae584c0177e35deb07816439849f4126f)
none ledger with pair (controller: Do9cjY9duZxbkABAtkSVLjyYsRaQm4WqzDMvMedZToSsgCW, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7025dd314d5cf9255ed0f3bdf2589adc292f47aed28c0690f788ed2dbceb1fc3ff)
none ledger with pair (controller: Cd2YYsjUbQZCZxeqXhJhgNHcgNgtfCqJEzTQA9xq39WkSMa, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70386a9e3f0e74067eef90a9a281c234e05d6fa9c4a25b20fd03913b81d7fccf13)
none ledger with pair (controller: DxFBRA3Zm1RERL7QxWkHHub6SDNWtPMDb56J8z5geHnggB3, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70402fc69a7eb122806b64c9e27735e45009aa922e1ba4675758c75607a96a2172)
none ledger with pair (controller: DmdHGKCbg3jb5jKKyUZXAHAKCpvCmC14bCxUtauo6chSQhr, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7045c200adc666cca26df86e2e4a5aa1af186606b9e2a5b86c14cc954228a3cd00)
none ledger with pair (controller: Dmeo68MTz7MBHww5DmTTVT39aT45iVDM2P9Xr2z8iiCBCai, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe709bc93667f57a17c791c766082c5278860748fc9d5b032f77020cd6f5f0cac404)
none ledger with pair (controller: FPx45BYQGnguBRfjzWMqncbULtLNrjT6iW29t2MhF4eZL7e, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70c399a325d8243855816bd296c0f09e3ed891e5444b629da318eabe05a59a6924)
none ledger with pair (controller: Hbci2LBYuEUMoe5WyprgAzhdGBpDVPUseZnbgrLfY2qyYZj, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70cb1adf3e69c1f58a1bbedb997abded4575ef5b6b7cb135291c8830fbaba1a1fa)
none ledger with pair (controller: HjpVcxLcrvhdmbXfS8EmB3S7zxS7ws2ZyBkgmDsG45y5pN4, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70e1dd89c4762c59f8ae6fb3aa0336a25682d27e847ca43db3d4b8921d230c5e21)
none ledger with pair (controller: GcWmetvhnVxxWpWp5fgf4cJFM3BA8aSrP5NHbFmauva86rS, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70f233e7a4244e2db9351ec357ce0bf89c083920c830df0279c4e2d42229f355e7)
# of none ledgers: 11
```
## 1. Corrupted `ESG`
**Current state**:
- `Bonded(ESG) = EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv`
- `Ledger(ESG) = None`
- `Balances.locks.staking(ESG) = 3,696,202,520`
For `EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv`: (OK ✅)
- `Bonded(EVe) = EVe3hL6XumVKNyrjrjqK5LHNSETvM4djs25wMi9nYr5VMqv`
- `Ledger(EVe) = `Ledger {stash: EVe.., total: 14,902,603,086,185}
- `Balances.locks.staking(EVe) = 14,902,603,086,185`
**Solution**:
```
Staking.restore_ledger(ESGsxFePah1qb96ooTU4QJMxMKUG7NZvgTig3eJxP9f3wLa, None, None, None)
```
✅ **State after recovery**:
- `Bonded(ESG) = ESGsxFePah1qb96ooTU4QJMxMKUG7NZvgTig3eJxP9f3wLa`
- `Ledger(ESG) = Ledger {stash: ESG.., total: 3,696,202,520}`
- `Balances.locks.staking(ESG) = 3,696,202,520`
## 2. Corrupted `Dgg`
**Current state**:
- `Bonded(Dgg) = EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm`
- `Ledger(Dgg) = None`
- `Balances.locks.staking(Dgg) = 187,908,199,001`
For `EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm` (OK ✅)
- `Bonded(EyX) = EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm`
- `Ledger(EyX) = `Ledger {stash: EyX.., total: 900,000,000,000,000}
- `Balances.locks.staking(EyX) = 900,000,000,000,000`
**Solution**:
```
Staking.restore_ledger(DggTJdwWEbPS4gERc3SRQL4heQufMeayrZGDpjHNC1iEiui, None, None)
```
✅ **State after recovery**:
- `Bonded(Dgg) = DggTJdwWEbPS4gERc3SRQL4heQufMeayrZGDpjHNC1iEiui`
- `Ledger(Dgg) = Ledger { stash: Dgg.., total: 187,908,199,001}`
- `Balances.locks.staking(Dgg) = 187,908,199,001`
## 3. Corrupted `Du2`
**Current state**:
- `Bonded(Du2) = E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt`
- `Ledger(Du2) = None`
- `Balances.locks.staking(Du2): 741,524,914
For `E7o2xM99q6ckmFbKJmmmvVyKzs1FDEbLZHjKbPy7mMG9KKt` (OK ✅)
- `Bonded(E7o) = EyXct79ZDWdQfcSgJTG5texKM9wJj3quyh1ugPDVSkSt3Xm`
- `Ledger(E7o) = `Ledger {stash: E7o.., total: 580,422,150,385,340}
- `Balances.locks.staking(E7o) = 580,422,150,385,340`
**Solution**:
```
`Staking.restore_ledger(Du2LiHk1D1kAoaQ8wsx5jiNEG5CNRQEg6xME5iYtGkeQAJP, None, None)`
```
✅ **State after recovery**:
- `Bonded(Du2) = Du2LiHk1D1kAoaQ8wsx5jiNEG5CNRQEg6xME5iYtGkeQAJP`
- `Ledger(Du2) = Ledger {stash: Du2.., total: 741,524,914}`
- `Balances.locks.staking(Du2): 741,524,914
## Overall state after recovery
Instructions to re-run the report in [github/polkadot-js-report](https://github.com/gpestana/polkadot-js-report).
Note: the remaining `None` ledgers are *not* related to the ledger corruption issue and it is a storage inconsistency that can be solved later on.
Note 2: the overall number of bonded/ledgers/payee items may differ at the time of running the report script, but the important factor is that they are all in sync after the ledger recovery.
```
> Starting report of corrupted ledgers
- Kusama
🔬 #ledgers: 26644, #bonded: 26644, #payee: 26644
⚫ None ledgers, i.e. 'Ledger(bonded_controller) = None'
none ledger with pair (controller: DFxvhrm1at9kvjRTAcSNKfiXyygHJMZcTf2BT1uJbTkMvSx, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7012b8dfc2b39bf2dd5a8c9bfe3df728c83660a5c3c5f9f7f89a5b897f50d53ffb)
none ledger with pair (controller: EG5xEDKMUkbeNH8aprjVKSnPFdZNRW2kShWsy4Lfxg8273f, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7018cd693190ba358fbfc1356eb81bb69ae584c0177e35deb07816439849f4126f)
none ledger with pair (controller: Do9cjY9duZxbkABAtkSVLjyYsRaQm4WqzDMvMedZToSsgCW, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7025dd314d5cf9255ed0f3bdf2589adc292f47aed28c0690f788ed2dbceb1fc3ff)
none ledger with pair (controller: Cd2YYsjUbQZCZxeqXhJhgNHcgNgtfCqJEzTQA9xq39WkSMa, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70386a9e3f0e74067eef90a9a281c234e05d6fa9c4a25b20fd03913b81d7fccf13)
none ledger with pair (controller: DxFBRA3Zm1RERL7QxWkHHub6SDNWtPMDb56J8z5geHnggB3, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70402fc69a7eb122806b64c9e27735e45009aa922e1ba4675758c75607a96a2172)
none ledger with pair (controller: DmdHGKCbg3jb5jKKyUZXAHAKCpvCmC14bCxUtauo6chSQhr, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe7045c200adc666cca26df86e2e4a5aa1af186606b9e2a5b86c14cc954228a3cd00)
none ledger with pair (controller: Dmeo68MTz7MBHww5DmTTVT39aT45iVDM2P9Xr2z8iiCBCai, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe709bc93667f57a17c791c766082c5278860748fc9d5b032f77020cd6f5f0cac404)
none ledger with pair (controller: FPx45BYQGnguBRfjzWMqncbULtLNrjT6iW29t2MhF4eZL7e, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70c399a325d8243855816bd296c0f09e3ed891e5444b629da318eabe05a59a6924)
none ledger with pair (controller: Hbci2LBYuEUMoe5WyprgAzhdGBpDVPUseZnbgrLfY2qyYZj, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70cb1adf3e69c1f58a1bbedb997abded4575ef5b6b7cb135291c8830fbaba1a1fa)
none ledger with pair (controller: HjpVcxLcrvhdmbXfS8EmB3S7zxS7ws2ZyBkgmDsG45y5pN4, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70e1dd89c4762c59f8ae6fb3aa0336a25682d27e847ca43db3d4b8921d230c5e21)
none ledger with pair (controller: GcWmetvhnVxxWpWp5fgf4cJFM3BA8aSrP5NHbFmauva86rS, stash: 0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe70f233e7a4244e2db9351ec357ce0bf89c083920c830df0279c4e2d42229f355e7)
# of none ledgers: 11
```