diff --git a/Cargo.lock b/Cargo.lock index eea698b36..e3253915f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,6 +5,16 @@ name = "adler32" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "aes" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "aes-ctr" version = "0.3.0" @@ -110,6 +120,11 @@ dependencies = [ "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "arrayvec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "asn1_der" version = "0.6.3" @@ -272,6 +287,15 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "block-modes" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-padding" version = "0.1.4" @@ -673,6 +697,10 @@ dependencies = [ [[package]] name = "darwinia-chainrelay-poa" version = "0.1.0" +dependencies = [ + "sr-primitives 2.0.0 (git+https://github.com/paritytech/substrate.git)", + "substrate-primitives 2.0.0 (git+https://github.com/paritytech/substrate.git)", +] [[package]] name = "darwinia-staking" @@ -849,6 +877,31 @@ dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ethbloom" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ethereum-types" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ethbloom 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "evo-kton" version = "0.1.0" @@ -947,6 +1000,17 @@ dependencies = [ "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fixed-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fixedbitset" version = "0.1.9" @@ -1423,6 +1487,14 @@ dependencies = [ "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "impl-rlp" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rlp 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "impl-serde" version = "0.2.2" @@ -1656,6 +1728,15 @@ name = "keccak" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "keccak-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -2755,6 +2836,30 @@ dependencies = [ "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-crypto" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-modes 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-secp256k1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parity-multiaddr" version = "0.5.0" @@ -2809,6 +2914,17 @@ dependencies = [ "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-secp256k1" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parity-send-wrapper" version = "0.1.0" @@ -2945,8 +3061,13 @@ name = "pbkdf2" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3012,6 +3133,18 @@ dependencies = [ "uint 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "primitive-types" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fixed-hash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-codec 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro-crate" version = "0.1.4" @@ -3434,6 +3567,34 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ripemd160" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rlp" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rlp_derive" +version = "0.1.0" +source = "git+https://github.com/paritytech/parity-ethereum.git#1b4d23fd20c90d8c61f33c64cace740d0616f930" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rocksdb" version = "0.11.0" @@ -3546,6 +3707,18 @@ name = "scopeguard" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scrypt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sct" version = "0.5.0" @@ -3823,6 +3996,24 @@ dependencies = [ "substrate-debug-derive 2.0.0 (git+https://github.com/paritytech/substrate.git)", ] +[[package]] +name = "sr-eth-primitives" +version = "0.1.0" +dependencies = [ + "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hash 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp_derive 0.1.0 (git+https://github.com/paritytech/parity-ethereum.git)", + "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 2.0.0 (git+https://github.com/paritytech/substrate.git)", + "sr-std 2.0.0 (git+https://github.com/paritytech/substrate.git)", + "srml-support 2.0.0 (git+https://github.com/paritytech/substrate.git)", + "substrate-primitives 2.0.0 (git+https://github.com/paritytech/substrate.git)", +] + [[package]] name = "sr-io" version = "2.0.0" @@ -3859,6 +4050,10 @@ dependencies = [ "substrate-primitives 2.0.0 (git+https://github.com/paritytech/substrate.git)", ] +[[package]] +name = "sr-rlp" +version = "0.1.0" + [[package]] name = "sr-sandbox" version = "2.0.0" @@ -4416,6 +4611,11 @@ name = "static_assertions" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "static_slice" version = "0.0.3" @@ -6383,6 +6583,7 @@ dependencies = [ [metadata] "checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +"checksum aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" "checksum aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" "checksum aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" "checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" @@ -6395,6 +6596,7 @@ dependencies = [ "checksum arc-swap 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f1a1eca3195b729bbd64e292ef2f5fff6b1c28504fed762ce2b1013dde4d8e92" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" "checksum asn1_der 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" "checksum asn1_der_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" @@ -6414,6 +6616,7 @@ dependencies = [ "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" +"checksum block-modes 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "31aa8410095e39fdb732909fb5730a48d5bd7c2e3cd76bd1b07b3dbea130c529" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c95ee6bba9d950218b6cc910cf62bc9e0a171d0f4537e3627b0f54d08549b188" "checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" @@ -6473,6 +6676,8 @@ dependencies = [ "checksum environmental 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34f8467a0284de039e6bd0e25c14519538462ba5beb548bb1f03e645097837a8" "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" "checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9" +"checksum ethbloom 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "32cfe1c169414b709cf28aa30c74060bdb830a03a8ba473314d079ac79d80a5f" +"checksum ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba744248e3553a393143d5ebb68939fc3a4ec0c22a269682535f5ffe7fed728c" "checksum exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d8013f441e38e31c670e7f34ec8f1d5d3a2bd9d303c1ff83976ca886005e8f48" "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" "checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" @@ -6480,6 +6685,7 @@ dependencies = [ "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum finality-grandpa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34754852da8d86bc509715292c73140a5b678656d0b16132acd6737bdb5fd5f8" "checksum fixed-hash 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "516877b7b9a1cc2d0293cbce23cd6203f0edbfd4090e6ca4489fecb5aa73050e" +"checksum fixed-hash 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72fe7539e2c5692c6989f2f9c0457e42f1e5768f96b85c87d273574670ae459f" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum flate2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" @@ -6532,6 +6738,7 @@ dependencies = [ "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" "checksum impl-codec 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3fa0086251524c50fd53b32e7b05eb6d79e2f97221eaf0c53c0ca9c3096f21d3" +"checksum impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f7a72f11830b52333f36e3b09a288333888bf54380fd0ac0790a3c31ab0f3c5" "checksum impl-serde 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a263dc95daa6c3788c8f7133d86dc2ad89ec5a0c56167f9e3441c5f7f33358c4" "checksum impl-trait-for-tuples 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6947b372790f8948f439bb6aaa6baabdf80be1a207a477ff072f83fb793e428f" "checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2" @@ -6556,6 +6763,7 @@ dependencies = [ "checksum jsonrpc-server-utils 13.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d415f51d016a4682878e19dd03e8c0b61cd4394912d7cd3dc48d4f19f061a4e" "checksum jsonrpc-ws-server 13.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4699433c1ac006d7df178b4c29c191e5bb6d81e2dca18c5c804a094592900101" "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +"checksum keccak-hash 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f0e55d8f242fdc281c21c4cd70960a25db6dd17cc6232d8b38b564b5b18c784" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" @@ -6638,10 +6846,12 @@ dependencies = [ "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum parity-codec 4.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c1a0e8c54ce49245caa93c1a4e11dc4da1d1e9cc8649ff30e57aa177d4abd55" "checksum parity-codec-derive 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00a486fd383382ddcb2de928364b1f82571c1e48274fc43b7667a4738ee4056c" +"checksum parity-crypto 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "27a9c2b525c93d717a234eb220c26474f8d97b08ac50d79faeac4cb6c74bf0b9" "checksum parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "045b3c7af871285146300da35b1932bb6e4639b66c7c98e85d06a32cbc4e8fa7" "checksum parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3" "checksum parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "001fbbb956d8593f321c7a784f64d16b2c99b2657823976eea729006ad2c3668" "checksum parity-scale-codec-derive 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42af752f59119656fa3cb31e8852ed24e895b968c0bdb41847da7f0cea6d155f" +"checksum parity-secp256k1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4fca4f82fccae37e8bbdaeb949a4a218a1bbc485d11598f193d2a908042e5fc1" "checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" "checksum parity-util-mem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2005637ccf93dbb60c85081ccaaf3f945f573da48dcc79f27f9646caa3ec1dc" "checksum parity-wasm 0.40.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1e39faaa292a687ea15120b1ac31899b13586446521df6c149e46f1584671e0f" @@ -6666,6 +6876,7 @@ dependencies = [ "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" "checksum primitive-types 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "83ef7b3b965c0eadcb6838f34f827e1dfb2939bdd5ebd43f9647e009b12b0371" +"checksum primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a0253db64c26d8b4e7896dd2063b516d2a1b9e0a5da26b5b78335f236d1e9522" "checksum proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" "checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097" "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" @@ -6708,6 +6919,9 @@ dependencies = [ "checksum reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)" = "2c2064233e442ce85c77231ebd67d9eca395207dec2127fe0bbedde4bd29a650" "checksum rhododendron 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "36542aafc2429a4c010fafa079a20dee953b663cb2427f51d86cf1d436846b4d" "checksum ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "426bc186e3e95cac1e4a4be125a4aca7e84c2d616ffc02244eef36e2a60a093c" +"checksum ripemd160 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad5112e0dbbb87577bfbc56c42450235e3012ce336e29c5befd7807bd626da4a" +"checksum rlp 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8376a3f725ebb53f69263bbebb42196361fdfd551212409c8a721239aab4f09f" +"checksum rlp_derive 0.1.0 (git+https://github.com/paritytech/parity-ethereum.git)" = "" "checksum rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1651697fefd273bfb4fd69466cc2a9d20de557a0213b97233b22b5e95924b5e" "checksum rpassword 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f072d931f11a96546efd97642e1e75e807345aced86b947f9239102f262d0fcd" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" @@ -6722,6 +6936,7 @@ dependencies = [ "checksum schnorrkel 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eacd8381b3c37840c9c9f40472af529e49975bdcbc24f83c31059fd6539023d3" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" +"checksum scrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "656c79d0e90d0ab28ac86bf3c3d10bfbbac91450d3f190113b4e76d9fec3cfdd" "checksum sct 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f5adf8fbd58e1b1b52699dc8bed2630faecb6d8c7bee77d009d6bbe4af569b9" "checksum security-framework 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eee63d0f4a9ec776eeb30e220f0bc1e092c3ad744b2a379e3993070364d3adc2" "checksum security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9636f8989cbf61385ae4824b98c1aaa54c994d7d8b41f11c601ed799f0549a56" @@ -6792,6 +7007,7 @@ dependencies = [ "checksum srml-utility 2.0.0 (git+https://github.com/paritytech/substrate.git)" = "" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" +"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" "checksum stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" "checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" diff --git a/Cargo.toml b/Cargo.toml index 340f4c43d..f4740a41b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,8 @@ path = 'node/src/main.rs' [workspace] members = [ # "darwinia-client", + "core/sr-eth-primitives", + "core/sr-rlp", "node/cli", "node/executor", "node/primitives", diff --git a/core/sr-eth-primitives/Cargo.toml b/core/sr-eth-primitives/Cargo.toml new file mode 100644 index 000000000..c11ecf277 --- /dev/null +++ b/core/sr-eth-primitives/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "sr-eth-primitives" +version = "0.1.0" +authors = ["hammeWang "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + + +[dependencies] +serde = { version = "1.0.101", optional = true, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } +rstd = { package = "sr-std", git = 'https://github.com/paritytech/substrate.git', default-features = false } +sr-primitives = {git = 'https://github.com/paritytech/substrate.git', default-features = false } +substrate-primitives = {git = 'https://github.com/paritytech/substrate.git', default-features = false } +rlp = { version = "0.4.3", optional = true } +parity-crypto = { version = "0.4.2", features = ["publickey"] } +rlp_derive = { git = "https://github.com/paritytech/parity-ethereum.git" } +ethereum-types = "0.8.0" +keccak-hash = "0.4.0" + + +[dev-dependencies] +support = { package = "srml-support", git = 'https://github.com/paritytech/substrate.git'} +rustc-hex = "2.0" + +[features] +default = ["std"] +std = [ + "serde", + "codec/std", + "rstd/std", + "sr-primitives/std", + "substrate-primitives/std", + "rlp", + "keccak-hash/std", + "ethereum-types/std", + "parity-crypto/publickey" +] + diff --git a/core/sr-eth-primitives/src/lib.rs b/core/sr-eth-primitives/src/lib.rs new file mode 100644 index 000000000..0338a6171 --- /dev/null +++ b/core/sr-eth-primitives/src/lib.rs @@ -0,0 +1,404 @@ +#![recursion_limit = "128"] +#![cfg_attr(not(feature = "std"), no_std)] + +pub use codec::{Decode, Encode}; +use ethereum_types::{Address, BigEndianHash, H160, H256, U256}; +use keccak_hash::keccak; +use parity_crypto::publickey::{public_to_address, recover, Public, Secret, Signature}; +use rlp::{self, DecoderError, Encodable, Rlp, RlpStream}; +use rstd::ops::Deref; +use rstd::prelude::*; +use substrate_primitives::RuntimeDebug; + +#[cfg(test)] +mod tests; + +pub type Bytes = Vec; + +/// Fake address for unsigned transactions as defined by EIP-86. +pub const UNSIGNED_SENDER: Address = H160([0xff; 20]); + +/// Replay protection logic for v part of transaction's signature +pub mod signature { + /// Adds chain id into v + pub fn add_chain_replay_protection(v: u64, chain_id: Option) -> u64 { + v + if let Some(n) = chain_id { 35 + n * 2 } else { 27 } + } + + /// Returns refined v + /// 0 if `v` would have been 27 under "Electrum" notation, 1 if 28 or 4 if invalid. + pub fn check_replay_protection(v: u64) -> u8 { + match v { + v if v == 27 => 0, + v if v == 28 => 1, + v if v >= 35 => ((v - 1) % 2) as u8, + _ => 4, + } + } +} + +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +pub enum Action { + /// Create creates new contract. + Create, + /// Calls contract at given address. + /// In the case of a transfer, this is the receiver's address.' + Call(Address), +} + +impl Default for Action { + fn default() -> Action { + Action::Create + } +} + +impl rlp::Decodable for Action { + fn decode(rlp: &Rlp) -> Result { + if rlp.is_empty() { + if rlp.is_data() { + Ok(Action::Create) + } else { + Err(DecoderError::RlpExpectedToBeData) + } + } else { + Ok(Action::Call(rlp.as_val()?)) + } + } +} + +impl rlp::Encodable for Action { + fn rlp_append(&self, s: &mut RlpStream) { + match *self { + Action::Create => s.append_internal(&""), + Action::Call(ref addr) => s.append_internal(addr), + }; + } +} + +pub struct BestBLock { + height: u64, // enough for ethereum poa network (kovan) + hash: H256, + total_difficulty: U256, +} + +#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +struct EthHeader { + parent_hash: H256, + ommers_hash: H256, + beneficiary: Address, + state_root: H256, + transactions_root: H256, + receipt_root: H256, + logs_bloom: H256, + difficulty: u64, + number: u64, + gas_limit: u64, + gas_used: u64, + timestamp: Moment, + extra_data: Bytes, + mix_hash: H256, + nonce: u64, +} + +#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +pub struct PlainTransaction { + pub nonce: U256, + pub gas_price: U256, + pub gas: U256, + pub action: Action, + pub value: U256, + pub data: Bytes, +} + +impl PlainTransaction { + /// Append object with a without signature into RLP stream + pub fn rlp_append_unsigned_transaction(&self, s: &mut RlpStream, chain_id: Option) { + s.begin_list(if chain_id.is_none() { 6 } else { 9 }); + s.append(&self.nonce); + s.append(&self.gas_price); + s.append(&self.gas); + s.append(&self.action); + s.append(&self.value); + s.append(&self.data); + if let Some(n) = chain_id { + s.append(&n); + s.append(&0u8); + s.append(&0u8); + } + } + + /// The message hash of the transaction. + pub fn hash(&self, chain_id: Option) -> H256 { + let mut stream = RlpStream::new(); + self.rlp_append_unsigned_transaction(&mut stream, chain_id); + keccak(stream.as_raw()) + } + + /// Signs the transaction as coming from `sender`. + pub fn sign(self, secret: &Secret, chain_id: Option) -> SignedTransaction { + let sig = parity_crypto::publickey::sign(secret, &self.hash(chain_id)) + .expect("data is valid and context has signing capabilities; qed"); + SignedTransaction::new(self.with_signature(sig, chain_id)).expect("secret is valid so it's recoverable") + } + + /// Signs the transaction with signature. + pub fn with_signature(self, sig: Signature, chain_id: Option) -> UnverifiedTransaction { + UnverifiedTransaction { + unsigned: self, + r: sig.r().into(), + s: sig.s().into(), + v: signature::add_chain_replay_protection(sig.v() as u64, chain_id), + hash: H256::zero(), + } + .compute_hash() + } + + /// Useful for test incorrectly signed transactions. + #[cfg(test)] + pub fn invalid_sign(self) -> UnverifiedTransaction { + UnverifiedTransaction { + unsigned: self, + r: U256::one(), + s: U256::one(), + v: 0, + hash: H256::zero(), + } + .compute_hash() + } + + /// Specify the sender; this won't survive the serialize/deserialize process, but can be cloned. + pub fn fake_sign(self, from: Address) -> SignedTransaction { + SignedTransaction { + transaction: UnverifiedTransaction { + unsigned: self, + r: U256::one(), + s: U256::one(), + v: 0, + hash: H256::zero(), + } + .compute_hash(), + sender: from, + public: None, + } + } + + /// Add EIP-86 compatible empty signature. + pub fn null_sign(self, chain_id: u64) -> SignedTransaction { + SignedTransaction { + transaction: UnverifiedTransaction { + unsigned: self, + r: U256::zero(), + s: U256::zero(), + v: chain_id, + hash: H256::zero(), + } + .compute_hash(), + sender: UNSIGNED_SENDER, + public: None, + } + } +} + +#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +pub struct UnverifiedTransaction { + unsigned: PlainTransaction, + v: u64, + r: U256, + s: U256, + hash: H256, +} + +impl Deref for UnverifiedTransaction { + type Target = PlainTransaction; + + fn deref(&self) -> &Self::Target { + &self.unsigned + } +} + +impl rlp::Decodable for UnverifiedTransaction { + fn decode(d: &Rlp) -> Result { + if d.item_count()? != 9 { + return Err(DecoderError::RlpIncorrectListLen); + } + let hash = keccak(d.as_raw()); + Ok(UnverifiedTransaction { + unsigned: PlainTransaction { + nonce: d.val_at(0)?, + gas_price: d.val_at(1)?, + gas: d.val_at(2)?, + action: d.val_at(3)?, + value: d.val_at(4)?, + data: d.val_at(5)?, + }, + v: d.val_at(6)?, + r: d.val_at(7)?, + s: d.val_at(8)?, + hash: hash, + }) + } +} + +impl rlp::Encodable for UnverifiedTransaction { + fn rlp_append(&self, s: &mut RlpStream) { + self.rlp_append_sealed_transaction(s) + } +} + +impl UnverifiedTransaction { + /// Used to compute hash of created transactions + fn compute_hash(mut self) -> UnverifiedTransaction { + let hash = keccak(&*self.rlp_bytes()); + self.hash = hash; + self + } + + /// Checks if the signature is empty. + pub fn is_unsigned(&self) -> bool { + self.r.is_zero() && self.s.is_zero() + } + + /// Returns transaction receiver, if any + pub fn receiver(&self) -> Option
{ + match self.unsigned.action { + Action::Create => None, + Action::Call(receiver) => Some(receiver), + } + } + + /// Append object with a signature into RLP stream + fn rlp_append_sealed_transaction(&self, s: &mut RlpStream) { + s.begin_list(9); + s.append(&self.nonce); + s.append(&self.gas_price); + s.append(&self.gas); + s.append(&self.action); + s.append(&self.value); + s.append(&self.data); + s.append(&self.v); + s.append(&self.r); + s.append(&self.s); + } + + /// Reference to unsigned part of this transaction. + pub fn as_unsigned(&self) -> &PlainTransaction { + &self.unsigned + } + + /// Returns standardized `v` value (0, 1 or 4 (invalid)) + pub fn standard_v(&self) -> u8 { + signature::check_replay_protection(self.v) + } + + /// The `v` value that appears in the RLP. + pub fn original_v(&self) -> u64 { + self.v + } + + /// The chain ID, or `None` if this is a global transaction. + pub fn chain_id(&self) -> Option { + match self.v { + v if self.is_unsigned() => Some(v), + v if v >= 35 => Some((v - 35) / 2), + _ => None, + } + } + + /// Construct a signature object from the sig. + pub fn signature(&self) -> Signature { + let r: H256 = BigEndianHash::from_uint(&self.r); + let s: H256 = BigEndianHash::from_uint(&self.s); + Signature::from_rsv(&r, &s, self.standard_v()) + } + + /// Checks whether the signature has a low 's' value. + pub fn check_low_s(&self) -> Result<(), parity_crypto::publickey::Error> { + if !self.signature().is_low_s() { + Err(parity_crypto::publickey::Error::InvalidSignature.into()) + } else { + Ok(()) + } + } + + /// Get the hash of this transaction (keccak of the RLP). + pub fn hash(&self) -> H256 { + self.hash + } + + /// Recovers the public key of the sender. + pub fn recover_public(&self) -> Result { + Ok(recover(&self.signature(), &self.unsigned.hash(self.chain_id()))?) + } + + /// Try to verify transaction and recover sender. + pub fn verify_unordered(self) -> Result { + SignedTransaction::new(self) + } +} + +#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] +pub struct SignedTransaction { + transaction: UnverifiedTransaction, + sender: Address, + public: Option, +} + +impl rlp::Encodable for SignedTransaction { + fn rlp_append(&self, s: &mut RlpStream) { + self.transaction.rlp_append_sealed_transaction(s) + } +} + +impl Deref for SignedTransaction { + type Target = UnverifiedTransaction; + fn deref(&self) -> &Self::Target { + &self.transaction + } +} + +impl From for UnverifiedTransaction { + fn from(tx: SignedTransaction) -> Self { + tx.transaction + } +} + +impl SignedTransaction { + /// Try to verify transaction and recover sender. + pub fn new(transaction: UnverifiedTransaction) -> Result { + if transaction.is_unsigned() { + Ok(SignedTransaction { + transaction: transaction, + sender: UNSIGNED_SENDER, + public: None, + }) + } else { + let public = transaction.recover_public()?; + let sender = public_to_address(&public); + Ok(SignedTransaction { + transaction: transaction, + sender: sender, + public: Some(public), + }) + } + } + + /// Returns transaction sender. + pub fn sender(&self) -> Address { + self.sender + } + + /// Returns a public key of the sender. + pub fn public_key(&self) -> Option { + self.public + } + + /// Checks is signature is empty. + pub fn is_unsigned(&self) -> bool { + self.transaction.is_unsigned() + } + + /// Deconstructs this transaction back into `UnverifiedTransaction` + pub fn deconstruct(self) -> (UnverifiedTransaction, Address, Option) { + (self.transaction, self.sender, self.public) + } +} diff --git a/core/sr-eth-primitives/src/tests.rs b/core/sr-eth-primitives/src/tests.rs new file mode 100644 index 000000000..d8f0fa62b --- /dev/null +++ b/core/sr-eth-primitives/src/tests.rs @@ -0,0 +1,33 @@ +use super::*; +use ethereum_types::{Address, H256, U128, U256}; +use rustc_hex::FromHex; +use std::str::FromStr; +use support::{assert_err, assert_noop, assert_ok}; + +#[test] +fn test() { + let bytes: Vec = FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap(); + let tx: UnverifiedTransaction = rlp::decode(&bytes).expect("decoding failure"); + + assert_eq!(tx.unsigned.gas, U256::from(U128::from(21000))); +} + +#[test] +fn compute_transaction_hash() { + let plain_tx = PlainTransaction { + nonce: U256::from(U128::from(5240 as u128)), + gas_price: U256::from(U128::from(15000000000 as u128)), + gas: U256::from(U128::from(21000 as u128)), + action: Action::Call(Address::from_str("674943d6003783cf20125caad89525983dbfd050").unwrap()), + value: U256::from(U128::from(2000000000000000000 as u128)), + data: b"".to_vec(), + }; + + // fill it with secret key + let sec = Secret::from_str("xxxxx").unwrap(); + let signed_tx = plain_tx.sign(&sec, Some(42)); + assert_eq!( + &signed_tx.hash(), + &H256::from_str("c654b4c4a183386722d42605ca91e23bc93919db8aa160b10cf50ab6a320ad9f").unwrap() + ); +} diff --git a/core/sr-rlp/Cargo.toml b/core/sr-rlp/Cargo.toml new file mode 100644 index 000000000..2baa8a41b --- /dev/null +++ b/core/sr-rlp/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "sr-rlp" +version = "0.1.0" +authors = ["hammeWang "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/core/sr-rlp/src/lib.rs b/core/sr-rlp/src/lib.rs new file mode 100644 index 000000000..860598826 --- /dev/null +++ b/core/sr-rlp/src/lib.rs @@ -0,0 +1,5 @@ + +/// RLP lib for eth transaction encoding + +#![recursion_limit = "128"] +#![cfg_attr(not(feature = "std"), no_std)] diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index 27f8e1e81..8f4e9aa8e 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -163,9 +163,9 @@ impl indices::Trait for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; - pub const TransferFee: Balance = 1 * CENTS; - pub const CreationFee: Balance = 1 * CENTS; + pub const ExistentialDeposit: Balance = 1 * COIN; + pub const TransferFee: Balance = 1 * MILLI; + pub const CreationFee: Balance = 1 * MILLI; } impl balances::Trait for Runtime { @@ -181,8 +181,8 @@ impl balances::Trait for Runtime { } parameter_types! { - pub const TransactionBaseFee: Balance = 1 * CENTS; - pub const TransactionByteFee: Balance = 10 * MILLICENTS; + pub const TransactionBaseFee: Balance = 1 * MILLI; + pub const TransactionByteFee: Balance = 10 * MICRO; } impl transaction_payment::Trait for Runtime { @@ -351,15 +351,15 @@ impl finality_tracker::Trait for Runtime { } parameter_types! { - pub const ContractTransferFee: Balance = 1 * CENTS; - pub const ContractCreationFee: Balance = 1 * CENTS; - pub const ContractTransactionBaseFee: Balance = 1 * CENTS; - pub const ContractTransactionByteFee: Balance = 10 * MILLICENTS; - pub const ContractFee: Balance = 1 * CENTS; - pub const TombstoneDeposit: Balance = 1 * DOLLARS; - pub const RentByteFee: Balance = 1 * DOLLARS; - pub const RentDepositOffset: Balance = 1000 * DOLLARS; - pub const SurchargeReward: Balance = 150 * DOLLARS; + pub const ContractTransferFee: Balance = 1 * MILLI; + pub const ContractCreationFee: Balance = 1 * MILLI; + pub const ContractTransactionBaseFee: Balance = 1 * MILLI; + pub const ContractTransactionByteFee: Balance = 10 * MICRO; + pub const ContractFee: Balance = 1 * MILLI; + pub const TombstoneDeposit: Balance = 1 * COIN; + pub const RentByteFee: Balance = 1 * COIN; + pub const RentDepositOffset: Balance = 1000 * COIN; + pub const SurchargeReward: Balance = 150 * COIN; } impl contracts::Trait for Runtime { diff --git a/srml/chainrelay/poa/Cargo.toml b/srml/chainrelay/poa/Cargo.toml index 252e715c9..01ddf052e 100644 --- a/srml/chainrelay/poa/Cargo.toml +++ b/srml/chainrelay/poa/Cargo.toml @@ -7,8 +7,13 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +sr-primitives = {git = 'https://github.com/paritytech/substrate.git', default-features = false } +substrate-primitives = {git = 'https://github.com/paritytech/substrate.git', default-features = false } [features] default = ["std"] -std = [] \ No newline at end of file +std = [ + "sr-primitives/std", + "substrate-primitives/std" +] \ No newline at end of file diff --git a/srml/chainrelay/poa/src/lib.rs b/srml/chainrelay/poa/src/lib.rs index 69529b312..49fa16746 100644 --- a/srml/chainrelay/poa/src/lib.rs +++ b/srml/chainrelay/poa/src/lib.rs @@ -1,4 +1,2 @@ -pub struct BestHeader { - height: u64, // enough for ethereum poa network (kovan) - hash: Hash, -} + +/// Handling eth poa(kovan) transaction verification etc. diff --git a/srml/chainrelay/src/lib.rs b/srml/chainrelay/src/lib.rs index acc6c9867..576e3ecde 100644 --- a/srml/chainrelay/src/lib.rs +++ b/srml/chainrelay/src/lib.rs @@ -15,7 +15,7 @@ decl_storage! { // we don't need to start from genesis block pub InitialBlock get(initial_block) config(): T::BlockNumber; // BestHeader - pub BestHeader get(best_header): BestHeader; + pub BestHeader get(best_header): BestBLock; } }