In this track: Advanced security reasoning
advanced · 4 MIN READ

Liquidation edge cases

Price, collateral and rounding boundaries jointly determine eligibility.

LET’S PICTURE IT

A safety threshold must handle values immediately on either side of the line.

SEE IT FOR YOURSELF
The same native ether amount shown as ETH, Gwei and WeiETH1× 1 billionGWEI1000000000× 1 billionWEI1000000000000000000

1 ETH = 1000000000 Gwei = 1000000000000000000 Wei.

Same value · different units · native ether only

Write the eligibility formula

Identify collateral valuation, debt valuation and the liquidation threshold with their units. A variable name alone does not establish the exact inequality.

Check boundary rounding

Integer rounding can move an account across a threshold or alter the amount seized. Test values just below, at and just above the defined boundary.

Include oracle and asset assumptions

Stale prices, decimal mismatches and unusual token behavior can invalidate an otherwise plausible formula. Keep those assumptions in the local model.

Test partial and repeated actions

Partial liquidation, fees and remaining dust can affect later eligibility and solvency. Verify the invariant after a sequence, not just one full liquidation.

Work through the boundary

toy eligibility: debt value > allowed collateral value
check debt = limit - 1, limit, limit + 1
then test partial liquidation and rounding

A simplified local review scenario. The example establishes a question to test, not a guarantee of production safety.

QUICK CHECK · NO PRESSURE

Are exact-threshold tests useful even if typical cases pass?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.