Conversation
… comments refactor(protocol): harmonize >= in recordDeposit; add invariants to balance updates; replace zero-health guard with explicit health assertion
…e BalanceDirection; remove dead deposit-capacity growth; keep debug logging enabled
…e existing entitlements
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
cadence/contracts/TidalProtocol.cdc
Outdated
There was a problem hiding this comment.
This comment only makes sense in the context of this PR. We should not have these types of comments in the code. If we're trying to add context for the reviewer, let's do that on GH PR, and not in SC comments
cadence/contracts/TidalProtocol.cdc
Outdated
There was a problem hiding this comment.
if default true here, i don't think it changes much. I think if this flag is how we're moving forward with debug logging, it should probably not be true by default.
cadence/contracts/TidalProtocol.cdc
Outdated
There was a problem hiding this comment.
so many unnecessary checks no? I feel like re-checking self.debug on every line is not providing anything.
…solidate failure logs; remove PR-specific comments
|
Addressed review feedback on TidalProtocol.cdc:
Changes pushed to review/dete-comments-audit. Please re-review. |
cadence/contracts/TidalProtocol.cdc
Outdated
There was a problem hiding this comment.
let's fix this issue similarly to how you fixed the other debug logs
There was a problem hiding this comment.
Consolidated at other places
35df16a to
b81b037
Compare
| // Skip the assertion only when a top-up was used in this call and the immediate | ||
| // post-withdrawal health is 0 (transitional state before top-up effects fully reflect). | ||
| let postHealth = self.positionHealth(pid: pid) | ||
| if !(usedTopUp && postHealth == 0) { |
There was a problem hiding this comment.
Currently, the cadence/tests/position_lifecycle_happy_test.cdc test fails on this assert, due to usedTopUp being false, even though postHealth is 0. Can we rethink why this might be the case?
does it matter that we didn't use the top up source here? or should we have attempted to use it anyways (and i guess likely have gotten 0?)
…d update phase0_pure_math_test.cdc to match new logic with added test for zero collateral positive debt case
|
The commit looks good, but can we double check why the coverage is so low? i would've expected most of the changes to have been covered by the existing tests |
…le; enable debug logs in tests; add governance parameters test; expose setDebugLogging(EGovernance)
…et codecov targets to auto
…st; test suite passes
… as collateral; make test deterministic
|
Added more governance tests and debugging logs enabled to improve coverage from 32 to 57% |
This PR addresses feedback from dete’s review (see PR #44: #44). Full triage and mapping are in PR_REVIEW_TRIAGE_dete.md in the repo.
Implemented
vaultType: Typein Deposited/Withdrawn; emit sites updated.>=; refine post-withdrawal health assertion to skip only when a top-up was used in the same call and immediate health is 0 (transitional).insuranceRate(default 0.001) with governance setter; add per-tokendepositLimitFraction(default 0.05) with governance setter;updateInterestRates()uses insuranceRate;depositLimit()= capacity * depositLimitFraction.debugLoggingflag and wrap verbose logs (default true).BalanceDirectionnear core types; add design notes on where/why 128-bit fixed-point is used vs UFix64 at boundaries; clarify comments for negative credit rate handling and deposit-limit rationale../run_tests.shpasses across the suite.Deferred / needs clarification (see PR_REVIEW_TRIAGE_dete.md)
recordDeposit/Withdrawalparams to UFix64 and reduceUInt128usage; evaluate future UFix128 migration when available. Added design notes now; type changes deliberately deferred.vaultTypefor off-chain viewing; make liquidation bonus configurable (discussion pending).Related Work: Liquidation mechanism branches
liquidationBonus, DEX guards, and execution/quoting paths. These map to several comments in PR DO NOT MERGE: A dummy PR to capture code review comments. #44 around liquidation bonuses, safety of liquidation flows, and explicit configurability.Scope notes
Links