Skip to content

Commit 7e9116a

Browse files
authored
Update conserveBalance account API (#56)
1 parent 722179c commit 7e9116a

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/PhEvm.sol

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,18 @@ interface PhEvm {
405405
returns (bool);
406406

407407
// ---------------------------------------------------------------
408-
// V2: Protection suite — supply conservation
408+
// V2: Protection suite — balance conservation
409409
// ---------------------------------------------------------------
410410

411-
/// @notice Checks that a token's totalSupply is unchanged between two forks.
411+
/// @notice Checks that an account's ERC20 balance is unchanged between two forks.
412412
/// @param fork0 The baseline fork.
413413
/// @param fork1 The comparison fork.
414414
/// @param token The ERC20 token address.
415-
/// @return True if totalSupply is identical at both forks.
416-
function conserveBalance(ForkId calldata fork0, ForkId calldata fork1, address token) external returns (bool);
415+
/// @param account The account whose balance should remain unchanged.
416+
/// @return True if balanceOf(account) is identical at both forks.
417+
function conserveBalance(ForkId calldata fork0, ForkId calldata fork1, address token, address account)
418+
external
419+
returns (bool);
417420

418421
// ---------------------------------------------------------------
419422
// V2: Protection suite — cumulative outflow circuit breaker

src/protection/vault/ERC4626AssetFlowAssertion.sol

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ import {ERC4626BaseAssertion} from "./ERC4626BaseAssertion.sol";
1818
/// - **Zero address never holds shares**: balanceOf(address(0)) == 0 after every
1919
/// share-minting operation.
2020
///
21-
/// - **Share supply conservation**: the vault's share token totalSupply is unchanged
22-
/// across operations that should only transfer tokens, not mint/burn them.
23-
/// Uses the V2 `conserveBalance` precompile.
2421
///
25-
/// @dev Uses V2 `registerTxEndTrigger` for tx-wide checks, `registerFnCallTrigger` +
26-
/// `ph.context()` for call-scoped checks, and `ph.conserveBalance()` for supply
27-
/// conservation verification.
22+
/// @dev Uses V2 `registerTxEndTrigger` for tx-wide checks and
23+
/// `registerFnCallTrigger` + `ph.context()` for call-scoped checks.
2824
abstract contract ERC4626AssetFlowAssertion is ERC4626BaseAssertion {
2925
/// @notice Register the default trigger set for asset-flow invariants.
3026
function _registerAssetFlowTriggers() internal view {

0 commit comments

Comments
 (0)