Comments (5)
I'd be happy for you to start working using the to_be_issued, issued, to_be_redeemed approach.
from interbtc.
I initially assumed all of the vault state on the chain would need to be cleared, but on second thought, it may not have to. We might even be able to resume normal operation even when there are still open redeems if the extrinsic locks sufficient new collateral
However, this introduces a dependency on the internal representation of Vault state, which may change in the future.
I don't think that's relevant - if the internal representation were to change, the check could be just be changed as well. It's far more difficult to determine there are no more open requests than to check the issued tokens, since you'd have to iterate over all of the requests
from interbtc.
I second @sander2 on this one.
Instead of ensuring there are no more pending requests associated with the VaultId, the recover_vault_id(...) extrinsic could check that the to_be_issued, issued, to_be_redeemed fields in the Vault struct are all zero. However, this introduces a dependency on the internal representation of Vault state, which may change in the future. Relying on finalized requests encapsulates this internal representation. Correctness is still preserved by the proposed solution, because the fields mentioned above can only be changed by new and pending requests.
This is the better solution since the to_be_issued
, issued
, to_be_redeemed
format is extremely unlikely to change (I don't have anything in mind that would change this). It's also more foolproof than checking for open requests since ultimately this is our core source of truth w.r.t. Vaults.
Slight modification would be: recover_vault_id(vault_id, active_status, Option<collateral>)
If all of to_be_issued, issued, to_be_redeemed are zero, the vault can directly be activated. If these are non-zero, the function checks if enough additional collateral is added to be above the secure collateral threshold and then reactivate the vault.
from interbtc.
@nud3l Allowing a vault to recover while to_be_redeemed
is non-zero creates an edge case where collateral may remain frozen indefinitely. It would happen when a vault is reported for theft with to_be_redeemed
tokens; the vault calls recover_vault_id(...)
and then redeem::execute_redeem(...)
. In this scenario, decrease_liquidated_collateral()
no longer gets called here, since the execution branch is different.
If you want to avoid this edge case and require zero to_be_redeemed
, then liquidated vaults have zero issued
and to_be_issued
anyway, so it wouldn't make sense to keep the Optional<collateral>
parameter.
from interbtc.
Closed by #647
from interbtc.
Related Issues (20)
- Add support for `rust-bitcoin` in ink! smart contracts HOT 4
- Runtime for testing Bitcoin smart contracts HOT 1
- Add EVM precompiles
- upgrade to polkadot v1.0.0 HOT 2
- Parachain peers HOT 1
- qToken Vaults
- EVM Compatibility
- Rust smart contracts via ink! and the contract pallet
- Remove griefing collateral from mandatory replace request HOT 1
- Benchmarking for sudo pallet
- Usage of longest-chain instead of most-work HOT 2
- Add XCM Test
- Set the max PoV size
- Add update_inflation extrinsic in supply pallet HOT 1
- InsufficientVaultCollateralAmount error when trying to withdraw an amount takes the vault below MinimumCollateral HOT 1
- Version number displayed is wrong HOT 1
- Building raw spec for interlay-dev
- Supply inflation hook is wrong
- Build error at `crates/bitcoin`
- Add migration for collator selection upgrading to polkadot-sdk 1.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interbtc.