File tree Expand file tree Collapse file tree 2 files changed +13
-27
lines changed
sdk/pinocchio/src/sysvars/slot_hashes Expand file tree Collapse file tree 2 files changed +13
-27
lines changed Original file line number Diff line number Diff line change @@ -25,31 +25,17 @@ fn test_from_account_info_constructor() {
2525 #[ allow( unused_assignments) ]
2626 let mut acct_ptr: * mut Account = core:: ptr:: null_mut ( ) ;
2727
28- #[ repr( C ) ]
29- #[ derive( Clone , Copy , Default ) ]
30- struct FakeAccount {
31- borrow_state : u8 ,
32- is_signer : u8 ,
33- is_writable : u8 ,
34- executable : u8 ,
35- resize_delta : i32 ,
36- key : Pubkey ,
37- owner : Pubkey ,
38- lamports : u64 ,
39- data_len : u64 ,
40- }
41-
4228 unsafe {
43- let header_size = core:: mem:: size_of :: < FakeAccount > ( ) ;
29+ let header_size = core:: mem:: size_of :: < AccountLayout > ( ) ;
4430 let total_size = header_size + data. len ( ) ;
4531 let word_len = ( total_size + 7 ) / 8 ;
4632 aligned_backing = std:: vec![ 0u64 ; word_len] ;
4733 let base_ptr = aligned_backing. as_mut_ptr ( ) as * mut u8 ;
4834
49- let header_ptr = base_ptr as * mut FakeAccount ;
35+ let header_ptr = base_ptr as * mut AccountLayout ;
5036 ptr:: write (
5137 header_ptr,
52- FakeAccount {
38+ AccountLayout {
5339 borrow_state : crate :: NON_DUP_MARKER ,
5440 is_signer : 0 ,
5541 is_writable : 0 ,
Original file line number Diff line number Diff line change @@ -14,16 +14,16 @@ use std::vec::Vec;
1414/// use of them in tests.
1515#[ repr( C ) ]
1616#[ derive( Clone , Copy ) ]
17- struct AccountLayout {
18- borrow_state : u8 ,
19- is_signer : u8 ,
20- is_writable : u8 ,
21- executable : u8 ,
22- resize_delta : i32 ,
23- key : Pubkey ,
24- owner : Pubkey ,
25- lamports : u64 ,
26- data_len : u64 ,
17+ pub struct AccountLayout {
18+ pub borrow_state : u8 ,
19+ pub is_signer : u8 ,
20+ pub is_writable : u8 ,
21+ pub executable : u8 ,
22+ pub resize_delta : i32 ,
23+ pub key : Pubkey ,
24+ pub owner : Pubkey ,
25+ pub lamports : u64 ,
26+ pub data_len : u64 ,
2727}
2828
2929/// Strategy that decides how much the slot number is decremented between
You can’t perform that action at this time.
0 commit comments