From 961bdb971a4d8c3ecc13a09c138786f4273f5ca3 Mon Sep 17 00:00:00 2001 From: Gerald Iakobinyi-Pich Date: Thu, 7 Dec 2023 15:54:12 +0200 Subject: [PATCH 1/2] docs: adding some comments & questions --- docs/07-identity-slashing.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/07-identity-slashing.md b/docs/07-identity-slashing.md index 4466d1c..fc3ae1d 100644 --- a/docs/07-identity-slashing.md +++ b/docs/07-identity-slashing.md @@ -138,7 +138,10 @@ that is older than a set threshold. - `removeManager(address manager) onlyAdmin` - `setBurnAgeThreshold(uint64 ageThreshold) onlyAdmin` - `setStakingContract(address stakingContract) onlyAdmin` + +> TODO: we should probably consider that a user has multiple slash events, abd the release will happen for each slash event individually - `release(address user, uint256 amount) onlyManager` +> TODO: Shall we consider that this could potentially be to big to be handled in 1 transaction, hence we might want to do this in patches (paginate)? - `burnAgedStake() onlyManager` - `supportsInterface(...)` - implement ERC165 interface for IGitcoinStakingIcebox - `slash(address user, uint256 amount) onlyStakingContract` - call transferFrom @@ -146,9 +149,13 @@ that is older than a set threshold. ### State +> TODO: the following mapping will not be able to hold multiple slashing events for the same user. A user might get slashed multiple times before we ever get to burn ... - `mapping(user => Slash) public slashes` +- > TODO: would it make sense to record also the stake IDs? - `struct Slash { uint256 amount, uint64 slashedDate }` - `uint64 public burnAgeThreshold` - `IGitcoinIdentityStaking public stakingContract` +> TODO: It would be great if we could also define what events we want to emit. That will be also important to record the history and evtl. replay everything. + _[← Back to README](..#other-topics)_ From e8408dce2c855851911e2c9c0af7a9d0f3a1b6b4 Mon Sep 17 00:00:00 2001 From: Lucian Hymer Date: Thu, 7 Dec 2023 16:22:24 -0700 Subject: [PATCH 2/2] fixed todos --- docs/07-identity-slashing.md | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/07-identity-slashing.md b/docs/07-identity-slashing.md index fc3ae1d..22b514f 100644 --- a/docs/07-identity-slashing.md +++ b/docs/07-identity-slashing.md @@ -76,8 +76,8 @@ When slashed, stake is sent to the **Stake Icebox** contract. The latest-to-unlock stake will be slashed first. -See [section #8](./08-gitcoin-identity-staking-management.md) for more info about this contract, not -related to slashing. +See [section #8](./08-gitcoin-identity-staking-management.md) for more info about +this contract, not related to slashing. ### Slashing Roles @@ -103,6 +103,14 @@ related to slashing. - `uint16 slashReasonCount` - `IGitcoinStakingIcebox public icebox` +### Slashing Events + +- `Slashed(address user, uint256 amount, uint16 reason)` +- `SlashedMultiple(address[] users, uint256 amount, uint16 reason)` +- `SetIcebox(address iceboxAddress)` +- `AddSlasher(address slasher)` +- `RemoveSlasher(address slasher)` + ## Slasher(s) Can call `slash` to slash stake. Could be... @@ -139,23 +147,24 @@ that is older than a set threshold. - `setBurnAgeThreshold(uint64 ageThreshold) onlyAdmin` - `setStakingContract(address stakingContract) onlyAdmin` -> TODO: we should probably consider that a user has multiple slash events, abd the release will happen for each slash event individually - `release(address user, uint256 amount) onlyManager` -> TODO: Shall we consider that this could potentially be to big to be handled in 1 transaction, hence we might want to do this in patches (paginate)? -- `burnAgedStake() onlyManager` +- `burnAgedStake(uint256 maxBurn) onlyManager` - optional maxBurn limits the + stake to be burned, in case there is too much stake to burn it all + in one transaction (gas limits) - `supportsInterface(...)` - implement ERC165 interface for IGitcoinStakingIcebox - `slash(address user, uint256 amount) onlyStakingContract` - call transferFrom and record the slash ### State -> TODO: the following mapping will not be able to hold multiple slashing events for the same user. A user might get slashed multiple times before we ever get to burn ... -- `mapping(user => Slash) public slashes` -- > TODO: would it make sense to record also the stake IDs? -- `struct Slash { uint256 amount, uint64 slashedDate }` +- `mapping(user => Slash[]) public slashes` +- `struct Slash { uint256 amount, uint64 slashedTime }` - `uint64 public burnAgeThreshold` - `IGitcoinIdentityStaking public stakingContract` -> TODO: It would be great if we could also define what events we want to emit. That will be also important to record the history and evtl. replay everything. +### Events + +- `Released(address user, uint256 amount)` +- `Burned(uint256 amount)` _[← Back to README](..#other-topics)_