bitshares / bsips

BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.
https://bitshares.github.io
63 stars 86 forks source link

BSIP65: Fix Locked Accounts #149

Open OpenLedgerApp opened 5 years ago

OpenLedgerApp commented 5 years ago

For https://github.com/bitshares/bsips/issues/94.

OpenLedgerApp commented 5 years ago

We need to determine the way how to fix locked accounts. There are two ways: 1) Automatic (unconditional)

Let's decide it will be automatic or manual way.

OpenLedgerApp commented 5 years ago

Due to the fact that the algorithm for finding and unlocking accounts is quite complex and will require significant costs, we suggest considering another opportunity to unlock in the near HF: 1) add functionality - prevent creation cycled authority 2) compile a list of blocked accounts, find blocking operations and previous account states 3) perform undo blocking operations and return the account to the previous state (hardcoded operations list)

After HF, we check if there are still blocked accounts. They may appear after adding the unlock code, but before the HF. If there are any, then add them hardcoded to the next HF.

pmconrad commented 5 years ago

IMO the algorithm for finding locked accounts is exactly as simple as detecting the lock in the first place. Since the detection logic will have to be implemented anyway, you can simply apply it to all account_update operations:

OpenLedgerApp commented 5 years ago

The logic of finding a blocking operation is not as simple as determining whether an account has been blocked. In addition to the fact that the account is blocked, we must find the last operation in the chain of blocked accounts that led to this state. If you perform such calculations in bitshares-core in maintenance, then you should also take into account that the history plugin may be inactive and the nodes must come to consensus even without it. Without history plugin, this is problematic. You need to build a cache of recent authority change operations during replay, which will require a large amount of additional memory.

pmconrad commented 5 years ago

The logic of finding a blocking operation is not as simple as determining whether an account has been blocked.

Yes it is. An account that is blocked cannot be updated. So a blocking operation is an account_update after which the account has been blocked.

Note that it is not necessary to find the complete original account_update that caused the lock. It is sufficient to remember the owner authority as it was before the lock, and restore that.

abitmore commented 5 years ago

@ryanRfox please assign BSIP number.

sschiessl-bcp commented 4 years ago

Massive amount of hours went into this. What is the status @OpenLedgerApp ?