Skip to content

Commit 71d420a

Browse files
committed
[Fix] implement missing trait items
substrate#3868 grandpa substrate#6656 API changes of grandpa substrate#7103 balances
1 parent 600c51e commit 71d420a

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

runtime/src/lib.rs

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,24 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
1010

1111
pub use balances::Call as BalancesCall;
1212
pub use frame_support::{
13-
construct_runtime, parameter_types, traits::Randomness, weights::{
13+
construct_runtime, parameter_types, StorageValue,
14+
traits::{
15+
KeyOwnerProofSystem, Randomness,
16+
},
17+
weights::{
1418
Weight, IdentityFee, constants::RocksDbWeight,
15-
}, StorageValue,
19+
},
1620
};
1721
use grandpa::fg_primitives;
18-
use grandpa::AuthorityList as GrandpaAuthorityList;
22+
use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
1923
use hash256_std_hasher::Hash256StdHasher;
2024
use sha3::{Digest, Keccak256};
2125
use sp_api::impl_runtime_apis;
2226
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
23-
use sp_core::{Hasher, OpaqueMetadata};
27+
use sp_core::{crypto::KeyTypeId, Hasher, OpaqueMetadata};
2428
use sp_runtime::traits::{
25-
BlakeTwo256, Block as BlockT, IdentifyAccount, IdentityLookup, Saturating, Verify,
29+
BlakeTwo256, Block as BlockT, IdentifyAccount, IdentityLookup, NumberFor,
30+
Saturating, Verify,
2631
};
2732
#[cfg(any(feature = "std", test))]
2833
pub use sp_runtime::BuildStorage;
@@ -206,6 +211,19 @@ impl aura::Trait for Runtime {
206211

207212
impl grandpa::Trait for Runtime {
208213
type Event = Event;
214+
type Call = Call;
215+
216+
type KeyOwnerProofSystem = ();
217+
218+
type KeyOwnerProof =
219+
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
220+
221+
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
222+
KeyTypeId,
223+
GrandpaId,
224+
)>>::IdentificationTuple;
225+
226+
type HandleEquivocation = ();
209227
type WeightInfo = ();
210228
}
211229

@@ -223,9 +241,11 @@ impl timestamp::Trait for Runtime {
223241

224242
parameter_types! {
225243
pub const ExistentialDeposit: u128 = 500;
244+
pub const MaxLocks: u32 = 50;
226245
}
227246

228247
impl balances::Trait for Runtime {
248+
type MaxLocks = MaxLocks;
229249
/// The type for recording an account's balance.
230250
type Balance = Balance;
231251
/// The ubiquitous event type.
@@ -383,7 +403,7 @@ impl_runtime_apis! {
383403

384404
fn decode_session_keys(
385405
encoded: Vec<u8>,
386-
) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
406+
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
387407
opaque::SessionKeys::decode_into_raw_public_keys(&encoded)
388408
}
389409
}
@@ -392,5 +412,25 @@ impl_runtime_apis! {
392412
fn grandpa_authorities() -> GrandpaAuthorityList {
393413
Grandpa::grandpa_authorities()
394414
}
415+
416+
fn submit_report_equivocation_unsigned_extrinsic(
417+
_equivocation_proof: fg_primitives::EquivocationProof<
418+
<Block as BlockT>::Hash,
419+
NumberFor<Block>,
420+
>,
421+
_key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
422+
) -> Option<()> {
423+
None
424+
}
425+
426+
fn generate_key_ownership_proof(
427+
_set_id: fg_primitives::SetId,
428+
_authority_id: GrandpaId,
429+
) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {
430+
// NOTE: this is the only implementation possible since we've
431+
// defined our key owner proof type as a bottom type (i.e. a type
432+
// with no values).
433+
None
434+
}
395435
}
396436
}

0 commit comments

Comments
 (0)