Skip to content
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

[Global Disputes] Fix issues after first battery station live test #912

Merged
merged 414 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
414 commits
Select commit Hold shift + click to select a range
06c2cea
Merge branch 'chralt98-dispute-restructuring' into chralt98-court-ove…
Chralt98 Mar 27, 2023
474d2c0
apply review suggestions
Chralt98 Mar 27, 2023
97e4dcc
use keep alive
Chralt98 Mar 27, 2023
c895c08
cargo fmt
Chralt98 Mar 27, 2023
991f140
use function instead of raw
Chralt98 Mar 27, 2023
56cd532
improve documentation
Chralt98 Mar 27, 2023
e261c29
improve 2 outcome check
Chralt98 Mar 27, 2023
80a4046
start gd requires two unqiue outcomes
Chralt98 Mar 28, 2023
8c468e5
fix error
Chralt98 Mar 28, 2023
1fc9b39
Merge branch 'release-dispute-system' into chralt98-dispute-restructu…
Chralt98 Mar 28, 2023
ce13fd2
add empty commit
Chralt98 Mar 28, 2023
7b3ff21
correct admin_destroy_market test
Chralt98 Mar 28, 2023
f445aac
Merge branch 'chralt98-dispute-restructuring' into chralt98-court-ove…
Chralt98 Mar 28, 2023
e9bed9f
revert get_resolution_outcome to on_resolution
Chralt98 Mar 28, 2023
e5a5b52
Merge branch 'main' into chralt98-fix-global-disputes
Chralt98 Mar 28, 2023
a052320
remove gd dependency from simple disputes
Chralt98 Mar 28, 2023
8563c25
fix clippy
Chralt98 Mar 28, 2023
1f7cf3d
Merge branch 'chralt98-dispute-restructuring' into chralt98-court-ove…
Chralt98 Mar 28, 2023
978b425
use appealed outcomes for global dispute
Chralt98 Mar 28, 2023
009039d
fix tests and benchmarks
Chralt98 Mar 28, 2023
c432ef4
modify appeal bond formula
Chralt98 Mar 29, 2023
b7c0127
remove slash percentages
Chralt98 Mar 29, 2023
fdfa079
test default toolchain
Chralt98 Mar 29, 2023
718b99b
benchmark court
Chralt98 Mar 30, 2023
a8b625c
Update zrml/court/src/types.rs
Chralt98 Mar 31, 2023
5fcdb90
Update zrml/court/src/types.rs
Chralt98 Mar 31, 2023
2a422d8
Update zrml/court/src/lib.rs
Chralt98 Mar 31, 2023
4ee4445
Update zrml/court/src/lib.rs
Chralt98 Mar 31, 2023
0409006
Update zrml/court/src/lib.rs
Chralt98 Mar 31, 2023
6be9a23
Update zrml/court/src/mock_storage.rs
Chralt98 Mar 31, 2023
44032bb
Update zrml/court/src/lib.rs
Chralt98 Mar 31, 2023
0cd2281
Update zrml/court/src/lib.rs
Chralt98 Mar 31, 2023
c7962c5
Update zrml/court/src/tests.rs
Chralt98 Mar 31, 2023
5c62d09
Update zrml/court/src/tests.rs
Chralt98 Mar 31, 2023
ea3c10a
periods to round timing, modify tests
Chralt98 Mar 31, 2023
c787a64
modify doc comments
Chralt98 Mar 31, 2023
fc3ec21
use onunbalanced
Chralt98 Mar 31, 2023
8ec3a1d
improve RequestInterval documentation
Chralt98 Mar 31, 2023
e5c93e5
improve consumed_stake documentation
Chralt98 Mar 31, 2023
c783f34
remove court from filter
Chralt98 Mar 31, 2023
3f4e11a
add treasury to court
Chralt98 Mar 31, 2023
7ba9309
correct errors
Chralt98 Mar 31, 2023
0e0e8ad
update comment
Chralt98 Mar 31, 2023
6eb35ba
update get_pool_item comment
Chralt98 Mar 31, 2023
3350021
update get_pool_item comment
Chralt98 Mar 31, 2023
326f4f2
Merge branch 'chralt98-court-overhaul' of github.com:zeitgeistpm/zeit…
Chralt98 Mar 31, 2023
b4a45a7
comment juror pool
Chralt98 Mar 31, 2023
6fe0223
improve doc comments
Chralt98 Mar 31, 2023
d9a3b9e
cargo fmt
Chralt98 Mar 31, 2023
06af2fb
rename constants
Chralt98 Mar 31, 2023
3c0de15
edit court pallet doc
Chralt98 Mar 31, 2023
bb61066
update tests
Chralt98 Mar 31, 2023
4729e1b
rename secret to commitment
Chralt98 Mar 31, 2023
7cbdbe5
make commit reveal failsafer
Chralt98 Mar 31, 2023
1c732de
outsource commitment function
Chralt98 Mar 31, 2023
06c0152
Update scripts/tests/misc.sh
Chralt98 Mar 31, 2023
c7e3986
update doc comments
Chralt98 Mar 31, 2023
5302bd3
merge punish tardy jurors reassign juror stakes
Chralt98 Mar 31, 2023
0bd260a
outsource get_n_random_numbers
Chralt98 Mar 31, 2023
c2c0683
correct logs
Chralt98 Mar 31, 2023
b75d015
rename default to get
Chralt98 Mar 31, 2023
1d3d707
improve extrinsic comments
Chralt98 Apr 3, 2023
6e3a4d5
simplify choose_multiple_weighted
Chralt98 Apr 3, 2023
1802297
improve naming
Chralt98 Apr 3, 2023
b2bca89
remove back_global_dispute
Chralt98 Apr 3, 2023
8fbba7a
unlock jurors from last draws
Chralt98 Apr 3, 2023
780198f
improve error description
Chralt98 Apr 3, 2023
03531fe
shorten mock periods
Chralt98 Apr 3, 2023
ce9a056
document private functions
Chralt98 Apr 3, 2023
6cadc38
add assert to check max appeals
Chralt98 Apr 3, 2023
0f5c763
add stake to juror joined event
Chralt98 Apr 3, 2023
d6abc98
correct test
Chralt98 Apr 3, 2023
31ed506
improve test
Chralt98 Apr 3, 2023
dd1cefc
update reassigned event comment
Chralt98 Apr 3, 2023
7ba0fcd
correct test
Chralt98 Apr 3, 2023
fa8cf27
add assert check
Chralt98 Apr 4, 2023
9fc3fe3
improve tests for draws
Chralt98 Apr 4, 2023
aced219
add reveal vote invalid salt fails test
Chralt98 Apr 4, 2023
49f05cd
denounce slash inside reassign_juror_stakes
Chralt98 Apr 4, 2023
09213de
improve test readibility
Chralt98 Apr 4, 2023
76e286c
rename periods to cycle_ends
Chralt98 Apr 4, 2023
1266ef3
add select jurors test
Chralt98 Apr 4, 2023
68d5817
change randomness source in court tests
Chralt98 Apr 4, 2023
0a5a7d0
fix clippy
Chralt98 Apr 4, 2023
a2a2098
imrpove tests
Chralt98 Apr 4, 2023
3c48e40
remove cccount lookup in tests
Chralt98 Apr 4, 2023
48d87f6
improve test setup
Chralt98 Apr 4, 2023
c16d461
add API tests, add missing unlockings
Chralt98 Apr 5, 2023
a8452fd
add full cycle court tests
Chralt98 Apr 6, 2023
499d1fb
remove invalid test
Chralt98 Apr 6, 2023
bc635e5
add missing WeightInfo
Chralt98 Apr 6, 2023
419c897
add inflation inside court
Chralt98 Apr 11, 2023
351f050
improve benchmarking and testing
Chralt98 Apr 12, 2023
67aa44d
add integrity_test
Chralt98 Apr 12, 2023
c3b61cb
Update zrml/simple-disputes/src/mock.rs
Chralt98 Apr 12, 2023
11960de
Update zrml/simple-disputes/src/mock.rs
Chralt98 Apr 12, 2023
6fc9197
Update zrml/prediction-markets/src/lib.rs
Chralt98 Apr 12, 2023
c638679
add doc string
Chralt98 Apr 12, 2023
553e082
add doc strings
Chralt98 Apr 12, 2023
55fdee0
Reduce settle_bonds LOC
sea212 Apr 3, 2023
0efc405
cargo fmt
Chralt98 Apr 12, 2023
aa09b01
Update zrml/prediction-markets/src/migrations.rs
Chralt98 Apr 12, 2023
2c15b96
Update zrml/prediction-markets/src/migrations.rs
Chralt98 Apr 12, 2023
a71bb5c
apply review suggestion
Chralt98 Apr 12, 2023
981ab1d
Merge branch 'chralt98-dispute-restructuring' into chralt98-court-ove…
Chralt98 Apr 13, 2023
3b789c1
add GDItem integration
Chralt98 Apr 13, 2023
17063e0
add delegations
Chralt98 Apr 13, 2023
ef0ded6
improve code structure
Chralt98 Apr 13, 2023
f4fb443
fix benchmarks
Chralt98 Apr 13, 2023
a0ac03d
optimize logic
Chralt98 Apr 14, 2023
afd9d61
add correct mdm benchmarking on_dispute
Chralt98 Apr 17, 2023
af0a25a
use on_dispute_weight inside api
Chralt98 Apr 17, 2023
b88aca4
improve mdm weight technique
Chralt98 Apr 17, 2023
f48a0a3
add mdm weights to on_resolution
Chralt98 Apr 18, 2023
cbe528a
add tests for pm
Chralt98 Apr 18, 2023
3c6c9fe
Merge branch 'main' into chralt98-dispute-restructuring
Chralt98 Apr 18, 2023
7ab62c4
modify migration logs, fix try-runtime
Chralt98 Apr 18, 2023
47061f1
adjust tests for binary search
Chralt98 Apr 19, 2023
a9f5f46
improve benchmarking
Chralt98 Apr 19, 2023
4a9a04b
do small change
Chralt98 Apr 19, 2023
86bd97e
little benchmark fix
Chralt98 Apr 20, 2023
af60129
Update zrml/authorized/src/benchmarks.rs
Chralt98 Apr 20, 2023
ddf14ff
Update zrml/authorized/src/benchmarks.rs
Chralt98 Apr 20, 2023
8513191
use result with weight struct
Chralt98 Apr 20, 2023
797917c
improve code
Chralt98 Apr 20, 2023
112f5f6
update benchmark and weights
Chralt98 Apr 20, 2023
1e0fcbc
improve dispute api weight system
Chralt98 Apr 21, 2023
da9ef19
test delegations for reassign
Chralt98 Apr 21, 2023
4c0a2f7
correct benchmarks and test
Chralt98 Apr 21, 2023
e2eba05
remove comment
Chralt98 Apr 21, 2023
213d610
Merge branch 'chralt98-dispute-restructuring' into chralt98-court-ove…
Chralt98 Apr 24, 2023
1d25aeb
add API benchmarks
Chralt98 Apr 24, 2023
7dd291f
update weights
Chralt98 Apr 24, 2023
1720ccf
use generic vote item instead of outcome report
Chralt98 Apr 25, 2023
0b0de97
update to court id and generic court
Chralt98 Apr 26, 2023
1c6d5b5
fix stuff and add documentation
Chralt98 Apr 26, 2023
c34b8c8
add court readme, use new parameters
Chralt98 Apr 28, 2023
e8a086b
improve naming, weighting
Chralt98 Apr 28, 2023
ae99d7f
Use accurate dispute weight instead of max
sea212 May 3, 2023
995eae3
take random ranges without replacement
Chralt98 May 4, 2023
2d1295b
Merge branch 'main' into chralt98-fix-global-disputes
Chralt98 May 5, 2023
9c814ac
add start_global_dispute tests
Chralt98 May 5, 2023
bd28a0d
add test
Chralt98 May 5, 2023
b4b040b
fix typo
Chralt98 May 5, 2023
1001f08
switch get_random_number algo
Chralt98 May 8, 2023
5ef62a8
integrate court and reject simple disputes
Chralt98 May 8, 2023
44d788a
update start_global_dispute bench
Chralt98 May 9, 2023
1f7f337
Merge branch 'release-dispute-system' into chralt98-dispute-restructu…
Chralt98 May 9, 2023
6025960
fix clippy
Chralt98 May 9, 2023
85e8fc7
Merge branch 'chralt98-dispute-restructuring' into chralt98-court-ove…
Chralt98 May 9, 2023
d0179b3
Merge branch 'main' into chralt98-fix-global-disputes
Chralt98 May 9, 2023
2e93087
use efficient draw without replacement algorithm
Chralt98 May 9, 2023
f128165
small edits
Chralt98 May 9, 2023
5790e4d
round to min juror stake, use other draw algo
Chralt98 May 10, 2023
0bba8ce
use partial fisher yates algorithm
Chralt98 May 11, 2023
631ad9b
improve naming and comments
Chralt98 May 12, 2023
b5d51f7
update changelog for devs
Chralt98 May 15, 2023
e27c384
improve dispute api documentation
Chralt98 May 15, 2023
3996a19
correct call filters
Chralt98 May 15, 2023
ed7b314
add copyright notice
Chralt98 May 15, 2023
45dcafc
remove is_outcome and is_binary
Chralt98 May 15, 2023
bb25f4a
remove unnecessary "Court" prefix
Chralt98 May 15, 2023
3c0c757
update copyright notices
Chralt98 May 15, 2023
b122ac1
remove front end comment
Chralt98 May 15, 2023
40c79b1
Update zrml/court/README.md
Chralt98 May 15, 2023
beb7caf
npx prettier court readme
Chralt98 May 15, 2023
7d52c61
Merge branch 'chralt98-court-overhaul' of github.com:zeitgeistpm/zeit…
Chralt98 May 15, 2023
d623ec7
improve style of terminology
Chralt98 May 15, 2023
77e4f53
update readme
Chralt98 May 15, 2023
c74938b
remove unnecessary impl block
Chralt98 May 15, 2023
291eb96
update comment
Chralt98 May 15, 2023
6486cf9
remove todo
Chralt98 May 15, 2023
4366285
make reward_pot package private
Chralt98 May 16, 2023
333ab10
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 May 16, 2023
99fc4cf
Update zrml/court/src/lib.rs
Chralt98 May 16, 2023
1b7fd2c
update integrity test
Chralt98 May 16, 2023
1eb1275
Merge branch 'chralt98-court-overhaul' of github.com:zeitgeistpm/zeit…
Chralt98 May 16, 2023
59a0644
improve join court doc
Chralt98 May 16, 2023
d971286
improve extrinsic documentation
Chralt98 May 16, 2023
593f5e0
update delegate doc
Chralt98 May 16, 2023
b8deb67
make some types package private
Chralt98 May 16, 2023
d95b289
fix struct comment
Chralt98 May 16, 2023
3ba2722
update readme
Chralt98 May 16, 2023
220db6b
update readme
Chralt98 May 16, 2023
8f95fbb
remove commitment matcher
Chralt98 May 16, 2023
d89ad7a
fix doc string
Chralt98 May 16, 2023
0c5b8dd
remove unnecessary error
Chralt98 May 16, 2023
4e1e405
improve import
Chralt98 May 16, 2023
83b7560
improve test case
Chralt98 May 17, 2023
ad0c472
fix inflation misbehaviour
Chralt98 May 17, 2023
1fd7d28
improve round timing structure
Chralt98 May 19, 2023
9a7d463
improve error names
Chralt98 May 19, 2023
63b72d8
fix get_valid_delegated_juror
Chralt98 May 19, 2023
b5445a0
remove wrong break
Chralt98 May 19, 2023
5ab27e9
update weight for select jurors
Chralt98 May 19, 2023
38e8b1e
allow rejoin after exit preparation
Chralt98 May 22, 2023
b434ba5
remove unnecessary apis
Chralt98 May 22, 2023
e05f9fd
improve naming and docs
Chralt98 May 24, 2023
5b78736
Merge branch 'main' into chralt98-court-overhaul
Chralt98 Jun 5, 2023
ead0bc5
fix clippy
Chralt98 Jun 5, 2023
16fb1e3
Merge branch 'main' into chralt98-fix-global-disputes
Chralt98 Jun 5, 2023
0479516
correct migrations
Chralt98 Jun 5, 2023
56e7bac
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 Jun 7, 2023
fb1c9fc
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 Jun 15, 2023
b4a8517
Merge branch 'main' into chralt98-fix-global-disputes
Chralt98 Jul 7, 2023
ae2d4f7
fix copyrights
Chralt98 Jul 7, 2023
d559344
fmt
Chralt98 Jul 7, 2023
be077d8
fix clippy
Chralt98 Jul 7, 2023
ebdc6dc
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 Aug 8, 2023
b84b6ea
fix copyrights
Chralt98 Aug 8, 2023
22f08c5
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 Aug 8, 2023
644e583
update changelog for devs
Chralt98 Aug 21, 2023
3d70ec8
Update runtime/common/src/lib.rs
Chralt98 Aug 21, 2023
6f44b92
Update zrml/court/src/lib.rs
Chralt98 Aug 21, 2023
5c8bde2
Update zrml/court/src/benchmarks.rs
Chralt98 Aug 21, 2023
b11b188
comment benchmark components
Chralt98 Aug 21, 2023
5ab68a1
comment benchmark component
Chralt98 Aug 21, 2023
ee75b0a
Update zrml/court/README.md
Chralt98 Aug 21, 2023
502a60d
add terminology for court
Chralt98 Aug 21, 2023
824a542
Merge branch 'chralt98-court-overhaul' of github.com:zeitgeistpm/zeit…
Chralt98 Aug 21, 2023
292deed
Update zrml/prediction-markets/src/benchmarks.rs
Chralt98 Aug 21, 2023
4ddbac0
restructure import
Chralt98 Aug 21, 2023
b51db9d
Update zrml/court/src/lib.rs
Chralt98 Aug 21, 2023
9446d34
Update zrml/court/src/lib.rs
Chralt98 Aug 21, 2023
9d8b87b
Update zrml/court/src/lib.rs
Chralt98 Aug 21, 2023
9715890
use mul_floor and reduce indentation
Chralt98 Aug 21, 2023
db516dc
Merge branch 'chralt98-court-overhaul' of github.com:zeitgeistpm/zeit…
Chralt98 Aug 21, 2023
e471c1e
safe guard inflation emission
Chralt98 Aug 21, 2023
9a71638
use imbalance for minting
Chralt98 Aug 21, 2023
53dc51c
use saturated div
Chralt98 Aug 21, 2023
4dd0931
logging if inflation period mint too high
Chralt98 Aug 22, 2023
4f5fe1f
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 Aug 22, 2023
d1b437d
Merge branch 'chralt98-court-overhaul' into chralt98-fix-global-disputes
Chralt98 Aug 22, 2023
77b8825
fix after merge
Chralt98 Aug 22, 2023
685b5d3
update changelog for devs
Chralt98 Aug 22, 2023
818b492
use imperative
Chralt98 Aug 22, 2023
84ec2a0
fmt
Chralt98 Aug 22, 2023
b14060a
Update zrml/court/src/lib.rs
Chralt98 Aug 22, 2023
a5ca6a4
reduce court InflationPeriod for Battery Station
Chralt98 Aug 22, 2023
5075923
Update zrml/court/src/lib.rs
Chralt98 Aug 22, 2023
6ec8c5d
fmt
Chralt98 Aug 22, 2023
0d7a506
fix tests
Chralt98 Aug 23, 2023
459e9ff
fix issue tokens without burn
Chralt98 Aug 23, 2023
3a33893
remove unnecessary error return
Chralt98 Aug 23, 2023
e2f5114
Merge branch 'chralt98-court-overhaul' into chralt98-fix-global-disputes
Chralt98 Aug 23, 2023
30dc38f
Update Makefile
Chralt98 Aug 23, 2023
a04810b
allow equal amount to previous stake
Chralt98 Aug 23, 2023
7b399bb
Merge branch 'release-dispute-system' into chralt98-court-overhaul
Chralt98 Aug 23, 2023
b792304
Merge branch 'chralt98-court-overhaul' into chralt98-fix-global-disputes
Chralt98 Aug 23, 2023
72c03d0
Merge branch 'release-dispute-system' into chralt98-fix-global-disputes
Chralt98 Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,728 changes: 962 additions & 766 deletions Cargo.lock

Large diffs are not rendered by default.

93 changes: 69 additions & 24 deletions docs/changelog_for_devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,47 @@ components which query the chain's storage, the extrinsics or the runtime
APIs/RPC interface.

## v0.4.0

[#976]: https://github.com/zeitgeistpm/zeitgeist/pull/976

### Changed

All things about Global Disputes Fix ⚠️ :

- Replace `WinnerInfo` by `GlobalDisputeInfo` with the following fields:
- `winner_outcome: OutcomeReport`
- `outcome_info: OutcomeInfo`
- `status: GdStatus`

### Removed

All things about Global Disputes Fix ⚠️ :

- Remove the following event:
- `OutcomeOwnersRewardedWithNoFunds`

### Added
- ⚠️ Add court production implementation ([#976]).
Dispatchable calls are:
- `join_court` - Join the court with a stake to become a juror in order to get the stake-weighted
chance to be selected for decision making.

- ⚠️ Add court production implementation ([#976]). Dispatchable calls are:
- `join_court` - Join the court with a stake to become a juror in order to get
the stake-weighted chance to be selected for decision making.
- `delegate` - Join the court with a stake to become a delegator in order to
delegate the voting power to actively participating jurors.
- `prepare_exit_court` - Prepare as a court participant to leave the court system.
delegate the voting power to actively participating jurors.
- `prepare_exit_court` - Prepare as a court participant to leave the court
system.
- `exit_court` - Exit the court system in order to get the stake back.
- `vote` - An actively participating juror votes secretely on a specific court case,
in which the juror got selected.
- `vote` - An actively participating juror votes secretely on a specific court
case, in which the juror got selected.
- `denounce_vote` - Denounce a selected and active juror, if the secret and
vote is known before the actual reveal period.
- `reveal_vote` - An actively participating juror reveals the previously casted secret vote.
- `appeal` - After the reveal phase (aggregation period), the jurors decision can be appealed.
- `reassign_juror_stakes` - After the appeal period is over,
losers pay the winners for the jurors and delegators.
- `set_inflation` - Set the yearly inflation rate of the court system.
Events are:
vote is known before the actual reveal period.
- `reveal_vote` - An actively participating juror reveals the previously
casted secret vote.
- `appeal` - After the reveal phase (aggregation period), the jurors decision
can be appealed.
- `reassign_juror_stakes` - After the appeal period is over, losers pay the
winners for the jurors and delegators.
- `set_inflation` - Set the yearly inflation rate of the court system. Events
are:
- `JurorJoined` - A juror joined the court system.
- `ExitPrepared` - A court participant prepared to exit the court system.
- `ExitedCourt` - A court participant exited the court system.
Expand All @@ -44,22 +64,43 @@ APIs/RPC interface.
- `CourtAppealed` - A court case was appealed.
- `MintedInCourt` - A court participant was rewarded with newly minted tokens.
- `StakesReassigned` - The juror and delegator stakes have been reassigned.
The losing jurors have been slashed.
The winning jurors have been rewarded by the losers.
The losing jurors are those, who did not vote, or did not vote with the plurality,
were denounced or did not reveal their vote.
The losing jurors have been slashed. The winning jurors have been rewarded
by the losers. The losing jurors are those, who did not vote, or did not
vote with the plurality, were denounced or did not reveal their vote.
- `InflationSet` - The yearly inflation rate of the court system was set.

All things about Global Disputes Fix ⚠️ :

- Add new dispatchable function:
- `refund_vote_fees` - Return all vote funds and fees, when a global dispute
was destroyed.
- Add the following events:
- `OutcomeOwnerRewarded` for `Possession::Paid`
- `OutcomeOwnersRewarded` for `Possession::Shared`
- `OutcomesFullyCleaned` and `OutcomesPartiallyCleaned` for extrinsic
`refund_vote_fees`
- Add enum `Possession` with variants:
- `Paid { owner: AccountId, fee: Balance }`
- `Shared { owners: BoundedVec }`
- `OutcomeInfo` has the following fields:
maltekliemann marked this conversation as resolved.
Show resolved Hide resolved
- `outcome_sum: Balance`
- `possession: Possession`
- Add `GdStatus` with the following enum variants:
- `Active { add_outcome_end: BlockNumber, vote_end: BlockNumber }`
- `Finished`
- `Destroyed`

## v0.3.11

[#1049]: https://github.com/zeitgeistpm/zeitgeist/pull/1049

### Changed

- ⚠️ All tokens now use 10 fractional decimal places ([#1049]).
- Cross-consensus messages (XCM) assume the global canonical representation for token balances.
- The token metadata in the asset registry now assumes that the existential deposit and fee factor
are stored in base 10,000,000,000.
- Cross-consensus messages (XCM) assume the global canonical representation for
token balances.
- The token metadata in the asset registry now assumes that the existential
deposit and fee factor are stored in base 10,000,000,000.

## v0.3.10

Expand All @@ -70,6 +111,7 @@ APIs/RPC interface.
- Use pallet-asset-tx-payment for allowing to pay transaction fees in foreign
currencies ([#1022]). This requires each transaction to specify the fee
payment token with `asset_id` (`None` is ZTG).
> > > > > > > chralt98-court-overhaul

## v0.3.9

Expand All @@ -81,6 +123,9 @@ APIs/RPC interface.

- ⚠️ Add `outsider` field to `MarketBonds` struct. In particular, the `Market`
struct's layout has changed ([#903]).

# v0.3.9

- Adjust `deposit` function used to calculate storage fees for the following
pallets: identity, multisig, preimage, proxy. The cost of adding an identity
reduced from a minimum of 125 ZTG to a minimum of 1.5243 ZTG ([#1011])
Expand Down Expand Up @@ -250,8 +295,8 @@ APIs/RPC interface.
- The `MarketCounter` of the `market-commons` pallet is incremented by one. This
means that `MarketCounter` is now equal to the total number of markets ever
created, instead of equal to the id of the last market created. For details
regarding this fix, see <https://github.com/zeitgeistpm/zeitgeist/pull/636> and
<https://github.com/zeitgeistpm/zeitgeist/issues/365>.
regarding this fix, see <https://github.com/zeitgeistpm/zeitgeist/pull/636>
and <https://github.com/zeitgeistpm/zeitgeist/issues/365>.

- Made the `min_asset_amount_out` and `max_price` parameters of
`swap_exact_amount_in` and the `max_asset_amount_in` and `max_price`
Expand Down
6 changes: 4 additions & 2 deletions primitives/src/constants/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ parameter_types! {

// Global disputes parameters
parameter_types! {
pub const AddOutcomePeriod: BlockNumber = 20;
pub const GlobalDisputeLockId: LockIdentifier = *b"zge/vote";
pub const GlobalDisputesPalletId: PalletId = PalletId(*b"zge/gldp");
pub const MaxGlobalDisputeVotes: u32 = 50;
pub const MaxOwners: u32 = 10;
pub const MinOutcomeVoteAmount: Balance = 10 * CENT;
pub const RemoveKeysLimit: u32 = 250;
pub const GdVotingPeriod: BlockNumber = 140;
pub const VotingOutcomeFee: Balance = 100 * CENT;
}

Expand All @@ -70,8 +72,8 @@ parameter_types! {
// Prediction Market parameters
parameter_types! {
pub const AdvisoryBond: Balance = 25 * CENT;
pub const DisputeBond: Balance = 20 * BASE;
pub const GlobalDisputePeriod: BlockNumber = 7 * BLOCKS_PER_DAY;
pub const DisputeBond: Balance = 5 * BASE;
pub const DisputeFactor: Balance = 2 * BASE;
pub const MaxCategories: u16 = 10;
pub const MaxDisputeDuration: BlockNumber = 50;
pub const MaxDisputes: u16 = 6;
Expand Down
8 changes: 5 additions & 3 deletions runtime/battery-station/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,20 @@ parameter_types! {

parameter_types! {
// Global Disputes
/// The time period in which the addition of new outcomes are allowed.
pub const AddOutcomePeriod: BlockNumber = BLOCKS_PER_DAY;
/// Vote lock identifier, mainly used for the LockableCurrency on the native token.
pub const GlobalDisputeLockId: LockIdentifier = GLOBAL_DISPUTES_LOCK_ID;
/// Pallet identifier
pub const GlobalDisputesPalletId: PalletId = GLOBAL_DISPUTES_PALLET_ID;
/// The period for a global dispute to end.
pub const GlobalDisputePeriod: BlockNumber = 3 * BLOCKS_PER_DAY;
/// The maximum number of owners for a voting outcome for private API calls of `push_voting_outcome`.
/// The maximum number of owners for a voting outcome for private API calls of `push_vote_outcome`.
pub const MaxOwners: u32 = 10;
/// The maximum number of market ids (participate in multiple different global disputes at the same time) for one account to vote on outcomes.
pub const MaxGlobalDisputeVotes: u32 = 50;
/// The minimum required amount to vote on an outcome.
pub const MinOutcomeVoteAmount: Balance = 10 * BASE;
/// The time period in which votes are allowed.
pub const GdVotingPeriod: BlockNumber = 3 * BLOCKS_PER_DAY;
/// The fee required to add a voting outcome.
pub const VotingOutcomeFee: Balance = 200 * BASE;
maltekliemann marked this conversation as resolved.
Show resolved Hide resolved
/// The remove limit for the Outcomes storage double map.
Expand Down
6 changes: 5 additions & 1 deletion runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ macro_rules! decl_common_types {
// IMPORTANT that AddDisputeBond comes before MoveDataToSimpleDisputes!!!
zrml_prediction_markets::migrations::AddDisputeBond<Runtime>,
zrml_prediction_markets::migrations::MoveDataToSimpleDisputes<Runtime>,
// TODO check when to execute this migration and what happens for main-net, since global-disputes was only present on battery station
zrml_global_disputes::migrations::ModifyGlobalDisputesStructures<Runtime>,
);

pub type Executive = frame_executive::Executive<
Expand Down Expand Up @@ -1094,7 +1096,6 @@ macro_rules! impl_config_traits {
type DisputeBond = DisputeBond;
type RuntimeEvent = RuntimeEvent;
type GlobalDisputes = GlobalDisputes;
type GlobalDisputePeriod = GlobalDisputePeriod;
// LiquidityMining is currently unstable.
// NoopLiquidityMining will be applied only to mainnet once runtimes are separated.
type LiquidityMining = NoopLiquidityMining;
Expand Down Expand Up @@ -1156,7 +1157,9 @@ macro_rules! impl_config_traits {
}

impl zrml_global_disputes::Config for Runtime {
type AddOutcomePeriod = AddOutcomePeriod;
type Currency = Balances;
type DisputeResolution = zrml_prediction_markets::Pallet<Runtime>;
type RuntimeEvent = RuntimeEvent;
type GlobalDisputeLockId = GlobalDisputeLockId;
type GlobalDisputesPalletId = GlobalDisputesPalletId;
Expand All @@ -1165,6 +1168,7 @@ macro_rules! impl_config_traits {
type MaxOwners = MaxOwners;
type MinOutcomeVoteAmount = MinOutcomeVoteAmount;
type RemoveKeysLimit = RemoveKeysLimit;
type GdVotingPeriod = GdVotingPeriod;
type VotingOutcomeFee = VotingOutcomeFee;
type WeightInfo = zrml_global_disputes::weights::WeightInfo<Runtime>;
}
Expand Down
8 changes: 5 additions & 3 deletions runtime/zeitgeist/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,20 @@ parameter_types! {

parameter_types! {
// Global Disputes
/// The time period in which the addition of new outcomes are allowed.
pub const AddOutcomePeriod: BlockNumber = BLOCKS_PER_DAY;
/// Vote lock identifier, mainly used for the LockableCurrency on the native token.
pub const GlobalDisputeLockId: LockIdentifier = GLOBAL_DISPUTES_LOCK_ID;
/// Pallet identifier
pub const GlobalDisputesPalletId: PalletId = GLOBAL_DISPUTES_PALLET_ID;
/// The period for a global dispute to end.
pub const GlobalDisputePeriod: BlockNumber = 7 * BLOCKS_PER_DAY;
/// The maximum number of owners for a voting outcome for private API calls of `push_voting_outcome`.
/// The maximum number of owners for a voting outcome for private API calls of `push_vote_outcome`.
pub const MaxOwners: u32 = 10;
/// The maximum number of market ids (participate in multiple different global disputes at the same time) for one account to vote on outcomes.
pub const MaxGlobalDisputeVotes: u32 = 50;
/// The minimum required amount to vote on an outcome.
pub const MinOutcomeVoteAmount: Balance = 10 * BASE;
/// The time period in which votes are allowed.
pub const GdVotingPeriod: BlockNumber = 7 * BLOCKS_PER_DAY;
/// The fee required to add a voting outcome.
pub const VotingOutcomeFee: Balance = 200 * BASE;
/// The remove limit for the Outcomes storage double map.
Expand Down
75 changes: 43 additions & 32 deletions zrml/court/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@ mod pallet {
/// The caller has not enough funds to join the court with the specified amount.
AmountExceedsBalance,
/// After the first join of the court the amount has to be equal or higher than the current stake.
/// This is to ensure the slashable amount in active court rounds
/// This is to ensure the slashable amount in active court rounds
/// is still smaller or equal to the stake.
/// It is also necessary to calculate the `unconsumed` stake properly.
/// Otherwise a juror could just reduce the probability to get selected whenever they want.
/// But this has to be done by `prepare_exit_court` and `exit_court`.
/// Additionally, the `join_court` and `delegate` extrinsics
/// Additionally, the `join_court` and `delegate` extrinsics
/// use `extend_lock` and not `set_lock` or `remove_lock`.
/// This means those extrinsics are not meant to get out, but only to get into the court.
AmountBelowLastJoin,
Expand Down Expand Up @@ -2319,39 +2319,50 @@ mod pallet {
Error::<T>::MarketDoesNotHaveCourtMechanism
);

let court_id = <MarketIdToCourtId<T>>::get(market_id)
.ok_or(Error::<T>::MarketIdToCourtIdNotFound)?;

let court = <Courts<T>>::get(court_id).ok_or(Error::<T>::CourtNotFound)?;
// oracle outcome is added by pm-pallet
let mut gd_outcomes: Vec<GlobalDisputeItem<Self::AccountId, Self::Balance>> =
Vec::new();

let report = market.report.as_ref().ok_or(Error::<T>::MarketReportNotFound)?;
let oracle_outcome = &report.outcome;
let mut appeals_len = 0u32;
let mut draws_len = 0u32;

let appeals_len = court.appeals.len() as u32;

let gd_outcomes = court
.appeals
.iter()
.filter_map(|a| {
match a.appealed_vote_item.clone().into_outcome() {
// oracle outcome is added by pm pallet
Some(outcome) if outcome != *oracle_outcome => Some(GlobalDisputeItem {
outcome,
// we have no better global dispute outcome owner
owner: Self::treasury_account_id(),
// initial vote amount
initial_vote_amount: <BalanceOf<T>>::zero(),
}),
_ => None,
}
})
.collect::<Vec<GlobalDisputeItem<Self::AccountId, Self::Balance>>>();
// None case can happen if no dispute could be created,
// because there is not enough juror and delegator stake,
// in this case allow a global dispute
if let Some(court_id) = <MarketIdToCourtId<T>>::get(market_id) {
let court = <Courts<T>>::get(court_id).ok_or(Error::<T>::CourtNotFound)?;

appeals_len = court.appeals.len() as u32;

let report = market.report.as_ref().ok_or(Error::<T>::MarketReportNotFound)?;
let oracle_outcome = &report.outcome;

gd_outcomes = court
.appeals
.iter()
.filter_map(|a| {
match a.appealed_vote_item.clone().into_outcome() {
// oracle outcome is added by pm pallet
Some(outcome) if outcome != *oracle_outcome => {
Some(GlobalDisputeItem {
outcome,
// we have no better global dispute outcome owner
owner: Self::treasury_account_id(),
// initial vote amount
initial_vote_amount: <BalanceOf<T>>::zero(),
})
}
_ => None,
}
})
.collect::<Vec<GlobalDisputeItem<Self::AccountId, Self::Balance>>>();

let old_draws = SelectedDraws::<T>::get(court_id);
let draws_len = old_draws.len() as u32;
Self::unlock_participants_from_last_draw(court_id, old_draws);
<SelectedDraws<T>>::remove(court_id);
<Courts<T>>::remove(court_id);
let old_draws = SelectedDraws::<T>::get(court_id);
draws_len = old_draws.len() as u32;
Self::unlock_participants_from_last_draw(court_id, old_draws);
<SelectedDraws<T>>::remove(court_id);
<Courts<T>>::remove(court_id);
}

let res = ResultWithWeightInfo {
result: gd_outcomes,
Expand Down
14 changes: 11 additions & 3 deletions zrml/global-disputes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ on which the market finally resolves.
get their reward. Fails if the global dispute is not concluded yet.
- `reward_outcome_owner` - Reward the collected fees to the owner(s) of a voting
outcome. Fails if not all outcomes are already purged.
- `refund_vote_fees` - Return all vote funds and fees, when a global dispute was
destroyed.

maltekliemann marked this conversation as resolved.
Show resolved Hide resolved
#### Private Pallet API

- `push_voting_outcome` - Start a global dispute, add an initial voting outcome
and vote on it.
- `push_vote_outcome` - Add an initial voting outcome and vote on it with
`initial_vote_balance`.
- `determine_voting_winner` - Determine the canonical voting outcome based on
total locked tokens.
- `is_started` - Check if the global dispute started already.
- `does_exist` - Check if the global dispute does already exist.
- `is_active` - Check if the global dispute is active to get votes
(`vote_on_outcome`) and allow the addition of new voting outcomes with
`add_vote_outcome`.
- `start_global_dispute` - Start a global dispute.
- `destroy_global_dispute` - Allow the users to get their voting funds and fee
payments back.
Loading
Loading