update: kitabu confs
This commit is contained in:
parent
43535882dc
commit
616c6c6344
@ -1,93 +1,85 @@
|
|||||||
// Author: Mohamed Sohail <mohamedsohailazim@gmail.com>
|
// Author: Mohamed Sohail <mohamedsohailazim@gmail.com>
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
pragma solidity >=0.6.12;
|
pragma solidity >= 0.6.12;
|
||||||
|
|
||||||
contract KitabuValidators {
|
contract KitabuValidators {
|
||||||
address constant SYSTEM_ADDRESS =
|
address constant SYSTEM_ADDRESS = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
|
||||||
0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
|
address public admissionController = 0x9F57B4A25638F3bdfFcB1F3d2902860601a1Aa65;
|
||||||
address public admissionController =
|
|
||||||
0x9F57B4A25638F3bdfFcB1F3d2902860601a1Aa65;
|
address[] bootstrapValidators = [
|
||||||
|
0x7c5a36Cb43fC87fbB1de46eb6Cfd231c2ADe147b
|
||||||
|
];
|
||||||
|
|
||||||
address[] validators;
|
address[] validators;
|
||||||
|
|
||||||
bool public finalized;
|
bool public finalized;
|
||||||
|
|
||||||
mapping(address => uint256) validatorSetIndex;
|
mapping(address => uint256) validatorSetIndex;
|
||||||
|
|
||||||
event NewAdmissionController(
|
event NewAdmissionController(address indexed old, address indexed newController);
|
||||||
address indexed old,
|
|
||||||
address indexed newController
|
|
||||||
);
|
|
||||||
event InitiateChange(bytes32 indexed parentHash, address[] newSet);
|
event InitiateChange(bytes32 indexed parentHash, address[] newSet);
|
||||||
event ChangeFinalized(address[] currentSet);
|
event ChangeFinalized(address[] currentSet);
|
||||||
|
|
||||||
modifier onlySystemChange() {
|
modifier onlySystemChange {
|
||||||
require(msg.sender == SYSTEM_ADDRESS);
|
require(msg.sender == SYSTEM_ADDRESS);
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier alreadyFinalized() {
|
modifier alreadyFinalized {
|
||||||
require(finalized);
|
require(finalized);
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier onlyAdmissionController() {
|
modifier onlyAdmissionController {
|
||||||
require(msg.sender == admissionController);
|
require(msg.sender == admissionController);
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() public {
|
constructor() public {
|
||||||
validators.push(admissionController);
|
for (uint i = 0; i < bootstrapValidators.length; i++) {
|
||||||
validatorSetIndex[admissionController] = 0;
|
validators.push(bootstrapValidators[i]);
|
||||||
|
validatorSetIndex[bootstrapValidators[i]] = i;
|
||||||
|
}
|
||||||
|
|
||||||
finalized = true;
|
finalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNewAdmissionController(address newController)
|
function setNewAdmissionController(address newController) public onlyAdmissionController {
|
||||||
public
|
|
||||||
onlyAdmissionController
|
|
||||||
{
|
|
||||||
emit NewAdmissionController(admissionController, newController);
|
emit NewAdmissionController(admissionController, newController);
|
||||||
admissionController = newController;
|
admissionController = newController;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValidators() public view returns (address[] memory) {
|
function getValidators() public view returns(address[] memory) {
|
||||||
return validators;
|
return validators;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initiateChange() private {
|
function initiateChange() private {
|
||||||
finalized = false;
|
finalized = false;
|
||||||
emit InitiateChange(blockhash(block.number - 1), getValidators());
|
emit InitiateChange(blockhash(block.number - 1), getValidators());
|
||||||
}
|
}
|
||||||
|
|
||||||
function finalizeChange() public onlySystemChange {
|
function finalizeChange() public {
|
||||||
finalized = true;
|
finalized = true;
|
||||||
emit ChangeFinalized(validators);
|
emit ChangeFinalized(validators);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addValidator(address newValidator)
|
|
||||||
public
|
function addValidator(address newValidator) public onlyAdmissionController alreadyFinalized{
|
||||||
onlyAdmissionController
|
|
||||||
alreadyFinalized
|
|
||||||
{
|
|
||||||
validators.push(newValidator);
|
validators.push(newValidator);
|
||||||
validatorSetIndex[newValidator] = validators.length - 1;
|
validatorSetIndex[newValidator] = validators.length - 1;
|
||||||
initiateChange();
|
initiateChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeValidator(address exValidator)
|
function removeValidator(address exValidator) public onlyAdmissionController alreadyFinalized{
|
||||||
public
|
|
||||||
onlyAdmissionController
|
|
||||||
alreadyFinalized
|
|
||||||
{
|
|
||||||
orderedRemoval(validatorSetIndex[exValidator]);
|
orderedRemoval(validatorSetIndex[exValidator]);
|
||||||
delete validatorSetIndex[exValidator];
|
delete validatorSetIndex[exValidator];
|
||||||
initiateChange();
|
initiateChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
function orderedRemoval(uint256 index) private {
|
function orderedRemoval(uint index) private {
|
||||||
for (uint256 i = index; i < validators.length - 1; i++) {
|
for(uint i = index; i < validators.length-1; i++){
|
||||||
validators[i] = validators[i + 1];
|
validators[i] = validators[i+1];
|
||||||
}
|
}
|
||||||
validators.pop();
|
validators.pop();
|
||||||
}
|
}
|
||||||
|
200
openethereum/kitabu.json
Normal file
200
openethereum/kitabu.json
Normal file
File diff suppressed because one or more lines are too long
57
openethereum/kitabu.toml
Normal file
57
openethereum/kitabu.toml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# File bootnode.toml
|
||||||
|
# enode://2e7f60d1c95e4e5bb0b8e0b60dc2c093d7c270bc80ac9cddf185b33fb59321fb26353d43ef4a623b33f42e90cfdf8dbe0616bb1f6a2ca6189a038f4525146316@159.223.42.214:30303
|
||||||
|
|
||||||
|
[parity]
|
||||||
|
chain = "/root/chain-1/kitabu.json"
|
||||||
|
base_path = "/root/chain-1/.openethereum/data"
|
||||||
|
|
||||||
|
[network]
|
||||||
|
port = 30303
|
||||||
|
#reserved_peers = "/root/chain-2/bootnodes.txt"
|
||||||
|
# reserved_only = true
|
||||||
|
max_peers = 10
|
||||||
|
snapshot_peers = 25
|
||||||
|
nat = "extip:178.128.93.108"
|
||||||
|
#nat = "extip:"
|
||||||
|
|
||||||
|
[rpc]
|
||||||
|
port = 8545
|
||||||
|
apis = [
|
||||||
|
"web3",
|
||||||
|
"eth",
|
||||||
|
"net",
|
||||||
|
"personal",
|
||||||
|
"parity",
|
||||||
|
"parity_set",
|
||||||
|
"traces",
|
||||||
|
"rpc",
|
||||||
|
"parity_accounts",
|
||||||
|
]
|
||||||
|
interface = "all"
|
||||||
|
cors = ["*"]
|
||||||
|
|
||||||
|
[websockets]
|
||||||
|
disable = false
|
||||||
|
port = 8546
|
||||||
|
interface = "all"
|
||||||
|
origins = ["all"]
|
||||||
|
|
||||||
|
[account]
|
||||||
|
password = ["/root/chain-2/kitabu.pwd"]
|
||||||
|
|
||||||
|
[mining]
|
||||||
|
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
|
||||||
|
engine_signer = "0xcC66240bAdA17eb4C6313FB3FF83e19dfB20C973"
|
||||||
|
reseal_on_txs = "none"
|
||||||
|
force_sealing = true
|
||||||
|
min_gas_price = 1
|
||||||
|
gas_floor_target = "1"
|
||||||
|
|
||||||
|
[footprint]
|
||||||
|
tracing = "on"
|
||||||
|
pruning = "archive"
|
||||||
|
pruning_history = 256
|
||||||
|
cache_size_db = 2000
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
log_file = "/root/chain-1/kitabu.log"
|
Loading…
Reference in New Issue
Block a user