diff --git a/programs/bpf/rust/noop/src/solana_sdk.rs b/programs/bpf/rust/noop/src/solana_sdk.rs index 82fac64abb..ec46865511 100644 --- a/programs/bpf/rust/noop/src/solana_sdk.rs +++ b/programs/bpf/rust/noop/src/solana_sdk.rs @@ -121,8 +121,8 @@ pub fn sol_log_params(ka: &[SolKeyedAccount], data: &[u8]) { sol_log_64(0, 0, 0, 0, k.is_signer as u64); sol_log("- Key"); sol_log_key(&k.key); - sol_log("- Tokens"); - sol_log_64(0, 0, 0, 0, k.tokens); + sol_log("- Lamports"); + sol_log_64(0, 0, 0, 0, k.lamports); sol_log("- Userdata"); sol_log_slice(k.userdata); sol_log("- Owner"); @@ -145,8 +145,8 @@ pub struct SolKeyedAccount<'a> { pub key: SolPubkey<'a>, /// Public key of the account pub is_signer: u64, - /// Number of tokens owned by this account - pub tokens: u64, + /// Number of lamports owned by this account + pub lamports: u64, /// On-chain data within this account pub userdata: &'a [u8], /// Program that owns this account @@ -193,10 +193,10 @@ pub extern "C" fn entrypoint(input: *mut u8) -> bool { let key = SolPubkey { key: &key_slice }; offset += SIZE_PUBKEY; - let tokens = unsafe { + let lamports = unsafe { #[allow(clippy::cast_ptr_alignment)] - let tokens_ptr: *const u64 = input.add(offset) as *const u64; - *tokens_ptr + let lamports_ptr: *const u64 = input.add(offset) as *const u64; + *lamports_ptr }; offset += size_of::(); @@ -217,7 +217,7 @@ pub extern "C" fn entrypoint(input: *mut u8) -> bool { let mut ka = [SolKeyedAccount { key, is_signer, - tokens, + lamports, userdata, owner, }]; @@ -385,7 +385,7 @@ mod tests { ]; assert_eq!(SIZE_PUBKEY, ka[0].key.key.len()); assert_eq!(key, ka[0].key.key); - assert_eq!(48, ka[0].tokens); + assert_eq!(48, ka[0].lamports); assert_eq!(1, ka[0].userdata.len()); let owner = [0; 32]; assert_eq!(SIZE_PUBKEY, ka[0].owner.key.len()); diff --git a/sdk/bpf/inc/solana_sdk.h b/sdk/bpf/inc/solana_sdk.h index 4cbe6a7686..9fda355d9b 100644 --- a/sdk/bpf/inc/solana_sdk.h +++ b/sdk/bpf/inc/solana_sdk.h @@ -112,7 +112,7 @@ SOL_FN_PREFIX bool SolPubkey_same(const SolPubkey *one, const SolPubkey *two) { typedef struct { SolPubkey *key; /** Public key of the account */ bool is_signer; /** Transaction was signed by this account's key */ - uint64_t *tokens; /** Number of tokens owned by this account */ + uint64_t *lamports; /** Number of lamports owned by this account */ uint64_t userdata_len; /** Length of data in bytes */ uint8_t *userdata; /** On-chain data within this account */ SolPubkey *owner; /** Program that owns this account */ @@ -209,7 +209,7 @@ typedef struct { * Use this function to deserialize the buffer passed to the program entrypoint * into usable types. This function does not perform copy deserialization, * instead it populates the pointers and lengths in SolKeyedAccount and data so - * that any modification to tokens or account data take place on the original + * that any modification to lamports or account data take place on the original * buffer. Doing so also eliminates the need to serialize back into the buffer * at program end. * @@ -238,8 +238,8 @@ SOL_FN_PREFIX bool sol_deserialize( params->ka[i].key = (SolPubkey *) input; input += sizeof(SolPubkey); - // tokens - params->ka[i].tokens = (uint64_t *) input; + // lamports + params->ka[i].lamports = (uint64_t *) input; input += sizeof(uint64_t); // account userdata @@ -311,8 +311,8 @@ SOL_FN_PREFIX void sol_log_params(const SolParameters *params) { sol_log_64(0, 0, 0, 0, params->ka[i].is_signer); sol_log(" - Key"); sol_log_key(params->ka[i].key); - sol_log(" - Tokens"); - sol_log_64(0, 0, 0, 0, *params->ka[i].tokens); + sol_log(" - Lamports"); + sol_log_64(0, 0, 0, 0, *params->ka[i].lamports); sol_log(" - Userdata"); sol_log_array(params->ka[i].userdata, params->ka[i].userdata_len); sol_log(" - Owner");