diff --git a/ethcore/res/validator_contract.json b/ethcore/res/validator_contract.json index 5bb5d8e9b29..4bf120b5470 100644 --- a/ethcore/res/validator_contract.json +++ b/ethcore/res/validator_contract.json @@ -35,7 +35,7 @@ "0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, "0000000000000000000000000000000000000005": { "balance": "1", - "constructor": "0x60a06040819052737d577a597b2742b498cb5cf0c26cdcd726d39e6e60609081527382a978b3f5962a5b0957d9ee9eef472ee55b42f1608052600080546002825581805290927f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639182019291905b828111156100a25782518254600160a060020a031916600160a060020a0390911617825560209092019160019091019061006d565b5b506100cd9291505b808211156100c9578054600160a060020a03191681556001016100ab565b5090565b505034610000575b610332806100e46000396000f300606060405263ffffffff60e060020a60003504166335aa2e44811461004557806380a02a41146100715780639112f55c1461008c578063ea0564861461009e575b610000565b3461000057610055600435610106565b60408051600160a060020a039092168252519081900360200190f35b346100005761008a600160a060020a0360043516610136565b005b346100005761008a6004356101ad565b005b34610000576100ab61029c565b60408051602080825283518183015283519192839290830191858101910280838382156100f3575b8051825260208311156100f357601f1990920191602091820191016100d3565b5050509050019250505060405180910390f35b600081815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054806001018281815481835581811511610178576000838152602090206101789181019083015b808211156101745760008155600101610160565b5090565b5b505050916000526020600020900160005b8154600160a060020a038086166101009390930a92830292021916179055505b50565b6000805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600082815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506000600160008054905003815481101561000057906000526020600020900160005b6101000a815490600160a060020a0302191690556000805480919060019003815481835581811511610293576000838152602090206102939181019083015b808211156101745760008155600101610160565b5090565b5b505050505b50565b60408051602081810183526000808352805484518184028101840190955280855292939290918301828280156102fb57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116102dd575b505050505090505b905600a165627a7a723058200c52661ec16b59726ce62645c05e4e40ece30b50946af735411313f10637403e0029" + "constructor": "0x60a06040819052737d577a597b2742b498cb5cf0c26cdcd726d39e6e60609081527382a978b3f5962a5b0957d9ee9eef472ee55b42f1608052600080546002825581805290927f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5639182019291905b828111156100a25782518254600160a060020a031916600160a060020a0390911617825560209092019160019091019061006d565b5b506100cd9291505b808211156100c9578054600160a060020a03191681556001016100ab565b5090565b505034610000575b610332806100e46000396000f300606060405263ffffffff60e060020a60003504166335aa2e4481146100455780634d238c8e14610071578063b7ab4db51461008c578063f94e1867146100f4575b610000565b3461000057610055600435610106565b60408051600160a060020a039092168252519081900360200190f35b346100005761008a600160a060020a0360043516610136565b005b34610000576100996101ad565b60408051602080825283518183015283519192839290830191858101910280838382156100e1575b8051825260208311156100e157601f1990920191602091820191016100c1565b5050509050019250505060405180910390f35b346100005761008a600435610217565b005b600081815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054806001018281815481835581811511610178576000838152602090206101789181019083015b808211156101745760008155600101610160565b5090565b5b505050916000526020600020900160005b8154600160a060020a038086166101009390930a92830292021916179055505b50565b604080516020818101835260008083528054845181840281018401909552808552929392909183018282801561020c57602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116101ee575b505050505090505b90565b6000805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600082815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506000600160008054905003815481101561000057906000526020600020900160005b6101000a815490600160a060020a03021916905560008054809190600190038154818355818115116102fd576000838152602090206102fd9181019083015b808211156101745760008155600101610160565b5090565b5b505050505b505600a165627a7a72305820d742dd391941c1c255f0e1187ffa5b1e783219264fb10196018aefa379f5638b0029" }, "9cce34f7ab185c7aba1b7c8140d620b4bda941d6": { "balance": "1606938044258990275541962092341162602522202993782792835301376" } } diff --git a/ethcore/src/engines/validator_set/contract.rs b/ethcore/src/engines/validator_set/contract.rs index de1f662a5df..ce7452c8c71 100644 --- a/ethcore/src/engines/validator_set/contract.rs +++ b/ethcore/src/engines/validator_set/contract.rs @@ -24,7 +24,7 @@ use super::ValidatorSet; use super::simple_list::SimpleList; /// The validator contract should have the following interface: -/// [{"constant":true,"inputs":[],"name":"get_validators","outputs":[{"name":"","type":"address[]"}],"payable":false,"type":"function"}] +/// [{"constant":true,"inputs":[],"name":"getValidators","outputs":[{"name":"","type":"address[]"}],"payable":false,"type":"function"}] pub struct ValidatorContract { address: Address, validators: RwLock, @@ -97,14 +97,12 @@ impl ValidatorSet for Arc { mod provider { // Autogenerated from JSON contract definition using Rust contract convertor. - #![allow(unused_imports)] use std::string::String; use std::result::Result; use std::fmt; use {util, ethabi}; use util::{FixedHash, Uint}; - use util::ToPretty; pub struct Contract { contract: ethabi::Contract, @@ -114,17 +112,17 @@ mod provider { impl Contract { pub fn new(address: util::Address, do_call: F) -> Self where F: Fn(util::Address, Vec) -> Result, String> + Send + Sync + 'static { Contract { - contract: ethabi::Contract::new(ethabi::Interface::load(b"[{\"constant\":true,\"inputs\":[],\"name\":\"get_validators\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"type\":\"function\"}]").expect("JSON is autogenerated; qed")), + contract: ethabi::Contract::new(ethabi::Interface::load(b"[{\"constant\":true,\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"name\":\"\",\"type\":\"address[]\"}],\"payable\":false,\"type\":\"function\"}]").expect("JSON is autogenerated; qed")), address: address, do_call: Box::new(do_call), } } fn as_string(e: T) -> String { format!("{:?}", e) } - /// Auto-generated from: `{"constant":true,"inputs":[],"name":"get_validators","outputs":[{"name":"","type":"address[]"}],"payable":false,"type":"function"}` + /// Auto-generated from: `{"constant":true,"inputs":[],"name":"getValidators","outputs":[{"name":"","type":"address[]"}],"payable":false,"type":"function"}` #[allow(dead_code)] pub fn get_validators(&self) -> Result, String> { - let call = self.contract.function("get_validators".into()).map_err(Self::as_string)?; + let call = self.contract.function("getValidators".into()).map_err(Self::as_string)?; let data = call.encode_call( vec![] ).map_err(Self::as_string)?; @@ -179,7 +177,7 @@ mod tests { gas: 500_000.into(), action: Action::Call(validator_contract), value: 0.into(), - data: "9112f55c0000000000000000000000000000000000000000000000000000000000000001".from_hex().unwrap(), + data: "f94e18670000000000000000000000000000000000000000000000000000000000000001".from_hex().unwrap(), }.sign(&"1".sha3(), None); client.miner().import_own_transaction(client.as_ref(), tx.into()).unwrap(); client.update_sealing(); @@ -191,7 +189,7 @@ mod tests { gas: 500_000.into(), action: Action::Call(validator_contract), value: 0.into(), - data: "80a02a4100000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1".from_hex().unwrap(), + data: "4d238c8e00000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1".from_hex().unwrap(), }.sign(&"1".sha3(), None); client.miner().import_own_transaction(client.as_ref(), tx.into()).unwrap(); client.update_sealing(); diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index 6baba0d0947..b3780d2f7fd 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -339,7 +339,7 @@ impl Spec { /// Create a new Spec with BasicAuthority which uses a contract at address 5 to determine the current validators. /// Accounts with secrets "0".sha3() and "1".sha3() are initially the validators. - /// Second validator can be removed with "0x9112f55c0000000000000000000000000000000000000000000000000000000000000001" and added back in using "0x80a02a4100000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1". + /// Second validator can be removed with "0xf94e18670000000000000000000000000000000000000000000000000000000000000001" and added back in using "0x4d238c8e00000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1". pub fn new_validator_contract() -> Self { load_bundled!("validator_contract") } /// Create a new Spec with Tendermint consensus which does internal sealing (not requiring work). diff --git a/scripts/contractABI.js b/scripts/contractABI.js index f021c728cc4..4ecdd2543c0 100644 --- a/scripts/contractABI.js +++ b/scripts/contractABI.js @@ -223,7 +223,7 @@ function convertFunction(json, _prefs) { }`; } -let jsonabi = [{"constant":true,"inputs":[],"name":"get_validators","outputs":[{"name":"","type":"address[]"}],"payable":false,"type":"function"}]; +let jsonabi = [{"constant":true,"inputs":[],"name":"getValidators","outputs":[{"name":"","type":"address[]"}],"payable":false,"type":"function"}]; let out = makeContractFile("Contract", jsonabi, {"_pub": true, "_": {"_client": {"string": true}, "_platform": {"string": true}}, "_sync": true}); console.log(`${out}`);