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

Luxor/vested wg spending #5072

Merged
merged 40 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ba91eaf
feat: :art: add extrinsic for decreasing budgetj
Jan 26, 2024
06a881b
test: :test_tube: add tests for new extrinsic
Jan 26, 2024
7d4c380
feat: :art: add proposal and tests to proposal pallet
Jan 26, 2024
a2f96d6
feat: :art: add proposal config to runtime
Jan 26, 2024
bf30b57
fix: :zap: rearrange checks
Jan 26, 2024
527e671
test: :zap: add proposal to integration test and update types and met…
Jan 30, 2024
1bd4196
feat: :art: metadata 2003
Jan 30, 2024
0a88b57
Revert "test: :zap: add proposal to integration test and update types…
Jan 31, 2024
52bdb41
feat: :zap: fix error on integration tests code
Jan 31, 2024
374d480
feat: :art: add functionality for vested budget spending
Jan 31, 2024
df6c4af
fix: :green_heart: build errors and add tests
Feb 1, 2024
d390a45
fix: :green_heart: lookup argument
Feb 1, 2024
c9520c0
fix: :green_heart: add converter in order to silence compiler
Feb 2, 2024
5a2f7c8
test: :white_check_mark: add test on vesting
Feb 5, 2024
d28277d
feat: :art: fix integartion tests
Feb 5, 2024
6263679
fix: :white_check_mark: test setup CI build
Feb 6, 2024
eba65fc
fix: :white_check_mark: fix mock setup for test on storage pallet
Feb 6, 2024
f57d8a3
fix: :bug: issue with amm sale
Feb 13, 2024
5ef824d
fix: :green_heart: fix ci checks
Feb 22, 2024
8b611f4
fix: :green_heart: checks for benchmarks
Feb 22, 2024
6d50f40
fix: :white_check_mark: benchmarks
Feb 23, 2024
0a147e4
feat: :sparkles: rebase on latest luxor
Mar 13, 2024
f6afcec
feat: :sparkles: update with latest luxor
Mar 14, 2024
2a9bd1d
feat: :art: simplify code with `force_vested_transfer`
Mar 19, 2024
222565e
Merge branch 'luxor' into pr/ignazio-bovo/5072
Mar 20, 2024
6d4b0e1
fix: :zap: update with latest luxor
Mar 20, 2024
f2239dd
feat: :art: add benchmarks
Mar 26, 2024
8fb6f55
Merge branch 'luxor' into pr/ignazio-bovo/5072
Mar 26, 2024
0be9f52
fix: :memo: address pr comments
Mar 26, 2024
d1ec38b
fix: :zap: integrations tests
Mar 27, 2024
b2fa736
fix: :bug: revert metadata 2002.json to master version and fix issue …
Mar 27, 2024
ac4b0b1
fix: :test_tube: tests & mocks
Mar 28, 2024
26daa9d
fix: :test_tube: benchmark error on amount type
Mar 28, 2024
faed4c3
fix: :green_heart: benchmarks
Apr 2, 2024
9a36aaa
fix: :zap: benchmarking
Apr 2, 2024
6b4abd3
fix: :zap: benchmarks
Apr 2, 2024
e972532
fix: :green_heart: build errors
Apr 2, 2024
d6f2efa
fix: :zap: runtime test errors
Apr 2, 2024
19409c9
fix: :green_heart: ci errors
Apr 2, 2024
210773e
fix: :green_heart: round of ci fixes
Apr 2, 2024
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
8 changes: 7 additions & 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 chain-metadata.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"start": "./start.sh",
"test": "./tests/network-tests/run-tests.sh",
"cargo-checks": "./scripts/cargo-checks.sh",
"cargo-checks-with-benchmarking": "./scripts/cargo-checks-with-benchmarking.sh",
"cargo-build": "./scripts/cargo-build.sh",
"lint": "./scripts/lint-typescript.sh",
"update-chain-metadata": "./scripts/fetch-chain-metadata.sh | tee chain-metadata.json query-node/chain-metadata/$(./scripts/fetch-chain-spec-version.sh).json >/dev/null",
Expand Down
2 changes: 1 addition & 1 deletion query-node/chain-metadata/2003.json

Large diffs are not rendered by default.

60 changes: 34 additions & 26 deletions runtime-modules/content/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,46 @@ authors = ['Joystream contributors']
edition = '2018'

[dependencies]
sp-std = { package = 'sp-std', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
frame-support = { package = 'frame-support', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
frame-system = { package = 'frame-system', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
codec = { package = 'parity-scale-codec', version = '3.1.2', default-features = false, features = ['derive'] }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
serde = {version = '1.0.101', features = ['derive'], optional = true}
strum = {version = "0.19", optional = true}
strum_macros = {version = "0.19", optional = true}
common = { package = 'pallet-common', default-features = false, path = '../common'}
storage = { package = 'pallet-storage', default-features = false, path = '../storage'}
membership = { package = 'pallet-membership', default-features = false, path = '../membership'}
balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
project-token = { package = 'pallet-project-token', default-features = false, path = '../project-token'}
sp-std = { package = 'sp-std', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
frame-support = { package = 'frame-support', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
frame-system = { package = 'frame-system', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
codec = { package = 'parity-scale-codec', version = '3.1.2', default-features = false, features = [
'derive',
] }
scale-info = { version = "2.1.2", default-features = false, features = [
"derive",
] }
serde = { version = '1.0.101', features = ['derive'], optional = true }
strum = { version = "0.19", optional = true }
strum_macros = { version = "0.19", optional = true }
common = { package = 'pallet-common', default-features = false, path = '../common' }
storage = { package = 'pallet-storage', default-features = false, path = '../storage' }
membership = { package = 'pallet-membership', default-features = false, path = '../membership' }
balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
project-token = { package = 'pallet-project-token', default-features = false, path = '../project-token' }
varaint-count = { version = '1.1.0', package = 'variant_count' }

# Benchmarking
frame-benchmarking = { package = 'frame-benchmarking', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true}
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group', optional = true}
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
frame-benchmarking = { package = 'frame-benchmarking', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true }
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group', optional = true }
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }

# util
log = { version = "0.4.17", default-features = false }

[dev-dependencies]
sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
randomness-collective-flip = { package = 'pallet-insecure-randomness-collective-flip', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler'}
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group'}
derive-fixture = { package = 'derive-fixture', default-features = false, path = '../support/derive-fixture'}
common = { package = 'pallet-common', default-features = false, features = ['test'], path = '../common'}
sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
randomness-collective-flip = { package = 'pallet-insecure-randomness-collective-flip', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler' }
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group' }
derive-fixture = { package = 'derive-fixture', default-features = false, path = '../support/derive-fixture' }
common = { package = 'pallet-common', default-features = false, features = [
'test',
], path = '../common' }
vesting = { package = 'pallet-vesting', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
derive-new = "0.5"

[features]
Expand All @@ -64,8 +71,9 @@ std = [
'storage/std',
'balances/std',
'membership/std',
'vesting/std',
'project-token/std',
'scale-info/std',
'frame-benchmarking?/std',
]
try-runtime = [ "frame-support/try-runtime"]
try-runtime = ["frame-support/try-runtime"]
38 changes: 37 additions & 1 deletion runtime-modules/content/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ use common::membership::MemberOriginValidator;
use common::working_group::WorkingGroupAuthenticator;
use frame_support::dispatch::DispatchResult;
use frame_support::traits::{
ConstU16, ConstU32, ConstU64, LockIdentifier, OnFinalize, OnInitialize,
ConstU16, ConstU32, ConstU64, LockIdentifier, OnFinalize, OnInitialize, WithdrawReasons,
};
use frame_support::{parameter_types, PalletId};
pub use membership::WeightInfo;
use sp_core::{H256, U256};
use sp_runtime::traits::Convert;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
Expand All @@ -17,6 +18,7 @@ use sp_runtime::{
use sp_std::cell::RefCell;
use sp_std::convert::{TryFrom, TryInto};
use staking_handler::LockComparator;
use working_group::VestingBalanceOf;

use crate::Config;
use crate::ContentActorAuthenticator;
Expand Down Expand Up @@ -154,6 +156,7 @@ frame_support::construct_runtime!(
DistributionWorkingGroup: working_group::<Instance9>::{Pallet, Call, Storage, Event<T, I>},
StorageWorkingGroup: working_group::<Instance2>::{Pallet, Call, Storage, Event<T, I>},
ContentWorkingGroup: working_group::<Instance3>::{Pallet, Call, Storage, Event<T, I>},
Vesting: vesting::{Pallet, Call, Storage, Event<T>},
}
);

Expand Down Expand Up @@ -476,6 +479,12 @@ impl common::council::CouncilBudgetManager<U256, u64> for CouncilBudgetManager {
}
}

parameter_types! {
pub const MinVestedTransfer: u64 = 10;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
}

// The storage working group instance alias.
pub type StorageWorkingGroupInstance = working_group::Instance2;

Expand All @@ -490,6 +499,7 @@ impl working_group::Config<StorageWorkingGroupInstance> for Test {
type WeightInfo = ();
type MinimumApplicationStake = MinimumApplicationStake;
type LeaderOpeningStake = LeaderOpeningStake;
type VestingBalanceToBalance = BalanceConverter;
}
// The distribution working group instance alias.
pub type DistributionWorkingGroupInstance = working_group::Instance9;
Expand All @@ -505,6 +515,31 @@ impl working_group::Config<DistributionWorkingGroupInstance> for Test {
type WeightInfo = ();
type MinimumApplicationStake = MinimumApplicationStake;
type LeaderOpeningStake = LeaderOpeningStake;
type VestingBalanceToBalance = BalanceConverter;
}

pub struct BlockNumberToBalance();
impl Convert<<Test as frame_system::Config>::BlockNumber, BalanceOf<Test>>
for BlockNumberToBalance
{
fn convert(block: <Test as frame_system::Config>::BlockNumber) -> BalanceOf<Test> {
block as u64
}
}
pub struct BalanceConverter();
impl Convert<BalanceOf<Test>, VestingBalanceOf<Test>> for BalanceConverter {
fn convert(balance: BalanceOf<Test>) -> VestingBalanceOf<Test> {
balance as u64
}
}
impl vesting::Config for Test {
type BlockNumberToBalance = BlockNumberToBalance;
type Currency = Balances;
type RuntimeEvent = RuntimeEvent;
const MAX_VESTING_SCHEDULES: u32 = 3;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
}

// Content working group instance alias.
Expand All @@ -521,6 +556,7 @@ impl working_group::Config<ContentWorkingGroupInstance> for Test {
type WeightInfo = ();
type MinimumApplicationStake = MinimumApplicationStake;
type LeaderOpeningStake = LeaderOpeningStake;
type VestingBalanceToBalance = BalanceConverter;
}

impl common::membership::MemberOriginValidator<RuntimeOrigin, u64, U256> for () {
Expand Down
54 changes: 30 additions & 24 deletions runtime-modules/forum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,45 @@ edition = '2018'

[dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = 'parity-scale-codec', version = '3.1.2', default-features = false, features = ['derive'] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
frame-support = { package = 'frame-support', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
frame-system = { package = 'frame-system', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
sp-std = { package = 'sp-std', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
common = { package = 'pallet-common', default-features = false, path = '../common'}
sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
codec = { package = 'parity-scale-codec', version = '3.1.2', default-features = false, features = [
'derive',
] }
scale-info = { version = "2.1.1", default-features = false, features = [
"derive",
] }
frame-support = { package = 'frame-support', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
frame-system = { package = 'frame-system', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
sp-arithmetic = { package = 'sp-arithmetic', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
sp-runtime = { package = 'sp-runtime', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
sp-std = { package = 'sp-std', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
common = { package = 'pallet-common', default-features = false, path = '../common' }
sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }

# Benchmarking dependencies
frame-benchmarking = { package = 'frame-benchmarking', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true}
membership = { package = 'pallet-membership', default-features = false, path = '../membership', optional = true}
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group', optional = true}
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler', optional = true}
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true}
frame-benchmarking = { package = 'frame-benchmarking', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true }
membership = { package = 'pallet-membership', default-features = false, path = '../membership', optional = true }
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group', optional = true }
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler', optional = true }
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9', optional = true }

[dev-dependencies]
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9'}
membership = { package = 'pallet-membership', default-features = false, path = '../membership'}
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group'}
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler'}
sp-core = { package = 'sp-core', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
vesting = { package = 'pallet-vesting', default-features = false, git = 'https://github.com/joystream/substrate.git', rev = '1d0eefca86ef31b9e7727df01a6ed23ad65491e9' }
membership = { package = 'pallet-membership', default-features = false, path = '../membership' }
working-group = { package = 'pallet-working-group', default-features = false, path = '../working-group' }
staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../staking-handler' }


[features]
default = ['std']
runtime-benchmarks = [
'frame-benchmarking/runtime-benchmarks',
'frame-benchmarking/runtime-benchmarks',
'membership/runtime-benchmarks',
'working-group/runtime-benchmarks',
'staking-handler',
'sp-core',
'sp-core',
'common/runtime-benchmarks',
]
std = [
Expand All @@ -52,10 +58,10 @@ std = [
'sp-io/std',
'pallet-timestamp/std',
'common/std',
'balances/std',
'balances/std',
'membership/std',
'working-group/std',
'scale-info/std',
'frame-benchmarking?/std',
]
try-runtime = [ "frame-support/try-runtime"]
try-runtime = ["frame-support/try-runtime"]
Loading
Loading