Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 74e71d7

Browse files
committed
Merge remote-tracking branch 'origin/master' into dp/chore/update-common-deps
* origin/master: Add Foundation Bootnodes (#9666) Docker: run as parity user (#9689) ethcore: mcip3 block reward contract (#9605) Verify block syncing responses against requests (#9670)
2 parents 1b96295 + 911fc74 commit 74e71d7

File tree

13 files changed

+493
-383
lines changed

13 files changed

+493
-383
lines changed

ethcore/res/ethereum/foundation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,9 @@
32473247
"enode://cadc6e573b6bc2a9128f2f635ac0db3353e360b56deef239e9be7e7fce039502e0ec670b595f6288c0d2116812516ad6b6ff8d5728ff45eba176989e40dead1e@37.128.191.230:30303",
32483248
"enode://595a9a06f8b9bc9835c8723b6a82105aea5d55c66b029b6d44f229d6d135ac3ecdd3e9309360a961ea39d7bee7bac5d03564077a4e08823acc723370aace65ec@46.20.235.22:30303",
32493249
"enode://029178d6d6f9f8026fc0bc17d5d1401aac76ec9d86633bba2320b5eed7b312980c0a210b74b20c4f9a8b0b2bf884b111fa9ea5c5f916bb9bbc0e0c8640a0f56c@216.158.85.185:30303",
3250-
"enode://fdd1b9bb613cfbc200bba17ce199a9490edc752a833f88d4134bf52bb0d858aa5524cb3ec9366c7a4ef4637754b8b15b5dc913e4ed9fdb6022f7512d7b63f181@212.47.247.103:30303"
3250+
"enode://fdd1b9bb613cfbc200bba17ce199a9490edc752a833f88d4134bf52bb0d858aa5524cb3ec9366c7a4ef4637754b8b15b5dc913e4ed9fdb6022f7512d7b63f181@212.47.247.103:30303",
3251+
"enode://cc26c9671dffd3ee8388a7c8c5b601ae9fe75fc0a85cedb72d2dd733d5916fad1d4f0dcbebad5f9518b39cc1f96ba214ab36a7fa5103aaf17294af92a89f227b@52.79.241.155:30303",
3252+
"enode://140872ce4eee37177fbb7a3c3aa4aaebe3f30bdbf814dd112f6c364fc2e325ba2b6a942f7296677adcdf753c33170cb4999d2573b5ff7197b4c1868f25727e45@52.78.149.82:30303"
32513253
],
32523254
"accounts": {
32533255
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },

ethcore/res/ethereum/mcip3_test.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
"homesteadTransition":"0x118c30",
1111
"eip100bTransition":"0x7fffffffffffff",
1212
"blockReward":"0x1105a0185b50a80000",
13-
"mcip3Transition":"0x00",
14-
"mcip3MinerReward":"0xd8d726b7177a80000",
15-
"mcip3UbiReward":"0x2b5e3af16b1880000",
16-
"mcip3UbiContract":"0x00efdd5883ec628983e9063c7d969fe268bbf310",
17-
"mcip3DevReward":"0xc249fdd327780000",
18-
"mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536"
13+
"blockRewardContractCode": "0x6080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663f91c28988114610045575b600080fd5b34801561005157600080fd5b50610071602460048035828101929082013591813591820191013561010a565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156100b557818101518382015260200161009d565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156100f45781810151838201526020016100dc565b5050505090500194505050505060405180910390f35b6060808080600080803373fffffffffffffffffffffffffffffffffffffffe1461013357600080fd5b89881461013f57600080fd5b60408051600380825260808201909252906020820160608038833950506040805160038082526080820190925292975090506020820160608038833901905050935072efdd5883ec628983e9063c7d969fe268bbf3108560018151811015156101a457fe5b73ffffffffffffffffffffffffffffffffffffffff90921660209283029091019091015283516802b5e3af16b188000090859060019081106101e257fe5b60209081029091010152845172756cf8159095948496617f5fb17ed95059f536908690600290811061021057fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152835167c249fdd327780000908590600290811061024d57fe5b60209081029091010152600092505b898310156103b75788888481811061027057fe5b9050602002013561ffff1661ffff166000141561030c578a8a8481811061029357fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168560008151811015156102bf57fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101528351680d8d726b7177a8000090859060009081106102fd57fe5b602090810290910101526103ac565b606489898581811061031a57fe5b9050602002013561ffff1661ffff161015156103ac57606489898581811061033e57fe5b9050602002013561ffff1603915060038260080361ffff16681105a0185b50a80000029060020a9004905061039d858c8c86818110151561037b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff166103c8565b94506103a9848261049f565b93505b60019092019161025c565b509299919850909650505050505050565b606080600084516001016040519080825280602002602001820160405280156103fb578160200160208202803883390190505b509150600090505b845181101561045e57848181518110151561041a57fe5b90602001906020020151828281518110151561043257fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101610403565b8382600184510381518110151561047157fe5b73ffffffffffffffffffffffffffffffffffffffff9290921660209283029190910190910152509392505050565b606080600084516001016040519080825280602002602001820160405280156104d2578160200160208202803883390190505b509150600090505b845181101561051b5784818151811015156104f157fe5b90602001906020020151828281518110151561050957fe5b602090810290910101526001016104da565b8382600184510381518110151561052e57fe5b60209081029190910101525093925050505600a165627a7a72305820c9ab92a56245040e76af5fc4f3ac4cf4315336b503db06677c21aa1e00aaa8e20029"
1914
}
2015
}
2116
},

ethcore/res/ethereum/mcip6_byz.json

Lines changed: 0 additions & 162 deletions
This file was deleted.

ethcore/res/ethereum/musicoin.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@
1010
"homesteadTransition":"0x118c30",
1111
"eip100bTransition":"0x21e88e",
1212
"blockReward":"0x1105a0185b50a80000",
13-
"mcip3Transition":"0x124f81",
14-
"mcip3MinerReward":"0xd8d726b7177a80000",
15-
"mcip3UbiReward":"0x2b5e3af16b1880000",
16-
"mcip3UbiContract":"0x00efdd5883ec628983e9063c7d969fe268bbf310",
17-
"mcip3DevReward":"0xc249fdd327780000",
18-
"mcip3DevContract":"0x00756cf8159095948496617f5fb17ed95059f536",
13+
"blockRewardContractTransition": "0x124f81",
14+
"blockRewardContractCode": "0x6080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663f91c28988114610045575b600080fd5b34801561005157600080fd5b50610071602460048035828101929082013591813591820191013561010a565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156100b557818101518382015260200161009d565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156100f45781810151838201526020016100dc565b5050505090500194505050505060405180910390f35b6060808080600080803373fffffffffffffffffffffffffffffffffffffffe1461013357600080fd5b89881461013f57600080fd5b60408051600380825260808201909252906020820160608038833950506040805160038082526080820190925292975090506020820160608038833901905050935072efdd5883ec628983e9063c7d969fe268bbf3108560018151811015156101a457fe5b73ffffffffffffffffffffffffffffffffffffffff90921660209283029091019091015283516802b5e3af16b188000090859060019081106101e257fe5b60209081029091010152845172756cf8159095948496617f5fb17ed95059f536908690600290811061021057fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152835167c249fdd327780000908590600290811061024d57fe5b60209081029091010152600092505b898310156103b75788888481811061027057fe5b9050602002013561ffff1661ffff166000141561030c578a8a8481811061029357fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168560008151811015156102bf57fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101528351680d8d726b7177a8000090859060009081106102fd57fe5b602090810290910101526103ac565b606489898581811061031a57fe5b9050602002013561ffff1661ffff161015156103ac57606489898581811061033e57fe5b9050602002013561ffff1603915060038260080361ffff16681105a0185b50a80000029060020a9004905061039d858c8c86818110151561037b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff166103c8565b94506103a9848261049f565b93505b60019092019161025c565b509299919850909650505050505050565b606080600084516001016040519080825280602002602001820160405280156103fb578160200160208202803883390190505b509150600090505b845181101561045e57848181518110151561041a57fe5b90602001906020020151828281518110151561043257fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101610403565b8382600184510381518110151561047157fe5b73ffffffffffffffffffffffffffffffffffffffff9290921660209283029190910190910152509392505050565b606080600084516001016040519080825280602002602001820160405280156104d2578160200160208202803883390190505b509150600090505b845181101561051b5784818151811015156104f157fe5b90602001906020020151828281518110151561050957fe5b602090810290910101526001016104da565b8382600184510381518110151561052e57fe5b60209081029190910101525093925050505600a165627a7a72305820c9ab92a56245040e76af5fc4f3ac4cf4315336b503db06677c21aa1e00aaa8e20029",
1915
"difficultyBombDelays": {
2016
"0x21e88e": 3000000
2117
}

ethcore/src/client/test_client.rs

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub struct TestBlockChainClient {
118118
}
119119

120120
/// Used for generating test client blocks.
121-
#[derive(Clone)]
121+
#[derive(Clone, Copy)]
122122
pub enum EachBlockWith {
123123
/// Plain block.
124124
Nothing,
@@ -242,69 +242,68 @@ impl TestBlockChainClient {
242242
*self.error_on_logs.write() = val;
243243
}
244244

245-
/// Add blocks to test client.
246-
pub fn add_blocks(&self, count: usize, with: EachBlockWith) {
247-
let len = self.numbers.read().len();
248-
for n in len..(len + count) {
249-
let mut header = BlockHeader::new();
250-
header.set_difficulty(From::from(n));
251-
header.set_parent_hash(self.last_hash.read().clone());
252-
header.set_number(n as BlockNumber);
253-
header.set_gas_limit(U256::from(1_000_000));
254-
header.set_extra_data(self.extra_data.clone());
255-
let uncles = match with {
256-
EachBlockWith::Uncle | EachBlockWith::UncleAndTransaction => {
257-
let mut uncles = RlpStream::new_list(1);
258-
let mut uncle_header = BlockHeader::new();
259-
uncle_header.set_difficulty(From::from(n));
260-
uncle_header.set_parent_hash(self.last_hash.read().clone());
261-
uncle_header.set_number(n as BlockNumber);
262-
uncles.append(&uncle_header);
263-
header.set_uncles_hash(keccak(uncles.as_raw()));
264-
uncles
265-
},
266-
_ => RlpStream::new_list(0)
267-
};
268-
let txs = match with {
269-
EachBlockWith::Transaction | EachBlockWith::UncleAndTransaction => {
270-
let mut txs = RlpStream::new_list(1);
271-
let keypair = Random.generate().unwrap();
272-
// Update nonces value
273-
self.nonces.write().insert(keypair.address(), U256::one());
274-
let tx = Transaction {
275-
action: Action::Create,
276-
value: U256::from(100),
277-
data: "3331600055".from_hex().unwrap(),
278-
gas: U256::from(100_000),
279-
gas_price: U256::from(200_000_000_000u64),
280-
nonce: U256::zero()
281-
};
282-
let signed_tx = tx.sign(keypair.secret(), None);
283-
txs.append(&signed_tx);
284-
txs.out()
285-
},
286-
_ => ::rlp::EMPTY_LIST_RLP.to_vec()
287-
};
288-
289-
let mut rlp = RlpStream::new_list(3);
290-
rlp.append(&header);
291-
rlp.append_raw(&txs, 1);
292-
rlp.append_raw(uncles.as_raw(), 1);
293-
let unverified = Unverified::from_rlp(rlp.out()).unwrap();
294-
self.import_block(unverified).unwrap();
295-
}
296-
}
245+
/// Add a block to test client.
246+
pub fn add_block<F>(&self, with: EachBlockWith, hook: F)
247+
where F: Fn(BlockHeader) -> BlockHeader
248+
{
249+
let n = self.numbers.read().len();
250+
251+
let mut header = BlockHeader::new();
252+
header.set_difficulty(From::from(n));
253+
header.set_parent_hash(self.last_hash.read().clone());
254+
header.set_number(n as BlockNumber);
255+
header.set_gas_limit(U256::from(1_000_000));
256+
header.set_extra_data(self.extra_data.clone());
257+
258+
header = hook(header);
259+
260+
let uncles = match with {
261+
EachBlockWith::Uncle | EachBlockWith::UncleAndTransaction => {
262+
let mut uncles = RlpStream::new_list(1);
263+
let mut uncle_header = BlockHeader::new();
264+
uncle_header.set_difficulty(From::from(n));
265+
uncle_header.set_parent_hash(self.last_hash.read().clone());
266+
uncle_header.set_number(n as BlockNumber);
267+
uncles.append(&uncle_header);
268+
header.set_uncles_hash(keccak(uncles.as_raw()));
269+
uncles
270+
},
271+
_ => RlpStream::new_list(0)
272+
};
273+
let txs = match with {
274+
EachBlockWith::Transaction | EachBlockWith::UncleAndTransaction => {
275+
let mut txs = RlpStream::new_list(1);
276+
let keypair = Random.generate().unwrap();
277+
// Update nonces value
278+
self.nonces.write().insert(keypair.address(), U256::one());
279+
let tx = Transaction {
280+
action: Action::Create,
281+
value: U256::from(100),
282+
data: "3331600055".from_hex().unwrap(),
283+
gas: U256::from(100_000),
284+
gas_price: U256::from(200_000_000_000u64),
285+
nonce: U256::zero()
286+
};
287+
let signed_tx = tx.sign(keypair.secret(), None);
288+
txs.append(&signed_tx);
289+
txs.out()
290+
},
291+
_ => ::rlp::EMPTY_LIST_RLP.to_vec()
292+
};
297293

298-
/// Make a bad block by setting invalid extra data.
299-
pub fn corrupt_block(&self, n: BlockNumber) {
300-
let hash = self.block_hash(BlockId::Number(n)).unwrap();
301-
let mut header: BlockHeader = self.block_header(BlockId::Number(n)).unwrap().decode().expect("decoding failed");
302-
header.set_extra_data(b"This extra data is way too long to be considered valid".to_vec());
303294
let mut rlp = RlpStream::new_list(3);
304295
rlp.append(&header);
305-
rlp.append_raw(&::rlp::NULL_RLP, 1);
306-
rlp.append_raw(&::rlp::NULL_RLP, 1);
307-
self.blocks.write().insert(hash, rlp.out());
296+
rlp.append_raw(&txs, 1);
297+
rlp.append_raw(uncles.as_raw(), 1);
298+
let unverified = Unverified::from_rlp(rlp.out()).unwrap();
299+
self.import_block(unverified).unwrap();
300+
}
301+
302+
/// Add a sequence of blocks to test client.
303+
pub fn add_blocks(&self, count: usize, with: EachBlockWith) {
304+
for _ in 0..count {
305+
self.add_block(with, |header| header);
306+
}
308307
}
309308

310309
/// Make a bad block by setting invalid parent hash.

0 commit comments

Comments
 (0)