From ec65195281607256f6f8bddf7288bbf1cb156711 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 20 Sep 2017 13:03:39 +0200 Subject: [PATCH 01/33] Add musicoin chain spec. --- ethcore/res/ethereum/musicoin.json | 96 ++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 ethcore/res/ethereum/musicoin.json diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json new file mode 100644 index 00000000000..9f50ccff44f --- /dev/null +++ b/ethcore/res/ethereum/musicoin.json @@ -0,0 +1,96 @@ +{ + "name": "Musicoin", + "engine": { + "Ethash": { + "params": { + "gasLimitBoundDivisor": "0x400", + "minimumDifficulty": "0x20000", + "difficultyBoundDivisor": "0x800", + "durationLimit": "0xd", + "blockReward": "0x1105A0185B50A80000", + "registrar": "0x00756cf8159095948496617f5fb17ed95059f536", + "homesteadTransition": 9223372036854775807, + "eip150Transition": 9223372036854775807, + "eip155Transition": 9223372036854775807, + "eip160Transition": 9223372036854775807, + "eip161abcTransition": 9223372036854775807, + "eip161dTransition": 9223372036854775807 + } + } + }, + "params": { + "accountStartNonce": "0x0", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID": 7762959 + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x000000000000002a", + "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" + } + }, + "difficulty": "0x3d0900", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "", + "gasLimit": "0x7a1200" + }, + "nodes": [ +"enode://9df4a65f416195203a114534a270e42e72ef725447c575e083392f7d5264b280cc87ab173cfcc80bebae8c761624ef377a1c8f929db46440b38aff6432979b58@104.155.131.203:30301", +"enode://0bc63520e065279b523c6acdb4022446be31f3adfe92d20108bf020d5bc8cd0daff41053afa8c393d650ee2a7061687e43f144320f962d8becc1e8a669a1f6d4@104.196.200.207:30301", +"enode://f17004560aadb12b547e1b2512eee7cf29771d03bc896507a465b7b30b4803746247bb07784580f9d35696e6bd37c957ab33825527fed054ba46d83559fcd9c2@104.198.8.228:30301" +], + "accounts": { + "0000000000000000000000000000000000000001": { + "balance": "1", + "builtin": { + "name": "ecrecover", + "pricing": { + "linear": { + "base": 3000, + "word": 0 + } + } + } + }, + "0000000000000000000000000000000000000002": { + "balance": "1", + "builtin": { + "name": "sha256", + "pricing": { + "linear": { + "base": 60, + "word": 12 + } + } + } + }, + "0000000000000000000000000000000000000003": { + "balance": "1", + "builtin": { + "name": "ripemd160", + "pricing": { + "linear": { + "base": 600, + "word": 120 + } + } + } + }, + "0000000000000000000000000000000000000004": { + "balance": "1", + "builtin": { + "name": "identity", + "pricing": { + "linear": { + "base": 15, + "word": 3 + } + } + } + } + } +} From 71b51087fba8beaf7240e2bce51322deeb6512ac Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 20 Sep 2017 13:07:50 +0200 Subject: [PATCH 02/33] Add musicoin to parity node --- ethcore/src/ethereum/mod.rs | 3 +++ parity/cli/mod.rs | 2 +- parity/params.rs | 18 ++++++++++++------ rpc/src/v1/traits/parity_set.rs | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 2135ea2678e..2c5a14d2389 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -58,6 +58,9 @@ pub fn new_classic(cache_dir: &Path) -> Spec { load(cache_dir, include_bytes!(". /// Create a new Expanse mainnet chain spec. pub fn new_expanse(cache_dir: &Path) -> Spec { load(cache_dir, include_bytes!("../../res/ethereum/expanse.json")) } +/// Create a new Musicoin mainnet chain spec. +pub fn new_musicoin(cache_dir: &Path) -> Spec { load(cache_dir, include_bytes!("../../res/ethereum/musicoin.json")) } + /// Create a new Kovan testnet chain spec. pub fn new_kovan(cache_dir: &Path) -> Spec { load(cache_dir, include_bytes!("../../res/ethereum/kovan.json")) } diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index e181bf88d83..dc5546e4bbc 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -301,7 +301,7 @@ usage! { ARG arg_chain: (String) = "foundation", or |c: &Config| otry!(c.parity).chain.clone(), "--chain=[CHAIN]", - "Specify the blockchain type. CHAIN may be either a JSON chain specification file or olympic, frontier, homestead, mainnet, morden, ropsten, classic, expanse, testnet, kovan or dev.", + "Specify the blockchain type. CHAIN may be either a JSON chain specification file or olympic, frontier, homestead, mainnet, morden, ropsten, classic, expanse, musicoin, testnet, kovan or dev.", ARG arg_keys_path: (String) = "$BASE/keys", or |c: &Config| otry!(c.parity).keys_path.clone(), "--keys-path=[PATH]", diff --git a/parity/params.rs b/parity/params.rs index fda57f99ab5..c2c6fac0a87 100644 --- a/parity/params.rs +++ b/parity/params.rs @@ -34,7 +34,8 @@ pub enum SpecType { Kovan, Olympic, Classic, - Expanse, + Expanse, + Musicoin, Dev, Custom(String), } @@ -56,7 +57,8 @@ impl str::FromStr for SpecType { "ropsten" => SpecType::Ropsten, "kovan" | "testnet" => SpecType::Kovan, "olympic" => SpecType::Olympic, - "expanse" => SpecType::Expanse, + "expanse" => SpecType::Expanse, + "musicoin" => SpecType::Musicoin, "dev" => SpecType::Dev, other => SpecType::Custom(other.into()), }; @@ -72,7 +74,8 @@ impl fmt::Display for SpecType { SpecType::Ropsten => "ropsten", SpecType::Olympic => "olympic", SpecType::Classic => "classic", - SpecType::Expanse => "expanse", + SpecType::Expanse => "expanse", + SpecType::Musicoin => "musicoin", SpecType::Kovan => "kovan", SpecType::Dev => "dev", SpecType::Custom(ref custom) => custom, @@ -89,7 +92,8 @@ impl SpecType { SpecType::Ropsten => Ok(ethereum::new_ropsten(cache_dir)), SpecType::Olympic => Ok(ethereum::new_olympic(cache_dir)), SpecType::Classic => Ok(ethereum::new_classic(cache_dir)), - SpecType::Expanse => Ok(ethereum::new_expanse(cache_dir)), + SpecType::Expanse => Ok(ethereum::new_expanse(cache_dir)), + SpecType::Musicoin => Ok(ethereum::new_musicoin(cache_dir)), SpecType::Kovan => Ok(ethereum::new_kovan(cache_dir)), SpecType::Dev => Ok(Spec::new_instant()), SpecType::Custom(ref filename) => { @@ -102,7 +106,8 @@ impl SpecType { pub fn legacy_fork_name(&self) -> Option { match *self { SpecType::Classic => Some("classic".to_owned()), - SpecType::Expanse => Some("expanse".to_owned()), + SpecType::Expanse => Some("expanse".to_owned()), + SpecType::Musicoin => Some("musicoin".to_owned()), _ => None, } } @@ -352,7 +357,8 @@ mod tests { assert_eq!(format!("{}", SpecType::Morden), "morden"); assert_eq!(format!("{}", SpecType::Olympic), "olympic"); assert_eq!(format!("{}", SpecType::Classic), "classic"); - assert_eq!(format!("{}", SpecType::Expanse), "expanse"); + assert_eq!(format!("{}", SpecType::Expanse), "expanse"); + assert_eq!(format!("{}", SpecType::Musicoin), "musicoin"); assert_eq!(format!("{}", SpecType::Kovan), "kovan"); assert_eq!(format!("{}", SpecType::Dev), "dev"); assert_eq!(format!("{}", SpecType::Custom("foo/bar".into())), "foo/bar"); diff --git a/rpc/src/v1/traits/parity_set.rs b/rpc/src/v1/traits/parity_set.rs index 15f35b67148..b8b4ebecb79 100644 --- a/rpc/src/v1/traits/parity_set.rs +++ b/rpc/src/v1/traits/parity_set.rs @@ -88,7 +88,7 @@ build_rpc_trait! { #[rpc(name = "parity_setMode")] fn set_mode(&self, String) -> Result; - /// Set the network spec. Argument must be one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse" or a filename. + /// Set the network spec. Argument must be one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse", "musicoin" or a filename. #[rpc(name = "parity_setChain")] fn set_spec_name(&self, String) -> Result; From e8d519daf31a85db790f0459b6da9cfe599cdc85 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 20 Sep 2017 14:34:25 +0200 Subject: [PATCH 03/33] Add musicoin to the wallet --- js/src/jsonrpc/interfaces/parity.js | 2 +- js/src/ui/CurrencySymbol/currencySymbol.example.js | 6 ++++++ js/src/ui/CurrencySymbol/currencySymbol.js | 4 ++++ js/src/ui/CurrencySymbol/currencySymbol.spec.js | 8 ++++++++ js/src/views/Settings/Parity/parity.js | 8 ++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/js/src/jsonrpc/interfaces/parity.js b/js/src/jsonrpc/interfaces/parity.js index b1e568d5f7d..791d52b9a75 100644 --- a/js/src/jsonrpc/interfaces/parity.js +++ b/js/src/jsonrpc/interfaces/parity.js @@ -1746,7 +1746,7 @@ export default { params: [ { type: String, - desc: 'Chain spec name, one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse" or a filename.', + desc: 'Chain spec name, one of: "foundation", "ropsten", "morden", "kovan", "olympic", "classic", "dev", "expanse", "musicoin" or a filename.', example: 'foundation' } ], diff --git a/js/src/ui/CurrencySymbol/currencySymbol.example.js b/js/src/ui/CurrencySymbol/currencySymbol.example.js index c1b56ed5cfc..1f33dbba86f 100644 --- a/js/src/ui/CurrencySymbol/currencySymbol.example.js +++ b/js/src/ui/CurrencySymbol/currencySymbol.example.js @@ -45,6 +45,12 @@ export default class CurrencySymbolExample extends Component { netChain='expanse' /> + + + + ); } diff --git a/js/src/ui/CurrencySymbol/currencySymbol.js b/js/src/ui/CurrencySymbol/currencySymbol.js index 3322b0301b7..ec7f98458ec 100644 --- a/js/src/ui/CurrencySymbol/currencySymbol.js +++ b/js/src/ui/CurrencySymbol/currencySymbol.js @@ -20,6 +20,7 @@ import { connect } from 'react-redux'; const SYMBOL_ETC = 'ETC'; const SYMBOL_ETH = 'ETH'; const SYMBOL_EXP = 'EXP'; +const SYMBOL_MUSIC = 'MUSIC'; export class CurrencySymbol extends Component { static propTypes = { @@ -45,6 +46,9 @@ export class CurrencySymbol extends Component { case 'expanse': return SYMBOL_EXP; + case 'musicoin': + return SYMBOL_MUSIC; + default: return SYMBOL_ETH; } diff --git a/js/src/ui/CurrencySymbol/currencySymbol.spec.js b/js/src/ui/CurrencySymbol/currencySymbol.spec.js index e705b5edc21..f10557bd298 100644 --- a/js/src/ui/CurrencySymbol/currencySymbol.spec.js +++ b/js/src/ui/CurrencySymbol/currencySymbol.spec.js @@ -74,6 +74,10 @@ describe('ui/CurrencySymbol', () => { expect(render('expanse').text()).equal('EXP'); }); + it('renders MUSIC for musicoin', () => { + expect(render('musicoin').text()).equal('MUSIC'); + }); + it('renders ETH as default', () => { expect(render('somethingElse').text()).equal('ETH'); }); @@ -95,5 +99,9 @@ describe('ui/CurrencySymbol', () => { it('render EXP', () => { expect(render('expanse').instance().renderSymbol()).equal('EXP'); }); + + it('render MUSIC', () => { + expect(render('musicoin').instance().renderSymbol()).equal('MUSIC'); + }); }); }); diff --git a/js/src/views/Settings/Parity/parity.js b/js/src/views/Settings/Parity/parity.js index 9cf2c4f86a8..853ba3aa193 100644 --- a/js/src/views/Settings/Parity/parity.js +++ b/js/src/views/Settings/Parity/parity.js @@ -263,6 +263,14 @@ export default class Parity extends Component { /> )) } + { + this.renderItem('musicoin', ( + + )) + } { this.renderItem('dev', ( Date: Wed, 20 Sep 2017 14:34:50 +0200 Subject: [PATCH 04/33] Add i18n for musicoin --- js/src/i18n/_default/settings.js | 1 + js/src/i18n/nl/settings.js | 1 + js/src/i18n/zh-Hant-TW/settings.js | 1 + js/src/i18n/zh/settings.js | 1 + 4 files changed, 4 insertions(+) diff --git a/js/src/i18n/_default/settings.js b/js/src/i18n/_default/settings.js index aef412b482a..29f56badb3a 100644 --- a/js/src/i18n/_default/settings.js +++ b/js/src/i18n/_default/settings.js @@ -26,6 +26,7 @@ export default { chain_classic: `Parity syncs to the Ethereum Classic network`, chain_dev: `Parity uses a local development chain`, chain_expanse: `Parity syncs to the Expanse network`, + chain_musicoin: `Parity syncs to the Musicoin network`, chain_foundation: `Parity syncs to the Ethereum network launched by the Ethereum Foundation`, chain_kovan: `Parity syncs to the Kovan test network`, chain_olympic: `Parity syncs to the Olympic test network`, diff --git a/js/src/i18n/nl/settings.js b/js/src/i18n/nl/settings.js index f436d39c652..2aedd9d9b17 100644 --- a/js/src/i18n/nl/settings.js +++ b/js/src/i18n/nl/settings.js @@ -26,6 +26,7 @@ export default { chain_classic: `Parity synchroniseert met het Ethereum Classic netwerk`, chain_dev: `Parity gebruikt een lokale ontwikkelaars chain`, chain_expanse: `Parity synchroniseert met het Expanse netwerk`, + chain_musicoin: `Parity synchroniseert met het Musicoin netwerk`, chain_foundation: `Parity synchroniseert met het Ethereum netwerk wat door de Ethereum Foundation is uitgebracht`, chain_kovan: `Parity synchroniseert met het Kovan test netwerk`, chain_olympic: `Parity synchroniseert met het Olympic test netwerk`, diff --git a/js/src/i18n/zh-Hant-TW/settings.js b/js/src/i18n/zh-Hant-TW/settings.js index 8841279dc01..1bcb38758b1 100644 --- a/js/src/i18n/zh-Hant-TW/settings.js +++ b/js/src/i18n/zh-Hant-TW/settings.js @@ -30,6 +30,7 @@ export default { chain_classic: `將Parity同步至以太坊經典網路`, // Parity syncs to the Ethereum Classic network chain_dev: `將Parity使用一條本地開發用區塊鏈`, // Parity uses a local development chain chain_expanse: `將Parity同步至Expanse網路`, // Parity syncs to the Expanse network + chain_musicoin: `將Parity同步至Musicoin網路`, // Parity syncs to the Musicoin network chain_foundation: `將Parity同步至以太坊基金會發起的以太坊網路`, // Parity syncs to the Ethereum network launched by the Ethereum Foundation chain_kovan: `將Parity同步至Kovan測試網路`, // Parity syncs to the Kovan test network chain_olympic: `將Parity同步至Olympic測試網路`, // Parity syncs to the Olympic test network diff --git a/js/src/i18n/zh/settings.js b/js/src/i18n/zh/settings.js index 4081a06d61d..752d124a1ee 100644 --- a/js/src/i18n/zh/settings.js +++ b/js/src/i18n/zh/settings.js @@ -30,6 +30,7 @@ export default { chain_classic: `将Parity同步至以太坊经典网络`, // Parity syncs to the Ethereum Classic network chain_dev: `将Parity使用一条本地开发用区块链`, // Parity uses a local development chain chain_expanse: `将Parity同步至Expanse网络`, // Parity syncs to the Expanse network + chain_musicoin: `将Parity同步至Musicoin网络`, // Parity syncs to the Musicoin network chain_foundation: `将Parity同步至以太坊基金会发起的以太坊网络`, // Parity syncs to the Ethereum network launched by the Ethereum Foundation chain_kovan: `将Parity同步至Kovan测试网络`, // Parity syncs to the Kovan test network chain_olympic: `将Parity同步至Olympic测试网络`, // Parity syncs to the Olympic test network From fef66989c37f17fd1c9c3f24fa330d33c7b1fef4 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 20 Sep 2017 16:30:38 +0200 Subject: [PATCH 05/33] Align musicoin chain spec with 1.8, ref #6134 --- ethcore/res/ethereum/musicoin.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 9f50ccff44f..27647b104e7 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -3,15 +3,11 @@ "engine": { "Ethash": { "params": { - "gasLimitBoundDivisor": "0x400", "minimumDifficulty": "0x20000", "difficultyBoundDivisor": "0x800", "durationLimit": "0xd", - "blockReward": "0x1105A0185B50A80000", - "registrar": "0x00756cf8159095948496617f5fb17ed95059f536", "homesteadTransition": 9223372036854775807, "eip150Transition": 9223372036854775807, - "eip155Transition": 9223372036854775807, "eip160Transition": 9223372036854775807, "eip161abcTransition": 9223372036854775807, "eip161dTransition": 9223372036854775807 @@ -19,10 +15,14 @@ } }, "params": { + "gasLimitBoundDivisor": "0x400", + "blockReward": "0x1105A0185B50A80000", + "registrar": "0x00756cf8159095948496617f5fb17ed95059f536", "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", - "networkID": 7762959 + "networkID": 7762959, + "eip155Transition": 9223372036854775807 }, "genesis": { "seal": { From 5dc2a337adbcc618ca2a932df97bbd993e8faaa3 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 21 Sep 2017 10:20:45 +0200 Subject: [PATCH 06/33] Update musicoin bootnodes --- ethcore/res/ethereum/musicoin.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 27647b104e7..46b93d7fdfe 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -39,9 +39,12 @@ "gasLimit": "0x7a1200" }, "nodes": [ -"enode://9df4a65f416195203a114534a270e42e72ef725447c575e083392f7d5264b280cc87ab173cfcc80bebae8c761624ef377a1c8f929db46440b38aff6432979b58@104.155.131.203:30301", -"enode://0bc63520e065279b523c6acdb4022446be31f3adfe92d20108bf020d5bc8cd0daff41053afa8c393d650ee2a7061687e43f144320f962d8becc1e8a669a1f6d4@104.196.200.207:30301", -"enode://f17004560aadb12b547e1b2512eee7cf29771d03bc896507a465b7b30b4803746247bb07784580f9d35696e6bd37c957ab33825527fed054ba46d83559fcd9c2@104.198.8.228:30301" + "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", + "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", + "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", + "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", + "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", + "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303" ], "accounts": { "0000000000000000000000000000000000000001": { From 41dfbfc72f91012d88d75f3a60426bfe6728025f Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 21 Sep 2017 12:26:43 +0200 Subject: [PATCH 07/33] Prepare MCIP-3 in musicoin chain spec. --- ethcore/res/ethereum/musicoin.json | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 46b93d7fdfe..f878f5c5179 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -6,23 +6,31 @@ "minimumDifficulty": "0x20000", "difficultyBoundDivisor": "0x800", "durationLimit": "0xd", - "homesteadTransition": 9223372036854775807, - "eip150Transition": 9223372036854775807, - "eip160Transition": 9223372036854775807, - "eip161abcTransition": 9223372036854775807, - "eip161dTransition": 9223372036854775807 + "homesteadTransition": "0x7fffffffffffff", + "eip150Transition": "0x7fffffffffffff", + "eip160Transition": "0x7fffffffffffff", + "eip161abcTransition": "0x7fffffffffffff", + "eip161dTransition": "0x7fffffffffffff", + "mcip3Transition": "0x124f80", + "mcip3MinerReward": "0xf2dc7d47f15600000", + "mcip3UbiReward": "0x1a055690d9db80000", + "mcip3DevReward": "0x3782dace9d900000" } } }, "params": { "gasLimitBoundDivisor": "0x400", - "blockReward": "0x1105A0185B50A80000", + "blockReward": "0x1105a0185b50a80000", "registrar": "0x00756cf8159095948496617f5fb17ed95059f536", "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", - "networkID": 7762959, - "eip155Transition": 9223372036854775807 + "networkID": "0x76740f", + "forkBlock": "0x5b6", + "forkCanonHash": "0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", + "eip155Transition": "0x7fffffffffffff", + "eip98Transition": "0x7fffffffffffff", + "eip86Transition": "0x7fffffffffffff" }, "genesis": { "seal": { @@ -45,7 +53,10 @@ "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303" -], + "enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303", + "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", + "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" + ], "accounts": { "0000000000000000000000000000000000000001": { "balance": "1", From 2c2ed16187ac16a92902d912585761adca839704 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 21 Sep 2017 13:11:34 +0200 Subject: [PATCH 08/33] Update musicoin chain spec with contract addresses for MCIP-3 --- ethcore/res/ethereum/classic.json | 2 -- ethcore/res/ethereum/musicoin.json | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ethcore/res/ethereum/classic.json b/ethcore/res/ethereum/classic.json index bfd64248e90..c4d87b233fb 100644 --- a/ethcore/res/ethereum/classic.json +++ b/ethcore/res/ethereum/classic.json @@ -13,7 +13,6 @@ "ecip1010PauseTransition": 3000000, "ecip1010ContinueTransition": 5000000, "ecip1017EraRounds": 5000000, - "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff" } @@ -31,7 +30,6 @@ "forkBlock": "0x1d4c00", "forkCanonHash": "0x94365e3a8c0b35089c1d1195081fe7489b528a84b22199c916180db8b28ade7f", "eip155Transition": 3000000, - "eip98Transition": "0x7fffffffffffff", "eip86Transition": "0x7fffffffffffff" }, diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index f878f5c5179..c999a645f7b 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -14,7 +14,9 @@ "mcip3Transition": "0x124f80", "mcip3MinerReward": "0xf2dc7d47f15600000", "mcip3UbiReward": "0x1a055690d9db80000", - "mcip3DevReward": "0x3782dace9d900000" + "mcip3UbiContract": "0x00eFdd5883eC628983E9063c7d969fE268BBf310", + "mcip3DevReward": "0x3782dace9d900000", + "mcip3DevContract": "0x00756cF8159095948496617F5FB17ED95059f536" } } }, From d3831af88dfb6a7dcba9ccc7f74b7276a219de67 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 21 Sep 2017 13:12:12 +0200 Subject: [PATCH 09/33] Extend ethash params by MCIP-3 --- ethcore/src/ethereum/ethash.rs | 18 ++++++++++++++++++ ethcore/src/tests/helpers.rs | 6 ++++++ json/src/spec/ethash.rs | 19 +++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 91e326b6462..16fad7fa8bb 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -96,6 +96,18 @@ pub struct EthashParams { pub ecip1010_continue_transition: u64, /// Total block number for one ECIP-1017 era. pub ecip1017_era_rounds: u64, + /// Number of first block where MCIP-3 begins. + pub mcip3_transition: u64, + /// MCIP-3 Block reward coin-base for miners. + pub mcip3_miner_reward: u64, + /// MCIP-3 Block reward ubi-base for basic income. + pub mcip3_ubi_reward: u64, + /// MCIP-3 contract address for universal basic income. + pub mcip3_ubi_contract: Address, + /// MCIP-3 Block reward dev-base for dev funds. + pub mcip3_dev_reward: u64, + /// MCIP-3 contract address for the developer funds. + pub mcip3_dev_contract: Address, /// Maximum amount of code that can be deploying into a contract. pub max_code_size: u64, /// Number of first block where the max gas limit becomes effective. @@ -137,6 +149,12 @@ impl From for EthashParams { ecip1010_pause_transition: p.ecip1010_pause_transition.map_or(u64::max_value(), Into::into), ecip1010_continue_transition: p.ecip1010_continue_transition.map_or(u64::max_value(), Into::into), ecip1017_era_rounds: p.ecip1017_era_rounds.map_or(u64::max_value(), Into::into), + mcip3_transition: p.mcip3_transition.map_or(u64::max_value(), Into::into), + mcip3_miner_reward: p.mcip3_miner_reward.map_or(u64::max_value(), Into::into), + mcip3_ubi_reward: p.mcip3_ubi_reward.map_or(u64::max_value(), Into::into), + mcip3_ubi_contract: p.mcip3_ubi_contract.map_or_else(Address::new, Into::into), + mcip3_dev_reward: p.mcip3_dev_reward.map_or(u64::max_value(), Into::into), + mcip3_dev_contract: p.mcip3_dev_contract.map_or_else(Address::new, Into::into), max_code_size: p.max_code_size.map_or(u64::max_value(), Into::into), max_gas_limit_transition: p.max_gas_limit_transition.map_or(u64::max_value(), Into::into), max_gas_limit: p.max_gas_limit.map_or(U256::max_value(), Into::into), diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index f61fa9d5ac5..f4c46ea3d3c 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -420,6 +420,12 @@ pub fn get_default_ethash_params() -> EthashParams { ecip1010_pause_transition: u64::max_value(), ecip1010_continue_transition: u64::max_value(), ecip1017_era_rounds: u64::max_value(), + mcip3_transition: u64::max_value(), + mcip3_miner_reward: u64::max_value(), + mcip3_ubi_reward: u64::max_value(), + mcip3_ubi_contract: "0000000000000000000000000000000000000001".into(), + mcip3_dev_reward: u64::max_value(), + mcip3_dev_contract: "0000000000000000000000000000000000000001".into(), max_code_size: u64::max_value(), max_gas_limit_transition: u64::max_value(), max_gas_limit: U256::max_value(), diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index bfc6fe315b8..0a1b569e925 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -92,6 +92,25 @@ pub struct EthashParams { #[serde(rename="ecip1017EraRounds")] pub ecip1017_era_rounds: Option, + /// See main EthashParams docs. + #[serde(rename="mcip3Transition")] + pub mcip3_transition: Option, + /// See main EthashParams docs. + #[serde(rename="mcip3MinerReward")] + pub mcip3_miner_reward: Option, + /// See main EthashParams docs. + #[serde(rename="mcip3UbiReward")] + pub mcip3_ubi_reward: Option, + /// See main EthashParams docs. + #[serde(rename="mcip3UbiContract")] + pub mcip3_ubi_contract: Option
, + /// See main EthashParams docs. + #[serde(rename="mcip3DevReward")] + pub mcip3_dev_reward: Option, + /// See main EthashParams docs. + #[serde(rename="mcip3DevContract")] + pub mcip3_dev_contract: Option
, + /// See main EthashParams docs. #[serde(rename="maxCodeSize")] pub max_code_size: Option, From 07dbdb8a66ff9bfbbfa1b1b096ad6136e756a488 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 21 Sep 2017 13:42:00 +0200 Subject: [PATCH 10/33] Fix musicoin chain spec json --- ethcore/res/ethereum/musicoin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index c999a645f7b..1a78f39cf77 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -54,7 +54,7 @@ "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", - "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303" + "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", "enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303", "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" From 7940bf6eca19da035abc09b7765f1d8da429f7b4 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 21 Sep 2017 14:09:41 +0200 Subject: [PATCH 11/33] Use U256 for block rewards. --- ethcore/src/ethereum/ethash.rs | 12 ++++++------ ethcore/src/tests/helpers.rs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 16fad7fa8bb..591e7bde843 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -99,13 +99,13 @@ pub struct EthashParams { /// Number of first block where MCIP-3 begins. pub mcip3_transition: u64, /// MCIP-3 Block reward coin-base for miners. - pub mcip3_miner_reward: u64, + pub mcip3_miner_reward: Option, /// MCIP-3 Block reward ubi-base for basic income. - pub mcip3_ubi_reward: u64, + pub mcip3_ubi_reward: Option, /// MCIP-3 contract address for universal basic income. pub mcip3_ubi_contract: Address, /// MCIP-3 Block reward dev-base for dev funds. - pub mcip3_dev_reward: u64, + pub mcip3_dev_reward: Option, /// MCIP-3 contract address for the developer funds. pub mcip3_dev_contract: Address, /// Maximum amount of code that can be deploying into a contract. @@ -150,10 +150,10 @@ impl From for EthashParams { ecip1010_continue_transition: p.ecip1010_continue_transition.map_or(u64::max_value(), Into::into), ecip1017_era_rounds: p.ecip1017_era_rounds.map_or(u64::max_value(), Into::into), mcip3_transition: p.mcip3_transition.map_or(u64::max_value(), Into::into), - mcip3_miner_reward: p.mcip3_miner_reward.map_or(u64::max_value(), Into::into), - mcip3_ubi_reward: p.mcip3_ubi_reward.map_or(u64::max_value(), Into::into), + mcip3_miner_reward: p.mcip3_miner_reward.map(Into::into), + mcip3_ubi_reward: p.mcip3_ubi_reward.map(Into::into), mcip3_ubi_contract: p.mcip3_ubi_contract.map_or_else(Address::new, Into::into), - mcip3_dev_reward: p.mcip3_dev_reward.map_or(u64::max_value(), Into::into), + mcip3_dev_reward: p.mcip3_dev_reward.map(Into::into), mcip3_dev_contract: p.mcip3_dev_contract.map_or_else(Address::new, Into::into), max_code_size: p.max_code_size.map_or(u64::max_value(), Into::into), max_gas_limit_transition: p.max_gas_limit_transition.map_or(u64::max_value(), Into::into), diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index f4c46ea3d3c..372b99219a5 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -421,10 +421,10 @@ pub fn get_default_ethash_params() -> EthashParams { ecip1010_continue_transition: u64::max_value(), ecip1017_era_rounds: u64::max_value(), mcip3_transition: u64::max_value(), - mcip3_miner_reward: u64::max_value(), - mcip3_ubi_reward: u64::max_value(), + mcip3_miner_reward: None, + mcip3_ubi_reward: None, mcip3_ubi_contract: "0000000000000000000000000000000000000001".into(), - mcip3_dev_reward: u64::max_value(), + mcip3_dev_reward: None, mcip3_dev_contract: "0000000000000000000000000000000000000001".into(), max_code_size: u64::max_value(), max_gas_limit_transition: u64::max_value(), From 7ca83d9c668802fc70905cc3f4c10143df457a41 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Fri, 22 Sep 2017 14:23:27 +0200 Subject: [PATCH 12/33] Update musicoin registrar --- ethcore/res/ethereum/musicoin.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 1a78f39cf77..513ce875544 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -1,5 +1,6 @@ { "name": "Musicoin", + "dataDir": "musicoin", "engine": { "Ethash": { "params": { @@ -11,7 +12,7 @@ "eip160Transition": "0x7fffffffffffff", "eip161abcTransition": "0x7fffffffffffff", "eip161dTransition": "0x7fffffffffffff", - "mcip3Transition": "0x124f80", + "mcip3Transition": "0x124f81", "mcip3MinerReward": "0xf2dc7d47f15600000", "mcip3UbiReward": "0x1a055690d9db80000", "mcip3UbiContract": "0x00eFdd5883eC628983E9063c7d969fE268BBf310", @@ -23,7 +24,7 @@ "params": { "gasLimitBoundDivisor": "0x400", "blockReward": "0x1105a0185b50a80000", - "registrar": "0x00756cf8159095948496617f5fb17ed95059f536", + "registrar": "0x3bb2bb5c6c9c9b7f4ef430b47dc7e026310042ea", "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", From 1cfbea41c6fd74661e7427f14a3d8de864e9ac86 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 27 Sep 2017 21:37:21 +0200 Subject: [PATCH 13/33] Fix merge leftovers --- ethcore/src/ethereum/ethash.rs | 1 + ethcore/src/ethereum/mod.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 026e1529cec..d46790d6835 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -22,6 +22,7 @@ use hash::{KECCAK_EMPTY_LIST_RLP}; use ethash::{quick_get_difficulty, slow_hash_block_number, EthashManager, OptimizeFor}; use bigint::prelude::U256; use bigint::hash::{H256, H64}; +use util::Address; use unexpected::{OutOfBounds, Mismatch}; use block::*; use error::{BlockError, Error}; diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 5f3a1ace4fe..5f5c30d5988 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -71,7 +71,9 @@ pub fn new_expanse<'a, T: Into>>(params: T) -> Spec { } /// Create a new Musicoin mainnet chain spec. -pub fn new_musicoin(cache_dir: &Path) -> Spec { load(cache_dir, include_bytes!("../../res/ethereum/musicoin.json")) } +pub fn new_musicoin<'a, T: Into>>(params: T) -> Spec { + load(params.into(), include_bytes!("../../res/ethereum/musicoin.json")) +} /// Create a new Kovan testnet chain spec. pub fn new_kovan<'a, T: Into>>(params: T) -> Spec { From 77a3ba85c9fefd0ba637e44720ad6ba684d57e57 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 27 Sep 2017 21:37:51 +0200 Subject: [PATCH 14/33] Update musicoin chain spec for latest master --- ethcore/res/ethereum/musicoin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 513ce875544..0676d3c46ef 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -12,6 +12,7 @@ "eip160Transition": "0x7fffffffffffff", "eip161abcTransition": "0x7fffffffffffff", "eip161dTransition": "0x7fffffffffffff", + "blockReward": "0x1105a0185b50a80000", "mcip3Transition": "0x124f81", "mcip3MinerReward": "0xf2dc7d47f15600000", "mcip3UbiReward": "0x1a055690d9db80000", @@ -23,7 +24,6 @@ }, "params": { "gasLimitBoundDivisor": "0x400", - "blockReward": "0x1105a0185b50a80000", "registrar": "0x3bb2bb5c6c9c9b7f4ef430b47dc7e026310042ea", "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", From f292915e547434e56a1f015b317f4166a411c275 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 27 Sep 2017 22:17:13 +0200 Subject: [PATCH 15/33] Bestow MCIP-3 block reward(s). --- ethcore/src/ethereum/ethash.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index d46790d6835..32c3d663eba 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -205,24 +205,39 @@ impl Engine for Arc { let author = *LiveBlock::header(&*block).author(); let number = LiveBlock::header(&*block).number(); + // Assumes EIP-649 and MCIP-3 are mutual exclusive let reward = if number >= self.ethash_params.eip649_transition { self.ethash_params.eip649_reward.unwrap_or(self.ethash_params.block_reward) + } else if number >= self.ethash_params.mcip3_transition { + self.ethash_params.mcip3_miner_reward.unwrap_or(self.ethash_params.block_reward) } else { self.ethash_params.block_reward }; + // Applies ECIP-1017 eras. let eras_rounds = self.ethash_params.ecip1017_era_rounds; let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, reward, number); let n_uncles = LiveBlock::uncles(&*block).len(); - // Bestow block reward + // Bestow block rewards. let result_block_reward = reward + reward.shr(5) * U256::from(n_uncles); let mut uncle_rewards = Vec::with_capacity(n_uncles); self.machine.add_balance(block, &author, &result_block_reward)?; - // bestow uncle rewards. + // Bestow additional MCIP-3 rewards. + if number >= self.ethash_params.mcip3_transition { + let ubi_contract = self.ethash_params.mcip3_ubi_contract; + let ubi_reward = self.ethash_params.mcip3_ubi_reward.unwrap(); + self.machine.add_balance(block, &ubi_contract, &ubi_reward?; + + let dev_contract = self.ethash_params.mcip3_dev_contract; + let dev_reward = self.ethash_params.mcip3_dev_reward.unwrap(); + self.machine.add_balance(block, &dev_contract, &dev_reward?; + } + + // Bestow uncle rewards. for u in LiveBlock::uncles(&*block) { let uncle_author = u.author(); let result_uncle_reward = if eras == 0 { @@ -238,7 +253,7 @@ impl Engine for Arc { self.machine.add_balance(block, a, reward)?; } - // note and trace. + // Note and trace. self.machine.note_rewards(block, &[(author, result_block_reward)], &uncle_rewards) } From 44ca37f6eda3eaef7074befa1c2a003b36264bf1 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Thu, 28 Sep 2017 11:48:47 +0200 Subject: [PATCH 16/33] Update musicoin registry once and for all --- ethcore/res/ethereum/musicoin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 513ce875544..331b05af048 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -24,7 +24,7 @@ "params": { "gasLimitBoundDivisor": "0x400", "blockReward": "0x1105a0185b50a80000", - "registrar": "0x3bb2bb5c6c9c9b7f4ef430b47dc7e026310042ea", + "registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D", "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", From 939354cefe1b9907647bbb429782c84b02180b1a Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Fri, 29 Sep 2017 21:12:33 +0200 Subject: [PATCH 17/33] Align MCIP-3 block reward with go implementation --- ethcore/res/ethereum/mcip3_test.json | 113 +++++++++++++++++++++++++++ ethcore/src/ethereum/ethash.rs | 17 ++-- 2 files changed, 121 insertions(+), 9 deletions(-) create mode 100644 ethcore/res/ethereum/mcip3_test.json diff --git a/ethcore/res/ethereum/mcip3_test.json b/ethcore/res/ethereum/mcip3_test.json new file mode 100644 index 00000000000..d3d143d16d7 --- /dev/null +++ b/ethcore/res/ethereum/mcip3_test.json @@ -0,0 +1,113 @@ +{ + "name": "MCIP3 Test", + "dataDir": "mcip3test", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x20000", + "difficultyBoundDivisor": "0x800", + "durationLimit": "0xd", + "homesteadTransition": "0x7fffffffffffff", + "eip150Transition": "0x7fffffffffffff", + "eip160Transition": "0x7fffffffffffff", + "eip161abcTransition": "0x7fffffffffffff", + "eip161dTransition": "0x7fffffffffffff", + "blockReward": "0x1105a0185b50a80000", + "mcip3Transition": "0xb", + "mcip3MinerReward": "0xf2dc7d47f15600000", + "mcip3UbiReward": "0x1a055690d9db80000", + "mcip3UbiContract": "0x00eFdd5883eC628983E9063c7d969fE268BBf310", + "mcip3DevReward": "0x3782dace9d900000", + "mcip3DevContract": "0x00756cF8159095948496617F5FB17ED95059f536" + } + } + }, + "params": { + "gasLimitBoundDivisor": "0x400", + "registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D", + "accountStartNonce": "0x0", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID": "0x76740b", + "forkBlock": "0x5b6", + "forkCanonHash": "0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", + "eip155Transition": "0x7fffffffffffff", + "eip98Transition": "0x7fffffffffffff", + "eip86Transition": "0x7fffffffffffff" + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x000000000000002a", + "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" + } + }, + "difficulty": "0x3d0900", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "", + "gasLimit": "0x7a1200" + }, + "nodes": [ + "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", + "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", + "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", + "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", + "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", + "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", + "enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303", + "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", + "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" + ], + "accounts": { + "0000000000000000000000000000000000000001": { + "balance": "1", + "builtin": { + "name": "ecrecover", + "pricing": { + "linear": { + "base": 3000, + "word": 0 + } + } + } + }, + "0000000000000000000000000000000000000002": { + "balance": "1", + "builtin": { + "name": "sha256", + "pricing": { + "linear": { + "base": 60, + "word": 12 + } + } + } + }, + "0000000000000000000000000000000000000003": { + "balance": "1", + "builtin": { + "name": "ripemd160", + "pricing": { + "linear": { + "base": 600, + "word": 120 + } + } + } + }, + "0000000000000000000000000000000000000004": { + "balance": "1", + "builtin": { + "name": "identity", + "pricing": { + "linear": { + "base": 15, + "word": 3 + } + } + } + } + } +} diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 32c3d663eba..d5c0b6dd16e 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -205,11 +205,9 @@ impl Engine for Arc { let author = *LiveBlock::header(&*block).author(); let number = LiveBlock::header(&*block).number(); - // Assumes EIP-649 and MCIP-3 are mutual exclusive + // Applies EIP-649 reward. let reward = if number >= self.ethash_params.eip649_transition { self.ethash_params.eip649_reward.unwrap_or(self.ethash_params.block_reward) - } else if number >= self.ethash_params.mcip3_transition { - self.ethash_params.mcip3_miner_reward.unwrap_or(self.ethash_params.block_reward) } else { self.ethash_params.block_reward }; @@ -224,17 +222,18 @@ impl Engine for Arc { let result_block_reward = reward + reward.shr(5) * U256::from(n_uncles); let mut uncle_rewards = Vec::with_capacity(n_uncles); - self.machine.add_balance(block, &author, &result_block_reward)?; - - // Bestow additional MCIP-3 rewards. if number >= self.ethash_params.mcip3_transition { + let miner_reward = self.ethash_params.mcip3_miner_reward.unwrap(); let ubi_contract = self.ethash_params.mcip3_ubi_contract; let ubi_reward = self.ethash_params.mcip3_ubi_reward.unwrap(); - self.machine.add_balance(block, &ubi_contract, &ubi_reward?; - let dev_contract = self.ethash_params.mcip3_dev_contract; let dev_reward = self.ethash_params.mcip3_dev_reward.unwrap(); - self.machine.add_balance(block, &dev_contract, &dev_reward?; + + self.machine.add_balance(block, &author, &miner_reward)?; + self.machine.add_balance(block, &ubi_contract, &ubi_reward)?; + self.machine.add_balance(block, &dev_contract, &dev_reward)?; + } else { + self.machine.add_balance(block, &author, &result_block_reward)?; } // Bestow uncle rewards. From 36a852a719b53895f6dde26eb07e35e0c8b56916 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Fri, 29 Sep 2017 21:24:34 +0200 Subject: [PATCH 18/33] Remove mcip3 test chain spec from repository --- ethcore/res/ethereum/mcip3_test.json | 113 --------------------------- 1 file changed, 113 deletions(-) delete mode 100644 ethcore/res/ethereum/mcip3_test.json diff --git a/ethcore/res/ethereum/mcip3_test.json b/ethcore/res/ethereum/mcip3_test.json deleted file mode 100644 index d3d143d16d7..00000000000 --- a/ethcore/res/ethereum/mcip3_test.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "MCIP3 Test", - "dataDir": "mcip3test", - "engine": { - "Ethash": { - "params": { - "minimumDifficulty": "0x20000", - "difficultyBoundDivisor": "0x800", - "durationLimit": "0xd", - "homesteadTransition": "0x7fffffffffffff", - "eip150Transition": "0x7fffffffffffff", - "eip160Transition": "0x7fffffffffffff", - "eip161abcTransition": "0x7fffffffffffff", - "eip161dTransition": "0x7fffffffffffff", - "blockReward": "0x1105a0185b50a80000", - "mcip3Transition": "0xb", - "mcip3MinerReward": "0xf2dc7d47f15600000", - "mcip3UbiReward": "0x1a055690d9db80000", - "mcip3UbiContract": "0x00eFdd5883eC628983E9063c7d969fE268BBf310", - "mcip3DevReward": "0x3782dace9d900000", - "mcip3DevContract": "0x00756cF8159095948496617F5FB17ED95059f536" - } - } - }, - "params": { - "gasLimitBoundDivisor": "0x400", - "registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D", - "accountStartNonce": "0x0", - "maximumExtraDataSize": "0x20", - "minGasLimit": "0x1388", - "networkID": "0x76740b", - "forkBlock": "0x5b6", - "forkCanonHash": "0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", - "eip155Transition": "0x7fffffffffffff", - "eip98Transition": "0x7fffffffffffff", - "eip86Transition": "0x7fffffffffffff" - }, - "genesis": { - "seal": { - "ethereum": { - "nonce": "0x000000000000002a", - "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" - } - }, - "difficulty": "0x3d0900", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": "0x00", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "", - "gasLimit": "0x7a1200" - }, - "nodes": [ - "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", - "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", - "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", - "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", - "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", - "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", - "enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303", - "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", - "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" - ], - "accounts": { - "0000000000000000000000000000000000000001": { - "balance": "1", - "builtin": { - "name": "ecrecover", - "pricing": { - "linear": { - "base": 3000, - "word": 0 - } - } - } - }, - "0000000000000000000000000000000000000002": { - "balance": "1", - "builtin": { - "name": "sha256", - "pricing": { - "linear": { - "base": 60, - "word": 12 - } - } - } - }, - "0000000000000000000000000000000000000003": { - "balance": "1", - "builtin": { - "name": "ripemd160", - "pricing": { - "linear": { - "base": 600, - "word": 120 - } - } - } - }, - "0000000000000000000000000000000000000004": { - "balance": "1", - "builtin": { - "name": "identity", - "pricing": { - "linear": { - "base": 15, - "word": 3 - } - } - } - } - } -} From 1b9cdfb8d1d83b90c2b3fd6356239a67ebc82ba3 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Mon, 2 Oct 2017 16:34:13 +0200 Subject: [PATCH 19/33] Update MCIP-3 block rewards --- ethcore/res/ethereum/musicoin.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 698791b52a5..fea8859fa42 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -14,11 +14,11 @@ "eip161dTransition": "0x7fffffffffffff", "blockReward": "0x1105a0185b50a80000", "mcip3Transition": "0x124f81", - "mcip3MinerReward": "0xf2dc7d47f15600000", - "mcip3UbiReward": "0x1a055690d9db80000", - "mcip3UbiContract": "0x00eFdd5883eC628983E9063c7d969fE268BBf310", - "mcip3DevReward": "0x3782dace9d900000", - "mcip3DevContract": "0x00756cF8159095948496617F5FB17ED95059f536" + "mcip3MinerReward": "0xd8d726b7177a80000", + "mcip3UbiReward": "0x2b5e3af16b1880000", + "mcip3UbiContract": "0x00efdd5883ec628983e9063c7d969fe268bbf310", + "mcip3DevReward": "0xc249fdd327780000", + "mcip3DevContract": "0x00756cf8159095948496617f5fb17ed95059f536" } } }, From 072ba1d1109c9c5b1eb1f61dba67adf769eb7c42 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Tue, 3 Oct 2017 10:48:34 +0200 Subject: [PATCH 20/33] Musicoin homestead transition is at 1_150_000 --- ethcore/res/ethereum/musicoin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index fea8859fa42..a662f408ce1 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -7,7 +7,7 @@ "minimumDifficulty": "0x20000", "difficultyBoundDivisor": "0x800", "durationLimit": "0xd", - "homesteadTransition": "0x7fffffffffffff", + "homesteadTransition": "0x118c30", "eip150Transition": "0x7fffffffffffff", "eip160Transition": "0x7fffffffffffff", "eip161abcTransition": "0x7fffffffffffff", From c6198a9f145c3b256a263d1cb8152266d14af370 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Tue, 3 Oct 2017 11:03:45 +0200 Subject: [PATCH 21/33] Expect mcip3 transtion to be properly defined in chain spec. --- ethcore/src/ethereum/ethash.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index d5c0b6dd16e..b924a7a1d2e 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -223,11 +223,11 @@ impl Engine for Arc { let mut uncle_rewards = Vec::with_capacity(n_uncles); if number >= self.ethash_params.mcip3_transition { - let miner_reward = self.ethash_params.mcip3_miner_reward.unwrap(); + let miner_reward = self.ethash_params.mcip3_miner_reward.expect("mcip3MinerReward is always defined for mcip3Transition in chain spec."); let ubi_contract = self.ethash_params.mcip3_ubi_contract; - let ubi_reward = self.ethash_params.mcip3_ubi_reward.unwrap(); + let ubi_reward = self.ethash_params.mcip3_ubi_reward.expect("mcip3UbiReward is always defined for mcip3Transition in chain spec."); let dev_contract = self.ethash_params.mcip3_dev_contract; - let dev_reward = self.ethash_params.mcip3_dev_reward.unwrap(); + let dev_reward = self.ethash_params.mcip3_dev_reward.expect("mcip3DevReward is always defined for mcip3Transition in chain spec."); self.machine.add_balance(block, &author, &miner_reward)?; self.machine.add_balance(block, &ubi_contract, &ubi_reward)?; From e4532f911b9bbfd9430eeb7b206fdc75d02f5fee Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Tue, 3 Oct 2017 11:52:36 +0200 Subject: [PATCH 22/33] Panic handling for mcip to default to regular block rewards if not specified --- ethcore/src/ethereum/ethash.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index b924a7a1d2e..29bf78c2733 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -109,10 +109,10 @@ impl From for EthashParams { ecip1010_continue_transition: p.ecip1010_continue_transition.map_or(u64::max_value(), Into::into), ecip1017_era_rounds: p.ecip1017_era_rounds.map_or(u64::max_value(), Into::into), mcip3_transition: p.mcip3_transition.map_or(u64::max_value(), Into::into), - mcip3_miner_reward: p.mcip3_miner_reward.map(Into::into), - mcip3_ubi_reward: p.mcip3_ubi_reward.map(Into::into), + mcip3_miner_reward: p.mcip3_miner_reward.map_or(p.block_reward.into(), Into::into), + mcip3_ubi_reward: p.mcip3_ubi_reward.map_or(0, Into::into), mcip3_ubi_contract: p.mcip3_ubi_contract.map_or_else(Address::new, Into::into), - mcip3_dev_reward: p.mcip3_dev_reward.map(Into::into), + mcip3_dev_reward: p.mcip3_dev_reward.map_or(0, Into::into), mcip3_dev_contract: p.mcip3_dev_contract.map_or_else(Address::new, Into::into), block_reward: p.block_reward.map_or_else(Default::default, Into::into), eip649_transition: p.eip649_transition.map_or(u64::max_value(), Into::into), @@ -223,11 +223,11 @@ impl Engine for Arc { let mut uncle_rewards = Vec::with_capacity(n_uncles); if number >= self.ethash_params.mcip3_transition { - let miner_reward = self.ethash_params.mcip3_miner_reward.expect("mcip3MinerReward is always defined for mcip3Transition in chain spec."); + let miner_reward = self.ethash_params.mcip3_miner_reward.expect("mcip3MinerReward is either defined for mcip3Transition or uses default blockReward."); let ubi_contract = self.ethash_params.mcip3_ubi_contract; - let ubi_reward = self.ethash_params.mcip3_ubi_reward.expect("mcip3UbiReward is always defined for mcip3Transition in chain spec."); + let ubi_reward = self.ethash_params.mcip3_ubi_reward.expect("mcip3UbiReward is either defined for mcip3Transition or 0."); let dev_contract = self.ethash_params.mcip3_dev_contract; - let dev_reward = self.ethash_params.mcip3_dev_reward.expect("mcip3DevReward is always defined for mcip3Transition in chain spec."); + let dev_reward = self.ethash_params.mcip3_dev_reward.expect("mcip3DevReward is either defined for mcip3Transition or 0."); self.machine.add_balance(block, &author, &miner_reward)?; self.machine.add_balance(block, &ubi_contract, &ubi_reward)?; From 8319991d98f89cc437c2bc349f7e0f84a3e8dfae Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Tue, 3 Oct 2017 12:14:08 +0200 Subject: [PATCH 23/33] Giving mcip3 rewards a useful default value. --- ethcore/src/ethereum/ethash.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 29bf78c2733..fa1da98e581 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -73,13 +73,13 @@ pub struct EthashParams { /// Number of first block where MCIP-3 begins. pub mcip3_transition: u64, /// MCIP-3 Block reward coin-base for miners. - pub mcip3_miner_reward: Option, + pub mcip3_miner_reward: U256, /// MCIP-3 Block reward ubi-base for basic income. - pub mcip3_ubi_reward: Option, + pub mcip3_ubi_reward: U256, /// MCIP-3 contract address for universal basic income. pub mcip3_ubi_contract: Address, /// MCIP-3 Block reward dev-base for dev funds. - pub mcip3_dev_reward: Option, + pub mcip3_dev_reward: U256, /// MCIP-3 contract address for the developer funds. pub mcip3_dev_contract: Address, /// Block reward in base units. @@ -109,10 +109,10 @@ impl From for EthashParams { ecip1010_continue_transition: p.ecip1010_continue_transition.map_or(u64::max_value(), Into::into), ecip1017_era_rounds: p.ecip1017_era_rounds.map_or(u64::max_value(), Into::into), mcip3_transition: p.mcip3_transition.map_or(u64::max_value(), Into::into), - mcip3_miner_reward: p.mcip3_miner_reward.map_or(p.block_reward.into(), Into::into), - mcip3_ubi_reward: p.mcip3_ubi_reward.map_or(0, Into::into), + mcip3_miner_reward: p.mcip3_miner_reward.map_or_else(Default::default, Into::into), + mcip3_ubi_reward: p.mcip3_ubi_reward.map_or(U256::from(0), Into::into), mcip3_ubi_contract: p.mcip3_ubi_contract.map_or_else(Address::new, Into::into), - mcip3_dev_reward: p.mcip3_dev_reward.map_or(0, Into::into), + mcip3_dev_reward: p.mcip3_dev_reward.map_or(U256::from(0), Into::into), mcip3_dev_contract: p.mcip3_dev_contract.map_or_else(Address::new, Into::into), block_reward: p.block_reward.map_or_else(Default::default, Into::into), eip649_transition: p.eip649_transition.map_or(u64::max_value(), Into::into), @@ -223,11 +223,11 @@ impl Engine for Arc { let mut uncle_rewards = Vec::with_capacity(n_uncles); if number >= self.ethash_params.mcip3_transition { - let miner_reward = self.ethash_params.mcip3_miner_reward.expect("mcip3MinerReward is either defined for mcip3Transition or uses default blockReward."); + let miner_reward = self.ethash_params.mcip3_miner_reward; let ubi_contract = self.ethash_params.mcip3_ubi_contract; - let ubi_reward = self.ethash_params.mcip3_ubi_reward.expect("mcip3UbiReward is either defined for mcip3Transition or 0."); + let ubi_reward = self.ethash_params.mcip3_ubi_reward; let dev_contract = self.ethash_params.mcip3_dev_contract; - let dev_reward = self.ethash_params.mcip3_dev_reward.expect("mcip3DevReward is either defined for mcip3Transition or 0."); + let dev_reward = self.ethash_params.mcip3_dev_reward; self.machine.add_balance(block, &author, &miner_reward)?; self.machine.add_balance(block, &ubi_contract, &ubi_reward)?; From d7db8487d9b2c9f03631214f4174816b44659fc7 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Tue, 3 Oct 2017 12:40:36 +0200 Subject: [PATCH 24/33] Fix ethjson tests. --- json/src/spec/ethash.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index 835f496eb03..8582a3d95e4 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -232,6 +232,12 @@ mod tests { ecip1010_pause_transition: None, ecip1010_continue_transition: None, ecip1017_era_rounds: None, + mcip3_transition: None, + mcip3_miner_reward: None, + mcip3_ubi_reward: None, + mcip3_ubi_contract: None, + mcip3_dev_reward: None, + mcip3_dev_contract: None, eip649_transition: None, eip649_delay: None, eip649_reward: None, @@ -272,6 +278,12 @@ mod tests { ecip1010_pause_transition: None, ecip1010_continue_transition: None, ecip1017_era_rounds: None, + mcip3_transition: None, + mcip3_miner_reward: None, + mcip3_ubi_reward: None, + mcip3_ubi_contract: None, + mcip3_dev_reward: None, + mcip3_dev_contract: None, eip649_transition: None, eip649_delay: None, eip649_reward: None, From b43006ed410941a49ab61e43418e504ffe50747f Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 4 Oct 2017 11:23:57 +0200 Subject: [PATCH 25/33] Update musicoin chain spec --- ethcore/res/ethereum/musicoin.json | 206 ++++++++++++++++++----------- 1 file changed, 129 insertions(+), 77 deletions(-) diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index a662f408ce1..3a9db732333 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -1,55 +1,56 @@ { - "name": "Musicoin", - "dataDir": "musicoin", - "engine": { - "Ethash": { - "params": { - "minimumDifficulty": "0x20000", - "difficultyBoundDivisor": "0x800", - "durationLimit": "0xd", - "homesteadTransition": "0x118c30", - "eip150Transition": "0x7fffffffffffff", - "eip160Transition": "0x7fffffffffffff", - "eip161abcTransition": "0x7fffffffffffff", - "eip161dTransition": "0x7fffffffffffff", - "blockReward": "0x1105a0185b50a80000", - "mcip3Transition": "0x124f81", - "mcip3MinerReward": "0xd8d726b7177a80000", - "mcip3UbiReward": "0x2b5e3af16b1880000", - "mcip3UbiContract": "0x00efdd5883ec628983e9063c7d969fe268bbf310", - "mcip3DevReward": "0xc249fdd327780000", - "mcip3DevContract": "0x00756cf8159095948496617f5fb17ed95059f536" + "name":"Musicoin", + "dataDir":"musicoin", + "engine":{ + "Ethash":{ + "params":{ + "minimumDifficulty":"0x020000", + "difficultyBoundDivisor":"0x0800", + "durationLimit":"0x0d", + "homesteadTransition":"0x118c30", + "eip150Transition":"0x7fffffffffffff", + "eip160Transition":"0x7fffffffffffff", + "eip161abcTransition":"0x7fffffffffffff", + "eip161dTransition":"0x7fffffffffffff", + "blockReward":"0x1105a0185b50a80000", + "mcip3Transition":"0x124f81", + "mcip3MinerReward":"0xd8d726b7177a80000", + "mcip3UbiReward":"0x2b5e3af16b1880000", + "mcip3UbiContract":"0x00efdd5883ec628983e9063c7d969fe268bbf310", + "mcip3DevReward":"0xc249fdd327780000", + "mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536" } } }, - "params": { - "gasLimitBoundDivisor": "0x400", - "registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D", - "accountStartNonce": "0x0", - "maximumExtraDataSize": "0x20", - "minGasLimit": "0x1388", - "networkID": "0x76740f", - "forkBlock": "0x5b6", - "forkCanonHash": "0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", - "eip155Transition": "0x7fffffffffffff", - "eip98Transition": "0x7fffffffffffff", - "eip86Transition": "0x7fffffffffffff" + "params":{ + "gasLimitBoundDivisor":"0x0400", + "registrar":"0x5C271c4C9A67E7D73b7b3669d47504741354f21D", + "accountStartNonce":"0x00", + "maximumExtraDataSize":"0x20", + "minGasLimit":"0x1388", + "networkID":"0x76740f", + "forkBlock":"0x5b6", + "forkCanonHash":"0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", + "eip155Transition":"0x7fffffffffffff", + "eip98Transition":"0x7fffffffffffff", + "eip86Transition":"0x7fffffffffffff", + "maxCodeSize":"0x6000" }, - "genesis": { - "seal": { - "ethereum": { - "nonce": "0x000000000000002a", - "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" + "genesis":{ + "seal":{ + "ethereum":{ + "nonce":"0x000000000000002a", + "mixHash":"0x00000000000000000000000000000000000000647572616c65787365646c6578" } }, - "difficulty": "0x3d0900", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": "0x00", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "", - "gasLimit": "0x7a1200" + "difficulty":"0x3d0900", + "author":"0x0000000000000000000000000000000000000000", + "timestamp":"0x00", + "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData":"", + "gasLimit":"0x7a1200" }, - "nodes": [ + "nodes":[ "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", @@ -60,51 +61,102 @@ "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" ], - "accounts": { - "0000000000000000000000000000000000000001": { - "balance": "1", - "builtin": { - "name": "ecrecover", - "pricing": { - "linear": { - "base": 3000, - "word": 0 + "accounts":{ + "0000000000000000000000000000000000000001":{ + "balance":"1", + "builtin":{ + "name":"ecrecover", + "pricing":{ + "linear":{ + "base":3000, + "word":0 } } } }, - "0000000000000000000000000000000000000002": { - "balance": "1", - "builtin": { - "name": "sha256", - "pricing": { - "linear": { - "base": 60, - "word": 12 + "0000000000000000000000000000000000000002":{ + "balance":"1", + "builtin":{ + "name":"sha256", + "pricing":{ + "linear":{ + "base":60, + "word":12 } } } }, - "0000000000000000000000000000000000000003": { - "balance": "1", - "builtin": { - "name": "ripemd160", - "pricing": { - "linear": { - "base": 600, - "word": 120 + "0000000000000000000000000000000000000003":{ + "balance":"1", + "builtin":{ + "name":"ripemd160", + "pricing":{ + "linear":{ + "base":600, + "word":120 } } } }, - "0000000000000000000000000000000000000004": { - "balance": "1", - "builtin": { - "name": "identity", - "pricing": { - "linear": { - "base": 15, - "word": 3 + "0000000000000000000000000000000000000004":{ + "balance":"1", + "builtin":{ + "name":"identity", + "pricing":{ + "linear":{ + "base":15, + "word":3 + } + } + } + }, + "0000000000000000000000000000000000000005":{ + "balance":"1", + "builtin":{ + "name":"modexp", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "modexp":{ + "divisor":100 + } + } + } + }, + "0000000000000000000000000000000000000006":{ + "balance":"1", + "builtin":{ + "name":"alt_bn128_add", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "linear":{ + "base":500, + "word":0 + } + } + } + }, + "0000000000000000000000000000000000000007":{ + "balance":"1", + "builtin":{ + "name":"alt_bn128_mul", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "linear":{ + "base":2000, + "word":0 + } + } + } + }, + "0000000000000000000000000000000000000008":{ + "balance":"1", + "builtin":{ + "name":"alt_bn128_pairing", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "alt_bn128_pairing":{ + "base":100000, + "pair":80000 } } } From 12cd04c582b93f0d465f3194c13ec76f23d66188 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 4 Oct 2017 11:46:41 +0200 Subject: [PATCH 26/33] Fix tests 0:) --- ethcore/src/tests/helpers.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index 32a0114b048..30e74e17986 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -378,10 +378,10 @@ pub fn get_default_ethash_params() -> EthashParams { ecip1010_continue_transition: u64::max_value(), ecip1017_era_rounds: u64::max_value(), mcip3_transition: u64::max_value(), - mcip3_miner_reward: None, - mcip3_ubi_reward: None, + mcip3_miner_reward: 0.into(), + mcip3_ubi_reward: 0.into(), mcip3_ubi_contract: "0000000000000000000000000000000000000001".into(), - mcip3_dev_reward: None, + mcip3_dev_reward: 0.into(), mcip3_dev_contract: "0000000000000000000000000000000000000001".into(), eip649_transition: u64::max_value(), eip649_delay: 3_000_000, From d0d8f1cfde183e3d825ac78dd938ea85c6a9a316 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 4 Oct 2017 11:55:20 +0200 Subject: [PATCH 27/33] Add musicoin mcip3 era test spec. --- ethcore/res/ethereum/mcip3_test.json | 165 +++++++++++++++++++++++++++ ethcore/src/ethereum/mod.rs | 6 + 2 files changed, 171 insertions(+) create mode 100644 ethcore/res/ethereum/mcip3_test.json diff --git a/ethcore/res/ethereum/mcip3_test.json b/ethcore/res/ethereum/mcip3_test.json new file mode 100644 index 00000000000..dfdfc81e6ed --- /dev/null +++ b/ethcore/res/ethereum/mcip3_test.json @@ -0,0 +1,165 @@ +{ + "name": "MCIP3 Test", + "dataDir": "mcip3test", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty":"0x020000", + "difficultyBoundDivisor":"0x0800", + "durationLimit":"0x0d", + "homesteadTransition":"0x118c30", + "eip150Transition": "0x7fffffffffffff", + "eip160Transition": "0x7fffffffffffff", + "eip161abcTransition": "0x7fffffffffffff", + "eip161dTransition": "0x7fffffffffffff", + "blockReward": "0x1105a0185b50a80000", + "mcip3Transition":"0x00", + "mcip3MinerReward":"0xd8d726b7177a80000", + "mcip3UbiReward":"0x2b5e3af16b1880000", + "mcip3UbiContract":"0x00efdd5883ec628983e9063c7d969fe268bbf310", + "mcip3DevReward":"0xc249fdd327780000", + "mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536" + } + } + }, + "params": { + "gasLimitBoundDivisor":"0x0400", + "registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D", + "accountStartNonce":"0x00", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID": "0x76740b", + "forkBlock": "0x5b6", + "forkCanonHash": "0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", + "eip155Transition": "0x7fffffffffffff", + "eip98Transition": "0x7fffffffffffff", + "eip86Transition":"0x7fffffffffffff", + "maxCodeSize":"0x6000" + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x000000000000002a", + "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" + } + }, + "difficulty": "0x3d0900", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "", + "gasLimit": "0x7a1200" + }, + "nodes": [ + "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", + "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", + "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", + "enode://158f8aab45f6d19c6cbf4a089c2670541a8da11978a2f90dbf6a502a4a3bab80d288afdbeb7ec0ef6d92de563767f3b1ea9e8e334ca711e9f8e2df5a0385e8e6@13.75.154.138:30303", + "enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303", + "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303", + "enode://d302f52c8789ad87ee528f1431a67f1aa646c9bec17babb4665dfb3d61de5b9119a70aa77b2147a5f28854092ba09769323c1c552a6ac6f6a34cbcf767e2d2fe@158.69.248.48:30303", + "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", + "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" + ], + "accounts": { + "0000000000000000000000000000000000000001": { + "balance": "1", + "builtin": { + "name": "ecrecover", + "pricing": { + "linear": { + "base": 3000, + "word": 0 + } + } + } + }, + "0000000000000000000000000000000000000002": { + "balance": "1", + "builtin": { + "name": "sha256", + "pricing": { + "linear": { + "base": 60, + "word": 12 + } + } + } + }, + "0000000000000000000000000000000000000003": { + "balance": "1", + "builtin": { + "name": "ripemd160", + "pricing": { + "linear": { + "base": 600, + "word": 120 + } + } + } + }, + "0000000000000000000000000000000000000004": { + "balance": "1", + "builtin": { + "name": "identity", + "pricing": { + "linear": { + "base": 15, + "word": 3 + } + } + } + }, + "0000000000000000000000000000000000000005":{ + "balance":"1", + "builtin":{ + "name":"modexp", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "modexp":{ + "divisor":100 + } + } + } + }, + "0000000000000000000000000000000000000006":{ + "balance":"1", + "builtin":{ + "name":"alt_bn128_add", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "linear":{ + "base":500, + "word":0 + } + } + } + }, + "0000000000000000000000000000000000000007":{ + "balance":"1", + "builtin":{ + "name":"alt_bn128_mul", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "linear":{ + "base":2000, + "word":0 + } + } + } + }, + "0000000000000000000000000000000000000008":{ + "balance":"1", + "builtin":{ + "name":"alt_bn128_pairing", + "activate_at":"0x7fffffffffffff", + "pricing":{ + "alt_bn128_pairing":{ + "base":100000, + "pair":80000 + } + } + } + } + } +} diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 5f5c30d5988..75c321ebe7f 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -116,6 +116,9 @@ pub fn new_byzantium_test() -> Spec { load(None, include_bytes!("../../res/ether /// Create a new Foundation Constantinople era spec. pub fn new_constantinople_test() -> Spec { load(None, include_bytes!("../../res/ethereum/constantinople_test.json")) } +/// Create a new Musicoin-MCIP3-era spec. +pub fn new_mcip3_test() -> Spec { load(None, include_bytes!("../../res/ethereum/mcip3_test.json")) } + // For tests /// Create a new Foundation Frontier-era chain spec as though it never changes to Homestead. @@ -130,6 +133,9 @@ pub fn new_byzantium_test_machine() -> EthereumMachine { load_machine(include_by /// Create a new Foundation Constantinople era spec. pub fn new_constantinople_test_machine() -> EthereumMachine { load_machine(include_bytes!("../../res/ethereum/constantinople_test.json")) } +/// Create a new Musicoin-MCIP3-era spec. +pub fn new_mcip3_test_machine() -> EthereumMachine { load_machine(include_bytes!("../../res/ethereum/mcip3_test.json")) } + #[cfg(test)] mod tests { use bigint::prelude::U256; From babb3a3fa7e9b5a04920fbc5d5f472c070ef8a9e Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 4 Oct 2017 13:51:47 +0200 Subject: [PATCH 28/33] Update musicoin chain spec(s) --- ethcore/res/ethereum/mcip3_test.json | 132 +++++++++++++-------------- ethcore/res/ethereum/musicoin.json | 4 - 2 files changed, 64 insertions(+), 72 deletions(-) diff --git a/ethcore/res/ethereum/mcip3_test.json b/ethcore/res/ethereum/mcip3_test.json index dfdfc81e6ed..ab3abf6e3ad 100644 --- a/ethcore/res/ethereum/mcip3_test.json +++ b/ethcore/res/ethereum/mcip3_test.json @@ -1,18 +1,18 @@ { - "name": "MCIP3 Test", - "dataDir": "mcip3test", - "engine": { - "Ethash": { - "params": { + "name":"MCIP3 Test", + "dataDir":"mcip3test", + "engine":{ + "Ethash":{ + "params":{ "minimumDifficulty":"0x020000", "difficultyBoundDivisor":"0x0800", "durationLimit":"0x0d", "homesteadTransition":"0x118c30", - "eip150Transition": "0x7fffffffffffff", - "eip160Transition": "0x7fffffffffffff", - "eip161abcTransition": "0x7fffffffffffff", - "eip161dTransition": "0x7fffffffffffff", - "blockReward": "0x1105a0185b50a80000", + "eip150Transition":"0x7fffffffffffff", + "eip160Transition":"0x7fffffffffffff", + "eip161abcTransition":"0x7fffffffffffff", + "eip161dTransition":"0x7fffffffffffff", + "blockReward":"0x1105a0185b50a80000", "mcip3Transition":"0x00", "mcip3MinerReward":"0xd8d726b7177a80000", "mcip3UbiReward":"0x2b5e3af16b1880000", @@ -22,35 +22,35 @@ } } }, - "params": { + "params":{ "gasLimitBoundDivisor":"0x0400", - "registrar": "0x5C271c4C9A67E7D73b7b3669d47504741354f21D", + "registrar":"0x5C271c4C9A67E7D73b7b3669d47504741354f21D", "accountStartNonce":"0x00", - "maximumExtraDataSize": "0x20", - "minGasLimit": "0x1388", - "networkID": "0x76740b", - "forkBlock": "0x5b6", - "forkCanonHash": "0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", - "eip155Transition": "0x7fffffffffffff", - "eip98Transition": "0x7fffffffffffff", + "maximumExtraDataSize":"0x20", + "minGasLimit":"0x1388", + "networkID":"0x76740b", + "forkBlock":"0x5b6", + "forkCanonHash":"0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", + "eip155Transition":"0x7fffffffffffff", + "eip98Transition":"0x7fffffffffffff", "eip86Transition":"0x7fffffffffffff", "maxCodeSize":"0x6000" }, - "genesis": { - "seal": { - "ethereum": { - "nonce": "0x000000000000002a", - "mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578" + "genesis":{ + "seal":{ + "ethereum":{ + "nonce":"0x000000000000002a", + "mixHash":"0x00000000000000000000000000000000000000647572616c65787365646c6578" } }, - "difficulty": "0x3d0900", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": "0x00", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "", - "gasLimit": "0x7a1200" + "difficulty":"0x3d0900", + "author":"0x0000000000000000000000000000000000000000", + "timestamp":"0x00", + "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData":"", + "gasLimit":"0x7a1200" }, - "nodes": [ + "nodes":[ "enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303", "enode://3f1d12044546b76342d59d4a05532c14b85aa669704bfe1f864fe079415aa2c02d743e03218e57a33fb94523adb54032871a6c51b2cc5514cb7c7e35b3ed0a99@13.93.211.84:30303", "enode://78de8a0916848093c73790ead81d1928bec737d565119932b98c6b100d944b7a95e94f847f689fc723399d2e31129d182f7ef3863f2b4c820abbf3ab2722344d@191.235.84.50:30303", @@ -61,57 +61,56 @@ "enode://c72564bce8331ae298fb8ece113a456e3927d7e5989c2be3e445678b3600579f722410ef9bbfe339335d676af77343cb21b5b1703b7bebc32be85fce937a2220@191.252.185.71:30303", "enode://e3ae4d25ee64791ff98bf17c37acf90933359f2505c00f65c84f6863231a32a94153cadb0a462e428f18f35ded6bd91cd91033d26576a28558c22678be9cfaee@5.63.158.137:35555" ], - "accounts": { - "0000000000000000000000000000000000000001": { - "balance": "1", - "builtin": { - "name": "ecrecover", - "pricing": { - "linear": { - "base": 3000, - "word": 0 + "accounts":{ + "0000000000000000000000000000000000000001":{ + "balance":"1", + "builtin":{ + "name":"ecrecover", + "pricing":{ + "linear":{ + "base":3000, + "word":0 } } } }, - "0000000000000000000000000000000000000002": { - "balance": "1", - "builtin": { - "name": "sha256", - "pricing": { - "linear": { - "base": 60, - "word": 12 + "0000000000000000000000000000000000000002":{ + "balance":"1", + "builtin":{ + "name":"sha256", + "pricing":{ + "linear":{ + "base":60, + "word":12 } } } }, - "0000000000000000000000000000000000000003": { - "balance": "1", - "builtin": { - "name": "ripemd160", - "pricing": { - "linear": { - "base": 600, - "word": 120 + "0000000000000000000000000000000000000003":{ + "balance":"1", + "builtin":{ + "name":"ripemd160", + "pricing":{ + "linear":{ + "base":600, + "word":120 } } } }, - "0000000000000000000000000000000000000004": { - "balance": "1", - "builtin": { - "name": "identity", - "pricing": { - "linear": { - "base": 15, - "word": 3 + "0000000000000000000000000000000000000004":{ + "balance":"1", + "builtin":{ + "name":"identity", + "pricing":{ + "linear":{ + "base":15, + "word":3 } } } }, "0000000000000000000000000000000000000005":{ - "balance":"1", "builtin":{ "name":"modexp", "activate_at":"0x7fffffffffffff", @@ -123,7 +122,6 @@ } }, "0000000000000000000000000000000000000006":{ - "balance":"1", "builtin":{ "name":"alt_bn128_add", "activate_at":"0x7fffffffffffff", @@ -136,7 +134,6 @@ } }, "0000000000000000000000000000000000000007":{ - "balance":"1", "builtin":{ "name":"alt_bn128_mul", "activate_at":"0x7fffffffffffff", @@ -149,7 +146,6 @@ } }, "0000000000000000000000000000000000000008":{ - "balance":"1", "builtin":{ "name":"alt_bn128_pairing", "activate_at":"0x7fffffffffffff", diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 3a9db732333..f4c82f3c432 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -111,7 +111,6 @@ } }, "0000000000000000000000000000000000000005":{ - "balance":"1", "builtin":{ "name":"modexp", "activate_at":"0x7fffffffffffff", @@ -123,7 +122,6 @@ } }, "0000000000000000000000000000000000000006":{ - "balance":"1", "builtin":{ "name":"alt_bn128_add", "activate_at":"0x7fffffffffffff", @@ -136,7 +134,6 @@ } }, "0000000000000000000000000000000000000007":{ - "balance":"1", "builtin":{ "name":"alt_bn128_mul", "activate_at":"0x7fffffffffffff", @@ -149,7 +146,6 @@ } }, "0000000000000000000000000000000000000008":{ - "balance":"1", "builtin":{ "name":"alt_bn128_pairing", "activate_at":"0x7fffffffffffff", From f49aa0bafd85efe805a8389061ebacc4abf35d19 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 4 Oct 2017 13:52:33 +0200 Subject: [PATCH 29/33] Add tests for mcip3 era block rewards --- ethcore/src/ethereum/ethash.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index fa1da98e581..d651ef07582 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -467,7 +467,7 @@ mod tests { use error::{BlockError, Error}; use header::Header; use spec::Spec; - use super::super::{new_morden, new_homestead_test_machine}; + use super::super::{new_morden, new_mcip3_test, new_homestead_test_machine}; use super::{Ethash, EthashParams, ecip1017_eras_block_reward}; use rlp; @@ -475,6 +475,10 @@ mod tests { new_morden(&::std::env::temp_dir()) } + fn test_spec_mcip3() -> Spec { + new_mcip3_test(&::std::env::temp_dir()) + } + #[test] fn on_close_block() { let spec = test_spec(); @@ -537,6 +541,23 @@ mod tests { assert_eq!(b.state().balance(&uncle_author).unwrap(), "3cb71f51fc558000".into()); } + #[test] + fn has_valid_mcip3_era_block_rewards() { + let spec = test_spec_mcip3(); + let engine = &*spec.engine; + let genesis_header = spec.genesis_header(); + let db = spec.ensure_db_good(get_temp_state_db(), &Default::default()).unwrap(); + let last_hashes = Arc::new(vec![genesis_header.hash()]); + let b = OpenBlock::new(engine, Default::default(), false, db, &genesis_header, last_hashes, Address::zero(), (3141562.into(), 31415620.into()), vec![], false).unwrap(); + let b = b.close(); + + let ubi_contract: Address = "00efdd5883ec628983e9063c7d969fe268bbf310".into(); + let dev_contract: Address = "00756cf8159095948496617f5fb17ed95059f536".into(); + assert_eq!(b.state().balance(&Address::zero()).unwrap(), U256::from_str("d8d726b7177a80000").unwrap()); + assert_eq!(b.state().balance(&ubi_contract).unwrap(), U256::from_str("2b5e3af16b1880000").unwrap()); + assert_eq!(b.state().balance(&dev_contract).unwrap(), U256::from_str("c249fdd327780000").unwrap()); + } + #[test] fn has_valid_metadata() { let engine = test_spec().engine; From 4e9e8c9c98fe5e56e888ebebdfb53017989142f7 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Wed, 4 Oct 2017 19:52:52 +0200 Subject: [PATCH 30/33] Fix tests --- ethcore/src/ethereum/ethash.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index d651ef07582..4278b5ede99 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -475,10 +475,6 @@ mod tests { new_morden(&::std::env::temp_dir()) } - fn test_spec_mcip3() -> Spec { - new_mcip3_test(&::std::env::temp_dir()) - } - #[test] fn on_close_block() { let spec = test_spec(); @@ -543,7 +539,7 @@ mod tests { #[test] fn has_valid_mcip3_era_block_rewards() { - let spec = test_spec_mcip3(); + let spec = new_mcip3_test(); let engine = &*spec.engine; let genesis_header = spec.genesis_header(); let db = spec.ensure_db_good(get_temp_state_db(), &Default::default()).unwrap(); From 5a21744fcb37c60e012c1c63d2a91a8a33263cb2 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Fri, 6 Oct 2017 11:13:24 +0200 Subject: [PATCH 31/33] Disable byzantium for musicoin --- ethcore/res/ethereum/mcip3_test.json | 14 ++++++++++---- ethcore/res/ethereum/musicoin.json | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ethcore/res/ethereum/mcip3_test.json b/ethcore/res/ethereum/mcip3_test.json index ab3abf6e3ad..098e146e318 100644 --- a/ethcore/res/ethereum/mcip3_test.json +++ b/ethcore/res/ethereum/mcip3_test.json @@ -8,10 +8,12 @@ "difficultyBoundDivisor":"0x0800", "durationLimit":"0x0d", "homesteadTransition":"0x118c30", + "eip100bTransition":"0x7fffffffffffff", "eip150Transition":"0x7fffffffffffff", "eip160Transition":"0x7fffffffffffff", "eip161abcTransition":"0x7fffffffffffff", "eip161dTransition":"0x7fffffffffffff", + "eip649Transition":"0x7fffffffffffff", "blockReward":"0x1105a0185b50a80000", "mcip3Transition":"0x00", "mcip3MinerReward":"0xd8d726b7177a80000", @@ -31,9 +33,13 @@ "networkID":"0x76740b", "forkBlock":"0x5b6", "forkCanonHash":"0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", - "eip155Transition":"0x7fffffffffffff", - "eip98Transition":"0x7fffffffffffff", "eip86Transition":"0x7fffffffffffff", + "eip98Transition":"0x7fffffffffffff", + "eip140Transition":"0x7fffffffffffff", + "eip155Transition":"0x7fffffffffffff", + "eip211Transition":"0x7fffffffffffff", + "eip214Transition":"0x7fffffffffffff", + "eip658Transition":"0x7fffffffffffff", "maxCodeSize":"0x6000" }, "genesis":{ @@ -116,7 +122,7 @@ "activate_at":"0x7fffffffffffff", "pricing":{ "modexp":{ - "divisor":100 + "divisor":20 } } } @@ -139,7 +145,7 @@ "activate_at":"0x7fffffffffffff", "pricing":{ "linear":{ - "base":2000, + "base":40000, "word":0 } } diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index f4c82f3c432..cf4d4ffba4d 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -8,10 +8,12 @@ "difficultyBoundDivisor":"0x0800", "durationLimit":"0x0d", "homesteadTransition":"0x118c30", + "eip100bTransition":"0x7fffffffffffff", "eip150Transition":"0x7fffffffffffff", "eip160Transition":"0x7fffffffffffff", "eip161abcTransition":"0x7fffffffffffff", "eip161dTransition":"0x7fffffffffffff", + "eip649Transition":"0x7fffffffffffff", "blockReward":"0x1105a0185b50a80000", "mcip3Transition":"0x124f81", "mcip3MinerReward":"0xd8d726b7177a80000", @@ -31,9 +33,13 @@ "networkID":"0x76740f", "forkBlock":"0x5b6", "forkCanonHash":"0xa5e88ad9e34d113e264e307bc27e8471452c8fc13780324bb3abb96fd0558343", - "eip155Transition":"0x7fffffffffffff", - "eip98Transition":"0x7fffffffffffff", "eip86Transition":"0x7fffffffffffff", + "eip98Transition":"0x7fffffffffffff", + "eip140Transition":"0x7fffffffffffff", + "eip155Transition":"0x7fffffffffffff", + "eip211Transition":"0x7fffffffffffff", + "eip214Transition":"0x7fffffffffffff", + "eip658Transition":"0x7fffffffffffff", "maxCodeSize":"0x6000" }, "genesis":{ @@ -116,7 +122,7 @@ "activate_at":"0x7fffffffffffff", "pricing":{ "modexp":{ - "divisor":100 + "divisor":20 } } } @@ -139,7 +145,7 @@ "activate_at":"0x7fffffffffffff", "pricing":{ "linear":{ - "base":2000, + "base":40000, "word":0 } } From 0cb6303a05c570b7e7ad95cc40da8b36bd0f44e1 Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Fri, 6 Oct 2017 11:37:58 +0200 Subject: [PATCH 32/33] Pass miner reward to the tracer. --- ethcore/src/ethereum/ethash.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 88f344afa91..cdc018e05b1 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -221,13 +221,13 @@ impl Engine for Arc { let mut uncle_rewards = Vec::with_capacity(n_uncles); if number >= self.ethash_params.mcip3_transition { - let miner_reward = self.ethash_params.mcip3_miner_reward; + result_block_reward = self.ethash_params.mcip3_miner_reward; let ubi_contract = self.ethash_params.mcip3_ubi_contract; let ubi_reward = self.ethash_params.mcip3_ubi_reward; let dev_contract = self.ethash_params.mcip3_dev_contract; let dev_reward = self.ethash_params.mcip3_dev_reward; - self.machine.add_balance(block, &author, &miner_reward)?; + self.machine.add_balance(block, &author, &result_block_reward)?; self.machine.add_balance(block, &ubi_contract, &ubi_reward)?; self.machine.add_balance(block, &dev_contract, &dev_reward)?; } else { From dd36b4c3e3604500d7f04d82e6f1fca2ba32f30c Mon Sep 17 00:00:00 2001 From: 5chdn <5chdn@users.noreply.github.com> Date: Fri, 6 Oct 2017 11:46:13 +0200 Subject: [PATCH 33/33] Allow modifying blockreward in MCIP-3 transition. --- ethcore/src/ethereum/ethash.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index cdc018e05b1..a49ba2e2ae9 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -217,7 +217,7 @@ impl Engine for Arc { let n_uncles = LiveBlock::uncles(&*block).len(); // Bestow block rewards. - let result_block_reward = reward + reward.shr(5) * U256::from(n_uncles); + let mut result_block_reward = reward + reward.shr(5) * U256::from(n_uncles); let mut uncle_rewards = Vec::with_capacity(n_uncles); if number >= self.ethash_params.mcip3_transition {