mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 17:07:56 +00:00
Update fixed-hash & uint utilities (#1078)
* [core/primitives] Update crunchy 0.1 => 0.2
* [core/primitives] Update fixed-hash 0.2 => 0.3.0-beta
* [core/primitives] Update `uint` 0.4 => 0.5.0-beta
* [core/state-machine] Fix errors emerged by fixed-hash update
* [core/state-db] Fix errors that emerged from fixed-hash update
* [core/sr-io] Fix errors that emerged from the fixed-hash update
* [core/trie] Fix errors emerged from fixed-hash updates
* [core/trie] Make use of new Hash::as_fixed_bytes_mut method in tests
* [core/sr-primitives] Fix errors emerged from updating fixed-hash
* [core/executor] Fix errors that emerged from fixed-hash update
* [core/test-runtime] Fix errors that emerged from updating fixed-hash
* [core/test-runtime] Fix an error that emerged from fixed-hash update
* [core/transaction-pool] Fix errors that emerged from updating fixed-hash
* Add From<u64> impl for hash types defined in core/primitives
* [core/client/db] Fix errors that emerged from fixed-hash update
* [core/{client/network/rpc}]: Fix errors emerged by fixed-hash update
* [node/{cli/executor/runtime}]: Fix errors emerged by updating fixed-hash
* [core/network]: Fix bug in parsing constant str
* Update Cargo.lock
- Add crunchy 0.2.1
- fixed-hash 0.2.2 => 0.3.0-beta.3
- Add static-assertions 0.2.5
- uint 0.4.1 => 0.5.0-beta.1
* [core/primitives]: Add fixed-hash/rustc-hex feature for FromStr impl
* [core/primitives] No longer provide From<u64> impl for hash types if byteorder support is not enabled
* [core/primitives] Revert to using From impl again in primitives tests
* [core/..] Fix some bugs that emerged by recent fixed-hash updates
* Update a bunch of Cargo.lock files
* [core/state-db] Re-add whitespace between attr and extern crate/mod
* [core/primitives] Fix bug in From<u64> impl for hash types using the wrong feature guard
This commit is contained in:
committed by
Bastian Köcher
parent
9072fce658
commit
660c747c51
@@ -357,7 +357,7 @@ struct StorageDb<Block: BlockT> {
|
||||
|
||||
impl<Block: BlockT> state_machine::Storage<Blake2Hasher> for StorageDb<Block> {
|
||||
fn get(&self, key: &H256) -> Result<Option<DBValue>, String> {
|
||||
self.state_db.get(&key.0.into(), self).map(|r| r.map(|v| DBValue::from_slice(&v)))
|
||||
self.state_db.get(key, self).map(|r| r.map(|v| DBValue::from_slice(&v)))
|
||||
.map_err(|e| format!("Database backend error: {:?}", e))
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ impl<Block: BlockT> state_db::HashDb for StorageDb<Block> {
|
||||
type Hash = H256;
|
||||
|
||||
fn get(&self, key: &H256) -> Result<Option<Vec<u8>>, Self::Error> {
|
||||
self.db.get(columns::STATE, &key[..]).map(|r| r.map(|v| v.to_vec()))
|
||||
self.db.get(columns::STATE, key.as_bytes()).map(|r| r.map(|v| v.to_vec()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,9 +734,9 @@ impl<Block> client::backend::Backend<Block, Blake2Hasher> for Backend<Block> whe
|
||||
let mut changeset: state_db::ChangeSet<H256> = state_db::ChangeSet::default();
|
||||
for (key, (val, rc)) in operation.updates.drain() {
|
||||
if rc > 0 {
|
||||
changeset.inserted.push((key.0.into(), val.to_vec()));
|
||||
changeset.inserted.push((key, val.to_vec()));
|
||||
} else if rc < 0 {
|
||||
changeset.deleted.push(key.0.into());
|
||||
changeset.deleted.push(key);
|
||||
}
|
||||
}
|
||||
let number_u64 = number.as_();
|
||||
@@ -1117,7 +1117,7 @@ mod tests {
|
||||
|
||||
backend.commit_operation(op).unwrap();
|
||||
|
||||
assert_eq!(backend.storage.db.get(::columns::STATE, &key.0[..]).unwrap().unwrap(), &b"hello"[..]);
|
||||
assert_eq!(backend.storage.db.get(::columns::STATE, key.as_bytes()).unwrap().unwrap(), &b"hello"[..]);
|
||||
hash
|
||||
};
|
||||
|
||||
@@ -1151,7 +1151,7 @@ mod tests {
|
||||
|
||||
backend.commit_operation(op).unwrap();
|
||||
|
||||
assert_eq!(backend.storage.db.get(::columns::STATE, &key.0[..]).unwrap().unwrap(), &b"hello"[..]);
|
||||
assert_eq!(backend.storage.db.get(::columns::STATE, key.as_bytes()).unwrap().unwrap(), &b"hello"[..]);
|
||||
hash
|
||||
};
|
||||
|
||||
@@ -1183,12 +1183,12 @@ mod tests {
|
||||
|
||||
backend.commit_operation(op).unwrap();
|
||||
|
||||
assert!(backend.storage.db.get(::columns::STATE, &key.0[..]).unwrap().is_none());
|
||||
assert!(backend.storage.db.get(::columns::STATE, key.as_bytes()).unwrap().is_none());
|
||||
}
|
||||
|
||||
backend.finalize_block(BlockId::Number(1)).unwrap();
|
||||
backend.finalize_block(BlockId::Number(2)).unwrap();
|
||||
assert!(backend.storage.db.get(::columns::STATE, &key.0[..]).unwrap().is_none());
|
||||
assert!(backend.storage.db.get(::columns::STATE, key.as_bytes()).unwrap().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user