-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Local/Shibuya v1 governance integration (#1260)
* v1 governance integration * Separate register & unregister origins for dApp staking * Init treasury integration * Treasury * Community council * Community treasury * Remove redundant function * Community proxy attempt * Rename * Missing box dep * Dummy weights * Tests * Fixes * Shibuya governance * Cargo * Zepter * dApp staking improvements * Align local * Remove TODOs * Extra UT * Formating * Benchmarks * clippy * fix tests * Integration tests setup * Basic governance integration tests * Finish integration tests * Review comment * Review comments * Benchmarks
- Loading branch information
Showing
31 changed files
with
3,660 additions
and
2,588 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[package] | ||
name = "pallet-collective-proxy" | ||
version = "0.1.0" | ||
description = "Proxy for collective calls." | ||
authors.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
|
||
[dependencies] | ||
frame-support = { workspace = true } | ||
frame-system = { workspace = true } | ||
log = { workspace = true } | ||
num-traits = { workspace = true } | ||
parity-scale-codec = { workspace = true } | ||
|
||
scale-info = { workspace = true } | ||
serde = { workspace = true } | ||
sp-core = { workspace = true } | ||
sp-io = { workspace = true } | ||
sp-runtime = { workspace = true } | ||
sp-std = { workspace = true } | ||
|
||
astar-primitives = { workspace = true } | ||
|
||
frame-benchmarking = { workspace = true, optional = true } | ||
|
||
[dev-dependencies] | ||
pallet-balances = { workspace = true } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"serde/std", | ||
"log/std", | ||
"parity-scale-codec/std", | ||
"astar-primitives/std", | ||
"scale-info/std", | ||
"num-traits/std", | ||
"sp-core/std", | ||
"sp-runtime/std", | ||
"sp-io/std", | ||
"sp-std/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"pallet-balances/std", | ||
"frame-benchmarking/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"sp-runtime/runtime-benchmarks", | ||
"astar-primitives/runtime-benchmarks", | ||
"frame-benchmarking/runtime-benchmarks", | ||
] | ||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
"astar-primitives/try-runtime", | ||
"frame-system/try-runtime", | ||
"sp-runtime/try-runtime", | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// This file is part of Astar. | ||
|
||
// Copyright (C) Stake Technologies Pte.Ltd. | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
// Astar is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Astar is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Astar. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
use super::*; | ||
|
||
use frame_benchmarking::v2::*; | ||
|
||
/// Assert that the last event equals the provided one. | ||
pub(super) fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) { | ||
frame_system::Pallet::<T>::assert_last_event(generic_event.into()); | ||
} | ||
|
||
#[benchmarks()] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
fn execute_call() { | ||
let origin = T::CollectiveProxy::try_successful_origin() | ||
.expect("Must succeed in order to run benchmarks."); | ||
|
||
// A bit dirty, but runtime should ensure to allow the `remark` call. | ||
let call: <T as Config>::RuntimeCall = | ||
frame_system::Call::<T>::remark { remark: vec![] }.into(); | ||
|
||
#[extrinsic_call] | ||
_(origin as T::RuntimeOrigin, Box::new(call)); | ||
|
||
assert_last_event::<T>(Event::<T>::CollectiveProxyExecuted { result: Ok(()) }.into()); | ||
} | ||
|
||
impl_benchmark_test_suite!( | ||
Pallet, | ||
crate::benchmarking::tests::new_test_ext(), | ||
crate::mock::Test, | ||
); | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::mock; | ||
use sp_io::TestExternalities; | ||
|
||
pub fn new_test_ext() -> TestExternalities { | ||
mock::ExtBuilder::build() | ||
} | ||
} |
Oops, something went wrong.