From 616c6c6344143d9da96f8166409aa70814bd481d Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Mon, 31 Jan 2022 15:19:49 +0300 Subject: [PATCH] update: kitabu confs --- contracts/validators/KitabuValidators.sol | 82 ++++----- openethereum/kitabu.json | 200 ++++++++++++++++++++++ openethereum/kitabu.toml | 57 ++++++ 3 files changed, 294 insertions(+), 45 deletions(-) create mode 100644 openethereum/kitabu.json create mode 100644 openethereum/kitabu.toml diff --git a/contracts/validators/KitabuValidators.sol b/contracts/validators/KitabuValidators.sol index 4f3336e..5f722dd 100644 --- a/contracts/validators/KitabuValidators.sol +++ b/contracts/validators/KitabuValidators.sol @@ -1,93 +1,85 @@ // Author: Mohamed Sohail // 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(); } diff --git a/openethereum/kitabu.json b/openethereum/kitabu.json new file mode 100644 index 0000000..7908436 --- /dev/null +++ b/openethereum/kitabu.json @@ -0,0 +1,200 @@ +{ + "name": "Kitabu Sarafu", + "dataDir": "kitabu_sarafu", + "engine": { + "authorityRound": { + "params": { + "stepDuration": 5, + "maximumUncleCountTransition": 0, + "maximumUncleCount": 0, + "validators": { + "safeContract": "0x000000000000000000000000000000000000000a" + } + } + } + }, + "params": { + "accountStartNonce": "0x0", + "chainID": "0x13ba", + "eip140Transition": "0x0", + "eip145Transition": "0x0", + "eip150Transition": "0x0", + "eip155Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip658Transition": "0x0", + "eip1014Transition": "0x0", + "eip1052Transition": "0x0", + "eip1283Transition": "0x0", + "eip1283DisableTransition": "0x0", + "eip1283ReenableTransition": "0x0", + "eip1344Transition": "0x0", + "eip1706Transition": "0x0", + "eip1884Transition": "0x0", + "eip2028Transition": "0x0", + "eip1559Transition": "0x1", + "eip1559BaseFeeMaxChangeDenominator": "0x8", + "eip1559ElasticityMultiplier": "0x2", + "gasLimitBoundDivisor": "0x400", + "maxCodeSize": "0x6000", + "maxCodeSizeTransition": "0x0", + "maximumExtraDataSize": "0xffff", + "minGasLimit": "0x44aa20", + "networkID": "0x13ba" + }, + "genesis": { + "seal": { + "authorityRound": { + "step": "0x0", + "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + }, + "difficulty": "0x2", + "gasLimit": "0x44aa20" + }, + "accounts": { + "0x0000000000000000000000000000000000000000": { + "balance": "0x1" + }, + "0x0000000000000000000000000000000000000001": { + "balance": "0x1", + "builtin": { + "name": "ecrecover", + "pricing": { + "linear": { + "base": 3000, + "word": 0 + } + } + } + }, + "0x0000000000000000000000000000000000000002": { + "balance": "0x1", + "builtin": { + "name": "sha256", + "pricing": { + "linear": { + "base": 60, + "word": 12 + } + } + } + }, + "0x0000000000000000000000000000000000000003": { + "balance": "0x1", + "builtin": { + "name": "ripemd160", + "pricing": { + "linear": { + "base": 600, + "word": 120 + } + } + } + }, + "0x0000000000000000000000000000000000000004": { + "balance": "0x1", + "builtin": { + "name": "identity", + "pricing": { + "linear": { + "base": 15, + "word": 3 + } + } + } + }, + "0x0000000000000000000000000000000000000005": { + "balance": "0x1", + "builtin": { + "name": "modexp", + "pricing": { + "0x0": { + "info": "EIP-198: Big integer modular exponentiation. Byzantium hardfork", + "price": { + "modexp": { + "divisor": 20 + } + } + }, + "0x441064": { + "info": "EIP-2565: ModExp Gas Cost. Berlin hardfork (4_460_644)", + "price": { + "modexp2565": {} + } + } + } + } + }, + "0x0000000000000000000000000000000000000006": { + "balance": "0x1", + "builtin": { + "name": "alt_bn128_add", + "pricing": { + "0": { + "price": { "alt_bn128_const_operations": { "price": 500 } } + }, + "0x17d433": { + "info": "EIP 1108 transition at block 1_561_651 (0x17d433)", + "price": { "alt_bn128_const_operations": { "price": 150 } } + } + } + } + }, + "0x0000000000000000000000000000000000000007": { + "balance": "0x1", + "builtin": { + "name": "alt_bn128_mul", + "pricing": { + "0": { + "price": { "alt_bn128_const_operations": { "price": 40000 } } + }, + "0x17d433": { + "info": "EIP 1108 transition at block 1_561_651 (0x17d433)", + "price": { "alt_bn128_const_operations": { "price": 6000 } } + } + } + } + }, + "0x0000000000000000000000000000000000000008": { + "balance": "0x1", + "builtin": { + "name": "alt_bn128_pairing", + "pricing": { + "0": { + "price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } + }, + "0x17d433": { + "info": "EIP 1108 transition at block 1_561_651 (0x17d433)", + "price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 } } + } + } + } + }, + "0x0000000000000000000000000000000000000009": { + "balance": "0x1", + "builtin": { + "name": "blake2_f", + "activate_at": "0x17d433", + "pricing": { + "blake2_f": { + "gas_per_round": 1 + } + } + } + }, + "0x000000000000000000000000000000000000000a": { + "balance": "0x1", + "constructor": "0x6080604052739f57b4a25638f3bdffcb1f3d2902860601a1aa656000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040518060200160405280737c5a36cb43fc87fbb1de46eb6cfd231c2ade147b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525060019060016100b7929190610218565b503480156100c457600080fd5b5060005b6001805490508110156101f7576002600182815481106100e457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006001848154811061018157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806001019150506100c8565b506001600360006101000a81548160ff0219169083151502179055506102dd565b828054828255906000526020600020908101928215610291579160200282015b828111156102905782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190610238565b5b50905061029e91906102a2565b5090565b5b808211156102d957600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016102a3565b5090565b6108ae806102ec6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063a7873c1b1161005b578063a7873c1b14610114578063b3f05b9714610148578063b7ab4db514610168578063f559ae80146101c75761007d565b806340a141ff146100825780634d238c8e146100c6578063752862111461010a575b600080fd5b6100c46004803603602081101561009857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061020b565b005b610108600480360360208110156100dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610312565b005b61011261043d565b005b61011c610506565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61015061052a565b60405180821515815260200191505060405180910390f35b61017061053d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101b3578082015181840152602081019050610198565b505050509050019250505060405180910390f35b610209600480360360208110156101dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105cb565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461026357600080fd5b600360009054906101000a900460ff1661027c57600080fd5b6102c4600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106e0565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000905561030f6107d7565b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461036a57600080fd5b600360009054906101000a900460ff1661038357600080fd5b6002819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160028054905003600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061043a6107d7565b50565b6001600360006101000a81548160ff0219169083151502179055507f8564cd629b15f47dc310d45bcbfc9bcf5420b0d51bf0659a16c67f91d27632536002604051808060200182810382528381815481526020019150805480156104f657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116104ac575b50509250505060405180910390a1565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900460ff1681565b606060028054806020026020016040519081016040528092919081815260200182805480156105c157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610577575b5050505050905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461062357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f39487b135b88702be9a144e7066245bf92d7fac0f685ddcf8e721cabfa5a912760405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008190505b600160028054905003811015610793576002600182018154811061070657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166002828154811061073e57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080806001019150506106e6565b50600280548061079f57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055905550565b6000600360006101000a81548160ff02191690831515021790555060014303407f55252fa6eee4741b4e24a74a70e9c11fd2c2281df8d6ea13126ff845f7825c8961082061053d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610863578082015181840152602081019050610848565b505050509050019250505060405180910390a256fea2646970667358221220080a3bba80f6165d0b3f004bffcad691d21130a87d4ebfab233915de4c85c56764736f6c634300060c0033" + }, + "0x77Bea3320Fa46aFF3C7c128B83F5E436596Ba73D": { + "balance": "0x204fce5e3e25026110000000" + }, + "0x9F57B4A25638F3bdfFcB1F3d2902860601a1Aa65": { + "balance": "0x204fce5e3e25026110000000" + } + } +} diff --git a/openethereum/kitabu.toml b/openethereum/kitabu.toml new file mode 100644 index 0000000..7ca401c --- /dev/null +++ b/openethereum/kitabu.toml @@ -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"