use epoch

This commit is contained in:
Jaynti Kanani 2019-06-13 23:02:04 +05:30
parent a02da31b3b
commit e522930bc9
No known key found for this signature in database
GPG key ID: 4396982C976BAE5E
5 changed files with 52 additions and 6 deletions

View file

@ -107,10 +107,9 @@ func (w *wizard) makeGenesis() {
genesis.Difficulty = big.NewInt(1)
genesis.GasLimit = 10000000
genesis.Config.Bor = &params.BorConfig{
Period: 1,
ProducerInterval: 60,
ProducerDelay: 5,
Epoch: 30000,
Period: 1,
ProducerDelay: 5,
Epoch: 60,
}
// We also need the initial list of signers

View file

@ -0,0 +1,48 @@
pragma solidity 0.5.9;
import { ValidatorSet } from "./ValidatorSet.sol";
contract BorValidatorSet is ValidatorSet {
/// Issue this log event to signal a desired change in validator set.
/// This will not lead to a change in active validator set until
/// finalizeChange is called.
///
/// Only the last log event of any block can take effect.
/// If a signal is issued while another is being finalized it may never
/// take effect.
///
/// _parentHash here should be the parent block hash, or the
/// signal will not be recognized.
event InitiateChange(bytes32 indexed _parentHash, address[] _newSet);
/// Called when an initiated change reaches finality and is activated.
/// Only valid when msg.sender == SYSTEM (EIP96, 2**160 - 2).
///
/// Also called when the contract is first enabled for consensus. In this case,
/// the "change" finalized is the activation of the initial set.
function finalizeChange() external {
}
/// Reports benign misbehavior of validator of the current validator set
/// (e.g. validator offline).
function reportBenign(address validator, uint256 blockNumber) external {
}
/// 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 calldata proof) external {
}
/// Get current validator set (last enacted or initial if no changes ever made) with current stake.
function getValidators() external view returns (address[] memory, uint256[] memory) {
address[] memory d = new address[](1);
d[0] = 0x9fB29AAc15b9A4B7F17c3385939b007540f4d791;
uint256[] memory p = new uint256[](1);
p[0] = 10;
return (d, p);
}
}

View file

@ -229,9 +229,8 @@ func (c *CliqueConfig) String() string {
// BorConfig is the consensus engine configs for Matic bor based sealing.
type BorConfig struct {
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
ProducerInterval uint64 `json:"producerInterval"` // Number of seconds between change in block producer interval to enforce
ProducerDelay uint64 `json:"producerDelay"` // Number of seconds delay between two producer interval
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
Epoch uint64 `json:"epoch"` // Epoch length to proposer
ValidatorContract string `json:"validatorContract"` // Validator set contract
}