Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Change the state machine used for processing new blocks #20

Merged
merged 2 commits into from
Oct 6, 2020
Merged
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 nearbridge/contracts/Borsh.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.6;

import "@openzeppelin/contracts/math/SafeMath.sol";

Expand Down Expand Up @@ -48,7 +48,7 @@ library Borsh {
bytes32[1] memory result;
// solium-disable-next-line security/no-inline-assembly
assembly {
pop(staticcall(gas, 0x02, add(add(ptr, 32), offset), length, result, 32))
pop(staticcall(gas(), 0x02, add(add(ptr, 32), offset), length, result, 32))
}
return result[0];
}
Expand Down
2 changes: 1 addition & 1 deletion nearbridge/contracts/Ed25519.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.6;


// https://gist.github.com/abacabadabacaba/cb927b5ebe6db63f00b98902503ffc76
Expand Down
4 changes: 2 additions & 2 deletions nearbridge/contracts/INearBridge.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.6;


interface INearBridge {
Expand All @@ -21,7 +21,7 @@ interface INearBridge {

function initWithValidators(bytes calldata initialValidators) external;
function initWithBlock(bytes calldata data) external;
function addLightClientBlock(bytes calldata data) external payable;
function addLightClientBlock(bytes calldata data) external;
function challenge(address payable receiver, uint256 signatureIndex) external;
function checkBlockProducerSignatureInHead(uint256 signatureIndex) external view returns(bool);
}
2 changes: 1 addition & 1 deletion nearbridge/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.6;


contract Migrations {
Expand Down
344 changes: 181 additions & 163 deletions nearbridge/contracts/NearBridge.sol

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nearbridge/contracts/NearDecoder.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.5.0;
pragma solidity ^0.6;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./Borsh.sol";
Expand Down
23 changes: 12 additions & 11 deletions nearbridge/dist/Borsh.full.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// File: @openzeppelin/contracts/math/SafeMath.sol

pragma solidity ^0.5.0;

pragma solidity ^0.6.0;

/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
Expand All @@ -24,6 +24,7 @@ library SafeMath {
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
Expand All @@ -40,6 +41,7 @@ library SafeMath {
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
Expand All @@ -53,9 +55,8 @@ library SafeMath {
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
Expand All @@ -71,6 +72,7 @@ library SafeMath {
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
Expand All @@ -96,6 +98,7 @@ library SafeMath {
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
Expand All @@ -111,12 +114,10 @@ library SafeMath {
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
Expand All @@ -133,6 +134,7 @@ library SafeMath {
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
Expand All @@ -148,9 +150,8 @@ library SafeMath {
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
Expand All @@ -160,7 +161,7 @@ library SafeMath {

// File: contracts/Borsh.sol

pragma solidity ^0.5.0;
pragma solidity ^0.6;



Expand Down Expand Up @@ -209,7 +210,7 @@ library Borsh {
bytes32[1] memory result;
// solium-disable-next-line security/no-inline-assembly
assembly {
pop(staticcall(gas, 0x02, add(add(ptr, 32), offset), length, result, 32))
pop(staticcall(gas(), 0x02, add(add(ptr, 32), offset), length, result, 32))
}
return result[0];
}
Expand Down
3 changes: 1 addition & 2 deletions nearbridge/dist/Ed25519.full.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

// File: contracts/Ed25519.sol

pragma solidity ^0.5.0;
pragma solidity ^0.6;


// https://gist.github.com/abacabadabacaba/cb927b5ebe6db63f00b98902503ffc76
Expand Down
5 changes: 2 additions & 3 deletions nearbridge/dist/INearBridge.full.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

// File: contracts/INearBridge.sol

pragma solidity ^0.5.0;
pragma solidity ^0.6;


interface INearBridge {
Expand All @@ -24,7 +23,7 @@ interface INearBridge {

function initWithValidators(bytes calldata initialValidators) external;
function initWithBlock(bytes calldata data) external;
function addLightClientBlock(bytes calldata data) external payable;
function addLightClientBlock(bytes calldata data) external;
function challenge(address payable receiver, uint256 signatureIndex) external;
function checkBlockProducerSignatureInHead(uint256 signatureIndex) external view returns(bool);
}
3 changes: 1 addition & 2 deletions nearbridge/dist/Migrations.full.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

// File: contracts/Migrations.sol

pragma solidity ^0.5.0;
pragma solidity ^0.6;


contract Migrations {
Expand Down
Loading