# incentives/rewards迁移 ## 迁移前准备 1. 发起两起council提案: a. batch pause 需要禁用的交易 b. batch unpause 被禁用的交易 这两笔提案不要投满票close,留有一票,由@王健江控制close 2. @bryan发起升级runtime的公投提案, 确认执行的区块高度 3. @qiuhao提前准备好相关脚本 ## 迁移流程 1. 在runtime升级执行的区块高度前(10分钟左右,@王健江 close 掉 pause 提案, @joey 测试 pause生效) 2. @qiuhao 控制开关,让相关操作在 apps 和 pw上暂不可用 3. 执行 runtime 升级 4. @qiuhao 用脚本触发 手动迁移 交易(预计15笔交易,每个区块一笔,预计5分钟) 5. @qiuhao 用脚本确认需要迁移的存储已经全部清空 6. @王健江 close掉 unpause 提案, @joey 测试 禁用交易已恢复 7. @qiuhao 打开开关,恢复前端用户的使用 > 理想情况下30分钟内完成整个过程 ## 迁移的storage | 模块 | old storage name | new storage name | 迁移方式 | 其他 | | --- | --- | --- | --- | --- | | Rewards | Pools | PoolInfos | on_runtime_upgrade自动迁移 | | | Rewards | ShareAndWithdrawnReward | SharesAndWithdrawnRewards | 调用`incentives.migrate_share_and_withdrawn_reward(migrate_count)` 触发迁移 | 当前items数量 12941, migrate_count设为 1000, 预计13 ~ 14笔交易后完成 | | Incentives | IncentiveRewardAmount | IncentiveRewardAmounts | on_runtime_upgrade自动迁移 | | | Incentives | DexSavingRewardRate | DexSavingRewardRates | on_runtime_upgrade自动迁移 | | | Incentives | PayoutDeductionRates | ClaimRewardDeductionRates | on_runtime_upgrade自动迁移 | | | Incentives | PendingRewards | PendingMultiRewards | 调用`incentives.migrate_pending_rewards(migrate_count)` 触发迁移 | 当前items数量 1239, migrate_count设为 1000, 预计2 ~ 3笔交易后完成 | > 迁移前再次查询items数量, 确认发送的交易足够迁移全部数据 @qiuhao > 迁移完成后,查询 old storage name 不存在数据 @qiuhao, 并且 new storage 的内容如预期 @joey,视为数据迁移完成 ## 需要禁用的交易 为了在迁移完成前,防止一些操作会对新storage中的shares和rewards进行读写,需要禁用掉下列交易, 对用户影响较大的是 CDP 相关的操作: | module_name | module_bytes | call_name | call_bytes | | ----------- | ---------------------- | --------------------------- | -------------------------------------------------------- | | Honzon | 0x486f6e7a6f6e | adjust_loan | 0x61646a7573745f6c6f616e | | Honzon | 0x486f6e7a6f6e | close_loan_has_debit_by_dex | 0x636c6f73655f6c6f616e5f6861735f64656269745f62795f646578 | | Honzon | 0x486f6e7a6f6e | transfer_loan_from | 0x7472616e736665725f6c6f616e5f66726f6d | | CdpEngine | 0x436470456e67696e65 | liquidate | 0x6c6971756964617465 | | Dex | 0x446578 | add_liquidity | 0x6164645f6c6971756964697479 | | Dex | 0x446578 | remove_liquidity | 0x72656d6f76655f6c6971756964697479 | | Incentives | 0x496e63656e7469766573 | claim_rewards | 0x636c61696d5f72657761726473 | | Incentives | 0x496e63656e7469766573 | deposit_dex_share | 0x6465706f7369745f6465785f7368617265 | | Incentives | 0x496e63656e7469766573 | withdraw_dex_share | 0x77697468647261775f6465785f7368617265 | > 使用 transactionPause.pauseTransaction(module_bytes, call_bytes) 来禁用交易 > 使用 transactionPause.unpauseTransaction 来恢复禁用掉的交易 - batch pause ``` //callData 0x030224060018486f6e7a6f6e2c61646a7573745f6c6f616e060018486f6e7a6f6e6c636c6f73655f6c6f616e5f6861735f64656269745f62795f646578060018486f6e7a6f6e487472616e736665725f6c6f616e5f66726f6d060024436470456e67696e65246c697175696461746506000c446578346164645f6c697175696469747906000c4465784072656d6f76655f6c6971756964697479060028496e63656e746976657334636c61696d5f72657761726473060028496e63656e7469766573446465706f7369745f6465785f7368617265060028496e63656e74697665734877697468647261775f6465785f7368617265 // callHash 0xf5581400269197b34c34eadcdbf0824a9a2164c8247b2024e0288f11813b1f74 ``` - batch unpause ``` // callData 0x030224060118486f6e7a6f6e2c61646a7573745f6c6f616e060118486f6e7a6f6e6c636c6f73655f6c6f616e5f6861735f64656269745f62795f646578060118486f6e7a6f6e487472616e736665725f6c6f616e5f66726f6d060124436470456e67696e65246c697175696461746506010c446578346164645f6c697175696469747906010c4465784072656d6f76655f6c6971756964697479060128496e63656e746976657334636c61696d5f72657761726473060128496e63656e7469766573446465706f7369745f6465785f7368617265060128496e63656e74697665734877697468647261775f6465785f7368617265 // callHash 0x144c8e4e2e26f51eb0621d9deed89eacb74bb606bec49bc3a783e54dbdcde3bc ``` - batch pause proposal ``` //callData 0x3d0214030224060018486f6e7a6f6e2c61646a7573745f6c6f616e060018486f6e7a6f6e6c636c6f73655f6c6f616e5f6861735f64656269745f62795f646578060018486f6e7a6f6e487472616e736665725f6c6f616e5f66726f6d060024436470456e67696e65246c697175696461746506000c446578346164645f6c697175696469747906000c4465784072656d6f76655f6c6971756964697479060028496e63656e746976657334636c61696d5f72657761726473060028496e63656e7469766573446465706f7369745f6465785f7368617265060028496e63656e74697665734877697468647261775f6465785f736861726500 // callHash 0xe9ba88bdeac2704c1b5c66f553b516f403d8a2bc1ea66903bf25fae85726431b ``` - batch unpause proposal ``` // callData 0x3d0214030224060118486f6e7a6f6e2c61646a7573745f6c6f616e060118486f6e7a6f6e6c636c6f73655f6c6f616e5f6861735f64656269745f62795f646578060118486f6e7a6f6e487472616e736665725f6c6f616e5f66726f6d060124436470456e67696e65246c697175696461746506010c446578346164645f6c697175696469747906010c4465784072656d6f76655f6c6971756964697479060128496e63656e746976657334636c61696d5f72657761726473060128496e63656e7469766573446465706f7369745f6465785f7368617265060128496e63656e74697665734877697468647261775f6465785f736861726500 // callHash 0x2c25a06c612a5d3673e54556387dedb9347aeef2d99bb27f157bd4d1468d1b18 ``` ## 后续 1. 由于之前把Loans 的shares 从 cdp 的debit 改成 collateral, PoolId::Loans(KSM) 的shares已经被污染,需要先整个删除。 2. 由于上个版本判断未设置奖励(奖励为0)的情况下用户向CDP中存入抵押物的数量不计入share(新版本已经移除这个改动), 但目前已经开放 LKSM 作为抵押物, 所以这部分用户在不触发adjust_loans的情况,share无法更新。 需要前端判断用户是否已有债仓且share没有更新, 会提示用户做一个更新share的操作。 最好是在开始进行Loans(LKSM)激励前, 在文章中提示用户更新share, 这样留给用户一些时间,然后再开放Loans(LKSM)激励 @qiuhao @向阳 3. 如果要开放Loans(KSM)的激励, 需要先完成1, 然后参考2中对Loans(LKSM)一样的处理
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up