-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into aleks-container-chains-disabled-offchain-w…
…orkers-check
- Loading branch information
Showing
31 changed files
with
3,724 additions
and
846 deletions.
There are no files selected for viewing
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,70 @@ | ||
name: Bridge e2e test | ||
|
||
on: | ||
workflow_run: | ||
workflows: [CI] | ||
branches: [master] | ||
types: [completed] | ||
|
||
jobs: | ||
e2e-bridge-test: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Check g++ | ||
id: setup_g_plusplus | ||
run: | | ||
g++ --version | ||
- name: Check protoc | ||
id: check_proto_c | ||
run: | | ||
protoc --version | ||
- name: Check jq | ||
id: check_jq | ||
run: | | ||
jq --version | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '^1.22.0' | ||
- name: Check go | ||
id: check_go | ||
run: | | ||
go version | ||
- name: Run Mage | ||
uses: magefile/mage-action@v3 | ||
with: | ||
install-only: true | ||
- name: Check mage | ||
id: check_mage | ||
run: | | ||
mage --version | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
- name: Check forge | ||
id: check_forge | ||
run: | | ||
forge --version | ||
- name: Pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 9 | ||
- name: Use Node.js 22.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22.x | ||
- name: Install yarn | ||
run: |- | ||
curl -fsSL --create-dirs -o $HOME/bin/yarn \ | ||
https://github.com/yarnpkg/yarn/releases/download/v1.22.22/yarn-1.22.22.js | ||
chmod +x $HOME/bin/yarn | ||
echo "$HOME/bin" >> $GITHUB_PATH | ||
- name: Check yarn | ||
id: check_yarn | ||
run: | | ||
yarn --version | ||
- name: Check date | ||
id: check_date | ||
run: | | ||
date --version |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[package] | ||
name = "pallet-external-validator-slashes" | ||
authors = { workspace = true } | ||
description = "External validator info slashes" | ||
edition = "2021" | ||
license = "GPL-3.0-only" | ||
version = "0.1.0" | ||
|
||
[package.metadata.docs.rs] | ||
targets = [ "x86_64-unknown-linux-gnu" ] | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
frame-benchmarking = { workspace = true, optional = true } | ||
frame-support = { workspace = true } | ||
frame-system = { workspace = true } | ||
log = { workspace = true } | ||
pallet-session = { workspace = true } | ||
pallet-staking = { workspace = true } | ||
parity-scale-codec = { workspace = true, features = [ "derive", "max-encoded-len" ] } | ||
scale-info = { workspace = true } | ||
sp-runtime = { workspace = true } | ||
sp-staking = { workspace = true } | ||
sp-std = { workspace = true } | ||
tp-traits = { workspace = true } | ||
|
||
[dev-dependencies] | ||
sp-core = { workspace = true } | ||
sp-io = { workspace = true } | ||
|
||
[features] | ||
default = [ "std" ] | ||
std = [ | ||
"frame-benchmarking/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"log/std", | ||
"pallet-session/std", | ||
"pallet-staking/std", | ||
"parity-scale-codec/std", | ||
"scale-info/std", | ||
"sp-core/std", | ||
"sp-io/std", | ||
"sp-runtime/std", | ||
"sp-staking/std", | ||
"sp-std/std", | ||
"tp-traits/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"pallet-staking/runtime-benchmarks", | ||
"scale-info/std", | ||
"sp-runtime/runtime-benchmarks", | ||
"sp-staking/runtime-benchmarks", | ||
"tp-traits/runtime-benchmarks", | ||
] | ||
|
||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
"frame-system/try-runtime", | ||
"pallet-session/try-runtime", | ||
"pallet-staking/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,95 @@ | ||
// Copyright (C) Moondance Labs Ltd. | ||
// This file is part of Tanssi. | ||
|
||
// Tanssi 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. | ||
|
||
// Tanssi 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 Tanssi. If not, see <http://www.gnu.org/licenses/> | ||
|
||
//! Benchmarking setup for pallet-external-validator-slashes | ||
use super::*; | ||
|
||
#[allow(unused)] | ||
use crate::Pallet as ExternalValidatorSlashes; | ||
use { | ||
frame_benchmarking::{v2::*, BenchmarkError}, | ||
frame_system::RawOrigin, | ||
pallet_session::{self as session}, | ||
sp_runtime::traits::TrailingZeroInput, | ||
sp_std::prelude::*, | ||
}; | ||
|
||
const MAX_SLASHES: u32 = 1000; | ||
|
||
#[allow(clippy::multiple_bound_locations)] | ||
#[benchmarks(where T: session::Config)] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
fn cancel_deferred_slash(s: Linear<1, MAX_SLASHES>) -> Result<(), BenchmarkError> { | ||
let mut existing_slashes = Vec::new(); | ||
let era = T::EraIndexProvider::active_era().index; | ||
let dummy = || T::AccountId::decode(&mut TrailingZeroInput::zeroes()).unwrap(); | ||
for _ in 0..MAX_SLASHES { | ||
existing_slashes.push(Slash::<T::AccountId, T::SlashId>::default_from(dummy())); | ||
} | ||
Slashes::<T>::insert( | ||
era.saturating_add(T::SlashDeferDuration::get()) | ||
.saturating_add(One::one()), | ||
&existing_slashes, | ||
); | ||
let slash_indices: Vec<u32> = (0..s).collect(); | ||
|
||
#[extrinsic_call] | ||
_( | ||
RawOrigin::Root, | ||
era.saturating_add(T::SlashDeferDuration::get()) | ||
.saturating_add(One::one()), | ||
slash_indices, | ||
); | ||
|
||
assert_eq!( | ||
Slashes::<T>::get( | ||
&era.saturating_add(T::SlashDeferDuration::get()) | ||
.saturating_add(One::one()) | ||
) | ||
.len(), | ||
(MAX_SLASHES - s) as usize | ||
); | ||
Ok(()) | ||
} | ||
|
||
#[benchmark] | ||
fn force_inject_slash() -> Result<(), BenchmarkError> { | ||
let era = T::EraIndexProvider::active_era().index; | ||
let dummy = || T::AccountId::decode(&mut TrailingZeroInput::zeroes()).unwrap(); | ||
#[extrinsic_call] | ||
_(RawOrigin::Root, era, dummy(), Perbill::from_percent(50)); | ||
|
||
assert_eq!( | ||
Slashes::<T>::get( | ||
&era.saturating_add(T::SlashDeferDuration::get()) | ||
.saturating_add(One::one()) | ||
) | ||
.len(), | ||
1_usize | ||
); | ||
Ok(()) | ||
} | ||
|
||
impl_benchmark_test_suite!( | ||
ExternalValidatorSlashes, | ||
crate::mock::new_test_ext(), | ||
crate::mock::Test, | ||
); | ||
} |
Oops, something went wrong.