Fix fixed-hash#110
Conversation
…tant directly Signed-off-by: koushiro <koushiro.cqx@gmail.com>
|
It looks like @koushiro hasn't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement at the following URL: https://cla.parity.io Once you've signed, please reply to this thread with Many thanks, Parity Technologies CLA Bot |
|
[clabot:check] |
|
It looks like @koushiro signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
There was a problem hiding this comment.
Hey,
Technically this is added functionality but it should be backwards compatible right?
Lastly, please respect the .editorconfig and we are not using cargo fmt please revert that commit
EDIT:
Well const fns doesn't look to be stable anytime soon so I guess that this make sense. We should probably add a tracking issue for that
However, if we merge this and switch back it is a breaking change just saying.
This reverts commit 529720d. Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Robbepop
left a comment
There was a problem hiding this comment.
I like small PRs. Looks good to me and might help as long as there is no stable support for const-fn.
larsrh
left a comment
There was a problem hiding this comment.
Very much in favour of this. Without this change, the storage_keys! macro breaks.
Glad that you pointed this out! |
|
The way I'm working around this right now looks as follows: pub struct Key {
pub key: [u8; 32]
}
impl Key {
pub fn new(key: [u8; 32]) -> Key {
Key { key: key }
}
pub fn h256(&self) -> H256 {
H256::from(self.key)
}
}
#[macro_export]
macro_rules! storage_keys {
() => {};
($($name:ident),*) => {
storage_keys!(0u8, $($name),*);
};
($count:expr, $name:ident) => {
static $name: Key = Key { key: [$count, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] };
};
($count:expr, $name:ident, $($tail:ident),*) => {
static $name: Key = Key { key: [$count, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] };
storage_keys!($count + 1u8, $($tail),*);
};
}Essentially, I'm building my own key type for storage. |
|
I ll merge it as soon as CI is okay with it. |
|
@Robbepop travis windows is always broken and after they kicked out all people, it will probably never work. |
* master: Fix fixed-hash (#110) Update transaction-pool/src/error.rs tx-pool: I think I copied and pasted some spaces from somewhere tx-pool: remove more spaces tx-pool: where did those spaces come from tx-pool: make error generic over hash tx-pool: replace error-chain with vanilla error impl
Signed-off-by: koushiro koushiro.cqx@gmail.com
Fix the problem that the current version of
fixed-hashcannot be defined in constant directly.related issue link: #109