This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix configuration and improve ci time
- Loading branch information
Showing
56 changed files
with
3,001 additions
and
2,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
max_line_length = 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
node_modules | ||
build | ||
MaticChannel0.sol | ||
|
||
test-blockchain/geth | ||
test-blockchain/history | ||
.DS_Store | ||
test-blockchain/data/** | ||
!test-blockchain/data/.gitkeep | ||
|
||
*.pid | ||
*.log | ||
|
||
.DS_Store |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": "solium:all", | ||
"plugins": ["security"], | ||
"rules": { | ||
"imports-on-top": 1, | ||
"variable-declarations": 1, | ||
"array-declarations": 1, | ||
"operator-whitespace": 1, | ||
"lbrace": 0, | ||
"mixedcase": 0, | ||
"camelcase": 1, | ||
"uppercase": 1, | ||
"no-empty-blocks": 1, | ||
"no-unused-vars": 1, | ||
"quotes": 1, | ||
"error-reason": 0, | ||
"indentation": ["error", 2], | ||
"arg-overflow": ["error", 8], | ||
"whitespace": 1, | ||
"deprecated-suicide": 1, | ||
"pragma-on-top": 1, | ||
"no-experimental": 0, | ||
"security/enforce-explicit-visibility": ["error"], | ||
"security/no-block-members": ["warning"], | ||
"security/no-low-level-calls": 0, | ||
"security/no-inline-assembly": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,5 @@ Run test cases: | |
|
||
``` | ||
# run test cases | ||
$ npm run test-ci | ||
$ npm run test:ci | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pragma solidity ^0.4.23; | ||
pragma solidity 0.4.24; | ||
|
||
|
||
contract Migrations { | ||
address public owner; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "./lib/SafeMath.sol"; | ||
|
||
|
||
/** | ||
* @title PriorityQueue | ||
* @dev A priority queue implementation. | ||
*/ | ||
contract PriorityQueue { | ||
using SafeMath for uint256; | ||
|
||
/** | ||
* Storage | ||
*/ | ||
address owner; | ||
uint256[] heapList; | ||
uint256 public currentSize; | ||
|
||
/** | ||
* Modifiers | ||
*/ | ||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
constructor() public { | ||
owner = msg.sender; | ||
heapList = [0]; | ||
currentSize = 0; | ||
} | ||
|
||
/** | ||
* Internal functions | ||
*/ | ||
|
||
/** | ||
* @dev Inserts an element into the priority queue. | ||
* @param _priority Priority to insert. | ||
* @param _value Some additional value. | ||
*/ | ||
function insert(uint256 _priority, uint256 _value) public onlyOwner { | ||
uint256 element = _priority << 128 | _value; | ||
heapList.push(element); | ||
currentSize = currentSize.add(1); | ||
_percUp(currentSize); | ||
} | ||
|
||
/** | ||
* @dev Returns the top element of the heap. | ||
* @return The smallest element in the priority queue. | ||
*/ | ||
function getMin() public view returns (uint256, uint256) { | ||
return _splitElement(heapList[1]); | ||
} | ||
|
||
/** | ||
* @dev Deletes the top element of the heap and shifts everything up. | ||
* @return The smallest element in the priorty queue. | ||
*/ | ||
function delMin() public onlyOwner returns (uint256, uint256) { | ||
uint256 retVal = heapList[1]; | ||
heapList[1] = heapList[currentSize]; | ||
delete heapList[currentSize]; | ||
currentSize = currentSize.sub(1); | ||
_percDown(1); | ||
heapList.length = heapList.length.sub(1); | ||
return _splitElement(retVal); | ||
} | ||
|
||
/* | ||
* Private functions | ||
*/ | ||
|
||
/** | ||
* @dev Determines the minimum child of a given node in the tree. | ||
* @param _index Index of the node in the tree. | ||
* @return The smallest child node. | ||
*/ | ||
function _minChild(uint256 _index) private view returns (uint256) { | ||
if (_index.mul(2).add(1) > currentSize) { | ||
return _index.mul(2); | ||
} else { | ||
if (heapList[_index.mul(2)] < heapList[_index.mul(2).add(1)]) { | ||
return _index.mul(2); | ||
} else { | ||
return _index.mul(2).add(1); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @dev Bubbles the element at some index up. | ||
*/ | ||
function _percUp(uint256 _index) private { | ||
uint256 index = _index; | ||
uint256 j = index; | ||
uint256 newVal = heapList[index]; | ||
|
||
while (newVal < heapList[index.div(2)]) { | ||
heapList[index] = heapList[index.div(2)]; | ||
index = index.div(2); | ||
} | ||
|
||
if (index != j) { | ||
heapList[index] = newVal; | ||
} | ||
} | ||
|
||
/** | ||
* @dev Bubbles the element at some index down. | ||
*/ | ||
function _percDown(uint256 _index) private { | ||
uint256 index = _index; | ||
uint256 j = index; | ||
uint256 newVal = heapList[index]; | ||
uint256 mc = _minChild(index); | ||
while (mc <= currentSize && newVal > heapList[mc]) { | ||
heapList[index] = heapList[mc]; | ||
index = mc; | ||
mc = _minChild(index); | ||
} | ||
|
||
if (index != j) { | ||
heapList[index] = newVal; | ||
} | ||
} | ||
|
||
/** | ||
* @dev Split an element into its priority and value. | ||
* @param _element Element to decode. | ||
* @return A tuple containing the priority and value. | ||
*/ | ||
function _splitElement(uint256 _element) private pure returns (uint256, uint256) { | ||
uint256 priority = _element >> 128; | ||
uint256 value = uint256(uint128(_element)); | ||
return (priority, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma solidity ^0.4.23; | ||
pragma solidity 0.4.24; | ||
|
||
|
||
interface RootChainInterface { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma solidity ^0.4.23; | ||
pragma solidity 0.4.24; | ||
|
||
interface StakeManagerInterface { | ||
|
||
|
Oops, something went wrong.