Skip to content

SIMD 194: Deprecate rent exemption_threshold #1490

@holps-7

Description

@holps-7

Motivation

SIMD-0194 is now active on mainnet-beta at epoch 943

The kit SDK currently uses the old terminology (lamportsPerByteYear, exemptionThreshold) and should be updated.

The key changes proposed are:

  • lamports_per_byte_year → renamed to lamports_per_byte (rent is no longer time-based)
  • DEFAULT_LAMPORTS_PER_BYTE changed from 3480 to 6960 (doubled to absorb the threshold)
  • exemption_threshold set to 1.0 and deprecated from the protocol
  • Minimum balance formula simplified to (ACCOUNT_STORAGE_OVERHEAD + data_len) * lamports_per_byte

The absolute lamports required for rent exemption does not change — 3480 * 2 = 6960 * 1.

Example use case

After this change, the SysvarRent type uses the updated terminology:

import { fetchSysvarRent } from '@solana/sysvars';

const rent = await fetchSysvarRent(rpc);

// New field name (SIMD-0194)
console.log(rent.lamportsPerByte);   // 6960n (Lamports)

// Deprecated — still available for backward compatibility
console.log(rent.lamportsPerByteYear); // same value, marked @deprecated
console.log(rent.exemptionThreshold); // 1.0, marked @deprecated

Details

Affected packages and files

Package File Change
@solana/sysvars src/rent.ts Add lamportsPerByte to SysvarRent type; deprecate lamportsPerByteYear and exemptionThreshold; update codec field names
@solana/rpc-parsed-types src/sysvar-accounts.ts Add lamportsPerByte to JsonParsedRentAccount; deprecate old fields
@solana/rpc-graphql src/schema/type-defs/account.ts Add lamportsPerByte field to SysvarRentAccount GraphQL type
@solana/kit src/get-minimum-balance-for-rent-exemption.ts Update constants to DEFAULT_LAMPORTS_PER_BYTE: 6960n, remove threshold multiplier (already deprecated, produces same result)

Important considerations

  1. On-chain binary layout is unchanged (17 bytes) — The current Rust Rent struct still occupies the same byte positions:

    pub struct Rent {
        pub lamports_per_byte: u64,           // 8 bytes (renamed from lamports_per_byte_year)
        #[deprecated]
        pub exemption_threshold: [u8; 8],     // 8 bytes (was f64, now raw bytes — same size)
        #[deprecated]
        pub burn_percent: u8,                 // 1 byte
    }

    The exemption_threshold field was changed from f64 to [u8; 8] in the Rust source to avoid floating-point operations, but it still occupies the exact same 8-byte slot. The SDK stores the known f64 bit patterns as byte-array constants (1.0f64 = [0,0,0,0,0,0,240,63]). Our kit codec decoding it as f64 will continue to work correctly since the binary representation is identical.

  2. Backward compatibilitylamportsPerByteYear and exemptionThreshold should remain as @deprecated aliases so existing code continues to compile. They can be removed in the next major version.

  3. No functional change to lamports amounts128 * 3480 * 2 = 128 * 6960 * 1 = 890,880 lamports for a zero-data account. The local getMinimumBalanceForRentExemption function will return the same values.

Questions -

  • Should we rename lamportsPerByteYearlamportsPerByte as the primary field immediately, keeping the old name as a @deprecated alias or remove the deprecated field entirely?
  • Should exemptionThreshold be removed entirely now or in the next major version (v7)?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions