mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 14:41:11 +00:00
Rename con:aut to be in line with :code.
This commit is contained in:
@@ -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"[..]]));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user