interfaceFee Incorrectly converted uint40 when stored
The `interfaceFee.amount` is currently defined as `uint48` , with a maximum value of approximately `281m`. However, it is incorrectly converted to `uint40` when saved, `uint40(UFixed6.unwrap(newValue.interfaceFee.amount))`, which means the maximum value can only be approximately `1.1M`. If a user sets an order where `interfaceFee.amount` is greater than `1.1M`, the order can be saved successfully but the actual stored value may be truncated to `0`. This is not what the user expects, and the user may think that the order has been set, but in reality, it is an incorrect order. Although a fee of `1.1M` is large, it is not impossible.\\n`interfaceFee.amount` is defined as `uint48` the legality check also uses `type(uint48).max`, but `uint40` is used when saving.\\n```\\nstruct StoredTriggerOrder {\\n    /* slot 0 */\\n    uint8 side;                // 0 = maker, 1 = long, 2 = short, 3 = collateral\\n    int8 comparison;           // -2 = lt, -1 = lte, 0 = eq, 1 = gte, 2 = gt\\n    uint64 fee;                // <= 18.44tb\\n    int64 price;               // <= 9.22t\\n    int64 delta;               // <= 9.22t\\n  uint48 interfaceFeeAmount; // <= 281m\\n\\n    /* slot 1 */\\n    address interfaceFeeReceiver;\\n    bool interfaceFeeUnwrap;\\n    bytes11 __unallocated0__;\\n}\\n\\nlibrary TriggerOrderLib {\\n    function store(TriggerOrderStorage storage self, TriggerOrder memory newValue) internal {\\n        if (newValue.side > type(uint8).max) revert TriggerOrderStorageInvalidError();\\n        if (newValue.comparison > type(int8).max) revert TriggerOrderStorageInvalidError();\\n        if (newValue.comparison < type(int8).min) revert TriggerOrderStorageInvalidError();\\n        if (newValue.fee.gt(UFixed6.wrap(type(uint64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.price.gt(Fixed6.wrap(type(int64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.price.lt(Fixed6.wrap(type(int64).min))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.delta.gt(Fixed6.wrap(type(int64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.delta.lt(Fixed6.wrap(type(int64).min))) revert TriggerOrderStorageInvalidError();\\n      if (newValue.interfaceFee.amount.gt(UFixed6.wrap(type(uint48).max))) revert TriggerOrderStorageInvalidError();\\n\\n        self.value = StoredTriggerOrder(\\n            uint8(newValue.side),\\n            int8(newValue.comparison),\\n            uint64(UFixed6.unwrap(newValue.fee)),\\n            int64(Fixed6.unwrap(newValue.price)),\\n            int64(Fixed6.unwrap(newValue.delta)),\\n          uint40(UFixed6.unwrap(newValue.interfaceFee.amount)),\\n            newValue.interfaceFee.receiver,\\n            newValue.interfaceFee.unwrap,\\n            bytes11(0)\\n        );\\n    }\\n```\\n\\nWe can see that when saving, it is forcibly converted to `uint40`, as in `uint40(UFixed6.unwrap(newValue.interfaceFee.amount))`. The order can be saved successfully, but the actual storage may be truncated to `0`.
```\\nlibrary TriggerOrderLib {\\n    function store(TriggerOrderStorage storage self, TriggerOrder memory newValue) internal {\\n        if (newValue.side > type(uint8).max) revert TriggerOrderStorageInvalidError();\\n        if (newValue.comparison > type(int8).max) revert TriggerOrderStorageInvalidError();\\n        if (newValue.comparison < type(int8).min) revert TriggerOrderStorageInvalidError();\\n        if (newValue.fee.gt(UFixed6.wrap(type(uint64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.price.gt(Fixed6.wrap(type(int64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.price.lt(Fixed6.wrap(type(int64).min))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.delta.gt(Fixed6.wrap(type(int64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.delta.lt(Fixed6.wrap(type(int64).min))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.interfaceFee.amount.gt(UFixed6.wrap(type(uint48).max))) revert TriggerOrderStorageInvalidError();\\n\\n        self.value = StoredTriggerOrder(\\n            uint8(newValue.side),\\n            int8(newValue.comparison),\\n            uint64(UFixed6.unwrap(newValue.fee)),\\n            int64(Fixed6.unwrap(newValue.price)),\\n            int64(Fixed6.unwrap(newValue.delta)),\\n// Remove the line below\\n          uint40(UFixed6.unwrap(newValue.interfaceFee.amount)),\\n// Add the line below\\n          uint48(UFixed6.unwrap(newValue.interfaceFee.amount)),\\n            newValue.interfaceFee.receiver,\\n            newValue.interfaceFee.unwrap,\\n            bytes11(0)\\n        );\\n    }\\n```\\n
For orders where `interfaceFee.amount` is greater than `1.1M`, the order can be saved successfully, but the actual storage may be truncated to `0`. This is not what users expect and may lead to incorrect fee payments when the order is executed. Although a fee of `1.1M` is large, it is not impossible.
```\\nstruct StoredTriggerOrder {\\n    /* slot 0 */\\n    uint8 side;                // 0 = maker, 1 = long, 2 = short, 3 = collateral\\n    int8 comparison;           // -2 = lt, -1 = lte, 0 = eq, 1 = gte, 2 = gt\\n    uint64 fee;                // <= 18.44tb\\n    int64 price;               // <= 9.22t\\n    int64 delta;               // <= 9.22t\\n  uint48 interfaceFeeAmount; // <= 281m\\n\\n    /* slot 1 */\\n    address interfaceFeeReceiver;\\n    bool interfaceFeeUnwrap;\\n    bytes11 __unallocated0__;\\n}\\n\\nlibrary TriggerOrderLib {\\n    function store(TriggerOrderStorage storage self, TriggerOrder memory newValue) internal {\\n        if (newValue.side > type(uint8).max) revert TriggerOrderStorageInvalidError();\\n        if (newValue.comparison > type(int8).max) revert TriggerOrderStorageInvalidError();\\n        if (newValue.comparison < type(int8).min) revert TriggerOrderStorageInvalidError();\\n        if (newValue.fee.gt(UFixed6.wrap(type(uint64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.price.gt(Fixed6.wrap(type(int64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.price.lt(Fixed6.wrap(type(int64).min))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.delta.gt(Fixed6.wrap(type(int64).max))) revert TriggerOrderStorageInvalidError();\\n        if (newValue.delta.lt(Fixed6.wrap(type(int64).min))) revert TriggerOrderStorageInvalidError();\\n      if (newValue.interfaceFee.amount.gt(UFixed6.wrap(type(uint48).max))) revert TriggerOrderStorageInvalidError();\\n\\n        self.value = StoredTriggerOrder(\\n            uint8(newValue.side),\\n            int8(newValue.comparison),\\n            uint64(UFixed6.unwrap(newValue.fee)),\\n            int64(Fixed6.unwrap(newValue.price)),\\n            int64(Fixed6.unwrap(newValue.delta)),\\n          uint40(UFixed6.unwrap(newValue.interfaceFee.amount)),\\n            newValue.interfaceFee.receiver,\\n            newValue.interfaceFee.unwrap,\\n            bytes11(0)\\n        );\\n    }\\n```\\n