update: kitabu confs
This commit is contained in:
parent
43535882dc
commit
616c6c6344
@ -1,93 +1,85 @@
|
||||
// Author: Mohamed Sohail <mohamedsohailazim@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
pragma solidity >=0.6.12;
|
||||
pragma solidity >= 0.6.12;
|
||||
|
||||
contract KitabuValidators {
|
||||
address constant SYSTEM_ADDRESS =
|
||||
0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
|
||||
address public admissionController =
|
||||
0x9F57B4A25638F3bdfFcB1F3d2902860601a1Aa65;
|
||||
address constant SYSTEM_ADDRESS = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
|
||||
address public admissionController = 0x9F57B4A25638F3bdfFcB1F3d2902860601a1Aa65;
|
||||
|
||||
address[] bootstrapValidators = [
|
||||
0x7c5a36Cb43fC87fbB1de46eb6Cfd231c2ADe147b
|
||||
];
|
||||
|
||||
address[] validators;
|
||||
|
||||
bool public finalized;
|
||||
|
||||
mapping(address => uint256) validatorSetIndex;
|
||||
|
||||
event NewAdmissionController(
|
||||
address indexed old,
|
||||
address indexed newController
|
||||
);
|
||||
|
||||
event NewAdmissionController(address indexed old, address indexed newController);
|
||||
event InitiateChange(bytes32 indexed parentHash, address[] newSet);
|
||||
event ChangeFinalized(address[] currentSet);
|
||||
|
||||
modifier onlySystemChange() {
|
||||
modifier onlySystemChange {
|
||||
require(msg.sender == SYSTEM_ADDRESS);
|
||||
_;
|
||||
}
|
||||
}
|
||||
|
||||
modifier alreadyFinalized() {
|
||||
modifier alreadyFinalized {
|
||||
require(finalized);
|
||||
_;
|
||||
}
|
||||
}
|
||||
|
||||
modifier onlyAdmissionController() {
|
||||
modifier onlyAdmissionController {
|
||||
require(msg.sender == admissionController);
|
||||
_;
|
||||
}
|
||||
}
|
||||
|
||||
constructor() public {
|
||||
validators.push(admissionController);
|
||||
validatorSetIndex[admissionController] = 0;
|
||||
for (uint i = 0; i < bootstrapValidators.length; i++) {
|
||||
validators.push(bootstrapValidators[i]);
|
||||
validatorSetIndex[bootstrapValidators[i]] = i;
|
||||
}
|
||||
|
||||
finalized = true;
|
||||
}
|
||||
|
||||
function setNewAdmissionController(address newController)
|
||||
public
|
||||
onlyAdmissionController
|
||||
{
|
||||
function setNewAdmissionController(address newController) public onlyAdmissionController {
|
||||
emit NewAdmissionController(admissionController, newController);
|
||||
admissionController = newController;
|
||||
}
|
||||
|
||||
function getValidators() public view returns (address[] memory) {
|
||||
return validators;
|
||||
}
|
||||
function getValidators() public view returns(address[] memory) {
|
||||
return validators;
|
||||
}
|
||||
|
||||
function initiateChange() private {
|
||||
finalized = false;
|
||||
emit InitiateChange(blockhash(block.number - 1), getValidators());
|
||||
}
|
||||
finalized = false;
|
||||
emit InitiateChange(blockhash(block.number - 1), getValidators());
|
||||
}
|
||||
|
||||
function finalizeChange() public onlySystemChange {
|
||||
function finalizeChange() public {
|
||||
finalized = true;
|
||||
emit ChangeFinalized(validators);
|
||||
}
|
||||
|
||||
function addValidator(address newValidator)
|
||||
public
|
||||
onlyAdmissionController
|
||||
alreadyFinalized
|
||||
{
|
||||
|
||||
function addValidator(address newValidator) public onlyAdmissionController alreadyFinalized{
|
||||
validators.push(newValidator);
|
||||
validatorSetIndex[newValidator] = validators.length - 1;
|
||||
initiateChange();
|
||||
}
|
||||
initiateChange();
|
||||
}
|
||||
|
||||
function removeValidator(address exValidator)
|
||||
public
|
||||
onlyAdmissionController
|
||||
alreadyFinalized
|
||||
{
|
||||
function removeValidator(address exValidator) public onlyAdmissionController alreadyFinalized{
|
||||
orderedRemoval(validatorSetIndex[exValidator]);
|
||||
delete validatorSetIndex[exValidator];
|
||||
initiateChange();
|
||||
}
|
||||
}
|
||||
|
||||
function orderedRemoval(uint256 index) private {
|
||||
for (uint256 i = index; i < validators.length - 1; i++) {
|
||||
validators[i] = validators[i + 1];
|
||||
function orderedRemoval(uint index) private {
|
||||
for(uint i = index; i < validators.length-1; i++){
|
||||
validators[i] = validators[i+1];
|
||||
}
|
||||
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