Skip to content

Commit

Permalink
feat: staking unbond/withdraw checks for active restaker (#543)
Browse files Browse the repository at this point in the history
* clone staking pallet

* update tests

* update clippy

* doc: use cargo test

* fix test
  • Loading branch information
1xstj authored Mar 12, 2024
1 parent 59a758d commit 6283512
Show file tree
Hide file tree
Showing 40 changed files with 19,721 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: sudo apt-get install protobuf-compiler

- name: Run test suite
run: cargo nextest run --release --workspace
run: cargo test --release --workspace

clippy:
concurrency:
Expand Down
114 changes: 81 additions & 33 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ pallet-offences = { git = "https://github.com/paritytech/polkadot-sdk.git", bran
pallet-nomination-pools = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.7.0", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.7.0", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.7.0", default-features = false }
pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.7.0", default-features = false }
pallet-staking-reward-curve = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.7.0", default-features = false }
pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.7.0", default-features = false }

pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.0", default-features = false }
Expand Down Expand Up @@ -317,6 +315,8 @@ sc-consensus-manual-seal = { git = "https://github.com/paritytech/polkadot-sdk",
tangle-primitives = { path = "primitives", default-features = false }
tangle-crypto-primitives = { path = "primitives/crypto", default-features = false }
pallet-transaction-pause = { path = "pallets/transaction-pause", default-features = false }
pallet-staking = { path = "pallets/staking", default-features = false }
pallet-staking-reward-curve = { path = "pallets/staking/reward-curve", default-features = false }

webb = { git = "https://github.com/webb-tools/webb-rs.git", default-features = false , branch = "salman/polkadot-v1.7.0"}

Expand Down
4 changes: 2 additions & 2 deletions pallets/jobs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub mod module {

for participant in participants {
ensure!(
T::RolesHandler::is_restaker(participant.clone(), role_type),
T::RolesHandler::is_restaker_with_role(participant.clone(), role_type),
Error::<T>::InvalidValidator
);

Expand Down Expand Up @@ -314,7 +314,7 @@ pub mod module {

for participant in participants {
ensure!(
T::RolesHandler::is_restaker(participant.clone(), role_type),
T::RolesHandler::is_restaker_with_role(participant.clone(), role_type),
Error::<T>::InvalidValidator
);

Expand Down
1 change: 1 addition & 0 deletions pallets/jobs/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = ();
type EraPayout = ();
type NextNewSession = Session;
type RolesHandler = Roles;
type MaxExposurePageSize = ConstU32<64>;
type MaxControllersInDeprecationBatch = ConstU32<100>;
type OffendingValidatorsThreshold = ();
Expand Down
Loading

0 comments on commit 6283512

Please sign in to comment.