ReadableAccount.data returns slice (#16686)

* ReadAbleAccount.data returns slice

* more slice fixup

* more slice

* slice
This commit is contained in:
Jeff Washington (jwash)
2021-04-20 16:41:16 -05:00
committed by GitHub
parent 08d5253651
commit 03f7b251b8
5 changed files with 18 additions and 18 deletions

View File

@ -51,7 +51,7 @@ fn append_vec_sequential_read(bencher: &mut Bencher) {
println!("reading pos {} {}", sample, pos);
let (account, _next) = vec.get_account(pos).unwrap();
let (_meta, test) = create_test_account(sample);
assert_eq!(account.data, test.data().as_slice());
assert_eq!(account.data, test.data());
indexes.push((sample, pos));
});
}
@ -66,7 +66,7 @@ fn append_vec_random_read(bencher: &mut Bencher) {
let (sample, pos) = &indexes[random_index];
let (account, _next) = vec.get_account(*pos).unwrap();
let (_meta, test) = create_test_account(*sample);
assert_eq!(account.data, test.data().as_slice());
assert_eq!(account.data, test.data());
});
}
@ -95,7 +95,7 @@ fn append_vec_concurrent_append_read(bencher: &mut Bencher) {
let (sample, pos) = *indexes.lock().unwrap().get(random_index).unwrap();
let (account, _next) = vec.get_account(pos).unwrap();
let (_meta, test) = create_test_account(sample);
assert_eq!(account.data, test.data().as_slice());
assert_eq!(account.data, test.data());
});
}
@ -115,7 +115,7 @@ fn append_vec_concurrent_read_append(bencher: &mut Bencher) {
let (sample, pos) = *indexes1.lock().unwrap().get(random_index % len).unwrap();
let (account, _next) = vec1.get_account(pos).unwrap();
let (_meta, test) = create_test_account(sample);
assert_eq!(account.data, test.data().as_slice());
assert_eq!(account.data, test.data());
});
bencher.iter(|| {
let sample: usize = thread_rng().gen_range(0, 256);

View File

@ -520,7 +520,7 @@ impl<'a> InvokeContext for ThisInvokeContext<'a> {
result = self
.account_db
.load_with_fixed_root(self.ancestors, id)
.map(|(account, _)| Rc::new(account.data().clone()));
.map(|(account, _)| Rc::new(account.data().to_vec()));
// Cache it
self.sysvars.push((*id, result.clone()));
}
@ -919,7 +919,7 @@ impl MessageProcessor {
dst_keyed_account.try_account_ref_mut()?.owner = src_keyed_account.owner;
dst_keyed_account
.try_account_ref_mut()?
.set_data(src_keyed_account.data().clone());
.set_data(src_keyed_account.data().to_vec());
}
}
}

View File

@ -154,7 +154,7 @@ impl NativeLoader {
// still exists even after invoke_context.remove_first_keyed_account() is called
(
*program.unsigned_key(),
&program.try_account_ref()?.data().clone(),
&program.try_account_ref()?.data().to_vec(),
)
};