Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Use a better data structure for SignedSubmissions instead of Vec #8933

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
14fcad9
Remove: (#8748)
kpp May 27, 2021
27cc30e
CI: fix simnet trigger (#8927)
TriplEight May 27, 2021
925f170
More sc-service config reexports (#8887)
MOZGIII May 27, 2021
426d57b
Fix check runtime CI (#8930)
athei May 28, 2021
c2ec5bc
Bump parity-wasm and pwasm-utils to the newest versions everywhere (#…
athei May 28, 2021
1d03d4e
BROKEN: convert SignedSubmissions to BoundedBTreeSet
coriolinus May 28, 2021
050e4ac
Simple `MaxBoundedLen` Implementations (#8793)
shawntabrizi May 28, 2021
6a63f28
remove duplicate Issued/Burned events (#8935)
joepetrowski May 28, 2021
4b99c7f
weather -> whether (#8938)
semuelle May 28, 2021
ac277db
make remote ext use batch ws-client (#8916)
kianenigma May 29, 2021
6aaa031
Make `Schedule` fields public to allow for customization (#8924)
athei May 29, 2021
be1b8ef
Session key should be settable at genesis even for non-endowed accoun…
gavofyork May 29, 2021
88021e9
Migrate pallet-scored-pool to pallet attribute macro (#8825)
shaunxw May 31, 2021
87e63fa
Bump retain_mut from 0.1.2 to 0.1.3 (#8951)
dependabot[bot] May 31, 2021
7209f7c
Merge remote-tracking branch 'origin/kiz-election-provider-3-signed-p…
coriolinus May 31, 2021
61aa8dc
Use correct CreateInherentDataProviders impl for manual seal (#8852)
May 31, 2021
fc29e14
Refactor code a little bit (#8932)
kpp May 31, 2021
6d43761
Optimize `next_storage_key` (#8956)
bkchr May 31, 2021
2538839
Add deserialize for TransactionValidityError in std. (#8961)
kianenigma May 31, 2021
7ba4e4c
Bump getrandom from 0.2.2 to 0.2.3 (#8952)
dependabot[bot] May 31, 2021
da051b1
Allow usage of path in construct_runtime! (#8801)
KiChjang Jun 1, 2021
f87609a
Reduce cargo doc warnings (#8947)
gilescope Jun 1, 2021
5ceb0b0
Update wasmtime to 0.27 (#8913)
pepyakin Jun 1, 2021
e1d93fb
Spellling corrections (no code changes) (#8971)
gilescope Jun 1, 2021
04aa0e9
Dependabot use correct label (#8973)
bkchr Jun 1, 2021
408e803
Inject hashed prefix for remote-ext (#8960)
kianenigma Jun 1, 2021
bfef07c
Use `SpawnTaskHandle`s for spawning tasks in the tx pool (#8958)
expenses Jun 1, 2021
24750ea
Do not spend time on verifying the signatures before calling Runtime …
pepyakin Jun 1, 2021
fa23b18
Revert "Use `SpawnTaskHandle`s for spawning tasks in the tx pool (#8…
expenses Jun 1, 2021
d8b3fce
Uniques: An economically-secure basic-featured NFT pallet (#8813)
gavofyork Jun 1, 2021
45f1630
Update WeakBoundedVec's remove and swap_remove (#8985)
Jun 1, 2021
9f621a9
Convert another instance of Into impl to From in the macros (#8986)
MOZGIII Jun 1, 2021
4652f9e
also fix bounded vec (#8987)
shawntabrizi Jun 2, 2021
b2cdfe8
fix most compiler errors
coriolinus Jun 2, 2021
dcf24c7
extract type SignedSubmissionsOf<T>
coriolinus Jun 2, 2021
33e6e45
impl Decode bounds on BoundedBTreeMap/Set on T, not predecessor
coriolinus Jun 2, 2021
1990b81
fix recursive trait bound problem
coriolinus Jun 2, 2021
a8069e5
minor fixes
coriolinus Jun 2, 2021
d961e2f
more little fixes
coriolinus Jun 2, 2021
1ab8cf2
correct semantics for try_insert
coriolinus Jun 2, 2021
d5724a2
more fixes
coriolinus Jun 2, 2021
9b4f143
derive Ord for SolutionType
coriolinus Jun 2, 2021
997a469
tests compile
coriolinus Jun 2, 2021
35277ea
fix most tests, rm unnecessary one
coriolinus Jun 2, 2021
538b15f
Transactionpool: Make `ready_at` return earlier (#8995)
bkchr Jun 2, 2021
437c838
Discard notifications if we have failed to parse handshake (#8806)
tomaka Jun 2, 2021
94679eb
Migrate pallet-democracy to pallet attribute macro (#8824)
shaunxw Jun 3, 2021
48aea1b
Add ecdsa::Pair::verify_prehashed() (#8996)
adoerr Jun 3, 2021
b14fdf5
Non-fungible token traits (#8993)
gavofyork Jun 3, 2021
2562dda
Removes unused import (#9007)
0x7CFE Jun 3, 2021
d6e4db6
Add Call Filter That Prevents Nested `batch_all` (#9009)
shawntabrizi Jun 3, 2021
ea5d357
Transaction pool: Ensure that we prune transactions properly (#8963)
bkchr Jun 3, 2021
a57bc44
Storage chain: Runtime module (#8624)
arkpar Jun 4, 2021
7d8a9b6
more useful error message (#9014)
ordian Jun 4, 2021
0495ead
Named reserve (#7778)
xlc Jun 4, 2021
e98aca3
update ss58 type to u16 (#8955)
jak-pan Jun 4, 2021
d27dea9
Fixed build (#9021)
arkpar Jun 4, 2021
2cff60c
Bump parity-db (#9024)
adoerr Jun 4, 2021
37bb3ae
consensus: handle justification sync for blocks authored locally (#8698)
andresilva Jun 4, 2021
24a92c3
arithmetic: fix PerThing pow (#9030)
andresilva Jun 6, 2021
1085a90
Compact proof utilities in sp_trie. (#8574)
cheme Jun 7, 2021
1fa8cf7
Don't inlucde nominaotrs that back no one in the snapshot. (#9017)
kianenigma Jun 7, 2021
a8e3f36
fix all_in_one test which had a logic error
coriolinus Jun 7, 2021
8190214
use sp_std, not std
coriolinus Jun 7, 2021
5d89967
Periodically call `Peerset::alloc_slots` on all sets (#9025)
tomaka Jun 7, 2021
fa26ce6
contracts: Add new `seal_call` that offers new features (#8909)
athei Jun 7, 2021
d089179
fix unreserve_all_named (#9042)
xlc Jun 8, 2021
0af6df5
Delete legacy runtime metadata macros (#9043)
ascjones Jun 8, 2021
0a2472d
`rpc-http-threads` cli arg (#8890)
tgmichel Jun 8, 2021
4ec3a3a
allow inserting equal items into bounded map/set
coriolinus Jun 8, 2021
3d7dc0b
refactor: only load one solution at a time
coriolinus Jun 8, 2021
07a1af3
Emit `Bonded` event when rebonding (#9040)
shawntabrizi Jun 8, 2021
dae31f2
fix tests
coriolinus Jun 8, 2021
de92b1e
Merge remote-tracking branch 'origin/master' into prgn-election-provi…
coriolinus Jun 8, 2021
95d7324
Revert "Merge remote-tracking branch 'origin/master' into prgn-electi…
coriolinus Jun 8, 2021
e614849
Merge remote-tracking branch 'origin/kiz-election-provider-3-signed-p…
coriolinus Jun 8, 2021
847b98c
only derive debug when std
coriolinus Jun 8, 2021
5b2a7c5
write after check
coriolinus Jun 8, 2021
7f4a837
SignedSubmissions doesn't ever modify storage until .put()
coriolinus Jun 9, 2021
3317a4b
REVERT ME: demo that Drop impl doesn't work
coriolinus Jun 9, 2021
8313f58
Revert "REVERT ME: demo that Drop impl doesn't work"
coriolinus Jun 9, 2021
58c96b4
doc note about decode_len
coriolinus Jun 14, 2021
9388c2c
rename get_submission, take_submission for clarity
coriolinus Jun 17, 2021
a8e0441
add test which fails for current incorrect behavior
coriolinus Jun 17, 2021
7dfc184
inline fn insert_submission
coriolinus Jun 17, 2021
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
10 changes: 7 additions & 3 deletions frame/election-provider-multi-phase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ pub use pallet::*;
#[frame_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_support::{pallet_prelude::*, storage::bounded_btree_set::BoundedBTreeSet};
use frame_system::pallet_prelude::*;

#[pallet::config]
Expand Down Expand Up @@ -562,6 +562,7 @@ pub mod pallet {
/// Maximum number of signed submissions that can be queued.
#[pallet::constant]
type SignedMaxSubmissions: Get<u32>;

/// Maximum weight of a signed solution.
///
/// This should probably be similar to [`Config::MinerMaxWeight`].
Expand Down Expand Up @@ -1039,12 +1040,15 @@ pub mod pallet {
#[pallet::getter(fn snapshot_metadata)]
pub type SnapshotMetadata<T: Config> = StorageValue<_, SolutionOrSnapshotSize>;

/// Sorted (worse -> best) list of unchecked, signed solutions.
/// Sorted set of unchecked, signed solutions.
#[pallet::storage]
#[pallet::getter(fn signed_submissions)]
pub type SignedSubmissions<T: Config> = StorageValue<
_,
Vec<SignedSubmission<T::AccountId, BalanceOf<T>, CompactOf<T>>>,
BoundedBTreeSet<
SignedSubmission<T::AccountId, BalanceOf<T>, CompactOf<T>>,
T::SignedMaxSubmissions,
>,
ValueQuery,
>;

Expand Down
36 changes: 33 additions & 3 deletions frame/election-provider-multi-phase/src/signed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,42 @@ pub struct SignedSubmission<AccountId, Balance: HasCompact, CompactSolution> {
pub solution: RawSolution<CompactSolution>,
}

pub(crate) type BalanceOf<T> =
impl<AccountId, Balance, CompactSolution> Ord
for SignedSubmission<AccountId, Balance, CompactSolution>
where
AccountId: Ord,
Balance: Ord + HasCompact,
CompactSolution: Ord,
{
fn cmp(&self, other: &Self) -> Ordering {
self.solution
.score
.cmp(&other.solution.score)
.and_then(|| self.solution.cmp(&other.solution))
.and_then(|| self.deposit.cmp(&other.deposit))
.and_then(|| self.reward.cmp(&other.reward))
.and_then(|| self.who.cmp(&other.who))
}
}

impl<AccountId, Balance, CompactSolution> PartialOrd
for SignedSubmission<AccountId, Balance, CompactSolution>
where
AccountId: Ord,
Balance: Ord + HasCompact,
CompactSolution: Ord,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}

pub type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
pub(crate) type PositiveImbalanceOf<T> = <<T as Config>::Currency as Currency<
pub type PositiveImbalanceOf<T> = <<T as Config>::Currency as Currency<
<T as frame_system::Config>::AccountId,
>>::PositiveImbalance;
pub(crate) type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<
pub type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<
<T as frame_system::Config>::AccountId,
>>::NegativeImbalance;

Expand Down