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

feat: impl block rewards #1198

Merged
merged 83 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b9bd2c4
chore: init block rewards from liquidity rewards clone
wischli Feb 6, 2023
a69bb5e
feat: adjust extrinsics, add SessionManager
wischli Feb 7, 2023
a2f9a79
refactor: use OneSessionHandler, handle minting, add docs
wischli Feb 10, 2023
1c81915
chore: remove admin deposit/withdraw_stake
wischli Feb 10, 2023
c4dbe47
chore: impl BlockRewards for dev runtime
wischli Feb 10, 2023
795036d
feat: make reward source configurable
wischli Feb 13, 2023
664eee6
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Feb 13, 2023
020ec78
feat: mint remainder
wischli Feb 13, 2023
ccae5c6
feat: finalize session handling
wischli Feb 13, 2023
a99a583
feat: init rewards at genesis
wischli Feb 14, 2023
1ee21af
fix: collator, treasury reward split
wischli Feb 14, 2023
257308d
refactor: use OnUnbalanced instead of PalletId
wischli Feb 14, 2023
bdb6d12
fix: beneficiary reward currency
wischli Feb 15, 2023
97292e2
chore: remove dummy bench, mock, tests
wischli Feb 15, 2023
4c48350
fix: session + collator selection benches
wischli Feb 15, 2023
6fa7c4a
refactor: hardcode many ATs
wischli Feb 15, 2023
0d73cf3
refactor: reward source v2
wischli Feb 16, 2023
a5ac903
refactor: issuance of rewards
wischli Feb 16, 2023
910139a
tests: apply RewardIssuance
wischli Feb 17, 2023
8b8c40f
refactor: total_rewards instead of beneficiary
wischli Feb 17, 2023
c5340dd
tests: add mock
wischli Feb 17, 2023
70bcdc9
fix: reward_to_mint
wischli Feb 21, 2023
4ad2bb0
tests: extend mock
wischli Feb 21, 2023
ce7d9d2
fix: new session handler, genesis setup
wischli Feb 21, 2023
e94c1d0
tests: almost done
wischli Feb 21, 2023
df29f21
feat: init new rewards instance in dev runtime
wischli Feb 21, 2023
9ccc965
tests: finish
wischli Feb 22, 2023
00fb722
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Feb 22, 2023
6ecd801
fix: clippy
wischli Feb 22, 2023
12a1f6f
tests: add pallet_restricted_tokens
wischli Feb 22, 2023
70b46bb
tests: add ci
wischli Feb 27, 2023
6a23f9a
refactor: split up ci tests
wischli Feb 27, 2023
95770df
chore: add block_rewards to dev genesis cfg
wischli Feb 28, 2023
bce628a
feat: add benchmarks
wischli Feb 28, 2023
8aad4b0
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Feb 28, 2023
c03962a
fix: add missing encoding to rewards currency
wischli Feb 28, 2023
b21e10a
fix: clippy
wischli Feb 28, 2023
2de4fb6
chore: bump nix
wischli Feb 28, 2023
48fd15e
ci: add fast-runtime flag to integration tests
wischli Feb 28, 2023
0a5c366
chore: remove open TODOs
wischli Feb 28, 2023
6971b5a
fmt: taplo
wischli Feb 28, 2023
17b6c67
refactor: replace epoch with session for b rewards
wischli Feb 28, 2023
69f703c
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Feb 28, 2023
cec502e
tests: temp fix pools env
wischli Mar 1, 2023
f8044e5
feat: add block rewards init migration
wischli Mar 1, 2023
55b0272
fix: migration
wischli Mar 2, 2023
373a5ed
fix: add missing try-runtime feat to all tomls
wischli Mar 2, 2023
1d3da74
chore: update codeowners
wischli Mar 3, 2023
34a7c57
style: fmt
wischli Mar 3, 2023
60194a9
chore: apply self-review
wischli Mar 3, 2023
404e564
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Mar 6, 2023
144ed20
fix: issues after rebasing
wischli Mar 6, 2023
c1304aa
chore: add session fail event
wischli Mar 7, 2023
78deabb
chore: add benches for session, collator selection
wischli Mar 9, 2023
5556b2c
fix: benchmarks
wischli Mar 10, 2023
5597f73
refactor: move pallet consts
wischli Mar 10, 2023
fdcd632
chore: add saturated conversion comment
wischli Mar 10, 2023
5f84538
refactor: remove unused Rewards requirement
wischli Mar 10, 2023
7070475
refactor: re-add staking currency
wischli Mar 16, 2023
43f6127
refactor: move block rewards consts
wischli Mar 16, 2023
7d4251c
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Mar 16, 2023
19fb92a
chore: nix
wischli Mar 16, 2023
dd50f66
chore: provide conversion for StakingCurrency
wischli Mar 16, 2023
b2cbf25
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Mar 16, 2023
ae05055
fix: lint
wischli Mar 16, 2023
b936c39
docs: improvements
wischli Mar 16, 2023
d5a4f1a
chore: bump nix
wischli Mar 16, 2023
93a481c
refactor: add StakeCurrency as associated type
wischli Mar 16, 2023
684dc68
fix: integration tests
wischli Mar 17, 2023
3f44316
refactor: collator stk
wischli Mar 20, 2023
cb72de4
Merge remote-tracking branch 'origin' into feat/impl-block-rewards
wischli Mar 20, 2023
7c64b8d
chore: bump nix
wischli Mar 20, 2023
27e4653
feat: add check to set_collator_rewards
wischli Mar 27, 2023
7223a31
chore: update CODEOWNERS
wischli Mar 27, 2023
02060eb
refactor: stake amt, group id via associated type
wischli Mar 27, 2023
5be160c
chore: move dev rewards config closer to prod
wischli Mar 27, 2023
ecd49de
refactor: abstract CfgCurrencyId
wischli Mar 28, 2023
8650cc8
Merge remote-tracking branch 'origin/main' into feat/impl-block-rewards
wischli Apr 13, 2023
69de861
Merge remote-tracking branch 'origin/main' into feat/impl-block-rewards
wischli Apr 14, 2023
97a0dbe
fix: bench errors after rebase
wischli Apr 14, 2023
5a3a6ad
fix: dev try-runtime
wischli Apr 14, 2023
572d9e2
fix: benchmarks
wischli Apr 17, 2023
cbb10b1
Merge branch 'main' into feat/impl-block-rewards
wischli Apr 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
};

# This is a hash of all the Cargo dependencies, for reproducibility.
cargoSha256 = "sha256-zxV3FOBuECZdZk7I3SRdgdfHr4/Kjot5cGXGa/p6O/0=";
cargoSha256 = "sha256-UuVX3RxSsUfng4G/Bec8JcI/lOUmxrG7NXSG5hMRgbc=";

nativeBuildInputs = with pkgs; [ clang git-mock pkg-config ];
buildInputs = with pkgs; [ openssl ] ++ (
Expand Down
3 changes: 2 additions & 1 deletion libs/types/src/ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

//! A module that contains all ids where we should be REALLY careful
//! when changing them.
use cfg_primitives::{Balance, CFG};
use frame_support::PalletId;
use sp_runtime::TypeId;

Expand Down Expand Up @@ -42,4 +43,4 @@ pub const CHAIN_BRIDGE_NATIVE_TOKEN_ID: [u8; 4] = *b"xCFG";
pub const COLLATOR_GROUP_ID: u32 = 1;
/// The default amount of stake for CurrencyId::Staking(StakingCurrency::BlockRewards) which is inherently
/// assigned to any member of the only group in block rewards.
pub const DEFAULT_COLLATOR_STAKE: u32 = 1000;
pub const DEFAULT_COLLATOR_STAKE: Balance = CFG;
wischli marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion pallets/block-rewards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ pub mod pallet {
+ MaxEncodedLen
+ FixedPointOperand
+ Into<<<Self as Config>::Currency as CurrencyT<Self::AccountId>>::Balance>
+ MaybeSerializeDeserialize;
+ MaybeSerializeDeserialize
+ From<cfg_primitives::Balance>;
lemunozm marked this conversation as resolved.
Show resolved Hide resolved

/// Domain identification used by this pallet
type Domain: TypedGet;
lemunozm marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
1 change: 1 addition & 0 deletions runtime/development/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ std = [
"frame-system/std",
"frame-system-benchmarking?/std",
"frame-try-runtime/std",
"hex/std",
"orml-asset-registry/std",
"orml-tokens/std",
"orml-xtokens/std",
Expand Down