The Default trait implementation for Rent sysvar differs from solana-program
In pinocchio, the Rent sysvar has a Default trait implementation automatically generated via a derive macro.
#[repr(C)]
#[derive(Clone, Debug, Default)]
pub struct Rent {
/// Rental rate in lamports per byte-year
pub lamports_per_byte_year: u64,
/// Exemption threshold in years
pub exemption_threshold: f64,
/// Burn percentage
pub burn_percent: u8,
}If one were to instantiate the Rent sysvar via its default implementation, all fields would be set to their default values — in this case, 0.
However, the Rent sysvar's Default implementation is defined in solana-program (actually solana-rent) in the following way:
pub const DEFAULT_LAMPORTS_PER_BYTE_YEAR: u64 = 1_000_000_000 / 100 * 365 / (1024 * 1024);
pub const DEFAULT_EXEMPTION_THRESHOLD: f64 = 2.0;
pub const DEFAULT_BURN_PERCENT: u8 = 50;
impl Default for Rent {
fn default() -> Self {
Self {
lamports_per_byte_year: DEFAULT_LAMPORTS_PER_BYTE_YEAR,
exemption_threshold: DEFAULT_EXEMPTION_THRESHOLD,
burn_percent: DEFAULT_BURN_PERCENT,
}
}
}These are nonzero figures, meaning that the expression Rent::default() differs in behavior between pinocchio and the existing crates.