Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to support solidity >= 0.5.0, web3 >= 1.0.0, truffle >= 5.0.0 #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.21;
pragma solidity >=0.5.0 <0.6.0;


contract Migrations {
Expand All @@ -11,7 +11,7 @@ contract Migrations {
}
}

function Migrations() public {
constructor() public {
owner = msg.sender;
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/OwnedSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// An owned validator set contract where the owner can add or remove validators.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;

import "./interfaces/BaseOwnedSet.sol";
import "./interfaces/ValidatorSet.sol";
Expand All @@ -32,7 +32,7 @@ contract OwnedSet is ValidatorSet, BaseOwnedSet {
_;
}

constructor(address[] _initial) BaseOwnedSet(_initial)
constructor(address[] memory _initial) BaseOwnedSet(_initial)
public
{
systemAddress = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
Expand All @@ -54,7 +54,7 @@ contract OwnedSet is ValidatorSet, BaseOwnedSet {
baseReportBenign(msg.sender, _validator, _blockNumber);
}

function reportMalicious(address _validator, uint256 _blockNumber, bytes _proof)
function reportMalicious(address _validator, uint256 _blockNumber, bytes calldata _proof)
external
{
baseReportMalicious(
Expand Down
10 changes: 5 additions & 5 deletions contracts/RelaySet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// trigger a change, since the engine will be listening for events emitted by
// the outer relay contract.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;

import "./interfaces/Owned.sol";
import "./interfaces/ValidatorSet.sol";
Expand All @@ -27,7 +27,7 @@ import "./RelayedOwnedSet.sol";

contract RelaySet is Owned, ValidatorSet {
// EVENTS
event NewRelayed(address indexed old, address indexed current);
event NewRelayed(RelayedOwnedSet indexed old, address indexed current);

// STATE

Expand All @@ -54,7 +54,7 @@ contract RelaySet is Owned, ValidatorSet {
}

// For innerSet
function initiateChange(bytes32 _parentHash, address[] _newSet)
function initiateChange(bytes32 _parentHash, address[] calldata _newSet)
external
onlyRelayed
{
Expand All @@ -75,7 +75,7 @@ contract RelaySet is Owned, ValidatorSet {
relayedSet.relayReportBenign(msg.sender, _validator, _blockNumber);
}

function reportMalicious(address _validator, uint256 _blockNumber, bytes _proof)
function reportMalicious(address _validator, uint256 _blockNumber, bytes calldata _proof)
external
{
relayedSet.relayReportMalicious(
Expand All @@ -97,7 +97,7 @@ contract RelaySet is Owned, ValidatorSet {
function getValidators()
external
view
returns (address[])
returns (address[] memory)
{
return relayedSet.getValidators();
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/RelayedOwnedSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// A `OwnedSet` validator contract that is meant to be relayed by a `RelaySet`
// contract.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;

import "./interfaces/BaseOwnedSet.sol";
import "./RelaySet.sol";
Expand All @@ -29,7 +29,7 @@ contract RelayedOwnedSet is BaseOwnedSet {
_;
}

constructor(address _relaySet, address[] _initial) BaseOwnedSet(_initial)
constructor(address _relaySet, address[] memory _initial) BaseOwnedSet(_initial)
public
{
relaySet = RelaySet(_relaySet);
Expand All @@ -46,7 +46,7 @@ contract RelayedOwnedSet is BaseOwnedSet {
address _reporter,
address _validator,
uint _blockNumber,
bytes _proof
bytes calldata _proof
)
external
onlyRelay
Expand Down
10 changes: 5 additions & 5 deletions contracts/interfaces/BaseOwnedSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// currently active validator set. The base implementation of `finalizeChange`
// validates that there are existing unfinalized changes.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;

import "./Owned.sol";

Expand Down Expand Up @@ -91,7 +91,7 @@ contract BaseOwnedSet is Owned {
_;
}

constructor(address[] _initial)
constructor(address[] memory _initial)
public
{
pending = _initial;
Expand Down Expand Up @@ -149,7 +149,7 @@ contract BaseOwnedSet is Owned {
function getValidators()
external
view
returns (address[])
returns (address[] memory)
{
return validators;
}
Expand All @@ -158,7 +158,7 @@ contract BaseOwnedSet is Owned {
function getPending()
external
view
returns (address[])
returns (address[] memory)
{
return pending;
}
Expand All @@ -180,7 +180,7 @@ contract BaseOwnedSet is Owned {
address _reporter,
address _validator,
uint _blockNumber,
bytes _proof
bytes memory _proof
)
internal
isValidator(_reporter)
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/Owned.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;


contract Owned {
Expand Down
6 changes: 3 additions & 3 deletions contracts/interfaces/ValidatorSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;


interface ValidatorSet {
Expand Down Expand Up @@ -44,12 +44,12 @@ interface ValidatorSet {
/// Reports malicious misbehavior of validator of the current validator set
/// and provides proof of that misbehavor, which varies by engine
/// (e.g. double vote).
function reportMalicious(address validator, uint256 blockNumber, bytes proof)
function reportMalicious(address validator, uint256 blockNumber, bytes calldata proof)
external;

/// Get current validator set (last enacted or initial if no changes ever made).
function getValidators()
external
view
returns (address[]);
returns (address[] memory);
}
4 changes: 2 additions & 2 deletions contracts/test/TestOwnedSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// A testable version of the `OwnedSet` contract that exposes some internal
// state and overrides the default system address.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;

import "../OwnedSet.sol";


contract TestOwnedSet is OwnedSet {
constructor(address _systemAddress, address[] _initial) OwnedSet(_initial)
constructor(address _systemAddress, address[] memory _initial) OwnedSet(_initial)
public
{
systemAddress = _systemAddress;
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/TestRelayedOwnedSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// A testable version of the `InnerOwnedSet` and `OuterSet` contracts that
// exposes some internal state and overrides de default system address.

pragma solidity ^0.4.22;
pragma solidity >=0.5.0 <0.6.0;

import "../RelayedOwnedSet.sol";
import "../RelaySet.sol";
Expand All @@ -31,7 +31,7 @@ contract TestRelaySet is RelaySet {


contract TestRelayedOwnedSet is RelayedOwnedSet {
constructor(address _outerSet, address[] _initial) RelayedOwnedSet(_outerSet, _initial)
constructor(address _outerSet, address[] memory _initial) RelayedOwnedSet(_outerSet, _initial)
public
{
}
Expand Down
Loading