From b50a35863ec2c2f7c035680ab80e54f21b7bdb00 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Fri, 20 Mar 2026 09:15:39 +0000 Subject: [PATCH] [#39] Drain pending royalties before D2 empty-claim revert test The broadcast script's F5 (buy/sell) generates new royalties after D1 claims. When the revert script runs afterward, the deployer has unclaimed royalties, so the D2 empty-claim test passes for the wrong reason. Fix: drain any pending royalties first, then test the revert. Fixes #39 Co-Authored-By: Claude Opus 4.6 (1M context) --- script/E2ETestReverts.s.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script/E2ETestReverts.s.sol b/script/E2ETestReverts.s.sol index 7e5e3bf..0bfabba 100644 --- a/script/E2ETestReverts.s.sol +++ b/script/E2ETestReverts.s.sol @@ -36,6 +36,11 @@ contract E2ETestReverts is Script { // ===== Group D2: Empty royalty claim ===== console.log("--- Group D: Royalties (reverts) ---"); + // Drain any pending royalties first (F5 buy/sell may have generated new ones) + vm.prank(deployer); + try BOND.claimRoyalties(address(PL_TEST)) {} catch {} + + // Now the second claim should revert with NothingToClaim vm.prank(deployer); try BOND.claimRoyalties(address(PL_TEST)) { revert("D2: should have reverted on empty claim");