This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Decouple Staking and Election - Part 2 Unsigned Phase #7909
Merged
gavofyork
merged 42 commits into
master
from
kiz-election-provider-2-two-phase-unsigned
Feb 23, 2021
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
d998b12
Base features and traits.
kianenigma 5aea9cc
pallet and unsigned phase
kianenigma 632e107
Undo bad formattings.
kianenigma c52e65d
Master.into()
kianenigma b4fc5e1
some formatting cleanup.
kianenigma cc26881
Small self-cleanup.
kianenigma 67a9fae
Master.into()
kianenigma 75eca3f
Make it all build
kianenigma 8daec3a
self-review
kianenigma 49613ed
Some doc tests.
kianenigma 35f1faf
Some changes from other PR
kianenigma e01cacc
Fix session test
kianenigma 6278150
Merge branch 'master' into kiz-election-provider-2-two-phase-unsigned
shawntabrizi 4c516cb
Update Cargo.lock
shawntabrizi 8c8d1e6
Update frame/election-provider-multi-phase/src/lib.rs
kianenigma 4b58c91
Some review comments
kianenigma f4029aa
Merge branch 'kiz-election-provider-2-two-phase-unsigned' of github.c…
kianenigma f16ac88
Master.into()
kianenigma 528917e
Rename + make encode/decode
kianenigma 1a5794a
Do an assert as well, just in case.
kianenigma 01e63ed
Fix build
kianenigma 4ccecdf
Update frame/election-provider-multi-phase/src/unsigned.rs
kianenigma 83a789e
Las comment
kianenigma adb3618
Merge branch 'kiz-election-provider-2-two-phase-unsigned' of github.c…
kianenigma 7c71df0
fix staking fuzzer.
kianenigma 12b1640
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
6397d4a
Add one last layer of feasibility check as well.
kianenigma 80d3c31
Merge branch 'kiz-election-provider-2-two-phase-unsigned' of github.c…
kianenigma 7d6f6ad
Last fixes to benchmarks
kianenigma 2e28437
Some more docs.
kianenigma 5fda744
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
1ce6c8e
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
f63c5b8
Some nits
kianenigma 8029c01
Merge branch 'kiz-election-provider-2-two-phase-unsigned' of github.c…
kianenigma 70f4191
Merge remote-tracking branch 'origin/master' into kiz-election-provid…
701e4a2
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
ea531e1
Fix doc
kianenigma c2a3286
Upstream.into()
kianenigma 16fe4f7
Master.into()
kianenigma 2c6ac80
Mkae ci green
kianenigma 0bcc776
Merge branch 'master' of github.com:paritytech/substrate into kiz-ele…
kianenigma 9328b71
Master.into()
kianenigma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
cargo run --release --features=runtime-benchmarks --manifest-path=bin…
…/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs
- Loading branch information
There are no files selected for viewing
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI most of these reads are in the
predict_next_electionfrom staking's side... This is one of the aspects of this PR that I am still not super happy with and gladly accept calls to rethink it: how we predict when next election happens.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we do this every block, maybe we can do it better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but also, at some point, if they are read everyblock, we can consider them always in cache no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are read only by me afaik, so sadly I think they are not cached in any way.
Noting that we don't have any cache that caches stuff from this block to the next one right? it is only intra-block caching.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, but there can be a cache inter block, for reads, in
client/db/src/storage_cache.rsmaybe @cheme knows about it.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, 'client/db/src/storage_cache.rs' is caching between consecutive blocks, got reset if there is a reorg though, and it's lru with client specific size so can't really make expectation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember thinking on how to avoid redundant calculation between blocks, and thought of something like:
calculated_cached_value(cache_key, source: [storage_keys | storage_prefix], fn calculate(source)-> result) -> resultthat would either:But this would require new host function to access cache and invalidate on source storage access.
But tbh it is not very easy to implement and is only useful for costly computation.
But in case of costly computation we can also simply write the result in state and have the invalidate logic coded in the runtime. It is possibly less efficient but since it will behave the same between client, calculated weight can benefit from it.