Skip to content

[continuous fee] per borrower, remaining#470

Closed
adhusson wants to merge 137 commits into
mainfrom
feat/per-borrower-continuous-fee-remaining
Closed

[continuous fee] per borrower, remaining#470
adhusson wants to merge 137 commits into
mainfrom
feat/per-borrower-continuous-fee-remaining

Conversation

@adhusson

@adhusson adhusson commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

continuous fee implementation

  • per borrower
  • predictable face value
  • no fee after maturity

specs done

  • debt are never read before accrual
  • lastAccrual = 0 => pending=0

rest of verif wish list moved to #109

good summary of the tradeoffs here

@adhusson adhusson changed the title feat: stor remaining fee instead of average [continuous fee] per borrower, remaining Mar 6, 2026
@adhusson adhusson requested review from MathisGD, QGarchery and peyha March 6, 2026 17:01
Comment thread src/Midnight.sol Outdated
Comment thread src/Midnight.sol Outdated
Comment thread src/Midnight.sol
@MathisGD MathisGD mentioned this pull request Mar 7, 2026
@adhusson adhusson changed the base branch from feat/per-borrower-continuous-fee-average to main March 8, 2026 15:30
Comment thread src/Midnight.sol Outdated
Comment thread src/Midnight.sol Outdated
@MathisGD MathisGD mentioned this pull request Mar 9, 2026
Comment thread src/Midnight.sol Outdated
Comment thread src/Midnight.sol Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06bc9e2c80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread certora/specs/DebtAccrual.spec
Comment thread certora/specs/Liquidate.spec
Comment thread certora/confs/Midnight.conf
Comment thread src/Midnight.sol
Comment thread src/Midnight.sol Outdated
Position storage _position = position[id][user];
uint128 _userLossIndex = _position.lossIndex;
uint128 lossIndex = obligationState[id].lossIndex;
if (_userLossIndex == lossIndex) return _position.credit;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (_userLossIndex == lossIndex) return _position.credit;

would work similarly except if _userlossIndex=type(uint128.max) so it would feel cleaner to not do this check or to check ``_userlossIndex==type(uint128.max)` instead

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a problem in the spec when the implementation of creditAfterSlashing differs from slash: if the loss index and the user loss index are both at max, then slash reverts but creditAfterSlashing doesn't

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b05808ee7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/ContinuousFeeTest.sol Outdated
Comment thread test/ContinuousFeeTest.sol
Comment thread src/Midnight.sol Outdated
@adhusson

Copy link
Copy Markdown
Contributor Author

closing in favor of #547

@adhusson adhusson closed this Mar 20, 2026
Comment thread certora/specs/Midnight.spec
Comment thread certora/specs/OnlyAuthorizedCanChange.spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants