Skip to content

Commit

Permalink
Fix issue with future
Browse files Browse the repository at this point in the history
  • Loading branch information
devdanco committed Jan 5, 2023
2 parents 756d3aa + a0a16a6 commit d81f776
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 11 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/mangata-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
name: CI

env:
TOOLCHAIN: nightly-2022-05-11
TOOLCHAIN: nightly-2022-09-19


jobs:
Expand All @@ -34,6 +34,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- name: Install ${{ env.TOOLCHAIN }}
uses: actions-rs/toolchain@v1
Expand All @@ -52,6 +56,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- name: Install ${{ env.TOOLCHAIN }}
uses: actions-rs/toolchain@v1
Expand Down
6 changes: 2 additions & 4 deletions client/consensus/slots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_INFO,
use sp_arithmetic::traits::BaseArithmetic;
use sp_consensus::{Proposal, Proposer, SelectChain, SyncOracle};
use sp_consensus_slots::{Slot, SlotDuration};
use sp_core::{crypto::key_types::AURA, sr25519, ShufflingSeed};
use sp_core::{sr25519, ShufflingSeed};
use sp_inherents::{CreateInherentDataProviders, InherentDataProvider};
use sp_keystore::{vrf, SyncCryptoStore, SyncCryptoStorePtr};
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, HashFor, Header as HeaderT},
};
use sp_timestamp::Timestamp;
use sp_ver::RandomSeedInherentDataProvider;
use std::{fmt::Debug, ops::Deref, time::{Duration, Instant}};

Expand Down Expand Up @@ -394,7 +392,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
let claim = self.claim_slot(&slot_info.chain_head, slot, &aux_data).await?;

let key = self.get_key(&claim);
inject_inherents(keystore, &key, &mut slot_info);
inject_inherents(keystore, &key, &mut slot_info).await.ok();

if self.should_backoff(slot, &slot_info.chain_head) {
return None
Expand Down
6 changes: 6 additions & 0 deletions frame/collective-mangata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ pub mod pallet {
/// - `P` storage mutations (codec `O(M)`) for updating the votes for each proposal
/// - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight((
T::WeightInfo::set_members(
*old_count, // M
Expand Down Expand Up @@ -462,6 +463,7 @@ pub mod pallet {
/// - DB: 1 read (codec `O(M)`) + DB access of `proposal`
/// - 1 event
/// # </weight>
#[pallet::call_index(1)]
#[pallet::weight((
T::WeightInfo::execute(
*length_bound, // B
Expand Down Expand Up @@ -532,6 +534,7 @@ pub mod pallet {
/// - 1 storage write `Voting` (codec `O(M)`)
/// - 1 event
/// # </weight>
#[pallet::call_index(2)]
#[pallet::weight((
if *threshold < 2 {
T::WeightInfo::propose_execute(
Expand Down Expand Up @@ -597,6 +600,7 @@ pub mod pallet {
/// - 1 storage mutation `Voting` (codec `O(M)`)
/// - 1 event
/// # </weight>
#[pallet::call_index(3)]
#[pallet::weight((T::WeightInfo::vote(T::MaxMembers::get()), DispatchClass::Operational))]
pub fn vote(
origin: OriginFor<T>,
Expand Down Expand Up @@ -650,6 +654,7 @@ pub mod pallet {
/// - any mutations done while executing `proposal` (`P1`)
/// - up to 3 events
/// # </weight>
#[pallet::call_index(4)]
#[pallet::weight((
{
let b = *length_bound;
Expand Down Expand Up @@ -690,6 +695,7 @@ pub mod pallet {
/// * Reads: Proposals
/// * Writes: Voting, Proposals, ProposalOf
/// # </weight>
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::disapprove_proposal(T::MaxProposals::get()))]
pub fn disapprove_proposal(
origin: OriginFor<T>,
Expand Down
2 changes: 1 addition & 1 deletion frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ mod tests {
use frame_system::{Call as SystemCall, ChainContext, LastRuntimeUpgradeInfo};
use pallet_balances::Call as BalancesCall;
use pallet_transaction_payment::CurrencyAdapter;
use sp_core::{crypto::key_types::AURA};
use sp_core::crypto::key_types::AURA;
use sp_keystore::{
vrf::{VRFTranscriptData, VRFTranscriptValue},
SyncCryptoStore,
Expand Down
4 changes: 4 additions & 0 deletions frame/sudo-mangata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub mod pallet {
/// - One DB write (event).
/// - Weight of derivative `call` execution + 10,000.
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight({
let dispatch_info = call.get_dispatch_info();
(dispatch_info.weight, dispatch_info.class)
Expand Down Expand Up @@ -184,6 +185,7 @@ pub mod pallet {
/// - O(1).
/// - The weight of this call is defined by the caller.
/// # </weight>
#[pallet::call_index(1)]
#[pallet::weight((*_weight, call.get_dispatch_info().class))]
pub fn sudo_unchecked_weight(
origin: OriginFor<T>,
Expand Down Expand Up @@ -218,6 +220,7 @@ pub mod pallet {
/// - Limited storage reads.
/// - One DB change.
/// # </weight>
#[pallet::call_index(2)]
#[pallet::weight(0)]
pub fn set_key(
origin: OriginFor<T>,
Expand Down Expand Up @@ -246,6 +249,7 @@ pub mod pallet {
/// - One DB write (event).
/// - Weight of derivative `call` execution + 10,000.
/// # </weight>
#[pallet::call_index(3)]
#[pallet::weight({
let dispatch_info = call.get_dispatch_info();
(
Expand Down
1 change: 1 addition & 0 deletions frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ pub mod pallet {
/// Persists list of encoded txs into the storage queue. There is an dedicated
/// check in [Executive](https://storage.googleapis.com/mangata-docs-node/frame_executive/struct.Executive.html) that verifies that passed binary data can be
/// decoded into extrinsics.
#[pallet::call_index(0)]
#[pallet::weight((
0,
DispatchClass::Mandatory
Expand Down
5 changes: 5 additions & 0 deletions frame/vesting-mangata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ pub mod pallet {
/// - Reads: Vesting Storage, Balances Locks, [Sender Account]
/// - Writes: Vesting Storage, Balances Locks, [Sender Account]
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::vest_locked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
.max(T::WeightInfo::vest_unlocked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES))
)]
Expand All @@ -317,6 +318,7 @@ pub mod pallet {
/// - Reads: Vesting Storage, Balances Locks, Target Account
/// - Writes: Vesting Storage, Balances Locks, Target Account
/// # </weight>
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::vest_other_locked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
.max(T::WeightInfo::vest_other_unlocked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES))
)]
Expand Down Expand Up @@ -348,6 +350,7 @@ pub mod pallet {
/// - Reads: Vesting Storage, Balances Locks, Target Account, Source Account
/// - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
/// # </weight>
#[pallet::call_index(2)]
#[pallet::weight(
T::WeightInfo::force_vested_transfer(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
)]
Expand Down Expand Up @@ -383,6 +386,7 @@ pub mod pallet {
///
/// - `schedule1_index`: index of the first schedule to merge.
/// - `schedule2_index`: index of the second schedule to merge.
#[pallet::call_index(3)]
#[pallet::weight(
T::WeightInfo::not_unlocking_merge_schedules(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
.max(T::WeightInfo::unlocking_merge_schedules(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES))
Expand Down Expand Up @@ -413,6 +417,7 @@ pub mod pallet {

// TODO
// Needs to be benchmarked
#[pallet::call_index(4)]
#[pallet::weight(400_000_000u64)]
pub fn sudo_unlock_all_vesting_tokens(
origin: OriginFor<T>,
Expand Down
7 changes: 2 additions & 5 deletions primitives/keystore/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,8 @@ impl SyncCryptoStore for KeyStore {
transcript_data: VRFTranscriptData,
) -> Result<Option<VRFSignature>, Error> {
let transcript = make_transcript(transcript_data);
let pair = if let Some(k) = self.sr25519_key_pair(key_type, public) {
k
} else {
return Ok(None)
};
let pair =
if let Some(k) = self.sr25519_key_pair(key_type, public) { k } else { return Ok(None) };

let (inout, proof, _) = pair.as_ref().vrf_sign(transcript);
Ok(Some(VRFSignature { output: inout.to_output(), proof }))
Expand Down

0 comments on commit d81f776

Please sign in to comment.