From d6c748ee0021d3ed127ead78e392f784e7643f13 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 5 Sep 2023 02:53:20 +0200 Subject: [PATCH] Add test to check EXPIRATION_ENTRY_SIZE --- soroban-env-host/tests/fees.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/soroban-env-host/tests/fees.rs b/soroban-env-host/tests/fees.rs index 9bef7d335..ff7211eef 100644 --- a/soroban-env-host/tests/fees.rs +++ b/soroban-env-host/tests/fees.rs @@ -1,8 +1,20 @@ -use soroban_env_host::fees::{ - compute_rent_fee, compute_transaction_resource_fee, compute_write_fee_per_1kb, - FeeConfiguration, LedgerEntryRentChange, RentFeeConfiguration, TransactionResources, - WriteFeeConfiguration, -}; +use soroban_env_common::xdr::{Hash, LedgerEntry, LedgerEntryData, LedgerEntryExt, WriteXdr}; +use soroban_env_host::fees::{compute_rent_fee, compute_transaction_resource_fee, compute_write_fee_per_1kb, EXPIRATION_ENTRY_SIZE, FeeConfiguration, LedgerEntryRentChange, RentFeeConfiguration, TransactionResources, WriteFeeConfiguration}; +use soroban_env_host::xdr::ExpirationEntry; + +#[test] +fn expiration_entry_size() { + let expiration_entry = LedgerEntry{ + last_modified_ledger_seq: 0, + data: LedgerEntryData::Expiration(ExpirationEntry{ + key_hash: Hash([0; 32]), + expiration_ledger_seq: 0, + }), + ext: LedgerEntryExt::V0, + }; + assert_eq!(EXPIRATION_ENTRY_SIZE, expiration_entry.to_xdr().unwrap().len() as u32) + +} #[test] fn resource_fee_computation() {