diff --git a/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol b/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol index 42f7465ed..e7115ae49 100644 --- a/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol +++ b/nucypher/blockchain/eth/sol/source/contracts/PolicyManager.sol @@ -105,9 +105,9 @@ contract PolicyManager is Upgradeable { bytes16 internal constant RESERVED_POLICY_ID = bytes16(0); address internal constant RESERVED_NODE = address(0); - uint256 internal constant MAX_BALANCE = uint256(uint128(0) - 1); + uint256 internal constant MAX_BALANCE = uint256(type(uint128).max); // controlled overflow to get max int256 - int256 public constant DEFAULT_FEE_DELTA = int256((uint256(0) - 1) >> 1); + int256 public constant DEFAULT_FEE_DELTA = int256((type(uint256).max) >> 1); IStakingEscrow public immutable escrow; uint32 public immutable genesisSecondsPerPeriod; diff --git a/nucypher/blockchain/eth/sol/source/contracts/WorkLock.sol b/nucypher/blockchain/eth/sol/source/contracts/WorkLock.sol index 86cbde385..8dd2fa81c 100644 --- a/nucypher/blockchain/eth/sol/source/contracts/WorkLock.sol +++ b/nucypher/blockchain/eth/sol/source/contracts/WorkLock.sol @@ -353,7 +353,7 @@ contract WorkLock is Ownable { function internalShutdown() internal { startBidDate = 0; endBidDate = 0; - endCancellationDate = uint256(0) - 1; // "infinite" cancellation window + endCancellationDate = type(uint256).max; // "infinite" cancellation window token.safeTransfer(owner(), tokenSupply); emit Shutdown(msg.sender); } diff --git a/nucypher/blockchain/eth/sol/source/contracts/lib/SignatureVerifier.sol b/nucypher/blockchain/eth/sol/source/contracts/lib/SignatureVerifier.sol index eff7b7e9d..98a4d386a 100644 --- a/nucypher/blockchain/eth/sol/source/contracts/lib/SignatureVerifier.sol +++ b/nucypher/blockchain/eth/sol/source/contracts/lib/SignatureVerifier.sol @@ -122,9 +122,9 @@ library SignatureVerifier { } bytes memory lengthAsText = new bytes(digits); length = _message.length; - uint256 index = digits - 1; + uint256 index = digits; while (length != 0) { - lengthAsText[index--] = bytes1(uint8(48 + length % 10)); + lengthAsText[--index] = bytes1(uint8(48 + length % 10)); length /= 10; }