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