From 53196ad423b4eb6cd9087447c445a849ca33ac11 Mon Sep 17 00:00:00 2001 From: Eric Shenghsiung Liu Date: Mon, 1 Jun 2026 20:55:09 -0400 Subject: [PATCH] fix(test): include REDEEM_SENDER_POLICY in _isKnownPolicyType and _knownPolicyType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit B20Test now deploys a security-variant token (since #115 removed the Default variant). MockB20Security overrides _readPolicyId/_writePolicyId to also handle REDEEM_SENDER_POLICY, so fuzz inputs hitting that scope no longer revert with UnsupportedPolicyType — breaking test_updatePolicy_revert_unsupportedPolicyType. Extend both helpers to cover all 5 policy types the security token supports. --- test/lib/B20Test.sol | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/lib/B20Test.sol b/test/lib/B20Test.sol index 4e8c654..70e1e3c 100644 --- a/test/lib/B20Test.sol +++ b/test/lib/B20Test.sol @@ -134,20 +134,22 @@ contract B20Test is B20FactoryTest { /// extends the codomain (e.g. a Security test that also /// covers `REDEEM_SENDER_POLICY`). function _knownPolicyType(uint8 idx) internal pure returns (bytes32) { - uint8 i = idx % 4; + uint8 i = idx % 5; if (i == 0) return B20Constants.TRANSFER_SENDER_POLICY; if (i == 1) return B20Constants.TRANSFER_RECEIVER_POLICY; if (i == 2) return B20Constants.TRANSFER_EXECUTOR_POLICY; - return B20Constants.MINT_RECEIVER_POLICY; + if (i == 3) return B20Constants.MINT_RECEIVER_POLICY; + return keccak256("REDEEM_SENDER_POLICY"); } - /// @notice True iff `policyType` is one of the four base-token - /// supported policy types. Used by tests that fuzz arbitrary - /// `bytes32` and need to filter to the supported / unsupported - /// partition. + /// @notice True iff `policyType` is one of the five policy types + /// supported by the security-variant token deployed in setUp. + /// Used by tests that fuzz arbitrary `bytes32` and need to + /// filter to the supported / unsupported partition. function _isKnownPolicyType(bytes32 policyType) internal pure returns (bool) { return policyType == B20Constants.TRANSFER_SENDER_POLICY || policyType == B20Constants.TRANSFER_RECEIVER_POLICY - || policyType == B20Constants.TRANSFER_EXECUTOR_POLICY || policyType == B20Constants.MINT_RECEIVER_POLICY; + || policyType == B20Constants.TRANSFER_EXECUTOR_POLICY || policyType == B20Constants.MINT_RECEIVER_POLICY + || policyType == keccak256("REDEEM_SENDER_POLICY"); } /// @notice Pauses a single `PausableFeature`, lazily granting `PAUSE_ROLE`