Commit a92d2fb
Edward (Edwardbot)
fix(asset-leasing): settle last_rent_paid_ts on close_expired default path
The default branch of `close_expired` (lessee ghosted past end_ts, lessor
takes the collateral) previously left `last_rent_paid_ts` at whatever the
most recent `pay_rent` wrote, which could be strictly less than
`min(now, end_ts)`. The invariant `last_rent_paid_ts <= min(now, end_ts)`
held, but the stronger invariant 'timestamp points at the latest settled
instant' did not.
Bump `last_rent_paid_ts` via `update_last_paid_ts` on the `Active` branch.
Behaviour is unchanged (the lease account is closed in the same ix) but
future versions that want to split the collateral differently on default —
pro-rata rent, partial refund, haircut for unused time — can now trust
that everything up to `now` is already settled rather than having to
re-derive it.
No-op on the `Listed` branch: rent never started accruing there.
All 11 tests still pass.1 parent 29f5e00 commit a92d2fb
1 file changed
Lines changed: 21 additions & 1 deletion
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
155 | 175 | | |
156 | 176 | | |
157 | 177 | | |
| |||
0 commit comments