Rename con:aut to be in line with :code.

This commit is contained in:
Gav
2018-02-04 16:01:14 +01:00
parent 337027b179
commit b125f72774
6 changed files with 14 additions and 14 deletions
+7 -7
View File
@@ -152,10 +152,10 @@ pub trait Externalities {
/// Get the current set of authorities from storage.
fn authorities(&self) -> Result<Vec<&[u8]>, ExternalitiesError> {
(0..self.storage(b":aut:len")?.into_iter()
(0..self.storage(b":auth:len")?.into_iter()
.rev()
.fold(0, |acc, &i| (acc << 8) + (i as u32)))
.map(|i| self.storage(&to_keyed_vec(i, b":aut:".to_vec())))
.map(|i| self.storage(&to_keyed_vec(i, b":auth:".to_vec())))
.collect()
}
@@ -260,17 +260,17 @@ mod tests {
assert_eq!(ext.authorities(), Ok(vec![]));
ext.set_storage(b"con:aut:len".to_vec(), vec![0u8; 4]);
ext.set_storage(b":auth:len".to_vec(), vec![0u8; 4]);
assert_eq!(ext.authorities(), Ok(vec![]));
ext.set_storage(b"con:aut:len".to_vec(), vec![1u8, 0, 0, 0]);
ext.set_storage(b":auth:len".to_vec(), vec![1u8, 0, 0, 0]);
assert_eq!(ext.authorities(), Ok(vec![&[][..]]));
ext.set_storage(b"con:aut:\0\0\0\0".to_vec(), b"first".to_vec());
ext.set_storage(b":auth:\0\0\0\0".to_vec(), b"first".to_vec());
assert_eq!(ext.authorities(), Ok(vec![&b"first"[..]]));
ext.set_storage(b"con:aut:len".to_vec(), vec![2u8, 0, 0, 0]);
ext.set_storage(b"con:aut:\x01\0\0\0".to_vec(), b"second".to_vec());
ext.set_storage(b":auth:len".to_vec(), vec![2u8, 0, 0, 0]);
ext.set_storage(b":auth:\x01\0\0\0".to_vec(), b"second".to_vec());
assert_eq!(ext.authorities(), Ok(vec![&b"first"[..], &b"second"[..]]));
}