From 209ed4af915ddf7ad08bb028e4332d454263f934 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 15:44:43 +0800 Subject: [PATCH 01/72] Create a basic spec for casper testing The current testnet seems to be outdated. So currently we use a tmp spec for testing. --- ethcore/res/ethereum/casper_test.json | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 ethcore/res/ethereum/casper_test.json diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json new file mode 100644 index 00000000000..71e1da37a2e --- /dev/null +++ b/ethcore/res/ethereum/casper_test.json @@ -0,0 +1,64 @@ +{ + "name": "Casper Testnet", + "dataDir": "caspertest", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x1", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": "0x4563918244F40000", + "homesteadTransition": "0x0", + "eip150Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip649Reward": "0x29A2241AF62C0000", + "eip100bTransition": "0x0", + "eip649Transition": "0x0" + } + } + }, + "params": { + "gasLimitBoundDivisor": "0x0400", + "registrar" : "0xe3389675d0338462dC76C6f9A3e432550c36A142", + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID" : "0x4827", + "eip155Transition": "0x0", + "eip98Transition": "0x7fffffffffffff", + "eip86Transition": "0x7fffffffffffff", + "maxCodeSize": 24576, + "maxCodeSizeTransition": "0x0", + "eip140Transition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip658Transition": "0x0" + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x0000000000000056", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "difficulty": "0x2000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", + "gasLimit": "0x5f5e100" + }, + "nodes": [], + "accounts": { + "0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, + "0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, + "0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } }, + "0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, + "0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "pricing": { "modexp": { "divisor": 20 } } } }, + "0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "pricing": { "linear": { "base": 500, "word": 0 } } } }, + "0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "pricing": { "linear": { "base": 40000, "word": 0 } } } }, + "0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } } + } +} From dc1a3de23756395880247f668597e032cc00b9c2 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 15:56:28 +0800 Subject: [PATCH 02/72] Add basic hybridCasperTransition flag --- ethcore/res/ethereum/casper_test.json | 3 ++- ethcore/src/ethereum/ethash.rs | 3 +++ ethcore/src/machine.rs | 3 +++ json/src/spec/ethash.rs | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index 71e1da37a2e..c661542840f 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -15,7 +15,8 @@ "eip161dTransition": "0x0", "eip649Reward": "0x29A2241AF62C0000", "eip100bTransition": "0x0", - "eip649Transition": "0x0" + "eip649Transition": "0x0", + "hybridCasperTransition": "0x1" } } }, diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 9b3945e38b1..2f2cef0cd5b 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -124,6 +124,8 @@ pub struct EthashParams { pub expip2_transition: u64, /// EXPIP-2 duration limit pub expip2_duration_limit: u64, + /// Number of first block wehre Casper rules begin. + pub hybrid_casper_transition: u64, } impl From for EthashParams { @@ -154,6 +156,7 @@ impl From for EthashParams { eip649_reward: p.eip649_reward.map(Into::into), expip2_transition: p.expip2_transition.map_or(u64::max_value(), Into::into), expip2_duration_limit: p.expip2_duration_limit.map_or(30, Into::into), + hybrid_casper_transition: p.hybrid_casper_transition.map_or(u64::max_value(), Into::into), } } } diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 1bd3805ef3b..c228b051505 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -60,6 +60,8 @@ pub struct EthashExtensions { pub dao_hardfork_beneficiary: Address, /// DAO hard-fork DAO accounts list (L) pub dao_hardfork_accounts: Vec
, + /// Number of first block wehre Casper rules begin. + pub hybrid_casper_transition: u64, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { @@ -73,6 +75,7 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { dao_hardfork_transition: p.dao_hardfork_transition.map_or(u64::max_value(), Into::into), dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into), dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(), + hybrid_casper_transition: p.hybrid_casper_transition.map_or_else(u64::max_value, Into::into), } } } diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index afa8b596823..f70ac196303 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -137,6 +137,10 @@ pub struct EthashParams { /// EXPIP-2 duration limit #[serde(rename="expip2DurationLimit")] pub expip2_duration_limit: Option, + + /// EIP1011 transition block + #[serde(rename="hybridCasperTransition")] + pub hybrid_casper_transition: Option, } /// Ethash engine deserialization. From b8c6dc5bd0e6e1df947b556b356c3696e17fe68d Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:20:08 +0800 Subject: [PATCH 03/72] Refactor contract hex code and update casper ones --- ethcore/res/code/blockhash.hex | 1 + ethcore/res/code/msg_hasher.hex | 1 + ethcore/res/code/purity_checker.hex | 1 + ethcore/res/code/simple_casper.hex | 1 + ethcore/src/engines/mod.rs | 11 ++++++++++- ethcore/src/machine.rs | 19 +++++++++++++++++++ 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 ethcore/res/code/blockhash.hex create mode 100644 ethcore/res/code/msg_hasher.hex create mode 100644 ethcore/res/code/purity_checker.hex create mode 100644 ethcore/res/code/simple_casper.hex diff --git a/ethcore/res/code/blockhash.hex b/ethcore/res/code/blockhash.hex new file mode 100644 index 00000000000..a6e35ce460c --- /dev/null +++ b/ethcore/res/code/blockhash.hex @@ -0,0 +1 @@ +"73fffffffffffffffffffffffffffffffffffffffe33141561006a5760014303600035610100820755610100810715156100455760003561010061010083050761010001555b6201000081071515610064576000356101006201000083050761020001555b5061013e565b4360003512151561008457600060405260206040f361013d565b61010060003543031315156100a857610100600035075460605260206060f361013c565b6101006000350715156100c55762010000600035430313156100c8565b60005b156100ea576101006101006000350507610100015460805260206080f361013b565b620100006000350715156101095763010000006000354303131561010c565b60005b1561012f57610100620100006000350507610200015460a052602060a0f361013a565b600060c052602060c0f35b5b5b5b5b" diff --git a/ethcore/res/code/msg_hasher.hex b/ethcore/res/code/msg_hasher.hex new file mode 100644 index 00000000000..c4f62229c51 --- /dev/null +++ b/ethcore/res/code/msg_hasher.hex @@ -0,0 +1 @@ +"60007f01000000000000000000000000000000000000000000000000000000000000006000350460f8811215610038576001915061003f565b60f6810391505b508060005b368312156100c8577f01000000000000000000000000000000000000000000000000000000000000008335048391506080811215610087576001840193506100c2565b60b881121561009d57607f8103840193506100c1565b60c08112156100c05760b68103600185013560b783036020035260005101840193505b5b5b50610044565b81810360388112156100f4578060c00160005380836001378060010160002060e052602060e0f3610143565b61010081121561010557600161011b565b6201000081121561011757600261011a565b60035b5b8160005280601f038160f701815382856020378282600101018120610140526020610140f350505b50505050" diff --git a/ethcore/res/code/purity_checker.hex b/ethcore/res/code/purity_checker.hex new file mode 100644 index 00000000000..a7cae7dbe37 --- /dev/null +++ b/ethcore/res/code/purity_checker.hex @@ -0,0 +1 @@ +"600061033f537c0100000000000000000000000000000000000000000000000000000000600035047f80010000000000000000000000000000000000000030ffff1c0e00000000000060205263a1903eab8114156103f7573659905901600090523660048237600435608052506080513b806020015990590160009052818152602081019050905060a0526080513b600060a0516080513c6080513b8060200260200159905901600090528181526020810190509050610100526080513b806020026020015990590160009052818152602081019050905061016052600060005b602060a05103518212156103c957610100601f8360a051010351066020518160020a161561010a57fe5b80606013151561011e57607f811315610121565b60005b1561014f5780607f036101000a60018460a0510101510482602002610160510152605e8103830192506103b2565b60f18114801561015f5780610164565b60f282145b905080156101725780610177565b60f482145b9050156103aa5760028212151561019e5760606001830360200261010051015112156101a1565b60005b156101bc57607f6001830360200261010051015113156101bf565b60005b156101d157600282036102605261031e565b6004821215156101f057600360018303602002610100510151146101f3565b60005b1561020d57605a6002830360200261010051015114610210565b60005b1561022b57606060038303602002610100510151121561022e565b60005b1561024957607f60038303602002610100510151131561024c565b60005b1561025e57600482036102605261031d565b60028212151561027d57605a6001830360200261010051015114610280565b60005b1561029257600282036102605261031c565b6002821215156102b157609060018303602002610100510151146102b4565b60005b156102c657600282036102605261031b565b6002821215156102e65760806001830360200261010051015112156102e9565b60005b156103035760906001830360200261010051015112610306565b60005b1561031857600282036102605261031a565bfe5b5b5b5b5b604060405990590160009052600081526102605160200261016051015181602001528090502054156103555760016102a052610393565b60306102605160200261010051015114156103755760016102a052610392565b60606102605160200261010051015114156103915760016102a0525b5b5b6102a051151561039f57fe5b6001830192506103b1565b6001830192505b5b8082602002610100510152600182019150506100e0565b50506001604060405990590160009052600081526080518160200152809050205560016102e05260206102e0f35b63c23697a8811415610440573659905901600090523660048237600435608052506040604059905901600090526000815260805181602001528090502054610300526020610300f35b50" diff --git a/ethcore/res/code/simple_casper.hex b/ethcore/res/code/simple_casper.hex new file mode 100644 index 00000000000..d803201a9db --- /dev/null +++ b/ethcore/res/code/simple_casper.hex @@ -0,0 +1 @@ +"600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526316d5c53d60005114156103105761010060046101403734156100b557600080fd5b606051600435806040519013585780919012156100d157600080fd5b50606051602435806040519013585780919012156100ee57600080fd5b506060516044358060405190135857809190121561010b57600080fd5b50606435602051811061011d57600080fd5b50608435602051811061012f57600080fd5b5060605160e4358060405190135857809190121561014c57600080fd5b506015541561015a57600080fd5b6101006101405112600061014051131661017357600080fd5b600061016051121561018457600080fd5b600261018051121561019557600080fd5b60006101e05112156101a657600080fd5b60006102005112156101b757600080fd5b600061022051136101c757600080fd5b60016015556101405160165561016051601755610180516018556101e051601b5561020051601c5561022051601d55600060a0516016548061020857600080fd5b6402540be4004302058060805190135857809190121561022757600080fd5b121561026f576402540be4006402540be3ff60a0516016548061024957600080fd5b6402540be4004302058060805190135857809190121561026857600080fd5b03056102a6565b6402540be40060a0516016548061028557600080fd5b6402540be400430205806080519013585780919012156102a457600080fd5b055b601e556101a0516019556101c051601a5560016002556000600455601e54600f5568056bc75e2d63100000600f54600c60c052602060c0200155600060065560006007556c0c9f2c9cd04674edea40000000601f5562030d4060205562030d406021556003602255005b639a8eec77600051141561035f57341561032957600080fd5b30331461033557600080fd5b606051601054600f54038060405190135857809190121561035557600080fd5b60005260206000f3005b63db23eee0600051141561068f57341561037857600080fd5b30331461038457600080fd5b600f54610140526060516001600060a051670de0b6b3a764000060a05160605160016101405103806040519013585780919012156103c157600080fd5b600c60c052602060c0200154600754600654808212156103e157806103e3565b815b9050905081810281198383830514176103fb57600080fd5b6402540be40081059050905090508060805190135857809190121561041f57600080fd5b058060805190135857809190121561043657600080fd5b12156104f3576402540be4006402540be3ff60a051670de0b6b3a764000060a051606051600161014051038060405190135857809190121561047757600080fd5b600c60c052602060c0200154600754600654808212156104975780610499565b815b9050905081810281198383830514176104b157600080fd5b6402540be4008105905090509050806080519013585780919012156104d557600080fd5b05806080519013585780919012156104ec57600080fd5b030561059f565b6402540be40060a051670de0b6b3a764000060a051606051600161014051038060405190135857809190121561052857600080fd5b600c60c052602060c020015460075460065480821215610548578061054a565b815b90509050818102811983838305141761056257600080fd5b6402540be40081059050905090508060805190135857809190121561058657600080fd5b058060805190135857809190121561059d57600080fd5b055b01806040519013585780919012156105b657600080fd5b6101605260a0516404a817c80068056bc75e2d63100000610160510205806080519013585780919012156105e957600080fd5b610180526101a060006014818352015b60a051600260a05160a051610180518061061257600080fd5b68056bc75e2d631000006101605102058060805190135857809190121561063857600080fd5b61018051018060805190135857809190121561065357600080fd5b058060805190135857809190121561066a57600080fd5b610180525b81516001018083528114156105f9575b50506101805160005260206000f3005b63de7f997560005114156106cb5734156106a857600080fd5b3033146106b457600080fd5b6000600754136000600654131660005260206000f3005b63d286bb8260005114156107e65734156106e457600080fd5b3033146106f057600080fd5b600f54610140526002606051600261014051038060405190135857809190121561071957600080fd5b600a60c052602060c0200160c052602060c0200154156107a057600460605160018254018060405190135857809190121561075357600080fd5b815550600654600755600660a051600454600560c052602060c02001548254018060805190135857809190121561078957600080fd5b81555061014051600454600860c052602060c02001555b60045461014051600960c052602060c0200155600b54156107df5760605160016101405103806040519013585780919012156107db57600080fd5b6013555b6000600b55005b636526ed7260005114156109645734156107ff57600080fd5b30331461080b57600080fd5b600f54610140526001600b5560016003606051600161014051038060405190135857809190121561083b57600080fd5b600a60c052602060c0200160c052602060c020015560016002606051600161014051038060405190135857809190121561087457600080fd5b600a60c052602060c0200160c052602060c020015560605160016101405103806040519013585780919012156108a957600080fd5b60115560605160016101405103806040519013585780919012156108cc57600080fd5b60105560016101a05260016101c05260406101605260016101a05260016101c052606051600161014051038060405190135857809190121561090d57600080fd5b600160c052602060c0200154606051600161014051038060405190135857809190121561093957600080fd5b7f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b9610160516101a0a3005b63acc619c36000511415610b7757341561097d57600080fd5b30331461098957600080fd5b600f5461014052600260206101e06004639a8eec776101805261019c6000305af16109b357600080fd5b6101e05113156101605261016051156020610260600463de7f99756102005261021c6000305af16109e357600080fd5b610260511517156109f957600060005260206000f35b60a05160135460016060516001610140510380604051901358578091901215610a2157600080fd5b600a60c052602060c0200160c052602060c0200160c052602060c020015460065480610a4c57600080fd5b806402540be4008302059050905080608051901358578091901215610a7057600080fd5b6102805260a05160135460056060516001610140510380604051901358578091901215610a9c57600080fd5b600a60c052602060c0200160c052602060c0200160c052602060c020015460075480610ac757600080fd5b806402540be4008302059050905080608051901358578091901215610aeb57600080fd5b6102a052610280516102a05180821315610b055780610b07565b815b905090506102c05260a051600260a0516012546102c0518181028119838383051417610b3257600080fd5b6402540be400810590509050905080608051901358578091901215610b5657600080fd5b0580608051901358578091901215610b6d57600080fd5b60005260206000f3005b63579f38b26000511415610ec15760406004610140373415610b9857600080fd5b303314610ba457600080fd5b60605160043580604051901358578091901215610bc057600080fd5b5060605160243580604051901358578091901215610bdd57600080fd5b50600161014051600060c052602060c0200160c052602060c0200160a0516402540be400610160510282540180608051901358578091901215610c1f57600080fd5b815550600461014051600060c052602060c0200160c052602060c020015461018052600261014051600060c052602060c0200160c052602060c02001546101a0526004546101c05260605160016101c0510380604051901358578091901215610c8757600080fd5b6101e0526101a0516101c051126101c0516101805113151615610cd157600660a0516402540be400610160510282540180608051901358578091901215610ccd57600080fd5b8155505b6101a0516101e051126101e0516101805113151615610d1757600760a0516402540be400610160510282540180608051901358578091901215610d1357600080fd5b8155505b601f546101a0511215610d5e576101a051600560c052602060c0200160a0516402540be400610160510282540380608051901358578091901215610d5a57600080fd5b8155505b6000600060006000600060a051600860a051600f54600c60c052602060c0200154610160518181028119838383051417610d9757600080fd5b8090509050905080608051901358578091901215610db457600080fd5b0580608051901358578091901215610dcb57600080fd5b1215610e47576402540be4006402540be3ff60a051600860a051600f54600c60c052602060c0200154610160518181028119838383051417610e0c57600080fd5b8090509050905080608051901358578091901215610e2957600080fd5b0580608051901358578091901215610e4057600080fd5b0305610eb2565b6402540be40060a051600860a051600f54600c60c052602060c0200154610160518181028119838383051417610e7c57600080fd5b8090509050905080608051901358578091901215610e9957600080fd5b0580608051901358578091901215610eb057600080fd5b055b416000f1610ebf57600080fd5b005b6301b7af186000511415610f7c5760206004610140373415610ee257600080fd5b303314610eee57600080fd5b60605160043580604051901358578091901215610f0a57600080fd5b506000600661014051600060c052602060c0200160c052602060c0200154600360c052602060c020015561014051600060c052602060c0200160c052602060c0206000815560006001820155600060028201556000600382015560006004820155600060058201556000600682015550005b63a276740060005114156110b75760606004610140373415610f9d57600080fd5b303314610fa957600080fd5b6104206024356004016101a037610400602435600401351115610fcb57600080fd5b60605160443580604051901358578091901215610fe757600080fd5b5060016000610140516020826105e00101526020810190506101a0610400806020846105e001018260208501600060046078f1505080518201915050806105e0526105e09050805160200180610a40828460006004600a8704601201f161104d57600080fd5b50506020610ec0610a4051610a60600061018051600060c052602060c0200160c052602060c02054602154f161108257600080fd5b6020610ea052610ea06020600060208351038113156110a057600080fd5b0460200260200181015190501460005260206000f3005b6337df0ba860005114156111a25734156110d057600080fd5b60a0516013546001600f54600a60c052602060c0200160c052602060c0200160c052602060c02001546006548061110657600080fd5b806402540be400830205905090508060805190135857809190121561112a57600080fd5b60a0516013546005600f54600a60c052602060c0200160c052602060c0200160c052602060c02001546007548061116057600080fd5b806402540be400830205905090508060805190135857809190121561118457600080fd5b808213156111925780611194565b815b9050905060005260206000f3005b6399fb5eec600051141561133c57602060046101403734156111c357600080fd5b606051600435806040519013585780919012156111df57600080fd5b50600060a051600f54600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761122357600080fd5b6402540be40081059050905090508060805190135857809190121561124757600080fd5b12156112c5576402540be4006402540be3ff60a051600f54600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761129a57600080fd5b6402540be4008105905090509050806080519013585780919012156112be57600080fd5b0305611332565b6402540be40060a051600f54600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761130c57600080fd5b6402540be40081059050905090508060805190135857809190121561133057600080fd5b055b60005260206000f3005b634a8fd698600051141561146957341561135557600080fd5b600060a051600f54600c60c052602060c0200154600654818102811983838305141761138057600080fd5b6402540be4008105905090509050806080519013585780919012156113a457600080fd5b121561140a576402540be4006402540be3ff60a051600f54600c60c052602060c020015460065481810281198383830514176113df57600080fd5b6402540be40081059050905090508060805190135857809190121561140357600080fd5b030561145f565b6402540be40060a051600f54600c60c052602060c0200154600654818102811983838305141761143957600080fd5b6402540be40081059050905090508060805190135857809190121561145d57600080fd5b055b60005260206000f3005b637db2eedc600051141561159657341561148257600080fd5b600060a051600f54600c60c052602060c020015460075481810281198383830514176114ad57600080fd5b6402540be4008105905090509050806080519013585780919012156114d157600080fd5b1215611537576402540be4006402540be3ff60a051600f54600c60c052602060c0200154600754818102811983838305141761150c57600080fd5b6402540be40081059050905090508060805190135857809190121561153057600080fd5b030561158c565b6402540be40060a051600f54600c60c052602060c0200154600754818102811983838305141761156657600080fd5b6402540be40081059050905090508060805190135857809190121561158a57600080fd5b055b60005260206000f3005b6313d21fa36000511415611c8a57604060046101403734156115b757600080fd5b610420600435600401610180376104006004356004013511156115d957600080fd5b6104206024356004016105c0376104006024356004013511156115fb57600080fd5b610180805160200180610a20828460006004600a8704601201f161161e57600080fd5b50506020610e80610a2051610a406000601954602054f161163e57600080fd5b6020610e6052610e6060206000602083510381131561165c57600080fd5b046020026020018101519050610a0052611520610180610620610ec08251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610ec051146116ab57600080fd5b610ec051610ec0018060200151600082518060209013585780919012156116d157600080fd5b601f6101000a82048115176116e557600080fd5b606051816020036101000a83048060405190135857809190121561170857600080fd5b90509050905081526020610ee051610ec001511461172557600080fd5b610ee051610ee001518160200152610f0051610ec00180602001516000825180602090135857809190121561175957600080fd5b601f6101000a820481151761176d57600080fd5b606051816020036101000a83048060405190135857809190121561179057600080fd5b9050905090508160400152610f2051610ec0018060200151600082518060209013585780919012156117c157600080fd5b601f6101000a82048115176117d557600080fd5b606051816020036101000a8304806040519013585780919012156117f857600080fd5b9050905090508160600152610f4051610ec00180516020018083608001828460006004600a8704601201f161182c57600080fd5b505050611520516119e05261156051611a005261158051611a20526115a0805160200180611a40828460006004600a8704601201f161186a57600080fd5b50506105c0805160200180611ea0828460006004600a8704601201f161188f57600080fd5b50506020612300611ea051611ec06000601954602054f16118af57600080fd5b60206122e0526122e06020600060208351038113156118cd57600080fd5b046020026020018101519050611e80526129a06105c06106206123408251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0612340511461191c57600080fd5b612340516123400180602001516000825180602090135857809190121561194257600080fd5b601f6101000a820481151761195657600080fd5b606051816020036101000a83048060405190135857809190121561197957600080fd5b905090509050815260206123605161234001511461199657600080fd5b612360516123600151816020015261238051612340018060200151600082518060209013585780919012156119ca57600080fd5b601f6101000a82048115176119de57600080fd5b606051816020036101000a830480604051901358578091901215611a0157600080fd5b90509050905081604001526123a05161234001806020015160008251806020901358578091901215611a3257600080fd5b601f6101000a8204811517611a4657600080fd5b606051816020036101000a830480604051901358578091901215611a6957600080fd5b90509050905081606001526123c0516123400180516020018083608001828460006004600a8704601201f1611a9d57600080fd5b5050506129a051612e60526129e051612e8052612a0051612ea052612a20805160200180612ec0828460006004600a8704601201f1611adb57600080fd5b505060206137e0610484606063a276740061330052610a0051613320528061334052611a40808051602001808461332001828460006004600a8704601201f1611b2357600080fd5b5050805182016020019150506119e0516133605261331c90506000305af1611b4a57600080fd5b6137e0511515611b5f57600060005260206000f35b6020613ce0610484606063a276740061380052611e8051613820528061384052612ec0808051602001808461382001828460006004600a8704601201f1611ba557600080fd5b505080518201602001915050612e60516138605261381c90506000305af1611bcc57600080fd5b613ce0511515611be157600060005260206000f35b612e60516119e051141515611bfb57600060005260206000f35b611e8051610a00511415611c1457600060005260206000f35b60036119e051600060c052602060c0200160c052602060c020015415611c3f57600060005260206000f35b612e8051611a005114613d0052611a2051612ea05112611a0051612e80511316612ea051611a205112612e8051611a0051131617613d2052613d2051613d00511760005260206000f3005b6310f246356000511415611cb0573415611ca357600080fd5b60135460005260206000f3005b63855f372c6000511415611d2d573415611cc957600080fd5b6060516001606051601654600f540280604051901358578091901215611cee57600080fd5b0380604051901358578091901215611d0557600080fd5b6101004303811215611d1657600080fd5b438110611d2257600080fd5b4060005260206000f3005b635c0a75de6000511415611e5f5760206004610140373415611d4e57600080fd5b60605160043580604051901358578091901215611d6a57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f540380604051901358578091901215611da457600080fd5b61016052600361016051600a60c052602060c0200160c052602060c02001546101a0526101405161016051600a60c052602060c0200160c052602060c0205412156101c05261014051600461016051600a60c052602060c0200160c052602060c020015412156101e0526101e0516101c051166101a0511615611e2e576101605160005260206000f35b601e54610160511415611e4057611e51565b5b8151600101808352811415611d83575b5050600060005260206000f3005b631f994c406000511415611fb05760206004610140373415611e8057600080fd5b60605160043580604051901358578091901215611e9c57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f540380604051901358578091901215611ed657600080fd5b61016052600261016051600a60c052602060c0200160c052602060c02001546101a0526101405161016051600a60c052602060c0200160c052602060c0205412156101c05261014051600461016051600a60c052602060c0200160c052602060c020015412156101e0526101e0516101c051166101a0511615611f60576101605160005260206000f35b601e54610160511415611f7257611f83565b5b8151600101808352811415611eb5575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000f3005b635dcffc1760005114156124c25760206004610140373415611fd157600080fd5b60605160043580604051901358578091901215611fed57600080fd5b50600060a0516016548061200057600080fd5b6402540be4004302058060805190135857809190121561201f57600080fd5b1215612067576402540be4006402540be3ff60a0516016548061204157600080fd5b6402540be4004302058060805190135857809190121561206057600080fd5b030561209e565b6402540be40060a0516016548061207d57600080fd5b6402540be4004302058060805190135857809190121561209c57600080fd5b055b610160526060516001600f5401806040519013585780919012156120c157600080fd5b610140511461016051610140511315166120da57600080fd5b60206101e06004634a8fd6986101805261019c6000305af16120fb57600080fd5b6101e05161014051600a60c052602060c0200160c052602060c0205560206102606004637db2eedc6102005261021c6000305af161213857600080fd5b61026051600461014051600a60c052602060c0200160c052602060c020015561014051600f5560a05160206102e0600463acc619c36102805261029c6000305af161218257600080fd5b6102e0516402540be40001806080519013585780919012156121a357600080fd5b600e5560a051600e5460a0516012546402540be40001806080519013585780919012156121cf57600080fd5b806121d957600080fd5b806402540be40083020590509050806080519013585780919012156121fd57600080fd5b600d5560a051600d54606051600161014051038060405190135857809190121561222657600080fd5b600c60c052602060c0200154818102811983838305141761224657600080fd5b6402540be40081059050905090508060805190135857809190121561226a57600080fd5b61014051600c60c052602060c0200155606051600161014051038060405190135857809190121561229a57600080fd5b601460c052602060c020015461014051601460c052602060c020015560206103c0600463de7f99756103605261037c6000305af16122d757600080fd5b6103c051156123ea5760a051601b546020610460600463db23eee06104005261041c6000305af161230757600080fd5b610460518061231557600080fd5b806402540be400830205905090508060805190135857809190121561233957600080fd5b6103e05260a05160a051606051600260206104e06004639a8eec776104805261049c6000305af161236957600080fd5b6104e051038060405190135857809190121561238457600080fd5b601c54818102811983838305141761239b57600080fd5b80905090509050806080519013585780919012156123b857600080fd5b6103e05101806080519013585780919012156123d357600080fd5b6012556000601254136123e557600080fd5b612410565b600060006004636526ed726103005261031c6000305af161240a57600080fd5b60006012555b6020610560600463855f372c6105005261051c6000305af161243157600080fd5b6105605161014051600160c052602060c020015560006000600463d286bb826105805261059c6000305af161246557600080fd5b60006106205260006106405260406105e05260006106205260006106405261014051600160c052602060c0200154610140517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96105e051610620a3005b63f9609f08600051141561289857604060046101403760043560205181106124e957600080fd5b5060243560205181106124fb57600080fd5b50600060a0516016548061250e57600080fd5b6402540be4004302058060805190135857809190121561252d57600080fd5b1215612575576402540be4006402540be3ff60a0516016548061254f57600080fd5b6402540be4004302058060805190135857809190121561256e57600080fd5b03056125ac565b6402540be40060a0516016548061258b57600080fd5b6402540be400430205806080519013585780919012156125aa57600080fd5b055b600f54146125b957600080fd5b600060006004610180527fa1903eab000000000000000000000000000000000000000000000000000000006101a0526101806004806020846101e001018260208501600060046012f1505080518201915050610140516020826101e0010152602081019050806101e0526101e09050805160200180610260828460006004600a8704601201f161264857600080fd5b50506020610300610260516102806000601a546207a120f161266957600080fd5b60206102e0526102e060206000602083510381131561268757600080fd5b046020026020018101519050141561269e57600080fd5b61016051600360c052602060c0200154156126b857600080fd5b601d543412156126c757600080fd5b606051600260045401806040519013585780919012156126e657600080fd5b6103405260a051600f54600c60c052602060c02001548061270657600080fd5b68056bc75e2d631000003402058060805190135857809190121561272957600080fd5b61036052600254600060c052602060c0200160c052602060c020610140518155610360516001820155601f54600282015560006003820155610340516004820155600060058201556101605160068201555060025461016051600360c052602060c020015560026060516001825401806040519013585780919012156127ae57600080fd5b81555061034051600560c052602060c0200160a05161036051825401806080519013585780919012156127e057600080fd5b815550610140516103c052600461016051600360c052602060c0200154600060c052602060c0200160c052602060c02001546103e0523461040052606061038052610140516103c052600461016051600360c052602060c0200154600060c052602060c0200160c052602060c02001546103e052346104005261016051600360c052602060c0200154610160517fc913dcae46368ac8a73eb63d4f2077a2de58e994bf2cddf074ab3a0fcaa3a0e1610380516103c0a3005b6342310c326000511415612dab57602060046101403734156128b957600080fd5b610420600435600401610160376104006004356004013511156128db57600080fd5b600060a051601654806128ed57600080fd5b6402540be4004302058060805190135857809190121561290c57600080fd5b1215612954576402540be4006402540be3ff60a0516016548061292e57600080fd5b6402540be4004302058060805190135857809190121561294d57600080fd5b030561298b565b6402540be40060a0516016548061296a57600080fd5b6402540be4004302058060805190135857809190121561298957600080fd5b055b600f541461299857600080fd5b6101608051602001806105c0828460006004600a8704601201f16129bb57600080fd5b50506020610a206105c0516105e06000601954602054f16129db57600080fd5b6020610a0052610a006020600060208351038113156129f957600080fd5b0460200260200181015190506105a052611000610160610560610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610aa0f150506080610a605114612a4857600080fd5b610a6051610a6001806020015160008251806020901358578091901215612a6e57600080fd5b601f6101000a8204811517612a8257600080fd5b606051816020036101000a830480604051901358578091901215612aa557600080fd5b9050905090508152610a8051610a6001806020015160008251806020901358578091901215612ad357600080fd5b601f6101000a8204811517612ae757600080fd5b606051816020036101000a830480604051901358578091901215612b0a57600080fd5b9050905090508160200152610aa051610a600180516020018083604001828460006004600a8704601201f1612b3e57600080fd5b5050506110005161148052611020516114a0526110408051602001806114c0828460006004600a8704601201f1612b7457600080fd5b50506114a051600f541215612b8857600080fd5b600661148051600060c052602060c0200160c052602060c02001543314611900526020611e00610484606063a2767400611920526105a0516119405280611960526114c0808051602001808461194001828460006004600a8704601201f1612bef57600080fd5b505080518201602001915050611480516119805261193c90506000305af1612c1657600080fd5b611e00516119005117612c2857600080fd5b6060516018546004540180604051901358578091901215612c4857600080fd5b611e2052611e2051600261148051600060c052602060c0200160c052602060c020015413612c7557600080fd5b611e2051600261148051600060c052602060c0200160c052602060c02001556020611ea06004634a8fd698611e4052611e5c6000305af1612cb557600080fd5b611ea051600561148051600060c052602060c0200160c052602060c0200155611e2051600560c052602060c0200160a051600161148051600060c052602060c0200160c052602060c020015482540380608051901358578091901215612d1a57600080fd5b815550600261148051600060c052602060c0200160c052602060c0200154611f00526020611ec052600261148051600060c052602060c0200160c052602060c0200154611f005261148051600661148051600060c052602060c0200160c052602060c02001547fb0da0cd4d3f901fa403fa301bd3cad4934e079e9f1a5b61bdb33a03da2c9aaaf611ec051611f00a3005b63edea1480600051141561342c5760206004610140373415612dcc57600080fd5b60605160043580604051901358578091901215612de857600080fd5b50600261014051600060c052602060c0200160c052602060c020015460045413612e1157600080fd5b6060516001600261014051600060c052602060c0200160c052602060c02001540180604051901358578091901215612e4857600080fd5b600860c052602060c020015461016052606051601754610160510180604051901358578091901215612e7957600080fd5b6101805261018051600f541215612e8f57600080fd5b600361014051600060c052602060c0200160c052602060c0200154151561300e57600060a05161016051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c02001548181028119838383051417612ef457600080fd5b6402540be400810590509050905080608051901358578091901215612f1857600080fd5b1215612f97576402540be4006402540be3ff60a05161016051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c02001548181028119838383051417612f6c57600080fd5b6402540be400810590509050905080608051901358578091901215612f9057600080fd5b0305613005565b6402540be40060a05161016051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c02001548181028119838383051417612fdf57600080fd5b6402540be40081059050905090508060805190135857809190121561300357600080fd5b055b6101a052613371565b6060516060516060516017546002028060405190135857809190121561303357600080fd5b61018051038060405190135857809190121561304e57600080fd5b601460c052602060c020015461018051601460c052602060c0200154038060405190135857809190121561308157600080fd5b6101c05260a051600561014051600060c052602060c0200160c052602060c0200154806130ad57600080fd5b6402540be4006060516022546101c05102806040519013585780919012156130d457600080fd5b0205806080519013585780919012156130ec57600080fd5b6101e05260a0516101e0516402540be400038060805190135857809190121561311457600080fd5b60006402540be4008102821215613132576402540be4008102613134565b815b9050905061020052600060a05161018051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761318057600080fd5b6402540be4008105905090509050806080519013585780919012156131a457600080fd5b1215613223576402540be4006402540be3ff60a05161018051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c020015481810281198383830514176131f857600080fd5b6402540be40081059050905090508060805190135857809190121561321c57600080fd5b0305613291565b6402540be40060a05161018051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761326b57600080fd5b6402540be40081059050905090508060805190135857809190121561328f57600080fd5b055b61022052600060a051610200516102205181810281198383830514176132b657600080fd5b80905090509050806080519013585780919012156132d357600080fd5b1215613328576402540be4006402540be3ff60a0516102005161022051818102811983838305141761330457600080fd5b809050905090508060805190135857809190121561332157600080fd5b030561336c565b6402540be40060a0516102005161022051818102811983838305141761334d57600080fd5b809050905090508060805190135857809190121561336a57600080fd5b055b6101a0525b60006000600060006101a051600661014051600060c052602060c0200160c052602060c02001546000f16133a457600080fd5b6101a051610280526020610240526101a0516102805261014051600661014051600060c052602060c0200160c052602060c02001547f499b9fc824d01426cfde5b95eebcfc53494a24d6316bb139b2333377f7c00e4761024051610280a36000600060246301b7af186102a052610140516102c0526102bc6000305af161342a57600080fd5b005b63e9dc06146000511415614074576020600461014037341561344d57600080fd5b6104206004356004016101603761040060043560040135111561346f57600080fd5b6101608051602001806105c0828460006004600a8704601201f161349257600080fd5b50506020610a206105c0516105e06000601954602054f16134b257600080fd5b6020610a0052610a006020600060208351038113156134d057600080fd5b0460200260200181015190506105a0526110c0610160610620610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610a60511461351f57600080fd5b610a6051610a600180602001516000825180602090135857809190121561354557600080fd5b601f6101000a820481151761355957600080fd5b606051816020036101000a83048060405190135857809190121561357c57600080fd5b90509050905081526020610a8051610a6001511461359957600080fd5b610a8051610a8001518160200152610aa051610a60018060200151600082518060209013585780919012156135cd57600080fd5b601f6101000a82048115176135e157600080fd5b606051816020036101000a83048060405190135857809190121561360457600080fd5b9050905090508160400152610ac051610a600180602001516000825180602090135857809190121561363557600080fd5b601f6101000a820481151761364957600080fd5b606051816020036101000a83048060405190135857809190121561366c57600080fd5b9050905090508160600152610ae051610a600180516020018083608001828460006004600a8704601201f16136a057600080fd5b5050506110c051611580526110e0516115a052611100516115c052611120516115e052611140805160200180611600828460006004600a8704601201f16136e657600080fd5b50506020611f20610484606063a2767400611a40526105a051611a605280611a80526116008080516020018084611a6001828460006004600a8704601201f161372e57600080fd5b50508051820160200191505061158051611aa052611a5c90506000305af161375557600080fd5b611f205161376257600080fd5b600160605161010061158051078060405190135857809190121561378557600080fd5b60008113151561379d578060000360020a82046137a4565b8060020a82025b90509050600060a0516101006402540be400611580510205806080519013585780919012156137d257600080fd5b1215613813576402540be4006402540be3ff60a0516101006402540be4006115805102058060805190135857809190121561380c57600080fd5b0305613843565b6402540be40060a0516101006402540be4006115805102058060805190135857809190121561384157600080fd5b055b60066115c051600a60c052602060c0200160c052602060c0200160c052602060c0200154161561387257600080fd5b6020611fa0600463855f372c611f4052611f5c6000305af161389357600080fd5b611fa0516115a051146138a557600080fd5b600f546115c051146138b657600080fd5b60036115e051600a60c052602060c0200160c052602060c02001546138da57600080fd5b600461158051600060c052602060c0200160c052602060c0200154611fc052600261158051600060c052602060c0200160c052602060c0200154611fe05260045461200052606051600161200051038060405190135857809190121561393f57600080fd5b61202052611fe051612000511261200051611fc05113151661204052611fe051612020511261202051611fc0511315166120605261206051612040511761398557600080fd5b60016060516101006115805107806040519013585780919012156139a857600080fd5b6000811315156139c0578060000360020a82046139c7565b8060020a82025b90509050600060a0516101006402540be400611580510205806080519013585780919012156139f557600080fd5b1215613a36576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901358578091901215613a2f57600080fd5b0305613a66565b6402540be40060a0516101006402540be40061158051020580608051901358578091901215613a6457600080fd5b055b60066115c051600a60c052602060c0200160c052602060c0200160c052602060c020015417600060a0516101006402540be40061158051020580608051901358578091901215613ab557600080fd5b1215613af6576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901358578091901215613aef57600080fd5b0305613b26565b6402540be40060a0516101006402540be40061158051020580608051901358578091901215613b2457600080fd5b055b60066115c051600a60c052602060c0200160c052602060c0200160c052602060c02001556115e05160016115c051600a60c052602060c0200160c052602060c0200160c052602060c0200154612080526115e05160056115c051600a60c052602060c0200160c052602060c0200160c052602060c02001546120a0526120405115613c155761208060a051600161158051600060c052602060c0200160c052602060c020015482510180608051901358578091901215613be557600080fd5b815250612080516115e05160016115c051600a60c052602060c0200160c052602060c0200160c052602060c02001555b6120605115613c88576120a060a051600161158051600060c052602060c0200160c052602060c020015482510180608051901358578091901215613c5857600080fd5b8152506120a0516115e05160056115c051600a60c052602060c0200160c052602060c0200160c052602060c02001555b6115e0516013541415613df857600060a051601254600161158051600060c052602060c0200160c052602060c02001548181028119838383051417613ccc57600080fd5b6402540be400810590509050905080608051901358578091901215613cf057600080fd5b1215613d62576402540be4006402540be3ff60a051601254600161158051600060c052602060c0200160c052602060c02001548181028119838383051417613d3757600080fd5b6402540be400810590509050905080608051901358578091901215613d5b57600080fd5b0305613dc3565b6402540be40060a051601254600161158051600060c052602060c0200160c052602060c02001548181028119838383051417613d9d57600080fd5b6402540be400810590509050905080608051901358578091901215613dc157600080fd5b055b6120c05260006000604463579f38b26120e05261158051612100526120c051612120526120fc6000305af1613df757600080fd5b5b60036115c051600a60c052602060c0200160c052602060c02001541560a051600360a05160026007548181028119838383051417613e3557600080fd5b8090509050905080608051901358578091901215613e5257600080fd5b0580608051901358578091901215613e6957600080fd5b6120a051121560a051600360a05160026006548181028119838383051417613e9057600080fd5b8090509050905080608051901358578091901215613ead57600080fd5b0580608051901358578091901215613ec457600080fd5b61208051121516161561400057600160036115c051600a60c052602060c0200160c052602060c02001556115c0516011556001600b5560016121c05260006121e05260406121805260016121c05260006121e0526115c051600160c052602060c02001546115c0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b9612180516121c0a360605160016115e0510180604051901358578091901215613f7557600080fd5b6115c0511415613fff57600160026115e051600a60c052602060c0200160c052602060c02001556115e0516010556001612240526001612260526040612200526001612240526001612260526115e051600160c052602060c02001546115e0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b961220051612240a35b5b6115c0516122c0526115e0516122e0526040612280526115c0516122c0526115e0516122e0526115a05161158051600661158051600060c052602060c0200160c052602060c02001547f0fa814a7606272ed601db3d9974a12a26536f050d147ad209b7e7b0a95746f17612280516122c0a4005b63cc20f16b6000511415614668576040600461014037341561409557600080fd5b610420600435600401610180376104006004356004013511156140b757600080fd5b6104206024356004016105c0376104006024356004013511156140d957600080fd5b60206112e061088460406313d21fa3610a005280610a20526101808080516020018084610a2001828460006004600a8704601201f161411757600080fd5b50508051820160200191505080610a40526105c08080516020018084610a2001828460006004600a8704601201f161414e57600080fd5b505080518201602001915050610a1c90506000305af161416d57600080fd5b6112e05161417a57600080fd5b6119606101806106206113008251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c061130051146141b957600080fd5b61130051611300018060200151600082518060209013585780919012156141df57600080fd5b601f6101000a82048115176141f357600080fd5b606051816020036101000a83048060405190135857809190121561421657600080fd5b905090509050815260206113205161130001511461423357600080fd5b6113205161132001518160200152611340516113000180602001516000825180602090135857809190121561426757600080fd5b601f6101000a820481151761427b57600080fd5b606051816020036101000a83048060405190135857809190121561429e57600080fd5b905090509050816040015261136051611300018060200151600082518060209013585780919012156142cf57600080fd5b601f6101000a82048115176142e357600080fd5b606051816020036101000a83048060405190135857809190121561430657600080fd5b9050905090508160600152611380516113000180516020018083608001828460006004600a8704601201f161433a57600080fd5b50505061196051611e20526020611ee060246399fb5eec611e6052611e2051611e8052611e7c6000305af161436e57600080fd5b611ee051611e4052600060a05160196402540be400611e405102058060805190135857809190121561439f57600080fd5b12156143df576402540be4006402540be3ff60a05160196402540be400611e40510205806080519013585780919012156143d857600080fd5b030561440e565b6402540be40060a05160196402540be400611e405102058060805190135857809190121561440c57600080fd5b055b611f0052606051611f0051611e4051038060405190135857809190121561443457600080fd5b611f2052600f54601460c052602060c02001606051611e40518254018060405190135857809190121561446657600080fd5b81555060016003611e2051600060c052602060c0200160c052602060c0200155611f0051611f8052611f2051611fa0526040611f4052611f0051611f8052611f2051611fa052611e20516006611e2051600060c052602060c0200160c052602060c0200154337fb63bb46c05149b79f409b978407acff3bb3bfb5fb728ed2909fdb52677c220da611f4051611f80a46002611e2051600060c052602060c0200160c052602060c0200154611fc052611fc051600454121561464d576001611e2051600060c052602060c0200160c052602060c0200154611fe0526060516001600454018060405190135857809190121561455f57600080fd5b600560c052602060c0200160a051611fe0518254038060805190135857809190121561458a57600080fd5b815550606051600160045401806040519013585780919012156145ac57600080fd5b6002611e2051600060c052602060c0200160c052602060c0200155601f54611fc051121561460b57611fc051600560c052602060c0200160a051611fe0518254018060805190135857809190121561460357600080fd5b81555061464c565b60206120606004634a8fd6986120005261201c6000305af161462c57600080fd5b612060516005611e2051600060c052602060c0200160c052602060c02001555b5b6000600060006000611f0051336000f161466657600080fd5b005b63bcc44d9960005114156146cb576020600461014037341561468957600080fd5b606051600435806040519013585780919012156146a557600080fd5b50600161014051600060c052602060c0200160c052602060c020015460005260206000f3005b63faf944fa600051141561472e57602060046101403734156146ec57600080fd5b6060516004358060405190135857809190121561470857600080fd5b50600461014051600060c052602060c0200160c052602060c020015460005260206000f3005b63c253bf416000511415614791576020600461014037341561474f57600080fd5b6060516004358060405190135857809190121561476b57600080fd5b50600261014051600060c052602060c0200160c052602060c020015460005260206000f3005b633b4f3ae360005114156147f457602060046101403734156147b257600080fd5b606051600435806040519013585780919012156147ce57600080fd5b50600361014051600060c052602060c0200160c052602060c020015460005260206000f3005b6306fcf2ff6000511415614857576020600461014037341561481557600080fd5b6060516004358060405190135857809190121561483157600080fd5b50600561014051600060c052602060c0200160c052602060c020015460005260206000f3005b63bb0115f060005114156148b7576020600461014037341561487857600080fd5b6060516004358060405190135857809190121561489457600080fd5b5061014051600060c052602060c0200160c052602060c0205460005260206000f3005b635dbfd1ce600051141561491a57602060046101403734156148d857600080fd5b606051600435806040519013585780919012156148f457600080fd5b50600661014051600060c052602060c0200160c052602060c020015460005260206000f3005b638208b8756000511415614972576020600461014037341561493b57600080fd5b6060516004358060405190135857809190121561495757600080fd5b5061014051600160c052602060c020015460005260206000f3005b637d69c5d9600051141561499857341561498b57600080fd5b60025460005260206000f3005b63dc2059b360005114156149e557602060046101403734156149b957600080fd5b60043560205181106149ca57600080fd5b5061014051600360c052602060c020015460005260206000f3005b637060054d6000511415614a0b5734156149fe57600080fd5b60045460005260206000f3005b63c44dc6596000511415614a635760206004610140373415614a2c57600080fd5b60605160043580604051901358578091901215614a4857600080fd5b5061014051600560c052602060c020015460005260206000f3005b63a2630bae6000511415614abb5760206004610140373415614a8457600080fd5b60605160043580604051901358578091901215614aa057600080fd5b5061014051600860c052602060c020015460005260206000f3005b6365ca80e66000511415614b135760206004610140373415614adc57600080fd5b60605160043580604051901358578091901215614af857600080fd5b5061014051600960c052602060c020015460005260206000f3005b634af8e81a6000511415614b735760206004610140373415614b3457600080fd5b60605160043580604051901358578091901215614b5057600080fd5b5061014051600a60c052602060c0200160c052602060c0205460005260206000f3005b6326becf586000511415614bd65760206004610140373415614b9457600080fd5b60605160043580604051901358578091901215614bb057600080fd5b50600461014051600a60c052602060c0200160c052602060c020015460005260206000f3005b63be26608e6000511415614c635760406004610140373415614bf757600080fd5b60605160043580604051901358578091901215614c1357600080fd5b5060605160243580604051901358578091901215614c3057600080fd5b5061016051600161014051600a60c052602060c0200160c052602060c0200160c052602060c020015460005260206000f3005b633673fd986000511415614cf05760406004610140373415614c8457600080fd5b60605160043580604051901358578091901215614ca057600080fd5b5060605160243580604051901358578091901215614cbd57600080fd5b5061016051600561014051600a60c052602060c0200160c052602060c0200160c052602060c020015460005260206000f3005b63e270eb666000511415614d7d5760406004610140373415614d1157600080fd5b60605160043580604051901358578091901215614d2d57600080fd5b5060605160243580604051901358578091901215614d4a57600080fd5b5061016051600661014051600a60c052602060c0200160c052602060c0200160c052602060c020015460005260206000f3005b6330d3c41a6000511415614de05760206004610140373415614d9e57600080fd5b60605160043580604051901358578091901215614dba57600080fd5b50600361014051600a60c052602060c0200160c052602060c020015460005260206000f3005b63cfff38c06000511415614e435760206004610140373415614e0157600080fd5b60605160043580604051901358578091901215614e1d57600080fd5b50600261014051600a60c052602060c0200160c052602060c020015460005260206000f3005b6399787ac66000511415614e69573415614e5c57600080fd5b600b5460005260206000f3005b63e430757f6000511415614ec15760206004610140373415614e8a57600080fd5b60605160043580604051901358578091901215614ea657600080fd5b5061014051600c60c052602060c020015460005260206000f3005b638a4844076000511415614ee7573415614eda57600080fd5b600d5460005260206000f3005b63e6b573666000511415614f0d573415614f0057600080fd5b600e5460005260206000f3005b639372b4e46000511415614f33573415614f2657600080fd5b600f5460005260206000f3005b632eff87596000511415614f59573415614f4c57600080fd5b60105460005260206000f3005b635f6116506000511415614f7f573415614f7257600080fd5b60115460005260206000f3005b6307dcf45b6000511415614fa5573415614f9857600080fd5b60125460005260206000f3005b635b03544a6000511415614fcb573415614fbe57600080fd5b60135460005260206000f3005b634c77567560005114156150235760206004610140373415614fec57600080fd5b6060516004358060405190135857809190121561500857600080fd5b5061014051601460c052602060c020015460005260206000f3005b63ac4746ab600051141561504957341561503c57600080fd5b60165460005260206000f3005b630ebb172a600051141561506f57341561506257600080fd5b60175460005260206000f3005b634f4ddb5e600051141561509557341561508857600080fd5b60185460005260206000f3005b633f8a500e60005114156150bb5734156150ae57600080fd5b601b5460005260206000f3005b6361073e8860005114156150e15734156150d457600080fd5b601c5460005260206000f3005b6326c0817e60005114156151075734156150fa57600080fd5b601d5460005260206000f3005b63d4b31281600051141561512d57341561512057600080fd5b601e5460005260206000f3005b" diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 0878b4595f1..65cbee21c6d 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -60,7 +60,16 @@ use types::ancestry_action::AncestryAction; /// Default EIP-210 contract code. /// As defined in https://github.com/ethereum/EIPs/pull/210 -pub const DEFAULT_BLOCKHASH_CONTRACT: &'static str = "73fffffffffffffffffffffffffffffffffffffffe33141561006a5760014303600035610100820755610100810715156100455760003561010061010083050761010001555b6201000081071515610064576000356101006201000083050761020001555b5061013e565b4360003512151561008457600060405260206040f361013d565b61010060003543031315156100a857610100600035075460605260206060f361013c565b6101006000350715156100c55762010000600035430313156100c8565b60005b156100ea576101006101006000350507610100015460805260206080f361013b565b620100006000350715156101095763010000006000354303131561010c565b60005b1561012f57610100620100006000350507610200015460a052602060a0f361013a565b600060c052602060c0f35b5b5b5b5b"; +pub const DEFAULT_BLOCKHASH_CONTRACT: &'static str = include!("../../res/code/blockhash.hex"); + +/// Hybrid Casper CASPER_CODE +pub const DEFAULT_CASPER_CONTRACT: &'static str = include!("../../res/code/simple_casper.hex"); + +/// Hybrid Casper PURITY_CHECKER_CODE +pub const DEFAULT_PURITY_CHECKER_CONTRACT: &'static str = include!("../../res/code/purity_checker.hex"); + +/// Hybrid Casper MSG_HASHER_CODE +pub const DEFAULT_MSG_HASHER_CONTRACT: &'static str = include!("../../res/code/msg_hasher.hex"); /// Fork choice. #[derive(Debug, PartialEq, Eq)] diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index c228b051505..dda52f1d754 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -62,6 +62,12 @@ pub struct EthashExtensions { pub dao_hardfork_accounts: Vec
, /// Number of first block wehre Casper rules begin. pub hybrid_casper_transition: u64, + /// EIP1011 Casper contract code. + pub hybrid_casper_contract_code: Bytes, + /// EIP1011 purity checker code. + pub hybrid_casper_purity_checker_contract_code: Bytes, + /// EIP1011 msg hasher code. + pub hybrid_casper_msg_hasher_contract_code: Bytes, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { @@ -76,6 +82,15 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into), dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(), hybrid_casper_transition: p.hybrid_casper_transition.map_or_else(u64::max_value, Into::into), + hybrid_casper_contract_code: DEFAULT_CASPER_CONTRACT.from_hex().expect( + "Default CASPER_CODE is valid", + ), + hybrid_casper_purity_checker_contract_code: DEFAULT_PURITY_CHECKER_CONTRACT.from_hex().expect( + "Default PURITY_CHECKER_CODE is valid", + ), + hybrid_casper_msg_hasher_contract_code: DEFAULT_MSG_HASHER_CONTRACT.from_hex().expect( + "Default MSG_HASHER_CODE is valid", + ), } } } @@ -203,6 +218,10 @@ impl EthereumMachine { .and_then(|b| state.transfer_balance(child, beneficiary, &b, CleanupMode::NoEmpty))?; } } + + if block.header().number() == ethash_params.hybrid_casper_transition { + + } } Ok(()) From 965f08fb428e4bfeb6224423dcc889ddb5db2d88 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:23:53 +0800 Subject: [PATCH 04/72] Fix missing imports --- ethcore/src/machine.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index dda52f1d754..230baed66b1 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -20,17 +20,20 @@ use std::collections::{BTreeMap, HashMap}; use std::cmp; use std::sync::Arc; +use bytes::Bytes; use block::{ExecutedBlock, IsBlock}; use builtin::Builtin; use client::{BlockInfo, CallContract}; use error::Error; use executive::Executive; +use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT}; use header::{BlockNumber, Header, ExtendedHeader}; use spec::CommonParams; use state::{CleanupMode, Substate}; use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Tracing}; use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction}; use tx_filter::TransactionFilter; +use rustc_hex::FromHex; use ethereum_types::{U256, Address}; use bytes::BytesRef; From 5df49480648254042f24d2bb356c9b3579597b02 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:32:06 +0800 Subject: [PATCH 05/72] Init casper contract code at the transition block --- ethcore/src/machine.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 230baed66b1..cad743fab76 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -67,10 +67,16 @@ pub struct EthashExtensions { pub hybrid_casper_transition: u64, /// EIP1011 Casper contract code. pub hybrid_casper_contract_code: Bytes, + /// EIP1011 Casper contract address. + pub hybrid_casper_contract_address: Address, /// EIP1011 purity checker code. pub hybrid_casper_purity_checker_contract_code: Bytes, + /// EIP1011 purity checker address. + pub hybrid_casper_purity_checker_contract_address: Address, /// EIP1011 msg hasher code. pub hybrid_casper_msg_hasher_contract_code: Bytes, + /// EIP1011 msg hasher address. + pub hybrid_casper_msg_hasher_contract_address: Address, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { @@ -88,12 +94,15 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { hybrid_casper_contract_code: DEFAULT_CASPER_CONTRACT.from_hex().expect( "Default CASPER_CODE is valid", ), + hybrid_casper_contract_address: Address::from(0x40u64), hybrid_casper_purity_checker_contract_code: DEFAULT_PURITY_CHECKER_CONTRACT.from_hex().expect( "Default PURITY_CHECKER_CODE is valid", ), + hybrid_casper_purity_checker_contract_address: Address::from(0x41u64), hybrid_casper_msg_hasher_contract_code: DEFAULT_MSG_HASHER_CONTRACT.from_hex().expect( "Default MSG_HASHER_CODE is valid", ), + hybrid_casper_msg_hasher_contract_address: Address::from(0x42u64), } } } @@ -223,7 +232,13 @@ impl EthereumMachine { } if block.header().number() == ethash_params.hybrid_casper_transition { - + let state = block.state_mut(); + state.init_code(ðash_params.hybrid_casper_contract_address, + ethash_params.hybrid_casper_contract_code.clone())?; + state.init_code(ðash_params.hybrid_casper_purity_checker_contract_address, + ethash_params.hybrid_casper_purity_checker_contract_code.clone())?; + state.init_code(ðash_params.hybrid_casper_msg_hasher_contract_address, + ethash_params.hybrid_casper_msg_hasher_contract_code.clone())?; } } From 0610c8f24f9cbb4957a45db0a6b9ec331f6fa59e Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:33:09 +0800 Subject: [PATCH 06/72] Init casper contract abi --- ethcore/res/contracts/simple_casper.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 ethcore/res/contracts/simple_casper.json diff --git a/ethcore/res/contracts/simple_casper.json b/ethcore/res/contracts/simple_casper.json new file mode 100644 index 00000000000..4196160acf0 --- /dev/null +++ b/ethcore/res/contracts/simple_casper.json @@ -0,0 +1 @@ +[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'inputs': [{'type': 'address', 'name': '_to', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Slash', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'address', 'name': '_offender', 'indexed': True}, {'type': 'int128', 'name': '_offender_index', 'indexed': True}, {'type': 'int128', 'name': '_bounty', 'indexed': False}, {'type': 'int128', 'name': '_destroyed', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Epoch', 'inputs': [{'type': 'int128', 'name': '_number', 'indexed': True}, {'type': 'bytes32', 'name': '_checkpoint_hash', 'indexed': True}, {'type': 'bool', 'name': '_is_justified', 'indexed': False}, {'type': 'bool', 'name': '_is_finalized', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'init', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch_length'}, {'type': 'int128', 'name': 'withdrawal_delay'}, {'type': 'int128', 'name': 'dynasty_logout_delay'}, {'type': 'address', 'name': 'msg_hasher'}, {'type': 'address', 'name': 'purity_checker'}, {'type': 'decimal10', 'name': 'base_interest_factor'}, {'type': 'decimal10', 'name': 'base_penalty_factor'}, {'type': 'int128', 'name': 'min_deposit_size'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 357964}, {'name': 'main_hash_voted_frac', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2989}, {'name': 'deposit_size', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2991}, {'name': 'total_curdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2595}, {'name': 'total_prevdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2625}, {'name': 'slashable', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 38206}, {'name': 'recommended_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 933}, {'name': 'recommended_target_hash', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 810}, {'name': 'highest_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000946}, {'name': 'highest_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000976}, {'name': 'initialize_epoch', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 427173}, {'name': 'deposit', 'outputs': [], 'inputs': [{'type': 'address', 'name': 'validation_addr'}, {'type': 'address', 'name': 'withdrawal_addr'}], 'constant': False, 'payable': True, 'type': 'function', 'gas': 682331}, {'name': 'logout', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'logout_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 87942}, {'name': 'withdraw', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 102634}, {'name': 'vote', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 321153}, {'name': 'slash', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 210102}, {'name': 'validators__deposit', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1500}, {'name': 'validators__start_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1530}, {'name': 'validators__end_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1560}, {'name': 'validators__is_slashed', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1590}, {'name': 'validators__total_deposits_at_logout', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1620}, {'name': 'validators__addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1644}, {'name': 'validators__withdrawal_addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1680}, {'name': 'checkpoint_hashes', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1632}, {'name': 'next_validator_index', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1473}, {'name': 'validator_indexes', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'address', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1641}, {'name': 'dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1533}, {'name': 'dynasty_wei_delta', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1752}, {'name': 'dynasty_start_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1782}, {'name': 'dynasty_in_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1812}, {'name': 'checkpoints__cur_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1914}, {'name': 'checkpoints__prev_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1950}, {'name': 'checkpoints__cur_dyn_votes', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2157}, {'name': 'checkpoints__prev_dyn_votes', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2187}, {'name': 'checkpoints__vote_bitmap', 'outputs': [{'type': 'uint256', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2217}, {'name': 'checkpoints__is_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2070}, {'name': 'checkpoints__is_finalized', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2100}, {'name': 'main_hash_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1863}, {'name': 'deposit_scale_factor', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2082}, {'name': 'last_nonvoter_rescale', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1923}, {'name': 'last_voter_rescale', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1953}, {'name': 'current_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1983}, {'name': 'last_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2013}, {'name': 'last_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2043}, {'name': 'reward_factor', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2073}, {'name': 'expected_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2103}, {'name': 'total_slashed', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2322}, {'name': 'EPOCH_LENGTH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2163}, {'name': 'WITHDRAWAL_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2193}, {'name': 'DYNASTY_LOGOUT_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2223}, {'name': 'BASE_INTEREST_FACTOR', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2253}, {'name': 'BASE_PENALTY_FACTOR', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2283}, {'name': 'MIN_DEPOSIT_SIZE', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2313}, {'name': 'START_EPOCH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2343}] From a6a63aafa135569af2c877b76a4f3f043ff925d4 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:36:52 +0800 Subject: [PATCH 07/72] Use fixed168x10 to replace decimal10 temporarily As many comments noted at https://github.com/ethereum/vyper/issues/566, those two are mostly equivalent except edge cases. So it's good enough for testing. --- ethcore/res/contracts/simple_casper.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/contracts/simple_casper.json b/ethcore/res/contracts/simple_casper.json index 4196160acf0..3502cd0fecb 100644 --- a/ethcore/res/contracts/simple_casper.json +++ b/ethcore/res/contracts/simple_casper.json @@ -1 +1 @@ -[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'inputs': [{'type': 'address', 'name': '_to', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Slash', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'address', 'name': '_offender', 'indexed': True}, {'type': 'int128', 'name': '_offender_index', 'indexed': True}, {'type': 'int128', 'name': '_bounty', 'indexed': False}, {'type': 'int128', 'name': '_destroyed', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Epoch', 'inputs': [{'type': 'int128', 'name': '_number', 'indexed': True}, {'type': 'bytes32', 'name': '_checkpoint_hash', 'indexed': True}, {'type': 'bool', 'name': '_is_justified', 'indexed': False}, {'type': 'bool', 'name': '_is_finalized', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'init', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch_length'}, {'type': 'int128', 'name': 'withdrawal_delay'}, {'type': 'int128', 'name': 'dynasty_logout_delay'}, {'type': 'address', 'name': 'msg_hasher'}, {'type': 'address', 'name': 'purity_checker'}, {'type': 'decimal10', 'name': 'base_interest_factor'}, {'type': 'decimal10', 'name': 'base_penalty_factor'}, {'type': 'int128', 'name': 'min_deposit_size'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 357964}, {'name': 'main_hash_voted_frac', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2989}, {'name': 'deposit_size', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2991}, {'name': 'total_curdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2595}, {'name': 'total_prevdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2625}, {'name': 'slashable', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 38206}, {'name': 'recommended_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 933}, {'name': 'recommended_target_hash', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 810}, {'name': 'highest_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000946}, {'name': 'highest_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000976}, {'name': 'initialize_epoch', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 427173}, {'name': 'deposit', 'outputs': [], 'inputs': [{'type': 'address', 'name': 'validation_addr'}, {'type': 'address', 'name': 'withdrawal_addr'}], 'constant': False, 'payable': True, 'type': 'function', 'gas': 682331}, {'name': 'logout', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'logout_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 87942}, {'name': 'withdraw', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 102634}, {'name': 'vote', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 321153}, {'name': 'slash', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 210102}, {'name': 'validators__deposit', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1500}, {'name': 'validators__start_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1530}, {'name': 'validators__end_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1560}, {'name': 'validators__is_slashed', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1590}, {'name': 'validators__total_deposits_at_logout', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1620}, {'name': 'validators__addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1644}, {'name': 'validators__withdrawal_addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1680}, {'name': 'checkpoint_hashes', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1632}, {'name': 'next_validator_index', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1473}, {'name': 'validator_indexes', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'address', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1641}, {'name': 'dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1533}, {'name': 'dynasty_wei_delta', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1752}, {'name': 'dynasty_start_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1782}, {'name': 'dynasty_in_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1812}, {'name': 'checkpoints__cur_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1914}, {'name': 'checkpoints__prev_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1950}, {'name': 'checkpoints__cur_dyn_votes', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2157}, {'name': 'checkpoints__prev_dyn_votes', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2187}, {'name': 'checkpoints__vote_bitmap', 'outputs': [{'type': 'uint256', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2217}, {'name': 'checkpoints__is_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2070}, {'name': 'checkpoints__is_finalized', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2100}, {'name': 'main_hash_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1863}, {'name': 'deposit_scale_factor', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2082}, {'name': 'last_nonvoter_rescale', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1923}, {'name': 'last_voter_rescale', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1953}, {'name': 'current_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1983}, {'name': 'last_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2013}, {'name': 'last_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2043}, {'name': 'reward_factor', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2073}, {'name': 'expected_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2103}, {'name': 'total_slashed', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2322}, {'name': 'EPOCH_LENGTH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2163}, {'name': 'WITHDRAWAL_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2193}, {'name': 'DYNASTY_LOGOUT_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2223}, {'name': 'BASE_INTEREST_FACTOR', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2253}, {'name': 'BASE_PENALTY_FACTOR', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2283}, {'name': 'MIN_DEPOSIT_SIZE', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2313}, {'name': 'START_EPOCH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2343}] +[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'inputs': [{'type': 'address', 'name': '_to', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Slash', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'address', 'name': '_offender', 'indexed': True}, {'type': 'int128', 'name': '_offender_index', 'indexed': True}, {'type': 'int128', 'name': '_bounty', 'indexed': False}, {'type': 'int128', 'name': '_destroyed', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Epoch', 'inputs': [{'type': 'int128', 'name': '_number', 'indexed': True}, {'type': 'bytes32', 'name': '_checkpoint_hash', 'indexed': True}, {'type': 'bool', 'name': '_is_justified', 'indexed': False}, {'type': 'bool', 'name': '_is_finalized', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'init', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch_length'}, {'type': 'int128', 'name': 'withdrawal_delay'}, {'type': 'int128', 'name': 'dynasty_logout_delay'}, {'type': 'address', 'name': 'msg_hasher'}, {'type': 'address', 'name': 'purity_checker'}, {'type': 'fixed168x10', 'name': 'base_interest_factor'}, {'type': 'fixed168x10', 'name': 'base_penalty_factor'}, {'type': 'int128', 'name': 'min_deposit_size'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 357964}, {'name': 'main_hash_voted_frac', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2989}, {'name': 'deposit_size', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2991}, {'name': 'total_curdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2595}, {'name': 'total_prevdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2625}, {'name': 'slashable', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 38206}, {'name': 'recommended_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 933}, {'name': 'recommended_target_hash', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 810}, {'name': 'highest_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000946}, {'name': 'highest_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000976}, {'name': 'initialize_epoch', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 427173}, {'name': 'deposit', 'outputs': [], 'inputs': [{'type': 'address', 'name': 'validation_addr'}, {'type': 'address', 'name': 'withdrawal_addr'}], 'constant': False, 'payable': True, 'type': 'function', 'gas': 682331}, {'name': 'logout', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'logout_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 87942}, {'name': 'withdraw', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 102634}, {'name': 'vote', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 321153}, {'name': 'slash', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 210102}, {'name': 'validators__deposit', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1500}, {'name': 'validators__start_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1530}, {'name': 'validators__end_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1560}, {'name': 'validators__is_slashed', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1590}, {'name': 'validators__total_deposits_at_logout', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1620}, {'name': 'validators__addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1644}, {'name': 'validators__withdrawal_addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1680}, {'name': 'checkpoint_hashes', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1632}, {'name': 'next_validator_index', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1473}, {'name': 'validator_indexes', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'address', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1641}, {'name': 'dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1533}, {'name': 'dynasty_wei_delta', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1752}, {'name': 'dynasty_start_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1782}, {'name': 'dynasty_in_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1812}, {'name': 'checkpoints__cur_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1914}, {'name': 'checkpoints__prev_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1950}, {'name': 'checkpoints__cur_dyn_votes', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2157}, {'name': 'checkpoints__prev_dyn_votes', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2187}, {'name': 'checkpoints__vote_bitmap', 'outputs': [{'type': 'uint256', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2217}, {'name': 'checkpoints__is_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2070}, {'name': 'checkpoints__is_finalized', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2100}, {'name': 'main_hash_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1863}, {'name': 'deposit_scale_factor', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2082}, {'name': 'last_nonvoter_rescale', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1923}, {'name': 'last_voter_rescale', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1953}, {'name': 'current_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1983}, {'name': 'last_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2013}, {'name': 'last_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2043}, {'name': 'reward_factor', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2073}, {'name': 'expected_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2103}, {'name': 'total_slashed', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2322}, {'name': 'EPOCH_LENGTH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2163}, {'name': 'WITHDRAWAL_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2193}, {'name': 'DYNASTY_LOGOUT_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2223}, {'name': 'BASE_INTEREST_FACTOR', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2253}, {'name': 'BASE_PENALTY_FACTOR', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2283}, {'name': 'MIN_DEPOSIT_SIZE', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2313}, {'name': 'START_EPOCH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2343}] From 4e56fd73a2a58476e8910af30e5813aa0a8fe72a Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:41:00 +0800 Subject: [PATCH 08/72] Use double quotes to make it valid json --- ethcore/res/contracts/simple_casper.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/contracts/simple_casper.json b/ethcore/res/contracts/simple_casper.json index 3502cd0fecb..bd2f6b4d4f1 100644 --- a/ethcore/res/contracts/simple_casper.json +++ b/ethcore/res/contracts/simple_casper.json @@ -1 +1 @@ -[{'name': 'Deposit', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'address', 'name': '_validation_address', 'indexed': False}, {'type': 'int128', 'name': '_start_dyn', 'indexed': False}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Vote', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'bytes32', 'name': '_target_hash', 'indexed': True}, {'type': 'int128', 'name': '_target_epoch', 'indexed': False}, {'type': 'int128', 'name': '_source_epoch', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Logout', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_end_dyn', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Withdraw', 'inputs': [{'type': 'address', 'name': '_to', 'indexed': True}, {'type': 'int128', 'name': '_validator_index', 'indexed': True}, {'type': 'int128', 'name': '_amount', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Slash', 'inputs': [{'type': 'address', 'name': '_from', 'indexed': True}, {'type': 'address', 'name': '_offender', 'indexed': True}, {'type': 'int128', 'name': '_offender_index', 'indexed': True}, {'type': 'int128', 'name': '_bounty', 'indexed': False}, {'type': 'int128', 'name': '_destroyed', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'Epoch', 'inputs': [{'type': 'int128', 'name': '_number', 'indexed': True}, {'type': 'bytes32', 'name': '_checkpoint_hash', 'indexed': True}, {'type': 'bool', 'name': '_is_justified', 'indexed': False}, {'type': 'bool', 'name': '_is_finalized', 'indexed': False}], 'anonymous': False, 'type': 'event'}, {'name': 'init', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch_length'}, {'type': 'int128', 'name': 'withdrawal_delay'}, {'type': 'int128', 'name': 'dynasty_logout_delay'}, {'type': 'address', 'name': 'msg_hasher'}, {'type': 'address', 'name': 'purity_checker'}, {'type': 'fixed168x10', 'name': 'base_interest_factor'}, {'type': 'fixed168x10', 'name': 'base_penalty_factor'}, {'type': 'int128', 'name': 'min_deposit_size'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 357964}, {'name': 'main_hash_voted_frac', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2989}, {'name': 'deposit_size', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2991}, {'name': 'total_curdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2595}, {'name': 'total_prevdyn_deposits_in_wei', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2625}, {'name': 'slashable', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 38206}, {'name': 'recommended_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 933}, {'name': 'recommended_target_hash', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 810}, {'name': 'highest_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000946}, {'name': 'highest_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'min_total_deposits'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1882000000000000000000000000000976}, {'name': 'initialize_epoch', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'epoch'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 427173}, {'name': 'deposit', 'outputs': [], 'inputs': [{'type': 'address', 'name': 'validation_addr'}, {'type': 'address', 'name': 'withdrawal_addr'}], 'constant': False, 'payable': True, 'type': 'function', 'gas': 682331}, {'name': 'logout', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'logout_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 87942}, {'name': 'withdraw', 'outputs': [], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 102634}, {'name': 'vote', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 321153}, {'name': 'slash', 'outputs': [], 'inputs': [{'type': 'bytes', 'name': 'vote_msg_1'}, {'type': 'bytes', 'name': 'vote_msg_2'}], 'constant': False, 'payable': False, 'type': 'function', 'gas': 210102}, {'name': 'validators__deposit', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1500}, {'name': 'validators__start_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1530}, {'name': 'validators__end_dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1560}, {'name': 'validators__is_slashed', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1590}, {'name': 'validators__total_deposits_at_logout', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1620}, {'name': 'validators__addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1644}, {'name': 'validators__withdrawal_addr', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1680}, {'name': 'checkpoint_hashes', 'outputs': [{'type': 'bytes32', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1632}, {'name': 'next_validator_index', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1473}, {'name': 'validator_indexes', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'address', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1641}, {'name': 'dynasty', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1533}, {'name': 'dynasty_wei_delta', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1752}, {'name': 'dynasty_start_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1782}, {'name': 'dynasty_in_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1812}, {'name': 'checkpoints__cur_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1914}, {'name': 'checkpoints__prev_dyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1950}, {'name': 'checkpoints__cur_dyn_votes', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2157}, {'name': 'checkpoints__prev_dyn_votes', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2187}, {'name': 'checkpoints__vote_bitmap', 'outputs': [{'type': 'uint256', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}, {'type': 'int128', 'name': 'arg1'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2217}, {'name': 'checkpoints__is_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2070}, {'name': 'checkpoints__is_finalized', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2100}, {'name': 'main_hash_justified', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1863}, {'name': 'deposit_scale_factor', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2082}, {'name': 'last_nonvoter_rescale', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1923}, {'name': 'last_voter_rescale', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1953}, {'name': 'current_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 1983}, {'name': 'last_finalized_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2013}, {'name': 'last_justified_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2043}, {'name': 'reward_factor', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2073}, {'name': 'expected_source_epoch', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2103}, {'name': 'total_slashed', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'arg0'}], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2322}, {'name': 'EPOCH_LENGTH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2163}, {'name': 'WITHDRAWAL_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2193}, {'name': 'DYNASTY_LOGOUT_DELAY', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2223}, {'name': 'BASE_INTEREST_FACTOR', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2253}, {'name': 'BASE_PENALTY_FACTOR', 'outputs': [{'type': 'fixed168x10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2283}, {'name': 'MIN_DEPOSIT_SIZE', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2313}, {'name': 'START_EPOCH', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 2343}] +[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "address", "name": "_validation_address", "indexed": False}, {"type": "int128", "name": "_start_dyn", "indexed": False}, {"type": "int128", "name": "_amount", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "bytes32", "name": "_target_hash", "indexed": True}, {"type": "int128", "name": "_target_epoch", "indexed": False}, {"type": "int128", "name": "_source_epoch", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "int128", "name": "_end_dyn", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "int128", "name": "_amount", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "address", "name": "_offender", "indexed": True}, {"type": "int128", "name": "_offender_index", "indexed": True}, {"type": "int128", "name": "_bounty", "indexed": False}, {"type": "int128", "name": "_destroyed", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": True}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": True}, {"type": "bool", "name": "_is_justified", "indexed": False}, {"type": "bool", "name": "_is_finalized", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "fixed168x10", "name": "base_interest_factor"}, {"type": "fixed168x10", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": False, "payable": False, "type": "function", "gas": 357964}, {"name": "main_hash_voted_frac", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2989}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": True, "payable": False, "type": "function", "gas": 2991}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2595}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2625}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": False, "payable": False, "type": "function", "gas": 38206}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": True, "payable": False, "type": "function", "gas": 1882000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": True, "payable": False, "type": "function", "gas": 1882000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": False, "payable": False, "type": "function", "gas": 427173}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": False, "payable": True, "type": "function", "gas": 682331}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": False, "payable": False, "type": "function", "gas": 87942}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": False, "payable": False, "type": "function", "gas": 102634}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": False, "payable": False, "type": "function", "gas": 321153}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": False, "payable": False, "type": "function", "gas": 210102}, {"name": "validators__deposit", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1500}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1530}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1560}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1590}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1620}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1644}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1680}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1632}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1641}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1752}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1782}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1812}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1914}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1950}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": True, "payable": False, "type": "function", "gas": 2157}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": True, "payable": False, "type": "function", "gas": 2187}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": True, "payable": False, "type": "function", "gas": 2217}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2070}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2100}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2082}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2322}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2163}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2193}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2223}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2253}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2283}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2313}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2343}] From 29cd6f8ee6dbb45e028af85da6129ff3072239ff Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 16:59:52 +0800 Subject: [PATCH 09/72] Use int168 to replace fixed168x10 ethabi does not support the later yet. We just need to remember that it has 10 decimal places. --- ethcore/res/contracts/simple_casper.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/contracts/simple_casper.json b/ethcore/res/contracts/simple_casper.json index bd2f6b4d4f1..8ed3dc79b11 100644 --- a/ethcore/res/contracts/simple_casper.json +++ b/ethcore/res/contracts/simple_casper.json @@ -1 +1 @@ -[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "address", "name": "_validation_address", "indexed": False}, {"type": "int128", "name": "_start_dyn", "indexed": False}, {"type": "int128", "name": "_amount", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "bytes32", "name": "_target_hash", "indexed": True}, {"type": "int128", "name": "_target_epoch", "indexed": False}, {"type": "int128", "name": "_source_epoch", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "int128", "name": "_end_dyn", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": True}, {"type": "int128", "name": "_validator_index", "indexed": True}, {"type": "int128", "name": "_amount", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": True}, {"type": "address", "name": "_offender", "indexed": True}, {"type": "int128", "name": "_offender_index", "indexed": True}, {"type": "int128", "name": "_bounty", "indexed": False}, {"type": "int128", "name": "_destroyed", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": True}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": True}, {"type": "bool", "name": "_is_justified", "indexed": False}, {"type": "bool", "name": "_is_finalized", "indexed": False}], "anonymous": False, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "fixed168x10", "name": "base_interest_factor"}, {"type": "fixed168x10", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": False, "payable": False, "type": "function", "gas": 357964}, {"name": "main_hash_voted_frac", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2989}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": True, "payable": False, "type": "function", "gas": 2991}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2595}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2625}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": False, "payable": False, "type": "function", "gas": 38206}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": True, "payable": False, "type": "function", "gas": 1882000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": True, "payable": False, "type": "function", "gas": 1882000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": False, "payable": False, "type": "function", "gas": 427173}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": False, "payable": True, "type": "function", "gas": 682331}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": False, "payable": False, "type": "function", "gas": 87942}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": False, "payable": False, "type": "function", "gas": 102634}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": False, "payable": False, "type": "function", "gas": 321153}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": False, "payable": False, "type": "function", "gas": 210102}, {"name": "validators__deposit", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1500}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1530}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1560}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1590}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1620}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1644}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1680}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1632}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1641}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1752}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1782}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1812}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1914}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 1950}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": True, "payable": False, "type": "function", "gas": 2157}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": True, "payable": False, "type": "function", "gas": 2187}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": True, "payable": False, "type": "function", "gas": 2217}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2070}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2100}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2082}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": True, "payable": False, "type": "function", "gas": 2322}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2163}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2193}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2223}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2253}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2283}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2313}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": True, "payable": False, "type": "function", "gas": 2343}] +[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "address", "name": "_validation_address", "indexed": false}, {"type": "int128", "name": "_start_dyn", "indexed": false}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "bytes32", "name": "_target_hash", "indexed": true}, {"type": "int128", "name": "_target_epoch", "indexed": false}, {"type": "int128", "name": "_source_epoch", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_end_dyn", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "address", "name": "_offender", "indexed": true}, {"type": "int128", "name": "_offender_index", "indexed": true}, {"type": "int128", "name": "_bounty", "indexed": false}, {"type": "int128", "name": "_destroyed", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": true}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": true}, {"type": "bool", "name": "_is_justified", "indexed": false}, {"type": "bool", "name": "_is_finalized", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "int168", "name": "base_interest_factor"}, {"type": "int168", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": false, "payable": false, "type": "function", "gas": 357964}, {"name": "main_hash_voted_frac", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2989}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": true, "payable": false, "type": "function", "gas": 2991}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2595}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2625}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 38206}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1882000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1882000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": false, "payable": false, "type": "function", "gas": 427173}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": false, "payable": true, "type": "function", "gas": 682331}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": false, "payable": false, "type": "function", "gas": 87942}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": false, "payable": false, "type": "function", "gas": 102634}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": false, "payable": false, "type": "function", "gas": 321153}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 210102}, {"name": "validators__deposit", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1500}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1530}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1560}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1590}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1620}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1644}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1680}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1632}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1641}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1752}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1782}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1812}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1914}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1950}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2157}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2187}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2217}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2070}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2100}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2082}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2322}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2163}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2193}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2223}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2253}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2283}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2313}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2343}] From 8b283b64c1e30632cf3a946d29422f43efdc5c4a Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 17:12:43 +0800 Subject: [PATCH 10/72] Call init function in Casper --- ethcore/src/machine.rs | 58 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index cad743fab76..c66500e2141 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -41,6 +41,8 @@ use rlp::Rlp; use vm::{CallType, ActionParams, ActionValue, ParamsType}; use vm::{EnvInfo, Schedule, CreateContractAddress}; +use_contract!(simple_casper_contract, "SimpleCasper", "res/contracts/simple_casper.json"); + /// Parity tries to round block.gas_limit to multiple of this constant pub const PARITY_GAS_LIMIT_DETERMINANT: U256 = U256([37, 0, 0, 0]); @@ -77,6 +79,19 @@ pub struct EthashExtensions { pub hybrid_casper_msg_hasher_contract_code: Bytes, /// EIP1011 msg hasher address. pub hybrid_casper_msg_hasher_contract_address: Address, + + /// EIP1011 epoch length. + pub hybrid_casper_epoch_length: u64, + /// EIP1011 warm up period. + pub hybrid_casper_withdrawal_delay: u64, + /// EIP1011 dynasty logout delay. + pub hybrid_casper_dynasty_logout_delay: u64, + /// EIP1011 base interest factor, with 10 decimals. + pub hybrid_casper_base_interest_factor: U256, + /// EIP1011 base panelty factor, with 10 decimals. + pub hybrid_casper_base_penalty_factor: U256, + /// EIP1011 minimal deposit size. + pub hybrid_casper_min_deposit_size: U256, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { @@ -103,6 +118,12 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { "Default MSG_HASHER_CODE is valid", ), hybrid_casper_msg_hasher_contract_address: Address::from(0x42u64), + hybrid_casper_epoch_length: 50, + hybrid_casper_withdrawal_delay: 15000, + hybrid_casper_dynasty_logout_delay: 700, + hybrid_casper_base_interest_factor: U256::from(70000000), + hybrid_casper_base_penalty_factor: U256::from(2000), + hybrid_casper_min_deposit_size: U256::from(1500) * ::ethereum::ether(), } } } @@ -232,13 +253,36 @@ impl EthereumMachine { } if block.header().number() == ethash_params.hybrid_casper_transition { - let state = block.state_mut(); - state.init_code(ðash_params.hybrid_casper_contract_address, - ethash_params.hybrid_casper_contract_code.clone())?; - state.init_code(ðash_params.hybrid_casper_purity_checker_contract_address, - ethash_params.hybrid_casper_purity_checker_contract_code.clone())?; - state.init_code(ðash_params.hybrid_casper_msg_hasher_contract_address, - ethash_params.hybrid_casper_msg_hasher_contract_code.clone())?; + // Force set Casper contract code. + { + let state = block.state_mut(); + state.init_code(ðash_params.hybrid_casper_contract_address, + ethash_params.hybrid_casper_contract_code.clone())?; + state.init_code(ðash_params.hybrid_casper_purity_checker_contract_address, + ethash_params.hybrid_casper_purity_checker_contract_code.clone())?; + state.init_code(ðash_params.hybrid_casper_msg_hasher_contract_address, + ethash_params.hybrid_casper_msg_hasher_contract_code.clone())?; + } + + // Call Casper contract's init function. + let casper_contract = simple_casper_contract::SimpleCasper::default(); + let input = casper_contract.functions().init().input( + ethash_params.hybrid_casper_epoch_length, + ethash_params.hybrid_casper_withdrawal_delay, + ethash_params.hybrid_casper_dynasty_logout_delay, + ethash_params.hybrid_casper_msg_hasher_contract_address, + ethash_params.hybrid_casper_purity_checker_contract_address, + ethash_params.hybrid_casper_base_interest_factor, + ethash_params.hybrid_casper_base_penalty_factor, + ethash_params.hybrid_casper_min_deposit_size, + ); + + let _ = self.execute_as_system( + block, + ethash_params.hybrid_casper_contract_address, + U256::max_value(), + Some(input) + )?; } } From 6343894eda989f0718f9fcb6d2242d576fb9cd4f Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 17:26:55 +0800 Subject: [PATCH 11/72] Lower initial difficulty for casper local testnet --- ethcore/res/ethereum/casper_test.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index c661542840f..4d7faa1394b 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -44,7 +44,7 @@ "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" } }, - "difficulty": "0x2000", + "difficulty": "0x1", "author": "0x0000000000000000000000000000000000000000", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", From 86e6377938bfc4ffb27620bc00089d681081c9fa Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 17:37:48 +0800 Subject: [PATCH 12/72] Increase the difficulty a little Otherwise it looks like broken --- ethcore/res/ethereum/casper_test.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index 4d7faa1394b..8fec2e329c8 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -4,7 +4,7 @@ "engine": { "Ethash": { "params": { - "minimumDifficulty": "0x1", + "minimumDifficulty": "0x20000", "difficultyBoundDivisor": "0x0800", "durationLimit": "0x0d", "blockReward": "0x4563918244F40000", @@ -44,7 +44,7 @@ "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" } }, - "difficulty": "0x1", + "difficulty": "0x20000", "author": "0x0000000000000000000000000000000000000000", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", From 77f1275516c9c567253cfa8bd64fd26c7754f33a Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 17 May 2018 17:49:30 +0800 Subject: [PATCH 13/72] Tweaking the testnet config --- ethcore/res/ethereum/casper_test.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index 8fec2e329c8..7b5980def33 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -4,7 +4,7 @@ "engine": { "Ethash": { "params": { - "minimumDifficulty": "0x20000", + "minimumDifficulty": "0x1ee73", "difficultyBoundDivisor": "0x0800", "durationLimit": "0x0d", "blockReward": "0x4563918244F40000", @@ -16,17 +16,16 @@ "eip649Reward": "0x29A2241AF62C0000", "eip100bTransition": "0x0", "eip649Transition": "0x0", - "hybridCasperTransition": "0x1" + "hybridCasperTransition": "0x5" } } }, "params": { "gasLimitBoundDivisor": "0x0400", - "registrar" : "0xe3389675d0338462dC76C6f9A3e432550c36A142", "accountStartNonce": "0x00", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", - "networkID" : "0x4827", + "networkID" : "0x1ee7", "eip155Transition": "0x0", "eip98Transition": "0x7fffffffffffff", "eip86Transition": "0x7fffffffffffff", From 4eeb6d5bf557eed692fea4122a1a06ae0c3eb837 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 07:29:12 +0800 Subject: [PATCH 14/72] Add basic framework for transaction reordering --- ethcore/src/block.rs | 10 +++++++++- ethcore/src/engines/mod.rs | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 4c470896773..1ab16cfc5c9 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -352,7 +352,15 @@ impl<'x> OpenBlock<'x> { } let env_info = self.env_info(); - let outcome = self.block.state.apply(&env_info, self.engine.machine(), &t, self.block.traces.is_enabled())?; + self.block.state.checkpoint(); + let mut outcome = self.block.state.apply(&env_info, self.engine.machine(), &t, self.block.traces.is_enabled())?; + + if !self.engine.verify_transaction_outcome(&t, &mut outcome.receipt) { + self.block.state.revert_to_checkpoint(); + return Err("Transaction outcome verification failed.".into()); + } + + self.block.state.discard_checkpoint(); self.block.transactions_set.insert(h.unwrap_or_else(||t.hash())); self.block.transactions.push(t.into()); diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 65cbee21c6d..48c5bfcf900 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -57,6 +57,7 @@ use ethereum_types::{H256, U256, Address}; use unexpected::{Mismatch, OutOfBounds}; use bytes::Bytes; use types::ancestry_action::AncestryAction; +use types::receipt::Receipt; /// Default EIP-210 contract code. /// As defined in https://github.com/ethereum/EIPs/pull/210 @@ -460,6 +461,14 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { self.machine().verify_transaction_basic(t, header) } + /// Verify the transaction outcome is acceptable. + fn verify_transaction_outcome(&self, _t: &SignedTransaction, _receipt: &mut Receipt) -> bool { + true + } + + /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. + fn reorder_transactions(&self, _ts: &mut [SignedTransaction]) { } + /// Additional information. fn additional_params(&self) -> HashMap { self.machine().additional_params() From a7a02ca727d00da5943b1f192f31fbb795861a51 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 07:58:10 +0800 Subject: [PATCH 15/72] Handle transaction ordering in miner --- ethcore/src/block.rs | 3 ++- ethcore/src/engines/mod.rs | 14 +++++++++++++- ethcore/src/miner/miner.rs | 20 +++++++++++++++++--- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 1ab16cfc5c9..e284f44b24c 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -351,7 +351,8 @@ impl<'x> OpenBlock<'x> { return Err(TransactionError::AlreadyImported.into()); } - let env_info = self.env_info(); + let mut env_info = self.env_info(); + self.engine.prepare_env_info(&t, &mut env_info); self.block.state.checkpoint(); let mut outcome = self.block.state.apply(&env_info, self.engine.machine(), &t, self.block.traces.is_enabled())?; diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 48c5bfcf900..fbd72964e01 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -58,6 +58,7 @@ use unexpected::{Mismatch, OutOfBounds}; use bytes::Bytes; use types::ancestry_action::AncestryAction; use types::receipt::Receipt; +use ethcore_miner::pool::VerifiedTransaction; /// Default EIP-210 contract code. /// As defined in https://github.com/ethereum/EIPs/pull/210 @@ -461,13 +462,24 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { self.machine().verify_transaction_basic(t, header) } + /// Prepare the environment information passed for transaction execution. + fn prepare_env_info(&self, _t: &SignedTransaction, _env_info: &mut EnvInfo) { } + /// Verify the transaction outcome is acceptable. fn verify_transaction_outcome(&self, _t: &SignedTransaction, _receipt: &mut Receipt) -> bool { true } + /// Whether the engine has transaction ordering. + fn has_transaction_ordering(&self) -> bool { false } + /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. - fn reorder_transactions(&self, _ts: &mut [SignedTransaction]) { } + fn reorder_transactions(&self, _ts: &mut [Arc]) { } + + /// Verify the current transaction ordering is acceptable. + fn verify_transaction_ordering(&self, _ts: &[SignedTransaction], _header: &Header) -> Result<(), transaction::Error> { + Ok(()) + } /// Additional information. fn additional_params(&self) -> HashMap { diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 3168ff1a846..7e1a08874a6 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -331,8 +331,18 @@ impl Miner { let mut open_block = match sealing.queue.pop_if(|b| b.block().header().parent_hash() == &best_hash) { Some(old_block) => { trace!(target: "miner", "prepare_block: Already have previous work; updating and returning"); - // add transactions to old_block - chain.reopen_block(old_block) + if !self.engine.has_transaction_ordering() { + // add transactions to old_block + chain.reopen_block(old_block) + } else { + trace!(target: "miner", "prepare_block: Transaction ordering prevents reopening of old block"); + let params = self.params.read().clone(); + chain.prepare_open_block( + params.author, + params.gas_range_target, + params.extra_data, + ) + } } None => { // block not found - create it. @@ -370,13 +380,17 @@ impl Miner { None }; - let pending: Vec> = self.transaction_queue.pending( + let mut pending: Vec> = self.transaction_queue.pending( client.clone(), chain_info.best_block_number, chain_info.best_block_timestamp, nonce_cap, ); + if self.engine.has_transaction_ordering() { + self.engine.reorder_transactions(&mut pending); + } + let took_ms = |elapsed: &Duration| { elapsed.as_secs() * 1000 + elapsed.subsec_nanos() as u64 / 1_000_000 }; From 3bf06f638a6634b8f32c9f763deeb9817deb8fd1 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 08:02:45 +0800 Subject: [PATCH 16/72] Verify transaction ordering in verifier --- ethcore/src/block.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index e284f44b24c..c131fe2b8a0 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -655,6 +655,8 @@ fn enact( )?; b.populate_from(&header); + + engine.verify_transaction_ordering(&transactions, &header)?; b.push_transactions(transactions)?; for u in uncles { From 96ad2b53062ae9cce8631f97c494f15123cb95e5 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 08:11:59 +0800 Subject: [PATCH 17/72] Delegate all work to EthereumMachine --- ethcore/src/block.rs | 4 ++-- ethcore/src/engines/mod.rs | 20 +++++++++++++------- ethcore/src/machine.rs | 27 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index c131fe2b8a0..4f5ee3e2d76 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -356,9 +356,9 @@ impl<'x> OpenBlock<'x> { self.block.state.checkpoint(); let mut outcome = self.block.state.apply(&env_info, self.engine.machine(), &t, self.block.traces.is_enabled())?; - if !self.engine.verify_transaction_outcome(&t, &mut outcome.receipt) { + if let Err(e) = self.engine.verify_transaction_outcome(&t, &mut outcome.receipt) { self.block.state.revert_to_checkpoint(); - return Err("Transaction outcome verification failed.".into()); + return Err(e).into(); } self.block.state.discard_checkpoint(); diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index fbd72964e01..5645205d947 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -463,22 +463,28 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { } /// Prepare the environment information passed for transaction execution. - fn prepare_env_info(&self, _t: &SignedTransaction, _env_info: &mut EnvInfo) { } + fn prepare_env_info(&self, t: &SignedTransaction, env_info: &mut EnvInfo) { + self.machine().prepare_env_info(t, env_info) + } /// Verify the transaction outcome is acceptable. - fn verify_transaction_outcome(&self, _t: &SignedTransaction, _receipt: &mut Receipt) -> bool { - true + fn verify_transaction_outcome(&self, t: &SignedTransaction, receipt: &mut Receipt) -> Result<(), Error> { + self.machine().verify_transaction_outcome(t, receipt) } /// Whether the engine has transaction ordering. - fn has_transaction_ordering(&self) -> bool { false } + fn has_transaction_ordering(&self) -> bool { + self.machine().has_transaction_ordering() + } /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. - fn reorder_transactions(&self, _ts: &mut [Arc]) { } + fn reorder_transactions(&self, ts: &mut [Arc]) { + self.machine().reorder_transactions(ts) + } /// Verify the current transaction ordering is acceptable. - fn verify_transaction_ordering(&self, _ts: &[SignedTransaction], _header: &Header) -> Result<(), transaction::Error> { - Ok(()) + fn verify_transaction_ordering(&self, ts: &[SignedTransaction], header: &Header) -> Result<(), Error> { + self.machine().verify_transaction_ordering(ts, header) } /// Additional information. diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index c66500e2141..30970a6eb31 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -34,6 +34,8 @@ use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Traci use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction}; use tx_filter::TransactionFilter; use rustc_hex::FromHex; +use types::receipt::Receipt; +use ethcore_miner::pool::VerifiedTransaction; use ethereum_types::{U256, Address}; use bytes::BytesRef; @@ -477,6 +479,31 @@ impl EthereumMachine { } rlp.as_val().map_err(|e| transaction::Error::InvalidRlp(e.to_string())) } + + /// Prepare the environment information passed for transaction execution. + pub fn prepare_env_info(&self, _t: &SignedTransaction, _env_info: &mut EnvInfo) { + + } + + /// Verify the transaction outcome is acceptable. + pub fn verify_transaction_outcome(&self, _t: &SignedTransaction, _receipt: &mut Receipt) -> Result<(), Error> { + Ok(()) + } + + /// Whether the engine has transaction ordering. + pub fn has_transaction_ordering(&self) -> bool { + false + } + + /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. + pub fn reorder_transactions(&self, _ts: &mut [Arc]) { + + } + + /// Verify the current transaction ordering is acceptable. + pub fn verify_transaction_ordering(&self, _ts: &[SignedTransaction], _header: &Header) -> Result<(), Error> { + Ok(()) + } } /// Auxiliary data fetcher for an Ethereum machine. In Ethereum-like machines From d3d5b5dbb813c085bb6459006ff16f1fe570e9da Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 08:36:36 +0800 Subject: [PATCH 18/72] Implement vote_gas_used through metadata --- ethcore/src/block.rs | 4 ++-- ethcore/src/engines/mod.rs | 9 +++++---- ethcore/src/machine.rs | 27 +++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 4f5ee3e2d76..015cccc6e35 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -352,11 +352,11 @@ impl<'x> OpenBlock<'x> { } let mut env_info = self.env_info(); - self.engine.prepare_env_info(&t, &mut env_info); + self.engine.prepare_env_info(&t, &self.block, &mut env_info); self.block.state.checkpoint(); let mut outcome = self.block.state.apply(&env_info, self.engine.machine(), &t, self.block.traces.is_enabled())?; - if let Err(e) = self.engine.verify_transaction_outcome(&t, &mut outcome.receipt) { + if let Err(e) = self.engine.verify_transaction_outcome(&t, &mut self.block, &mut outcome.receipt) { self.block.state.revert_to_checkpoint(); return Err(e).into(); } diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 5645205d947..1bc20656429 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -55,6 +55,7 @@ use ethkey::Signature; use parity_machine::{Machine, LocalizedMachine as Localized, TotalScoredHeader}; use ethereum_types::{H256, U256, Address}; use unexpected::{Mismatch, OutOfBounds}; +use block::ExecutedBlock; use bytes::Bytes; use types::ancestry_action::AncestryAction; use types::receipt::Receipt; @@ -463,13 +464,13 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { } /// Prepare the environment information passed for transaction execution. - fn prepare_env_info(&self, t: &SignedTransaction, env_info: &mut EnvInfo) { - self.machine().prepare_env_info(t, env_info) + fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { + self.machine().prepare_env_info(t, block, env_info) } /// Verify the transaction outcome is acceptable. - fn verify_transaction_outcome(&self, t: &SignedTransaction, receipt: &mut Receipt) -> Result<(), Error> { - self.machine().verify_transaction_outcome(t, receipt) + fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { + self.machine().verify_transaction_outcome(t, block, receipt) } /// Whether the engine has transaction ordering. diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 30970a6eb31..3493ee41928 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -36,10 +36,11 @@ use tx_filter::TransactionFilter; use rustc_hex::FromHex; use types::receipt::Receipt; use ethcore_miner::pool::VerifiedTransaction; +use parity_machine::WithMetadata; use ethereum_types::{U256, Address}; use bytes::BytesRef; -use rlp::Rlp; +use rlp::{self, Rlp}; use vm::{CallType, ActionParams, ActionValue, ParamsType}; use vm::{EnvInfo, Schedule, CreateContractAddress}; @@ -130,6 +131,21 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { } } +/// Casper related metadata. +#[derive(Debug, PartialEq, Clone, RlpEncodable, RlpDecodable)] +pub struct CasperMetadata { + /// Gas used in vote transactions. + pub vote_gas_used: U256, +} + +impl Default for CasperMetadata { + fn default() -> Self { + Self { + vote_gas_used: U256::zero(), + } + } +} + /// Special rules to be applied to the schedule. pub type ScheduleCreationRules = Fn(&mut Schedule, BlockNumber) + Sync + Send; @@ -481,12 +497,15 @@ impl EthereumMachine { } /// Prepare the environment information passed for transaction execution. - pub fn prepare_env_info(&self, _t: &SignedTransaction, _env_info: &mut EnvInfo) { - + pub fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { + if t.is_unsigned() { + let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + env_info.gas_used = metadata.vote_gas_used; + } } /// Verify the transaction outcome is acceptable. - pub fn verify_transaction_outcome(&self, _t: &SignedTransaction, _receipt: &mut Receipt) -> Result<(), Error> { + pub fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { Ok(()) } From 39f51f4b7d23625cea467f26caaf93111d4ca04f Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 09:00:30 +0800 Subject: [PATCH 19/72] Implement vote transaction check --- ethcore/src/machine.rs | 82 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 3493ee41928..c1183cd6d5a 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -31,10 +31,10 @@ use header::{BlockNumber, Header, ExtendedHeader}; use spec::CommonParams; use state::{CleanupMode, Substate}; use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Tracing}; -use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction}; +use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction, Action}; use tx_filter::TransactionFilter; use rustc_hex::FromHex; -use types::receipt::Receipt; +use types::receipt::{Receipt, TransactionOutcome}; use ethcore_miner::pool::VerifiedTransaction; use parity_machine::WithMetadata; @@ -443,8 +443,40 @@ impl EthereumMachine { } /// Verify a particular transaction is valid, regardless of order. - pub fn verify_transaction_unordered(&self, t: UnverifiedTransaction, _header: &Header) -> Result { - Ok(SignedTransaction::new(t)?) + pub fn verify_transaction_unordered(&self, t: UnverifiedTransaction, header: &Header) -> Result { + let signed = SignedTransaction::new(t)?; + + if let Some(ref ethash_params) = self.ethash_extensions { + if header.number() >= ethash_params.hybrid_casper_transition { + if signed.is_unsigned() { + let (transaction, _, _) = signed.clone().deconstruct(); + let unsigned = transaction.as_unsigned(); + + match unsigned.action { + Action::Call(address) => { + if address != ethash_params.hybrid_casper_contract_address { + return Err(transaction::Error::NotAllowed) + } + }, + _ => { + return Err(transaction::Error::NotAllowed) + }, + } + + if unsigned.data.len() < 4 { + return Err(transaction::Error::NotAllowed); + } + + if &unsigned.data[0..4] != &[0xe9, 0xdc, 0x06, 0x14] { + return Err(transaction::Error::NotAllowed); + } + } else { + return Err(transaction::Error::NotAllowed); + } + } + } + + Ok(signed) } /// Does basic verification of the transaction. @@ -461,7 +493,18 @@ impl EthereumMachine { } else { None }; - t.verify_basic(check_low_s, chain_id, false)?; + + let allow_null_signer = if let Some(ref ethash_params) = self.ethash_extensions { + if header.number() >= ethash_params.hybrid_casper_transition { + true + } else { + false + } + } else { + false + }; + + t.verify_basic(check_low_s, chain_id, allow_null_signer)?; Ok(()) } @@ -498,14 +541,37 @@ impl EthereumMachine { /// Prepare the environment information passed for transaction execution. pub fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { - if t.is_unsigned() { - let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); - env_info.gas_used = metadata.vote_gas_used; + if let Some(ref ethash_params) = self.ethash_extensions { + if block.header().number() >= ethash_params.hybrid_casper_transition { + if t.is_unsigned() { + let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + env_info.gas_used = metadata.vote_gas_used; + } + } } } /// Verify the transaction outcome is acceptable. pub fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { + if let Some(ref ethash_params) = self.ethash_extensions { + if block.header().number() >= ethash_params.hybrid_casper_transition { + if t.is_unsigned() { + match receipt.outcome { + TransactionOutcome::StatusCode(c) => { + if c == 0 { + return Err("Vote transaction failed.".into()); + } + }, + _ => panic!("Casper requires EIP658 to be enabled."), + } + + let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + metadata.vote_gas_used = receipt.gas_used; + receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); + block.set_metadata(Some(rlp::encode(&metadata).to_vec())); + } + } + } Ok(()) } From 5b6f904c63c18aa15c054e6a39ee38fff3431973 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 09:12:17 +0800 Subject: [PATCH 20/72] Implement all vote transaction related features --- ethcore/src/engines/mod.rs | 8 ++++---- ethcore/src/machine.rs | 41 +++++++++++++++++++++++++++++++++----- ethcore/src/miner/miner.rs | 6 +++--- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 1bc20656429..8dd5763b7d7 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -474,13 +474,13 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { } /// Whether the engine has transaction ordering. - fn has_transaction_ordering(&self) -> bool { - self.machine().has_transaction_ordering() + fn has_transaction_ordering(&self, header: &Header) -> bool { + self.machine().has_transaction_ordering(header) } /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. - fn reorder_transactions(&self, ts: &mut [Arc]) { - self.machine().reorder_transactions(ts) + fn reorder_transactions(&self, ts: &mut [Arc], header: &Header) { + self.machine().reorder_transactions(ts, header) } /// Verify the current transaction ordering is acceptable. diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index c1183cd6d5a..29efefc59c1 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -17,7 +17,7 @@ //! Ethereum-like state machine definition. use std::collections::{BTreeMap, HashMap}; -use std::cmp; +use std::cmp::{self, Ordering}; use std::sync::Arc; use bytes::Bytes; @@ -576,17 +576,48 @@ impl EthereumMachine { } /// Whether the engine has transaction ordering. - pub fn has_transaction_ordering(&self) -> bool { + pub fn has_transaction_ordering(&self, header: &Header) -> bool { + if let Some(ref ethash_params) = self.ethash_extensions { + if header.number() >= ethash_params.hybrid_casper_transition { + return true; + } + } + false } /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. - pub fn reorder_transactions(&self, _ts: &mut [Arc]) { - + pub fn reorder_transactions(&self, ts: &mut [Arc], header: &Header) { + if let Some(ref ethash_params) = self.ethash_extensions { + if header.number() >= ethash_params.hybrid_casper_transition { + ts.sort_by(|a, b| { + match (a.signed().is_unsigned(), b.signed().is_unsigned()) { + (true, true) => Ordering::Equal, + (false, false) => Ordering::Equal, + (true, false) => Ordering::Greater, + (false, true) => Ordering::Less, + } + }); + } + } } /// Verify the current transaction ordering is acceptable. - pub fn verify_transaction_ordering(&self, _ts: &[SignedTransaction], _header: &Header) -> Result<(), Error> { + pub fn verify_transaction_ordering(&self, ts: &[SignedTransaction], header: &Header) -> Result<(), Error> { + if let Some(ref ethash_params) = self.ethash_extensions { + if header.number() >= ethash_params.hybrid_casper_transition { + let mut met_vote_transactions = false; + for t in ts { + if t.is_unsigned() { + met_vote_transactions = true; + } + + if !t.is_unsigned() && met_vote_transactions { + return Err("Found vote transaction before normal transactions.".into()); + } + } + } + } Ok(()) } } diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 7e1a08874a6..c5047594b12 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -331,7 +331,7 @@ impl Miner { let mut open_block = match sealing.queue.pop_if(|b| b.block().header().parent_hash() == &best_hash) { Some(old_block) => { trace!(target: "miner", "prepare_block: Already have previous work; updating and returning"); - if !self.engine.has_transaction_ordering() { + if !self.engine.has_transaction_ordering(old_block.header()) { // add transactions to old_block chain.reopen_block(old_block) } else { @@ -387,8 +387,8 @@ impl Miner { nonce_cap, ); - if self.engine.has_transaction_ordering() { - self.engine.reorder_transactions(&mut pending); + if self.engine.has_transaction_ordering(open_block.header()) { + self.engine.reorder_transactions(&mut pending, open_block.header()); } let took_ms = |elapsed: &Duration| { From d58e5cab0c07f915711ad85aab1e489777aa2c12 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 09:18:37 +0800 Subject: [PATCH 21/72] Set casper contract balance --- ethcore/src/machine.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 29efefc59c1..faa60ddc932 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -74,6 +74,8 @@ pub struct EthashExtensions { pub hybrid_casper_contract_code: Bytes, /// EIP1011 Casper contract address. pub hybrid_casper_contract_address: Address, + /// EIP1011 Casper contract balance. + pub hybrid_casper_contract_balance: U256, /// EIP1011 purity checker code. pub hybrid_casper_purity_checker_contract_code: Bytes, /// EIP1011 purity checker address. @@ -113,6 +115,7 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { "Default CASPER_CODE is valid", ), hybrid_casper_contract_address: Address::from(0x40u64), + hybrid_casper_contract_balance: U256::from(1250000) * ::ethereum::ether(), hybrid_casper_purity_checker_contract_code: DEFAULT_PURITY_CHECKER_CONTRACT.from_hex().expect( "Default PURITY_CHECKER_CODE is valid", ), @@ -274,6 +277,9 @@ impl EthereumMachine { // Force set Casper contract code. { let state = block.state_mut(); + state.new_contract(ðash_params.hybrid_casper_contract_address, + ethash_params.hybrid_casper_contract_balance, + U256::zero()); state.init_code(ðash_params.hybrid_casper_contract_address, ethash_params.hybrid_casper_contract_code.clone())?; state.init_code(ðash_params.hybrid_casper_purity_checker_contract_address, From 837612b3d0061101df84c99c31eeee2468f21d89 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 09:24:31 +0800 Subject: [PATCH 22/72] Call init_epoch for epoch length --- ethcore/src/machine.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index faa60ddc932..6c2824da98b 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -97,6 +97,8 @@ pub struct EthashExtensions { pub hybrid_casper_base_penalty_factor: U256, /// EIP1011 minimal deposit size. pub hybrid_casper_min_deposit_size: U256, + /// EIP1011 warm up period. + pub hybrid_casper_warm_up_period: u64, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { @@ -130,6 +132,7 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { hybrid_casper_base_interest_factor: U256::from(70000000), hybrid_casper_base_penalty_factor: U256::from(2000), hybrid_casper_min_deposit_size: U256::from(1500) * ::ethereum::ether(), + hybrid_casper_warm_up_period: 180000, } } } @@ -308,6 +311,22 @@ impl EthereumMachine { Some(input) )?; } + + if block.header().number() >= ethash_params.hybrid_casper_transition + ethash_params.hybrid_casper_warm_up_period { + if block.header().number() % ethash_params.hybrid_casper_epoch_length == 0 { + let casper_contract = simple_casper_contract::SimpleCasper::default(); + let input = casper_contract.functions().initialize_epoch().input( + block.header().number() / ethash_params.hybrid_casper_epoch_length + ); + + let _ = self.execute_as_system( + block, + ethash_params.hybrid_casper_contract_address, + U256::max_value(), + Some(input) + )?; + } + } } Ok(()) From 8f509be059f5eca3c1c4c4bd3cffe56a719c9d09 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 10:16:26 +0800 Subject: [PATCH 23/72] Implement epoch score fork choice --- ethcore/src/ethereum/ethash.rs | 23 ++++++++++++--- ethcore/src/machine.rs | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 2f2cef0cd5b..dd67dfd792f 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -26,10 +26,11 @@ use unexpected::{OutOfBounds, Mismatch}; use block::*; use error::{BlockError, Error}; use header::{Header, BlockNumber, ExtendedHeader}; -use engines::{self, Engine}; +use engines::{self, Engine, ForkChoice}; use ethjson; -use rlp::Rlp; -use machine::EthereumMachine; +use rlp::{self, Rlp}; +use machine::{EthereumMachine, CasperMetadata}; +use parity_machine::{WithMetadataHeader, TotalScoredHeader}; /// Number of blocks in an ethash snapshot. // make dependent on difficulty incrment divisor? @@ -280,6 +281,8 @@ impl Engine for Arc { rewards.push((*uncle_author, RewardKind::Uncle, result_uncle_reward)); } + self.machine().write_closing_metadata(block)?; + block_reward::apply_block_rewards(&rewards, block, &self.machine) } @@ -361,7 +364,19 @@ impl Engine for Arc { } fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice { - engines::total_difficulty_fork_choice(new, current) + let new_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + let current_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + + // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to + // check transition block here. + let new_score = new_metadata.highest_justified_epoch * U256::from(10).pow(U256::from(40)) + new.total_score(); + let current_score = current_metadata.highest_justified_epoch * U256::from(10).pow(U256::from(40)) + current.total_score(); + + if new_score > current_score { + ForkChoice::New + } else { + ForkChoice::Old + } } } diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 6c2824da98b..202ed373acd 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -99,6 +99,8 @@ pub struct EthashExtensions { pub hybrid_casper_min_deposit_size: U256, /// EIP1011 warm up period. pub hybrid_casper_warm_up_period: u64, + /// EIP1011 non revert min deposit. + pub hybrid_casper_non_revert_min_deposits: U256, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { @@ -133,6 +135,7 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { hybrid_casper_base_penalty_factor: U256::from(2000), hybrid_casper_min_deposit_size: U256::from(1500) * ::ethereum::ether(), hybrid_casper_warm_up_period: 180000, + hybrid_casper_non_revert_min_deposits: U256::from(150000) * ::ethereum::ether(), } } } @@ -142,12 +145,18 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { pub struct CasperMetadata { /// Gas used in vote transactions. pub vote_gas_used: U256, + /// Highest justified epoch returned by Casper contract. + pub highest_justified_epoch: U256, + /// Highest finalized epoch returned by Casper contract. + pub highest_finalized_epoch: U256, } impl Default for CasperMetadata { fn default() -> Self { Self { vote_gas_used: U256::zero(), + highest_justified_epoch: U256::zero(), + highest_finalized_epoch: U256::zero(), } } } @@ -332,6 +341,48 @@ impl EthereumMachine { Ok(()) } + /// Write additional metadata when closing block. + pub fn write_closing_metadata(&self, block: &mut ExecutedBlock) -> Result<(), Error> { + if let Some(ref ethash_params) = self.ethash_extensions { + if block.header().number() >= ethash_params.hybrid_casper_transition { + let casper_contract = simple_casper_contract::SimpleCasper::default(); + let highest_justified_epoch: U256 = { + let input = casper_contract.functions().highest_justified_epoch().input( + ethash_params.hybrid_casper_non_revert_min_deposits, + ); + let result = self.execute_as_system( + block, + ethash_params.hybrid_casper_contract_address, + U256::max_value(), + Some(input) + )?; + casper_contract.functions().highest_justified_epoch().output(&result) + .expect("Casper contract ABI definition is valid; qed") + }; + let highest_finalized_epoch: U256 = { + let input = casper_contract.functions().highest_finalized_epoch().input( + ethash_params.hybrid_casper_non_revert_min_deposits, + ); + let result = self.execute_as_system( + block, + ethash_params.hybrid_casper_contract_address, + U256::max_value(), + Some(input) + )?; + casper_contract.functions().highest_finalized_epoch().output(&result) + .expect("Casper contract ABI definition is valid; qed") + }; + + let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + metadata.highest_justified_epoch = highest_justified_epoch; + metadata.highest_finalized_epoch = highest_finalized_epoch; + block.set_metadata(Some(rlp::encode(&metadata).to_vec())); + } + } + + Ok(()) + } + /// Populate a header's fields based on its parent's header. /// Usually implements the chain scoring rule based on weight. /// The gas floor target must not be lower than the engine's minimum gas limit. From fc47b492eb17ef9756b2ccd2415a3783f1ee312b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 18 May 2018 10:24:45 +0800 Subject: [PATCH 24/72] Handle Casper finalization --- ethcore/src/ethereum/ethash.rs | 16 +++++++++++++++- ethcore/src/machine.rs | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index dd67dfd792f..435a64afeba 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -30,7 +30,8 @@ use engines::{self, Engine, ForkChoice}; use ethjson; use rlp::{self, Rlp}; use machine::{EthereumMachine, CasperMetadata}; -use parity_machine::{WithMetadataHeader, TotalScoredHeader}; +use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; +use types::ancestry_action::AncestryAction; /// Number of blocks in an ethash snapshot. // make dependent on difficulty incrment divisor? @@ -378,6 +379,19 @@ impl Engine for Arc { ForkChoice::Old } } + + fn ancestry_actions(&self, block: &ExecutedBlock, _ancestry: &mut Iterator) -> Vec { + let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + + if metadata.highest_finalized_hash != Default::default() { + // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a + // conditional. + vec![AncestryAction::MarkFinalized(metadata.highest_finalized_hash)] + } else { + // Default metadata would match this. So we don't need to check Casper transition block here. + vec![] + } + } } impl Ethash { diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 202ed373acd..e71e950c9d2 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -43,6 +43,7 @@ use bytes::BytesRef; use rlp::{self, Rlp}; use vm::{CallType, ActionParams, ActionValue, ParamsType}; use vm::{EnvInfo, Schedule, CreateContractAddress}; +use hash::H256; use_contract!(simple_casper_contract, "SimpleCasper", "res/contracts/simple_casper.json"); @@ -149,6 +150,8 @@ pub struct CasperMetadata { pub highest_justified_epoch: U256, /// Highest finalized epoch returned by Casper contract. pub highest_finalized_epoch: U256, + /// Highest finalized block hash returned by Casper contract. + pub highest_finalized_hash: H256, } impl Default for CasperMetadata { @@ -157,6 +160,7 @@ impl Default for CasperMetadata { vote_gas_used: U256::zero(), highest_justified_epoch: U256::zero(), highest_finalized_epoch: U256::zero(), + highest_finalized_hash: Default::default(), } } } @@ -372,10 +376,24 @@ impl EthereumMachine { casper_contract.functions().highest_finalized_epoch().output(&result) .expect("Casper contract ABI definition is valid; qed") }; + let highest_finalized_hash: H256 = { + let input = casper_contract.functions().checkpoint_hashes().input( + highest_finalized_epoch, + ); + let result = self.execute_as_system( + block, + ethash_params.hybrid_casper_contract_address, + U256::max_value(), + Some(input) + )?; + casper_contract.functions().checkpoint_hashes().output(&result) + .expect("Casper contract ABI definition is valid; qed") + }; let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); metadata.highest_justified_epoch = highest_justified_epoch; metadata.highest_finalized_epoch = highest_finalized_epoch; + metadata.highest_finalized_hash = highest_finalized_hash; block.set_metadata(Some(rlp::encode(&metadata).to_vec())); } } From 1729fa3edae06bf5ba7aa28f6012405ea19f643b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 22 May 2018 15:13:10 +0800 Subject: [PATCH 25/72] typo: where --- ethcore/src/machine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index e71e950c9d2..1da7ad0a430 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -69,7 +69,7 @@ pub struct EthashExtensions { pub dao_hardfork_beneficiary: Address, /// DAO hard-fork DAO accounts list (L) pub dao_hardfork_accounts: Vec
, - /// Number of first block wehre Casper rules begin. + /// Number of first block where Casper rules begin. pub hybrid_casper_transition: u64, /// EIP1011 Casper contract code. pub hybrid_casper_contract_code: Bytes, From cc4aaa483989b50fe32afa764b8a8c87db7a7112 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 22 May 2018 15:28:35 +0800 Subject: [PATCH 26/72] Remove transacrion ordering requirement for Casper --- ethcore/src/block.rs | 1 - ethcore/src/engines/mod.rs | 16 ---------------- ethcore/src/miner/miner.rs | 20 +++----------------- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 015cccc6e35..3d2ae00d6b5 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -656,7 +656,6 @@ fn enact( b.populate_from(&header); - engine.verify_transaction_ordering(&transactions, &header)?; b.push_transactions(transactions)?; for u in uncles { diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 8dd5763b7d7..9aa8669c98b 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -59,7 +59,6 @@ use block::ExecutedBlock; use bytes::Bytes; use types::ancestry_action::AncestryAction; use types::receipt::Receipt; -use ethcore_miner::pool::VerifiedTransaction; /// Default EIP-210 contract code. /// As defined in https://github.com/ethereum/EIPs/pull/210 @@ -473,21 +472,6 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { self.machine().verify_transaction_outcome(t, block, receipt) } - /// Whether the engine has transaction ordering. - fn has_transaction_ordering(&self, header: &Header) -> bool { - self.machine().has_transaction_ordering(header) - } - - /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. - fn reorder_transactions(&self, ts: &mut [Arc], header: &Header) { - self.machine().reorder_transactions(ts, header) - } - - /// Verify the current transaction ordering is acceptable. - fn verify_transaction_ordering(&self, ts: &[SignedTransaction], header: &Header) -> Result<(), Error> { - self.machine().verify_transaction_ordering(ts, header) - } - /// Additional information. fn additional_params(&self) -> HashMap { self.machine().additional_params() diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index c5047594b12..3168ff1a846 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -331,18 +331,8 @@ impl Miner { let mut open_block = match sealing.queue.pop_if(|b| b.block().header().parent_hash() == &best_hash) { Some(old_block) => { trace!(target: "miner", "prepare_block: Already have previous work; updating and returning"); - if !self.engine.has_transaction_ordering(old_block.header()) { - // add transactions to old_block - chain.reopen_block(old_block) - } else { - trace!(target: "miner", "prepare_block: Transaction ordering prevents reopening of old block"); - let params = self.params.read().clone(); - chain.prepare_open_block( - params.author, - params.gas_range_target, - params.extra_data, - ) - } + // add transactions to old_block + chain.reopen_block(old_block) } None => { // block not found - create it. @@ -380,17 +370,13 @@ impl Miner { None }; - let mut pending: Vec> = self.transaction_queue.pending( + let pending: Vec> = self.transaction_queue.pending( client.clone(), chain_info.best_block_number, chain_info.best_block_timestamp, nonce_cap, ); - if self.engine.has_transaction_ordering(open_block.header()) { - self.engine.reorder_transactions(&mut pending, open_block.header()); - } - let took_ms = |elapsed: &Duration| { elapsed.as_secs() * 1000 + elapsed.subsec_nanos() as u64 / 1_000_000 }; From 19fe45ffc7c96f54caea0e1f2f89b46a3498f59e Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 22 May 2018 15:29:47 +0800 Subject: [PATCH 27/72] typo: extra empty line --- ethcore/src/block.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 3d2ae00d6b5..6adb1baafaf 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -655,7 +655,6 @@ fn enact( )?; b.populate_from(&header); - b.push_transactions(transactions)?; for u in uncles { From 40ecf94a33e80a872a89e065138bb52e2f3e8c45 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 22 May 2018 15:30:55 +0800 Subject: [PATCH 28/72] typo: remove unused functions --- ethcore/src/machine.rs | 46 ------------------------------------------ 1 file changed, 46 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 1da7ad0a430..445cee0bbc9 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -668,52 +668,6 @@ impl EthereumMachine { } Ok(()) } - - /// Whether the engine has transaction ordering. - pub fn has_transaction_ordering(&self, header: &Header) -> bool { - if let Some(ref ethash_params) = self.ethash_extensions { - if header.number() >= ethash_params.hybrid_casper_transition { - return true; - } - } - - false - } - - /// Before applying transaction states, order transactions to desired. The engine should only apply absolutely minimal ordering. - pub fn reorder_transactions(&self, ts: &mut [Arc], header: &Header) { - if let Some(ref ethash_params) = self.ethash_extensions { - if header.number() >= ethash_params.hybrid_casper_transition { - ts.sort_by(|a, b| { - match (a.signed().is_unsigned(), b.signed().is_unsigned()) { - (true, true) => Ordering::Equal, - (false, false) => Ordering::Equal, - (true, false) => Ordering::Greater, - (false, true) => Ordering::Less, - } - }); - } - } - } - - /// Verify the current transaction ordering is acceptable. - pub fn verify_transaction_ordering(&self, ts: &[SignedTransaction], header: &Header) -> Result<(), Error> { - if let Some(ref ethash_params) = self.ethash_extensions { - if header.number() >= ethash_params.hybrid_casper_transition { - let mut met_vote_transactions = false; - for t in ts { - if t.is_unsigned() { - met_vote_transactions = true; - } - - if !t.is_unsigned() && met_vote_transactions { - return Err("Found vote transaction before normal transactions.".into()); - } - } - } - } - Ok(()) - } } /// Auxiliary data fetcher for an Ethereum machine. In Ethereum-like machines From f77e0be0cf55cb6708f83fbd264e4460ff357e6c Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 22 May 2018 15:33:24 +0800 Subject: [PATCH 29/72] Fix expect messages --- ethcore/src/ethereum/ethash.rs | 6 +++--- ethcore/src/machine.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 435a64afeba..fa9205ace23 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -365,8 +365,8 @@ impl Engine for Arc { } fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice { - let new_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); - let current_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + let new_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let current_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to // check transition block here. @@ -381,7 +381,7 @@ impl Engine for Arc { } fn ancestry_actions(&self, block: &ExecutedBlock, _ancestry: &mut Iterator) -> Vec { - let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); if metadata.highest_finalized_hash != Default::default() { // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 445cee0bbc9..b26ae22d963 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -390,7 +390,7 @@ impl EthereumMachine { .expect("Casper contract ABI definition is valid; qed") }; - let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); metadata.highest_justified_epoch = highest_justified_epoch; metadata.highest_finalized_epoch = highest_finalized_epoch; metadata.highest_finalized_hash = highest_finalized_hash; @@ -638,7 +638,7 @@ impl EthereumMachine { if let Some(ref ethash_params) = self.ethash_extensions { if block.header().number() >= ethash_params.hybrid_casper_transition { if t.is_unsigned() { - let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); env_info.gas_used = metadata.vote_gas_used; } } @@ -659,7 +659,7 @@ impl EthereumMachine { _ => panic!("Casper requires EIP658 to be enabled."), } - let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Block metadata is valid; qed")).unwrap_or(Default::default()); + let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); metadata.vote_gas_used = receipt.gas_used; receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); block.set_metadata(Some(rlp::encode(&metadata).to_vec())); From ab251eda1ad6418ada104858ee718cbc6b5e5934 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 23 May 2018 14:49:53 +0800 Subject: [PATCH 30/72] Reduce value of Casper parameters for testing --- ethcore/src/machine.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index b26ae22d963..1c1189e3fcb 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -129,14 +129,14 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { "Default MSG_HASHER_CODE is valid", ), hybrid_casper_msg_hasher_contract_address: Address::from(0x42u64), - hybrid_casper_epoch_length: 50, - hybrid_casper_withdrawal_delay: 15000, - hybrid_casper_dynasty_logout_delay: 700, + hybrid_casper_epoch_length: 5, + hybrid_casper_withdrawal_delay: 150, + hybrid_casper_dynasty_logout_delay: 70, hybrid_casper_base_interest_factor: U256::from(70000000), hybrid_casper_base_penalty_factor: U256::from(2000), - hybrid_casper_min_deposit_size: U256::from(1500) * ::ethereum::ether(), - hybrid_casper_warm_up_period: 180000, - hybrid_casper_non_revert_min_deposits: U256::from(150000) * ::ethereum::ether(), + hybrid_casper_min_deposit_size: U256::from(5) * ::ethereum::ether(), + hybrid_casper_warm_up_period: 5, + hybrid_casper_non_revert_min_deposits: U256::from(1) * ::ethereum::ether(), } } } From 6bab4ee75ceeff437ad7c442bce06f473b959fbd Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 23 May 2018 18:05:28 +0800 Subject: [PATCH 31/72] Update casper contract --- ethcore/res/code/simple_casper.hex | 2 +- ethcore/res/contracts/simple_casper.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ethcore/res/code/simple_casper.hex b/ethcore/res/code/simple_casper.hex index d803201a9db..2c0e3a65786 100644 --- a/ethcore/res/code/simple_casper.hex +++ b/ethcore/res/code/simple_casper.hex @@ -1 +1 @@ -"600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526316d5c53d60005114156103105761010060046101403734156100b557600080fd5b606051600435806040519013585780919012156100d157600080fd5b50606051602435806040519013585780919012156100ee57600080fd5b506060516044358060405190135857809190121561010b57600080fd5b50606435602051811061011d57600080fd5b50608435602051811061012f57600080fd5b5060605160e4358060405190135857809190121561014c57600080fd5b506015541561015a57600080fd5b6101006101405112600061014051131661017357600080fd5b600061016051121561018457600080fd5b600261018051121561019557600080fd5b60006101e05112156101a657600080fd5b60006102005112156101b757600080fd5b600061022051136101c757600080fd5b60016015556101405160165561016051601755610180516018556101e051601b5561020051601c5561022051601d55600060a0516016548061020857600080fd5b6402540be4004302058060805190135857809190121561022757600080fd5b121561026f576402540be4006402540be3ff60a0516016548061024957600080fd5b6402540be4004302058060805190135857809190121561026857600080fd5b03056102a6565b6402540be40060a0516016548061028557600080fd5b6402540be400430205806080519013585780919012156102a457600080fd5b055b601e556101a0516019556101c051601a5560016002556000600455601e54600f5568056bc75e2d63100000600f54600c60c052602060c0200155600060065560006007556c0c9f2c9cd04674edea40000000601f5562030d4060205562030d406021556003602255005b639a8eec77600051141561035f57341561032957600080fd5b30331461033557600080fd5b606051601054600f54038060405190135857809190121561035557600080fd5b60005260206000f3005b63db23eee0600051141561068f57341561037857600080fd5b30331461038457600080fd5b600f54610140526060516001600060a051670de0b6b3a764000060a05160605160016101405103806040519013585780919012156103c157600080fd5b600c60c052602060c0200154600754600654808212156103e157806103e3565b815b9050905081810281198383830514176103fb57600080fd5b6402540be40081059050905090508060805190135857809190121561041f57600080fd5b058060805190135857809190121561043657600080fd5b12156104f3576402540be4006402540be3ff60a051670de0b6b3a764000060a051606051600161014051038060405190135857809190121561047757600080fd5b600c60c052602060c0200154600754600654808212156104975780610499565b815b9050905081810281198383830514176104b157600080fd5b6402540be4008105905090509050806080519013585780919012156104d557600080fd5b05806080519013585780919012156104ec57600080fd5b030561059f565b6402540be40060a051670de0b6b3a764000060a051606051600161014051038060405190135857809190121561052857600080fd5b600c60c052602060c020015460075460065480821215610548578061054a565b815b90509050818102811983838305141761056257600080fd5b6402540be40081059050905090508060805190135857809190121561058657600080fd5b058060805190135857809190121561059d57600080fd5b055b01806040519013585780919012156105b657600080fd5b6101605260a0516404a817c80068056bc75e2d63100000610160510205806080519013585780919012156105e957600080fd5b610180526101a060006014818352015b60a051600260a05160a051610180518061061257600080fd5b68056bc75e2d631000006101605102058060805190135857809190121561063857600080fd5b61018051018060805190135857809190121561065357600080fd5b058060805190135857809190121561066a57600080fd5b610180525b81516001018083528114156105f9575b50506101805160005260206000f3005b63de7f997560005114156106cb5734156106a857600080fd5b3033146106b457600080fd5b6000600754136000600654131660005260206000f3005b63d286bb8260005114156107e65734156106e457600080fd5b3033146106f057600080fd5b600f54610140526002606051600261014051038060405190135857809190121561071957600080fd5b600a60c052602060c0200160c052602060c0200154156107a057600460605160018254018060405190135857809190121561075357600080fd5b815550600654600755600660a051600454600560c052602060c02001548254018060805190135857809190121561078957600080fd5b81555061014051600454600860c052602060c02001555b60045461014051600960c052602060c0200155600b54156107df5760605160016101405103806040519013585780919012156107db57600080fd5b6013555b6000600b55005b636526ed7260005114156109645734156107ff57600080fd5b30331461080b57600080fd5b600f54610140526001600b5560016003606051600161014051038060405190135857809190121561083b57600080fd5b600a60c052602060c0200160c052602060c020015560016002606051600161014051038060405190135857809190121561087457600080fd5b600a60c052602060c0200160c052602060c020015560605160016101405103806040519013585780919012156108a957600080fd5b60115560605160016101405103806040519013585780919012156108cc57600080fd5b60105560016101a05260016101c05260406101605260016101a05260016101c052606051600161014051038060405190135857809190121561090d57600080fd5b600160c052602060c0200154606051600161014051038060405190135857809190121561093957600080fd5b7f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b9610160516101a0a3005b63acc619c36000511415610b7757341561097d57600080fd5b30331461098957600080fd5b600f5461014052600260206101e06004639a8eec776101805261019c6000305af16109b357600080fd5b6101e05113156101605261016051156020610260600463de7f99756102005261021c6000305af16109e357600080fd5b610260511517156109f957600060005260206000f35b60a05160135460016060516001610140510380604051901358578091901215610a2157600080fd5b600a60c052602060c0200160c052602060c0200160c052602060c020015460065480610a4c57600080fd5b806402540be4008302059050905080608051901358578091901215610a7057600080fd5b6102805260a05160135460056060516001610140510380604051901358578091901215610a9c57600080fd5b600a60c052602060c0200160c052602060c0200160c052602060c020015460075480610ac757600080fd5b806402540be4008302059050905080608051901358578091901215610aeb57600080fd5b6102a052610280516102a05180821315610b055780610b07565b815b905090506102c05260a051600260a0516012546102c0518181028119838383051417610b3257600080fd5b6402540be400810590509050905080608051901358578091901215610b5657600080fd5b0580608051901358578091901215610b6d57600080fd5b60005260206000f3005b63579f38b26000511415610ec15760406004610140373415610b9857600080fd5b303314610ba457600080fd5b60605160043580604051901358578091901215610bc057600080fd5b5060605160243580604051901358578091901215610bdd57600080fd5b50600161014051600060c052602060c0200160c052602060c0200160a0516402540be400610160510282540180608051901358578091901215610c1f57600080fd5b815550600461014051600060c052602060c0200160c052602060c020015461018052600261014051600060c052602060c0200160c052602060c02001546101a0526004546101c05260605160016101c0510380604051901358578091901215610c8757600080fd5b6101e0526101a0516101c051126101c0516101805113151615610cd157600660a0516402540be400610160510282540180608051901358578091901215610ccd57600080fd5b8155505b6101a0516101e051126101e0516101805113151615610d1757600760a0516402540be400610160510282540180608051901358578091901215610d1357600080fd5b8155505b601f546101a0511215610d5e576101a051600560c052602060c0200160a0516402540be400610160510282540380608051901358578091901215610d5a57600080fd5b8155505b6000600060006000600060a051600860a051600f54600c60c052602060c0200154610160518181028119838383051417610d9757600080fd5b8090509050905080608051901358578091901215610db457600080fd5b0580608051901358578091901215610dcb57600080fd5b1215610e47576402540be4006402540be3ff60a051600860a051600f54600c60c052602060c0200154610160518181028119838383051417610e0c57600080fd5b8090509050905080608051901358578091901215610e2957600080fd5b0580608051901358578091901215610e4057600080fd5b0305610eb2565b6402540be40060a051600860a051600f54600c60c052602060c0200154610160518181028119838383051417610e7c57600080fd5b8090509050905080608051901358578091901215610e9957600080fd5b0580608051901358578091901215610eb057600080fd5b055b416000f1610ebf57600080fd5b005b6301b7af186000511415610f7c5760206004610140373415610ee257600080fd5b303314610eee57600080fd5b60605160043580604051901358578091901215610f0a57600080fd5b506000600661014051600060c052602060c0200160c052602060c0200154600360c052602060c020015561014051600060c052602060c0200160c052602060c0206000815560006001820155600060028201556000600382015560006004820155600060058201556000600682015550005b63a276740060005114156110b75760606004610140373415610f9d57600080fd5b303314610fa957600080fd5b6104206024356004016101a037610400602435600401351115610fcb57600080fd5b60605160443580604051901358578091901215610fe757600080fd5b5060016000610140516020826105e00101526020810190506101a0610400806020846105e001018260208501600060046078f1505080518201915050806105e0526105e09050805160200180610a40828460006004600a8704601201f161104d57600080fd5b50506020610ec0610a4051610a60600061018051600060c052602060c0200160c052602060c02054602154f161108257600080fd5b6020610ea052610ea06020600060208351038113156110a057600080fd5b0460200260200181015190501460005260206000f3005b6337df0ba860005114156111a25734156110d057600080fd5b60a0516013546001600f54600a60c052602060c0200160c052602060c0200160c052602060c02001546006548061110657600080fd5b806402540be400830205905090508060805190135857809190121561112a57600080fd5b60a0516013546005600f54600a60c052602060c0200160c052602060c0200160c052602060c02001546007548061116057600080fd5b806402540be400830205905090508060805190135857809190121561118457600080fd5b808213156111925780611194565b815b9050905060005260206000f3005b6399fb5eec600051141561133c57602060046101403734156111c357600080fd5b606051600435806040519013585780919012156111df57600080fd5b50600060a051600f54600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761122357600080fd5b6402540be40081059050905090508060805190135857809190121561124757600080fd5b12156112c5576402540be4006402540be3ff60a051600f54600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761129a57600080fd5b6402540be4008105905090509050806080519013585780919012156112be57600080fd5b0305611332565b6402540be40060a051600f54600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761130c57600080fd5b6402540be40081059050905090508060805190135857809190121561133057600080fd5b055b60005260206000f3005b634a8fd698600051141561146957341561135557600080fd5b600060a051600f54600c60c052602060c0200154600654818102811983838305141761138057600080fd5b6402540be4008105905090509050806080519013585780919012156113a457600080fd5b121561140a576402540be4006402540be3ff60a051600f54600c60c052602060c020015460065481810281198383830514176113df57600080fd5b6402540be40081059050905090508060805190135857809190121561140357600080fd5b030561145f565b6402540be40060a051600f54600c60c052602060c0200154600654818102811983838305141761143957600080fd5b6402540be40081059050905090508060805190135857809190121561145d57600080fd5b055b60005260206000f3005b637db2eedc600051141561159657341561148257600080fd5b600060a051600f54600c60c052602060c020015460075481810281198383830514176114ad57600080fd5b6402540be4008105905090509050806080519013585780919012156114d157600080fd5b1215611537576402540be4006402540be3ff60a051600f54600c60c052602060c0200154600754818102811983838305141761150c57600080fd5b6402540be40081059050905090508060805190135857809190121561153057600080fd5b030561158c565b6402540be40060a051600f54600c60c052602060c0200154600754818102811983838305141761156657600080fd5b6402540be40081059050905090508060805190135857809190121561158a57600080fd5b055b60005260206000f3005b6313d21fa36000511415611c8a57604060046101403734156115b757600080fd5b610420600435600401610180376104006004356004013511156115d957600080fd5b6104206024356004016105c0376104006024356004013511156115fb57600080fd5b610180805160200180610a20828460006004600a8704601201f161161e57600080fd5b50506020610e80610a2051610a406000601954602054f161163e57600080fd5b6020610e6052610e6060206000602083510381131561165c57600080fd5b046020026020018101519050610a0052611520610180610620610ec08251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610ec051146116ab57600080fd5b610ec051610ec0018060200151600082518060209013585780919012156116d157600080fd5b601f6101000a82048115176116e557600080fd5b606051816020036101000a83048060405190135857809190121561170857600080fd5b90509050905081526020610ee051610ec001511461172557600080fd5b610ee051610ee001518160200152610f0051610ec00180602001516000825180602090135857809190121561175957600080fd5b601f6101000a820481151761176d57600080fd5b606051816020036101000a83048060405190135857809190121561179057600080fd5b9050905090508160400152610f2051610ec0018060200151600082518060209013585780919012156117c157600080fd5b601f6101000a82048115176117d557600080fd5b606051816020036101000a8304806040519013585780919012156117f857600080fd5b9050905090508160600152610f4051610ec00180516020018083608001828460006004600a8704601201f161182c57600080fd5b505050611520516119e05261156051611a005261158051611a20526115a0805160200180611a40828460006004600a8704601201f161186a57600080fd5b50506105c0805160200180611ea0828460006004600a8704601201f161188f57600080fd5b50506020612300611ea051611ec06000601954602054f16118af57600080fd5b60206122e0526122e06020600060208351038113156118cd57600080fd5b046020026020018101519050611e80526129a06105c06106206123408251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0612340511461191c57600080fd5b612340516123400180602001516000825180602090135857809190121561194257600080fd5b601f6101000a820481151761195657600080fd5b606051816020036101000a83048060405190135857809190121561197957600080fd5b905090509050815260206123605161234001511461199657600080fd5b612360516123600151816020015261238051612340018060200151600082518060209013585780919012156119ca57600080fd5b601f6101000a82048115176119de57600080fd5b606051816020036101000a830480604051901358578091901215611a0157600080fd5b90509050905081604001526123a05161234001806020015160008251806020901358578091901215611a3257600080fd5b601f6101000a8204811517611a4657600080fd5b606051816020036101000a830480604051901358578091901215611a6957600080fd5b90509050905081606001526123c0516123400180516020018083608001828460006004600a8704601201f1611a9d57600080fd5b5050506129a051612e60526129e051612e8052612a0051612ea052612a20805160200180612ec0828460006004600a8704601201f1611adb57600080fd5b505060206137e0610484606063a276740061330052610a0051613320528061334052611a40808051602001808461332001828460006004600a8704601201f1611b2357600080fd5b5050805182016020019150506119e0516133605261331c90506000305af1611b4a57600080fd5b6137e0511515611b5f57600060005260206000f35b6020613ce0610484606063a276740061380052611e8051613820528061384052612ec0808051602001808461382001828460006004600a8704601201f1611ba557600080fd5b505080518201602001915050612e60516138605261381c90506000305af1611bcc57600080fd5b613ce0511515611be157600060005260206000f35b612e60516119e051141515611bfb57600060005260206000f35b611e8051610a00511415611c1457600060005260206000f35b60036119e051600060c052602060c0200160c052602060c020015415611c3f57600060005260206000f35b612e8051611a005114613d0052611a2051612ea05112611a0051612e80511316612ea051611a205112612e8051611a0051131617613d2052613d2051613d00511760005260206000f3005b6310f246356000511415611cb0573415611ca357600080fd5b60135460005260206000f3005b63855f372c6000511415611d2d573415611cc957600080fd5b6060516001606051601654600f540280604051901358578091901215611cee57600080fd5b0380604051901358578091901215611d0557600080fd5b6101004303811215611d1657600080fd5b438110611d2257600080fd5b4060005260206000f3005b635c0a75de6000511415611e5f5760206004610140373415611d4e57600080fd5b60605160043580604051901358578091901215611d6a57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f540380604051901358578091901215611da457600080fd5b61016052600361016051600a60c052602060c0200160c052602060c02001546101a0526101405161016051600a60c052602060c0200160c052602060c0205412156101c05261014051600461016051600a60c052602060c0200160c052602060c020015412156101e0526101e0516101c051166101a0511615611e2e576101605160005260206000f35b601e54610160511415611e4057611e51565b5b8151600101808352811415611d83575b5050600060005260206000f3005b631f994c406000511415611fb05760206004610140373415611e8057600080fd5b60605160043580604051901358578091901215611e9c57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f540380604051901358578091901215611ed657600080fd5b61016052600261016051600a60c052602060c0200160c052602060c02001546101a0526101405161016051600a60c052602060c0200160c052602060c0205412156101c05261014051600461016051600a60c052602060c0200160c052602060c020015412156101e0526101e0516101c051166101a0511615611f60576101605160005260206000f35b601e54610160511415611f7257611f83565b5b8151600101808352811415611eb5575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000f3005b635dcffc1760005114156124c25760206004610140373415611fd157600080fd5b60605160043580604051901358578091901215611fed57600080fd5b50600060a0516016548061200057600080fd5b6402540be4004302058060805190135857809190121561201f57600080fd5b1215612067576402540be4006402540be3ff60a0516016548061204157600080fd5b6402540be4004302058060805190135857809190121561206057600080fd5b030561209e565b6402540be40060a0516016548061207d57600080fd5b6402540be4004302058060805190135857809190121561209c57600080fd5b055b610160526060516001600f5401806040519013585780919012156120c157600080fd5b610140511461016051610140511315166120da57600080fd5b60206101e06004634a8fd6986101805261019c6000305af16120fb57600080fd5b6101e05161014051600a60c052602060c0200160c052602060c0205560206102606004637db2eedc6102005261021c6000305af161213857600080fd5b61026051600461014051600a60c052602060c0200160c052602060c020015561014051600f5560a05160206102e0600463acc619c36102805261029c6000305af161218257600080fd5b6102e0516402540be40001806080519013585780919012156121a357600080fd5b600e5560a051600e5460a0516012546402540be40001806080519013585780919012156121cf57600080fd5b806121d957600080fd5b806402540be40083020590509050806080519013585780919012156121fd57600080fd5b600d5560a051600d54606051600161014051038060405190135857809190121561222657600080fd5b600c60c052602060c0200154818102811983838305141761224657600080fd5b6402540be40081059050905090508060805190135857809190121561226a57600080fd5b61014051600c60c052602060c0200155606051600161014051038060405190135857809190121561229a57600080fd5b601460c052602060c020015461014051601460c052602060c020015560206103c0600463de7f99756103605261037c6000305af16122d757600080fd5b6103c051156123ea5760a051601b546020610460600463db23eee06104005261041c6000305af161230757600080fd5b610460518061231557600080fd5b806402540be400830205905090508060805190135857809190121561233957600080fd5b6103e05260a05160a051606051600260206104e06004639a8eec776104805261049c6000305af161236957600080fd5b6104e051038060405190135857809190121561238457600080fd5b601c54818102811983838305141761239b57600080fd5b80905090509050806080519013585780919012156123b857600080fd5b6103e05101806080519013585780919012156123d357600080fd5b6012556000601254136123e557600080fd5b612410565b600060006004636526ed726103005261031c6000305af161240a57600080fd5b60006012555b6020610560600463855f372c6105005261051c6000305af161243157600080fd5b6105605161014051600160c052602060c020015560006000600463d286bb826105805261059c6000305af161246557600080fd5b60006106205260006106405260406105e05260006106205260006106405261014051600160c052602060c0200154610140517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96105e051610620a3005b63f9609f08600051141561289857604060046101403760043560205181106124e957600080fd5b5060243560205181106124fb57600080fd5b50600060a0516016548061250e57600080fd5b6402540be4004302058060805190135857809190121561252d57600080fd5b1215612575576402540be4006402540be3ff60a0516016548061254f57600080fd5b6402540be4004302058060805190135857809190121561256e57600080fd5b03056125ac565b6402540be40060a0516016548061258b57600080fd5b6402540be400430205806080519013585780919012156125aa57600080fd5b055b600f54146125b957600080fd5b600060006004610180527fa1903eab000000000000000000000000000000000000000000000000000000006101a0526101806004806020846101e001018260208501600060046012f1505080518201915050610140516020826101e0010152602081019050806101e0526101e09050805160200180610260828460006004600a8704601201f161264857600080fd5b50506020610300610260516102806000601a546207a120f161266957600080fd5b60206102e0526102e060206000602083510381131561268757600080fd5b046020026020018101519050141561269e57600080fd5b61016051600360c052602060c0200154156126b857600080fd5b601d543412156126c757600080fd5b606051600260045401806040519013585780919012156126e657600080fd5b6103405260a051600f54600c60c052602060c02001548061270657600080fd5b68056bc75e2d631000003402058060805190135857809190121561272957600080fd5b61036052600254600060c052602060c0200160c052602060c020610140518155610360516001820155601f54600282015560006003820155610340516004820155600060058201556101605160068201555060025461016051600360c052602060c020015560026060516001825401806040519013585780919012156127ae57600080fd5b81555061034051600560c052602060c0200160a05161036051825401806080519013585780919012156127e057600080fd5b815550610140516103c052600461016051600360c052602060c0200154600060c052602060c0200160c052602060c02001546103e0523461040052606061038052610140516103c052600461016051600360c052602060c0200154600060c052602060c0200160c052602060c02001546103e052346104005261016051600360c052602060c0200154610160517fc913dcae46368ac8a73eb63d4f2077a2de58e994bf2cddf074ab3a0fcaa3a0e1610380516103c0a3005b6342310c326000511415612dab57602060046101403734156128b957600080fd5b610420600435600401610160376104006004356004013511156128db57600080fd5b600060a051601654806128ed57600080fd5b6402540be4004302058060805190135857809190121561290c57600080fd5b1215612954576402540be4006402540be3ff60a0516016548061292e57600080fd5b6402540be4004302058060805190135857809190121561294d57600080fd5b030561298b565b6402540be40060a0516016548061296a57600080fd5b6402540be4004302058060805190135857809190121561298957600080fd5b055b600f541461299857600080fd5b6101608051602001806105c0828460006004600a8704601201f16129bb57600080fd5b50506020610a206105c0516105e06000601954602054f16129db57600080fd5b6020610a0052610a006020600060208351038113156129f957600080fd5b0460200260200181015190506105a052611000610160610560610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610aa0f150506080610a605114612a4857600080fd5b610a6051610a6001806020015160008251806020901358578091901215612a6e57600080fd5b601f6101000a8204811517612a8257600080fd5b606051816020036101000a830480604051901358578091901215612aa557600080fd5b9050905090508152610a8051610a6001806020015160008251806020901358578091901215612ad357600080fd5b601f6101000a8204811517612ae757600080fd5b606051816020036101000a830480604051901358578091901215612b0a57600080fd5b9050905090508160200152610aa051610a600180516020018083604001828460006004600a8704601201f1612b3e57600080fd5b5050506110005161148052611020516114a0526110408051602001806114c0828460006004600a8704601201f1612b7457600080fd5b50506114a051600f541215612b8857600080fd5b600661148051600060c052602060c0200160c052602060c02001543314611900526020611e00610484606063a2767400611920526105a0516119405280611960526114c0808051602001808461194001828460006004600a8704601201f1612bef57600080fd5b505080518201602001915050611480516119805261193c90506000305af1612c1657600080fd5b611e00516119005117612c2857600080fd5b6060516018546004540180604051901358578091901215612c4857600080fd5b611e2052611e2051600261148051600060c052602060c0200160c052602060c020015413612c7557600080fd5b611e2051600261148051600060c052602060c0200160c052602060c02001556020611ea06004634a8fd698611e4052611e5c6000305af1612cb557600080fd5b611ea051600561148051600060c052602060c0200160c052602060c0200155611e2051600560c052602060c0200160a051600161148051600060c052602060c0200160c052602060c020015482540380608051901358578091901215612d1a57600080fd5b815550600261148051600060c052602060c0200160c052602060c0200154611f00526020611ec052600261148051600060c052602060c0200160c052602060c0200154611f005261148051600661148051600060c052602060c0200160c052602060c02001547fb0da0cd4d3f901fa403fa301bd3cad4934e079e9f1a5b61bdb33a03da2c9aaaf611ec051611f00a3005b63edea1480600051141561342c5760206004610140373415612dcc57600080fd5b60605160043580604051901358578091901215612de857600080fd5b50600261014051600060c052602060c0200160c052602060c020015460045413612e1157600080fd5b6060516001600261014051600060c052602060c0200160c052602060c02001540180604051901358578091901215612e4857600080fd5b600860c052602060c020015461016052606051601754610160510180604051901358578091901215612e7957600080fd5b6101805261018051600f541215612e8f57600080fd5b600361014051600060c052602060c0200160c052602060c0200154151561300e57600060a05161016051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c02001548181028119838383051417612ef457600080fd5b6402540be400810590509050905080608051901358578091901215612f1857600080fd5b1215612f97576402540be4006402540be3ff60a05161016051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c02001548181028119838383051417612f6c57600080fd5b6402540be400810590509050905080608051901358578091901215612f9057600080fd5b0305613005565b6402540be40060a05161016051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c02001548181028119838383051417612fdf57600080fd5b6402540be40081059050905090508060805190135857809190121561300357600080fd5b055b6101a052613371565b6060516060516060516017546002028060405190135857809190121561303357600080fd5b61018051038060405190135857809190121561304e57600080fd5b601460c052602060c020015461018051601460c052602060c0200154038060405190135857809190121561308157600080fd5b6101c05260a051600561014051600060c052602060c0200160c052602060c0200154806130ad57600080fd5b6402540be4006060516022546101c05102806040519013585780919012156130d457600080fd5b0205806080519013585780919012156130ec57600080fd5b6101e05260a0516101e0516402540be400038060805190135857809190121561311457600080fd5b60006402540be4008102821215613132576402540be4008102613134565b815b9050905061020052600060a05161018051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761318057600080fd5b6402540be4008105905090509050806080519013585780919012156131a457600080fd5b1215613223576402540be4006402540be3ff60a05161018051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c020015481810281198383830514176131f857600080fd5b6402540be40081059050905090508060805190135857809190121561321c57600080fd5b0305613291565b6402540be40060a05161018051600c60c052602060c0200154600161014051600060c052602060c0200160c052602060c0200154818102811983838305141761326b57600080fd5b6402540be40081059050905090508060805190135857809190121561328f57600080fd5b055b61022052600060a051610200516102205181810281198383830514176132b657600080fd5b80905090509050806080519013585780919012156132d357600080fd5b1215613328576402540be4006402540be3ff60a0516102005161022051818102811983838305141761330457600080fd5b809050905090508060805190135857809190121561332157600080fd5b030561336c565b6402540be40060a0516102005161022051818102811983838305141761334d57600080fd5b809050905090508060805190135857809190121561336a57600080fd5b055b6101a0525b60006000600060006101a051600661014051600060c052602060c0200160c052602060c02001546000f16133a457600080fd5b6101a051610280526020610240526101a0516102805261014051600661014051600060c052602060c0200160c052602060c02001547f499b9fc824d01426cfde5b95eebcfc53494a24d6316bb139b2333377f7c00e4761024051610280a36000600060246301b7af186102a052610140516102c0526102bc6000305af161342a57600080fd5b005b63e9dc06146000511415614074576020600461014037341561344d57600080fd5b6104206004356004016101603761040060043560040135111561346f57600080fd5b6101608051602001806105c0828460006004600a8704601201f161349257600080fd5b50506020610a206105c0516105e06000601954602054f16134b257600080fd5b6020610a0052610a006020600060208351038113156134d057600080fd5b0460200260200181015190506105a0526110c0610160610620610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610a60511461351f57600080fd5b610a6051610a600180602001516000825180602090135857809190121561354557600080fd5b601f6101000a820481151761355957600080fd5b606051816020036101000a83048060405190135857809190121561357c57600080fd5b90509050905081526020610a8051610a6001511461359957600080fd5b610a8051610a8001518160200152610aa051610a60018060200151600082518060209013585780919012156135cd57600080fd5b601f6101000a82048115176135e157600080fd5b606051816020036101000a83048060405190135857809190121561360457600080fd5b9050905090508160400152610ac051610a600180602001516000825180602090135857809190121561363557600080fd5b601f6101000a820481151761364957600080fd5b606051816020036101000a83048060405190135857809190121561366c57600080fd5b9050905090508160600152610ae051610a600180516020018083608001828460006004600a8704601201f16136a057600080fd5b5050506110c051611580526110e0516115a052611100516115c052611120516115e052611140805160200180611600828460006004600a8704601201f16136e657600080fd5b50506020611f20610484606063a2767400611a40526105a051611a605280611a80526116008080516020018084611a6001828460006004600a8704601201f161372e57600080fd5b50508051820160200191505061158051611aa052611a5c90506000305af161375557600080fd5b611f205161376257600080fd5b600160605161010061158051078060405190135857809190121561378557600080fd5b60008113151561379d578060000360020a82046137a4565b8060020a82025b90509050600060a0516101006402540be400611580510205806080519013585780919012156137d257600080fd5b1215613813576402540be4006402540be3ff60a0516101006402540be4006115805102058060805190135857809190121561380c57600080fd5b0305613843565b6402540be40060a0516101006402540be4006115805102058060805190135857809190121561384157600080fd5b055b60066115c051600a60c052602060c0200160c052602060c0200160c052602060c0200154161561387257600080fd5b6020611fa0600463855f372c611f4052611f5c6000305af161389357600080fd5b611fa0516115a051146138a557600080fd5b600f546115c051146138b657600080fd5b60036115e051600a60c052602060c0200160c052602060c02001546138da57600080fd5b600461158051600060c052602060c0200160c052602060c0200154611fc052600261158051600060c052602060c0200160c052602060c0200154611fe05260045461200052606051600161200051038060405190135857809190121561393f57600080fd5b61202052611fe051612000511261200051611fc05113151661204052611fe051612020511261202051611fc0511315166120605261206051612040511761398557600080fd5b60016060516101006115805107806040519013585780919012156139a857600080fd5b6000811315156139c0578060000360020a82046139c7565b8060020a82025b90509050600060a0516101006402540be400611580510205806080519013585780919012156139f557600080fd5b1215613a36576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901358578091901215613a2f57600080fd5b0305613a66565b6402540be40060a0516101006402540be40061158051020580608051901358578091901215613a6457600080fd5b055b60066115c051600a60c052602060c0200160c052602060c0200160c052602060c020015417600060a0516101006402540be40061158051020580608051901358578091901215613ab557600080fd5b1215613af6576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901358578091901215613aef57600080fd5b0305613b26565b6402540be40060a0516101006402540be40061158051020580608051901358578091901215613b2457600080fd5b055b60066115c051600a60c052602060c0200160c052602060c0200160c052602060c02001556115e05160016115c051600a60c052602060c0200160c052602060c0200160c052602060c0200154612080526115e05160056115c051600a60c052602060c0200160c052602060c0200160c052602060c02001546120a0526120405115613c155761208060a051600161158051600060c052602060c0200160c052602060c020015482510180608051901358578091901215613be557600080fd5b815250612080516115e05160016115c051600a60c052602060c0200160c052602060c0200160c052602060c02001555b6120605115613c88576120a060a051600161158051600060c052602060c0200160c052602060c020015482510180608051901358578091901215613c5857600080fd5b8152506120a0516115e05160056115c051600a60c052602060c0200160c052602060c0200160c052602060c02001555b6115e0516013541415613df857600060a051601254600161158051600060c052602060c0200160c052602060c02001548181028119838383051417613ccc57600080fd5b6402540be400810590509050905080608051901358578091901215613cf057600080fd5b1215613d62576402540be4006402540be3ff60a051601254600161158051600060c052602060c0200160c052602060c02001548181028119838383051417613d3757600080fd5b6402540be400810590509050905080608051901358578091901215613d5b57600080fd5b0305613dc3565b6402540be40060a051601254600161158051600060c052602060c0200160c052602060c02001548181028119838383051417613d9d57600080fd5b6402540be400810590509050905080608051901358578091901215613dc157600080fd5b055b6120c05260006000604463579f38b26120e05261158051612100526120c051612120526120fc6000305af1613df757600080fd5b5b60036115c051600a60c052602060c0200160c052602060c02001541560a051600360a05160026007548181028119838383051417613e3557600080fd5b8090509050905080608051901358578091901215613e5257600080fd5b0580608051901358578091901215613e6957600080fd5b6120a051121560a051600360a05160026006548181028119838383051417613e9057600080fd5b8090509050905080608051901358578091901215613ead57600080fd5b0580608051901358578091901215613ec457600080fd5b61208051121516161561400057600160036115c051600a60c052602060c0200160c052602060c02001556115c0516011556001600b5560016121c05260006121e05260406121805260016121c05260006121e0526115c051600160c052602060c02001546115c0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b9612180516121c0a360605160016115e0510180604051901358578091901215613f7557600080fd5b6115c0511415613fff57600160026115e051600a60c052602060c0200160c052602060c02001556115e0516010556001612240526001612260526040612200526001612240526001612260526115e051600160c052602060c02001546115e0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b961220051612240a35b5b6115c0516122c0526115e0516122e0526040612280526115c0516122c0526115e0516122e0526115a05161158051600661158051600060c052602060c0200160c052602060c02001547f0fa814a7606272ed601db3d9974a12a26536f050d147ad209b7e7b0a95746f17612280516122c0a4005b63cc20f16b6000511415614668576040600461014037341561409557600080fd5b610420600435600401610180376104006004356004013511156140b757600080fd5b6104206024356004016105c0376104006024356004013511156140d957600080fd5b60206112e061088460406313d21fa3610a005280610a20526101808080516020018084610a2001828460006004600a8704601201f161411757600080fd5b50508051820160200191505080610a40526105c08080516020018084610a2001828460006004600a8704601201f161414e57600080fd5b505080518201602001915050610a1c90506000305af161416d57600080fd5b6112e05161417a57600080fd5b6119606101806106206113008251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c061130051146141b957600080fd5b61130051611300018060200151600082518060209013585780919012156141df57600080fd5b601f6101000a82048115176141f357600080fd5b606051816020036101000a83048060405190135857809190121561421657600080fd5b905090509050815260206113205161130001511461423357600080fd5b6113205161132001518160200152611340516113000180602001516000825180602090135857809190121561426757600080fd5b601f6101000a820481151761427b57600080fd5b606051816020036101000a83048060405190135857809190121561429e57600080fd5b905090509050816040015261136051611300018060200151600082518060209013585780919012156142cf57600080fd5b601f6101000a82048115176142e357600080fd5b606051816020036101000a83048060405190135857809190121561430657600080fd5b9050905090508160600152611380516113000180516020018083608001828460006004600a8704601201f161433a57600080fd5b50505061196051611e20526020611ee060246399fb5eec611e6052611e2051611e8052611e7c6000305af161436e57600080fd5b611ee051611e4052600060a05160196402540be400611e405102058060805190135857809190121561439f57600080fd5b12156143df576402540be4006402540be3ff60a05160196402540be400611e40510205806080519013585780919012156143d857600080fd5b030561440e565b6402540be40060a05160196402540be400611e405102058060805190135857809190121561440c57600080fd5b055b611f0052606051611f0051611e4051038060405190135857809190121561443457600080fd5b611f2052600f54601460c052602060c02001606051611e40518254018060405190135857809190121561446657600080fd5b81555060016003611e2051600060c052602060c0200160c052602060c0200155611f0051611f8052611f2051611fa0526040611f4052611f0051611f8052611f2051611fa052611e20516006611e2051600060c052602060c0200160c052602060c0200154337fb63bb46c05149b79f409b978407acff3bb3bfb5fb728ed2909fdb52677c220da611f4051611f80a46002611e2051600060c052602060c0200160c052602060c0200154611fc052611fc051600454121561464d576001611e2051600060c052602060c0200160c052602060c0200154611fe0526060516001600454018060405190135857809190121561455f57600080fd5b600560c052602060c0200160a051611fe0518254038060805190135857809190121561458a57600080fd5b815550606051600160045401806040519013585780919012156145ac57600080fd5b6002611e2051600060c052602060c0200160c052602060c0200155601f54611fc051121561460b57611fc051600560c052602060c0200160a051611fe0518254018060805190135857809190121561460357600080fd5b81555061464c565b60206120606004634a8fd6986120005261201c6000305af161462c57600080fd5b612060516005611e2051600060c052602060c0200160c052602060c02001555b5b6000600060006000611f0051336000f161466657600080fd5b005b63bcc44d9960005114156146cb576020600461014037341561468957600080fd5b606051600435806040519013585780919012156146a557600080fd5b50600161014051600060c052602060c0200160c052602060c020015460005260206000f3005b63faf944fa600051141561472e57602060046101403734156146ec57600080fd5b6060516004358060405190135857809190121561470857600080fd5b50600461014051600060c052602060c0200160c052602060c020015460005260206000f3005b63c253bf416000511415614791576020600461014037341561474f57600080fd5b6060516004358060405190135857809190121561476b57600080fd5b50600261014051600060c052602060c0200160c052602060c020015460005260206000f3005b633b4f3ae360005114156147f457602060046101403734156147b257600080fd5b606051600435806040519013585780919012156147ce57600080fd5b50600361014051600060c052602060c0200160c052602060c020015460005260206000f3005b6306fcf2ff6000511415614857576020600461014037341561481557600080fd5b6060516004358060405190135857809190121561483157600080fd5b50600561014051600060c052602060c0200160c052602060c020015460005260206000f3005b63bb0115f060005114156148b7576020600461014037341561487857600080fd5b6060516004358060405190135857809190121561489457600080fd5b5061014051600060c052602060c0200160c052602060c0205460005260206000f3005b635dbfd1ce600051141561491a57602060046101403734156148d857600080fd5b606051600435806040519013585780919012156148f457600080fd5b50600661014051600060c052602060c0200160c052602060c020015460005260206000f3005b638208b8756000511415614972576020600461014037341561493b57600080fd5b6060516004358060405190135857809190121561495757600080fd5b5061014051600160c052602060c020015460005260206000f3005b637d69c5d9600051141561499857341561498b57600080fd5b60025460005260206000f3005b63dc2059b360005114156149e557602060046101403734156149b957600080fd5b60043560205181106149ca57600080fd5b5061014051600360c052602060c020015460005260206000f3005b637060054d6000511415614a0b5734156149fe57600080fd5b60045460005260206000f3005b63c44dc6596000511415614a635760206004610140373415614a2c57600080fd5b60605160043580604051901358578091901215614a4857600080fd5b5061014051600560c052602060c020015460005260206000f3005b63a2630bae6000511415614abb5760206004610140373415614a8457600080fd5b60605160043580604051901358578091901215614aa057600080fd5b5061014051600860c052602060c020015460005260206000f3005b6365ca80e66000511415614b135760206004610140373415614adc57600080fd5b60605160043580604051901358578091901215614af857600080fd5b5061014051600960c052602060c020015460005260206000f3005b634af8e81a6000511415614b735760206004610140373415614b3457600080fd5b60605160043580604051901358578091901215614b5057600080fd5b5061014051600a60c052602060c0200160c052602060c0205460005260206000f3005b6326becf586000511415614bd65760206004610140373415614b9457600080fd5b60605160043580604051901358578091901215614bb057600080fd5b50600461014051600a60c052602060c0200160c052602060c020015460005260206000f3005b63be26608e6000511415614c635760406004610140373415614bf757600080fd5b60605160043580604051901358578091901215614c1357600080fd5b5060605160243580604051901358578091901215614c3057600080fd5b5061016051600161014051600a60c052602060c0200160c052602060c0200160c052602060c020015460005260206000f3005b633673fd986000511415614cf05760406004610140373415614c8457600080fd5b60605160043580604051901358578091901215614ca057600080fd5b5060605160243580604051901358578091901215614cbd57600080fd5b5061016051600561014051600a60c052602060c0200160c052602060c0200160c052602060c020015460005260206000f3005b63e270eb666000511415614d7d5760406004610140373415614d1157600080fd5b60605160043580604051901358578091901215614d2d57600080fd5b5060605160243580604051901358578091901215614d4a57600080fd5b5061016051600661014051600a60c052602060c0200160c052602060c0200160c052602060c020015460005260206000f3005b6330d3c41a6000511415614de05760206004610140373415614d9e57600080fd5b60605160043580604051901358578091901215614dba57600080fd5b50600361014051600a60c052602060c0200160c052602060c020015460005260206000f3005b63cfff38c06000511415614e435760206004610140373415614e0157600080fd5b60605160043580604051901358578091901215614e1d57600080fd5b50600261014051600a60c052602060c0200160c052602060c020015460005260206000f3005b6399787ac66000511415614e69573415614e5c57600080fd5b600b5460005260206000f3005b63e430757f6000511415614ec15760206004610140373415614e8a57600080fd5b60605160043580604051901358578091901215614ea657600080fd5b5061014051600c60c052602060c020015460005260206000f3005b638a4844076000511415614ee7573415614eda57600080fd5b600d5460005260206000f3005b63e6b573666000511415614f0d573415614f0057600080fd5b600e5460005260206000f3005b639372b4e46000511415614f33573415614f2657600080fd5b600f5460005260206000f3005b632eff87596000511415614f59573415614f4c57600080fd5b60105460005260206000f3005b635f6116506000511415614f7f573415614f7257600080fd5b60115460005260206000f3005b6307dcf45b6000511415614fa5573415614f9857600080fd5b60125460005260206000f3005b635b03544a6000511415614fcb573415614fbe57600080fd5b60135460005260206000f3005b634c77567560005114156150235760206004610140373415614fec57600080fd5b6060516004358060405190135857809190121561500857600080fd5b5061014051601460c052602060c020015460005260206000f3005b63ac4746ab600051141561504957341561503c57600080fd5b60165460005260206000f3005b630ebb172a600051141561506f57341561506257600080fd5b60175460005260206000f3005b634f4ddb5e600051141561509557341561508857600080fd5b60185460005260206000f3005b633f8a500e60005114156150bb5734156150ae57600080fd5b601b5460005260206000f3005b6361073e8860005114156150e15734156150d457600080fd5b601c5460005260206000f3005b6326c0817e60005114156151075734156150fa57600080fd5b601d5460005260206000f3005b63d4b31281600051141561512d57341561512057600080fd5b601e5460005260206000f3005b" +"600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526358c4540b60005114156103fa5761012060046101403734156100b557600080fd5b606051600435806040519013156100cb57600080fd5b80919012156100d957600080fd5b50606051602435806040519013156100f057600080fd5b80919012156100fe57600080fd5b506060516044358060405190131561011557600080fd5b809190121561012357600080fd5b506060516064358060405190131561013a57600080fd5b809190121561014857600080fd5b50608435602051811061015a57600080fd5b5060a435602051811061016c57600080fd5b50606051610104358060405190131561018457600080fd5b809190121561019257600080fd5b50601554156101a057600080fd5b610100610140511260006101405113166101b957600080fd5b60006101605112156101ca57600080fd5b60006101805112156101db57600080fd5b60026101a05112156101ec57600080fd5b60006102005112156101fd57600080fd5b600061022051121561020e57600080fd5b6000610240511361021e57600080fd5b60016015556101405160165561016051601755610180516018556101a05160195561020051601c5561022051601d5561024051601e55600060a0516016548061026657600080fd5b6402540be4006060516101605143018060405190131561028557600080fd5b809190121561029357600080fd5b0205806080519013156102a557600080fd5b80919012156102b357600080fd5b1215610329576402540be4006402540be3ff60a051601654806102d557600080fd5b6402540be400606051610160514301806040519013156102f457600080fd5b809190121561030257600080fd5b02058060805190131561031457600080fd5b809190121561032257600080fd5b030561038e565b6402540be40060a0516016548061033f57600080fd5b6402540be4006060516101605143018060405190131561035e57600080fd5b809190121561036c57600080fd5b02058060805190131561037e57600080fd5b809190121561038c57600080fd5b055b601f556101c051601a556101e051601b5560016002556000600455601f54600f5568056bc75e2d63100000600c60c052600f5460e052604060c02055600060065560006007556c0c9f2c9cd04674edea4000000060205562030d4060215562030d406022556003602355005b639a8eec77600051141561045157341561041357600080fd5b30331461041f57600080fd5b606051601054600f54038060405190131561043957600080fd5b809190121561044757600080fd5b60005260206000f3005b63db23eee060005114156107f757341561046a57600080fd5b30331461047657600080fd5b600f54610140526060516001600060a051670de0b6b3a764000060a051600c60c05260605160016101405103806040519013156104b257600080fd5b80919012156104c057600080fd5b60e052604060c02054600754600654808212156104dd57806104df565b815b9050905081810281158383830514176104f757600080fd5b6402540be40081059050905090508060805190131561051557600080fd5b809190121561052357600080fd5b058060805190131561053457600080fd5b809190121561054257600080fd5b1215610619576402540be4006402540be3ff60a051670de0b6b3a764000060a051600c60c052606051600161014051038060405190131561058257600080fd5b809190121561059057600080fd5b60e052604060c02054600754600654808212156105ad57806105af565b815b9050905081810281158383830514176105c757600080fd5b6402540be4008105905090509050806080519013156105e557600080fd5b80919012156105f357600080fd5b058060805190131561060457600080fd5b809190121561061257600080fd5b03056106df565b6402540be40060a051670de0b6b3a764000060a051600c60c052606051600161014051038060405190131561064d57600080fd5b809190121561065b57600080fd5b60e052604060c0205460075460065480821215610678578061067a565b815b90509050818102811583838305141761069257600080fd5b6402540be4008105905090509050806080519013156106b057600080fd5b80919012156106be57600080fd5b05806080519013156106cf57600080fd5b80919012156106dd57600080fd5b055b01806040519013156106f057600080fd5b80919012156106fe57600080fd5b6101605260a0516404a817c80068056bc75e2d631000006101605102058060805190131561072b57600080fd5b809190121561073957600080fd5b610180526101a060006014818352015b60a051600260a05160a051610180518061076257600080fd5b68056bc75e2d631000006101605102058060805190131561078257600080fd5b809190121561079057600080fd5b6101805101806080519013156107a557600080fd5b80919012156107b357600080fd5b05806080519013156107c457600080fd5b80919012156107d257600080fd5b610180525b8151600101808352811415610749575b50506101805160005260206000f3005b63de7f9975600051141561083357341561081057600080fd5b30331461081c57600080fd5b6000600754136000600654131660005260206000f3005b63d286bb82600051141561097657341561084c57600080fd5b30331461085857600080fd5b600f54610140526002600a60c052606051600261014051038060405190131561088057600080fd5b809190121561088e57600080fd5b60e052604060c02060c052602060c0200154156109265760046060516001825401806040519013156108bf57600080fd5b80919012156108cd57600080fd5b815550600654600755600660a051600560c05260045460e052604060c02054825401806080519013156108ff57600080fd5b809190121561090d57600080fd5b81555061014051600860c05260045460e052604060c020555b600454600960c0526101405160e052604060c02055600b541561096f57606051600161014051038060405190131561095d57600080fd5b809190121561096b57600080fd5b6013555b6000600b55005b636526ed726000511415610b1657341561098f57600080fd5b30331461099b57600080fd5b600f54610140526001600b5560016003600a60c05260605160016101405103806040519013156109ca57600080fd5b80919012156109d857600080fd5b60e052604060c02060c052602060c020015560016002600a60c0526060516001610140510380604051901315610a0d57600080fd5b8091901215610a1b57600080fd5b60e052604060c02060c052602060c02001556060516001610140510380604051901315610a4757600080fd5b8091901215610a5557600080fd5b6011556060516001610140510380604051901315610a7257600080fd5b8091901215610a8057600080fd5b601055600161016052600161018052600160c0526060516001610140510380604051901315610aae57600080fd5b8091901215610abc57600080fd5b60e052604060c020546060516001610140510380604051901315610adf57600080fd5b8091901215610aed57600080fd5b7f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96040610160a3005b63acc619c36000511415610d61573415610b2f57600080fd5b303314610b3b57600080fd5b600f5461014052600260206101e06004639a8eec776101805261019c6000305af1610b6557600080fd5b6101e05113156101605261016051156020610260600463de7f99756102005261021c6000305af1610b9557600080fd5b61026051151715610bab57600060005260206000f35b60a0516001600a60c0526060516001610140510380604051901315610bcf57600080fd5b8091901215610bdd57600080fd5b60e052604060c02060c052602060c0200160c05260135460e052604060c0205460065480610c0a57600080fd5b806402540be4008302059050905080608051901315610c2857600080fd5b8091901215610c3657600080fd5b6102805260a0516005600a60c0526060516001610140510380604051901315610c5e57600080fd5b8091901215610c6c57600080fd5b60e052604060c02060c052602060c0200160c05260135460e052604060c0205460075480610c9957600080fd5b806402540be4008302059050905080608051901315610cb757600080fd5b8091901215610cc557600080fd5b6102a052610280516102a05180821315610cdf5780610ce1565b815b905090506102c05260a051600260a0516012546102c0518181028115838383051417610d0c57600080fd5b6402540be400810590509050905080608051901315610d2a57600080fd5b8091901215610d3857600080fd5b0580608051901315610d4957600080fd5b8091901215610d5757600080fd5b60005260206000f3005b63579f38b260005114156111215760406004610140373415610d8257600080fd5b303314610d8e57600080fd5b60605160043580604051901315610da457600080fd5b8091901215610db257600080fd5b5060605160243580604051901315610dc957600080fd5b8091901215610dd757600080fd5b506001600060c0526101405160e052604060c02060c052602060c0200160a0516402540be400610160510282540180608051901315610e1557600080fd5b8091901215610e2357600080fd5b8155506004600060c0526101405160e052604060c02060c052602060c0200154610180526002600060c0526101405160e052604060c02060c052602060c02001546101a0526004546101c05260605160016101c0510380604051901315610e8957600080fd5b8091901215610e9757600080fd5b6101e0526101a0516101c051126101c0516101805113151615610ee957600660a0516402540be400610160510282540180608051901315610ed757600080fd5b8091901215610ee557600080fd5b8155505b6101a0516101e051126101e0516101805113151615610f3757600760a0516402540be400610160510282540180608051901315610f2557600080fd5b8091901215610f3357600080fd5b8155505b6020546101a0511215610f8857600560c0526101a05160e052604060c02060a0516402540be400610160510282540380608051901315610f7657600080fd5b8091901215610f8457600080fd5b8155505b6000600060006000600060a051600860a051600c60c052600f5460e052604060c02054610160518181028115838383051417610fc357600080fd5b8090509050905080608051901315610fda57600080fd5b8091901215610fe857600080fd5b0580608051901315610ff957600080fd5b809190121561100757600080fd5b1215611095576402540be4006402540be3ff60a051600860a051600c60c052600f5460e052604060c0205461016051818102811583838305141761104a57600080fd5b809050905090508060805190131561106157600080fd5b809190121561106f57600080fd5b058060805190131561108057600080fd5b809190121561108e57600080fd5b0305611112565b6402540be40060a051600860a051600c60c052600f5460e052604060c020546101605181810281158383830514176110cc57600080fd5b80905090509050806080519013156110e357600080fd5b80919012156110f157600080fd5b058060805190131561110257600080fd5b809190121561111057600080fd5b055b416000f161111f57600080fd5b005b6301b7af1860005114156111ea576020600461014037341561114257600080fd5b30331461114e57600080fd5b6060516004358060405190131561116457600080fd5b809190121561117257600080fd5b506000600360c0526006600060c0526101405160e052604060c02060c052602060c020015460e052604060c02055600060c0526101405160e052604060c02060c052602060c0206000815560006001820155600060028201556000600382015560006004820155600060058201556000600682015550005b63a2767400600051141561132f576060600461014037341561120b57600080fd5b30331461121757600080fd5b6104206024356004016101a03761040060243560040135111561123957600080fd5b6060516044358060405190131561124f57600080fd5b809190121561125d57600080fd5b5060016000610140516020826105e00101526020810190506101a0610400806020846105e001018260208501600060046078f1505080518201915050806105e0526105e09050805160200180610a40828460006004600a8704601201f16112c357600080fd5b50506020610ec0610a4051610a606000600060c0526101805160e052604060c02060c052602060c02054602254f16112fa57600080fd5b6020610ea052610ea060206000602083510381131561131857600080fd5b0460200260200181015190501460005260206000f3005b6337df0ba8600051141561143257341561134857600080fd5b60a0516001600a60c052600f5460e052604060c02060c052602060c0200160c05260135460e052604060c020546006548061138257600080fd5b806402540be40083020590509050806080519013156113a057600080fd5b80919012156113ae57600080fd5b60a0516005600a60c052600f5460e052604060c02060c052602060c0200160c05260135460e052604060c02054600754806113e857600080fd5b806402540be400830205905090508060805190131561140657600080fd5b809190121561141457600080fd5b808213156114225780611424565b815b9050905060005260206000f3005b6399fb5eec60005114156115f8576020600461014037341561145357600080fd5b6060516004358060405190131561146957600080fd5b809190121561147757600080fd5b50600060a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176114bf57600080fd5b6402540be4008105905090509050806080519013156114dd57600080fd5b80919012156114eb57600080fd5b1215611575576402540be4006402540be3ff60a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761154257600080fd5b6402540be40081059050905090508060805190131561156057600080fd5b809190121561156e57600080fd5b03056115ee565b6402540be40060a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176115c057600080fd5b6402540be4008105905090509050806080519013156115de57600080fd5b80919012156115ec57600080fd5b055b60005260206000f3005b634a8fd698600051141561174357341561161157600080fd5b600060a051600c60c052600f5460e052604060c02054600654818102811583838305141761163e57600080fd5b6402540be40081059050905090508060805190131561165c57600080fd5b809190121561166a57600080fd5b12156116da576402540be4006402540be3ff60a051600c60c052600f5460e052604060c0205460065481810281158383830514176116a757600080fd5b6402540be4008105905090509050806080519013156116c557600080fd5b80919012156116d357600080fd5b0305611739565b6402540be40060a051600c60c052600f5460e052604060c02054600654818102811583838305141761170b57600080fd5b6402540be40081059050905090508060805190131561172957600080fd5b809190121561173757600080fd5b055b60005260206000f3005b637db2eedc600051141561188e57341561175c57600080fd5b600060a051600c60c052600f5460e052604060c02054600754818102811583838305141761178957600080fd5b6402540be4008105905090509050806080519013156117a757600080fd5b80919012156117b557600080fd5b1215611825576402540be4006402540be3ff60a051600c60c052600f5460e052604060c0205460075481810281158383830514176117f257600080fd5b6402540be40081059050905090508060805190131561181057600080fd5b809190121561181e57600080fd5b0305611884565b6402540be40060a051600c60c052600f5460e052604060c02054600754818102811583838305141761185657600080fd5b6402540be40081059050905090508060805190131561187457600080fd5b809190121561188257600080fd5b055b60005260206000f3005b6313d21fa36000511415611f6c57604060046101403734156118af57600080fd5b610420600435600401610180376104006004356004013511156118d157600080fd5b6104206024356004016105c0376104006024356004013511156118f357600080fd5b610180805160200180610a20828460006004600a8704601201f161191657600080fd5b50506020610e80610a2051610a406000601a54602154f161193657600080fd5b6020610e6052610e6060206000602083510381131561195457600080fd5b046020026020018101519050610a0052611520610180610620610ec08251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610ec051146119a357600080fd5b610ec051610ec0018060200151600082518060209013156119c357600080fd5b80919012156119d157600080fd5b606051816020036101000a8304806040519013156119ee57600080fd5b80919012156119fc57600080fd5b90509050905081526020610ee051610ec0015114611a1957600080fd5b610ee051610ee001518160200152610f0051610ec001806020015160008251806020901315611a4757600080fd5b8091901215611a5557600080fd5b606051816020036101000a830480604051901315611a7257600080fd5b8091901215611a8057600080fd5b9050905090508160400152610f2051610ec001806020015160008251806020901315611aab57600080fd5b8091901215611ab957600080fd5b606051816020036101000a830480604051901315611ad657600080fd5b8091901215611ae457600080fd5b9050905090508160600152610f4051610ec00180516020018083608001828460006004600a8704601201f1611b1857600080fd5b505050611520516119e05261156051611a005261158051611a20526115a0805160200180611a40828460006004600a8704601201f1611b5657600080fd5b50506105c0805160200180611ea0828460006004600a8704601201f1611b7b57600080fd5b50506020612300611ea051611ec06000601a54602154f1611b9b57600080fd5b60206122e0526122e0602060006020835103811315611bb957600080fd5b046020026020018101519050611e80526129a06105c06106206123408251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c06123405114611c0857600080fd5b6123405161234001806020015160008251806020901315611c2857600080fd5b8091901215611c3657600080fd5b606051816020036101000a830480604051901315611c5357600080fd5b8091901215611c6157600080fd5b9050905090508152602061236051612340015114611c7e57600080fd5b61236051612360015181602001526123805161234001806020015160008251806020901315611cac57600080fd5b8091901215611cba57600080fd5b606051816020036101000a830480604051901315611cd757600080fd5b8091901215611ce557600080fd5b90509050905081604001526123a05161234001806020015160008251806020901315611d1057600080fd5b8091901215611d1e57600080fd5b606051816020036101000a830480604051901315611d3b57600080fd5b8091901215611d4957600080fd5b90509050905081606001526123c0516123400180516020018083608001828460006004600a8704601201f1611d7d57600080fd5b5050506129a051612e60526129e051612e8052612a0051612ea052612a20805160200180612ec0828460006004600a8704601201f1611dbb57600080fd5b505060206137e0610484606063a276740061330052610a0051613320528061334052611a40808051602001808461332001828460006004600a8704601201f1611e0357600080fd5b5050805182016020019150506119e0516133605261331c90506000305af1611e2a57600080fd5b6137e0511515611e3f57600060005260206000f35b6020613ce0610484606063a276740061380052611e8051613820528061384052612ec0808051602001808461382001828460006004600a8704601201f1611e8557600080fd5b505080518201602001915050612e60516138605261381c90506000305af1611eac57600080fd5b613ce0511515611ec157600060005260206000f35b612e60516119e051141515611edb57600060005260206000f35b611e8051610a00511415611ef457600060005260206000f35b6003600060c0526119e05160e052604060c02060c052602060c020015415611f2157600060005260206000f35b612e8051611a005114613d0052611a2051612ea05112611a0051612e80511316612ea051611a205112612e8051611a0051131617613d2052613d2051613d00511760005260206000f3005b6310f246356000511415611f92573415611f8557600080fd5b60135460005260206000f3005b63855f372c600051141561201f573415611fab57600080fd5b6060516001606051601654600f540280604051901315611fca57600080fd5b8091901215611fd857600080fd5b0380604051901315611fe957600080fd5b8091901215611ff757600080fd5b610100430381121561200857600080fd5b43811061201457600080fd5b4060005260206000f3005b635c0a75de6000511415612167576020600461014037341561204057600080fd5b6060516004358060405190131561205657600080fd5b809190121561206457600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f54038060405190131561209857600080fd5b80919012156120a657600080fd5b610160526003600a60c0526101605160e052604060c02060c052602060c02001546101a05261014051600a60c0526101605160e052604060c02060c052602060c0205412156101c052610140516004600a60c0526101605160e052604060c02060c052602060c020015412156101e0526101e0516101c051166101a0511615612136576101605160005260206000f35b601f5461016051141561214857612159565b5b815160010180835281141561207d575b5050600060005260206000f3005b631f994c4060005114156122ce576020600461014037341561218857600080fd5b6060516004358060405190131561219e57600080fd5b80919012156121ac57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f5403806040519013156121e057600080fd5b80919012156121ee57600080fd5b610160526002600a60c0526101605160e052604060c02060c052602060c02001546101a05261014051600a60c0526101605160e052604060c02060c052602060c0205412156101c052610140516004600a60c0526101605160e052604060c02060c052602060c020015412156101e0526101e0516101c051166101a051161561227e576101605160005260206000f35b601f54610160511415612290576122a1565b5b81516001018083528114156121c5575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000f3005b635dcffc17600051141561285457602060046101403734156122ef57600080fd5b6060516004358060405190131561230557600080fd5b809190121561231357600080fd5b50600060a0516016548061232657600080fd5b6402540be4004302058060805190131561233f57600080fd5b809190121561234d57600080fd5b121561239d576402540be4006402540be3ff60a0516016548061236f57600080fd5b6402540be4004302058060805190131561238857600080fd5b809190121561239657600080fd5b03056123dc565b6402540be40060a051601654806123b357600080fd5b6402540be400430205806080519013156123cc57600080fd5b80919012156123da57600080fd5b055b610160526060516001600f5401806040519013156123f957600080fd5b809190121561240757600080fd5b6101405114610160516101405113151661242057600080fd5b60206101e06004634a8fd6986101805261019c6000305af161244157600080fd5b6101e051600a60c0526101405160e052604060c02060c052602060c0205560206102606004637db2eedc6102005261021c6000305af161248057600080fd5b610260516004600a60c0526101405160e052604060c02060c052602060c020015561014051600f5560a05160206102e0600463acc619c36102805261029c6000305af16124cc57600080fd5b6102e0516402540be40001806080519013156124e757600080fd5b80919012156124f557600080fd5b600e5560a051600e5460a0516012546402540be400018060805190131561251b57600080fd5b809190121561252957600080fd5b8061253357600080fd5b806402540be400830205905090508060805190131561255157600080fd5b809190121561255f57600080fd5b600d5560a051600d54600c60c052606051600161014051038060405190131561258757600080fd5b809190121561259557600080fd5b60e052604060c0205481810281158383830514176125b257600080fd5b6402540be4008105905090509050806080519013156125d057600080fd5b80919012156125de57600080fd5b600c60c0526101405160e052604060c02055601460c052606051600161014051038060405190131561260f57600080fd5b809190121561261d57600080fd5b60e052604060c02054601460c0526101405160e052604060c0205560206103c0600463de7f99756103605261037c6000305af161265957600080fd5b6103c0511561278c5760a051601c546020610460600463db23eee06104005261041c6000305af161268957600080fd5b610460518061269757600080fd5b806402540be40083020590509050806080519013156126b557600080fd5b80919012156126c357600080fd5b6103e05260a05160a051606051600260206104e06004639a8eec776104805261049c6000305af16126f357600080fd5b6104e051038060405190131561270857600080fd5b809190121561271657600080fd5b601d54818102811583838305141761272d57600080fd5b809050905090508060805190131561274457600080fd5b809190121561275257600080fd5b6103e051018060805190131561276757600080fd5b809190121561277557600080fd5b60125560006012541361278757600080fd5b6127b2565b600060006004636526ed726103005261031c6000305af16127ac57600080fd5b60006012555b6020610560600463855f372c6105005261051c6000305af16127d357600080fd5b61056051600160c0526101405160e052604060c0205560006000600463d286bb826105805261059c6000305af161280957600080fd5b60006105e052600061060052600160c0526101405160e052604060c02054610140517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b960406105e0a3005b63f9609f086000511415612b5d576040600461014037600435602051811061287b57600080fd5b50602435602051811061288d57600080fd5b50600060006004610180527fa1903eab000000000000000000000000000000000000000000000000000000006101a0526101806004806020846101e001018260208501600060046012f1505080518201915050610140516020826101e0010152602081019050806101e0526101e09050805160200180610260828460006004600a8704601201f161291d57600080fd5b50506020610300610260516102806000601b546207a120f161293e57600080fd5b60206102e0526102e060206000602083510381131561295c57600080fd5b046020026020018101519050141561297357600080fd5b600360c0526101605160e052604060c020541561298f57600080fd5b601e5434121561299e57600080fd5b606051600260045401806040519013156129b757600080fd5b80919012156129c557600080fd5b6103405260a051600c60c052600f5460e052604060c02054806129e757600080fd5b68056bc75e2d6310000034020580608051901315612a0457600080fd5b8091901215612a1257600080fd5b61036052600060c05260025460e052604060c02060c052602060c0206101405181556103605160018201556020546002820155600060038201556103405160048201556000600582015561016051600682015550600254600360c0526101605160e052604060c020556002606051600182540180604051901315612a9557600080fd5b8091901215612aa357600080fd5b815550600560c0526103405160e052604060c02060a0516103605182540180608051901315612ad157600080fd5b8091901215612adf57600080fd5b81555061014051610380526004600060c052600360c0526101605160e052604060c0205460e052604060c02060c052602060c02001546103a052346103c052600360c0526101605160e052604060c02054610160517fc913dcae46368ac8a73eb63d4f2077a2de58e994bf2cddf074ab3a0fcaa3a0e16060610380a3005b6342310c3260005114156130795760206004610140373415612b7e57600080fd5b61042060043560040161016037610400600435600401351115612ba057600080fd5b600060a05160165480612bb257600080fd5b6402540be40043020580608051901315612bcb57600080fd5b8091901215612bd957600080fd5b1215612c29576402540be4006402540be3ff60a05160165480612bfb57600080fd5b6402540be40043020580608051901315612c1457600080fd5b8091901215612c2257600080fd5b0305612c68565b6402540be40060a05160165480612c3f57600080fd5b6402540be40043020580608051901315612c5857600080fd5b8091901215612c6657600080fd5b055b600f5414612c7557600080fd5b6101608051602001806105c0828460006004600a8704601201f1612c9857600080fd5b50506020610a206105c0516105e06000601a54602154f1612cb857600080fd5b6020610a0052610a00602060006020835103811315612cd657600080fd5b0460200260200181015190506105a052611000610160610560610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610aa0f150506080610a605114612d2557600080fd5b610a6051610a6001806020015160008251806020901315612d4557600080fd5b8091901215612d5357600080fd5b606051816020036101000a830480604051901315612d7057600080fd5b8091901215612d7e57600080fd5b9050905090508152610a8051610a6001806020015160008251806020901315612da657600080fd5b8091901215612db457600080fd5b606051816020036101000a830480604051901315612dd157600080fd5b8091901215612ddf57600080fd5b9050905090508160200152610aa051610a600180516020018083604001828460006004600a8704601201f1612e1357600080fd5b5050506110005161148052611020516114a0526110408051602001806114c0828460006004600a8704601201f1612e4957600080fd5b50506114a051600f541215612e5d57600080fd5b6006600060c0526114805160e052604060c02060c052602060c02001543314611900526020611e00610484606063a2767400611920526105a0516119405280611960526114c0808051602001808461194001828460006004600a8704601201f1612ec657600080fd5b505080518201602001915050611480516119805261193c90506000305af1612eed57600080fd5b611e00516119005117612eff57600080fd5b6060516019546004540180604051901315612f1957600080fd5b8091901215612f2757600080fd5b611e2052611e20516002600060c0526114805160e052604060c02060c052602060c020015413612f5657600080fd5b611e20516002600060c0526114805160e052604060c02060c052602060c02001556020611ea06004634a8fd698611e4052611e5c6000305af1612f9857600080fd5b611ea0516005600060c0526114805160e052604060c02060c052602060c0200155600560c052611e205160e052604060c02060a0516001600060c0526114805160e052604060c02060c052602060c020015482540380608051901315612ffd57600080fd5b809190121561300b57600080fd5b8155506002600060c0526114805160e052604060c02060c052602060c0200154611ec052611480516006600060c0526114805160e052604060c02060c052602060c02001547fb0da0cd4d3f901fa403fa301bd3cad4934e079e9f1a5b61bdb33a03da2c9aaaf6020611ec0a3005b63edea148060005114156137a4576020600461014037341561309a57600080fd5b606051600435806040519013156130b057600080fd5b80919012156130be57600080fd5b506002600060c0526101405160e052604060c02060c052602060c0200154600454136130e957600080fd5b600860c05260605160016002600060c0526101405160e052604060c02060c052602060c0200154018060405190131561312157600080fd5b809190121561312f57600080fd5b60e052604060c020546101605260605160185461016051018060405190131561315757600080fd5b809190121561316557600080fd5b6101805261018051600f54121561317b57600080fd5b6003600060c0526101405160e052604060c02060c052602060c0200154151561332057600060a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176131e657600080fd5b6402540be40081059050905090508060805190131561320457600080fd5b809190121561321257600080fd5b121561329d576402540be4006402540be3ff60a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761326a57600080fd5b6402540be40081059050905090508060805190131561328857600080fd5b809190121561329657600080fd5b0305613317565b6402540be40060a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176132e957600080fd5b6402540be40081059050905090508060805190131561330757600080fd5b809190121561331557600080fd5b055b6101a0526136f5565b606051601460c0526060516060516018546002028060405190131561334457600080fd5b809190121561335257600080fd5b61018051038060405190131561336757600080fd5b809190121561337557600080fd5b60e052604060c02054601460c0526101805160e052604060c0205403806040519013156133a157600080fd5b80919012156133af57600080fd5b6101c05260a0516005600060c0526101405160e052604060c02060c052602060c0200154806133dd57600080fd5b6402540be4006060516023546101c05102806040519013156133fe57600080fd5b809190121561340c57600080fd5b02058060805190131561341e57600080fd5b809190121561342c57600080fd5b6101e05260a0516101e0516402540be400038060805190131561344e57600080fd5b809190121561345c57600080fd5b60006402540be400810282121561347a576402540be400810261347c565b815b9050905061020052600060a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176134cc57600080fd5b6402540be4008105905090509050806080519013156134ea57600080fd5b80919012156134f857600080fd5b1215613583576402540be4006402540be3ff60a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761355057600080fd5b6402540be40081059050905090508060805190131561356e57600080fd5b809190121561357c57600080fd5b03056135fd565b6402540be40060a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176135cf57600080fd5b6402540be4008105905090509050806080519013156135ed57600080fd5b80919012156135fb57600080fd5b055b61022052600060a0516102005161022051818102811583838305141761362257600080fd5b809050905090508060805190131561363957600080fd5b809190121561364757600080fd5b12156136a4576402540be4006402540be3ff60a0516102005161022051818102811583838305141761367857600080fd5b809050905090508060805190131561368f57600080fd5b809190121561369d57600080fd5b03056136f0565b6402540be40060a051610200516102205181810281158383830514176136c957600080fd5b80905090509050806080519013156136e057600080fd5b80919012156136ee57600080fd5b055b6101a0525b60006000600060006101a0516006600060c0526101405160e052604060c02060c052602060c02001546000f161372a57600080fd5b6101a05161024052610140516006600060c0526101405160e052604060c02060c052602060c02001547f499b9fc824d01426cfde5b95eebcfc53494a24d6316bb139b2333377f7c00e476020610240a36000600060246301b7af1861026052610140516102805261027c6000305af16137a257600080fd5b005b63e9dc0614600051141561448657602060046101403734156137c557600080fd5b610420600435600401610160376104006004356004013511156137e757600080fd5b6101608051602001806105c0828460006004600a8704601201f161380a57600080fd5b50506020610a206105c0516105e06000601a54602154f161382a57600080fd5b6020610a0052610a0060206000602083510381131561384857600080fd5b0460200260200181015190506105a0526110c0610160610620610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610a60511461389757600080fd5b610a6051610a60018060200151600082518060209013156138b757600080fd5b80919012156138c557600080fd5b606051816020036101000a8304806040519013156138e257600080fd5b80919012156138f057600080fd5b90509050905081526020610a8051610a6001511461390d57600080fd5b610a8051610a8001518160200152610aa051610a600180602001516000825180602090131561393b57600080fd5b809190121561394957600080fd5b606051816020036101000a83048060405190131561396657600080fd5b809190121561397457600080fd5b9050905090508160400152610ac051610a600180602001516000825180602090131561399f57600080fd5b80919012156139ad57600080fd5b606051816020036101000a8304806040519013156139ca57600080fd5b80919012156139d857600080fd5b9050905090508160600152610ae051610a600180516020018083608001828460006004600a8704601201f1613a0c57600080fd5b5050506110c051611580526110e0516115a052611100516115c052611120516115e052611140805160200180611600828460006004600a8704601201f1613a5257600080fd5b50506020611f20610484606063a2767400611a40526105a051611a605280611a80526116008080516020018084611a6001828460006004600a8704601201f1613a9a57600080fd5b50508051820160200191505061158051611aa052611a5c90506000305af1613ac157600080fd5b611f2051613ace57600080fd5b6001606051610100611580510780604051901315613aeb57600080fd5b8091901215613af957600080fd5b6000811215613b10578060000360020a8204613b17565b8060020a82025b905090506006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613b5e57600080fd5b8091901215613b6c57600080fd5b1215613bb5576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613ba057600080fd5b8091901215613bae57600080fd5b0305613bed565b6402540be40060a0516101006402540be40061158051020580608051901315613bdd57600080fd5b8091901215613beb57600080fd5b055b60e052604060c020541615613c0157600080fd5b6020611fa0600463855f372c611f4052611f5c6000305af1613c2257600080fd5b611fa0516115a05114613c3457600080fd5b600f546115c05114613c4557600080fd5b6003600a60c0526115e05160e052604060c02060c052602060c0200154613c6b57600080fd5b6004600060c0526115805160e052604060c02060c052602060c0200154611fc0526002600060c0526115805160e052604060c02060c052602060c0200154611fe052600454612000526060516001612000510380604051901315613cce57600080fd5b8091901215613cdc57600080fd5b61202052611fe051612000511261200051611fc05113151661204052611fe051612020511261202051611fc05113151661206052612060516120405117613d2257600080fd5b6001606051610100611580510780604051901315613d3f57600080fd5b8091901215613d4d57600080fd5b6000811215613d64578060000360020a8204613d6b565b8060020a82025b905090506006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613db257600080fd5b8091901215613dc057600080fd5b1215613e09576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613df457600080fd5b8091901215613e0257600080fd5b0305613e41565b6402540be40060a0516101006402540be40061158051020580608051901315613e3157600080fd5b8091901215613e3f57600080fd5b055b60e052604060c02054176006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613e8e57600080fd5b8091901215613e9c57600080fd5b1215613ee5576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613ed057600080fd5b8091901215613ede57600080fd5b0305613f1d565b6402540be40060a0516101006402540be40061158051020580608051901315613f0d57600080fd5b8091901215613f1b57600080fd5b055b60e052604060c020556001600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c02054612080526005600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020546120a05261204051156140075761208060a0516001600060c0526115805160e052604060c02060c052602060c020015482510180608051901315613fc557600080fd5b8091901215613fd357600080fd5b815250612080516001600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020555b6120605115614088576120a060a0516001600060c0526115805160e052604060c02060c052602060c02001548251018060805190131561404657600080fd5b809190121561405457600080fd5b8152506120a0516005600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020555b6115e051601354141561421657600060a0516012546001600060c0526115805160e052604060c02060c052602060c020015481810281158383830514176140ce57600080fd5b6402540be4008105905090509050806080519013156140ec57600080fd5b80919012156140fa57600080fd5b1215614176576402540be4006402540be3ff60a0516012546001600060c0526115805160e052604060c02060c052602060c0200154818102811583838305141761414357600080fd5b6402540be40081059050905090508060805190131561416157600080fd5b809190121561416f57600080fd5b03056141e1565b6402540be40060a0516012546001600060c0526115805160e052604060c02060c052602060c020015481810281158383830514176141b357600080fd5b6402540be4008105905090509050806080519013156141d157600080fd5b80919012156141df57600080fd5b055b6120c05260006000604463579f38b26120e05261158051612100526120c051612120526120fc6000305af161421557600080fd5b5b6003600a60c0526115c05160e052604060c02060c052602060c02001541560a051600360a0516002600754818102811583838305141761425557600080fd5b809050905090508060805190131561426c57600080fd5b809190121561427a57600080fd5b058060805190131561428b57600080fd5b809190121561429957600080fd5b6120a051121560a051600360a051600260065481810281158383830514176142c057600080fd5b80905090509050806080519013156142d757600080fd5b80919012156142e557600080fd5b05806080519013156142f657600080fd5b809190121561430457600080fd5b6120805112151616156144285760016003600a60c0526115c05160e052604060c02060c052602060c02001556115c0516011556001600b5560016121805260006121a052600160c0526115c05160e052604060c020546115c0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96040612180a360605160016115e051018060405190131561439f57600080fd5b80919012156143ad57600080fd5b6115c05114156144275760016002600a60c0526115e05160e052604060c02060c052602060c02001556115e05160105560016121c05260016121e052600160c0526115e05160e052604060c020546115e0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b960406121c0a35b5b6115c051612200526115e051612220526115a051611580516006600060c0526115805160e052604060c02060c052602060c02001547f0fa814a7606272ed601db3d9974a12a26536f050d147ad209b7e7b0a95746f176040612200a4005b63cc20f16b6000511415614ab057604060046101403734156144a757600080fd5b610420600435600401610180376104006004356004013511156144c957600080fd5b6104206024356004016105c0376104006024356004013511156144eb57600080fd5b60206112e061088460406313d21fa3610a005280610a20526101808080516020018084610a2001828460006004600a8704601201f161452957600080fd5b50508051820160200191505080610a40526105c08080516020018084610a2001828460006004600a8704601201f161456057600080fd5b505080518201602001915050610a1c90506000305af161457f57600080fd5b6112e05161458c57600080fd5b6119606101806106206113008251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c061130051146145cb57600080fd5b61130051611300018060200151600082518060209013156145eb57600080fd5b80919012156145f957600080fd5b606051816020036101000a83048060405190131561461657600080fd5b809190121561462457600080fd5b905090509050815260206113205161130001511461464157600080fd5b6113205161132001518160200152611340516113000180602001516000825180602090131561466f57600080fd5b809190121561467d57600080fd5b606051816020036101000a83048060405190131561469a57600080fd5b80919012156146a857600080fd5b905090509050816040015261136051611300018060200151600082518060209013156146d357600080fd5b80919012156146e157600080fd5b606051816020036101000a8304806040519013156146fe57600080fd5b809190121561470c57600080fd5b9050905090508160600152611380516113000180516020018083608001828460006004600a8704601201f161474057600080fd5b50505061196051611e20526020611ee060246399fb5eec611e6052611e2051611e8052611e7c6000305af161477457600080fd5b611ee051611e4052600060a05160196402540be400611e405102058060805190131561479f57600080fd5b80919012156147ad57600080fd5b12156147f5576402540be4006402540be3ff60a05160196402540be400611e40510205806080519013156147e057600080fd5b80919012156147ee57600080fd5b030561482c565b6402540be40060a05160196402540be400611e405102058060805190131561481c57600080fd5b809190121561482a57600080fd5b055b611f0052606051611f0051611e4051038060405190131561484c57600080fd5b809190121561485a57600080fd5b611f2052601460c052600f5460e052604060c020606051611e40518254018060405190131561488857600080fd5b809190121561489657600080fd5b81555060016003600060c052611e205160e052604060c02060c052602060c0200155611f0051611f4052611f2051611f6052611e20516006600060c052611e205160e052604060c02060c052602060c0200154337fb63bb46c05149b79f409b978407acff3bb3bfb5fb728ed2909fdb52677c220da6040611f40a46002600060c052611e205160e052604060c02060c052602060c0200154611f8052611f80516004541215614a95576001600060c052611e205160e052604060c02060c052602060c0200154611fa052600560c0526060516001600454018060405190131561497e57600080fd5b809190121561498c57600080fd5b60e052604060c02060a051611fa051825403806080519013156149ae57600080fd5b80919012156149bc57600080fd5b815550606051600160045401806040519013156149d857600080fd5b80919012156149e657600080fd5b6002600060c052611e205160e052604060c02060c052602060c0200155602054611f80511215614a5157600560c052611f805160e052604060c02060a051611fa05182540180608051901315614a3b57600080fd5b8091901215614a4957600080fd5b815550614a94565b60206120206004634a8fd698611fc052611fdc6000305af1614a7257600080fd5b612020516005600060c052611e205160e052604060c02060c052602060c02001555b5b6000600060006000611f0051336000f1614aae57600080fd5b005b63bcc44d996000511415614b1d5760206004610140373415614ad157600080fd5b60605160043580604051901315614ae757600080fd5b8091901215614af557600080fd5b506001600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63faf944fa6000511415614b8a5760206004610140373415614b3e57600080fd5b60605160043580604051901315614b5457600080fd5b8091901215614b6257600080fd5b506004600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63c253bf416000511415614bf75760206004610140373415614bab57600080fd5b60605160043580604051901315614bc157600080fd5b8091901215614bcf57600080fd5b506002600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b633b4f3ae36000511415614c645760206004610140373415614c1857600080fd5b60605160043580604051901315614c2e57600080fd5b8091901215614c3c57600080fd5b506003600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b6306fcf2ff6000511415614cd15760206004610140373415614c8557600080fd5b60605160043580604051901315614c9b57600080fd5b8091901215614ca957600080fd5b506005600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63bb0115f06000511415614d3b5760206004610140373415614cf257600080fd5b60605160043580604051901315614d0857600080fd5b8091901215614d1657600080fd5b50600060c0526101405160e052604060c02060c052602060c0205460005260206000f3005b635dbfd1ce6000511415614da85760206004610140373415614d5c57600080fd5b60605160043580604051901315614d7257600080fd5b8091901215614d8057600080fd5b506006600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b638208b8756000511415614e0a5760206004610140373415614dc957600080fd5b60605160043580604051901315614ddf57600080fd5b8091901215614ded57600080fd5b50600160c0526101405160e052604060c0205460005260206000f3005b637d69c5d96000511415614e30573415614e2357600080fd5b60025460005260206000f3005b63dc2059b36000511415614e7f5760206004610140373415614e5157600080fd5b6004356020518110614e6257600080fd5b50600360c0526101405160e052604060c0205460005260206000f3005b637060054d6000511415614ea5573415614e9857600080fd5b60045460005260206000f3005b63c44dc6596000511415614f075760206004610140373415614ec657600080fd5b60605160043580604051901315614edc57600080fd5b8091901215614eea57600080fd5b50600560c0526101405160e052604060c0205460005260206000f3005b63a2630bae6000511415614f695760206004610140373415614f2857600080fd5b60605160043580604051901315614f3e57600080fd5b8091901215614f4c57600080fd5b50600860c0526101405160e052604060c0205460005260206000f3005b6365ca80e66000511415614fcb5760206004610140373415614f8a57600080fd5b60605160043580604051901315614fa057600080fd5b8091901215614fae57600080fd5b50600960c0526101405160e052604060c0205460005260206000f3005b634af8e81a60005114156150355760206004610140373415614fec57600080fd5b6060516004358060405190131561500257600080fd5b809190121561501057600080fd5b50600a60c0526101405160e052604060c02060c052602060c0205460005260206000f3005b6326becf5860005114156150a2576020600461014037341561505657600080fd5b6060516004358060405190131561506c57600080fd5b809190121561507a57600080fd5b506004600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63be26608e600051141561514357604060046101403734156150c357600080fd5b606051600435806040519013156150d957600080fd5b80919012156150e757600080fd5b50606051602435806040519013156150fe57600080fd5b809190121561510c57600080fd5b506001600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b633673fd9860005114156151e4576040600461014037341561516457600080fd5b6060516004358060405190131561517a57600080fd5b809190121561518857600080fd5b506060516024358060405190131561519f57600080fd5b80919012156151ad57600080fd5b506005600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b63e270eb666000511415615285576040600461014037341561520557600080fd5b6060516004358060405190131561521b57600080fd5b809190121561522957600080fd5b506060516024358060405190131561524057600080fd5b809190121561524e57600080fd5b506006600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b6330d3c41a60005114156152f257602060046101403734156152a657600080fd5b606051600435806040519013156152bc57600080fd5b80919012156152ca57600080fd5b506003600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63cfff38c0600051141561535f576020600461014037341561531357600080fd5b6060516004358060405190131561532957600080fd5b809190121561533757600080fd5b506002600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b6399787ac6600051141561538557341561537857600080fd5b600b5460005260206000f3005b63e430757f60005114156153e757602060046101403734156153a657600080fd5b606051600435806040519013156153bc57600080fd5b80919012156153ca57600080fd5b50600c60c0526101405160e052604060c0205460005260206000f3005b638a484407600051141561540d57341561540057600080fd5b600d5460005260206000f3005b63e6b57366600051141561543357341561542657600080fd5b600e5460005260206000f3005b639372b4e4600051141561545957341561544c57600080fd5b600f5460005260206000f3005b632eff8759600051141561547f57341561547257600080fd5b60105460005260206000f3005b635f61165060005114156154a557341561549857600080fd5b60115460005260206000f3005b6307dcf45b60005114156154cb5734156154be57600080fd5b60125460005260206000f3005b635b03544a60005114156154f15734156154e457600080fd5b60135460005260206000f3005b634c7756756000511415615553576020600461014037341561551257600080fd5b6060516004358060405190131561552857600080fd5b809190121561553657600080fd5b50601460c0526101405160e052604060c0205460005260206000f3005b63ac4746ab600051141561557957341561556c57600080fd5b60165460005260206000f3005b6397fbdf08600051141561559f57341561559257600080fd5b60175460005260206000f3005b630ebb172a60005114156155c55734156155b857600080fd5b60185460005260206000f3005b634f4ddb5e60005114156155eb5734156155de57600080fd5b60195460005260206000f3005b633f8a500e600051141561561157341561560457600080fd5b601c5460005260206000f3005b6361073e88600051141561563757341561562a57600080fd5b601d5460005260206000f3005b6326c0817e600051141561565d57341561565057600080fd5b601e5460005260206000f3005b63d4b31281600051141561568357341561567657600080fd5b601f5460005260206000f3005b" diff --git a/ethcore/res/contracts/simple_casper.json b/ethcore/res/contracts/simple_casper.json index 8ed3dc79b11..606ce9012b9 100644 --- a/ethcore/res/contracts/simple_casper.json +++ b/ethcore/res/contracts/simple_casper.json @@ -1 +1 @@ -[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "address", "name": "_validation_address", "indexed": false}, {"type": "int128", "name": "_start_dyn", "indexed": false}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "bytes32", "name": "_target_hash", "indexed": true}, {"type": "int128", "name": "_target_epoch", "indexed": false}, {"type": "int128", "name": "_source_epoch", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_end_dyn", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "address", "name": "_offender", "indexed": true}, {"type": "int128", "name": "_offender_index", "indexed": true}, {"type": "int128", "name": "_bounty", "indexed": false}, {"type": "int128", "name": "_destroyed", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": true}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": true}, {"type": "bool", "name": "_is_justified", "indexed": false}, {"type": "bool", "name": "_is_finalized", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "int168", "name": "base_interest_factor"}, {"type": "int168", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": false, "payable": false, "type": "function", "gas": 357964}, {"name": "main_hash_voted_frac", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2989}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": true, "payable": false, "type": "function", "gas": 2991}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2595}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2625}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 38206}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1882000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1882000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": false, "payable": false, "type": "function", "gas": 427173}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": false, "payable": true, "type": "function", "gas": 682331}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": false, "payable": false, "type": "function", "gas": 87942}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": false, "payable": false, "type": "function", "gas": 102634}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": false, "payable": false, "type": "function", "gas": 321153}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 210102}, {"name": "validators__deposit", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1500}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1530}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1560}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1590}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1620}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1644}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1680}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1632}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1641}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1752}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1782}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1812}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1914}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1950}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2157}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2187}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2217}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2070}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2100}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2082}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2322}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2163}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2193}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2223}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2253}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2283}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2313}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2343}] +[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "address", "name": "_validation_address", "indexed": false}, {"type": "int128", "name": "_start_dyn", "indexed": false}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "bytes32", "name": "_target_hash", "indexed": true}, {"type": "int128", "name": "_target_epoch", "indexed": false}, {"type": "int128", "name": "_source_epoch", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_end_dyn", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "address", "name": "_offender", "indexed": true}, {"type": "int128", "name": "_offender_index", "indexed": true}, {"type": "int128", "name": "_bounty", "indexed": false}, {"type": "int128", "name": "_destroyed", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": true}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": true}, {"type": "bool", "name": "_is_justified", "indexed": false}, {"type": "bool", "name": "_is_finalized", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "warm_up_period"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "int168", "name": "base_interest_factor"}, {"type": "int168", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": false, "payable": false, "type": "function", "gas": 693389}, {"name": "main_hash_voted_frac", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 3125}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": true, "payable": false, "type": "function", "gas": 3127}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2663}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2693}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 37420}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1984000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1984000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": false, "payable": false, "type": "function", "gas": 743858}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": false, "payable": true, "type": "function", "gas": 831732}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": false, "payable": false, "type": "function", "gas": 132888}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": false, "payable": false, "type": "function", "gas": 223404}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": false, "payable": false, "type": "function", "gas": 503266}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 284884}, {"name": "validators__deposit", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1534}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1564}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1594}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1624}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1654}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1678}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1714}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1666}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1675}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1786}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1816}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1846}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1948}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1984}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2225}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2255}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2285}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2104}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2134}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2116}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2356}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2163}, {"name": "WARM_UP_PERIOD", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2193}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2223}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2253}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2283}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2313}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2343}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2373}] From 03fbfec451cc3381cc83fd8e82da7dad92e75b65 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 05:58:31 +0800 Subject: [PATCH 32/72] Use fixed168x10 simple casper bytecode --- ethcore/res/contracts/simple_casper.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/res/contracts/simple_casper.json b/ethcore/res/contracts/simple_casper.json index 606ce9012b9..e7d917d5ee1 100644 --- a/ethcore/res/contracts/simple_casper.json +++ b/ethcore/res/contracts/simple_casper.json @@ -1 +1 @@ -[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "address", "name": "_validation_address", "indexed": false}, {"type": "int128", "name": "_start_dyn", "indexed": false}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "bytes32", "name": "_target_hash", "indexed": true}, {"type": "int128", "name": "_target_epoch", "indexed": false}, {"type": "int128", "name": "_source_epoch", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_end_dyn", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "address", "name": "_offender", "indexed": true}, {"type": "int128", "name": "_offender_index", "indexed": true}, {"type": "int128", "name": "_bounty", "indexed": false}, {"type": "int128", "name": "_destroyed", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": true}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": true}, {"type": "bool", "name": "_is_justified", "indexed": false}, {"type": "bool", "name": "_is_finalized", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "warm_up_period"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "int168", "name": "base_interest_factor"}, {"type": "int168", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": false, "payable": false, "type": "function", "gas": 693389}, {"name": "main_hash_voted_frac", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 3125}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": true, "payable": false, "type": "function", "gas": 3127}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2663}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2693}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 37420}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1984000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1984000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": false, "payable": false, "type": "function", "gas": 743858}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": false, "payable": true, "type": "function", "gas": 831732}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": false, "payable": false, "type": "function", "gas": 132888}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": false, "payable": false, "type": "function", "gas": 223404}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": false, "payable": false, "type": "function", "gas": 503266}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 284884}, {"name": "validators__deposit", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1534}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1564}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1594}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1624}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1654}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1678}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1714}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1666}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1675}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1786}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1816}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1846}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1948}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1984}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2225}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2255}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2285}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2104}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2134}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2116}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2356}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2163}, {"name": "WARM_UP_PERIOD", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2193}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2223}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2253}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2283}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "int168", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2313}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2343}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2373}] +[{"name": "Deposit", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "address", "name": "_validation_address", "indexed": false}, {"type": "int128", "name": "_start_dyn", "indexed": false}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Vote", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "bytes32", "name": "_target_hash", "indexed": true}, {"type": "int128", "name": "_target_epoch", "indexed": false}, {"type": "int128", "name": "_source_epoch", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Logout", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_end_dyn", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Withdraw", "inputs": [{"type": "address", "name": "_to", "indexed": true}, {"type": "int128", "name": "_validator_index", "indexed": true}, {"type": "int128", "name": "_amount", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Slash", "inputs": [{"type": "address", "name": "_from", "indexed": true}, {"type": "address", "name": "_offender", "indexed": true}, {"type": "int128", "name": "_offender_index", "indexed": true}, {"type": "int128", "name": "_bounty", "indexed": false}, {"type": "int128", "name": "_destroyed", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "Epoch", "inputs": [{"type": "int128", "name": "_number", "indexed": true}, {"type": "bytes32", "name": "_checkpoint_hash", "indexed": true}, {"type": "bool", "name": "_is_justified", "indexed": false}, {"type": "bool", "name": "_is_finalized", "indexed": false}], "anonymous": false, "type": "event"}, {"name": "init", "outputs": [], "inputs": [{"type": "int128", "name": "epoch_length"}, {"type": "int128", "name": "warm_up_period"}, {"type": "int128", "name": "withdrawal_delay"}, {"type": "int128", "name": "dynasty_logout_delay"}, {"type": "address", "name": "msg_hasher"}, {"type": "address", "name": "purity_checker"}, {"type": "fixed168x10", "name": "base_interest_factor"}, {"type": "fixed168x10", "name": "base_penalty_factor"}, {"type": "int128", "name": "min_deposit_size"}], "constant": false, "payable": false, "type": "function", "gas": 693389}, {"name": "main_hash_voted_frac", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 3125}, {"name": "deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": true, "payable": false, "type": "function", "gas": 3127}, {"name": "total_curdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2663}, {"name": "total_prevdyn_deposits_in_wei", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2693}, {"name": "slashable", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 37420}, {"name": "recommended_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 933}, {"name": "recommended_target_hash", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 810}, {"name": "highest_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1984000000000000000000000000000946}, {"name": "highest_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "min_total_deposits"}], "constant": true, "payable": false, "type": "function", "gas": 1984000000000000000000000000000976}, {"name": "initialize_epoch", "outputs": [], "inputs": [{"type": "int128", "name": "epoch"}], "constant": false, "payable": false, "type": "function", "gas": 743858}, {"name": "deposit", "outputs": [], "inputs": [{"type": "address", "name": "validation_addr"}, {"type": "address", "name": "withdrawal_addr"}], "constant": false, "payable": true, "type": "function", "gas": 831732}, {"name": "logout", "outputs": [], "inputs": [{"type": "bytes", "name": "logout_msg"}], "constant": false, "payable": false, "type": "function", "gas": 132888}, {"name": "withdraw", "outputs": [], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": false, "payable": false, "type": "function", "gas": 223404}, {"name": "vote", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg"}], "constant": false, "payable": false, "type": "function", "gas": 503266}, {"name": "slash", "outputs": [], "inputs": [{"type": "bytes", "name": "vote_msg_1"}, {"type": "bytes", "name": "vote_msg_2"}], "constant": false, "payable": false, "type": "function", "gas": 284884}, {"name": "validators__deposit", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1534}, {"name": "validators__start_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1564}, {"name": "validators__end_dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1594}, {"name": "validators__is_slashed", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1624}, {"name": "validators__total_deposits_at_logout", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1654}, {"name": "validators__addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1678}, {"name": "validators__withdrawal_addr", "outputs": [{"type": "address", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1714}, {"name": "checkpoint_hashes", "outputs": [{"type": "bytes32", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1666}, {"name": "next_validator_index", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1473}, {"name": "validator_indexes", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "address", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1675}, {"name": "dynasty", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1533}, {"name": "dynasty_wei_delta", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1786}, {"name": "dynasty_start_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1816}, {"name": "dynasty_in_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1846}, {"name": "checkpoints__cur_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1948}, {"name": "checkpoints__prev_dyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 1984}, {"name": "checkpoints__cur_dyn_votes", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2225}, {"name": "checkpoints__prev_dyn_votes", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2255}, {"name": "checkpoints__vote_bitmap", "outputs": [{"type": "uint256", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}, {"type": "int128", "name": "arg1"}], "constant": true, "payable": false, "type": "function", "gas": 2285}, {"name": "checkpoints__is_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2104}, {"name": "checkpoints__is_finalized", "outputs": [{"type": "bool", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2134}, {"name": "main_hash_justified", "outputs": [{"type": "bool", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1863}, {"name": "deposit_scale_factor", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2116}, {"name": "last_nonvoter_rescale", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1923}, {"name": "last_voter_rescale", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1953}, {"name": "current_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1983}, {"name": "last_finalized_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2013}, {"name": "last_justified_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2043}, {"name": "reward_factor", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2073}, {"name": "expected_source_epoch", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2103}, {"name": "total_slashed", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "arg0"}], "constant": true, "payable": false, "type": "function", "gas": 2356}, {"name": "EPOCH_LENGTH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2163}, {"name": "WARM_UP_PERIOD", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2193}, {"name": "WITHDRAWAL_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2223}, {"name": "DYNASTY_LOGOUT_DELAY", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2253}, {"name": "BASE_INTEREST_FACTOR", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2283}, {"name": "BASE_PENALTY_FACTOR", "outputs": [{"type": "fixed168x10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2313}, {"name": "MIN_DEPOSIT_SIZE", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2343}, {"name": "START_EPOCH", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 2373}] From 0ba80b91bb4cab8d4270e76cf150e9fb591827a0 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 06:00:20 +0800 Subject: [PATCH 33/72] Add warm up period to casper init function --- ethcore/src/machine.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 1c1189e3fcb..815d8b53333 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -308,6 +308,7 @@ impl EthereumMachine { let casper_contract = simple_casper_contract::SimpleCasper::default(); let input = casper_contract.functions().init().input( ethash_params.hybrid_casper_epoch_length, + ethash_params.hybrid_casper_warm_up_period, ethash_params.hybrid_casper_withdrawal_delay, ethash_params.hybrid_casper_dynasty_logout_delay, ethash_params.hybrid_casper_msg_hasher_contract_address, From fb2b9d51c1daaf24fd4c5a4a894eab95602bb82d Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 06:01:12 +0800 Subject: [PATCH 34/72] typo: should use current.metadata() --- 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 fa9205ace23..0b2bebeeb46 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -366,7 +366,7 @@ impl Engine for Arc { fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice { let new_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - let current_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let current_metadata: CasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to // check transition block here. From a7346f0325ab23a31d703a17fbadec1aa7666bbf Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 06:30:39 +0800 Subject: [PATCH 35/72] Use ethabi version with fixed168x10 support --- Cargo.lock | 41 +++++++++++++++++++++++++++++++++++++---- ethcore/Cargo.toml | 6 +++--- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4d6bd315f2..2023a4edec1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -451,6 +451,20 @@ dependencies = [ "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ethabi" +version = "5.1.1" +source = "git+https://github.com/paritytech/ethabi?branch=casper#141aef6e747b5c7887a944d19af96d75d4b6cfc9" +dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ethabi" version = "5.1.1" @@ -465,11 +479,27 @@ dependencies = [ "tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ethabi-contract" +version = "5.1.0" +source = "git+https://github.com/paritytech/ethabi?branch=casper#141aef6e747b5c7887a944d19af96d75d4b6cfc9" + [[package]] name = "ethabi-contract" version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ethabi-derive" +version = "5.1.2" +source = "git+https://github.com/paritytech/ethabi?branch=casper#141aef6e747b5c7887a944d19af96d75d4b6cfc9" +dependencies = [ + "ethabi 5.1.1 (git+https://github.com/paritytech/ethabi?branch=casper)", + "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ethabi-derive" version = "5.1.2" @@ -518,9 +548,9 @@ dependencies = [ "common-types 0.1.0", "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi-contract 5.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 5.1.1 (git+https://github.com/paritytech/ethabi?branch=casper)", + "ethabi-contract 5.1.0 (git+https://github.com/paritytech/ethabi?branch=casper)", + "ethabi-derive 5.1.2 (git+https://github.com/paritytech/ethabi?branch=casper)", "ethash 1.12.0", "ethcore-bloom-journal 0.1.0", "ethcore-bytes 0.1.0", @@ -2695,7 +2725,7 @@ dependencies = [ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3843,8 +3873,11 @@ dependencies = [ "checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" "checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "" +"checksum ethabi 5.1.1 (git+https://github.com/paritytech/ethabi?branch=casper)" = "" "checksum ethabi 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05e33a914b94b763f0a92333e4e5c95c095563f06ef7d6b295b3d3c2cf31e21f" +"checksum ethabi-contract 5.1.0 (git+https://github.com/paritytech/ethabi?branch=casper)" = "" "checksum ethabi-contract 5.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "210c9e21d164c15b6ef64fe601e0e12a3c84a031d5ef558e38463e53edbd22ed" +"checksum ethabi-derive 5.1.2 (git+https://github.com/paritytech/ethabi?branch=casper)" = "" "checksum ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d2bc7099baa147187aedaecd9fe04a6c0541c82bc43ff317cb6900fe2b983d74" "checksum ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a93a43ce2e9f09071449da36bfa7a1b20b950ee344b6904ff23de493b03b386" "checksum ethereum-types 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3ae691a36ce5d25b433e63128ce5579f4a18457b6a9c849832b2c9e0fec92a" diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 71c84a293f9..3f1df8e6676 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -29,9 +29,9 @@ ethcore-stratum = { path = "./stratum" } ethcore-transaction = { path = "./transaction" } ethereum-types = "0.3" memory-cache = { path = "../util/memory_cache" } -ethabi = "5.1" -ethabi-derive = "5.0" -ethabi-contract = "5.0" +ethabi = { git = "https://github.com/paritytech/ethabi", branch = "casper" } +ethabi-derive = { git = "https://github.com/paritytech/ethabi", branch = "casper" } +ethabi-contract = { git = "https://github.com/paritytech/ethabi", branch = "casper" } ethjson = { path = "../json" } ethkey = { path = "../ethkey" } ethstore = { path = "../ethstore" } From c5f6e5a520cb3fd1db39a2f1f4618835cd54c081 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 07:06:14 +0800 Subject: [PATCH 36/72] Update capser-temporary ethabi version --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2023a4edec1..6184abd3487 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -454,7 +454,7 @@ dependencies = [ [[package]] name = "ethabi" version = "5.1.1" -source = "git+https://github.com/paritytech/ethabi?branch=casper#141aef6e747b5c7887a944d19af96d75d4b6cfc9" +source = "git+https://github.com/paritytech/ethabi?branch=casper#6ec7a3eb5e0c12dd24bbba037e1c885e47d7fd33" dependencies = [ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -482,7 +482,7 @@ dependencies = [ [[package]] name = "ethabi-contract" version = "5.1.0" -source = "git+https://github.com/paritytech/ethabi?branch=casper#141aef6e747b5c7887a944d19af96d75d4b6cfc9" +source = "git+https://github.com/paritytech/ethabi?branch=casper#6ec7a3eb5e0c12dd24bbba037e1c885e47d7fd33" [[package]] name = "ethabi-contract" @@ -492,7 +492,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ethabi-derive" version = "5.1.2" -source = "git+https://github.com/paritytech/ethabi?branch=casper#141aef6e747b5c7887a944d19af96d75d4b6cfc9" +source = "git+https://github.com/paritytech/ethabi?branch=casper#6ec7a3eb5e0c12dd24bbba037e1c885e47d7fd33" dependencies = [ "ethabi 5.1.1 (git+https://github.com/paritytech/ethabi?branch=casper)", "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", From a13f5c63b5f5de88985377481da485d46ecc6c9b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 08:58:55 +0800 Subject: [PATCH 37/72] Deploy RLP decoder contract for Casper --- ethcore/res/code/simple_casper.hex | 2 +- ethcore/src/engines/mod.rs | 3 +++ ethcore/src/machine.rs | 21 +++++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ethcore/res/code/simple_casper.hex b/ethcore/res/code/simple_casper.hex index 2c0e3a65786..438a76a3a3b 100644 --- a/ethcore/res/code/simple_casper.hex +++ b/ethcore/res/code/simple_casper.hex @@ -1 +1 @@ -"600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526358c4540b60005114156103fa5761012060046101403734156100b557600080fd5b606051600435806040519013156100cb57600080fd5b80919012156100d957600080fd5b50606051602435806040519013156100f057600080fd5b80919012156100fe57600080fd5b506060516044358060405190131561011557600080fd5b809190121561012357600080fd5b506060516064358060405190131561013a57600080fd5b809190121561014857600080fd5b50608435602051811061015a57600080fd5b5060a435602051811061016c57600080fd5b50606051610104358060405190131561018457600080fd5b809190121561019257600080fd5b50601554156101a057600080fd5b610100610140511260006101405113166101b957600080fd5b60006101605112156101ca57600080fd5b60006101805112156101db57600080fd5b60026101a05112156101ec57600080fd5b60006102005112156101fd57600080fd5b600061022051121561020e57600080fd5b6000610240511361021e57600080fd5b60016015556101405160165561016051601755610180516018556101a05160195561020051601c5561022051601d5561024051601e55600060a0516016548061026657600080fd5b6402540be4006060516101605143018060405190131561028557600080fd5b809190121561029357600080fd5b0205806080519013156102a557600080fd5b80919012156102b357600080fd5b1215610329576402540be4006402540be3ff60a051601654806102d557600080fd5b6402540be400606051610160514301806040519013156102f457600080fd5b809190121561030257600080fd5b02058060805190131561031457600080fd5b809190121561032257600080fd5b030561038e565b6402540be40060a0516016548061033f57600080fd5b6402540be4006060516101605143018060405190131561035e57600080fd5b809190121561036c57600080fd5b02058060805190131561037e57600080fd5b809190121561038c57600080fd5b055b601f556101c051601a556101e051601b5560016002556000600455601f54600f5568056bc75e2d63100000600c60c052600f5460e052604060c02055600060065560006007556c0c9f2c9cd04674edea4000000060205562030d4060215562030d406022556003602355005b639a8eec77600051141561045157341561041357600080fd5b30331461041f57600080fd5b606051601054600f54038060405190131561043957600080fd5b809190121561044757600080fd5b60005260206000f3005b63db23eee060005114156107f757341561046a57600080fd5b30331461047657600080fd5b600f54610140526060516001600060a051670de0b6b3a764000060a051600c60c05260605160016101405103806040519013156104b257600080fd5b80919012156104c057600080fd5b60e052604060c02054600754600654808212156104dd57806104df565b815b9050905081810281158383830514176104f757600080fd5b6402540be40081059050905090508060805190131561051557600080fd5b809190121561052357600080fd5b058060805190131561053457600080fd5b809190121561054257600080fd5b1215610619576402540be4006402540be3ff60a051670de0b6b3a764000060a051600c60c052606051600161014051038060405190131561058257600080fd5b809190121561059057600080fd5b60e052604060c02054600754600654808212156105ad57806105af565b815b9050905081810281158383830514176105c757600080fd5b6402540be4008105905090509050806080519013156105e557600080fd5b80919012156105f357600080fd5b058060805190131561060457600080fd5b809190121561061257600080fd5b03056106df565b6402540be40060a051670de0b6b3a764000060a051600c60c052606051600161014051038060405190131561064d57600080fd5b809190121561065b57600080fd5b60e052604060c0205460075460065480821215610678578061067a565b815b90509050818102811583838305141761069257600080fd5b6402540be4008105905090509050806080519013156106b057600080fd5b80919012156106be57600080fd5b05806080519013156106cf57600080fd5b80919012156106dd57600080fd5b055b01806040519013156106f057600080fd5b80919012156106fe57600080fd5b6101605260a0516404a817c80068056bc75e2d631000006101605102058060805190131561072b57600080fd5b809190121561073957600080fd5b610180526101a060006014818352015b60a051600260a05160a051610180518061076257600080fd5b68056bc75e2d631000006101605102058060805190131561078257600080fd5b809190121561079057600080fd5b6101805101806080519013156107a557600080fd5b80919012156107b357600080fd5b05806080519013156107c457600080fd5b80919012156107d257600080fd5b610180525b8151600101808352811415610749575b50506101805160005260206000f3005b63de7f9975600051141561083357341561081057600080fd5b30331461081c57600080fd5b6000600754136000600654131660005260206000f3005b63d286bb82600051141561097657341561084c57600080fd5b30331461085857600080fd5b600f54610140526002600a60c052606051600261014051038060405190131561088057600080fd5b809190121561088e57600080fd5b60e052604060c02060c052602060c0200154156109265760046060516001825401806040519013156108bf57600080fd5b80919012156108cd57600080fd5b815550600654600755600660a051600560c05260045460e052604060c02054825401806080519013156108ff57600080fd5b809190121561090d57600080fd5b81555061014051600860c05260045460e052604060c020555b600454600960c0526101405160e052604060c02055600b541561096f57606051600161014051038060405190131561095d57600080fd5b809190121561096b57600080fd5b6013555b6000600b55005b636526ed726000511415610b1657341561098f57600080fd5b30331461099b57600080fd5b600f54610140526001600b5560016003600a60c05260605160016101405103806040519013156109ca57600080fd5b80919012156109d857600080fd5b60e052604060c02060c052602060c020015560016002600a60c0526060516001610140510380604051901315610a0d57600080fd5b8091901215610a1b57600080fd5b60e052604060c02060c052602060c02001556060516001610140510380604051901315610a4757600080fd5b8091901215610a5557600080fd5b6011556060516001610140510380604051901315610a7257600080fd5b8091901215610a8057600080fd5b601055600161016052600161018052600160c0526060516001610140510380604051901315610aae57600080fd5b8091901215610abc57600080fd5b60e052604060c020546060516001610140510380604051901315610adf57600080fd5b8091901215610aed57600080fd5b7f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96040610160a3005b63acc619c36000511415610d61573415610b2f57600080fd5b303314610b3b57600080fd5b600f5461014052600260206101e06004639a8eec776101805261019c6000305af1610b6557600080fd5b6101e05113156101605261016051156020610260600463de7f99756102005261021c6000305af1610b9557600080fd5b61026051151715610bab57600060005260206000f35b60a0516001600a60c0526060516001610140510380604051901315610bcf57600080fd5b8091901215610bdd57600080fd5b60e052604060c02060c052602060c0200160c05260135460e052604060c0205460065480610c0a57600080fd5b806402540be4008302059050905080608051901315610c2857600080fd5b8091901215610c3657600080fd5b6102805260a0516005600a60c0526060516001610140510380604051901315610c5e57600080fd5b8091901215610c6c57600080fd5b60e052604060c02060c052602060c0200160c05260135460e052604060c0205460075480610c9957600080fd5b806402540be4008302059050905080608051901315610cb757600080fd5b8091901215610cc557600080fd5b6102a052610280516102a05180821315610cdf5780610ce1565b815b905090506102c05260a051600260a0516012546102c0518181028115838383051417610d0c57600080fd5b6402540be400810590509050905080608051901315610d2a57600080fd5b8091901215610d3857600080fd5b0580608051901315610d4957600080fd5b8091901215610d5757600080fd5b60005260206000f3005b63579f38b260005114156111215760406004610140373415610d8257600080fd5b303314610d8e57600080fd5b60605160043580604051901315610da457600080fd5b8091901215610db257600080fd5b5060605160243580604051901315610dc957600080fd5b8091901215610dd757600080fd5b506001600060c0526101405160e052604060c02060c052602060c0200160a0516402540be400610160510282540180608051901315610e1557600080fd5b8091901215610e2357600080fd5b8155506004600060c0526101405160e052604060c02060c052602060c0200154610180526002600060c0526101405160e052604060c02060c052602060c02001546101a0526004546101c05260605160016101c0510380604051901315610e8957600080fd5b8091901215610e9757600080fd5b6101e0526101a0516101c051126101c0516101805113151615610ee957600660a0516402540be400610160510282540180608051901315610ed757600080fd5b8091901215610ee557600080fd5b8155505b6101a0516101e051126101e0516101805113151615610f3757600760a0516402540be400610160510282540180608051901315610f2557600080fd5b8091901215610f3357600080fd5b8155505b6020546101a0511215610f8857600560c0526101a05160e052604060c02060a0516402540be400610160510282540380608051901315610f7657600080fd5b8091901215610f8457600080fd5b8155505b6000600060006000600060a051600860a051600c60c052600f5460e052604060c02054610160518181028115838383051417610fc357600080fd5b8090509050905080608051901315610fda57600080fd5b8091901215610fe857600080fd5b0580608051901315610ff957600080fd5b809190121561100757600080fd5b1215611095576402540be4006402540be3ff60a051600860a051600c60c052600f5460e052604060c0205461016051818102811583838305141761104a57600080fd5b809050905090508060805190131561106157600080fd5b809190121561106f57600080fd5b058060805190131561108057600080fd5b809190121561108e57600080fd5b0305611112565b6402540be40060a051600860a051600c60c052600f5460e052604060c020546101605181810281158383830514176110cc57600080fd5b80905090509050806080519013156110e357600080fd5b80919012156110f157600080fd5b058060805190131561110257600080fd5b809190121561111057600080fd5b055b416000f161111f57600080fd5b005b6301b7af1860005114156111ea576020600461014037341561114257600080fd5b30331461114e57600080fd5b6060516004358060405190131561116457600080fd5b809190121561117257600080fd5b506000600360c0526006600060c0526101405160e052604060c02060c052602060c020015460e052604060c02055600060c0526101405160e052604060c02060c052602060c0206000815560006001820155600060028201556000600382015560006004820155600060058201556000600682015550005b63a2767400600051141561132f576060600461014037341561120b57600080fd5b30331461121757600080fd5b6104206024356004016101a03761040060243560040135111561123957600080fd5b6060516044358060405190131561124f57600080fd5b809190121561125d57600080fd5b5060016000610140516020826105e00101526020810190506101a0610400806020846105e001018260208501600060046078f1505080518201915050806105e0526105e09050805160200180610a40828460006004600a8704601201f16112c357600080fd5b50506020610ec0610a4051610a606000600060c0526101805160e052604060c02060c052602060c02054602254f16112fa57600080fd5b6020610ea052610ea060206000602083510381131561131857600080fd5b0460200260200181015190501460005260206000f3005b6337df0ba8600051141561143257341561134857600080fd5b60a0516001600a60c052600f5460e052604060c02060c052602060c0200160c05260135460e052604060c020546006548061138257600080fd5b806402540be40083020590509050806080519013156113a057600080fd5b80919012156113ae57600080fd5b60a0516005600a60c052600f5460e052604060c02060c052602060c0200160c05260135460e052604060c02054600754806113e857600080fd5b806402540be400830205905090508060805190131561140657600080fd5b809190121561141457600080fd5b808213156114225780611424565b815b9050905060005260206000f3005b6399fb5eec60005114156115f8576020600461014037341561145357600080fd5b6060516004358060405190131561146957600080fd5b809190121561147757600080fd5b50600060a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176114bf57600080fd5b6402540be4008105905090509050806080519013156114dd57600080fd5b80919012156114eb57600080fd5b1215611575576402540be4006402540be3ff60a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761154257600080fd5b6402540be40081059050905090508060805190131561156057600080fd5b809190121561156e57600080fd5b03056115ee565b6402540be40060a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176115c057600080fd5b6402540be4008105905090509050806080519013156115de57600080fd5b80919012156115ec57600080fd5b055b60005260206000f3005b634a8fd698600051141561174357341561161157600080fd5b600060a051600c60c052600f5460e052604060c02054600654818102811583838305141761163e57600080fd5b6402540be40081059050905090508060805190131561165c57600080fd5b809190121561166a57600080fd5b12156116da576402540be4006402540be3ff60a051600c60c052600f5460e052604060c0205460065481810281158383830514176116a757600080fd5b6402540be4008105905090509050806080519013156116c557600080fd5b80919012156116d357600080fd5b0305611739565b6402540be40060a051600c60c052600f5460e052604060c02054600654818102811583838305141761170b57600080fd5b6402540be40081059050905090508060805190131561172957600080fd5b809190121561173757600080fd5b055b60005260206000f3005b637db2eedc600051141561188e57341561175c57600080fd5b600060a051600c60c052600f5460e052604060c02054600754818102811583838305141761178957600080fd5b6402540be4008105905090509050806080519013156117a757600080fd5b80919012156117b557600080fd5b1215611825576402540be4006402540be3ff60a051600c60c052600f5460e052604060c0205460075481810281158383830514176117f257600080fd5b6402540be40081059050905090508060805190131561181057600080fd5b809190121561181e57600080fd5b0305611884565b6402540be40060a051600c60c052600f5460e052604060c02054600754818102811583838305141761185657600080fd5b6402540be40081059050905090508060805190131561187457600080fd5b809190121561188257600080fd5b055b60005260206000f3005b6313d21fa36000511415611f6c57604060046101403734156118af57600080fd5b610420600435600401610180376104006004356004013511156118d157600080fd5b6104206024356004016105c0376104006024356004013511156118f357600080fd5b610180805160200180610a20828460006004600a8704601201f161191657600080fd5b50506020610e80610a2051610a406000601a54602154f161193657600080fd5b6020610e6052610e6060206000602083510381131561195457600080fd5b046020026020018101519050610a0052611520610180610620610ec08251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610ec051146119a357600080fd5b610ec051610ec0018060200151600082518060209013156119c357600080fd5b80919012156119d157600080fd5b606051816020036101000a8304806040519013156119ee57600080fd5b80919012156119fc57600080fd5b90509050905081526020610ee051610ec0015114611a1957600080fd5b610ee051610ee001518160200152610f0051610ec001806020015160008251806020901315611a4757600080fd5b8091901215611a5557600080fd5b606051816020036101000a830480604051901315611a7257600080fd5b8091901215611a8057600080fd5b9050905090508160400152610f2051610ec001806020015160008251806020901315611aab57600080fd5b8091901215611ab957600080fd5b606051816020036101000a830480604051901315611ad657600080fd5b8091901215611ae457600080fd5b9050905090508160600152610f4051610ec00180516020018083608001828460006004600a8704601201f1611b1857600080fd5b505050611520516119e05261156051611a005261158051611a20526115a0805160200180611a40828460006004600a8704601201f1611b5657600080fd5b50506105c0805160200180611ea0828460006004600a8704601201f1611b7b57600080fd5b50506020612300611ea051611ec06000601a54602154f1611b9b57600080fd5b60206122e0526122e0602060006020835103811315611bb957600080fd5b046020026020018101519050611e80526129a06105c06106206123408251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c06123405114611c0857600080fd5b6123405161234001806020015160008251806020901315611c2857600080fd5b8091901215611c3657600080fd5b606051816020036101000a830480604051901315611c5357600080fd5b8091901215611c6157600080fd5b9050905090508152602061236051612340015114611c7e57600080fd5b61236051612360015181602001526123805161234001806020015160008251806020901315611cac57600080fd5b8091901215611cba57600080fd5b606051816020036101000a830480604051901315611cd757600080fd5b8091901215611ce557600080fd5b90509050905081604001526123a05161234001806020015160008251806020901315611d1057600080fd5b8091901215611d1e57600080fd5b606051816020036101000a830480604051901315611d3b57600080fd5b8091901215611d4957600080fd5b90509050905081606001526123c0516123400180516020018083608001828460006004600a8704601201f1611d7d57600080fd5b5050506129a051612e60526129e051612e8052612a0051612ea052612a20805160200180612ec0828460006004600a8704601201f1611dbb57600080fd5b505060206137e0610484606063a276740061330052610a0051613320528061334052611a40808051602001808461332001828460006004600a8704601201f1611e0357600080fd5b5050805182016020019150506119e0516133605261331c90506000305af1611e2a57600080fd5b6137e0511515611e3f57600060005260206000f35b6020613ce0610484606063a276740061380052611e8051613820528061384052612ec0808051602001808461382001828460006004600a8704601201f1611e8557600080fd5b505080518201602001915050612e60516138605261381c90506000305af1611eac57600080fd5b613ce0511515611ec157600060005260206000f35b612e60516119e051141515611edb57600060005260206000f35b611e8051610a00511415611ef457600060005260206000f35b6003600060c0526119e05160e052604060c02060c052602060c020015415611f2157600060005260206000f35b612e8051611a005114613d0052611a2051612ea05112611a0051612e80511316612ea051611a205112612e8051611a0051131617613d2052613d2051613d00511760005260206000f3005b6310f246356000511415611f92573415611f8557600080fd5b60135460005260206000f3005b63855f372c600051141561201f573415611fab57600080fd5b6060516001606051601654600f540280604051901315611fca57600080fd5b8091901215611fd857600080fd5b0380604051901315611fe957600080fd5b8091901215611ff757600080fd5b610100430381121561200857600080fd5b43811061201457600080fd5b4060005260206000f3005b635c0a75de6000511415612167576020600461014037341561204057600080fd5b6060516004358060405190131561205657600080fd5b809190121561206457600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f54038060405190131561209857600080fd5b80919012156120a657600080fd5b610160526003600a60c0526101605160e052604060c02060c052602060c02001546101a05261014051600a60c0526101605160e052604060c02060c052602060c0205412156101c052610140516004600a60c0526101605160e052604060c02060c052602060c020015412156101e0526101e0516101c051166101a0511615612136576101605160005260206000f35b601f5461016051141561214857612159565b5b815160010180835281141561207d575b5050600060005260206000f3005b631f994c4060005114156122ce576020600461014037341561218857600080fd5b6060516004358060405190131561219e57600080fd5b80919012156121ac57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f5403806040519013156121e057600080fd5b80919012156121ee57600080fd5b610160526002600a60c0526101605160e052604060c02060c052602060c02001546101a05261014051600a60c0526101605160e052604060c02060c052602060c0205412156101c052610140516004600a60c0526101605160e052604060c02060c052602060c020015412156101e0526101e0516101c051166101a051161561227e576101605160005260206000f35b601f54610160511415612290576122a1565b5b81516001018083528114156121c5575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000f3005b635dcffc17600051141561285457602060046101403734156122ef57600080fd5b6060516004358060405190131561230557600080fd5b809190121561231357600080fd5b50600060a0516016548061232657600080fd5b6402540be4004302058060805190131561233f57600080fd5b809190121561234d57600080fd5b121561239d576402540be4006402540be3ff60a0516016548061236f57600080fd5b6402540be4004302058060805190131561238857600080fd5b809190121561239657600080fd5b03056123dc565b6402540be40060a051601654806123b357600080fd5b6402540be400430205806080519013156123cc57600080fd5b80919012156123da57600080fd5b055b610160526060516001600f5401806040519013156123f957600080fd5b809190121561240757600080fd5b6101405114610160516101405113151661242057600080fd5b60206101e06004634a8fd6986101805261019c6000305af161244157600080fd5b6101e051600a60c0526101405160e052604060c02060c052602060c0205560206102606004637db2eedc6102005261021c6000305af161248057600080fd5b610260516004600a60c0526101405160e052604060c02060c052602060c020015561014051600f5560a05160206102e0600463acc619c36102805261029c6000305af16124cc57600080fd5b6102e0516402540be40001806080519013156124e757600080fd5b80919012156124f557600080fd5b600e5560a051600e5460a0516012546402540be400018060805190131561251b57600080fd5b809190121561252957600080fd5b8061253357600080fd5b806402540be400830205905090508060805190131561255157600080fd5b809190121561255f57600080fd5b600d5560a051600d54600c60c052606051600161014051038060405190131561258757600080fd5b809190121561259557600080fd5b60e052604060c0205481810281158383830514176125b257600080fd5b6402540be4008105905090509050806080519013156125d057600080fd5b80919012156125de57600080fd5b600c60c0526101405160e052604060c02055601460c052606051600161014051038060405190131561260f57600080fd5b809190121561261d57600080fd5b60e052604060c02054601460c0526101405160e052604060c0205560206103c0600463de7f99756103605261037c6000305af161265957600080fd5b6103c0511561278c5760a051601c546020610460600463db23eee06104005261041c6000305af161268957600080fd5b610460518061269757600080fd5b806402540be40083020590509050806080519013156126b557600080fd5b80919012156126c357600080fd5b6103e05260a05160a051606051600260206104e06004639a8eec776104805261049c6000305af16126f357600080fd5b6104e051038060405190131561270857600080fd5b809190121561271657600080fd5b601d54818102811583838305141761272d57600080fd5b809050905090508060805190131561274457600080fd5b809190121561275257600080fd5b6103e051018060805190131561276757600080fd5b809190121561277557600080fd5b60125560006012541361278757600080fd5b6127b2565b600060006004636526ed726103005261031c6000305af16127ac57600080fd5b60006012555b6020610560600463855f372c6105005261051c6000305af16127d357600080fd5b61056051600160c0526101405160e052604060c0205560006000600463d286bb826105805261059c6000305af161280957600080fd5b60006105e052600061060052600160c0526101405160e052604060c02054610140517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b960406105e0a3005b63f9609f086000511415612b5d576040600461014037600435602051811061287b57600080fd5b50602435602051811061288d57600080fd5b50600060006004610180527fa1903eab000000000000000000000000000000000000000000000000000000006101a0526101806004806020846101e001018260208501600060046012f1505080518201915050610140516020826101e0010152602081019050806101e0526101e09050805160200180610260828460006004600a8704601201f161291d57600080fd5b50506020610300610260516102806000601b546207a120f161293e57600080fd5b60206102e0526102e060206000602083510381131561295c57600080fd5b046020026020018101519050141561297357600080fd5b600360c0526101605160e052604060c020541561298f57600080fd5b601e5434121561299e57600080fd5b606051600260045401806040519013156129b757600080fd5b80919012156129c557600080fd5b6103405260a051600c60c052600f5460e052604060c02054806129e757600080fd5b68056bc75e2d6310000034020580608051901315612a0457600080fd5b8091901215612a1257600080fd5b61036052600060c05260025460e052604060c02060c052602060c0206101405181556103605160018201556020546002820155600060038201556103405160048201556000600582015561016051600682015550600254600360c0526101605160e052604060c020556002606051600182540180604051901315612a9557600080fd5b8091901215612aa357600080fd5b815550600560c0526103405160e052604060c02060a0516103605182540180608051901315612ad157600080fd5b8091901215612adf57600080fd5b81555061014051610380526004600060c052600360c0526101605160e052604060c0205460e052604060c02060c052602060c02001546103a052346103c052600360c0526101605160e052604060c02054610160517fc913dcae46368ac8a73eb63d4f2077a2de58e994bf2cddf074ab3a0fcaa3a0e16060610380a3005b6342310c3260005114156130795760206004610140373415612b7e57600080fd5b61042060043560040161016037610400600435600401351115612ba057600080fd5b600060a05160165480612bb257600080fd5b6402540be40043020580608051901315612bcb57600080fd5b8091901215612bd957600080fd5b1215612c29576402540be4006402540be3ff60a05160165480612bfb57600080fd5b6402540be40043020580608051901315612c1457600080fd5b8091901215612c2257600080fd5b0305612c68565b6402540be40060a05160165480612c3f57600080fd5b6402540be40043020580608051901315612c5857600080fd5b8091901215612c6657600080fd5b055b600f5414612c7557600080fd5b6101608051602001806105c0828460006004600a8704601201f1612c9857600080fd5b50506020610a206105c0516105e06000601a54602154f1612cb857600080fd5b6020610a0052610a00602060006020835103811315612cd657600080fd5b0460200260200181015190506105a052611000610160610560610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610aa0f150506080610a605114612d2557600080fd5b610a6051610a6001806020015160008251806020901315612d4557600080fd5b8091901215612d5357600080fd5b606051816020036101000a830480604051901315612d7057600080fd5b8091901215612d7e57600080fd5b9050905090508152610a8051610a6001806020015160008251806020901315612da657600080fd5b8091901215612db457600080fd5b606051816020036101000a830480604051901315612dd157600080fd5b8091901215612ddf57600080fd5b9050905090508160200152610aa051610a600180516020018083604001828460006004600a8704601201f1612e1357600080fd5b5050506110005161148052611020516114a0526110408051602001806114c0828460006004600a8704601201f1612e4957600080fd5b50506114a051600f541215612e5d57600080fd5b6006600060c0526114805160e052604060c02060c052602060c02001543314611900526020611e00610484606063a2767400611920526105a0516119405280611960526114c0808051602001808461194001828460006004600a8704601201f1612ec657600080fd5b505080518201602001915050611480516119805261193c90506000305af1612eed57600080fd5b611e00516119005117612eff57600080fd5b6060516019546004540180604051901315612f1957600080fd5b8091901215612f2757600080fd5b611e2052611e20516002600060c0526114805160e052604060c02060c052602060c020015413612f5657600080fd5b611e20516002600060c0526114805160e052604060c02060c052602060c02001556020611ea06004634a8fd698611e4052611e5c6000305af1612f9857600080fd5b611ea0516005600060c0526114805160e052604060c02060c052602060c0200155600560c052611e205160e052604060c02060a0516001600060c0526114805160e052604060c02060c052602060c020015482540380608051901315612ffd57600080fd5b809190121561300b57600080fd5b8155506002600060c0526114805160e052604060c02060c052602060c0200154611ec052611480516006600060c0526114805160e052604060c02060c052602060c02001547fb0da0cd4d3f901fa403fa301bd3cad4934e079e9f1a5b61bdb33a03da2c9aaaf6020611ec0a3005b63edea148060005114156137a4576020600461014037341561309a57600080fd5b606051600435806040519013156130b057600080fd5b80919012156130be57600080fd5b506002600060c0526101405160e052604060c02060c052602060c0200154600454136130e957600080fd5b600860c05260605160016002600060c0526101405160e052604060c02060c052602060c0200154018060405190131561312157600080fd5b809190121561312f57600080fd5b60e052604060c020546101605260605160185461016051018060405190131561315757600080fd5b809190121561316557600080fd5b6101805261018051600f54121561317b57600080fd5b6003600060c0526101405160e052604060c02060c052602060c0200154151561332057600060a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176131e657600080fd5b6402540be40081059050905090508060805190131561320457600080fd5b809190121561321257600080fd5b121561329d576402540be4006402540be3ff60a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761326a57600080fd5b6402540be40081059050905090508060805190131561328857600080fd5b809190121561329657600080fd5b0305613317565b6402540be40060a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176132e957600080fd5b6402540be40081059050905090508060805190131561330757600080fd5b809190121561331557600080fd5b055b6101a0526136f5565b606051601460c0526060516060516018546002028060405190131561334457600080fd5b809190121561335257600080fd5b61018051038060405190131561336757600080fd5b809190121561337557600080fd5b60e052604060c02054601460c0526101805160e052604060c0205403806040519013156133a157600080fd5b80919012156133af57600080fd5b6101c05260a0516005600060c0526101405160e052604060c02060c052602060c0200154806133dd57600080fd5b6402540be4006060516023546101c05102806040519013156133fe57600080fd5b809190121561340c57600080fd5b02058060805190131561341e57600080fd5b809190121561342c57600080fd5b6101e05260a0516101e0516402540be400038060805190131561344e57600080fd5b809190121561345c57600080fd5b60006402540be400810282121561347a576402540be400810261347c565b815b9050905061020052600060a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176134cc57600080fd5b6402540be4008105905090509050806080519013156134ea57600080fd5b80919012156134f857600080fd5b1215613583576402540be4006402540be3ff60a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761355057600080fd5b6402540be40081059050905090508060805190131561356e57600080fd5b809190121561357c57600080fd5b03056135fd565b6402540be40060a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176135cf57600080fd5b6402540be4008105905090509050806080519013156135ed57600080fd5b80919012156135fb57600080fd5b055b61022052600060a0516102005161022051818102811583838305141761362257600080fd5b809050905090508060805190131561363957600080fd5b809190121561364757600080fd5b12156136a4576402540be4006402540be3ff60a0516102005161022051818102811583838305141761367857600080fd5b809050905090508060805190131561368f57600080fd5b809190121561369d57600080fd5b03056136f0565b6402540be40060a051610200516102205181810281158383830514176136c957600080fd5b80905090509050806080519013156136e057600080fd5b80919012156136ee57600080fd5b055b6101a0525b60006000600060006101a0516006600060c0526101405160e052604060c02060c052602060c02001546000f161372a57600080fd5b6101a05161024052610140516006600060c0526101405160e052604060c02060c052602060c02001547f499b9fc824d01426cfde5b95eebcfc53494a24d6316bb139b2333377f7c00e476020610240a36000600060246301b7af1861026052610140516102805261027c6000305af16137a257600080fd5b005b63e9dc0614600051141561448657602060046101403734156137c557600080fd5b610420600435600401610160376104006004356004013511156137e757600080fd5b6101608051602001806105c0828460006004600a8704601201f161380a57600080fd5b50506020610a206105c0516105e06000601a54602154f161382a57600080fd5b6020610a0052610a0060206000602083510381131561384857600080fd5b0460200260200181015190506105a0526110c0610160610620610a608251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c0610a60511461389757600080fd5b610a6051610a60018060200151600082518060209013156138b757600080fd5b80919012156138c557600080fd5b606051816020036101000a8304806040519013156138e257600080fd5b80919012156138f057600080fd5b90509050905081526020610a8051610a6001511461390d57600080fd5b610a8051610a8001518160200152610aa051610a600180602001516000825180602090131561393b57600080fd5b809190121561394957600080fd5b606051816020036101000a83048060405190131561396657600080fd5b809190121561397457600080fd5b9050905090508160400152610ac051610a600180602001516000825180602090131561399f57600080fd5b80919012156139ad57600080fd5b606051816020036101000a8304806040519013156139ca57600080fd5b80919012156139d857600080fd5b9050905090508160600152610ae051610a600180516020018083608001828460006004600a8704601201f1613a0c57600080fd5b5050506110c051611580526110e0516115a052611100516115c052611120516115e052611140805160200180611600828460006004600a8704601201f1613a5257600080fd5b50506020611f20610484606063a2767400611a40526105a051611a605280611a80526116008080516020018084611a6001828460006004600a8704601201f1613a9a57600080fd5b50508051820160200191505061158051611aa052611a5c90506000305af1613ac157600080fd5b611f2051613ace57600080fd5b6001606051610100611580510780604051901315613aeb57600080fd5b8091901215613af957600080fd5b6000811215613b10578060000360020a8204613b17565b8060020a82025b905090506006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613b5e57600080fd5b8091901215613b6c57600080fd5b1215613bb5576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613ba057600080fd5b8091901215613bae57600080fd5b0305613bed565b6402540be40060a0516101006402540be40061158051020580608051901315613bdd57600080fd5b8091901215613beb57600080fd5b055b60e052604060c020541615613c0157600080fd5b6020611fa0600463855f372c611f4052611f5c6000305af1613c2257600080fd5b611fa0516115a05114613c3457600080fd5b600f546115c05114613c4557600080fd5b6003600a60c0526115e05160e052604060c02060c052602060c0200154613c6b57600080fd5b6004600060c0526115805160e052604060c02060c052602060c0200154611fc0526002600060c0526115805160e052604060c02060c052602060c0200154611fe052600454612000526060516001612000510380604051901315613cce57600080fd5b8091901215613cdc57600080fd5b61202052611fe051612000511261200051611fc05113151661204052611fe051612020511261202051611fc05113151661206052612060516120405117613d2257600080fd5b6001606051610100611580510780604051901315613d3f57600080fd5b8091901215613d4d57600080fd5b6000811215613d64578060000360020a8204613d6b565b8060020a82025b905090506006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613db257600080fd5b8091901215613dc057600080fd5b1215613e09576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613df457600080fd5b8091901215613e0257600080fd5b0305613e41565b6402540be40060a0516101006402540be40061158051020580608051901315613e3157600080fd5b8091901215613e3f57600080fd5b055b60e052604060c02054176006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613e8e57600080fd5b8091901215613e9c57600080fd5b1215613ee5576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613ed057600080fd5b8091901215613ede57600080fd5b0305613f1d565b6402540be40060a0516101006402540be40061158051020580608051901315613f0d57600080fd5b8091901215613f1b57600080fd5b055b60e052604060c020556001600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c02054612080526005600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020546120a05261204051156140075761208060a0516001600060c0526115805160e052604060c02060c052602060c020015482510180608051901315613fc557600080fd5b8091901215613fd357600080fd5b815250612080516001600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020555b6120605115614088576120a060a0516001600060c0526115805160e052604060c02060c052602060c02001548251018060805190131561404657600080fd5b809190121561405457600080fd5b8152506120a0516005600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020555b6115e051601354141561421657600060a0516012546001600060c0526115805160e052604060c02060c052602060c020015481810281158383830514176140ce57600080fd5b6402540be4008105905090509050806080519013156140ec57600080fd5b80919012156140fa57600080fd5b1215614176576402540be4006402540be3ff60a0516012546001600060c0526115805160e052604060c02060c052602060c0200154818102811583838305141761414357600080fd5b6402540be40081059050905090508060805190131561416157600080fd5b809190121561416f57600080fd5b03056141e1565b6402540be40060a0516012546001600060c0526115805160e052604060c02060c052602060c020015481810281158383830514176141b357600080fd5b6402540be4008105905090509050806080519013156141d157600080fd5b80919012156141df57600080fd5b055b6120c05260006000604463579f38b26120e05261158051612100526120c051612120526120fc6000305af161421557600080fd5b5b6003600a60c0526115c05160e052604060c02060c052602060c02001541560a051600360a0516002600754818102811583838305141761425557600080fd5b809050905090508060805190131561426c57600080fd5b809190121561427a57600080fd5b058060805190131561428b57600080fd5b809190121561429957600080fd5b6120a051121560a051600360a051600260065481810281158383830514176142c057600080fd5b80905090509050806080519013156142d757600080fd5b80919012156142e557600080fd5b05806080519013156142f657600080fd5b809190121561430457600080fd5b6120805112151616156144285760016003600a60c0526115c05160e052604060c02060c052602060c02001556115c0516011556001600b5560016121805260006121a052600160c0526115c05160e052604060c020546115c0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96040612180a360605160016115e051018060405190131561439f57600080fd5b80919012156143ad57600080fd5b6115c05114156144275760016002600a60c0526115e05160e052604060c02060c052602060c02001556115e05160105560016121c05260016121e052600160c0526115e05160e052604060c020546115e0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b960406121c0a35b5b6115c051612200526115e051612220526115a051611580516006600060c0526115805160e052604060c02060c052602060c02001547f0fa814a7606272ed601db3d9974a12a26536f050d147ad209b7e7b0a95746f176040612200a4005b63cc20f16b6000511415614ab057604060046101403734156144a757600080fd5b610420600435600401610180376104006004356004013511156144c957600080fd5b6104206024356004016105c0376104006024356004013511156144eb57600080fd5b60206112e061088460406313d21fa3610a005280610a20526101808080516020018084610a2001828460006004600a8704601201f161452957600080fd5b50508051820160200191505080610a40526105c08080516020018084610a2001828460006004600a8704601201f161456057600080fd5b505080518201602001915050610a1c90506000305af161457f57600080fd5b6112e05161458c57600080fd5b6119606101806106206113008251602084016000735185d17c44699cecc3133114f8df70753b856709610dc0f1505060c061130051146145cb57600080fd5b61130051611300018060200151600082518060209013156145eb57600080fd5b80919012156145f957600080fd5b606051816020036101000a83048060405190131561461657600080fd5b809190121561462457600080fd5b905090509050815260206113205161130001511461464157600080fd5b6113205161132001518160200152611340516113000180602001516000825180602090131561466f57600080fd5b809190121561467d57600080fd5b606051816020036101000a83048060405190131561469a57600080fd5b80919012156146a857600080fd5b905090509050816040015261136051611300018060200151600082518060209013156146d357600080fd5b80919012156146e157600080fd5b606051816020036101000a8304806040519013156146fe57600080fd5b809190121561470c57600080fd5b9050905090508160600152611380516113000180516020018083608001828460006004600a8704601201f161474057600080fd5b50505061196051611e20526020611ee060246399fb5eec611e6052611e2051611e8052611e7c6000305af161477457600080fd5b611ee051611e4052600060a05160196402540be400611e405102058060805190131561479f57600080fd5b80919012156147ad57600080fd5b12156147f5576402540be4006402540be3ff60a05160196402540be400611e40510205806080519013156147e057600080fd5b80919012156147ee57600080fd5b030561482c565b6402540be40060a05160196402540be400611e405102058060805190131561481c57600080fd5b809190121561482a57600080fd5b055b611f0052606051611f0051611e4051038060405190131561484c57600080fd5b809190121561485a57600080fd5b611f2052601460c052600f5460e052604060c020606051611e40518254018060405190131561488857600080fd5b809190121561489657600080fd5b81555060016003600060c052611e205160e052604060c02060c052602060c0200155611f0051611f4052611f2051611f6052611e20516006600060c052611e205160e052604060c02060c052602060c0200154337fb63bb46c05149b79f409b978407acff3bb3bfb5fb728ed2909fdb52677c220da6040611f40a46002600060c052611e205160e052604060c02060c052602060c0200154611f8052611f80516004541215614a95576001600060c052611e205160e052604060c02060c052602060c0200154611fa052600560c0526060516001600454018060405190131561497e57600080fd5b809190121561498c57600080fd5b60e052604060c02060a051611fa051825403806080519013156149ae57600080fd5b80919012156149bc57600080fd5b815550606051600160045401806040519013156149d857600080fd5b80919012156149e657600080fd5b6002600060c052611e205160e052604060c02060c052602060c0200155602054611f80511215614a5157600560c052611f805160e052604060c02060a051611fa05182540180608051901315614a3b57600080fd5b8091901215614a4957600080fd5b815550614a94565b60206120206004634a8fd698611fc052611fdc6000305af1614a7257600080fd5b612020516005600060c052611e205160e052604060c02060c052602060c02001555b5b6000600060006000611f0051336000f1614aae57600080fd5b005b63bcc44d996000511415614b1d5760206004610140373415614ad157600080fd5b60605160043580604051901315614ae757600080fd5b8091901215614af557600080fd5b506001600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63faf944fa6000511415614b8a5760206004610140373415614b3e57600080fd5b60605160043580604051901315614b5457600080fd5b8091901215614b6257600080fd5b506004600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63c253bf416000511415614bf75760206004610140373415614bab57600080fd5b60605160043580604051901315614bc157600080fd5b8091901215614bcf57600080fd5b506002600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b633b4f3ae36000511415614c645760206004610140373415614c1857600080fd5b60605160043580604051901315614c2e57600080fd5b8091901215614c3c57600080fd5b506003600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b6306fcf2ff6000511415614cd15760206004610140373415614c8557600080fd5b60605160043580604051901315614c9b57600080fd5b8091901215614ca957600080fd5b506005600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63bb0115f06000511415614d3b5760206004610140373415614cf257600080fd5b60605160043580604051901315614d0857600080fd5b8091901215614d1657600080fd5b50600060c0526101405160e052604060c02060c052602060c0205460005260206000f3005b635dbfd1ce6000511415614da85760206004610140373415614d5c57600080fd5b60605160043580604051901315614d7257600080fd5b8091901215614d8057600080fd5b506006600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b638208b8756000511415614e0a5760206004610140373415614dc957600080fd5b60605160043580604051901315614ddf57600080fd5b8091901215614ded57600080fd5b50600160c0526101405160e052604060c0205460005260206000f3005b637d69c5d96000511415614e30573415614e2357600080fd5b60025460005260206000f3005b63dc2059b36000511415614e7f5760206004610140373415614e5157600080fd5b6004356020518110614e6257600080fd5b50600360c0526101405160e052604060c0205460005260206000f3005b637060054d6000511415614ea5573415614e9857600080fd5b60045460005260206000f3005b63c44dc6596000511415614f075760206004610140373415614ec657600080fd5b60605160043580604051901315614edc57600080fd5b8091901215614eea57600080fd5b50600560c0526101405160e052604060c0205460005260206000f3005b63a2630bae6000511415614f695760206004610140373415614f2857600080fd5b60605160043580604051901315614f3e57600080fd5b8091901215614f4c57600080fd5b50600860c0526101405160e052604060c0205460005260206000f3005b6365ca80e66000511415614fcb5760206004610140373415614f8a57600080fd5b60605160043580604051901315614fa057600080fd5b8091901215614fae57600080fd5b50600960c0526101405160e052604060c0205460005260206000f3005b634af8e81a60005114156150355760206004610140373415614fec57600080fd5b6060516004358060405190131561500257600080fd5b809190121561501057600080fd5b50600a60c0526101405160e052604060c02060c052602060c0205460005260206000f3005b6326becf5860005114156150a2576020600461014037341561505657600080fd5b6060516004358060405190131561506c57600080fd5b809190121561507a57600080fd5b506004600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63be26608e600051141561514357604060046101403734156150c357600080fd5b606051600435806040519013156150d957600080fd5b80919012156150e757600080fd5b50606051602435806040519013156150fe57600080fd5b809190121561510c57600080fd5b506001600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b633673fd9860005114156151e4576040600461014037341561516457600080fd5b6060516004358060405190131561517a57600080fd5b809190121561518857600080fd5b506060516024358060405190131561519f57600080fd5b80919012156151ad57600080fd5b506005600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b63e270eb666000511415615285576040600461014037341561520557600080fd5b6060516004358060405190131561521b57600080fd5b809190121561522957600080fd5b506060516024358060405190131561524057600080fd5b809190121561524e57600080fd5b506006600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b6330d3c41a60005114156152f257602060046101403734156152a657600080fd5b606051600435806040519013156152bc57600080fd5b80919012156152ca57600080fd5b506003600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63cfff38c0600051141561535f576020600461014037341561531357600080fd5b6060516004358060405190131561532957600080fd5b809190121561533757600080fd5b506002600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b6399787ac6600051141561538557341561537857600080fd5b600b5460005260206000f3005b63e430757f60005114156153e757602060046101403734156153a657600080fd5b606051600435806040519013156153bc57600080fd5b80919012156153ca57600080fd5b50600c60c0526101405160e052604060c0205460005260206000f3005b638a484407600051141561540d57341561540057600080fd5b600d5460005260206000f3005b63e6b57366600051141561543357341561542657600080fd5b600e5460005260206000f3005b639372b4e4600051141561545957341561544c57600080fd5b600f5460005260206000f3005b632eff8759600051141561547f57341561547257600080fd5b60105460005260206000f3005b635f61165060005114156154a557341561549857600080fd5b60115460005260206000f3005b6307dcf45b60005114156154cb5734156154be57600080fd5b60125460005260206000f3005b635b03544a60005114156154f15734156154e457600080fd5b60135460005260206000f3005b634c7756756000511415615553576020600461014037341561551257600080fd5b6060516004358060405190131561552857600080fd5b809190121561553657600080fd5b50601460c0526101405160e052604060c0205460005260206000f3005b63ac4746ab600051141561557957341561556c57600080fd5b60165460005260206000f3005b6397fbdf08600051141561559f57341561559257600080fd5b60175460005260206000f3005b630ebb172a60005114156155c55734156155b857600080fd5b60185460005260206000f3005b634f4ddb5e60005114156155eb5734156155de57600080fd5b60195460005260206000f3005b633f8a500e600051141561561157341561560457600080fd5b601c5460005260206000f3005b6361073e88600051141561563757341561562a57600080fd5b601d5460005260206000f3005b6326c0817e600051141561565d57341561565057600080fd5b601e5460005260206000f3005b63d4b31281600051141561568357341561567657600080fd5b601f5460005260206000f3005b" +"600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526358c4540b60005114156103fa5761012060046101403734156100b557600080fd5b606051600435806040519013156100cb57600080fd5b80919012156100d957600080fd5b50606051602435806040519013156100f057600080fd5b80919012156100fe57600080fd5b506060516044358060405190131561011557600080fd5b809190121561012357600080fd5b506060516064358060405190131561013a57600080fd5b809190121561014857600080fd5b50608435602051811061015a57600080fd5b5060a435602051811061016c57600080fd5b50606051610104358060405190131561018457600080fd5b809190121561019257600080fd5b50601554156101a057600080fd5b610100610140511260006101405113166101b957600080fd5b60006101605112156101ca57600080fd5b60006101805112156101db57600080fd5b60026101a05112156101ec57600080fd5b60006102005112156101fd57600080fd5b600061022051121561020e57600080fd5b6000610240511361021e57600080fd5b60016015556101405160165561016051601755610180516018556101a05160195561020051601c5561022051601d5561024051601e55600060a0516016548061026657600080fd5b6402540be4006060516101605143018060405190131561028557600080fd5b809190121561029357600080fd5b0205806080519013156102a557600080fd5b80919012156102b357600080fd5b1215610329576402540be4006402540be3ff60a051601654806102d557600080fd5b6402540be400606051610160514301806040519013156102f457600080fd5b809190121561030257600080fd5b02058060805190131561031457600080fd5b809190121561032257600080fd5b030561038e565b6402540be40060a0516016548061033f57600080fd5b6402540be4006060516101605143018060405190131561035e57600080fd5b809190121561036c57600080fd5b02058060805190131561037e57600080fd5b809190121561038c57600080fd5b055b601f556101c051601a556101e051601b5560016002556000600455601f54600f5568056bc75e2d63100000600c60c052600f5460e052604060c02055600060065560006007556c0c9f2c9cd04674edea4000000060205562030d4060215562030d406022556003602355005b639a8eec77600051141561045157341561041357600080fd5b30331461041f57600080fd5b606051601054600f54038060405190131561043957600080fd5b809190121561044757600080fd5b60005260206000f3005b63db23eee060005114156107f757341561046a57600080fd5b30331461047657600080fd5b600f54610140526060516001600060a051670de0b6b3a764000060a051600c60c05260605160016101405103806040519013156104b257600080fd5b80919012156104c057600080fd5b60e052604060c02054600754600654808212156104dd57806104df565b815b9050905081810281158383830514176104f757600080fd5b6402540be40081059050905090508060805190131561051557600080fd5b809190121561052357600080fd5b058060805190131561053457600080fd5b809190121561054257600080fd5b1215610619576402540be4006402540be3ff60a051670de0b6b3a764000060a051600c60c052606051600161014051038060405190131561058257600080fd5b809190121561059057600080fd5b60e052604060c02054600754600654808212156105ad57806105af565b815b9050905081810281158383830514176105c757600080fd5b6402540be4008105905090509050806080519013156105e557600080fd5b80919012156105f357600080fd5b058060805190131561060457600080fd5b809190121561061257600080fd5b03056106df565b6402540be40060a051670de0b6b3a764000060a051600c60c052606051600161014051038060405190131561064d57600080fd5b809190121561065b57600080fd5b60e052604060c0205460075460065480821215610678578061067a565b815b90509050818102811583838305141761069257600080fd5b6402540be4008105905090509050806080519013156106b057600080fd5b80919012156106be57600080fd5b05806080519013156106cf57600080fd5b80919012156106dd57600080fd5b055b01806040519013156106f057600080fd5b80919012156106fe57600080fd5b6101605260a0516404a817c80068056bc75e2d631000006101605102058060805190131561072b57600080fd5b809190121561073957600080fd5b610180526101a060006014818352015b60a051600260a05160a051610180518061076257600080fd5b68056bc75e2d631000006101605102058060805190131561078257600080fd5b809190121561079057600080fd5b6101805101806080519013156107a557600080fd5b80919012156107b357600080fd5b05806080519013156107c457600080fd5b80919012156107d257600080fd5b610180525b8151600101808352811415610749575b50506101805160005260206000f3005b63de7f9975600051141561083357341561081057600080fd5b30331461081c57600080fd5b6000600754136000600654131660005260206000f3005b63d286bb82600051141561097657341561084c57600080fd5b30331461085857600080fd5b600f54610140526002600a60c052606051600261014051038060405190131561088057600080fd5b809190121561088e57600080fd5b60e052604060c02060c052602060c0200154156109265760046060516001825401806040519013156108bf57600080fd5b80919012156108cd57600080fd5b815550600654600755600660a051600560c05260045460e052604060c02054825401806080519013156108ff57600080fd5b809190121561090d57600080fd5b81555061014051600860c05260045460e052604060c020555b600454600960c0526101405160e052604060c02055600b541561096f57606051600161014051038060405190131561095d57600080fd5b809190121561096b57600080fd5b6013555b6000600b55005b636526ed726000511415610b1657341561098f57600080fd5b30331461099b57600080fd5b600f54610140526001600b5560016003600a60c05260605160016101405103806040519013156109ca57600080fd5b80919012156109d857600080fd5b60e052604060c02060c052602060c020015560016002600a60c0526060516001610140510380604051901315610a0d57600080fd5b8091901215610a1b57600080fd5b60e052604060c02060c052602060c02001556060516001610140510380604051901315610a4757600080fd5b8091901215610a5557600080fd5b6011556060516001610140510380604051901315610a7257600080fd5b8091901215610a8057600080fd5b601055600161016052600161018052600160c0526060516001610140510380604051901315610aae57600080fd5b8091901215610abc57600080fd5b60e052604060c020546060516001610140510380604051901315610adf57600080fd5b8091901215610aed57600080fd5b7f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96040610160a3005b63acc619c36000511415610d61573415610b2f57600080fd5b303314610b3b57600080fd5b600f5461014052600260206101e06004639a8eec776101805261019c6000305af1610b6557600080fd5b6101e05113156101605261016051156020610260600463de7f99756102005261021c6000305af1610b9557600080fd5b61026051151715610bab57600060005260206000f35b60a0516001600a60c0526060516001610140510380604051901315610bcf57600080fd5b8091901215610bdd57600080fd5b60e052604060c02060c052602060c0200160c05260135460e052604060c0205460065480610c0a57600080fd5b806402540be4008302059050905080608051901315610c2857600080fd5b8091901215610c3657600080fd5b6102805260a0516005600a60c0526060516001610140510380604051901315610c5e57600080fd5b8091901215610c6c57600080fd5b60e052604060c02060c052602060c0200160c05260135460e052604060c0205460075480610c9957600080fd5b806402540be4008302059050905080608051901315610cb757600080fd5b8091901215610cc557600080fd5b6102a052610280516102a05180821315610cdf5780610ce1565b815b905090506102c05260a051600260a0516012546102c0518181028115838383051417610d0c57600080fd5b6402540be400810590509050905080608051901315610d2a57600080fd5b8091901215610d3857600080fd5b0580608051901315610d4957600080fd5b8091901215610d5757600080fd5b60005260206000f3005b63579f38b260005114156111215760406004610140373415610d8257600080fd5b303314610d8e57600080fd5b60605160043580604051901315610da457600080fd5b8091901215610db257600080fd5b5060605160243580604051901315610dc957600080fd5b8091901215610dd757600080fd5b506001600060c0526101405160e052604060c02060c052602060c0200160a0516402540be400610160510282540180608051901315610e1557600080fd5b8091901215610e2357600080fd5b8155506004600060c0526101405160e052604060c02060c052602060c0200154610180526002600060c0526101405160e052604060c02060c052602060c02001546101a0526004546101c05260605160016101c0510380604051901315610e8957600080fd5b8091901215610e9757600080fd5b6101e0526101a0516101c051126101c0516101805113151615610ee957600660a0516402540be400610160510282540180608051901315610ed757600080fd5b8091901215610ee557600080fd5b8155505b6101a0516101e051126101e0516101805113151615610f3757600760a0516402540be400610160510282540180608051901315610f2557600080fd5b8091901215610f3357600080fd5b8155505b6020546101a0511215610f8857600560c0526101a05160e052604060c02060a0516402540be400610160510282540380608051901315610f7657600080fd5b8091901215610f8457600080fd5b8155505b6000600060006000600060a051600860a051600c60c052600f5460e052604060c02054610160518181028115838383051417610fc357600080fd5b8090509050905080608051901315610fda57600080fd5b8091901215610fe857600080fd5b0580608051901315610ff957600080fd5b809190121561100757600080fd5b1215611095576402540be4006402540be3ff60a051600860a051600c60c052600f5460e052604060c0205461016051818102811583838305141761104a57600080fd5b809050905090508060805190131561106157600080fd5b809190121561106f57600080fd5b058060805190131561108057600080fd5b809190121561108e57600080fd5b0305611112565b6402540be40060a051600860a051600c60c052600f5460e052604060c020546101605181810281158383830514176110cc57600080fd5b80905090509050806080519013156110e357600080fd5b80919012156110f157600080fd5b058060805190131561110257600080fd5b809190121561111057600080fd5b055b416000f161111f57600080fd5b005b6301b7af1860005114156111ea576020600461014037341561114257600080fd5b30331461114e57600080fd5b6060516004358060405190131561116457600080fd5b809190121561117257600080fd5b506000600360c0526006600060c0526101405160e052604060c02060c052602060c020015460e052604060c02055600060c0526101405160e052604060c02060c052602060c0206000815560006001820155600060028201556000600382015560006004820155600060058201556000600682015550005b63a2767400600051141561132f576060600461014037341561120b57600080fd5b30331461121757600080fd5b6104206024356004016101a03761040060243560040135111561123957600080fd5b6060516044358060405190131561124f57600080fd5b809190121561125d57600080fd5b5060016000610140516020826105e00101526020810190506101a0610400806020846105e001018260208501600060046078f1505080518201915050806105e0526105e09050805160200180610a40828460006004600a8704601201f16112c357600080fd5b50506020610ec0610a4051610a606000600060c0526101805160e052604060c02060c052602060c02054602254f16112fa57600080fd5b6020610ea052610ea060206000602083510381131561131857600080fd5b0460200260200181015190501460005260206000f3005b6337df0ba8600051141561143257341561134857600080fd5b60a0516001600a60c052600f5460e052604060c02060c052602060c0200160c05260135460e052604060c020546006548061138257600080fd5b806402540be40083020590509050806080519013156113a057600080fd5b80919012156113ae57600080fd5b60a0516005600a60c052600f5460e052604060c02060c052602060c0200160c05260135460e052604060c02054600754806113e857600080fd5b806402540be400830205905090508060805190131561140657600080fd5b809190121561141457600080fd5b808213156114225780611424565b815b9050905060005260206000f3005b6399fb5eec60005114156115f8576020600461014037341561145357600080fd5b6060516004358060405190131561146957600080fd5b809190121561147757600080fd5b50600060a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176114bf57600080fd5b6402540be4008105905090509050806080519013156114dd57600080fd5b80919012156114eb57600080fd5b1215611575576402540be4006402540be3ff60a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761154257600080fd5b6402540be40081059050905090508060805190131561156057600080fd5b809190121561156e57600080fd5b03056115ee565b6402540be40060a051600c60c052600f5460e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176115c057600080fd5b6402540be4008105905090509050806080519013156115de57600080fd5b80919012156115ec57600080fd5b055b60005260206000f3005b634a8fd698600051141561174357341561161157600080fd5b600060a051600c60c052600f5460e052604060c02054600654818102811583838305141761163e57600080fd5b6402540be40081059050905090508060805190131561165c57600080fd5b809190121561166a57600080fd5b12156116da576402540be4006402540be3ff60a051600c60c052600f5460e052604060c0205460065481810281158383830514176116a757600080fd5b6402540be4008105905090509050806080519013156116c557600080fd5b80919012156116d357600080fd5b0305611739565b6402540be40060a051600c60c052600f5460e052604060c02054600654818102811583838305141761170b57600080fd5b6402540be40081059050905090508060805190131561172957600080fd5b809190121561173757600080fd5b055b60005260206000f3005b637db2eedc600051141561188e57341561175c57600080fd5b600060a051600c60c052600f5460e052604060c02054600754818102811583838305141761178957600080fd5b6402540be4008105905090509050806080519013156117a757600080fd5b80919012156117b557600080fd5b1215611825576402540be4006402540be3ff60a051600c60c052600f5460e052604060c0205460075481810281158383830514176117f257600080fd5b6402540be40081059050905090508060805190131561181057600080fd5b809190121561181e57600080fd5b0305611884565b6402540be40060a051600c60c052600f5460e052604060c02054600754818102811583838305141761185657600080fd5b6402540be40081059050905090508060805190131561187457600080fd5b809190121561188257600080fd5b055b60005260206000f3005b6313d21fa36000511415611f6c57604060046101403734156118af57600080fd5b610420600435600401610180376104006004356004013511156118d157600080fd5b6104206024356004016105c0376104006024356004013511156118f357600080fd5b610180805160200180610a20828460006004600a8704601201f161191657600080fd5b50506020610e80610a2051610a406000601a54602154f161193657600080fd5b6020610e6052610e6060206000602083510381131561195457600080fd5b046020026020018101519050610a0052611520610180610620610ec0825160208401600073610dc0f1505060c0610ec051146119a357600080fd5b610ec051610ec0018060200151600082518060209013156119c357600080fd5b80919012156119d157600080fd5b606051816020036101000a8304806040519013156119ee57600080fd5b80919012156119fc57600080fd5b90509050905081526020610ee051610ec0015114611a1957600080fd5b610ee051610ee001518160200152610f0051610ec001806020015160008251806020901315611a4757600080fd5b8091901215611a5557600080fd5b606051816020036101000a830480604051901315611a7257600080fd5b8091901215611a8057600080fd5b9050905090508160400152610f2051610ec001806020015160008251806020901315611aab57600080fd5b8091901215611ab957600080fd5b606051816020036101000a830480604051901315611ad657600080fd5b8091901215611ae457600080fd5b9050905090508160600152610f4051610ec00180516020018083608001828460006004600a8704601201f1611b1857600080fd5b505050611520516119e05261156051611a005261158051611a20526115a0805160200180611a40828460006004600a8704601201f1611b5657600080fd5b50506105c0805160200180611ea0828460006004600a8704601201f1611b7b57600080fd5b50506020612300611ea051611ec06000601a54602154f1611b9b57600080fd5b60206122e0526122e0602060006020835103811315611bb957600080fd5b046020026020018101519050611e80526129a06105c0610620612340825160208401600073610dc0f1505060c06123405114611c0857600080fd5b6123405161234001806020015160008251806020901315611c2857600080fd5b8091901215611c3657600080fd5b606051816020036101000a830480604051901315611c5357600080fd5b8091901215611c6157600080fd5b9050905090508152602061236051612340015114611c7e57600080fd5b61236051612360015181602001526123805161234001806020015160008251806020901315611cac57600080fd5b8091901215611cba57600080fd5b606051816020036101000a830480604051901315611cd757600080fd5b8091901215611ce557600080fd5b90509050905081604001526123a05161234001806020015160008251806020901315611d1057600080fd5b8091901215611d1e57600080fd5b606051816020036101000a830480604051901315611d3b57600080fd5b8091901215611d4957600080fd5b90509050905081606001526123c0516123400180516020018083608001828460006004600a8704601201f1611d7d57600080fd5b5050506129a051612e60526129e051612e8052612a0051612ea052612a20805160200180612ec0828460006004600a8704601201f1611dbb57600080fd5b505060206137e0610484606063a276740061330052610a0051613320528061334052611a40808051602001808461332001828460006004600a8704601201f1611e0357600080fd5b5050805182016020019150506119e0516133605261331c90506000305af1611e2a57600080fd5b6137e0511515611e3f57600060005260206000f35b6020613ce0610484606063a276740061380052611e8051613820528061384052612ec0808051602001808461382001828460006004600a8704601201f1611e8557600080fd5b505080518201602001915050612e60516138605261381c90506000305af1611eac57600080fd5b613ce0511515611ec157600060005260206000f35b612e60516119e051141515611edb57600060005260206000f35b611e8051610a00511415611ef457600060005260206000f35b6003600060c0526119e05160e052604060c02060c052602060c020015415611f2157600060005260206000f35b612e8051611a005114613d0052611a2051612ea05112611a0051612e80511316612ea051611a205112612e8051611a0051131617613d2052613d2051613d00511760005260206000f3005b6310f246356000511415611f92573415611f8557600080fd5b60135460005260206000f3005b63855f372c600051141561201f573415611fab57600080fd5b6060516001606051601654600f540280604051901315611fca57600080fd5b8091901215611fd857600080fd5b0380604051901315611fe957600080fd5b8091901215611ff757600080fd5b610100430381121561200857600080fd5b43811061201457600080fd5b4060005260206000f3005b635c0a75de6000511415612167576020600461014037341561204057600080fd5b6060516004358060405190131561205657600080fd5b809190121561206457600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f54038060405190131561209857600080fd5b80919012156120a657600080fd5b610160526003600a60c0526101605160e052604060c02060c052602060c02001546101a05261014051600a60c0526101605160e052604060c02060c052602060c0205412156101c052610140516004600a60c0526101605160e052604060c02060c052602060c020015412156101e0526101e0516101c051166101a0511615612136576101605160005260206000f35b601f5461016051141561214857612159565b5b815160010180835281141561207d575b5050600060005260206000f3005b631f994c4060005114156122ce576020600461014037341561218857600080fd5b6060516004358060405190131561219e57600080fd5b80919012156121ac57600080fd5b5061018060006c0c9f2c9cd04674edea40000000818352015b60605161018051600f5403806040519013156121e057600080fd5b80919012156121ee57600080fd5b610160526002600a60c0526101605160e052604060c02060c052602060c02001546101a05261014051600a60c0526101605160e052604060c02060c052602060c0205412156101c052610140516004600a60c0526101605160e052604060c02060c052602060c020015412156101e0526101e0516101c051166101a051161561227e576101605160005260206000f35b601f54610160511415612290576122a1565b5b81516001018083528114156121c5575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60005260206000f3005b635dcffc17600051141561285457602060046101403734156122ef57600080fd5b6060516004358060405190131561230557600080fd5b809190121561231357600080fd5b50600060a0516016548061232657600080fd5b6402540be4004302058060805190131561233f57600080fd5b809190121561234d57600080fd5b121561239d576402540be4006402540be3ff60a0516016548061236f57600080fd5b6402540be4004302058060805190131561238857600080fd5b809190121561239657600080fd5b03056123dc565b6402540be40060a051601654806123b357600080fd5b6402540be400430205806080519013156123cc57600080fd5b80919012156123da57600080fd5b055b610160526060516001600f5401806040519013156123f957600080fd5b809190121561240757600080fd5b6101405114610160516101405113151661242057600080fd5b60206101e06004634a8fd6986101805261019c6000305af161244157600080fd5b6101e051600a60c0526101405160e052604060c02060c052602060c0205560206102606004637db2eedc6102005261021c6000305af161248057600080fd5b610260516004600a60c0526101405160e052604060c02060c052602060c020015561014051600f5560a05160206102e0600463acc619c36102805261029c6000305af16124cc57600080fd5b6102e0516402540be40001806080519013156124e757600080fd5b80919012156124f557600080fd5b600e5560a051600e5460a0516012546402540be400018060805190131561251b57600080fd5b809190121561252957600080fd5b8061253357600080fd5b806402540be400830205905090508060805190131561255157600080fd5b809190121561255f57600080fd5b600d5560a051600d54600c60c052606051600161014051038060405190131561258757600080fd5b809190121561259557600080fd5b60e052604060c0205481810281158383830514176125b257600080fd5b6402540be4008105905090509050806080519013156125d057600080fd5b80919012156125de57600080fd5b600c60c0526101405160e052604060c02055601460c052606051600161014051038060405190131561260f57600080fd5b809190121561261d57600080fd5b60e052604060c02054601460c0526101405160e052604060c0205560206103c0600463de7f99756103605261037c6000305af161265957600080fd5b6103c0511561278c5760a051601c546020610460600463db23eee06104005261041c6000305af161268957600080fd5b610460518061269757600080fd5b806402540be40083020590509050806080519013156126b557600080fd5b80919012156126c357600080fd5b6103e05260a05160a051606051600260206104e06004639a8eec776104805261049c6000305af16126f357600080fd5b6104e051038060405190131561270857600080fd5b809190121561271657600080fd5b601d54818102811583838305141761272d57600080fd5b809050905090508060805190131561274457600080fd5b809190121561275257600080fd5b6103e051018060805190131561276757600080fd5b809190121561277557600080fd5b60125560006012541361278757600080fd5b6127b2565b600060006004636526ed726103005261031c6000305af16127ac57600080fd5b60006012555b6020610560600463855f372c6105005261051c6000305af16127d357600080fd5b61056051600160c0526101405160e052604060c0205560006000600463d286bb826105805261059c6000305af161280957600080fd5b60006105e052600061060052600160c0526101405160e052604060c02054610140517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b960406105e0a3005b63f9609f086000511415612b5d576040600461014037600435602051811061287b57600080fd5b50602435602051811061288d57600080fd5b50600060006004610180527fa1903eab000000000000000000000000000000000000000000000000000000006101a0526101806004806020846101e001018260208501600060046012f1505080518201915050610140516020826101e0010152602081019050806101e0526101e09050805160200180610260828460006004600a8704601201f161291d57600080fd5b50506020610300610260516102806000601b546207a120f161293e57600080fd5b60206102e0526102e060206000602083510381131561295c57600080fd5b046020026020018101519050141561297357600080fd5b600360c0526101605160e052604060c020541561298f57600080fd5b601e5434121561299e57600080fd5b606051600260045401806040519013156129b757600080fd5b80919012156129c557600080fd5b6103405260a051600c60c052600f5460e052604060c02054806129e757600080fd5b68056bc75e2d6310000034020580608051901315612a0457600080fd5b8091901215612a1257600080fd5b61036052600060c05260025460e052604060c02060c052602060c0206101405181556103605160018201556020546002820155600060038201556103405160048201556000600582015561016051600682015550600254600360c0526101605160e052604060c020556002606051600182540180604051901315612a9557600080fd5b8091901215612aa357600080fd5b815550600560c0526103405160e052604060c02060a0516103605182540180608051901315612ad157600080fd5b8091901215612adf57600080fd5b81555061014051610380526004600060c052600360c0526101605160e052604060c0205460e052604060c02060c052602060c02001546103a052346103c052600360c0526101605160e052604060c02054610160517fc913dcae46368ac8a73eb63d4f2077a2de58e994bf2cddf074ab3a0fcaa3a0e16060610380a3005b6342310c3260005114156130795760206004610140373415612b7e57600080fd5b61042060043560040161016037610400600435600401351115612ba057600080fd5b600060a05160165480612bb257600080fd5b6402540be40043020580608051901315612bcb57600080fd5b8091901215612bd957600080fd5b1215612c29576402540be4006402540be3ff60a05160165480612bfb57600080fd5b6402540be40043020580608051901315612c1457600080fd5b8091901215612c2257600080fd5b0305612c68565b6402540be40060a05160165480612c3f57600080fd5b6402540be40043020580608051901315612c5857600080fd5b8091901215612c6657600080fd5b055b600f5414612c7557600080fd5b6101608051602001806105c0828460006004600a8704601201f1612c9857600080fd5b50506020610a206105c0516105e06000601a54602154f1612cb857600080fd5b6020610a0052610a00602060006020835103811315612cd657600080fd5b0460200260200181015190506105a052611000610160610560610a60825160208401600073610aa0f150506080610a605114612d2557600080fd5b610a6051610a6001806020015160008251806020901315612d4557600080fd5b8091901215612d5357600080fd5b606051816020036101000a830480604051901315612d7057600080fd5b8091901215612d7e57600080fd5b9050905090508152610a8051610a6001806020015160008251806020901315612da657600080fd5b8091901215612db457600080fd5b606051816020036101000a830480604051901315612dd157600080fd5b8091901215612ddf57600080fd5b9050905090508160200152610aa051610a600180516020018083604001828460006004600a8704601201f1612e1357600080fd5b5050506110005161148052611020516114a0526110408051602001806114c0828460006004600a8704601201f1612e4957600080fd5b50506114a051600f541215612e5d57600080fd5b6006600060c0526114805160e052604060c02060c052602060c02001543314611900526020611e00610484606063a2767400611920526105a0516119405280611960526114c0808051602001808461194001828460006004600a8704601201f1612ec657600080fd5b505080518201602001915050611480516119805261193c90506000305af1612eed57600080fd5b611e00516119005117612eff57600080fd5b6060516019546004540180604051901315612f1957600080fd5b8091901215612f2757600080fd5b611e2052611e20516002600060c0526114805160e052604060c02060c052602060c020015413612f5657600080fd5b611e20516002600060c0526114805160e052604060c02060c052602060c02001556020611ea06004634a8fd698611e4052611e5c6000305af1612f9857600080fd5b611ea0516005600060c0526114805160e052604060c02060c052602060c0200155600560c052611e205160e052604060c02060a0516001600060c0526114805160e052604060c02060c052602060c020015482540380608051901315612ffd57600080fd5b809190121561300b57600080fd5b8155506002600060c0526114805160e052604060c02060c052602060c0200154611ec052611480516006600060c0526114805160e052604060c02060c052602060c02001547fb0da0cd4d3f901fa403fa301bd3cad4934e079e9f1a5b61bdb33a03da2c9aaaf6020611ec0a3005b63edea148060005114156137a4576020600461014037341561309a57600080fd5b606051600435806040519013156130b057600080fd5b80919012156130be57600080fd5b506002600060c0526101405160e052604060c02060c052602060c0200154600454136130e957600080fd5b600860c05260605160016002600060c0526101405160e052604060c02060c052602060c0200154018060405190131561312157600080fd5b809190121561312f57600080fd5b60e052604060c020546101605260605160185461016051018060405190131561315757600080fd5b809190121561316557600080fd5b6101805261018051600f54121561317b57600080fd5b6003600060c0526101405160e052604060c02060c052602060c0200154151561332057600060a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176131e657600080fd5b6402540be40081059050905090508060805190131561320457600080fd5b809190121561321257600080fd5b121561329d576402540be4006402540be3ff60a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761326a57600080fd5b6402540be40081059050905090508060805190131561328857600080fd5b809190121561329657600080fd5b0305613317565b6402540be40060a051600c60c0526101605160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176132e957600080fd5b6402540be40081059050905090508060805190131561330757600080fd5b809190121561331557600080fd5b055b6101a0526136f5565b606051601460c0526060516060516018546002028060405190131561334457600080fd5b809190121561335257600080fd5b61018051038060405190131561336757600080fd5b809190121561337557600080fd5b60e052604060c02054601460c0526101805160e052604060c0205403806040519013156133a157600080fd5b80919012156133af57600080fd5b6101c05260a0516005600060c0526101405160e052604060c02060c052602060c0200154806133dd57600080fd5b6402540be4006060516023546101c05102806040519013156133fe57600080fd5b809190121561340c57600080fd5b02058060805190131561341e57600080fd5b809190121561342c57600080fd5b6101e05260a0516101e0516402540be400038060805190131561344e57600080fd5b809190121561345c57600080fd5b60006402540be400810282121561347a576402540be400810261347c565b815b9050905061020052600060a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176134cc57600080fd5b6402540be4008105905090509050806080519013156134ea57600080fd5b80919012156134f857600080fd5b1215613583576402540be4006402540be3ff60a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c0200154818102811583838305141761355057600080fd5b6402540be40081059050905090508060805190131561356e57600080fd5b809190121561357c57600080fd5b03056135fd565b6402540be40060a051600c60c0526101805160e052604060c020546001600060c0526101405160e052604060c02060c052602060c020015481810281158383830514176135cf57600080fd5b6402540be4008105905090509050806080519013156135ed57600080fd5b80919012156135fb57600080fd5b055b61022052600060a0516102005161022051818102811583838305141761362257600080fd5b809050905090508060805190131561363957600080fd5b809190121561364757600080fd5b12156136a4576402540be4006402540be3ff60a0516102005161022051818102811583838305141761367857600080fd5b809050905090508060805190131561368f57600080fd5b809190121561369d57600080fd5b03056136f0565b6402540be40060a051610200516102205181810281158383830514176136c957600080fd5b80905090509050806080519013156136e057600080fd5b80919012156136ee57600080fd5b055b6101a0525b60006000600060006101a0516006600060c0526101405160e052604060c02060c052602060c02001546000f161372a57600080fd5b6101a05161024052610140516006600060c0526101405160e052604060c02060c052602060c02001547f499b9fc824d01426cfde5b95eebcfc53494a24d6316bb139b2333377f7c00e476020610240a36000600060246301b7af1861026052610140516102805261027c6000305af16137a257600080fd5b005b63e9dc0614600051141561448657602060046101403734156137c557600080fd5b610420600435600401610160376104006004356004013511156137e757600080fd5b6101608051602001806105c0828460006004600a8704601201f161380a57600080fd5b50506020610a206105c0516105e06000601a54602154f161382a57600080fd5b6020610a0052610a0060206000602083510381131561384857600080fd5b0460200260200181015190506105a0526110c0610160610620610a60825160208401600073610dc0f1505060c0610a60511461389757600080fd5b610a6051610a60018060200151600082518060209013156138b757600080fd5b80919012156138c557600080fd5b606051816020036101000a8304806040519013156138e257600080fd5b80919012156138f057600080fd5b90509050905081526020610a8051610a6001511461390d57600080fd5b610a8051610a8001518160200152610aa051610a600180602001516000825180602090131561393b57600080fd5b809190121561394957600080fd5b606051816020036101000a83048060405190131561396657600080fd5b809190121561397457600080fd5b9050905090508160400152610ac051610a600180602001516000825180602090131561399f57600080fd5b80919012156139ad57600080fd5b606051816020036101000a8304806040519013156139ca57600080fd5b80919012156139d857600080fd5b9050905090508160600152610ae051610a600180516020018083608001828460006004600a8704601201f1613a0c57600080fd5b5050506110c051611580526110e0516115a052611100516115c052611120516115e052611140805160200180611600828460006004600a8704601201f1613a5257600080fd5b50506020611f20610484606063a2767400611a40526105a051611a605280611a80526116008080516020018084611a6001828460006004600a8704601201f1613a9a57600080fd5b50508051820160200191505061158051611aa052611a5c90506000305af1613ac157600080fd5b611f2051613ace57600080fd5b6001606051610100611580510780604051901315613aeb57600080fd5b8091901215613af957600080fd5b6000811215613b10578060000360020a8204613b17565b8060020a82025b905090506006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613b5e57600080fd5b8091901215613b6c57600080fd5b1215613bb5576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613ba057600080fd5b8091901215613bae57600080fd5b0305613bed565b6402540be40060a0516101006402540be40061158051020580608051901315613bdd57600080fd5b8091901215613beb57600080fd5b055b60e052604060c020541615613c0157600080fd5b6020611fa0600463855f372c611f4052611f5c6000305af1613c2257600080fd5b611fa0516115a05114613c3457600080fd5b600f546115c05114613c4557600080fd5b6003600a60c0526115e05160e052604060c02060c052602060c0200154613c6b57600080fd5b6004600060c0526115805160e052604060c02060c052602060c0200154611fc0526002600060c0526115805160e052604060c02060c052602060c0200154611fe052600454612000526060516001612000510380604051901315613cce57600080fd5b8091901215613cdc57600080fd5b61202052611fe051612000511261200051611fc05113151661204052611fe051612020511261202051611fc05113151661206052612060516120405117613d2257600080fd5b6001606051610100611580510780604051901315613d3f57600080fd5b8091901215613d4d57600080fd5b6000811215613d64578060000360020a8204613d6b565b8060020a82025b905090506006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613db257600080fd5b8091901215613dc057600080fd5b1215613e09576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613df457600080fd5b8091901215613e0257600080fd5b0305613e41565b6402540be40060a0516101006402540be40061158051020580608051901315613e3157600080fd5b8091901215613e3f57600080fd5b055b60e052604060c02054176006600a60c0526115c05160e052604060c02060c052602060c0200160c052600060a0516101006402540be40061158051020580608051901315613e8e57600080fd5b8091901215613e9c57600080fd5b1215613ee5576402540be4006402540be3ff60a0516101006402540be40061158051020580608051901315613ed057600080fd5b8091901215613ede57600080fd5b0305613f1d565b6402540be40060a0516101006402540be40061158051020580608051901315613f0d57600080fd5b8091901215613f1b57600080fd5b055b60e052604060c020556001600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c02054612080526005600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020546120a05261204051156140075761208060a0516001600060c0526115805160e052604060c02060c052602060c020015482510180608051901315613fc557600080fd5b8091901215613fd357600080fd5b815250612080516001600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020555b6120605115614088576120a060a0516001600060c0526115805160e052604060c02060c052602060c02001548251018060805190131561404657600080fd5b809190121561405457600080fd5b8152506120a0516005600a60c0526115c05160e052604060c02060c052602060c0200160c0526115e05160e052604060c020555b6115e051601354141561421657600060a0516012546001600060c0526115805160e052604060c02060c052602060c020015481810281158383830514176140ce57600080fd5b6402540be4008105905090509050806080519013156140ec57600080fd5b80919012156140fa57600080fd5b1215614176576402540be4006402540be3ff60a0516012546001600060c0526115805160e052604060c02060c052602060c0200154818102811583838305141761414357600080fd5b6402540be40081059050905090508060805190131561416157600080fd5b809190121561416f57600080fd5b03056141e1565b6402540be40060a0516012546001600060c0526115805160e052604060c02060c052602060c020015481810281158383830514176141b357600080fd5b6402540be4008105905090509050806080519013156141d157600080fd5b80919012156141df57600080fd5b055b6120c05260006000604463579f38b26120e05261158051612100526120c051612120526120fc6000305af161421557600080fd5b5b6003600a60c0526115c05160e052604060c02060c052602060c02001541560a051600360a0516002600754818102811583838305141761425557600080fd5b809050905090508060805190131561426c57600080fd5b809190121561427a57600080fd5b058060805190131561428b57600080fd5b809190121561429957600080fd5b6120a051121560a051600360a051600260065481810281158383830514176142c057600080fd5b80905090509050806080519013156142d757600080fd5b80919012156142e557600080fd5b05806080519013156142f657600080fd5b809190121561430457600080fd5b6120805112151616156144285760016003600a60c0526115c05160e052604060c02060c052602060c02001556115c0516011556001600b5560016121805260006121a052600160c0526115c05160e052604060c020546115c0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b96040612180a360605160016115e051018060405190131561439f57600080fd5b80919012156143ad57600080fd5b6115c05114156144275760016002600a60c0526115e05160e052604060c02060c052602060c02001556115e05160105560016121c05260016121e052600160c0526115e05160e052604060c020546115e0517f6940a3069a76fdb79d757f4dca548d7930f85e4bce3a3e2d06f5562bda0b10b960406121c0a35b5b6115c051612200526115e051612220526115a051611580516006600060c0526115805160e052604060c02060c052602060c02001547f0fa814a7606272ed601db3d9974a12a26536f050d147ad209b7e7b0a95746f176040612200a4005b63cc20f16b6000511415614ab057604060046101403734156144a757600080fd5b610420600435600401610180376104006004356004013511156144c957600080fd5b6104206024356004016105c0376104006024356004013511156144eb57600080fd5b60206112e061088460406313d21fa3610a005280610a20526101808080516020018084610a2001828460006004600a8704601201f161452957600080fd5b50508051820160200191505080610a40526105c08080516020018084610a2001828460006004600a8704601201f161456057600080fd5b505080518201602001915050610a1c90506000305af161457f57600080fd5b6112e05161458c57600080fd5b611960610180610620611300825160208401600073610dc0f1505060c061130051146145cb57600080fd5b61130051611300018060200151600082518060209013156145eb57600080fd5b80919012156145f957600080fd5b606051816020036101000a83048060405190131561461657600080fd5b809190121561462457600080fd5b905090509050815260206113205161130001511461464157600080fd5b6113205161132001518160200152611340516113000180602001516000825180602090131561466f57600080fd5b809190121561467d57600080fd5b606051816020036101000a83048060405190131561469a57600080fd5b80919012156146a857600080fd5b905090509050816040015261136051611300018060200151600082518060209013156146d357600080fd5b80919012156146e157600080fd5b606051816020036101000a8304806040519013156146fe57600080fd5b809190121561470c57600080fd5b9050905090508160600152611380516113000180516020018083608001828460006004600a8704601201f161474057600080fd5b50505061196051611e20526020611ee060246399fb5eec611e6052611e2051611e8052611e7c6000305af161477457600080fd5b611ee051611e4052600060a05160196402540be400611e405102058060805190131561479f57600080fd5b80919012156147ad57600080fd5b12156147f5576402540be4006402540be3ff60a05160196402540be400611e40510205806080519013156147e057600080fd5b80919012156147ee57600080fd5b030561482c565b6402540be40060a05160196402540be400611e405102058060805190131561481c57600080fd5b809190121561482a57600080fd5b055b611f0052606051611f0051611e4051038060405190131561484c57600080fd5b809190121561485a57600080fd5b611f2052601460c052600f5460e052604060c020606051611e40518254018060405190131561488857600080fd5b809190121561489657600080fd5b81555060016003600060c052611e205160e052604060c02060c052602060c0200155611f0051611f4052611f2051611f6052611e20516006600060c052611e205160e052604060c02060c052602060c0200154337fb63bb46c05149b79f409b978407acff3bb3bfb5fb728ed2909fdb52677c220da6040611f40a46002600060c052611e205160e052604060c02060c052602060c0200154611f8052611f80516004541215614a95576001600060c052611e205160e052604060c02060c052602060c0200154611fa052600560c0526060516001600454018060405190131561497e57600080fd5b809190121561498c57600080fd5b60e052604060c02060a051611fa051825403806080519013156149ae57600080fd5b80919012156149bc57600080fd5b815550606051600160045401806040519013156149d857600080fd5b80919012156149e657600080fd5b6002600060c052611e205160e052604060c02060c052602060c0200155602054611f80511215614a5157600560c052611f805160e052604060c02060a051611fa05182540180608051901315614a3b57600080fd5b8091901215614a4957600080fd5b815550614a94565b60206120206004634a8fd698611fc052611fdc6000305af1614a7257600080fd5b612020516005600060c052611e205160e052604060c02060c052602060c02001555b5b6000600060006000611f0051336000f1614aae57600080fd5b005b63bcc44d996000511415614b1d5760206004610140373415614ad157600080fd5b60605160043580604051901315614ae757600080fd5b8091901215614af557600080fd5b506001600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63faf944fa6000511415614b8a5760206004610140373415614b3e57600080fd5b60605160043580604051901315614b5457600080fd5b8091901215614b6257600080fd5b506004600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63c253bf416000511415614bf75760206004610140373415614bab57600080fd5b60605160043580604051901315614bc157600080fd5b8091901215614bcf57600080fd5b506002600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b633b4f3ae36000511415614c645760206004610140373415614c1857600080fd5b60605160043580604051901315614c2e57600080fd5b8091901215614c3c57600080fd5b506003600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b6306fcf2ff6000511415614cd15760206004610140373415614c8557600080fd5b60605160043580604051901315614c9b57600080fd5b8091901215614ca957600080fd5b506005600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63bb0115f06000511415614d3b5760206004610140373415614cf257600080fd5b60605160043580604051901315614d0857600080fd5b8091901215614d1657600080fd5b50600060c0526101405160e052604060c02060c052602060c0205460005260206000f3005b635dbfd1ce6000511415614da85760206004610140373415614d5c57600080fd5b60605160043580604051901315614d7257600080fd5b8091901215614d8057600080fd5b506006600060c0526101405160e052604060c02060c052602060c020015460005260206000f3005b638208b8756000511415614e0a5760206004610140373415614dc957600080fd5b60605160043580604051901315614ddf57600080fd5b8091901215614ded57600080fd5b50600160c0526101405160e052604060c0205460005260206000f3005b637d69c5d96000511415614e30573415614e2357600080fd5b60025460005260206000f3005b63dc2059b36000511415614e7f5760206004610140373415614e5157600080fd5b6004356020518110614e6257600080fd5b50600360c0526101405160e052604060c0205460005260206000f3005b637060054d6000511415614ea5573415614e9857600080fd5b60045460005260206000f3005b63c44dc6596000511415614f075760206004610140373415614ec657600080fd5b60605160043580604051901315614edc57600080fd5b8091901215614eea57600080fd5b50600560c0526101405160e052604060c0205460005260206000f3005b63a2630bae6000511415614f695760206004610140373415614f2857600080fd5b60605160043580604051901315614f3e57600080fd5b8091901215614f4c57600080fd5b50600860c0526101405160e052604060c0205460005260206000f3005b6365ca80e66000511415614fcb5760206004610140373415614f8a57600080fd5b60605160043580604051901315614fa057600080fd5b8091901215614fae57600080fd5b50600960c0526101405160e052604060c0205460005260206000f3005b634af8e81a60005114156150355760206004610140373415614fec57600080fd5b6060516004358060405190131561500257600080fd5b809190121561501057600080fd5b50600a60c0526101405160e052604060c02060c052602060c0205460005260206000f3005b6326becf5860005114156150a2576020600461014037341561505657600080fd5b6060516004358060405190131561506c57600080fd5b809190121561507a57600080fd5b506004600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63be26608e600051141561514357604060046101403734156150c357600080fd5b606051600435806040519013156150d957600080fd5b80919012156150e757600080fd5b50606051602435806040519013156150fe57600080fd5b809190121561510c57600080fd5b506001600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b633673fd9860005114156151e4576040600461014037341561516457600080fd5b6060516004358060405190131561517a57600080fd5b809190121561518857600080fd5b506060516024358060405190131561519f57600080fd5b80919012156151ad57600080fd5b506005600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b63e270eb666000511415615285576040600461014037341561520557600080fd5b6060516004358060405190131561521b57600080fd5b809190121561522957600080fd5b506060516024358060405190131561524057600080fd5b809190121561524e57600080fd5b506006600a60c0526101405160e052604060c02060c052602060c0200160c0526101605160e052604060c0205460005260206000f3005b6330d3c41a60005114156152f257602060046101403734156152a657600080fd5b606051600435806040519013156152bc57600080fd5b80919012156152ca57600080fd5b506003600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b63cfff38c0600051141561535f576020600461014037341561531357600080fd5b6060516004358060405190131561532957600080fd5b809190121561533757600080fd5b506002600a60c0526101405160e052604060c02060c052602060c020015460005260206000f3005b6399787ac6600051141561538557341561537857600080fd5b600b5460005260206000f3005b63e430757f60005114156153e757602060046101403734156153a657600080fd5b606051600435806040519013156153bc57600080fd5b80919012156153ca57600080fd5b50600c60c0526101405160e052604060c0205460005260206000f3005b638a484407600051141561540d57341561540057600080fd5b600d5460005260206000f3005b63e6b57366600051141561543357341561542657600080fd5b600e5460005260206000f3005b639372b4e4600051141561545957341561544c57600080fd5b600f5460005260206000f3005b632eff8759600051141561547f57341561547257600080fd5b60105460005260206000f3005b635f61165060005114156154a557341561549857600080fd5b60115460005260206000f3005b6307dcf45b60005114156154cb5734156154be57600080fd5b60125460005260206000f3005b635b03544a60005114156154f15734156154e457600080fd5b60135460005260206000f3005b634c7756756000511415615553576020600461014037341561551257600080fd5b6060516004358060405190131561552857600080fd5b809190121561553657600080fd5b50601460c0526101405160e052604060c0205460005260206000f3005b63ac4746ab600051141561557957341561556c57600080fd5b60165460005260206000f3005b6397fbdf08600051141561559f57341561559257600080fd5b60175460005260206000f3005b630ebb172a60005114156155c55734156155b857600080fd5b60185460005260206000f3005b634f4ddb5e60005114156155eb5734156155de57600080fd5b60195460005260206000f3005b633f8a500e600051141561561157341561560457600080fd5b601c5460005260206000f3005b6361073e88600051141561563757341561562a57600080fd5b601d5460005260206000f3005b6326c0817e600051141561565d57341561565057600080fd5b601e5460005260206000f3005b63d4b31281600051141561568357341561567657600080fd5b601f5460005260206000f3005b" diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 9aa8669c98b..b6057890eb1 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -73,6 +73,9 @@ pub const DEFAULT_PURITY_CHECKER_CONTRACT: &'static str = include!("../../res/co /// Hybrid Casper MSG_HASHER_CODE pub const DEFAULT_MSG_HASHER_CONTRACT: &'static str = include!("../../res/code/msg_hasher.hex"); +/// Hybrid Casper RLP_DECODER_CODE +pub const DEFAULT_RLP_DECODER_CONTRACT: &'static str = include!("../../res/code/rlp_decoder.hex"); + /// Fork choice. #[derive(Debug, PartialEq, Eq)] pub enum ForkChoice { diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 815d8b53333..f84ac048c71 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -26,7 +26,7 @@ use builtin::Builtin; use client::{BlockInfo, CallContract}; use error::Error; use executive::Executive; -use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT}; +use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; use header::{BlockNumber, Header, ExtendedHeader}; use spec::CommonParams; use state::{CleanupMode, Substate}; @@ -85,6 +85,12 @@ pub struct EthashExtensions { pub hybrid_casper_msg_hasher_contract_code: Bytes, /// EIP1011 msg hasher address. pub hybrid_casper_msg_hasher_contract_address: Address, + /// EIP1011 RLP decoder code. + pub hybrid_casper_rlp_decoder_contract_code: Bytes, + /// EIP1011 RLP decoder address. + pub hybrid_casper_rlp_decoder_contract_address: Address, + /// Whether to deploy EIP1011 RLP decoder or not. + pub hybrid_casper_deploy_rlp_decoder: bool, /// EIP1011 epoch length. pub hybrid_casper_epoch_length: u64, @@ -106,6 +112,8 @@ pub struct EthashExtensions { impl From<::ethjson::spec::EthashParams> for EthashExtensions { fn from(p: ::ethjson::spec::EthashParams) -> Self { + let hybrid_casper_rlp_decoder_contract_address = Address::from(0x43u64); + EthashExtensions { homestead_transition: p.homestead_transition.map_or(0, Into::into), eip150_transition: p.eip150_transition.map_or(0, Into::into), @@ -116,7 +124,7 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into), dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(), hybrid_casper_transition: p.hybrid_casper_transition.map_or_else(u64::max_value, Into::into), - hybrid_casper_contract_code: DEFAULT_CASPER_CONTRACT.from_hex().expect( + hybrid_casper_contract_code: DEFAULT_CASPER_CONTRACT.replace("", &format!("{:x}", hybrid_casper_rlp_decoder_contract_address)).from_hex().expect( "Default CASPER_CODE is valid", ), hybrid_casper_contract_address: Address::from(0x40u64), @@ -129,6 +137,11 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { "Default MSG_HASHER_CODE is valid", ), hybrid_casper_msg_hasher_contract_address: Address::from(0x42u64), + hybrid_casper_rlp_decoder_contract_code: DEFAULT_RLP_DECODER_CONTRACT.from_hex().expect( + "Default RLP_DECODER_CODE is valid", + ), + hybrid_casper_rlp_decoder_contract_address: hybrid_casper_rlp_decoder_contract_address, + hybrid_casper_deploy_rlp_decoder: true, hybrid_casper_epoch_length: 5, hybrid_casper_withdrawal_delay: 150, hybrid_casper_dynasty_logout_delay: 70, @@ -302,6 +315,10 @@ impl EthereumMachine { ethash_params.hybrid_casper_purity_checker_contract_code.clone())?; state.init_code(ðash_params.hybrid_casper_msg_hasher_contract_address, ethash_params.hybrid_casper_msg_hasher_contract_code.clone())?; + if ethash_params.hybrid_casper_deploy_rlp_decoder { + state.init_code(ðash_params.hybrid_casper_rlp_decoder_contract_address, + ethash_params.hybrid_casper_rlp_decoder_contract_code.clone())?; + } } // Call Casper contract's init function. From 1f23a01bd41ade891f67ba15e6704e147192b44b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 09:44:14 +0800 Subject: [PATCH 38/72] Add a convenience function send_unsigned_transaction in RPC --- rpc/src/v1/impls/light/parity.rs | 4 ++++ rpc/src/v1/impls/parity.rs | 23 +++++++++++++++++++++++ rpc/src/v1/traits/parity.rs | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/rpc/src/v1/impls/light/parity.rs b/rpc/src/v1/impls/light/parity.rs index 025538fc427..dadaf9f739e 100644 --- a/rpc/src/v1/impls/light/parity.rs +++ b/rpc/src/v1/impls/light/parity.rs @@ -346,6 +346,10 @@ impl Parity for ParityClient { Err(errors::light_unimplemented(None)) } + fn send_unsigned_transaction(&self, _: H160, _: Bytes) -> Result { + Err(errors::light_unimplemented(None)) + } + fn chain_id(&self) -> Result> { Ok(self.client.signing_chain_id().map(U64::from)) } diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index 08d5147202c..78f128c6faa 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -33,6 +33,7 @@ use ethcore::miner::{self, MinerService}; use ethcore::mode::Mode; use ethcore::state::StateInfo; use ethcore_logger::RotatingLogger; +use transaction::{Transaction as CoreTransaction, Action as TransactionAction}; use node_health::{NodeHealth, Health}; use updater::{Service as UpdateService}; @@ -41,6 +42,7 @@ use jsonrpc_core::futures::{future, Future}; use jsonrpc_macros::Trailing; use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings}; use v1::helpers::accounts::unwrap_provider; +use v1::helpers::dispatch::FullDispatcher; use v1::metadata::Metadata; use v1::traits::Parity; use v1::types::{ @@ -210,6 +212,27 @@ impl Parity for ParityClient where Ok(self.client.spec_name()) } + fn send_unsigned_transaction(&self, to: H160, data: Bytes) -> Result { + use ethereum_types::{U256 as CoreU256}; + + let transaction = CoreTransaction { + nonce: CoreU256::zero(), + value: CoreU256::zero(), + gas_price: CoreU256::zero(), + gas: CoreU256::from(940000), + action: TransactionAction::Call(to.into()), + data: data.into() + }; + + let signed = transaction.null_sign(self.client.signing_chain_id().unwrap_or(0)); + + FullDispatcher::dispatch_transaction( + &*self.client, + &*self.miner, + signed.into(), + ).map(Into::into) + } + fn net_peers(&self) -> Result { let sync_status = self.sync.status(); let net_config = self.net.network_config(); diff --git a/rpc/src/v1/traits/parity.rs b/rpc/src/v1/traits/parity.rs index 83d8b19811c..eebcc208d43 100644 --- a/rpc/src/v1/traits/parity.rs +++ b/rpc/src/v1/traits/parity.rs @@ -56,6 +56,10 @@ build_rpc_trait! { #[rpc(name = "parity_transactionsLimit")] fn transactions_limit(&self) -> Result; + /// Submit a raw unsigned EIP86 transaction locally. + #[rpc(name = "parity_sendUnsignedTransaction")] + fn send_unsigned_transaction(&self, H160, Bytes) -> Result; + /// Returns mining extra data. #[rpc(name = "parity_extraData")] fn extra_data(&self) -> Result; From 9c518854083972d6cb841e81ae3b991ac6d284d0 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 24 May 2018 10:55:13 +0800 Subject: [PATCH 39/72] Enable EIP86 internal schedule --- ethcore/src/machine.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index f84ac048c71..a6f02aeb592 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -498,6 +498,12 @@ impl EthereumMachine { } }; + if let Some(ref ethash_params) = self.ethash_extensions { + if block_number >= ethash_params.hybrid_casper_transition { + schedule.eip86 = true; + } + } + if let Some(ref rules) = self.schedule_rules { (rules)(&mut schedule, block_number) } From 4993c6076f303dfe8726337b108f90690806c14a Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 12:52:42 +0800 Subject: [PATCH 40/72] Make it possible to deserialize all casper params --- ethcore/src/client/client.rs | 2 +- ethcore/src/engines/hybrid_casper.rs | 117 +++++++++++++++++++++++++++ ethcore/src/engines/mod.rs | 1 + json/src/spec/hybrid_casper.rs | 64 +++++++++++++++ json/src/spec/mod.rs | 2 + 5 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 ethcore/src/engines/hybrid_casper.rs create mode 100644 json/src/spec/hybrid_casper.rs diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 993ecdda216..cefbbd04513 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -2168,7 +2168,7 @@ impl ImportSealedBlock for Client { route }; let route = ChainRoute::from([route].as_ref()); - self.importer.miner.chain_new_blocks(self, &[h.clone()], &[], route.enacted(), route.retracted(), true); + self.importer.miner.chain_new_blocks(self, &[h.clone()], &[], route.enacted(), route.retracted(), self.engine.seals_internally().is_some()); self.notify(|notify| { notify.new_blocks( vec![h.clone()], diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs new file mode 100644 index 00000000000..e5a1e372f84 --- /dev/null +++ b/ethcore/src/engines/hybrid_casper.rs @@ -0,0 +1,117 @@ +// Copyright 2015-2018 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +//! Hybrid Casper related functionalities. + +use bytes::Bytes; +use ethereum_types::{Address, U256}; +use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; +use rustc_hex::FromHex; + +/// Hybrid Casper parameters. +pub struct HybridCasperParams { + /// Main contract code. + pub contract_code: Bytes, + /// Address to deploy the main contract. + pub contract_address: Address, + /// Balance to force set in the beginning. + pub contract_balance: U256, + /// Purity checker contract code. + pub purity_checker_contract_code: Bytes, + /// Address to deploy the purity checker. + pub purity_checker_contract_address: Address, + /// Msg hasher contract code. + pub msg_hasher_contract_code: Bytes, + /// Address to deploy the msg hasher. + pub msg_hasher_contract_address: Address, + /// RLP decoder contract code. + pub rlp_decoder_contract_code: Bytes, + /// Address to deploy the RLP decoder. + pub rlp_decoder_contract_address: Address, + /// Whether force-deploying the RLP decoder or not. + pub deploy_rlp_decoder: bool, + + /// Casper epoch length. + pub epoch_length: u64, + /// Casper withdrawal delay. + pub withdrawal_delay: u64, + /// Casper dynasty logout delay. + pub dynasty_logout_delay: u64, + /// Base interest factor passed to the Casper init function. + pub base_interest_factor: U256, + /// Base penalty factor passed to the Casper init function. + pub base_penalty_factor: U256, + /// Min deposit size accepted by Casper. + pub min_deposit_size: U256, + /// Warm up period before vote begins. + pub warm_up_period: u64, + /// Min deposit to consider a block to be justified. + pub non_revert_min_deposits: U256, +} + +impl From<::ethjson::spec::HybridCasperParams> for HybridCasperParams { + fn from(p: ::ethjson::spec::HybridCasperParams) -> Self { + let rlp_decoder_contract_address = p.rlp_decoder_contract_address.map_or(Address::from(0x43u64), Into::into); + + HybridCasperParams { + contract_code: p.contract_code + .map_or(DEFAULT_CASPER_CONTRACT + .replace("", &format!("{:x}", rlp_decoder_contract_address)) + .from_hex() + .expect("DEFAULT_CASPER_CONTRACT is valid bytearray; qed"), Into::into), + contract_address: p.contract_address.map_or(Address::from(0x40u64), Into::into), + contract_balance: p.contract_balance.map_or(U256::from(1250000) * ::ethereum::ether(), Into::into), + + purity_checker_contract_code: p.purity_checker_contract_code + .map_or(DEFAULT_PURITY_CHECKER_CONTRACT + .from_hex() + .expect("DEFAULT_PURITY_CHECKER_CONTRACT is valid bytearray; qed"), Into::into), + purity_checker_contract_address: p.purity_checker_contract_address.map_or(Address::from(0x41u64), Into::into), + + msg_hasher_contract_code: p.msg_hasher_contract_code + .map_or(DEFAULT_MSG_HASHER_CONTRACT + .from_hex() + .expect("DEFAULT_MSG_HASHER_CONTRACT is valid bytearray; qed"), Into::into), + msg_hasher_contract_address: p.msg_hasher_contract_address.map_or(Address::from(0x42u64), Into::into), + + rlp_decoder_contract_code: p.rlp_decoder_contract_code + .map_or(DEFAULT_RLP_DECODER_CONTRACT + .from_hex() + .expect("DEFAULT_RLP_DECODER_CONTRACT is valid bytearray; qed"), Into::into), + rlp_decoder_contract_address: rlp_decoder_contract_address, + deploy_rlp_decoder: p.deploy_rlp_decoder.unwrap_or(true), + + epoch_length: p.epoch_length.map_or(5, Into::into), + withdrawal_delay: p.withdrawal_delay.map_or(150, Into::into), + dynasty_logout_delay: p.dynasty_logout_delay.map_or(70, Into::into), + base_interest_factor: p.base_interest_factor.map_or(U256::from(70000000), Into::into), + base_penalty_factor: p.base_penalty_factor.map_or(U256::from(2000), Into::into), + min_deposit_size: p.min_deposit_size.map_or(U256::from(5) * ::ethereum::ether(), Into::into), + warm_up_period: p.warm_up_period.map_or(5, Into::into), + non_revert_min_deposits: p.non_revert_min_deposits.map_or(U256::from(1) * ::ethereum::ether(), Into::into), + } + } +} + +impl Default for HybridCasperParams { + fn default() -> Self { + Self::from(::ethjson::spec::HybridCasperParams::default()) + } +} + +pub struct HybridCasper { + params: HybridCasperParams, +} diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index b6057890eb1..70b86d3b172 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -26,6 +26,7 @@ mod transition; mod validator_set; mod vote_collector; +pub mod hybrid_casper; pub mod block_reward; pub mod epoch; diff --git a/json/src/spec/hybrid_casper.rs b/json/src/spec/hybrid_casper.rs new file mode 100644 index 00000000000..bbd4119ad58 --- /dev/null +++ b/json/src/spec/hybrid_casper.rs @@ -0,0 +1,64 @@ +// Copyright 2015-2018 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +//! Hybrid Casper spec deserialization. + +use uint::Uint; +use hash::Address; +use bytes::Bytes; + +/// Hybrid Casper params deserialization. +#[derive(Debug, Default, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct HybridCasperParams { + /// Main contract code. + pub contract_code: Option, + /// Address to deploy the main contract. + pub contract_address: Option
, + /// Balance to force set in the beginning. + pub contract_balance: Option, + /// Purity checker contract code. + pub purity_checker_contract_code: Option, + /// Address to deploy the purity checker. + pub purity_checker_contract_address: Option
, + /// Msg hasher contract code. + pub msg_hasher_contract_code: Option, + /// Address to deploy the msg hasher. + pub msg_hasher_contract_address: Option
, + /// RLP decoder contract code. + pub rlp_decoder_contract_code: Option, + /// Address to deploy the RLP decoder. + pub rlp_decoder_contract_address: Option
, + /// Whether force-deploying the RLP decoder or not. + pub deploy_rlp_decoder: Option, + + /// Casper epoch length. + pub epoch_length: Option, + /// Casper withdrawal delay. + pub withdrawal_delay: Option, + /// Casper dynasty logout delay. + pub dynasty_logout_delay: Option, + /// Base interest factor passed to the Casper init function. + pub base_interest_factor: Option, + /// Base penalty factor passed to the Casper init function. + pub base_penalty_factor: Option, + /// Min deposit size accepted by Casper. + pub min_deposit_size: Option, + /// Warm up period before vote begins. + pub warm_up_period: Option, + /// Min deposit to consider a block to be justified. + pub non_revert_min_deposits: Option, +} diff --git a/json/src/spec/mod.rs b/json/src/spec/mod.rs index 285596f14a7..b8aaa564d5a 100644 --- a/json/src/spec/mod.rs +++ b/json/src/spec/mod.rs @@ -31,6 +31,7 @@ pub mod authority_round; pub mod tendermint; pub mod null_engine; pub mod hardcoded_sync; +pub mod hybrid_casper; pub use self::account::Account; pub use self::builtin::{Builtin, Pricing, Linear}; @@ -47,3 +48,4 @@ pub use self::authority_round::{AuthorityRound, AuthorityRoundParams}; pub use self::tendermint::{Tendermint, TendermintParams}; pub use self::null_engine::{NullEngine, NullEngineParams}; pub use self::hardcoded_sync::HardcodedSync; +pub use self::hybrid_casper::HybridCasperParams; From c3a9ec4b25e5439176608cd19338c2da0b016d43 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 12:52:58 +0800 Subject: [PATCH 41/72] Commit a missing file rlp_decoder.hex Oops! --- ethcore/res/code/rlp_decoder.hex | 1 + 1 file changed, 1 insertion(+) create mode 100644 ethcore/res/code/rlp_decoder.hex diff --git a/ethcore/res/code/rlp_decoder.hex b/ethcore/res/code/rlp_decoder.hex new file mode 100644 index 00000000000..969404f3af2 --- /dev/null +++ b/ethcore/res/code/rlp_decoder.hex @@ -0,0 +1 @@ +"60006109ac5260006109cc527f0100000000000000000000000000000000000000000000000000000000000000600035046109ec526000610a0c5260006109005260c06109ec51101515585760f86109ec51101561006e5760bf6109ec510336141558576001610a0c52610098565b60013560f76109ec51036020035260005160f66109ec510301361415585760f66109ec5103610a0c525b61022060016064818352015b36610a0c511015156100b557610291565b7f0100000000000000000000000000000000000000000000000000000000000000610a0c5135046109ec526109cc5160206109ac51026040015260016109ac51016109ac5260806109ec51101561013b5760016109cc5161044001526001610a0c516109cc5161046001376001610a0c5101610a0c5260216109cc51016109cc52610281565b60b86109ec5110156101d15760806109ec51036109cc51610440015260806109ec51036001610a0c51016109cc51610460013760816109ec5114156101ac5760807f01000000000000000000000000000000000000000000000000000000000000006001610a0c5101350410151558575b607f6109ec5103610a0c5101610a0c5260606109ec51036109cc51016109cc52610280565b60c06109ec51101561027d576001610a0c51013560b76109ec510360200352600051610a2c526038610a2c5110157f01000000000000000000000000000000000000000000000000000000000000006001610a0c5101350402155857610a2c516109cc516104400152610a2c5160b66109ec5103610a0c51016109cc516104600137610a2c5160b66109ec5103610a0c510101610a0c526020610a2c51016109cc51016109cc5261027f565bfe5b5b5b81516001018083528114156100a4575b5050601f6109ac511115155857602060206109ac5102016109005260206109005103610a0c5261022060016064818352015b6000610a0c5112156102d45761030a565b61090051610a0c516040015101610a0c51610900516104400301526020610a0c5103610a0c5281516001018083528114156102c3575b50506109cc516109005101610420526109cc5161090051016109005161044003f3" From 5900797280927e01035a7eaaede7684f0e241e33 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 13:20:02 +0800 Subject: [PATCH 42/72] Move is_vote_transaction to HybridCasper --- ethcore/src/engines/hybrid_casper.rs | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index e5a1e372f84..467cf8f95d9 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -20,6 +20,7 @@ use bytes::Bytes; use ethereum_types::{Address, U256}; use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; use rustc_hex::FromHex; +use transaction::{SignedTransaction, Action}; /// Hybrid Casper parameters. pub struct HybridCasperParams { @@ -115,3 +116,34 @@ impl Default for HybridCasperParams { pub struct HybridCasper { params: HybridCasperParams, } + +impl HybridCasper { + pub fn is_vote_transaction(&self, transaction: &SignedTransaction) -> bool { + if !transaction.is_unsigned() { + return false; + } + + let unsigned = transaction.as_unsigned(); + + match unsigned.action { + Action::Create => { + return false; + }, + Action::Call(address) => { + if address != self.params.contract_address { + return false; + } + }, + } + + if unsigned.data.len() < 4 { + return false; + } + + if &unsigned.data[0..4] != &[0xe9, 0xdc, 0x06, 0x14] { + return false; + } + + return true; + } +} From 0849f4e3b41bd906862f0fb9c63067ec90bc6556 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 13:25:37 +0800 Subject: [PATCH 43/72] Manually implement EthEngine trait for engines This allows customization of EthEngine functions. --- ethcore/src/engines/authority_round/mod.rs | 2 ++ ethcore/src/engines/basic_authority.rs | 2 ++ ethcore/src/engines/instant_seal.rs | 2 ++ ethcore/src/engines/mod.rs | 3 --- ethcore/src/engines/null_engine.rs | 2 ++ ethcore/src/engines/tendermint/mod.rs | 2 ++ ethcore/src/ethereum/ethash.rs | 4 +++- 7 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ethcore/src/engines/authority_round/mod.rs b/ethcore/src/engines/authority_round/mod.rs index 02bb88c51f2..c8de1146885 100644 --- a/ethcore/src/engines/authority_round/mod.rs +++ b/ethcore/src/engines/authority_round/mod.rs @@ -1355,6 +1355,8 @@ impl Engine for AuthorityRound { } } +impl ::engines::EthEngine for AuthorityRound { } + #[cfg(test)] mod tests { use std::sync::Arc; diff --git a/ethcore/src/engines/basic_authority.rs b/ethcore/src/engines/basic_authority.rs index e99fd88dcbc..9e6041113a3 100644 --- a/ethcore/src/engines/basic_authority.rs +++ b/ethcore/src/engines/basic_authority.rs @@ -197,6 +197,8 @@ impl Engine for BasicAuthority { } } +impl ::engines::EthEngine for BasicAuthority { } + #[cfg(test)] mod tests { use std::sync::Arc; diff --git a/ethcore/src/engines/instant_seal.rs b/ethcore/src/engines/instant_seal.rs index c16203f1053..25366f8fb12 100644 --- a/ethcore/src/engines/instant_seal.rs +++ b/ethcore/src/engines/instant_seal.rs @@ -69,6 +69,8 @@ impl Engine for InstantSeal } } +impl ::engines::EthEngine for InstantSeal<::machine::EthereumMachine> { } + #[cfg(test)] mod tests { use std::sync::Arc; diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 70b86d3b172..defe98961fc 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -486,6 +486,3 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { self.machine().decode_transaction(transaction) } } - -// convenience wrappers for existing functions. -impl EthEngine for T where T: Engine<::machine::EthereumMachine> { } diff --git a/ethcore/src/engines/null_engine.rs b/ethcore/src/engines/null_engine.rs index c6025e62471..71b50335ecc 100644 --- a/ethcore/src/engines/null_engine.rs +++ b/ethcore/src/engines/null_engine.rs @@ -109,3 +109,5 @@ impl Engine for NullEngine super::total_difficulty_fork_choice(new, current) } } + +impl ::engines::EthEngine for NullEngine<::machine::EthereumMachine> { } diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs index 52bf5ff67b8..57e0954dac1 100644 --- a/ethcore/src/engines/tendermint/mod.rs +++ b/ethcore/src/engines/tendermint/mod.rs @@ -771,6 +771,8 @@ impl Engine for Tendermint { } } +impl ::engines::EthEngine for Tendermint { } + #[cfg(test)] mod tests { use std::str::FromStr; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 0b2bebeeb46..9ce5a33a847 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -26,7 +26,7 @@ use unexpected::{OutOfBounds, Mismatch}; use block::*; use error::{BlockError, Error}; use header::{Header, BlockNumber, ExtendedHeader}; -use engines::{self, Engine, ForkChoice}; +use engines::{self, Engine, EthEngine, ForkChoice}; use ethjson; use rlp::{self, Rlp}; use machine::{EthereumMachine, CasperMetadata}; @@ -394,6 +394,8 @@ impl Engine for Arc { } } +impl EthEngine for Arc { } + impl Ethash { fn calculate_difficulty(&self, header: &Header, parent: &Header) -> U256 { const EXP_DIFF_PERIOD: u64 = 100_000; From c61e1fbff37fdad11a669ceb4554f1d2d8f1f5a6 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 13:31:48 +0800 Subject: [PATCH 44/72] Initialize the hybrid casper parameter in Ethash --- ethcore/src/engines/hybrid_casper.rs | 5 +++++ ethcore/src/ethereum/ethash.rs | 6 ++++++ json/src/spec/ethash.rs | 4 ++++ json/src/spec/hybrid_casper.rs | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index 467cf8f95d9..80633fa7bd7 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -23,6 +23,7 @@ use rustc_hex::FromHex; use transaction::{SignedTransaction, Action}; /// Hybrid Casper parameters. +#[derive(Debug, Clone, PartialEq)] pub struct HybridCasperParams { /// Main contract code. pub contract_code: Bytes, @@ -118,6 +119,10 @@ pub struct HybridCasper { } impl HybridCasper { + pub fn new(params: HybridCasperParams) -> Self { + Self { params } + } + pub fn is_vote_transaction(&self, transaction: &SignedTransaction) -> bool { if !transaction.is_unsigned() { return false; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 9ce5a33a847..cf182d17f82 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -20,6 +20,7 @@ use std::collections::BTreeMap; use std::sync::Arc; use hash::{KECCAK_EMPTY_LIST_RLP}; use engines::block_reward::{self, RewardKind}; +use engines::hybrid_casper::{HybridCasper, HybridCasperParams}; use ethash::{quick_get_difficulty, slow_hash_block_number, EthashManager, OptimizeFor}; use ethereum_types::{H256, H64, U256, Address}; use unexpected::{OutOfBounds, Mismatch}; @@ -128,6 +129,8 @@ pub struct EthashParams { pub expip2_duration_limit: u64, /// Number of first block wehre Casper rules begin. pub hybrid_casper_transition: u64, + /// Hybrid casper parameters. + pub hybrid_casper_params: HybridCasperParams, } impl From for EthashParams { @@ -159,6 +162,7 @@ impl From for EthashParams { expip2_transition: p.expip2_transition.map_or(u64::max_value(), Into::into), expip2_duration_limit: p.expip2_duration_limit.map_or(30, Into::into), hybrid_casper_transition: p.hybrid_casper_transition.map_or(u64::max_value(), Into::into), + hybrid_casper_params: p.hybrid_casper_params.map_or_else(Default::default, Into::into), } } } @@ -169,6 +173,7 @@ pub struct Ethash { ethash_params: EthashParams, pow: EthashManager, machine: EthereumMachine, + casper: HybridCasper, } impl Ethash { @@ -180,6 +185,7 @@ impl Ethash { optimize_for: T, ) -> Arc { Arc::new(Ethash { + casper: HybridCasper::new(ethash_params.hybrid_casper_params.clone()), ethash_params, machine, pow: EthashManager::new(cache_dir.as_ref(), optimize_for.into()), diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index f70ac196303..4c304b385db 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -18,6 +18,7 @@ use uint::{self, Uint}; use hash::Address; +use super::HybridCasperParams; /// Deserializable doppelganger of EthashParams. #[derive(Clone, Debug, PartialEq, Deserialize)] @@ -141,6 +142,9 @@ pub struct EthashParams { /// EIP1011 transition block #[serde(rename="hybridCasperTransition")] pub hybrid_casper_transition: Option, + /// EIP1011 parameters + #[serde(rename="hybridCasperParams")] + pub hybrid_casper_params: Option, } /// Ethash engine deserialization. diff --git a/json/src/spec/hybrid_casper.rs b/json/src/spec/hybrid_casper.rs index bbd4119ad58..f47366a85c8 100644 --- a/json/src/spec/hybrid_casper.rs +++ b/json/src/spec/hybrid_casper.rs @@ -21,7 +21,7 @@ use hash::Address; use bytes::Bytes; /// Hybrid Casper params deserialization. -#[derive(Debug, Default, PartialEq, Deserialize)] +#[derive(Clone, Debug, Default, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub struct HybridCasperParams { /// Main contract code. From 44063c92bbc34fe8fd4c7f4d4f5f8608329a5ff8 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 13:37:47 +0800 Subject: [PATCH 45/72] Move vote_transaction check in unordered_check to Ethash --- ethcore/src/ethereum/ethash.rs | 15 +++++++++++++- ethcore/src/machine.rs | 36 ++-------------------------------- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index cf182d17f82..a3e8c1d09a9 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -30,6 +30,7 @@ use header::{Header, BlockNumber, ExtendedHeader}; use engines::{self, Engine, EthEngine, ForkChoice}; use ethjson; use rlp::{self, Rlp}; +use transaction::{self, UnverifiedTransaction, SignedTransaction}; use machine::{EthereumMachine, CasperMetadata}; use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; use types::ancestry_action::AncestryAction; @@ -400,7 +401,19 @@ impl Engine for Arc { } } -impl EthEngine for Arc { } +impl EthEngine for Arc { + fn verify_transaction_unordered(&self, t: UnverifiedTransaction, header: &Header) -> Result { + let signed = self.machine().verify_transaction_unordered(t, header)?; + + if header.number() >= self.ethash_params.hybrid_casper_transition { + if signed.is_unsigned() && !self.casper.is_vote_transaction(&signed) { + return Err(transaction::Error::NotAllowed); + } + } + + Ok(signed) + } +} impl Ethash { fn calculate_difficulty(&self, header: &Header, parent: &Header) -> U256 { diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index a6f02aeb592..1acdaaee089 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -561,40 +561,8 @@ impl EthereumMachine { } /// Verify a particular transaction is valid, regardless of order. - pub fn verify_transaction_unordered(&self, t: UnverifiedTransaction, header: &Header) -> Result { - let signed = SignedTransaction::new(t)?; - - if let Some(ref ethash_params) = self.ethash_extensions { - if header.number() >= ethash_params.hybrid_casper_transition { - if signed.is_unsigned() { - let (transaction, _, _) = signed.clone().deconstruct(); - let unsigned = transaction.as_unsigned(); - - match unsigned.action { - Action::Call(address) => { - if address != ethash_params.hybrid_casper_contract_address { - return Err(transaction::Error::NotAllowed) - } - }, - _ => { - return Err(transaction::Error::NotAllowed) - }, - } - - if unsigned.data.len() < 4 { - return Err(transaction::Error::NotAllowed); - } - - if &unsigned.data[0..4] != &[0xe9, 0xdc, 0x06, 0x14] { - return Err(transaction::Error::NotAllowed); - } - } else { - return Err(transaction::Error::NotAllowed); - } - } - } - - Ok(signed) + pub fn verify_transaction_unordered(&self, t: UnverifiedTransaction, _header: &Header) -> Result { + Ok(SignedTransaction::new(t)?) } /// Does basic verification of the transaction. From da167b732ade8e5f7f97609134bb5ce4a5046b81 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 14:11:47 +0800 Subject: [PATCH 46/72] Move eip86 casper check to Ethash --- ethcore/src/ethereum/ethash.rs | 9 ++++++++- ethcore/src/machine.rs | 6 ------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index a3e8c1d09a9..0f7fc11b201 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -182,9 +182,16 @@ impl Ethash { pub fn new>>( cache_dir: &Path, ethash_params: EthashParams, - machine: EthereumMachine, + mut machine: EthereumMachine, optimize_for: T, ) -> Arc { + let hybrid_casper_transition = ethash_params.hybrid_casper_transition; + machine.set_schedule_creation_rules(Box::new(move |schedule, block_number| { + if block_number >= hybrid_casper_transition { + schedule.eip86 = true; + } + })); + Arc::new(Ethash { casper: HybridCasper::new(ethash_params.hybrid_casper_params.clone()), ethash_params, diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 1acdaaee089..a59196f8504 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -498,12 +498,6 @@ impl EthereumMachine { } }; - if let Some(ref ethash_params) = self.ethash_extensions { - if block_number >= ethash_params.hybrid_casper_transition { - schedule.eip86 = true; - } - } - if let Some(ref rules) = self.schedule_rules { (rules)(&mut schedule, block_number) } From 9de9f19446289677b5b9d23f81dfda818fd3acc7 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 14:16:56 +0800 Subject: [PATCH 47/72] Move casper schedule enabling logic to HybridCasper struct --- ethcore/src/engines/hybrid_casper.rs | 5 +++++ ethcore/src/ethereum/ethash.rs | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index 80633fa7bd7..5b15f9baab4 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -21,6 +21,7 @@ use ethereum_types::{Address, U256}; use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; use rustc_hex::FromHex; use transaction::{SignedTransaction, Action}; +use vm::Schedule; /// Hybrid Casper parameters. #[derive(Debug, Clone, PartialEq)] @@ -151,4 +152,8 @@ impl HybridCasper { return true; } + + pub fn enable_casper_schedule(&self, schedule: &mut Schedule) { + schedule.eip86 = true; + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 0f7fc11b201..5d73b7ff15d 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -174,7 +174,7 @@ pub struct Ethash { ethash_params: EthashParams, pow: EthashManager, machine: EthereumMachine, - casper: HybridCasper, + casper: Arc, } impl Ethash { @@ -185,15 +185,18 @@ impl Ethash { mut machine: EthereumMachine, optimize_for: T, ) -> Arc { + let casper = Arc::new(HybridCasper::new(ethash_params.hybrid_casper_params.clone())); + let casper_c = casper.clone(); let hybrid_casper_transition = ethash_params.hybrid_casper_transition; + machine.set_schedule_creation_rules(Box::new(move |schedule, block_number| { if block_number >= hybrid_casper_transition { - schedule.eip86 = true; + casper_c.enable_casper_schedule(schedule); } })); Arc::new(Ethash { - casper: HybridCasper::new(ethash_params.hybrid_casper_params.clone()), + casper, ethash_params, machine, pow: EthashManager::new(cache_dir.as_ref(), optimize_for.into()), From 6c903cb0c19644bb05737bbe1da2d25dec414918 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 14:38:14 +0800 Subject: [PATCH 48/72] Move state init and casper contract init to HybridCasper --- ethcore/src/engines/hybrid_casper.rs | 46 +++++++++++++++++++++++++++- ethcore/src/ethereum/ethash.rs | 16 ++++++++++ ethcore/src/machine.rs | 41 ------------------------- 3 files changed, 61 insertions(+), 42 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index 5b15f9baab4..c7120ef9d3f 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -22,6 +22,10 @@ use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_ use rustc_hex::FromHex; use transaction::{SignedTransaction, Action}; use vm::Schedule; +use state::{State, Backend}; +use super::SystemCall; + +use_contract!(simple_casper, "SimpleCasper", "res/contracts/simple_casper.json"); /// Hybrid Casper parameters. #[derive(Debug, Clone, PartialEq)] @@ -117,11 +121,15 @@ impl Default for HybridCasperParams { pub struct HybridCasper { params: HybridCasperParams, + provider: simple_casper::SimpleCasper, } impl HybridCasper { pub fn new(params: HybridCasperParams) -> Self { - Self { params } + Self { + params, + provider: simple_casper::SimpleCasper::default(), + } } pub fn is_vote_transaction(&self, transaction: &SignedTransaction) -> bool { @@ -156,4 +164,40 @@ impl HybridCasper { pub fn enable_casper_schedule(&self, schedule: &mut Schedule) { schedule.eip86 = true; } + + pub fn init_state(&self, state: &mut State) -> Result<(), ::error::Error> { + state.new_contract(&self.params.contract_address, + self.params.contract_balance, + U256::zero()); + state.init_code(&self.params.contract_address, + self.params.contract_code.clone())?; + state.init_code(&self.params.purity_checker_contract_address, + self.params.purity_checker_contract_code.clone())?; + state.init_code(&self.params.msg_hasher_contract_address, + self.params.msg_hasher_contract_code.clone())?; + if self.params.deploy_rlp_decoder { + state.init_code(&self.params.rlp_decoder_contract_address, + self.params.rlp_decoder_contract_code.clone())?; + } + + Ok(()) + } + + pub fn init_casper_contract(&self, caller: &mut SystemCall) -> Result<(), ::error::Error> { + let data = self.provider.functions().init().input( + self.params.epoch_length, + self.params.warm_up_period, + self.params.withdrawal_delay, + self.params.dynasty_logout_delay, + self.params.msg_hasher_contract_address, + self.params.purity_checker_contract_address, + self.params.base_interest_factor, + self.params.base_penalty_factor, + self.params.min_deposit_size, + ); + caller(self.params.contract_address, data) + .map(|_| ()) + .map_err(::engines::EngineError::FailedSystemCall) + .map_err(Into::into) + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 5d73b7ff15d..75678e2a9f5 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -244,6 +244,22 @@ impl Engine for Arc { header.set_difficulty(difficulty); } + fn on_new_block(&self, block: &mut ExecutedBlock, _epoch_begin: bool, _ancestry: &mut Iterator) -> Result<(), Error> { + if block.header().number() == self.ethash_params.hybrid_casper_transition { + self.casper.init_state(block.state_mut())?; + self.casper.init_casper_contract(&mut |address, data| { + self.machine().execute_as_system( + block, + address, + U256::max_value(), + Some(data) + ).map_err(|e| format!("{}", e)) + })?; + } + + Ok(()) + } + /// Apply the block reward on finalisation of the block. /// This assumes that all uncles are valid uncles (i.e. of at least one generation before the current). fn on_close_block(&self, block: &mut ExecutedBlock) -> Result<(), Error> { diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index a59196f8504..12b7b0f9779 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -302,47 +302,6 @@ impl EthereumMachine { } } - if block.header().number() == ethash_params.hybrid_casper_transition { - // Force set Casper contract code. - { - let state = block.state_mut(); - state.new_contract(ðash_params.hybrid_casper_contract_address, - ethash_params.hybrid_casper_contract_balance, - U256::zero()); - state.init_code(ðash_params.hybrid_casper_contract_address, - ethash_params.hybrid_casper_contract_code.clone())?; - state.init_code(ðash_params.hybrid_casper_purity_checker_contract_address, - ethash_params.hybrid_casper_purity_checker_contract_code.clone())?; - state.init_code(ðash_params.hybrid_casper_msg_hasher_contract_address, - ethash_params.hybrid_casper_msg_hasher_contract_code.clone())?; - if ethash_params.hybrid_casper_deploy_rlp_decoder { - state.init_code(ðash_params.hybrid_casper_rlp_decoder_contract_address, - ethash_params.hybrid_casper_rlp_decoder_contract_code.clone())?; - } - } - - // Call Casper contract's init function. - let casper_contract = simple_casper_contract::SimpleCasper::default(); - let input = casper_contract.functions().init().input( - ethash_params.hybrid_casper_epoch_length, - ethash_params.hybrid_casper_warm_up_period, - ethash_params.hybrid_casper_withdrawal_delay, - ethash_params.hybrid_casper_dynasty_logout_delay, - ethash_params.hybrid_casper_msg_hasher_contract_address, - ethash_params.hybrid_casper_purity_checker_contract_address, - ethash_params.hybrid_casper_base_interest_factor, - ethash_params.hybrid_casper_base_penalty_factor, - ethash_params.hybrid_casper_min_deposit_size, - ); - - let _ = self.execute_as_system( - block, - ethash_params.hybrid_casper_contract_address, - U256::max_value(), - Some(input) - )?; - } - if block.header().number() >= ethash_params.hybrid_casper_transition + ethash_params.hybrid_casper_warm_up_period { if block.header().number() % ethash_params.hybrid_casper_epoch_length == 0 { let casper_contract = simple_casper_contract::SimpleCasper::default(); From ae3862184d8a5ac4b28fa0fbf92c0d5d3edc627b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 14:48:15 +0800 Subject: [PATCH 49/72] Move epoch initialization functionality to HybridCasper --- ethcore/src/engines/hybrid_casper.rs | 15 +++++++++++++++ ethcore/src/ethereum/ethash.rs | 11 +++++++++++ ethcore/src/machine.rs | 16 ---------------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index c7120ef9d3f..ec960e2d559 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -23,6 +23,7 @@ use rustc_hex::FromHex; use transaction::{SignedTransaction, Action}; use vm::Schedule; use state::{State, Backend}; +use types::BlockNumber; use super::SystemCall; use_contract!(simple_casper, "SimpleCasper", "res/contracts/simple_casper.json"); @@ -200,4 +201,18 @@ impl HybridCasper { .map_err(::engines::EngineError::FailedSystemCall) .map_err(Into::into) } + + pub fn on_new_epoch(&self, block_number: BlockNumber, caller: &mut SystemCall) -> Result<(), ::error::Error> { + if block_number % self.params.epoch_length == 0 { + let data = self.provider.functions().initialize_epoch().input( + block_number / self.params.epoch_length + ); + caller(self.params.contract_address, data) + .map(|_| ()) + .map_err(::engines::EngineError::FailedSystemCall) + .map_err(Into::into) + } else { + Ok(()) + } + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 75678e2a9f5..753eb1846ab 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -257,6 +257,17 @@ impl Engine for Arc { })?; } + if block.header().number() >= self.ethash_params.hybrid_casper_transition + self.ethash_params.hybrid_casper_params.warm_up_period { + self.casper.on_new_epoch(block.header().number(), &mut |address, data| { + self.machine().execute_as_system( + block, + address, + U256::max_value(), + Some(data) + ).map_err(|e| format!("{}", e)) + })?; + } + Ok(()) } diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 12b7b0f9779..21cde2d0493 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -301,22 +301,6 @@ impl EthereumMachine { .and_then(|b| state.transfer_balance(child, beneficiary, &b, CleanupMode::NoEmpty))?; } } - - if block.header().number() >= ethash_params.hybrid_casper_transition + ethash_params.hybrid_casper_warm_up_period { - if block.header().number() % ethash_params.hybrid_casper_epoch_length == 0 { - let casper_contract = simple_casper_contract::SimpleCasper::default(); - let input = casper_contract.functions().initialize_epoch().input( - block.header().number() / ethash_params.hybrid_casper_epoch_length - ); - - let _ = self.execute_as_system( - block, - ethash_params.hybrid_casper_contract_address, - U256::max_value(), - Some(input) - )?; - } - } } Ok(()) From 7525e83fcbdcd4dd9d1772f63400a7ac3af70a4c Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 15:23:42 +0800 Subject: [PATCH 50/72] Move closing metadata write to HybridCasper --- ethcore/src/engines/hybrid_casper.rs | 48 +++++++++++++++++++++++- ethcore/src/ethereum/ethash.rs | 19 +++++++++- ethcore/src/machine.rs | 56 ---------------------------- 3 files changed, 65 insertions(+), 58 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index ec960e2d559..ecb3001fc78 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -17,13 +17,14 @@ //! Hybrid Casper related functionalities. use bytes::Bytes; -use ethereum_types::{Address, U256}; +use ethereum_types::{Address, U256, H256}; use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; use rustc_hex::FromHex; use transaction::{SignedTransaction, Action}; use vm::Schedule; use state::{State, Backend}; use types::BlockNumber; +use ethabi::{self, ParamType}; use super::SystemCall; use_contract!(simple_casper, "SimpleCasper", "res/contracts/simple_casper.json"); @@ -215,4 +216,49 @@ impl HybridCasper { Ok(()) } } + + pub fn highest_justified_epoch(&self, caller: &mut SystemCall) -> Result { + let data = self.provider.functions().highest_justified_epoch().input( + self.params.non_revert_min_deposits, + ); + caller(self.params.contract_address, data) + .and_then(|output| { + Ok(ethabi::decode(&[ParamType::Int(128)], &output) + .map_err(|e| format!("{}", e))?[0].clone() + .to_int() + .expect("type checked by ethabi::decode; qed")) + }) + .map_err(::engines::EngineError::FailedSystemCall) + .map_err(Into::into) + } + + pub fn highest_finalized_epoch(&self, caller: &mut SystemCall) -> Result { + let data = self.provider.functions().highest_finalized_epoch().input( + self.params.non_revert_min_deposits, + ); + caller(self.params.contract_address, data) + .and_then(|output| { + Ok(ethabi::decode(&[ParamType::Int(128)], &output) + .map_err(|e| format!("{}", e))?[0].clone() + .to_int() + .expect("type checked by ethabi::decode; qed")) + }) + .map_err(::engines::EngineError::FailedSystemCall) + .map_err(Into::into) + } + + pub fn checkpoint_hashes(&self, epoch: U256, caller: &mut SystemCall) -> Result { + let data = self.provider.functions().checkpoint_hashes().input( + epoch, + ); + caller(self.params.contract_address, data) + .and_then(|output| { + Ok(H256::from_slice(ðabi::decode(&[ParamType::FixedBytes(32)], &output) + .map_err(|e| format!("{}", e))?[0].clone() + .to_fixed_bytes() + .expect("type checked by ethabi::decode; qed"))) + }) + .map_err(::engines::EngineError::FailedSystemCall) + .map_err(Into::into) + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 753eb1846ab..34a56e58e98 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -326,7 +326,24 @@ impl Engine for Arc { rewards.push((*uncle_author, RewardKind::Uncle, result_uncle_reward)); } - self.machine().write_closing_metadata(block)?; + // Write closing metadata for Casper. + if number >= self.ethash_params.hybrid_casper_transition { + let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + { + let mut system_call = |address, data| { + self.machine().execute_as_system( + block, + address, + U256::max_value(), + Some(data) + ).map_err(|e| format!("{}", e)) + }; + metadata.highest_justified_epoch = self.casper.highest_justified_epoch(&mut system_call)?; + metadata.highest_finalized_epoch = self.casper.highest_finalized_epoch(&mut system_call)?; + metadata.highest_finalized_hash = self.casper.checkpoint_hashes(metadata.highest_finalized_epoch, &mut system_call)?; + } + block.set_metadata(Some(rlp::encode(&metadata).to_vec())); + } block_reward::apply_block_rewards(&rewards, block, &self.machine) } diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 21cde2d0493..7dc0a8ee672 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -306,62 +306,6 @@ impl EthereumMachine { Ok(()) } - /// Write additional metadata when closing block. - pub fn write_closing_metadata(&self, block: &mut ExecutedBlock) -> Result<(), Error> { - if let Some(ref ethash_params) = self.ethash_extensions { - if block.header().number() >= ethash_params.hybrid_casper_transition { - let casper_contract = simple_casper_contract::SimpleCasper::default(); - let highest_justified_epoch: U256 = { - let input = casper_contract.functions().highest_justified_epoch().input( - ethash_params.hybrid_casper_non_revert_min_deposits, - ); - let result = self.execute_as_system( - block, - ethash_params.hybrid_casper_contract_address, - U256::max_value(), - Some(input) - )?; - casper_contract.functions().highest_justified_epoch().output(&result) - .expect("Casper contract ABI definition is valid; qed") - }; - let highest_finalized_epoch: U256 = { - let input = casper_contract.functions().highest_finalized_epoch().input( - ethash_params.hybrid_casper_non_revert_min_deposits, - ); - let result = self.execute_as_system( - block, - ethash_params.hybrid_casper_contract_address, - U256::max_value(), - Some(input) - )?; - casper_contract.functions().highest_finalized_epoch().output(&result) - .expect("Casper contract ABI definition is valid; qed") - }; - let highest_finalized_hash: H256 = { - let input = casper_contract.functions().checkpoint_hashes().input( - highest_finalized_epoch, - ); - let result = self.execute_as_system( - block, - ethash_params.hybrid_casper_contract_address, - U256::max_value(), - Some(input) - )?; - casper_contract.functions().checkpoint_hashes().output(&result) - .expect("Casper contract ABI definition is valid; qed") - }; - - let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - metadata.highest_justified_epoch = highest_justified_epoch; - metadata.highest_finalized_epoch = highest_finalized_epoch; - metadata.highest_finalized_hash = highest_finalized_hash; - block.set_metadata(Some(rlp::encode(&metadata).to_vec())); - } - } - - Ok(()) - } - /// Populate a header's fields based on its parent's header. /// Usually implements the chain scoring rule based on weight. /// The gas floor target must not be lower than the engine's minimum gas limit. From 426b85fae580bd6fdd621bacc7f7e2e0eeb65348 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 15:32:37 +0800 Subject: [PATCH 51/72] Move null_signer check out of Machine --- ethcore/src/engines/mod.rs | 2 +- ethcore/src/ethereum/ethash.rs | 4 ++++ ethcore/src/machine.rs | 13 +------------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index defe98961fc..81f19ed0d9a 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -463,7 +463,7 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { /// TODO: Add flags for which bits of the transaction to check. /// TODO: consider including State in the params. fn verify_transaction_basic(&self, t: &UnverifiedTransaction, header: &Header) -> Result<(), transaction::Error> { - self.machine().verify_transaction_basic(t, header) + self.machine().verify_transaction_basic(t, header, false) } /// Prepare the environment information passed for transaction execution. diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 34a56e58e98..100fe2539d0 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -467,6 +467,10 @@ impl EthEngine for Arc { Ok(signed) } + + fn verify_transaction_basic(&self, t: &UnverifiedTransaction, header: &Header) -> Result<(), transaction::Error> { + self.machine().verify_transaction_basic(t, header, header.number() >= self.ethash_params.hybrid_casper_transition) + } } impl Ethash { diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 7dc0a8ee672..e598c891029 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -447,7 +447,7 @@ impl EthereumMachine { } /// Does basic verification of the transaction. - pub fn verify_transaction_basic(&self, t: &UnverifiedTransaction, header: &Header) -> Result<(), transaction::Error> { + pub fn verify_transaction_basic(&self, t: &UnverifiedTransaction, header: &Header, allow_null_signer: bool) -> Result<(), transaction::Error> { let check_low_s = match self.ethash_extensions { Some(ref ext) => header.number() >= ext.homestead_transition, None => true, @@ -460,17 +460,6 @@ impl EthereumMachine { } else { None }; - - let allow_null_signer = if let Some(ref ethash_params) = self.ethash_extensions { - if header.number() >= ethash_params.hybrid_casper_transition { - true - } else { - false - } - } else { - false - }; - t.verify_basic(check_low_s, chain_id, allow_null_signer)?; Ok(()) From 7a7e26f79b8b34e5ade78d4cbd487efc1a86098b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 15:36:43 +0800 Subject: [PATCH 52/72] Move prepare_env_info and verify_transaction_outcome out of Machine --- ethcore/src/engines/mod.rs | 6 ++---- ethcore/src/ethereum/ethash.rs | 32 +++++++++++++++++++++++++++++ ethcore/src/machine.rs | 37 ---------------------------------- 3 files changed, 34 insertions(+), 41 deletions(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 81f19ed0d9a..29ba61b021b 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -467,13 +467,11 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { } /// Prepare the environment information passed for transaction execution. - fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { - self.machine().prepare_env_info(t, block, env_info) - } + fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { } /// Verify the transaction outcome is acceptable. fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { - self.machine().verify_transaction_outcome(t, block, receipt) + Ok(()) } /// Additional information. diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 100fe2539d0..f08a1b614dc 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -31,9 +31,11 @@ use engines::{self, Engine, EthEngine, ForkChoice}; use ethjson; use rlp::{self, Rlp}; use transaction::{self, UnverifiedTransaction, SignedTransaction}; +use types::receipt::{Receipt, TransactionOutcome}; use machine::{EthereumMachine, CasperMetadata}; use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; use types::ancestry_action::AncestryAction; +use vm::EnvInfo; /// Number of blocks in an ethash snapshot. // make dependent on difficulty incrment divisor? @@ -471,6 +473,36 @@ impl EthEngine for Arc { fn verify_transaction_basic(&self, t: &UnverifiedTransaction, header: &Header) -> Result<(), transaction::Error> { self.machine().verify_transaction_basic(t, header, header.number() >= self.ethash_params.hybrid_casper_transition) } + + fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { + if block.header().number() >= self.ethash_params.hybrid_casper_transition { + if t.is_unsigned() { + let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + env_info.gas_used = metadata.vote_gas_used; + } + } + } + + fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { + if block.header().number() >= self.ethash_params.hybrid_casper_transition { + if t.is_unsigned() { + match receipt.outcome { + TransactionOutcome::StatusCode(c) => { + if c == 0 { + return Err("Vote transaction failed.".into()); + } + }, + _ => panic!("Casper requires EIP658 to be enabled."), + } + + let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + metadata.vote_gas_used = receipt.gas_used; + receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); + block.set_metadata(Some(rlp::encode(&metadata).to_vec())); + } + } + Ok(()) + } } impl Ethash { diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index e598c891029..45f62a25837 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -34,7 +34,6 @@ use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Traci use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction, Action}; use tx_filter::TransactionFilter; use rustc_hex::FromHex; -use types::receipt::{Receipt, TransactionOutcome}; use ethcore_miner::pool::VerifiedTransaction; use parity_machine::WithMetadata; @@ -494,42 +493,6 @@ impl EthereumMachine { } rlp.as_val().map_err(|e| transaction::Error::InvalidRlp(e.to_string())) } - - /// Prepare the environment information passed for transaction execution. - pub fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { - if let Some(ref ethash_params) = self.ethash_extensions { - if block.header().number() >= ethash_params.hybrid_casper_transition { - if t.is_unsigned() { - let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - env_info.gas_used = metadata.vote_gas_used; - } - } - } - } - - /// Verify the transaction outcome is acceptable. - pub fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { - if let Some(ref ethash_params) = self.ethash_extensions { - if block.header().number() >= ethash_params.hybrid_casper_transition { - if t.is_unsigned() { - match receipt.outcome { - TransactionOutcome::StatusCode(c) => { - if c == 0 { - return Err("Vote transaction failed.".into()); - } - }, - _ => panic!("Casper requires EIP658 to be enabled."), - } - - let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - metadata.vote_gas_used = receipt.gas_used; - receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); - block.set_metadata(Some(rlp::encode(&metadata).to_vec())); - } - } - } - Ok(()) - } } /// Auxiliary data fetcher for an Ethereum machine. In Ethereum-like machines From 0ad4ffa1db5aaf3681e7eda78de34043cd119092 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 17:31:02 +0800 Subject: [PATCH 53/72] Remove unused casper variables in Machine --- ethcore/src/machine.rs | 68 ------------------------------------------ 1 file changed, 68 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 45f62a25837..5d72e868924 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -68,51 +68,10 @@ pub struct EthashExtensions { pub dao_hardfork_beneficiary: Address, /// DAO hard-fork DAO accounts list (L) pub dao_hardfork_accounts: Vec
, - /// Number of first block where Casper rules begin. - pub hybrid_casper_transition: u64, - /// EIP1011 Casper contract code. - pub hybrid_casper_contract_code: Bytes, - /// EIP1011 Casper contract address. - pub hybrid_casper_contract_address: Address, - /// EIP1011 Casper contract balance. - pub hybrid_casper_contract_balance: U256, - /// EIP1011 purity checker code. - pub hybrid_casper_purity_checker_contract_code: Bytes, - /// EIP1011 purity checker address. - pub hybrid_casper_purity_checker_contract_address: Address, - /// EIP1011 msg hasher code. - pub hybrid_casper_msg_hasher_contract_code: Bytes, - /// EIP1011 msg hasher address. - pub hybrid_casper_msg_hasher_contract_address: Address, - /// EIP1011 RLP decoder code. - pub hybrid_casper_rlp_decoder_contract_code: Bytes, - /// EIP1011 RLP decoder address. - pub hybrid_casper_rlp_decoder_contract_address: Address, - /// Whether to deploy EIP1011 RLP decoder or not. - pub hybrid_casper_deploy_rlp_decoder: bool, - - /// EIP1011 epoch length. - pub hybrid_casper_epoch_length: u64, - /// EIP1011 warm up period. - pub hybrid_casper_withdrawal_delay: u64, - /// EIP1011 dynasty logout delay. - pub hybrid_casper_dynasty_logout_delay: u64, - /// EIP1011 base interest factor, with 10 decimals. - pub hybrid_casper_base_interest_factor: U256, - /// EIP1011 base panelty factor, with 10 decimals. - pub hybrid_casper_base_penalty_factor: U256, - /// EIP1011 minimal deposit size. - pub hybrid_casper_min_deposit_size: U256, - /// EIP1011 warm up period. - pub hybrid_casper_warm_up_period: u64, - /// EIP1011 non revert min deposit. - pub hybrid_casper_non_revert_min_deposits: U256, } impl From<::ethjson::spec::EthashParams> for EthashExtensions { fn from(p: ::ethjson::spec::EthashParams) -> Self { - let hybrid_casper_rlp_decoder_contract_address = Address::from(0x43u64); - EthashExtensions { homestead_transition: p.homestead_transition.map_or(0, Into::into), eip150_transition: p.eip150_transition.map_or(0, Into::into), @@ -122,33 +81,6 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { dao_hardfork_transition: p.dao_hardfork_transition.map_or(u64::max_value(), Into::into), dao_hardfork_beneficiary: p.dao_hardfork_beneficiary.map_or_else(Address::new, Into::into), dao_hardfork_accounts: p.dao_hardfork_accounts.unwrap_or_else(Vec::new).into_iter().map(Into::into).collect(), - hybrid_casper_transition: p.hybrid_casper_transition.map_or_else(u64::max_value, Into::into), - hybrid_casper_contract_code: DEFAULT_CASPER_CONTRACT.replace("", &format!("{:x}", hybrid_casper_rlp_decoder_contract_address)).from_hex().expect( - "Default CASPER_CODE is valid", - ), - hybrid_casper_contract_address: Address::from(0x40u64), - hybrid_casper_contract_balance: U256::from(1250000) * ::ethereum::ether(), - hybrid_casper_purity_checker_contract_code: DEFAULT_PURITY_CHECKER_CONTRACT.from_hex().expect( - "Default PURITY_CHECKER_CODE is valid", - ), - hybrid_casper_purity_checker_contract_address: Address::from(0x41u64), - hybrid_casper_msg_hasher_contract_code: DEFAULT_MSG_HASHER_CONTRACT.from_hex().expect( - "Default MSG_HASHER_CODE is valid", - ), - hybrid_casper_msg_hasher_contract_address: Address::from(0x42u64), - hybrid_casper_rlp_decoder_contract_code: DEFAULT_RLP_DECODER_CONTRACT.from_hex().expect( - "Default RLP_DECODER_CODE is valid", - ), - hybrid_casper_rlp_decoder_contract_address: hybrid_casper_rlp_decoder_contract_address, - hybrid_casper_deploy_rlp_decoder: true, - hybrid_casper_epoch_length: 5, - hybrid_casper_withdrawal_delay: 150, - hybrid_casper_dynasty_logout_delay: 70, - hybrid_casper_base_interest_factor: U256::from(70000000), - hybrid_casper_base_penalty_factor: U256::from(2000), - hybrid_casper_min_deposit_size: U256::from(5) * ::ethereum::ether(), - hybrid_casper_warm_up_period: 5, - hybrid_casper_non_revert_min_deposits: U256::from(1) * ::ethereum::ether(), } } } From e547167502f9c98cc60e8b8a80a1a6a0051e3731 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 17:33:42 +0800 Subject: [PATCH 54/72] Move metadata struct to hybrid_casper --- ethcore/src/engines/hybrid_casper.rs | 24 ++++++++++++++++++++++++ ethcore/src/ethereum/ethash.rs | 16 ++++++++-------- ethcore/src/machine.rs | 24 ------------------------ 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index ecb3001fc78..a29e86cab0b 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -121,6 +121,30 @@ impl Default for HybridCasperParams { } } +/// Casper related metadata. +#[derive(Debug, PartialEq, Clone, RlpEncodable, RlpDecodable)] +pub struct HybridCasperMetadata { + /// Gas used in vote transactions. + pub vote_gas_used: U256, + /// Highest justified epoch returned by Casper contract. + pub highest_justified_epoch: U256, + /// Highest finalized epoch returned by Casper contract. + pub highest_finalized_epoch: U256, + /// Highest finalized block hash returned by Casper contract. + pub highest_finalized_hash: H256, +} + +impl Default for HybridCasperMetadata { + fn default() -> Self { + Self { + vote_gas_used: U256::zero(), + highest_justified_epoch: U256::zero(), + highest_finalized_epoch: U256::zero(), + highest_finalized_hash: Default::default(), + } + } +} + pub struct HybridCasper { params: HybridCasperParams, provider: simple_casper::SimpleCasper, diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index f08a1b614dc..6dd6098a5fb 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -20,7 +20,7 @@ use std::collections::BTreeMap; use std::sync::Arc; use hash::{KECCAK_EMPTY_LIST_RLP}; use engines::block_reward::{self, RewardKind}; -use engines::hybrid_casper::{HybridCasper, HybridCasperParams}; +use engines::hybrid_casper::{HybridCasper, HybridCasperParams, HybridCasperMetadata}; use ethash::{quick_get_difficulty, slow_hash_block_number, EthashManager, OptimizeFor}; use ethereum_types::{H256, H64, U256, Address}; use unexpected::{OutOfBounds, Mismatch}; @@ -32,7 +32,7 @@ use ethjson; use rlp::{self, Rlp}; use transaction::{self, UnverifiedTransaction, SignedTransaction}; use types::receipt::{Receipt, TransactionOutcome}; -use machine::{EthereumMachine, CasperMetadata}; +use machine::EthereumMachine; use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; use types::ancestry_action::AncestryAction; use vm::EnvInfo; @@ -330,7 +330,7 @@ impl Engine for Arc { // Write closing metadata for Casper. if number >= self.ethash_params.hybrid_casper_transition { - let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); { let mut system_call = |address, data| { self.machine().execute_as_system( @@ -428,8 +428,8 @@ impl Engine for Arc { } fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice { - let new_metadata: CasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - let current_metadata: CasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to // check transition block here. @@ -444,7 +444,7 @@ impl Engine for Arc { } fn ancestry_actions(&self, block: &ExecutedBlock, _ancestry: &mut Iterator) -> Vec { - let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); if metadata.highest_finalized_hash != Default::default() { // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a @@ -477,7 +477,7 @@ impl EthEngine for Arc { fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { if block.header().number() >= self.ethash_params.hybrid_casper_transition { if t.is_unsigned() { - let metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); env_info.gas_used = metadata.vote_gas_used; } } @@ -495,7 +495,7 @@ impl EthEngine for Arc { _ => panic!("Casper requires EIP658 to be enabled."), } - let mut metadata: CasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); metadata.vote_gas_used = receipt.gas_used; receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); block.set_metadata(Some(rlp::encode(&metadata).to_vec())); diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 5d72e868924..b2a2e991a29 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -85,30 +85,6 @@ impl From<::ethjson::spec::EthashParams> for EthashExtensions { } } -/// Casper related metadata. -#[derive(Debug, PartialEq, Clone, RlpEncodable, RlpDecodable)] -pub struct CasperMetadata { - /// Gas used in vote transactions. - pub vote_gas_used: U256, - /// Highest justified epoch returned by Casper contract. - pub highest_justified_epoch: U256, - /// Highest finalized epoch returned by Casper contract. - pub highest_finalized_epoch: U256, - /// Highest finalized block hash returned by Casper contract. - pub highest_finalized_hash: H256, -} - -impl Default for CasperMetadata { - fn default() -> Self { - Self { - vote_gas_used: U256::zero(), - highest_justified_epoch: U256::zero(), - highest_finalized_epoch: U256::zero(), - highest_finalized_hash: Default::default(), - } - } -} - /// Special rules to be applied to the schedule. pub type ScheduleCreationRules = Fn(&mut Schedule, BlockNumber) + Sync + Send; From 017d3269091b5f4ec84e82e03a6590c0539639c2 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 28 May 2018 17:38:26 +0800 Subject: [PATCH 55/72] Move internal logic for updating metadata to HybridCasper sturct --- ethcore/src/engines/hybrid_casper.rs | 8 ++++++++ ethcore/src/ethereum/ethash.rs | 21 ++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index a29e86cab0b..b549e10bab7 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -285,4 +285,12 @@ impl HybridCasper { .map_err(::engines::EngineError::FailedSystemCall) .map_err(Into::into) } + + pub fn update_metadata(&self, metadata: &mut HybridCasperMetadata, caller: &mut SystemCall) -> Result<(), ::error::Error> { + metadata.highest_justified_epoch = self.highest_justified_epoch(caller)?; + metadata.highest_finalized_epoch = self.highest_finalized_epoch(caller)?; + metadata.highest_finalized_hash = self.checkpoint_hashes(metadata.highest_finalized_epoch, caller)?; + + Ok(()) + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 6dd6098a5fb..c778a222fa5 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -331,19 +331,14 @@ impl Engine for Arc { // Write closing metadata for Casper. if number >= self.ethash_params.hybrid_casper_transition { let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - { - let mut system_call = |address, data| { - self.machine().execute_as_system( - block, - address, - U256::max_value(), - Some(data) - ).map_err(|e| format!("{}", e)) - }; - metadata.highest_justified_epoch = self.casper.highest_justified_epoch(&mut system_call)?; - metadata.highest_finalized_epoch = self.casper.highest_finalized_epoch(&mut system_call)?; - metadata.highest_finalized_hash = self.casper.checkpoint_hashes(metadata.highest_finalized_epoch, &mut system_call)?; - } + self.casper.update_metadata(&mut metadata, &mut |address, data| { + self.machine().execute_as_system( + block, + address, + U256::max_value(), + Some(data) + ).map_err(|e| format!("{}", e)) + })?; block.set_metadata(Some(rlp::encode(&metadata).to_vec())); } From 59d449f392e43ee55c13348456cec7ee6286b695 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 08:25:36 +0800 Subject: [PATCH 56/72] Move casper fork choice and ancestry action to hybrid casper --- ethcore/src/engines/hybrid_casper.rs | 36 +++++++++++++++++++++++++++- ethcore/src/ethereum/ethash.rs | 25 ++----------------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index b549e10bab7..8093b94a337 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -17,13 +17,18 @@ //! Hybrid Casper related functionalities. use bytes::Bytes; +use block::ExecutedBlock; use ethereum_types::{Address, U256, H256}; -use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; +use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT, ForkChoice}; +use header::ExtendedHeader; use rustc_hex::FromHex; +use rlp; use transaction::{SignedTransaction, Action}; use vm::Schedule; +use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; use state::{State, Backend}; use types::BlockNumber; +use types::ancestry_action::AncestryAction; use ethabi::{self, ParamType}; use super::SystemCall; @@ -293,4 +298,33 @@ impl HybridCasper { Ok(()) } + + pub fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { + let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + + // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to + // check transition block here. + let new_score = new_metadata.highest_justified_epoch * U256::from(10).pow(U256::from(40)) + new.total_score(); + let current_score = current_metadata.highest_justified_epoch * U256::from(10).pow(U256::from(40)) + current.total_score(); + + if new_score > current_score { + ForkChoice::New + } else { + ForkChoice::Old + } + } + + pub fn ancestry_actions(&self, block: &ExecutedBlock) -> Vec { + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + + if metadata.highest_finalized_hash != Default::default() { + // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a + // conditional. + vec![AncestryAction::MarkFinalized(metadata.highest_finalized_hash)] + } else { + // Default metadata would match this. So we don't need to check Casper transition block here. + vec![] + } + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index c778a222fa5..f9155346f14 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -423,32 +423,11 @@ impl Engine for Arc { } fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice { - let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - - // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to - // check transition block here. - let new_score = new_metadata.highest_justified_epoch * U256::from(10).pow(U256::from(40)) + new.total_score(); - let current_score = current_metadata.highest_justified_epoch * U256::from(10).pow(U256::from(40)) + current.total_score(); - - if new_score > current_score { - ForkChoice::New - } else { - ForkChoice::Old - } + self.casper.fork_choice(new, current) } fn ancestry_actions(&self, block: &ExecutedBlock, _ancestry: &mut Iterator) -> Vec { - let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - - if metadata.highest_finalized_hash != Default::default() { - // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a - // conditional. - vec![AncestryAction::MarkFinalized(metadata.highest_finalized_hash)] - } else { - // Default metadata would match this. So we don't need to check Casper transition block here. - vec![] - } + self.casper.ancestry_actions(block) } } From 233c0f03fc92fb80e7b24c9351cf456404e7df30 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 08:36:08 +0800 Subject: [PATCH 57/72] Move env_info and transaction outcome casper-specific logic to HybridCasper --- ethcore/src/engines/hybrid_casper.rs | 28 ++++++++++++++++++++++++++-- ethcore/src/ethereum/ethash.rs | 17 ++--------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index 8093b94a337..fd2d0fbb081 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -17,18 +17,19 @@ //! Hybrid Casper related functionalities. use bytes::Bytes; -use block::ExecutedBlock; +use block::{IsBlock, ExecutedBlock}; use ethereum_types::{Address, U256, H256}; use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT, ForkChoice}; use header::ExtendedHeader; use rustc_hex::FromHex; use rlp; use transaction::{SignedTransaction, Action}; -use vm::Schedule; +use vm::{EnvInfo, Schedule}; use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; use state::{State, Backend}; use types::BlockNumber; use types::ancestry_action::AncestryAction; +use types::receipt::{Receipt, TransactionOutcome}; use ethabi::{self, ParamType}; use super::SystemCall; @@ -327,4 +328,27 @@ impl HybridCasper { vec![] } } + + pub fn prepare_vote_transaction_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + env_info.gas_used = metadata.vote_gas_used; + } + + pub fn verify_vote_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), ::error::Error> { + match receipt.outcome { + TransactionOutcome::StatusCode(c) => { + if c == 0 { + return Err("Vote transaction failed.".into()); + } + }, + _ => panic!("Casper requires EIP658 to be enabled."), + } + + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + metadata.vote_gas_used = receipt.gas_used; + receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); + block.set_metadata(Some(rlp::encode(&metadata).to_vec())); + + Ok(()) + } } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index f9155346f14..77728182e01 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -451,8 +451,7 @@ impl EthEngine for Arc { fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { if block.header().number() >= self.ethash_params.hybrid_casper_transition { if t.is_unsigned() { - let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - env_info.gas_used = metadata.vote_gas_used; + self.casper.prepare_vote_transaction_env_info(t, block, env_info); } } } @@ -460,19 +459,7 @@ impl EthEngine for Arc { fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { if block.header().number() >= self.ethash_params.hybrid_casper_transition { if t.is_unsigned() { - match receipt.outcome { - TransactionOutcome::StatusCode(c) => { - if c == 0 { - return Err("Vote transaction failed.".into()); - } - }, - _ => panic!("Casper requires EIP658 to be enabled."), - } - - let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - metadata.vote_gas_used = receipt.gas_used; - receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); - block.set_metadata(Some(rlp::encode(&metadata).to_vec())); + self.casper.verify_vote_transaction_outcome(t, block, receipt)?; } } Ok(()) From 0004c8b922785ea2584747ae268a11c9bffd0f23 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 08:42:03 +0800 Subject: [PATCH 58/72] Fix unused imports and unused variables --- ethcore/src/engines/hybrid_casper.rs | 4 ++-- ethcore/src/engines/mod.rs | 4 ++-- ethcore/src/ethereum/ethash.rs | 6 +++--- ethcore/src/machine.rs | 12 +++--------- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index fd2d0fbb081..c8dca83d8da 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -329,12 +329,12 @@ impl HybridCasper { } } - pub fn prepare_vote_transaction_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { + pub fn prepare_vote_transaction_env_info(&self, _t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); env_info.gas_used = metadata.vote_gas_used; } - pub fn verify_vote_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), ::error::Error> { + pub fn verify_vote_transaction_outcome(&self, _t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), ::error::Error> { match receipt.outcome { TransactionOutcome::StatusCode(c) => { if c == 0 { diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index 29ba61b021b..e8b04d347f0 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -467,10 +467,10 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { } /// Prepare the environment information passed for transaction execution. - fn prepare_env_info(&self, t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { } + fn prepare_env_info(&self, _t: &SignedTransaction, _block: &ExecutedBlock, _env_info: &mut EnvInfo) { } /// Verify the transaction outcome is acceptable. - fn verify_transaction_outcome(&self, t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), Error> { + fn verify_transaction_outcome(&self, _t: &SignedTransaction, _block: &mut ExecutedBlock, _receipt: &mut Receipt) -> Result<(), Error> { Ok(()) } diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 77728182e01..fc51063ccc2 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -31,9 +31,9 @@ use engines::{self, Engine, EthEngine, ForkChoice}; use ethjson; use rlp::{self, Rlp}; use transaction::{self, UnverifiedTransaction, SignedTransaction}; -use types::receipt::{Receipt, TransactionOutcome}; +use types::receipt::Receipt; use machine::EthereumMachine; -use parity_machine::{WithMetadata, WithMetadataHeader, TotalScoredHeader}; +use parity_machine::WithMetadata; use types::ancestry_action::AncestryAction; use vm::EnvInfo; @@ -422,7 +422,7 @@ impl Engine for Arc { Some(Box::new(::snapshot::PowSnapshot::new(SNAPSHOT_BLOCKS, MAX_SNAPSHOT_BLOCKS))) } - fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> engines::ForkChoice { + fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { self.casper.fork_choice(new, current) } diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index b2a2e991a29..95e4b9890e0 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -17,32 +17,26 @@ //! Ethereum-like state machine definition. use std::collections::{BTreeMap, HashMap}; -use std::cmp::{self, Ordering}; +use std::cmp; use std::sync::Arc; -use bytes::Bytes; use block::{ExecutedBlock, IsBlock}; use builtin::Builtin; use client::{BlockInfo, CallContract}; use error::Error; use executive::Executive; -use engines::{DEFAULT_CASPER_CONTRACT, DEFAULT_PURITY_CHECKER_CONTRACT, DEFAULT_MSG_HASHER_CONTRACT, DEFAULT_RLP_DECODER_CONTRACT}; use header::{BlockNumber, Header, ExtendedHeader}; use spec::CommonParams; use state::{CleanupMode, Substate}; use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Tracing}; -use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction, Action}; +use transaction::{self, SYSTEM_ADDRESS, UnverifiedTransaction, SignedTransaction}; use tx_filter::TransactionFilter; -use rustc_hex::FromHex; -use ethcore_miner::pool::VerifiedTransaction; -use parity_machine::WithMetadata; use ethereum_types::{U256, Address}; use bytes::BytesRef; -use rlp::{self, Rlp}; +use rlp::Rlp; use vm::{CallType, ActionParams, ActionValue, ParamsType}; use vm::{EnvInfo, Schedule, CreateContractAddress}; -use hash::H256; use_contract!(simple_casper_contract, "SimpleCasper", "res/contracts/simple_casper.json"); From 86d08d6d309372e1c2c8e25f920f789db5f33122 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 08:43:39 +0800 Subject: [PATCH 59/72] Remove unused contract declaration --- ethcore/src/machine.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index 95e4b9890e0..1b6867ff225 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -38,8 +38,6 @@ use rlp::Rlp; use vm::{CallType, ActionParams, ActionValue, ParamsType}; use vm::{EnvInfo, Schedule, CreateContractAddress}; -use_contract!(simple_casper_contract, "SimpleCasper", "res/contracts/simple_casper.json"); - /// Parity tries to round block.gas_limit to multiple of this constant pub const PARITY_GAS_LIMIT_DETERMINANT: U256 = U256([37, 0, 0, 0]); From 58875dbef1c2d8063bffe4f03819289a2c2d30c1 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 08:49:41 +0800 Subject: [PATCH 60/72] Fix all missing docs --- ethcore/src/engines/hybrid_casper.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index c8dca83d8da..fc5a513c022 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -151,12 +151,14 @@ impl Default for HybridCasperMetadata { } } +/// Hybrid Casper functionalities as defined by EIP1011. pub struct HybridCasper { params: HybridCasperParams, provider: simple_casper::SimpleCasper, } impl HybridCasper { + /// Create a new Hybrid Casper instance based on parameters. pub fn new(params: HybridCasperParams) -> Self { Self { params, @@ -164,6 +166,8 @@ impl HybridCasper { } } + /// Check whether a signed transaction is vote transaction. The vote transaction must be an unsigned transaction, + /// whose to address is the casper contract address, and data starts with bytes 0xe9dc0614. pub fn is_vote_transaction(&self, transaction: &SignedTransaction) -> bool { if !transaction.is_unsigned() { return false; @@ -193,10 +197,12 @@ impl HybridCasper { return true; } + /// Modify the schedule to enable Casper-related functionalities. pub fn enable_casper_schedule(&self, schedule: &mut Schedule) { schedule.eip86 = true; } + /// Initialize Casper contract, purity checker contract, msg hasher contract and RLP decoder. pub fn init_state(&self, state: &mut State) -> Result<(), ::error::Error> { state.new_contract(&self.params.contract_address, self.params.contract_balance, @@ -215,6 +221,7 @@ impl HybridCasper { Ok(()) } + /// Called `init` function in Casper contract. pub fn init_casper_contract(&self, caller: &mut SystemCall) -> Result<(), ::error::Error> { let data = self.provider.functions().init().input( self.params.epoch_length, @@ -233,6 +240,8 @@ impl HybridCasper { .map_err(Into::into) } + /// Called at every block after Casper's warm up period. Initialize a new epoch if we are at the epoch starting + /// block. pub fn on_new_epoch(&self, block_number: BlockNumber, caller: &mut SystemCall) -> Result<(), ::error::Error> { if block_number % self.params.epoch_length == 0 { let data = self.provider.functions().initialize_epoch().input( @@ -247,6 +256,7 @@ impl HybridCasper { } } + /// Get the highest justified epoch. pub fn highest_justified_epoch(&self, caller: &mut SystemCall) -> Result { let data = self.provider.functions().highest_justified_epoch().input( self.params.non_revert_min_deposits, @@ -262,6 +272,7 @@ impl HybridCasper { .map_err(Into::into) } + /// Get the highest finalized epoch. pub fn highest_finalized_epoch(&self, caller: &mut SystemCall) -> Result { let data = self.provider.functions().highest_finalized_epoch().input( self.params.non_revert_min_deposits, @@ -277,6 +288,7 @@ impl HybridCasper { .map_err(Into::into) } + /// Get checkpoint hashes given an epoch. pub fn checkpoint_hashes(&self, epoch: U256, caller: &mut SystemCall) -> Result { let data = self.provider.functions().checkpoint_hashes().input( epoch, @@ -292,6 +304,7 @@ impl HybridCasper { .map_err(Into::into) } + /// Update block metadata based on the current block state. pub fn update_metadata(&self, metadata: &mut HybridCasperMetadata, caller: &mut SystemCall) -> Result<(), ::error::Error> { metadata.highest_justified_epoch = self.highest_justified_epoch(caller)?; metadata.highest_finalized_epoch = self.highest_finalized_epoch(caller)?; @@ -300,6 +313,7 @@ impl HybridCasper { Ok(()) } + /// Casper-specific fork choice. pub fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); @@ -316,6 +330,7 @@ impl HybridCasper { } } + /// Casper-specific ancestry actions. pub fn ancestry_actions(&self, block: &ExecutedBlock) -> Vec { let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); @@ -329,11 +344,13 @@ impl HybridCasper { } } + /// Prepare the env info required for vote transactions. pub fn prepare_vote_transaction_env_info(&self, _t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); env_info.gas_used = metadata.vote_gas_used; } + /// Verify the outcome of a vote transaction is valid. pub fn verify_vote_transaction_outcome(&self, _t: &SignedTransaction, block: &mut ExecutedBlock, receipt: &mut Receipt) -> Result<(), ::error::Error> { match receipt.outcome { TransactionOutcome::StatusCode(c) => { From bfd1b0c696d93b38322d654cfe91e51a80c50992 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 09:14:35 +0800 Subject: [PATCH 61/72] Fix tests --- ethcore/src/ethereum/ethash.rs | 2 ++ json/src/spec/ethash.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index fc51063ccc2..3f313b0655b 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -628,6 +628,8 @@ mod tests { eip649_reward: None, expip2_transition: u64::max_value(), expip2_duration_limit: 30, + hybrid_casper_transition: u64::max_value(), + hybrid_casper_params: Default::default(), } } diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index 4c304b385db..077ae042709 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -263,6 +263,8 @@ mod tests { eip649_reward: None, expip2_transition: None, expip2_duration_limit: None, + hybrid_casper_transition: None, + hybrid_casper_params: None, } }); } @@ -311,6 +313,8 @@ mod tests { eip649_reward: None, expip2_transition: None, expip2_duration_limit: None, + hybrid_casper_transition: None, + hybrid_casper_params: None, } }); } From 1319068b37b6dd6d81cdefa2017a3f76b51adc37 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 09:18:50 +0800 Subject: [PATCH 62/72] Use saturating_add to avoid possible overflow --- 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 3f313b0655b..2968f5d73a1 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -259,7 +259,7 @@ impl Engine for Arc { })?; } - if block.header().number() >= self.ethash_params.hybrid_casper_transition + self.ethash_params.hybrid_casper_params.warm_up_period { + if block.header().number() >= self.ethash_params.hybrid_casper_transition.saturating_add(self.ethash_params.hybrid_casper_params.warm_up_period) { self.casper.on_new_epoch(block.header().number(), &mut |address, data| { self.machine().execute_as_system( block, From e67ff2377b45e55cef6322d7cf51fa637c0424fd Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 15:35:45 +0800 Subject: [PATCH 63/72] Allow engine to specify additional transactions as service trnsaction --- ethcore/src/engines/mod.rs | 7 ++++++- ethcore/src/miner/pool_client.rs | 18 +++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs index e8b04d347f0..7654b5cb5f4 100644 --- a/ethcore/src/engines/mod.rs +++ b/ethcore/src/engines/mod.rs @@ -479,8 +479,13 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> { self.machine().additional_params() } - /// Performs pre-validation of RLP decoded transaction before other processing + /// Performs pre-validation of RLP decoded transaction before other processing. fn decode_transaction(&self, transaction: &[u8]) -> Result { self.machine().decode_transaction(transaction) } + + /// Whether the given transaction is considered a builtin service transaction. + fn is_builtin_service_transaction(&self, _t: &SignedTransaction, _header: &Header) -> bool { + false + } } diff --git a/ethcore/src/miner/pool_client.rs b/ethcore/src/miner/pool_client.rs index dfcdec684f8..b7c9059cef9 100644 --- a/ethcore/src/miner/pool_client.rs +++ b/ethcore/src/miner/pool_client.rs @@ -135,13 +135,17 @@ impl<'a, C: 'a> pool::client::Client for PoolClient<'a, C> where fn transaction_type(&self, tx: &SignedTransaction) -> pool::client::TransactionType { match self.service_transaction_checker { None => pool::client::TransactionType::Regular, - Some(ref checker) => match checker.check(self.chain, &tx) { - Ok(true) => pool::client::TransactionType::Service, - Ok(false) => pool::client::TransactionType::Regular, - Err(e) => { - debug!(target: "txqueue", "Unable to verify service transaction: {:?}", e); - pool::client::TransactionType::Regular - }, + Some(ref checker) => if self.engine.is_builtin_service_transaction(tx, &self.best_block_header) { + pool::client::TransactionType::Service + } else { + match checker.check(self.chain, &tx) { + Ok(true) => pool::client::TransactionType::Service, + Ok(false) => pool::client::TransactionType::Regular, + Err(e) => { + debug!(target: "txqueue", "Unable to verify service transaction: {:?}", e); + pool::client::TransactionType::Regular + }, + } } } } From 3f41dbc26df35635075151393071c032a32f7924 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 29 May 2018 15:38:10 +0800 Subject: [PATCH 64/72] Mark casper vote transactions as service transaction --- ethcore/src/ethereum/ethash.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 2968f5d73a1..f709eaab7a2 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -464,6 +464,14 @@ impl EthEngine for Arc { } Ok(()) } + + fn is_builtin_service_transaction(&self, t: &SignedTransaction, header: &Header) -> bool { + if header.number() >= self.ethash_params.hybrid_casper_transition { + self.casper.is_vote_transaction(t) + } else { + false + } + } } impl Ethash { From e10bb646e9e4cebb77dadbf09097bfce0b4b896b Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 30 May 2018 09:10:09 +0800 Subject: [PATCH 65/72] Set casper values back to defaults We can use json config to customize them now. --- ethcore/src/engines/hybrid_casper.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index fc5a513c022..8c14c026087 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -109,13 +109,13 @@ impl From<::ethjson::spec::HybridCasperParams> for HybridCasperParams { rlp_decoder_contract_address: rlp_decoder_contract_address, deploy_rlp_decoder: p.deploy_rlp_decoder.unwrap_or(true), - epoch_length: p.epoch_length.map_or(5, Into::into), - withdrawal_delay: p.withdrawal_delay.map_or(150, Into::into), - dynasty_logout_delay: p.dynasty_logout_delay.map_or(70, Into::into), + epoch_length: p.epoch_length.map_or(50, Into::into), + withdrawal_delay: p.withdrawal_delay.map_or(15000, Into::into), + dynasty_logout_delay: p.dynasty_logout_delay.map_or(700, Into::into), base_interest_factor: p.base_interest_factor.map_or(U256::from(70000000), Into::into), base_penalty_factor: p.base_penalty_factor.map_or(U256::from(2000), Into::into), - min_deposit_size: p.min_deposit_size.map_or(U256::from(5) * ::ethereum::ether(), Into::into), - warm_up_period: p.warm_up_period.map_or(5, Into::into), + min_deposit_size: p.min_deposit_size.map_or(U256::from(1500) * ::ethereum::ether(), Into::into), + warm_up_period: p.warm_up_period.map_or(180000, Into::into), non_revert_min_deposits: p.non_revert_min_deposits.map_or(U256::from(1) * ::ethereum::ether(), Into::into), } } From eaadeee4cfae49c666bb252b529714e6628cb686 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 30 May 2018 10:25:11 +0800 Subject: [PATCH 66/72] Update testnet definition --- ethcore/res/ethereum/casper_test.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index 7b5980def33..db1d2e08600 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -16,7 +16,11 @@ "eip649Reward": "0x29A2241AF62C0000", "eip100bTransition": "0x0", "eip649Transition": "0x0", - "hybridCasperTransition": "0x5" + "hybridCasperTransition": "0x32", + "hybridCasperParams": { + "epochLength": 50, + "warmUpPeriod": 50 + } } } }, @@ -59,6 +63,7 @@ "0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "pricing": { "modexp": { "divisor": 20 } } } }, "0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "pricing": { "linear": { "base": 500, "word": 0 } } } }, "0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "pricing": { "linear": { "base": 40000, "word": 0 } } } }, - "0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } } + "0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } }, + "00402845b96a30cfb8d49449d4b0159bcecd1d89": { "balance": "0x52B7D2DCC80CD2E4000000" } } } From 5c7d64e05917f1f2f75fe1d3eedfda975d309d92 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Mon, 4 Jun 2018 11:36:24 +0800 Subject: [PATCH 67/72] Fix cargo.lock merge failure --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a876a7a5fd9..0eb1bfa6af6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -457,12 +457,12 @@ version = "5.1.1" source = "git+https://github.com/paritytech/ethabi?branch=casper#6ec7a3eb5e0c12dd24bbba037e1c885e47d7fd33" dependencies = [ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] From 1ba5e4df3755553b718aa34e4392aa8126e0aefb Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 5 Jun 2018 11:39:02 +0800 Subject: [PATCH 68/72] Fix casper test config --- ethcore/res/ethereum/casper_test.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index db1d2e08600..c98ee45b263 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -9,10 +9,6 @@ "durationLimit": "0x0d", "blockReward": "0x4563918244F40000", "homesteadTransition": "0x0", - "eip150Transition": "0x0", - "eip160Transition": "0x0", - "eip161abcTransition": "0x0", - "eip161dTransition": "0x0", "eip649Reward": "0x29A2241AF62C0000", "eip100bTransition": "0x0", "eip649Transition": "0x0", @@ -38,7 +34,11 @@ "eip140Transition": "0x0", "eip211Transition": "0x0", "eip214Transition": "0x0", - "eip658Transition": "0x0" + "eip658Transition": "0x0", + "eip150Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0" }, "genesis": { "seal": { From 801a9649bd84658eac5e2ef75f812114a1bf4a91 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Fri, 8 Jun 2018 16:01:21 +0800 Subject: [PATCH 69/72] Fix tests in EIP86 incident --- ethcore/src/machine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index a562d31d7dd..400a7e7177d 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -500,7 +500,7 @@ mod tests { let mut header = ::header::Header::new(); header.set_number(15); - let res = machine.verify_transaction_basic(&transaction, &header); + let res = machine.verify_transaction_basic(&transaction, &header, false); assert_eq!(res, Err(transaction::Error::InvalidSignature("Crypto error (Invalid EC signature)".into()))); } From cfe51a82c5daebd26ef1b9683d53b04f331a3e6a Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 12 Jun 2018 19:54:32 +0800 Subject: [PATCH 70/72] Fix all instance of typo for "deserializing" --- ethcore/src/engines/hybrid_casper.rs | 10 +++++----- ethcore/src/ethereum/ethash.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index 8c14c026087..775c08a2c34 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -315,8 +315,8 @@ impl HybridCasper { /// Casper-specific fork choice. pub fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { - let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to // check transition block here. @@ -332,7 +332,7 @@ impl HybridCasper { /// Casper-specific ancestry actions. pub fn ancestry_actions(&self, block: &ExecutedBlock) -> Vec { - let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); if metadata.highest_finalized_hash != Default::default() { // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a @@ -346,7 +346,7 @@ impl HybridCasper { /// Prepare the env info required for vote transactions. pub fn prepare_vote_transaction_env_info(&self, _t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { - let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); env_info.gas_used = metadata.vote_gas_used; } @@ -361,7 +361,7 @@ impl HybridCasper { _ => panic!("Casper requires EIP658 to be enabled."), } - let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); metadata.vote_gas_used = receipt.gas_used; receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); block.set_metadata(Some(rlp::encode(&metadata).to_vec())); diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 5127d1a0062..e84b244d6d3 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -330,7 +330,7 @@ impl Engine for Arc { // Write closing metadata for Casper. if number >= self.ethash_params.hybrid_casper_transition { - let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserailzling CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); self.casper.update_metadata(&mut metadata, &mut |address, data| { self.machine().execute_as_system( block, From 7bfd9908bbcdf42b3bce75774befabbcb12b1f52 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 12 Jun 2018 19:56:44 +0800 Subject: [PATCH 71/72] Use unwrap_or_else whenever possible --- ethcore/src/engines/hybrid_casper.rs | 12 ++++++------ ethcore/src/ethereum/ethash.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ethcore/src/engines/hybrid_casper.rs b/ethcore/src/engines/hybrid_casper.rs index 775c08a2c34..a47506370c4 100644 --- a/ethcore/src/engines/hybrid_casper.rs +++ b/ethcore/src/engines/hybrid_casper.rs @@ -315,8 +315,8 @@ impl HybridCasper { /// Casper-specific fork choice. pub fn fork_choice(&self, new: &ExtendedHeader, current: &ExtendedHeader) -> ForkChoice { - let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); - let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let new_metadata: HybridCasperMetadata = new.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or_else(Default::default); + let current_metadata: HybridCasperMetadata = current.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or_else(Default::default); // Casper fails back to total difficulty fork choice if highest_justified_epoch is zero. So we don't need to // check transition block here. @@ -332,7 +332,7 @@ impl HybridCasper { /// Casper-specific ancestry actions. pub fn ancestry_actions(&self, block: &ExecutedBlock) -> Vec { - let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or_else(Default::default); if metadata.highest_finalized_hash != Default::default() { // Call finalize on an already finalized block won't do anything. So we just do that for now to avoid a @@ -346,7 +346,7 @@ impl HybridCasper { /// Prepare the env info required for vote transactions. pub fn prepare_vote_transaction_env_info(&self, _t: &SignedTransaction, block: &ExecutedBlock, env_info: &mut EnvInfo) { - let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or_else(Default::default); env_info.gas_used = metadata.vote_gas_used; } @@ -361,9 +361,9 @@ impl HybridCasper { _ => panic!("Casper requires EIP658 to be enabled."), } - let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or_else(Default::default); metadata.vote_gas_used = receipt.gas_used; - receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or(U256::zero()); + receipt.gas_used = block.receipts().last().map(|r| r.gas_used).unwrap_or_else(U256::zero); block.set_metadata(Some(rlp::encode(&metadata).to_vec())); Ok(()) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index e84b244d6d3..663f3354cc7 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -330,7 +330,7 @@ impl Engine for Arc { // Write closing metadata for Casper. if number >= self.ethash_params.hybrid_casper_transition { - let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or(Default::default()); + let mut metadata: HybridCasperMetadata = block.metadata().map(|d| rlp::decode(d).expect("Metadata is only set by serializing CasperMetadata struct; deserializing CasperMetadata RLP always succeeds; qed")).unwrap_or_else(Default::default); self.casper.update_metadata(&mut metadata, &mut |address, data| { self.machine().execute_as_system( block, From 5097bc605c8208823e2617ed429547f14b112a4e Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Tue, 12 Jun 2018 19:59:31 +0800 Subject: [PATCH 72/72] Update casper_test file to point to the current live testnet --- ethcore/res/ethereum/casper_test.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethcore/res/ethereum/casper_test.json b/ethcore/res/ethereum/casper_test.json index c98ee45b263..38eca8835a3 100644 --- a/ethcore/res/ethereum/casper_test.json +++ b/ethcore/res/ethereum/casper_test.json @@ -54,7 +54,10 @@ "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", "gasLimit": "0x5f5e100" }, - "nodes": [], + "nodes": [ + "enode://c32ec5909c84ca346dda05435809889fed101dadadcae5e255e09658bcb1e4d1ed304c90929e34a3b51d9cf5869ff486c887f600dbd8f0305f52637280a7a55a@139.162.71.88:30303", + "enode://b541cb9808a932ac2b7e3ea9fb584dc0cac391527788773fccceaae7a2d86bd250f725bf5899a452ef25b2ff69084d830c2f905fce619eaf372ccd63f3056d98@139.162.71.88:31303" + ], "accounts": { "0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, "0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, @@ -64,6 +67,6 @@ "0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "pricing": { "linear": { "base": 500, "word": 0 } } } }, "0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "pricing": { "linear": { "base": 40000, "word": 0 } } } }, "0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } }, - "00402845b96a30cfb8d49449d4b0159bcecd1d89": { "balance": "0x52B7D2DCC80CD2E4000000" } + "bfb20f94b5640d144592ab9a64c3b515add1b90e": { "balance": "0x52B7D2DCC80CD2E4000000" } } }