contracts: Add configurable per-storage item cost (#7819)

* Rework rent parameters

* No need for empty_pair_count any longer

* Parameterize runtime
This commit is contained in:
Alexander Theißen authored and GitHub committed 2021-01-06 15:47:22 +00:00
1 parent dd4625a1e7
commit a208da1d18
6 files changed
+103 -112

No files matched your search

@@ -116,12 +116,13 @@ where
// the subsistence threshold does not pay rent given a large enough subsistence
// threshold. But we need rent payments to occur in order to benchmark for worst cases.
let storage_size = ConfigCache::<T>::subsistence_threshold_uncached()
.checked_div(&T::RentDepositOffset::get())
.checked_div(&T::DepositPerStorageByte::get())
.unwrap_or_else(Zero::zero);
// Endowment should be large but not as large to inhibit rent payments.
let endowment = T::RentDepositOffset::get()
.saturating_mul(storage_size + T::StorageSizeOffset::get().into())
let endowment = T::DepositPerStorageByte::get()
.saturating_mul(storage_size)
.saturating_add(T::DepositPerContract::get())
.saturating_sub(1u32.into());
(storage_size, endowment)