@@ -279,13 +279,13 @@ impl<'a> SlotHashes<Ref<'a, [u8]>> {
279279
280280#[ cfg( feature = "std" ) ]
281281impl SlotHashes < Box < [ u8 ] > > {
282- /// Allocates a buffer and fetches SlotHashes sysvar data via syscall .
282+ /// Fills the provided buffer with the full SlotHashes sysvar data.
283283 ///
284284 /// # Safety
285285 /// The caller must ensure the buffer pointer is valid for MAX_SIZE bytes.
286286 /// The syscall will write exactly MAX_SIZE bytes to the buffer.
287287 #[ inline( always) ]
288- unsafe fn fetch_into_buffer ( buffer_ptr : * mut u8 ) -> Result < ( ) , ProgramError > {
288+ unsafe fn fill_from_sysvar ( buffer_ptr : * mut u8 ) -> Result < ( ) , ProgramError > {
289289 crate :: sysvars:: get_sysvar_unchecked ( buffer_ptr, & SLOTHASHES_ID , 0 , MAX_SIZE ) ?;
290290
291291 // For tests on builds that don't actually fill the buffer.
@@ -308,7 +308,7 @@ impl SlotHashes<Box<[u8]>> {
308308 // fully initialise it before use.
309309 let mut data = Box :: new_uninit_slice ( MAX_SIZE ) ;
310310 unsafe {
311- Self :: fetch_into_buffer ( data. as_mut_ptr ( ) as * mut u8 ) ?;
311+ Self :: fill_from_sysvar ( data. as_mut_ptr ( ) as * mut u8 ) ?;
312312 Ok ( data. assume_init ( ) )
313313 }
314314 }
@@ -318,11 +318,11 @@ impl SlotHashes<Box<[u8]>> {
318318 let mut vec_buf: std:: vec:: Vec < u8 > = std:: vec:: Vec :: with_capacity ( MAX_SIZE ) ;
319319 unsafe {
320320 // SAFETY: `vec_buf` was allocated with capacity `MAX_SIZE` so its
321- // pointer is valid for exactly that many bytes. `fetch_into_buffer `
321+ // pointer is valid for exactly that many bytes. `fill_from_sysvar `
322322 // writes `MAX_SIZE` bytes, and we immediately set the length to
323323 // `MAX_SIZE`, marking the entire buffer as initialised before it is
324324 // turned into a boxed slice.
325- Self :: fetch_into_buffer ( vec_buf. as_mut_ptr ( ) ) ?;
325+ Self :: fill_from_sysvar ( vec_buf. as_mut_ptr ( ) ) ?;
326326 vec_buf. set_len ( MAX_SIZE ) ;
327327 }
328328 Ok ( vec_buf. into_boxed_slice ( ) )
0 commit comments