From 1ba7e35c1848fce4b4a5990a382e5f2a05e14a41 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 6 Feb 2019 11:16:40 +0100 Subject: [PATCH] Support multi-hash in multi-trie via PlainDB (#1106) * Temporarily pin trie to #2 * Use generic and delay trait object casting Rust does not support super-trait upcasting * Add PlainDB impl for Ephemeral * Add PlainDB trait alias for completeness * Use PlainDB for test TrieBackendStorage fetch We always check overlay first for a storage fetch, which already checked null data. Using PlainDB here makes it work nicer with other PlainDB overlays. * Update trie reference * Use HashDBRef in places when approriate * Use PlainDBRef in places when approriate * Update trie crate reference * Remove unused HashDB::keys * Patch dependencies * Fix cargolock * Update cargo lock again --- substrate/Cargo.lock | 92 +++++++-------- substrate/Cargo.toml | 10 ++ substrate/core/executor/wasm/Cargo.lock | 43 ++++++- substrate/core/executor/wasm/Cargo.toml | 10 ++ .../core/state-machine/src/proving_backend.rs | 4 +- .../core/state-machine/src/trie_backend.rs | 4 +- .../state-machine/src/trie_backend_essence.rs | 107 ++++++++++++++---- substrate/core/test-runtime/Cargo.toml | 10 ++ substrate/core/trie/src/lib.rs | 82 +++++++++++--- substrate/node/runtime/wasm/Cargo.lock | 55 +++++++-- substrate/node/runtime/wasm/Cargo.toml | 10 ++ 11 files changed, 322 insertions(+), 105 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index ad1a095905..a9eda33d0b 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -922,12 +922,12 @@ dependencies = [ [[package]] name = "hash-db" version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" [[package]] name = "hash256-std-hasher" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1209,10 +1209,10 @@ dependencies = [ [[package]] name = "keccak-hasher" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", + "hash256-std-hasher 0.9.1 (git+https://github.com/paritytech/trie)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1704,9 +1704,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memory-db" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1891,7 +1891,7 @@ dependencies = [ "substrate-primitives 0.1.0", "substrate-state-machine 0.1.0", "substrate-trie 0.4.0", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.9.1 (git+https://github.com/paritytech/trie)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2860,7 +2860,7 @@ name = "sr-io" version = "0.1.0" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3480,7 +3480,7 @@ dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", @@ -3509,7 +3509,7 @@ name = "substrate-client-db" version = "0.1.0" dependencies = [ "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "kvdb-memorydb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", @@ -3799,8 +3799,8 @@ dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", + "hash256-std-hasher 0.9.1 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3935,7 +3935,7 @@ dependencies = [ name = "substrate-state-machine" version = "0.1.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3944,8 +3944,8 @@ dependencies = [ "substrate-panic-handler 0.1.0", "substrate-primitives 0.1.0", "substrate-trie 0.4.0", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.9.1 (git+https://github.com/paritytech/trie)", + "trie-root 0.9.1 (git+https://github.com/paritytech/trie)", ] [[package]] @@ -4037,16 +4037,16 @@ name = "substrate-trie" version = "0.4.0" dependencies = [ "criterion 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak-hasher 0.2.1 (git+https://github.com/paritytech/trie)", + "memory-db 0.9.1 (git+https://github.com/paritytech/trie)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0", - "trie-bench 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-standardmap 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-bench 0.10.0 (git+https://github.com/paritytech/trie)", + "trie-db 0.9.1 (git+https://github.com/paritytech/trie)", + "trie-root 0.9.1 (git+https://github.com/paritytech/trie)", + "trie-standardmap 0.9.1 (git+https://github.com/paritytech/trie)", ] [[package]] @@ -4399,25 +4399,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "trie-bench" version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ "criterion 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", + "keccak-hasher 0.2.1 (git+https://github.com/paritytech/trie)", + "memory-db 0.9.1 (git+https://github.com/paritytech/trie)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-standardmap 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.9.1 (git+https://github.com/paritytech/trie)", + "trie-root 0.9.1 (git+https://github.com/paritytech/trie)", + "trie-standardmap 0.9.1 (git+https://github.com/paritytech/trie)", ] [[package]] name = "trie-db" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4425,19 +4425,19 @@ dependencies = [ [[package]] name = "trie-root" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", ] [[package]] name = "trie-standardmap" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#18cd9434609560dec0b3ceacaab55d491ce7eeb2" dependencies = [ "criterion 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "keccak-hasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", + "keccak-hasher 0.2.1 (git+https://github.com/paritytech/trie)", ] [[package]] @@ -4460,7 +4460,7 @@ name = "twox-hash" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4890,8 +4890,8 @@ dependencies = [ "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4743617a7464bbda3c8aec8558ff2f9429047e025771037df561d383337ff865" "checksum h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb2b25a33e231484694267af28fec74ac63b5ccf51ee2065a5e313b834d836e" -"checksum hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc5ec43724866bbc8337e09cab4d4b5f9fdbbe589f04bdc8bfda906a639ad338" -"checksum hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fc2d94c8e127b205b3caf6fd3013fb5e5b314234bb0b9bea6588c52fddbb82b" +"checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" +"checksum hash256-std-hasher 0.9.1 (git+https://github.com/paritytech/trie)" = "" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" @@ -4920,7 +4920,7 @@ dependencies = [ "checksum jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "56608ed54b1b2a69f4357cb8bdfbcbd99fe1179383c03a09bb428931bd35f592" "checksum jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5521613b31ea22d36d9f95ad642058dccec846a94ed8690957652d479f620707" "checksum jsonrpc-ws-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20b8333a5a6e6ccbcf5c90f90919de557cba4929efa164e9bd0e8e497eb20e46" -"checksum keccak-hasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c75270466c10e5204b2121f9eddb1f7a0fa9d3d753aba51dcd027c00084fb778" +"checksum keccak-hasher 0.2.1 (git+https://github.com/paritytech/trie)" = "" "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)" = "" @@ -4961,7 +4961,7 @@ dependencies = [ "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0c940ff365f921ac747e7a009d8f9688105acf956f3fbb7fd967920737e935d" +"checksum memory-db 0.9.1 (git+https://github.com/paritytech/trie)" = "" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" @@ -5122,10 +5122,10 @@ dependencies = [ "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" -"checksum trie-bench 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6a334b73cca143545b1cede73ea70f10a838376c5ec3c1e5365b65d57abe52e" -"checksum trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec6ceb1ad749359cedcf6fa95d7b5104acf70e871e2416e71cabcc3a8b2dbb8" -"checksum trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6294c313431d8bd2dda88db3a57550c4911dd6f7f0e8be6001e23c1e6cbdcf1b" -"checksum trie-standardmap 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30da337fb1e61993d3f6a6fed2957d13f7a604097e34d1ea9715c2f0b2df616e" +"checksum trie-bench 0.10.0 (git+https://github.com/paritytech/trie)" = "" +"checksum trie-db 0.9.1 (git+https://github.com/paritytech/trie)" = "" +"checksum trie-root 0.9.1 (git+https://github.com/paritytech/trie)" = "" +"checksum trie-standardmap 0.9.1 (git+https://github.com/paritytech/trie)" = "" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum twofish 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eef327f05b0d0ec1b9d7d119d8f4d9f602ceee37e0540aff8071e8e66c2e22e" "checksum twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "555cd4909480122bbbf21e34faac4cb08a171f324775670447ed116726c474af" diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index da5b83e85a..6deda046ff 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -96,3 +96,13 @@ is-it-maintained-open-issues = { repository = "paritytech/substrate" } [profile.release] # Substrate runtime requires unwinding. panic = "unwind" + +[patch.crates-io] +hash-db = { git = "https://github.com/paritytech/trie" } +hash256-std-hasher = { git = "https://github.com/paritytech/trie" } +keccak-hasher = { git = "https://github.com/paritytech/trie" } +memory-db = { git = "https://github.com/paritytech/trie" } +trie-bench = { git = "https://github.com/paritytech/trie" } +trie-db = { git = "https://github.com/paritytech/trie" } +trie-root = { git = "https://github.com/paritytech/trie" } +trie-standardmap = { git = "https://github.com/paritytech/trie" } diff --git a/substrate/core/executor/wasm/Cargo.lock b/substrate/core/executor/wasm/Cargo.lock index c9761a913e..44e59ea68c 100644 --- a/substrate/core/executor/wasm/Cargo.lock +++ b/substrate/core/executor/wasm/Cargo.lock @@ -34,7 +34,7 @@ dependencies = [ [[package]] name = "hash-db" version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" [[package]] name = "hash256-std-hasher" @@ -145,7 +145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "sr-io" version = "0.1.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0", @@ -179,7 +179,7 @@ name = "substrate-primitives" version = "0.1.0" dependencies = [ "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hash256-std-hasher 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -214,13 +214,48 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[patch.unused]] +name = "hash256-std-hasher" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "keccak-hasher" +version = "0.2.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "memory-db" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-bench" +version = "0.10.0" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-db" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-root" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-standardmap" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + [metadata] "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" "checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a557e80084b05c32b455963ff565a9de6f2866da023d6671705c6aff6f65e01c" -"checksum hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc5ec43724866bbc8337e09cab4d4b5f9fdbbe589f04bdc8bfda906a639ad338" +"checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "811bd8c26961527b7d5623b71162d865325639f8ca204d4ec90b5b87473a122d" "checksum impl-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2050d823639fbeae26b2b5ba09aca8907793117324858070ade0673c49f793b" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" diff --git a/substrate/core/executor/wasm/Cargo.toml b/substrate/core/executor/wasm/Cargo.toml index 9683cd764e..eea37e4a30 100644 --- a/substrate/core/executor/wasm/Cargo.toml +++ b/substrate/core/executor/wasm/Cargo.toml @@ -18,3 +18,13 @@ lto = true [workspace] members = [] + +[patch.crates-io] +hash-db = { git = "https://github.com/paritytech/trie" } +hash256-std-hasher = { git = "https://github.com/paritytech/trie" } +keccak-hasher = { git = "https://github.com/paritytech/trie" } +memory-db = { git = "https://github.com/paritytech/trie" } +trie-bench = { git = "https://github.com/paritytech/trie" } +trie-db = { git = "https://github.com/paritytech/trie" } +trie-root = { git = "https://github.com/paritytech/trie" } +trie-standardmap = { git = "https://github.com/paritytech/trie" } diff --git a/substrate/core/state-machine/src/proving_backend.rs b/substrate/core/state-machine/src/proving_backend.rs index a41c035001..1aeb83fe3a 100644 --- a/substrate/core/state-machine/src/proving_backend.rs +++ b/substrate/core/state-machine/src/proving_backend.rs @@ -48,7 +48,7 @@ impl<'a, S, H> ProvingBackendEssence<'a, S, H> let map_e = |e| format!("Trie lookup error: {}", e); - read_trie_value_with(&eph, self.backend.root(), key, &mut *self.proof_recorder).map_err(map_e) + read_trie_value_with::>(&eph, self.backend.root(), key, &mut *self.proof_recorder).map_err(map_e) } pub fn child_storage(&mut self, storage_key: &[u8], key: &[u8]) -> Result>, String> { @@ -74,7 +74,7 @@ impl<'a, S, H> ProvingBackendEssence<'a, S, H> let mut iter = move || -> Result<(), Box>> { let root = self.backend.root(); - record_all_keys::(&eph, root, &mut *self.proof_recorder) + record_all_keys::(&eph, root, &mut *self.proof_recorder) }; if let Err(e) = iter() { diff --git a/substrate/core/state-machine/src/trie_backend.rs b/substrate/core/state-machine/src/trie_backend.rs index 85db5965c9..989b990d93 100644 --- a/substrate/core/state-machine/src/trie_backend.rs +++ b/substrate/core/state-machine/src/trie_backend.rs @@ -138,7 +138,7 @@ impl, H: Hasher> Backend for TrieBackend where &mut write_overlay, ); - match delta_trie_root::(&mut eph, root, delta) { + match delta_trie_root::(&mut eph, root, delta) { Ok(ret) => root = ret, Err(e) => warn!(target: "trie", "Failed to write to trie: {}", e), } @@ -169,7 +169,7 @@ impl, H: Hasher> Backend for TrieBackend where &mut write_overlay, ); - match child_delta_trie_root::(storage_key, &mut eph, root.clone(), delta) { + match child_delta_trie_root::(storage_key, &mut eph, root.clone(), delta) { Ok(ret) => root = ret, Err(e) => warn!(target: "trie", "Failed to write to trie: {}", e), } diff --git a/substrate/core/state-machine/src/trie_backend_essence.rs b/substrate/core/state-machine/src/trie_backend_essence.rs index d66da71363..5a2fc8d76d 100644 --- a/substrate/core/state-machine/src/trie_backend_essence.rs +++ b/substrate/core/state-machine/src/trie_backend_essence.rs @@ -17,7 +17,6 @@ //! Trie-based state machine backend essence used to read values //! from storage. -use std::collections::HashMap; use std::ops::Deref; use std::sync::Arc; use log::{debug, warn}; @@ -106,7 +105,7 @@ impl, H: Hasher> TrieBackendEssence where H::Out: overlay: &mut read_overlay, }; - if let Err(e) = for_keys_in_child_trie::(storage_key, &eph, &root, f) { + if let Err(e) = for_keys_in_child_trie::>(storage_key, &eph, &root, f) { debug!(target: "trie", "Error while iterating child storage: {}", e); } } @@ -149,6 +148,17 @@ pub(crate) struct Ephemeral<'a, S: 'a + TrieBackendStorage, H: 'a + Hasher> { overlay: &'a mut MemoryDB, } +impl<'a, + S: 'a + TrieBackendStorage, + H: 'a + Hasher +> hash_db::AsPlainDB + for Ephemeral<'a, S, H> + where H::Out: HeapSizeOf +{ + fn as_plain_db<'b>(&'b self) -> &'b (hash_db::PlainDB + 'b) { self } + fn as_plain_db_mut<'b>(&'b mut self) -> &'b mut (hash_db::PlainDB + 'b) { self } +} + impl<'a, S: 'a + TrieBackendStorage, H: 'a + Hasher @@ -172,50 +182,97 @@ impl<'a, S: TrieBackendStorage, H: Hasher> Ephemeral<'a, S, H> { impl<'a, S: 'a + TrieBackendStorage, H: Hasher -> hash_db::HashDB +> hash_db::PlainDB for Ephemeral<'a, S, H> where H::Out: HeapSizeOf { - fn keys(&self) -> HashMap { - self.overlay.keys() - } - fn get(&self, key: &H::Out) -> Option { - match self.overlay.raw(key) { - Some((val, i)) => { - if i <= 0 { - None - } else { - Some(val.clone()) - } - } - None => match self.storage.get(&key) { + if let Some(val) = hash_db::PlainDB::get(self.overlay, key) { + Some(val) + } else { + match self.storage.get(&key) { Ok(x) => x, Err(e) => { warn!(target: "trie", "Failed to read from DB: {}", e); None }, - }, + } } } fn contains(&self, key: &H::Out) -> bool { - self.get(key).is_some() - } - - fn insert(&mut self, value: &[u8]) -> H::Out { - self.overlay.insert(value) + hash_db::PlainDB::get(self, key).is_some() } fn emplace(&mut self, key: H::Out, value: DBValue) { - self.overlay.emplace(key, value) + hash_db::PlainDB::emplace(self.overlay, key, value) } fn remove(&mut self, key: &H::Out) { - self.overlay.remove(key) + hash_db::PlainDB::remove(self.overlay, key) } } +impl<'a, + S: 'a + TrieBackendStorage, + H: Hasher +> hash_db::PlainDBRef + for Ephemeral<'a, S, H> + where H::Out: HeapSizeOf +{ + fn get(&self, key: &H::Out) -> Option { hash_db::PlainDB::get(self, key) } + fn contains(&self, key: &H::Out) -> bool { hash_db::PlainDB::contains(self, key) } +} + +impl<'a, + S: 'a + TrieBackendStorage, + H: Hasher +> hash_db::HashDB + for Ephemeral<'a, S, H> + where H::Out: HeapSizeOf +{ + fn get(&self, key: &H::Out) -> Option { + if let Some(val) = hash_db::HashDB::get(self.overlay, key) { + Some(val) + } else { + match self.storage.get(&key) { + Ok(x) => x, + Err(e) => { + warn!(target: "trie", "Failed to read from DB: {}", e); + None + }, + } + } + } + + fn contains(&self, key: &H::Out) -> bool { + hash_db::HashDB::get(self, key).is_some() + } + + fn insert(&mut self, value: &[u8]) -> H::Out { + hash_db::HashDB::insert(self.overlay, value) + } + + fn emplace(&mut self, key: H::Out, value: DBValue) { + hash_db::HashDB::emplace(self.overlay, key, value) + } + + fn remove(&mut self, key: &H::Out) { + hash_db::HashDB::remove(self.overlay, key) + } +} + +impl<'a, + S: 'a + TrieBackendStorage, + H: Hasher +> hash_db::HashDBRef + for Ephemeral<'a, S, H> + where H::Out: HeapSizeOf +{ + fn get(&self, key: &H::Out) -> Option { hash_db::HashDB::get(self, key) } + fn contains(&self, key: &H::Out) -> bool { hash_db::HashDB::contains(self, key) } +} + /// Key-value pairs storage that is used by trie backend essence. pub trait TrieBackendStorage: Send + Sync { /// Get the value stored at key. @@ -232,7 +289,7 @@ impl TrieBackendStorage for Arc> { // This implementation is used by test storage trie clients. impl TrieBackendStorage for MemoryDB { fn get(&self, key: &H::Out) -> Result, String> { - Ok(>::get(self, key)) + Ok(hash_db::PlainDB::get(self, key)) } } diff --git a/substrate/core/test-runtime/Cargo.toml b/substrate/core/test-runtime/Cargo.toml index ac276b91c2..80c6677bdc 100644 --- a/substrate/core/test-runtime/Cargo.toml +++ b/substrate/core/test-runtime/Cargo.toml @@ -44,3 +44,13 @@ std = [ "runtime_version/std", "consensus_aura/std", ] + +[patch.crates-io] +hash-db = { git = "https://github.com/paritytech/trie" } +hash256-std-hasher = { git = "https://github.com/paritytech/trie" } +keccak-hasher = { git = "https://github.com/paritytech/trie" } +memory-db = { git = "https://github.com/paritytech/trie" } +trie-bench = { git = "https://github.com/paritytech/trie" } +trie-db = { git = "https://github.com/paritytech/trie" } +trie-root = { git = "https://github.com/paritytech/trie" } +trie-standardmap = { git = "https://github.com/paritytech/trie" } diff --git a/substrate/core/trie/src/lib.rs b/substrate/core/trie/src/lib.rs index 5b02e915cb..cb76600370 100644 --- a/substrate/core/trie/src/lib.rs +++ b/substrate/core/trie/src/lib.rs @@ -40,6 +40,8 @@ pub trait AsHashDB: hash_db::AsHashDB {} impl> AsHashDB for T {} /// As in `hash_db`, but less generic, trait exposed. pub type HashDB<'a, H> = hash_db::HashDB + 'a; +/// As in `hash_db`, but less generic, trait exposed. +pub type PlainDB<'a, K> = hash_db::PlainDB + 'a; /// As in `memory_db`, but less generic, trait exposed. pub type MemoryDB = memory_db::MemoryDB; @@ -60,13 +62,18 @@ pub fn trie_root(input: I) -> H::Out where } /// Determine a trie root given a hash DB and delta values. -pub fn delta_trie_root(db: &mut HashDB, mut root: H::Out, delta: I) -> Result>> where +pub fn delta_trie_root( + db: &mut DB, + mut root: H::Out, + delta: I +) -> Result>> where I: IntoIterator)>, A: AsRef<[u8]> + Ord, B: AsRef<[u8]>, + DB: hash_db::HashDB, { { - let mut trie = TrieDBMut::::from_existing(db, &mut root)?; + let mut trie = TrieDBMut::::from_existing(&mut *db, &mut root)?; for (key, change) in delta { match change { @@ -80,13 +87,22 @@ pub fn delta_trie_root(db: &mut HashDB, mut root: H::Out, } /// Read a value from the trie. -pub fn read_trie_value(db: &HashDB, root: &H::Out, key: &[u8]) -> Result>, Box>> { - Ok(TrieDB::::new(db, root)?.get(key).map(|x| x.map(|val| val.to_vec()))?) +pub fn read_trie_value>( + db: &DB, + root: &H::Out, + key: &[u8] +) -> Result>, Box>> { + Ok(TrieDB::::new(&*db, root)?.get(key).map(|x| x.map(|val| val.to_vec()))?) } /// Read a value from the trie with given Query. -pub fn read_trie_value_with>(db: &HashDB, root: &H::Out, key: &[u8], query: Q) -> Result>, Box>> { - Ok(TrieDB::::new(db, root)?.get_with(key, query).map(|x| x.map(|val| val.to_vec()))?) +pub fn read_trie_value_with, DB: hash_db::HashDBRef>( + db: &DB, + root: &H::Out, + key: &[u8], + query: Q +) -> Result>, Box>> { + Ok(TrieDB::::new(&*db, root)?.get_with(key, query).map(|x| x.map(|val| val.to_vec()))?) } /// Determine a trie root node's data given its ordered contents, closed form. @@ -137,16 +153,22 @@ pub fn child_trie_root(_storage_key: &[u8], input: I) -> Vec } /// Determine a child trie root given a hash DB and delta values. H is the default hasher, but a generic implementation may ignore this type parameter and use other hashers. -pub fn child_delta_trie_root(_storage_key: &[u8], db: &mut HashDB, root_vec: Vec, delta: I) -> Result, Box>> where +pub fn child_delta_trie_root( + _storage_key: &[u8], + db: &mut DB, + root_vec: Vec, + delta: I +) -> Result, Box>> where I: IntoIterator)>, A: AsRef<[u8]> + Ord, B: AsRef<[u8]>, + DB: hash_db::HashDB + hash_db::PlainDB, { let mut root = H::Out::default(); root.as_mut().copy_from_slice(&root_vec); // root is fetched from DB, not writable by runtime, so it's always valid. { - let mut trie = TrieDBMut::::from_existing(db, &mut root)?; + let mut trie = TrieDBMut::::from_existing(&mut *db, &mut root)?; for (key, change) in delta { match change { @@ -160,11 +182,18 @@ pub fn child_delta_trie_root(_storage_key: &[u8], db: &mut H } /// Call `f` for all keys in a child trie. -pub fn for_keys_in_child_trie(_storage_key: &[u8], db: &HashDB, root_slice: &[u8], mut f: F) -> Result<(), Box>> { +pub fn for_keys_in_child_trie( + _storage_key: &[u8], + db: &DB, + root_slice: &[u8], + mut f: F +) -> Result<(), Box>> where + DB: hash_db::HashDBRef + hash_db::PlainDBRef, +{ let mut root = H::Out::default(); root.as_mut().copy_from_slice(root_slice); // root is fetched from DB, not writable by runtime, so it's always valid. - let trie = TrieDB::::new(db, &root)?; + let trie = TrieDB::::new(&*db, &root)?; let iter = trie.iter()?; for x in iter { @@ -176,8 +205,14 @@ pub fn for_keys_in_child_trie(_storage_key: &[u8], d } /// Record all keys for a given root. -pub fn record_all_keys(db: &HashDB, root: &H::Out, recorder: &mut Recorder) -> Result<(), Box>> { - let trie = TrieDB::::new(db, root)?; +pub fn record_all_keys( + db: &DB, + root: &H::Out, + recorder: &mut Recorder +) -> Result<(), Box>> where + DB: hash_db::HashDBRef +{ + let trie = TrieDB::::new(&*db, root)?; let iter = trie.iter()?; for x in iter { @@ -193,19 +228,34 @@ pub fn record_all_keys(db: &HashDB, root: &H::Out, recorder: &mut } /// Read a value from the child trie. -pub fn read_child_trie_value(_storage_key: &[u8], db: &HashDB, root_slice: &[u8], key: &[u8]) -> Result>, Box>> { +pub fn read_child_trie_value( + _storage_key: &[u8], + db: &DB, + root_slice: &[u8], + key: &[u8] +) -> Result>, Box>> where + DB: hash_db::HashDBRef + hash_db::PlainDBRef, +{ let mut root = H::Out::default(); root.as_mut().copy_from_slice(root_slice); // root is fetched from DB, not writable by runtime, so it's always valid. - Ok(TrieDB::::new(db, &root)?.get(key).map(|x| x.map(|val| val.to_vec()))?) + Ok(TrieDB::::new(&*db, &root)?.get(key).map(|x| x.map(|val| val.to_vec()))?) } /// Read a value from the child trie with given query. -pub fn read_child_trie_value_with>(_storage_key: &[u8], db: &HashDB, root_slice: &[u8], key: &[u8], query: Q) -> Result>, Box>> { +pub fn read_child_trie_value_with, DB>( + _storage_key: &[u8], + db: &DB, + root_slice: &[u8], + key: &[u8], + query: Q +) -> Result>, Box>> where + DB: hash_db::HashDBRef + hash_db::PlainDBRef, +{ let mut root = H::Out::default(); root.as_mut().copy_from_slice(root_slice); // root is fetched from DB, not writable by runtime, so it's always valid. - Ok(TrieDB::::new(db, &root)?.get_with(key, query).map(|x| x.map(|val| val.to_vec()))?) + Ok(TrieDB::::new(&*db, &root)?.get_with(key, query).map(|x| x.map(|val| val.to_vec()))?) } // Utilities (not exported): diff --git a/substrate/node/runtime/wasm/Cargo.lock b/substrate/node/runtime/wasm/Cargo.lock index f60f15b51c..c28857422b 100644 --- a/substrate/node/runtime/wasm/Cargo.lock +++ b/substrate/node/runtime/wasm/Cargo.lock @@ -264,7 +264,7 @@ dependencies = [ [[package]] name = "hash-db" version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" [[package]] name = "hash256-std-hasher" @@ -479,7 +479,7 @@ name = "memory-db" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1099,7 +1099,7 @@ name = "sr-io" version = "0.1.0" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1519,7 +1519,7 @@ dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", @@ -1642,7 +1642,7 @@ dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "hash256-std-hasher 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1671,7 +1671,7 @@ dependencies = [ name = "substrate-state-machine" version = "0.1.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1702,7 +1702,7 @@ dependencies = [ name = "substrate-trie" version = "0.4.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "memory-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1911,7 +1911,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1921,7 +1921,7 @@ name = "trie-root" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.9.0 (git+https://github.com/paritytech/trie)", ] [[package]] @@ -2065,6 +2065,41 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[patch.unused]] +name = "hash256-std-hasher" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "keccak-hasher" +version = "0.2.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "memory-db" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-bench" +version = "0.10.0" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-db" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-root" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + +[[patch.unused]] +name = "trie-standardmap" +version = "0.9.1" +source = "git+https://github.com/paritytech/trie#696a380c1bf1a816a0c1872a6349e4b12e19b3ef" + [metadata] "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f405cc4c21cd8b784f6c8fc2adf9bc00f59558f0049b5ec21517f875963040cc" @@ -2102,7 +2137,7 @@ dependencies = [ "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" -"checksum hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc5ec43724866bbc8337e09cab4d4b5f9fdbbe589f04bdc8bfda906a639ad338" +"checksum hash-db 0.9.0 (git+https://github.com/paritytech/trie)" = "" "checksum hash256-std-hasher 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "811bd8c26961527b7d5623b71162d865325639f8ca204d4ec90b5b87473a122d" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" diff --git a/substrate/node/runtime/wasm/Cargo.toml b/substrate/node/runtime/wasm/Cargo.toml index 3512971a44..495d53bd2e 100644 --- a/substrate/node/runtime/wasm/Cargo.toml +++ b/substrate/node/runtime/wasm/Cargo.toml @@ -23,3 +23,13 @@ lto = true [workspace] members = [] + +[patch.crates-io] +hash-db = { git = "https://github.com/paritytech/trie" } +hash256-std-hasher = { git = "https://github.com/paritytech/trie" } +keccak-hasher = { git = "https://github.com/paritytech/trie" } +memory-db = { git = "https://github.com/paritytech/trie" } +trie-bench = { git = "https://github.com/paritytech/trie" } +trie-db = { git = "https://github.com/paritytech/trie" } +trie-root = { git = "https://github.com/paritytech/trie" } +trie-standardmap = { git = "https://github.com/paritytech/trie" }