Commit fab8c869 authored by Alina's avatar Alina Committed by GitHub

uint -> uint256 (#112)

* uint -> uint256

* indent fix
parent ef9d1e75
...@@ -16,7 +16,7 @@ import { OVM_ExecutionManager } from "../execution/OVM_ExecutionManager.sol"; ...@@ -16,7 +16,7 @@ import { OVM_ExecutionManager } from "../execution/OVM_ExecutionManager.sol";
library Math { library Math {
function min(uint x, uint y) internal pure returns (uint z) { function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
if (x < y) { if (x < y) {
return x; return x;
} }
......
...@@ -10,9 +10,9 @@ abstract contract OVM_FraudContributor is Lib_AddressResolver { ...@@ -10,9 +10,9 @@ abstract contract OVM_FraudContributor is Lib_AddressResolver {
/// Decorate your functions with this modifier to store how much total gas was /// Decorate your functions with this modifier to store how much total gas was
/// consumed by the sender, to reward users fairly /// consumed by the sender, to reward users fairly
modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) { modifier contributesToFraudProof(bytes32 preStateRoot, bytes32 txHash) {
uint startGas = gasleft(); uint256 startGas = gasleft();
_; _;
uint gasSpent = startGas - gasleft(); uint256 gasSpent = startGas - gasleft();
iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent); iOVM_BondManager(resolve('OVM_BondManager')).recordGasSpent(preStateRoot, txHash, msg.sender, gasSpent);
} }
} }
...@@ -29,7 +29,7 @@ interface iOVM_ExecutionManager { ...@@ -29,7 +29,7 @@ interface iOVM_ExecutionManager {
PREV_EPOCH_SEQUENCER_QUEUE_GAS, PREV_EPOCH_SEQUENCER_QUEUE_GAS,
PREV_EPOCH_L1TOL2_QUEUE_GAS PREV_EPOCH_L1TOL2_QUEUE_GAS
} }
/*********** /***********
* Structs * * Structs *
***********/ ***********/
...@@ -91,7 +91,7 @@ interface iOVM_ExecutionManager { ...@@ -91,7 +91,7 @@ interface iOVM_ExecutionManager {
function ovmGASLIMIT() external view returns (uint256 _gasLimit); function ovmGASLIMIT() external view returns (uint256 _gasLimit);
function ovmCHAINID() external view returns (uint256 _chainId); function ovmCHAINID() external view returns (uint256 _chainId);
/********************** /**********************
* L2 Context Opcodes * * L2 Context Opcodes *
**********************/ **********************/
...@@ -99,11 +99,11 @@ interface iOVM_ExecutionManager { ...@@ -99,11 +99,11 @@ interface iOVM_ExecutionManager {
function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin); function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);
function ovmL1TXORIGIN() external view returns (address _l1TxOrigin); function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);
/******************* /*******************
* Halting Opcodes * * Halting Opcodes *
*******************/ *******************/
function ovmREVERT(bytes memory _data) external; function ovmREVERT(bytes memory _data) external;
...@@ -118,7 +118,7 @@ interface iOVM_ExecutionManager { ...@@ -118,7 +118,7 @@ interface iOVM_ExecutionManager {
/******************************* /*******************************
* Account Abstraction Opcodes * * Account Abstraction Opcodes *
******************************/ ******************************/
function ovmGETNONCE() external returns (uint256 _nonce); function ovmGETNONCE() external returns (uint256 _nonce);
function ovmSETNONCE(uint256 _nonce) external; function ovmSETNONCE(uint256 _nonce) external;
function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external; function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;
...@@ -153,7 +153,7 @@ interface iOVM_ExecutionManager { ...@@ -153,7 +153,7 @@ interface iOVM_ExecutionManager {
/************************************** /**************************************
* Public Functions: Execution Safety * * Public Functions: Execution Safety *
**************************************/ **************************************/
function safeCREATE(address _address, bytes memory _bytecode) external; function safeCREATE(address _address, bytes memory _bytecode) external;
/*************************************** /***************************************
......
...@@ -12,15 +12,15 @@ interface iOVM_L2ToL1MessagePasser { ...@@ -12,15 +12,15 @@ interface iOVM_L2ToL1MessagePasser {
**********/ **********/
event L2ToL1Message( event L2ToL1Message(
uint _nonce, uint256 _nonce,
address _sender, address _sender,
bytes _data bytes _data
); );
/******************** /********************
* Public Functions * * Public Functions *
********************/ ********************/
function passMessageToL1(bytes calldata _message) external; function passMessageToL1(bytes calldata _message) external;
} }
...@@ -131,15 +131,15 @@ library Lib_OVMCodec { ...@@ -131,15 +131,15 @@ library Lib_OVMCodec {
{ {
if (_isEthSignedMessage) { if (_isEthSignedMessage) {
( (
uint _nonce, uint256 _nonce,
uint _gasLimit, uint256 _gasLimit,
uint _gasPrice, uint256 _gasPrice,
uint _chainId, uint256 _chainId,
address _to, address _to,
bytes memory _data bytes memory _data
) = abi.decode( ) = abi.decode(
_transaction, _transaction,
(uint, uint, uint, uint, address ,bytes) (uint256, uint256, uint256, uint256, address ,bytes)
); );
return EIP155Transaction({ return EIP155Transaction({
nonce: _nonce, nonce: _nonce,
......
...@@ -94,11 +94,11 @@ library Lib_RLPWriter { ...@@ -94,11 +94,11 @@ library Lib_RLPWriter {
/** /**
* RLP encodes a uint. * RLP encodes a uint.
* @param _in The uint to encode. * @param _in The uint256 to encode.
* @return _out The RLP encoded uint in bytes. * @return _out The RLP encoded uint256 in bytes.
*/ */
function writeUint( function writeUint(
uint _in uint256 _in
) )
internal internal
pure pure
...@@ -140,8 +140,8 @@ library Lib_RLPWriter { ...@@ -140,8 +140,8 @@ library Lib_RLPWriter {
* @return _encoded RLP encoded bytes. * @return _encoded RLP encoded bytes.
*/ */
function _writeLength( function _writeLength(
uint _len, uint256 _len,
uint _offset uint256 _offset
) )
private private
pure pure
...@@ -155,8 +155,8 @@ library Lib_RLPWriter { ...@@ -155,8 +155,8 @@ library Lib_RLPWriter {
encoded = new bytes(1); encoded = new bytes(1);
encoded[0] = byte(uint8(_len) + uint8(_offset)); encoded[0] = byte(uint8(_len) + uint8(_offset));
} else { } else {
uint lenLen; uint256 lenLen;
uint i = 1; uint256 i = 1;
while (_len / i != 0) { while (_len / i != 0) {
lenLen++; lenLen++;
i *= 256; i *= 256;
...@@ -212,16 +212,16 @@ library Lib_RLPWriter { ...@@ -212,16 +212,16 @@ library Lib_RLPWriter {
* @param _len Length of memory to copy. * @param _len Length of memory to copy.
*/ */
function _memcpy( function _memcpy(
uint _dest, uint256 _dest,
uint _src, uint256 _src,
uint _len uint256 _len
) )
private private
pure pure
{ {
uint dest = _dest; uint256 dest = _dest;
uint src = _src; uint256 src = _src;
uint len = _len; uint256 len = _len;
for(; len >= 32; len -= 32) { for(; len >= 32; len -= 32) {
assembly { assembly {
...@@ -231,7 +231,7 @@ library Lib_RLPWriter { ...@@ -231,7 +231,7 @@ library Lib_RLPWriter {
src += 32; src += 32;
} }
uint mask = 256 ** (32 - len) - 1; uint256 mask = 256 ** (32 - len) - 1;
assembly { assembly {
let srcpart := and(mload(src), not(mask)) let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask) let destpart := and(mload(dest), mask)
...@@ -258,20 +258,20 @@ library Lib_RLPWriter { ...@@ -258,20 +258,20 @@ library Lib_RLPWriter {
return new bytes(0); return new bytes(0);
} }
uint len; uint256 len;
uint i = 0; uint256 i = 0;
for (; i < _list.length; i++) { for (; i < _list.length; i++) {
len += _list[i].length; len += _list[i].length;
} }
bytes memory flattened = new bytes(len); bytes memory flattened = new bytes(len);
uint flattenedPtr; uint256 flattenedPtr;
assembly { flattenedPtr := add(flattened, 0x20) } assembly { flattenedPtr := add(flattened, 0x20) }
for(i = 0; i < _list.length; i++) { for(i = 0; i < _list.length; i++) {
bytes memory item = _list[i]; bytes memory item = _list[i];
uint listPtr; uint256 listPtr;
assembly { listPtr := add(item, 0x20)} assembly { listPtr := add(item, 0x20)}
_memcpy(flattenedPtr, listPtr, item.length); _memcpy(flattenedPtr, listPtr, item.length);
......
...@@ -7,13 +7,13 @@ contract Helper_GasMeasurer { ...@@ -7,13 +7,13 @@ contract Helper_GasMeasurer {
bytes memory _data bytes memory _data
) )
public public
returns ( uint ) returns ( uint256 )
{ {
uint gasBefore; uint256 gasBefore;
uint gasAfter; uint256 gasAfter;
uint calldataStart; uint256 calldataStart;
uint calldataLength; uint256 calldataLength;
assembly { assembly {
calldataStart := add(_data,0x20) calldataStart := add(_data,0x20)
calldataLength := mload(_data) calldataLength := mload(_data)
......
...@@ -8,43 +8,43 @@ contract TestERC20 { ...@@ -8,43 +8,43 @@ contract TestERC20 {
string public constant name = 'Test'; string public constant name = 'Test';
string public constant symbol = 'TST'; string public constant symbol = 'TST';
uint8 public constant decimals = 18; uint8 public constant decimals = 18;
uint public totalSupply; uint256 public totalSupply;
mapping(address => uint) public balanceOf; mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance; mapping(address => mapping(address => uint)) public allowance;
event Approval(address indexed owner, address indexed spender, uint value); event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint value); event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {} constructor() public {}
function mint(address to, uint value) public { function mint(address to, uint256 value) public {
totalSupply = totalSupply.add(value); totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value); balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value); emit Transfer(address(0), to, value);
} }
function _approve(address owner, address spender, uint value) private { function _approve(address owner, address spender, uint256 value) private {
allowance[owner][spender] = value; allowance[owner][spender] = value;
emit Approval(owner, spender, value); emit Approval(owner, spender, value);
} }
function _transfer(address from, address to, uint value) private { function _transfer(address from, address to, uint256 value) private {
balanceOf[from] = balanceOf[from].sub(value); balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value); balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value); emit Transfer(from, to, value);
} }
function approve(address spender, uint value) external returns (bool) { function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value); _approve(msg.sender, spender, value);
return true; return true;
} }
function transfer(address to, uint value) external returns (bool) { function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value); _transfer(msg.sender, to, value);
return true; return true;
} }
function transferFrom(address from, address to, uint value) external returns (bool) { function transferFrom(address from, address to, uint256 value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) { if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
} }
...@@ -54,15 +54,15 @@ contract TestERC20 { ...@@ -54,15 +54,15 @@ contract TestERC20 {
} }
library SafeMath { library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) { function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, 'ds-math-add-overflow'); require((z = x + y) >= x, 'ds-math-add-overflow');
} }
function sub(uint x, uint y) internal pure returns (uint z) { function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, 'ds-math-sub-underflow'); require((z = x - y) <= x, 'ds-math-sub-underflow');
} }
function mul(uint x, uint y) internal pure returns (uint z) { function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
} }
} }
...@@ -60,7 +60,7 @@ contract TestLib_RLPWriter { ...@@ -60,7 +60,7 @@ contract TestLib_RLPWriter {
} }
function writeUint( function writeUint(
uint _in uint256 _in
) )
public public
pure pure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment