This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Conversation
gavofyork
reviewed
Jan 23, 2018
| impl<T: Copy + EndianSensitive + 'static> Slicable for T { | ||
| fn set_as_slice<F: FnOnce(&mut [u8]) -> bool>(fill_slice: F) -> Option<Self> { | ||
| let size = mem::size_of::<T>(); | ||
| let mut result: T = unsafe { mem::zeroed() }; |
Member
There was a problem hiding this comment.
why is this better? it's obvious that it'll be written to; looks like it's just an invitation for the compiler's optimiser to fail.
Contributor
Author
There was a problem hiding this comment.
reading from zeroed memory is allowed. reading from uninitialized memory is undefined behavior. "reading" in this case includes writing without using ptr::write, which the fill_slice closure is probably expected to do.
Member
There was a problem hiding this comment.
well, at least it'll likely be in L0 cache when the zeroes are being overwritten with the real data.
gavofyork
reviewed
Jan 23, 2018
| //! Conensus module for runtime; manages the authority set ready for the native code. | ||
|
|
||
| use runtime_support::Vec; | ||
| use runtime_support::vec::Vec; |
Member
There was a problem hiding this comment.
why not use runtime_support::prelude::*;?
gavofyork
reviewed
Jan 23, 2018
| //! consensus module. | ||
|
|
||
| use runtime_support::Vec; | ||
| use runtime_support::vec::Vec; |
gavofyork
reviewed
Jan 23, 2018
| //! Staking manager: Handles balances and periodically determines the best set of validators. | ||
|
|
||
| use runtime_support::Vec; | ||
| use runtime_support::vec::Vec; |
gavofyork
reviewed
Jan 23, 2018
| use primitives::{Block, BlockNumber, Hash, UncheckedTransaction, TxOrder, Hashable}; | ||
| use runtime_support::{Vec, swap}; | ||
| use runtime_support::mem; | ||
| use runtime_support::vec::Vec; |
gavofyork
reviewed
Jan 23, 2018
| //! Primitive types. | ||
|
|
||
| use runtime_support::Vec; | ||
| use runtime_support::vec::Vec; |
gavofyork
reviewed
Jan 23, 2018
| pub fn kill(key: &[u8]) { runtime_support::set_storage(&twox_128(key)[..], b""); } | ||
|
|
||
| impl<T: Default + Sized + EndianSensitive> Storable for T { | ||
| impl<T: Default + Copy + EndianSensitive + 'static> Storable for T { |
Member
There was a problem hiding this comment.
why not add to EndianSensitive directly?
Member
|
some comments. |
gavofyork
approved these changes
Jan 23, 2018
JoshOrndorff
referenced
this pull request
in moonbeam-foundation/substrate
Apr 21, 2021
Add command line arguments for logs limit
iStrike7
referenced
this pull request
in gasp-xyz/substrate
Aug 3, 2021
Co-authored-by: Dan Forbes <dan@danforbes.dev>
iStrike7
referenced
this pull request
in gasp-xyz/substrate
Aug 3, 2021
…ests_trello_91 Feature/enable outdated tests trello 91
liuchengxu
pushed a commit
to chainx-org/substrate
that referenced
this pull request
Aug 23, 2021
imstar15
pushed a commit
to imstar15/substrate
that referenced
this pull request
Jan 3, 2023
…evert-consider-hooks-and-runtime-upgrade-when-constructing-block Revert "dummy commit for revert-consider-hooks-and-runtime-upgrade-when-const…"
helin6
pushed a commit
to boolnetwork/substrate
that referenced
this pull request
Jul 25, 2023
- Use thiserror instead of derive_more - Format code - Fix clippy warnings - Add LICENSE_TEMPLATE Signed-off-by: koushiro <koushiro.cqx@gmail.com>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.