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

[subsystem-bench] Trigger own assignments in approval-voting #4772

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion polkadot/node/subsystem-bench/src/lib/approval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ use polkadot_node_subsystem_util::metrics::Metrics;
use polkadot_overseer::Handle as OverseerHandleReal;
use polkadot_primitives::{
BlockNumber, CandidateEvent, CandidateIndex, CandidateReceipt, Hash, Header, Slot,
ValidatorIndex,
ValidatorIndex, ASSIGNMENT_KEY_TYPE_ID,
};
use prometheus::Registry;
use sc_keystore::LocalKeystore;
use sc_service::SpawnTaskHandle;
use serde::{Deserialize, Serialize};
use sp_consensus_babe::Epoch as BabeEpoch;
use sp_core::H256;
use sp_keystore::Keystore;
use std::{
cmp::max,
collections::{HashMap, HashSet},
Expand Down Expand Up @@ -785,6 +786,12 @@ fn build_overseer(
let db: polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter<kvdb_memorydb::InMemory> =
polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter::new(db, &[]);
let keystore = LocalKeystore::in_memory();
keystore
.sr25519_generate_new(
ASSIGNMENT_KEY_TYPE_ID,
Some(state.test_authorities.key_seeds.get(NODE_UNDER_TEST as usize).unwrap().as_str()),
)
.unwrap();

let system_clock =
PastSystemClock::new(SystemClock {}, state.delta_tick_from_generated.clone());
Expand Down
11 changes: 10 additions & 1 deletion polkadot/node/subsystem-bench/src/lib/mock/runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use polkadot_node_subsystem_types::OverseerSignal;
use polkadot_primitives::{
node_features, AsyncBackingParams, CandidateEvent, CandidateReceipt, CoreState, GroupIndex,
GroupRotationInfo, IndexedVec, NodeFeatures, OccupiedCore, ScheduledCore, SessionIndex,
SessionInfo, ValidatorIndex,
SessionInfo, ValidationCode, ValidatorIndex,
};
use sp_consensus_babe::Epoch as BabeEpoch;
use sp_core::H256;
Expand Down Expand Up @@ -288,6 +288,15 @@ impl MockRuntimeApi {
};
tx.send(Ok((groups, group_rotation_info))).unwrap();
},
RuntimeApiMessage::Request(
_parent,
RuntimeApiRequest::ValidationCodeByHash(_, tx),
) => {
let validation_code = ValidationCode(Vec::new());
if let Err(err) = tx.send(Ok(Some(validation_code))) {
gum::error!(target: LOG_TARGET, ?err, "validation code wasn't received");
}
},
// Long term TODO: implement more as needed.
message => {
unimplemented!("Unexpected runtime-api message: {:?}", message)
Expand Down
Loading