Commit 0b668b2b authored by Vaibhav Chellani's avatar Vaibhav Chellani Committed by GitHub

Remove compiler warnings (#265)

* fix: licenses and constructor modifiers

* fix: apply review suggestions

* fix: update function modifiers and remove unused vars

* fix indentation

* fix indentation

* fix: remove unused params

* Revert "fix: remove unused params"

This reverts commit a321e9d39319432fb89bd77c1fc3ff2e1a08295d.
Co-authored-by: default avatarMaurelian <maurelian@protonmail.ch>
parent 0b72812d
...@@ -35,7 +35,6 @@ contract OVM_ProxyEOA { ...@@ -35,7 +35,6 @@ contract OVM_ProxyEOA {
constructor( constructor(
address _implementation address _implementation
) )
public
{ {
_setImplementation(_implementation); _setImplementation(_implementation);
} }
......
...@@ -33,7 +33,7 @@ abstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger, ...@@ -33,7 +33,7 @@ abstract contract Abs_BaseCrossDomainMessenger is iAbs_BaseCrossDomainMessenger,
* Public Functions * * Public Functions *
********************/ ********************/
constructor() Lib_ReentrancyGuard() internal {} constructor() Lib_ReentrancyGuard() {}
/** /**
* Sends a cross domain message to the target messenger. * Sends a cross domain message to the target messenger.
......
...@@ -36,7 +36,6 @@ contract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, Abs_BaseCros ...@@ -36,7 +36,6 @@ contract OVM_L1CrossDomainMessenger is iOVM_L1CrossDomainMessenger, Abs_BaseCros
* Pass a default zero address to the address resolver. This will be updated when initialized. * Pass a default zero address to the address resolver. This will be updated when initialized.
*/ */
constructor() constructor()
public
Lib_AddressResolver(address(0)) Lib_AddressResolver(address(0))
{} {}
......
...@@ -34,7 +34,6 @@ contract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, Abs_BaseCros ...@@ -34,7 +34,6 @@ contract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, Abs_BaseCros
constructor( constructor(
address _libAddressManager address _libAddressManager
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{} {}
...@@ -108,6 +107,7 @@ contract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, Abs_BaseCros ...@@ -108,6 +107,7 @@ contract OVM_L2CrossDomainMessenger is iOVM_L2CrossDomainMessenger, Abs_BaseCros
* @return _valid Whether or not the message is valid. * @return _valid Whether or not the message is valid.
*/ */
function _verifyXDomainMessage() function _verifyXDomainMessage()
view
internal internal
returns ( returns (
bool _valid bool _valid
......
...@@ -39,7 +39,6 @@ contract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 { ...@@ -39,7 +39,6 @@ contract OVM_L2DepositedERC20 is Abs_L2DepositedToken, UniswapV2ERC20 {
string memory _name, string memory _name,
string memory _symbol string memory _symbol
) )
public
Abs_L2DepositedToken(_l2CrossDomainMessenger) Abs_L2DepositedToken(_l2CrossDomainMessenger)
UniswapV2ERC20(_name, _symbol) UniswapV2ERC20(_name, _symbol)
{} {}
......
...@@ -68,7 +68,6 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -68,7 +68,6 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
uint256 _forceInclusionPeriodBlocks, uint256 _forceInclusionPeriodBlocks,
uint256 _maxTransactionGasLimit uint256 _maxTransactionGasLimit
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{ {
forceInclusionPeriodSeconds = _forceInclusionPeriodSeconds; forceInclusionPeriodSeconds = _forceInclusionPeriodSeconds;
...@@ -209,11 +208,11 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -209,11 +208,11 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
Lib_OVMCodec.QueueElement memory _element Lib_OVMCodec.QueueElement memory _element
) )
{ {
iOVM_ChainStorageContainer queue = queue(); iOVM_ChainStorageContainer ctcQueue = queue();
uint40 trueIndex = uint40(_index * 2); uint40 trueIndex = uint40(_index * 2);
bytes32 queueRoot = queue.get(trueIndex); bytes32 queueRoot = ctcQueue.get(trueIndex);
bytes32 timestampAndBlockNumber = queue.get(trueIndex + 1); bytes32 timestampAndBlockNumber = ctcQueue.get(trueIndex + 1);
uint40 elementTimestamp; uint40 elementTimestamp;
uint40 elementBlockNumber; uint40 elementBlockNumber;
...@@ -327,14 +326,14 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -327,14 +326,14 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number())) timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number()))
} }
iOVM_ChainStorageContainer queue = queue(); iOVM_ChainStorageContainer ctcQueue = queue();
queue.push2( ctcQueue.push2(
transactionHash, transactionHash,
timestampAndBlockNumber timestampAndBlockNumber
); );
uint256 queueIndex = queue.length() / 2; uint256 queueIndex = ctcQueue.length() / 2;
emit TransactionEnqueued( emit TransactionEnqueued(
msg.sender, msg.sender,
_target, _target,
...@@ -506,16 +505,16 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -506,16 +505,16 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
// Generate the required metadata that we need to append this batch // Generate the required metadata that we need to append this batch
uint40 numQueuedTransactions = totalElementsToAppend - numSequencerTransactions; uint40 numQueuedTransactions = totalElementsToAppend - numSequencerTransactions;
uint40 timestamp; uint40 blockTimestamp;
uint40 blockNumber; uint40 blockNumber;
if (curContext.numSubsequentQueueTransactions == 0) { if (curContext.numSubsequentQueueTransactions == 0) {
// The last element is a sequencer tx, therefore pull timestamp and block number from the last context. // The last element is a sequencer tx, therefore pull timestamp and block number from the last context.
timestamp = uint40(curContext.timestamp); blockTimestamp = uint40(curContext.timestamp);
blockNumber = uint40(curContext.blockNumber); blockNumber = uint40(curContext.blockNumber);
} else { } else {
// The last element is a queue tx, therefore pull timestamp and block number from the queue element. // The last element is a queue tx, therefore pull timestamp and block number from the queue element.
Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1); Lib_OVMCodec.QueueElement memory lastElement = getQueueElement(nextQueueIndex - 1);
timestamp = lastElement.timestamp; blockTimestamp = lastElement.timestamp;
blockNumber = lastElement.blockNumber; blockNumber = lastElement.blockNumber;
} }
...@@ -523,7 +522,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -523,7 +522,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
Lib_MerkleTree.getMerkleRoot(leaves), Lib_MerkleTree.getMerkleRoot(leaves),
totalElementsToAppend, totalElementsToAppend,
numQueuedTransactions, numQueuedTransactions,
timestamp, blockTimestamp,
blockNumber blockNumber
); );
...@@ -690,7 +689,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -690,7 +689,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
uint256 _index uint256 _index
) )
internal internal
view pure
returns ( returns (
bytes32 bytes32
) )
...@@ -826,7 +825,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad ...@@ -826,7 +825,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
) )
internal internal
{ {
(uint40 totalElements, uint40 nextQueueIndex, uint40 lastTimestamp, uint40 lastBlockNumber) = _getBatchExtraData(); (uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();
Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({ Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({
batchIndex: batches().length(), batchIndex: batches().length(),
......
...@@ -51,7 +51,6 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes ...@@ -51,7 +51,6 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
address _libAddressManager, address _libAddressManager,
string memory _owner string memory _owner
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{ {
owner = _owner; owner = _owner;
......
...@@ -49,7 +49,6 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol ...@@ -49,7 +49,6 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
uint256 _fraudProofWindow, uint256 _fraudProofWindow,
uint256 _sequencerPublishWindow uint256 _sequencerPublishWindow
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{ {
FRAUD_PROOF_WINDOW = _fraudProofWindow; FRAUD_PROOF_WINDOW = _fraudProofWindow;
......
...@@ -79,7 +79,6 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -79,7 +79,6 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
GasMeterConfig memory _gasMeterConfig, GasMeterConfig memory _gasMeterConfig,
GlobalContext memory _globalContext GlobalContext memory _globalContext
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{ {
ovmSafetyChecker = iOVM_SafetyChecker(resolve("OVM_SafetyChecker")); ovmSafetyChecker = iOVM_SafetyChecker(resolve("OVM_SafetyChecker"));
...@@ -632,6 +631,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -632,6 +631,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
{ {
// DELEGATECALL does not change anything about the message context. // DELEGATECALL does not change anything about the message context.
MessageContext memory nextMessageContext = messageContext; MessageContext memory nextMessageContext = messageContext;
bool isStaticEntrypoint = false; bool isStaticEntrypoint = false;
return _callContract( return _callContract(
...@@ -1632,6 +1632,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -1632,6 +1632,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
uint256 _gasLimit, uint256 _gasLimit,
Lib_OVMCodec.QueueOrigin _queueOrigin Lib_OVMCodec.QueueOrigin _queueOrigin
) )
view
internal internal
returns ( returns (
bool _valid bool _valid
......
...@@ -53,7 +53,6 @@ contract OVM_StateManager is iOVM_StateManager { ...@@ -53,7 +53,6 @@ contract OVM_StateManager is iOVM_StateManager {
constructor( constructor(
address _owner address _owner
) )
public
{ {
owner = _owner; owner = _owner;
} }
......
...@@ -28,7 +28,6 @@ contract OVM_ETH is OVM_L2DepositedERC20 { ...@@ -28,7 +28,6 @@ contract OVM_ETH is OVM_L2DepositedERC20 {
"ovmWETH", "ovmWETH",
"oWETH" "oWETH"
) )
public
{ {
init(iOVM_L1TokenGateway(_l1ETHGateway)); init(iOVM_L1TokenGateway(_l1ETHGateway));
} }
......
...@@ -104,14 +104,14 @@ contract OVM_SequencerEntrypoint { ...@@ -104,14 +104,14 @@ contract OVM_SequencerEntrypoint {
/** /**
* Converts a uint256 into a TransactionType enum. * Converts a uint256 into a TransactionType enum.
* @param _transactionType Transaction type index. * @param _transactionType Transaction type index.
* @return Transaction type enum value. * @return _txType Transaction type enum value.
*/ */
function _getTransactionType( function _getTransactionType(
uint8 _transactionType uint8 _transactionType
) )
internal internal
returns ( returns (
TransactionType TransactionType _txType
) )
{ {
if (_transactionType == 0) { if (_transactionType == 0) {
......
...@@ -64,7 +64,6 @@ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver { ...@@ -64,7 +64,6 @@ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver {
ERC20 _token, ERC20 _token,
address _libAddressManager address _libAddressManager
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{ {
token = _token; token = _token;
......
...@@ -47,7 +47,6 @@ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_Fr ...@@ -47,7 +47,6 @@ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_Fr
constructor( constructor(
address _libAddressManager address _libAddressManager
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{} {}
...@@ -171,7 +170,6 @@ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_Fr ...@@ -171,7 +170,6 @@ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_Fr
{ {
iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash); iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash);
iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain"));
iOVM_BondManager ovmBondManager = iOVM_BondManager(resolve("OVM_BondManager"));
require( require(
transitioner.isComplete() == true, transitioner.isComplete() == true,
......
...@@ -92,7 +92,6 @@ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOV ...@@ -92,7 +92,6 @@ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOV
bytes32 _preStateRoot, bytes32 _preStateRoot,
bytes32 _transactionHash bytes32 _transactionHash
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{ {
stateTransitionIndex = _stateTransitionIndex; stateTransitionIndex = _stateTransitionIndex;
......
...@@ -26,7 +26,6 @@ contract OVM_StateTransitionerFactory is iOVM_StateTransitionerFactory, Lib_Addr ...@@ -26,7 +26,6 @@ contract OVM_StateTransitionerFactory is iOVM_StateTransitionerFactory, Lib_Addr
constructor( constructor(
address _libAddressManager address _libAddressManager
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{} {}
......
...@@ -7,7 +7,7 @@ import { Lib_AddressManager } from "./Lib_AddressManager.sol"; ...@@ -7,7 +7,7 @@ import { Lib_AddressManager } from "./Lib_AddressManager.sol";
/** /**
* @title Lib_AddressResolver * @title Lib_AddressResolver
*/ */
contract Lib_AddressResolver { abstract contract Lib_AddressResolver {
/******************************************* /*******************************************
* Contract Variables: Contract References * * Contract Variables: Contract References *
...@@ -25,7 +25,7 @@ contract Lib_AddressResolver { ...@@ -25,7 +25,7 @@ contract Lib_AddressResolver {
*/ */
constructor( constructor(
address _libAddressManager address _libAddressManager
) public { ) {
libAddressManager = Lib_AddressManager(_libAddressManager); libAddressManager = Lib_AddressManager(_libAddressManager);
} }
......
...@@ -28,7 +28,7 @@ abstract contract Ownable { ...@@ -28,7 +28,7 @@ abstract contract Ownable {
* Constructor * * Constructor *
***************/ ***************/
constructor() internal { constructor() {
owner = msg.sender; owner = msg.sender;
emit OwnershipTransferred(address(0), owner); emit OwnershipTransferred(address(0), owner);
} }
......
...@@ -38,7 +38,6 @@ contract Lib_ResolvedDelegateProxy { ...@@ -38,7 +38,6 @@ contract Lib_ResolvedDelegateProxy {
address _libAddressManager, address _libAddressManager,
string memory _implementationName string memory _implementationName
) )
public
{ {
addressManager[address(this)] = Lib_AddressManager(_libAddressManager); addressManager[address(this)] = Lib_AddressManager(_libAddressManager);
implementationName[address(this)] = _implementationName; implementationName[address(this)] = _implementationName;
......
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16 <0.8.0; pragma solidity >=0.5.16 <0.8.0;
interface IUniswapV2ERC20 { interface IUniswapV2ERC20 {
......
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16 <0.8.0; pragma solidity >=0.5.16 <0.8.0;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
......
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16 <0.8.0; pragma solidity >=0.5.16 <0.8.0;
import './IUniswapV2ERC20.sol'; import './IUniswapV2ERC20.sol';
......
...@@ -23,7 +23,7 @@ library Lib_MerkleTree { ...@@ -23,7 +23,7 @@ library Lib_MerkleTree {
bytes32[] memory _elements bytes32[] memory _elements
) )
internal internal
view pure
returns ( returns (
bytes32 bytes32
) )
......
...@@ -34,7 +34,7 @@ abstract contract Lib_ReentrancyGuard { ...@@ -34,7 +34,7 @@ abstract contract Lib_ReentrancyGuard {
uint256 private _status; uint256 private _status;
constructor () internal { constructor () {
_status = _NOT_ENTERED; _status = _NOT_ENTERED;
} }
......
...@@ -231,9 +231,6 @@ library Lib_RingBuffer { ...@@ -231,9 +231,6 @@ library Lib_RingBuffer {
"Index out of bounds." "Index out of bounds."
); );
Buffer storage currBuffer = _self.getBuffer(ctx.currBufferIndex);
Buffer storage prevBuffer = _self.getBuffer(ctx.currBufferIndex + 1);
if (_index < ctx.currResetIndex) { if (_index < ctx.currResetIndex) {
// We're switching back to the previous buffer. // We're switching back to the previous buffer.
// Reduce the buffer index, set the current reset index back to match the previous one. // Reduce the buffer index, set the current reset index back to match the previous one.
......
...@@ -46,7 +46,6 @@ contract mockOVM_CrossDomainMessenger is iAbs_BaseCrossDomainMessenger { ...@@ -46,7 +46,6 @@ contract mockOVM_CrossDomainMessenger is iAbs_BaseCrossDomainMessenger {
constructor( constructor(
uint256 _delay uint256 _delay
) )
public
{ {
delay = _delay; delay = _delay;
} }
......
...@@ -14,7 +14,6 @@ contract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver { ...@@ -14,7 +14,6 @@ contract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver {
constructor( constructor(
address _libAddressManager address _libAddressManager
) )
public
Lib_AddressResolver(_libAddressManager) Lib_AddressResolver(_libAddressManager)
{} {}
...@@ -79,7 +78,7 @@ contract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver { ...@@ -79,7 +78,7 @@ contract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver {
) )
override override
public public
view pure
returns ( returns (
uint256 uint256
) )
......
...@@ -15,7 +15,7 @@ contract TestERC20 { ...@@ -15,7 +15,7 @@ contract TestERC20 {
event Approval(address indexed owner, address indexed spender, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {} constructor() {}
function mint(address to, uint256 value) public { function mint(address to, uint256 value) public {
totalSupply = totalSupply.add(value); totalSupply = totalSupply.add(value);
......
...@@ -14,7 +14,7 @@ contract TestLib_MerkleTree { ...@@ -14,7 +14,7 @@ contract TestLib_MerkleTree {
bytes32[] memory _elements bytes32[] memory _elements
) )
public public
view pure
returns ( returns (
bytes32 bytes32
) )
......
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