Skip to content

Commit

Permalink
Add expiration write fee description.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmkozh committed Aug 21, 2023
1 parent 73c63e3 commit e7dc219
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/cap-0046-07.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ Rent fee has to be payed if operation increases the lifetime of the ledger entri

Rent fee is computed only at transaction application time and it depends on the state of the ledger entries before and after the transaction has been applied.

Fee: `Rent_fee = sum(rent_fee_per_entry_change(entry_before, entry_after))` for all the ledger entry changes.
Fee: `Rent_fee = sum(rent_fee_per_entry_change(entry_before, entry_after)) + expiration_write_fee` for all the ledger entry changes.

Entry rent fee consists of two components: fee for renting new ledgers with the new entry size and fee for renting the old ledgers with increased size. If `entry_before` does not exist, we treat its size as `0`` and expiration ledger as `0` for the sake of this formula.

Expand Down Expand Up @@ -410,6 +410,16 @@ rent_fee_for_size_and_ledgers(is_persistent, S, L) = round_up(

Settings values come from `StateExpirationSettings`.

Additionally, we charge for the `ExpirationEntry` writes of entries that had `expirationLedger` changed using the same rate as for any other entry write:

```
expiration_write_fee =
num_expiration_updates * feeWriteLedgerEntry +
round_up(write_fee_per_1kb(BucketListSize) * EXPIRATION_ENTRY_SIZE / 1024)
```

where `num_expiration_updates` is the number of ledger entries that had expiration ledger updated and `EXPIRATION_ENTRY_SIZE` is size of `ExpirationEntry` with its key and is set to `68` bytes.

Validity constraints: _None_

Apply-time enforcement: _None_
Expand Down

0 comments on commit e7dc219

Please sign in to comment.