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";
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) {
return x;
}
......
......@@ -10,9 +10,9 @@ abstract contract OVM_FraudContributor is Lib_AddressResolver {
/// Decorate your functions with this modifier to store how much total gas was
/// consumed by the sender, to reward users fairly
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);
}
}
......@@ -29,7 +29,7 @@ interface iOVM_ExecutionManager {
PREV_EPOCH_SEQUENCER_QUEUE_GAS,
PREV_EPOCH_L1TOL2_QUEUE_GAS
}
/***********
* Structs *
***********/
......@@ -91,7 +91,7 @@ interface iOVM_ExecutionManager {
function ovmGASLIMIT() external view returns (uint256 _gasLimit);
function ovmCHAINID() external view returns (uint256 _chainId);
/**********************
* L2 Context Opcodes *
**********************/
......@@ -99,11 +99,11 @@ interface iOVM_ExecutionManager {
function ovmL1QUEUEORIGIN() external view returns (Lib_OVMCodec.QueueOrigin _queueOrigin);
function ovmL1TXORIGIN() external view returns (address _l1TxOrigin);
/*******************
* Halting Opcodes *
*******************/
function ovmREVERT(bytes memory _data) external;
......@@ -118,7 +118,7 @@ interface iOVM_ExecutionManager {
/*******************************
* Account Abstraction Opcodes *
******************************/
function ovmGETNONCE() external returns (uint256 _nonce);
function ovmSETNONCE(uint256 _nonce) external;
function ovmCREATEEOA(bytes32 _messageHash, uint8 _v, bytes32 _r, bytes32 _s) external;
......@@ -153,7 +153,7 @@ interface iOVM_ExecutionManager {
/**************************************
* Public Functions: Execution Safety *
**************************************/
function safeCREATE(address _address, bytes memory _bytecode) external;
/***************************************
......
......@@ -12,15 +12,15 @@ interface iOVM_L2ToL1MessagePasser {
**********/
event L2ToL1Message(
uint _nonce,
address _sender,
bytes _data
uint256 _nonce,
address _sender,
bytes _data
);
/********************
* Public Functions *
********************/
function passMessageToL1(bytes calldata _message) external;
}
......@@ -131,15 +131,15 @@ library Lib_OVMCodec {
{
if (_isEthSignedMessage) {
(
uint _nonce,
uint _gasLimit,
uint _gasPrice,
uint _chainId,
uint256 _nonce,
uint256 _gasLimit,
uint256 _gasPrice,
uint256 _chainId,
address _to,
bytes memory _data
) = abi.decode(
_transaction,
(uint, uint, uint, uint, address ,bytes)
(uint256, uint256, uint256, uint256, address ,bytes)
);
return EIP155Transaction({
nonce: _nonce,
......
......@@ -94,11 +94,11 @@ library Lib_RLPWriter {
/**
* RLP encodes a uint.
* @param _in The uint to encode.
* @return _out The RLP encoded uint in bytes.
* @param _in The uint256 to encode.
* @return _out The RLP encoded uint256 in bytes.
*/
function writeUint(
uint _in
uint256 _in
)
internal
pure
......@@ -140,8 +140,8 @@ library Lib_RLPWriter {
* @return _encoded RLP encoded bytes.
*/
function _writeLength(
uint _len,
uint _offset
uint256 _len,
uint256 _offset
)
private
pure
......@@ -155,8 +155,8 @@ library Lib_RLPWriter {
encoded = new bytes(1);
encoded[0] = byte(uint8(_len) + uint8(_offset));
} else {
uint lenLen;
uint i = 1;
uint256 lenLen;
uint256 i = 1;
while (_len / i != 0) {
lenLen++;
i *= 256;
......@@ -212,16 +212,16 @@ library Lib_RLPWriter {
* @param _len Length of memory to copy.
*/
function _memcpy(
uint _dest,
uint _src,
uint _len
uint256 _dest,
uint256 _src,
uint256 _len
)
private
pure
{
uint dest = _dest;
uint src = _src;
uint len = _len;
uint256 dest = _dest;
uint256 src = _src;
uint256 len = _len;
for(; len >= 32; len -= 32) {
assembly {
......@@ -231,7 +231,7 @@ library Lib_RLPWriter {
src += 32;
}
uint mask = 256 ** (32 - len) - 1;
uint256 mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
......@@ -258,20 +258,20 @@ library Lib_RLPWriter {
return new bytes(0);
}
uint len;
uint i = 0;
uint256 len;
uint256 i = 0;
for (; i < _list.length; i++) {
len += _list[i].length;
}
bytes memory flattened = new bytes(len);
uint flattenedPtr;
uint256 flattenedPtr;
assembly { flattenedPtr := add(flattened, 0x20) }
for(i = 0; i < _list.length; i++) {
bytes memory item = _list[i];
uint listPtr;
uint256 listPtr;
assembly { listPtr := add(item, 0x20)}
_memcpy(flattenedPtr, listPtr, item.length);
......
......@@ -7,13 +7,13 @@ contract Helper_GasMeasurer {
bytes memory _data
)
public
returns ( uint )
returns ( uint256 )
{
uint gasBefore;
uint gasAfter;
uint256 gasBefore;
uint256 gasAfter;
uint calldataStart;
uint calldataLength;
uint256 calldataStart;
uint256 calldataLength;
assembly {
calldataStart := add(_data,0x20)
calldataLength := mload(_data)
......
......@@ -8,43 +8,43 @@ contract TestERC20 {
string public constant name = 'Test';
string public constant symbol = 'TST';
uint8 public constant decimals = 18;
uint public totalSupply;
uint256 public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {}
function mint(address to, uint value) public {
function mint(address to, uint256 value) public {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(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;
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[to] = balanceOf[to].add(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);
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);
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)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
......@@ -54,15 +54,15 @@ contract TestERC20 {
}
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');
}
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');
}
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');
}
}
......@@ -60,7 +60,7 @@ contract TestLib_RLPWriter {
}
function writeUint(
uint _in
uint256 _in
)
public
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