-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instant staking #1228
Merged
Merged
Instant staking #1228
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for kleros-v2 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Kudos, SonarCloud Quality Gate passed! |
jaybuidl
added
Type: Feature🗿
Package: Contracts
Court smart contracts
Type: UX
User Experience
labels
Sep 18, 2023
jaybuidl
force-pushed
the
feat/instant-staking
branch
from
December 8, 2023 18:53
de32966
to
1b365a4
Compare
jaybuidl
force-pushed
the
feat/instant-staking
branch
from
December 9, 2023 01:43
83acd03
to
1a4a5f7
Compare
jaybuidl
previously approved these changes
Dec 12, 2023
jaybuidl
force-pushed
the
feat/instant-staking
branch
from
December 13, 2023 12:26
861c85d
to
6cbe8c4
Compare
jaybuidl
approved these changes
Dec 13, 2023
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Code Climate has analyzed commit 6cbe8c4 and detected 26 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
jaybuidl
added a commit
that referenced
this pull request
Dec 19, 2023
jaybuidl
added a commit
that referenced
this pull request
Dec 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Compatibility: ABI change 🗯
Smart contract ABI is changing.
Package: Contracts
Court smart contracts
Type: Feature🗿
Type: UX
User Experience
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change relies heavliy on the new feature that wasn't present in the older version which is the removal of the old delayed stake.
When the juror changes his stake while there is already a delayed stake present for this juror, the old stake will simply be nullified and skipped upon delayed stake execution. Its index will still be there but it'll point to an empty struct. Also this applies to automatic staking (e.g. when inactive juror is penalized), thus it'll also remove the existing delayed stake for this juror. In order for this to work I had to restore the old
stakeOf()
function which returns the current stake that is stored in the sortition. This is needed because the sortition stake is unaffected by the partial staking, thus I can revert to this value if a partially delayed stake gets removed/replaced.Overall, I tried to come up with a solution that doesn't complicate the existing code while also being reliable, and the option to remove the old delayed stake seems like an optimal one.
Also, the delayed stake can be manually removed by the juror if he staked by mistake (e.g. staked in the court where he didn't want to stake).
PR-Codex overview
This PR focuses on improving the arbitration functionality by making changes to the KlerosCore contract and related files.
Detailed summary
timeout
configuration for Mocha tests inhardhat.config.ts
.core.getJurorBalance
tocore.sortitionModule().getJurorBalance
inDisputeKitClassic.sol
andDisputeKitSybilResistant.sol
.subgraph.yaml
.StakeDelayed
toStakeDelayedNotTransferred
inKlerosCore.ts
.core.getJurorBalance
tosortitionModule.getJurorBalance
in integration tests.lockStake
,unlockStake
,penalizeStake
, and updatedsetStake
inISortitionModule.sol
.core.getJurorBalance
tosortitionModule.getJurorBalance
in draw.ts.Juror
and related mappings inKlerosCore.sol
.