@@ -48,4 +48,54 @@ contract EmergencyPauseTest is IntegrationBase {
4848 assertEq (rwaToken.balanceOf (alice), 0 , "no RWA while policy suspended " );
4949 assertEq (quote.balanceOf (alice), 1_000 ether, "no quote spent " );
5050 }
51+
52+ // A PROPOSED (registered but not yet operator-approved) manifest must be
53+ // rejected end-to-end: the engine's default-deny gate fails closed before any
54+ // recipe runs. Drive rwaToken back to PROPOSED via retire -> register
55+ // (deployStack left it ACTIVE and re-register over ACTIVE is illegal).
56+ function test_proposedPolicy_failsClosed () public {
57+ policyReg.retireManifest (address (rwaToken), bytes32 ("REISSUE " ));
58+ policyReg.registerManifest (address (rwaToken), _activeManifest (0 , 0 )); // PROPOSED, not approved
59+
60+ ExecutionRequest memory req = buildBuyRequest (alice, 50 ether, 50 ether);
61+ vm.prank (alice);
62+ vm.expectRevert (); // ComplianceRejected(reasonCode) — POLICY/PROPOSED
63+ router.execute (req);
64+
65+ assertEq (rwaToken.balanceOf (alice), 0 , "no RWA while policy only PROPOSED " );
66+ assertEq (quote.balanceOf (alice), 1_000 ether, "no quote spent " );
67+ }
68+
69+ // A RETIRED (terminal) manifest must be rejected end-to-end for the same
70+ // default-deny reason.
71+ function test_retiredPolicy_failsClosed () public {
72+ policyReg.retireManifest (address (rwaToken), bytes32 ("EOL " )); // ACTIVE -> RETIRED
73+
74+ ExecutionRequest memory req = buildBuyRequest (alice, 50 ether, 50 ether);
75+ vm.prank (alice);
76+ vm.expectRevert (); // ComplianceRejected(reasonCode) — POLICY/RETIRED
77+ router.execute (req);
78+
79+ assertEq (rwaToken.balanceOf (alice), 0 , "no RWA while policy RETIRED " );
80+ assertEq (quote.balanceOf (alice), 1_000 ether, "no quote spent " );
81+ }
82+
83+ // A suspension is reversible: after resume the token is ACTIVE again and a
84+ // trade that was blocked while SUSPENDED settles once more.
85+ function test_suspendThenResume_tradesAgain () public {
86+ // suspend → blocked.
87+ policyReg.suspendManifest (address (rwaToken), bytes32 ("EMERGENCY " ));
88+ ExecutionRequest memory blocked = buildBuyRequest (alice, 50 ether, 50 ether);
89+ vm.prank (alice);
90+ vm.expectRevert (); // ComplianceRejected — POLICY/SUSPENDED
91+ router.execute (blocked);
92+ assertEq (rwaToken.balanceOf (alice), 0 , "blocked while suspended " );
93+
94+ // resume → ACTIVE again → trade settles.
95+ policyReg.resumeManifest (address (rwaToken));
96+ ExecutionRequest memory ok = buildBuyRequest (alice, 50 ether, 50 ether);
97+ vm.prank (alice);
98+ router.execute (ok);
99+ assertEq (rwaToken.balanceOf (alice), 50 ether, "trade settles after resume " );
100+ }
51101}
0 commit comments