Skip to content

Commit

Permalink
apply erro msg script again
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Jan 11, 2021
1 parent bfe2d34 commit d53600a
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 81 deletions.
24 changes: 12 additions & 12 deletions contracts/contracts/Bytes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ library Bytes {
// Copies 'len' lower bytes from 'self' into a new 'bytes memory'.
// Returns the newly created 'bytes memory'. The returned bytes will be of length 'len'.
function toBytesFromUIntTruncated(uint256 self, uint8 byteLength) private pure returns (bytes memory bts) {
require(byteLength <= 32, "a");
require(byteLength <= 32, "Q");
bts = new bytes(byteLength);
// Even though the bytes will allocate a full word, we don't want
// any potential garbage bytes in there.
Expand All @@ -53,7 +53,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 20)
function bytesToAddress(bytes memory self, uint256 _start) internal pure returns (address addr) {
uint256 offset = _start + 20;
require(self.length >= offset, "b");
require(self.length >= offset, "R");
assembly {
addr := mload(add(self, offset))
}
Expand All @@ -63,7 +63,7 @@ library Bytes {
// NOTE: that bytes1..32 is stored in the beginning of the word unlike other primitive types
// NOTE: theoretically possible overflow of (_start + 20)
function bytesToBytes20(bytes memory self, uint256 _start) internal pure returns (bytes20 r) {
require(self.length >= (_start + 20), "c");
require(self.length >= (_start + 20), "S");
assembly {
r := mload(add(add(self, 0x20), _start))
}
Expand All @@ -73,7 +73,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 0x2)
function bytesToUInt16(bytes memory _bytes, uint256 _start) internal pure returns (uint16 r) {
uint256 offset = _start + 0x2;
require(_bytes.length >= offset, "d");
require(_bytes.length >= offset, "T");
assembly {
r := mload(add(_bytes, offset))
}
Expand All @@ -83,7 +83,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 0x3)
function bytesToUInt24(bytes memory _bytes, uint256 _start) internal pure returns (uint24 r) {
uint256 offset = _start + 0x3;
require(_bytes.length >= offset, "e");
require(_bytes.length >= offset, "U");
assembly {
r := mload(add(_bytes, offset))
}
Expand All @@ -92,7 +92,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 0x4)
function bytesToUInt32(bytes memory _bytes, uint256 _start) internal pure returns (uint32 r) {
uint256 offset = _start + 0x4;
require(_bytes.length >= offset, "f");
require(_bytes.length >= offset, "V");
assembly {
r := mload(add(_bytes, offset))
}
Expand All @@ -101,7 +101,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 0x10)
function bytesToUInt128(bytes memory _bytes, uint256 _start) internal pure returns (uint128 r) {
uint256 offset = _start + 0x10;
require(_bytes.length >= offset, "g");
require(_bytes.length >= offset, "W");
assembly {
r := mload(add(_bytes, offset))
}
Expand All @@ -111,7 +111,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 0x14)
function bytesToUInt160(bytes memory _bytes, uint256 _start) internal pure returns (uint160 r) {
uint256 offset = _start + 0x14;
require(_bytes.length >= offset, "h");
require(_bytes.length >= offset, "X");
assembly {
r := mload(add(_bytes, offset))
}
Expand All @@ -120,7 +120,7 @@ library Bytes {
// NOTE: theoretically possible overflow of (_start + 0x20)
function bytesToBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32 r) {
uint256 offset = _start + 0x20;
require(_bytes.length >= offset, "i");
require(_bytes.length >= offset, "Y");
assembly {
r := mload(add(_bytes, offset))
}
Expand All @@ -135,7 +135,7 @@ library Bytes {
uint256 _start,
uint256 _length
) internal pure returns (bytes memory) {
require(_bytes.length >= (_start + _length), "j"); // bytes length is less then start byte + length bytes
require(_bytes.length >= (_start + _length), "Z"); // bytes length is less then start byte + length bytes

bytes memory tempBytes = new bytes(_length);

Expand Down Expand Up @@ -234,8 +234,8 @@ library Bytes {

/// Trim bytes into single word
function trim(bytes memory _data, uint256 _new_length) internal pure returns (uint256 r) {
require(_new_length <= 0x20, "k"); // new_length is longer than word
require(_data.length >= _new_length, "l"); // data is to short
require(_new_length <= 0x20, "10"); // new_length is longer than word
require(_data.length >= _new_length, "11"); // data is to short

uint256 a;
assembly {
Expand Down
10 changes: 5 additions & 5 deletions contracts/contracts/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ contract Governance is Config {
/// @param _token Token address
function addToken(address _token) external {
requireGovernor(msg.sender);
require(tokenIds[_token] == 0, "bz"); // token exists
require(totalTokens < MAX_AMOUNT_OF_REGISTERED_TOKENS, "ca"); // no free identifiers for tokens
require(tokenIds[_token] == 0, "1e"); // token exists
require(totalTokens < MAX_AMOUNT_OF_REGISTERED_TOKENS, "1f"); // no free identifiers for tokens

totalTokens++;
uint16 newTokenId = totalTokens; // it is not `totalTokens - 1` because tokenId = 0 is reserved for eth
Expand Down Expand Up @@ -101,13 +101,13 @@ contract Governance is Config {
/// @notice Check if specified address is is governor
/// @param _address Address to check
function requireGovernor(address _address) public view {
require(_address == networkGovernor, "cb"); // only by governor
require(_address == networkGovernor, "1g"); // only by governor
}

/// @notice Checks if validator is active
/// @param _address Validator address
function requireActiveValidator(address _address) external view {
require(validators[_address], "cc"); // validator is not active
require(validators[_address], "1h"); // validator is not active
}

/// @notice Validate token id (must be less than or equal to total tokens amount)
Expand All @@ -122,7 +122,7 @@ contract Governance is Config {
/// @return tokens id
function validateTokenAddress(address _tokenAddr) external view returns (uint16) {
uint16 tokenId = tokenIds[_tokenAddr];
require(tokenId != 0, "cd"); // 0 is not a valid token
require(tokenId != 0, "1i"); // 0 is not a valid token
return tokenId;
}
}
4 changes: 2 additions & 2 deletions contracts/contracts/Operations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ library Operations {
(offset, parsed.amount) = Bytes.readUInt128(_data, offset); // amount
(offset, parsed.owner) = Bytes.readAddress(_data, offset); // owner

require(offset == PACKED_DEPOSIT_PUBDATA_BYTES, "m"); // reading invalid deposit pubdata size
require(offset == PACKED_DEPOSIT_PUBDATA_BYTES, "N"); // reading invalid deposit pubdata size
}

/// Serialize deposit pubdata
Expand Down Expand Up @@ -111,7 +111,7 @@ library Operations {
(offset, parsed.tokenId) = Bytes.readUInt16(_data, offset); // tokenId
(offset, parsed.amount) = Bytes.readUInt128(_data, offset); // amount

require(offset == PACKED_FULL_EXIT_PUBDATA_BYTES, "n"); // reading invalid full exit pubdata size
require(offset == PACKED_FULL_EXIT_PUBDATA_BYTES, "O"); // reading invalid full exit pubdata size
}

function writeFullExitPubdataForPriorityQueue(FullExit memory op) internal pure returns (bytes memory buf) {
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/Ownable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract Ownable {
/// @notice Check if specified address is master
/// @param _address Address to check
function requireMaster(address _address) internal view {
require(_address == getMaster(), "oro11"); // oro11 - only by master
require(_address == getMaster(), "1c"); // oro11 - only by master
}

/// @notice Returns contract masters address
Expand All @@ -43,7 +43,7 @@ contract Ownable {
/// @param _newMaster New masters address
function transferMastership(address _newMaster) external {
requireMaster(msg.sender);
require(_newMaster != address(0), "otp11"); // otp11 - new masters address can't be zero address
require(_newMaster != address(0), "1d"); // otp11 - new masters address can't be zero address
setMaster(_newMaster);
}
}
2 changes: 1 addition & 1 deletion contracts/contracts/ReentrancyGuard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract ReentrancyGuard {
}

// On the first call to nonReentrant, _notEntered will be true
require(notEntered, "o");
require(notEntered, "1b");

// Any calls to nonReentrant after this point will fail
assembly {
Expand Down
10 changes: 5 additions & 5 deletions contracts/contracts/SafeCast.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ library SafeCast {
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value < 2**128, "p");
require(value < 2**128, "16");
return uint128(value);
}

Expand All @@ -46,7 +46,7 @@ library SafeCast {
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value < 2**64, "q");
require(value < 2**64, "17");
return uint64(value);
}

Expand All @@ -61,7 +61,7 @@ library SafeCast {
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value < 2**32, "r");
require(value < 2**32, "18");
return uint32(value);
}

Expand All @@ -76,7 +76,7 @@ library SafeCast {
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value < 2**16, "s");
require(value < 2**16, "19");
return uint16(value);
}

Expand All @@ -91,7 +91,7 @@ library SafeCast {
* - input must fit into 8 bits.
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value < 2**8, "t");
require(value < 2**8, "1a");
return uint8(value);
}
}
4 changes: 2 additions & 2 deletions contracts/contracts/SafeMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ library SafeMath {
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "u");
require(c >= a, "14");

return c;
}
Expand Down Expand Up @@ -85,7 +85,7 @@ library SafeMath {
}

uint256 c = a * b;
require(c / a == b, "w");
require(c / a == b, "15");

return c;
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/SafeMathUInt128.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ library SafeMathUInt128 {
*/
function add(uint128 a, uint128 b) internal pure returns (uint128) {
uint128 c = a + b;
require(c >= a, "z");
require(c >= a, "12");

return c;
}
Expand Down Expand Up @@ -85,7 +85,7 @@ library SafeMathUInt128 {
}

uint128 c = a * b;
require(c / a == b, "ab");
require(c / a == b, "13");

return c;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ library Utils {
pure
returns (address)
{
require(_signature.length == 65, "ae"); // incorrect signature length
require(_signature.length == 65, "P"); // incorrect signature length

bytes32 signR;
bytes32 signS;
Expand Down
Loading

0 comments on commit d53600a

Please sign in to comment.