diff --git a/Cargo.lock b/Cargo.lock index 45913faa9..382c23fae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,6 +71,12 @@ version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +[[package]] +name = "array-bytes" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" + [[package]] name = "array-init" version = "2.0.1" @@ -83,15 +89,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -334,16 +331,6 @@ dependencies = [ "digest 0.10.5", ] -[[package]] -name = "blake2-rfc" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.7.3" @@ -480,11 +467,11 @@ dependencies = [ "dirs", "heck", "hex", - "impl-serde 0.4.0", - "jsonrpsee 0.16.0", + "impl-serde", + "jsonrpsee", "pallet-contracts-primitives", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm", "predicates", "pretty_assertions", "regex", @@ -494,6 +481,7 @@ dependencies = [ "serde", "serde_json", "sp-core", + "sp-weights", "substrate-build-script-utils", "subxt", "tempfile", @@ -634,18 +622,12 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "contract-metadata" version = "2.0.0-alpha.5" dependencies = [ "anyhow", - "impl-serde 0.4.0", + "impl-serde", "pretty_assertions", "semver", "serde", @@ -1002,24 +984,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" [[package]] -name = "ed25519" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" +name = "ed25519-zebra" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek 3.2.0", - "ed25519", - "rand 0.7.3", - "serde", + "hashbrown", + "hex", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] @@ -1081,9 +1054,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", "rand 0.8.5", @@ -1283,8 +1256,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1311,6 +1286,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hash-db" version = "0.15.2" @@ -1395,7 +1389,18 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.3", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", ] [[package]] @@ -1404,12 +1409,58 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + [[package]] name = "iana-time-zone" version = "0.1.50" @@ -1448,15 +1499,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-serde" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" -dependencies = [ - "serde", -] - [[package]] name = "impl-serde" version = "0.4.0" @@ -1528,7 +1570,7 @@ dependencies = [ "derive_more", "either", "heck", - "impl-serde 0.4.0", + "impl-serde", "ink_ir", "ink_primitives", "itertools", @@ -1549,7 +1591,7 @@ dependencies = [ "ink_primitives", "parity-scale-codec", "rand 0.8.5", - "secp256k1 0.24.0", + "secp256k1", "sha2 0.10.6", "sha3", ] @@ -1576,7 +1618,7 @@ dependencies = [ "rand 0.8.5", "rlibc", "scale-info", - "secp256k1 0.24.0", + "secp256k1", "sha2 0.10.6", "sha3", "static_assertions", @@ -1619,7 +1661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ae8287f3ae7a9473f1b767db3da834b6875ec7ac4c105ee360a38a5b9d9538" dependencies = [ "derive_more", - "impl-serde 0.4.0", + "impl-serde", "ink_prelude", "ink_primitives", "scale-info", @@ -1709,15 +1751,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "jobserver" @@ -1743,49 +1779,19 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpsee" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a" -dependencies = [ - "jsonrpsee-client-transport 0.15.1", - "jsonrpsee-core 0.15.1", - "jsonrpsee-types 0.15.1", -] - [[package]] name = "jsonrpsee" version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0ee76536f6a303b67c13a99ecae0002bb388674dbf416094dde808263ea229c" dependencies = [ - "jsonrpsee-core 0.16.0", - "jsonrpsee-types 0.16.0", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", "jsonrpsee-ws-client", ] -[[package]] -name = "jsonrpsee-client-transport" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8752740ecd374bcbf8b69f3e80b0327942df76f793f8d4e60d3355650c31fb74" -dependencies = [ - "futures-util", - "http", - "jsonrpsee-core 0.15.1", - "jsonrpsee-types 0.15.1", - "pin-project", - "rustls-native-certs", - "soketto", - "thiserror", - "tokio", - "tokio-rustls", - "tokio-util", - "tracing", - "webpki-roots", -] - [[package]] name = "jsonrpsee-client-transport" version = "0.16.0" @@ -1794,8 +1800,8 @@ checksum = "74c8f8f21b684623d23be8b6fcb101594f4e95d8a505ffd0568de863d93668f4" dependencies = [ "futures-util", "http", - "jsonrpsee-core 0.16.0", - "jsonrpsee-types 0.16.0", + "jsonrpsee-core", + "jsonrpsee-types", "pin-project", "rustls-native-certs", "soketto", @@ -1809,9 +1815,9 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" +checksum = "f57020f4c98b6c6e8848fb115e61227fba6993517bee0faa38e4db627a9f7254" dependencies = [ "anyhow", "async-lock", @@ -1820,30 +1826,27 @@ dependencies = [ "futures-channel", "futures-timer", "futures-util", - "jsonrpsee-types 0.15.1", + "hyper", + "jsonrpsee-types", "rustc-hash", "serde", "serde_json", "thiserror", "tokio", "tracing", - "tracing-futures", ] [[package]] -name = "jsonrpsee-core" +name = "jsonrpsee-http-client" version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f57020f4c98b6c6e8848fb115e61227fba6993517bee0faa38e4db627a9f7254" +checksum = "7ca71086fd13ad0991cd4a0e50c9f4c59488b1acfac4a528c448c2e10020aa1e" dependencies = [ - "anyhow", - "async-lock", "async-trait", - "beef", - "futures-channel", - "futures-timer", - "futures-util", - "jsonrpsee-types 0.16.0", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", "rustc-hash", "serde", "serde_json", @@ -1852,20 +1855,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-types" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d" -dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", - "tracing", -] - [[package]] name = "jsonrpsee-types" version = "0.16.0" @@ -1887,9 +1876,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea609539b5062f856a43652fd01d8ed8df40cd4d7067be6f6b7ce81d8bbd03be" dependencies = [ "http", - "jsonrpsee-client-transport 0.16.0", - "jsonrpsee-core 0.16.0", - "jsonrpsee-types 0.16.0", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", ] [[package]] @@ -1919,6 +1908,12 @@ version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + [[package]] name = "libsecp256k1" version = "0.7.1" @@ -1996,6 +1991,15 @@ dependencies = [ "value-bag", ] +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown", +] + [[package]] name = "matchers" version = "0.0.1" @@ -2022,9 +2026,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", "hashbrown", @@ -2033,9 +2037,9 @@ dependencies = [ [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merlin" @@ -2077,10 +2081,10 @@ dependencies = [ ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" @@ -2123,9 +2127,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -2134,12 +2138,12 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa", ] [[package]] @@ -2154,9 +2158,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-bigint", @@ -2239,18 +2243,15 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pallet-contracts-primitives" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64046754df757ab4ddb3530d568c6f05a0a04ecaf17e3e19d9667bc121faa0b1" +checksum = "33fd2f159dc7cc71def8ac684fa4938b2a66ef158436d3c7ab4aa6b69390d562" dependencies = [ "bitflags", "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-rpc", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] @@ -2262,6 +2263,7 @@ dependencies = [ "arrayvec 0.7.2", "bitvec", "byte-slice-cast", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -2281,9 +2283,9 @@ dependencies = [ [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ "cfg-if", "hashbrown", @@ -2305,12 +2307,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "parity-wasm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" - [[package]] name = "parity-wasm" version = "0.45.0" @@ -2478,13 +2474,13 @@ dependencies = [ [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", - "impl-serde 0.3.2", + "impl-serde", "scale-info", "uint", ] @@ -2933,31 +2929,13 @@ dependencies = [ "untrusted", ] -[[package]] -name = "secp256k1" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" -dependencies = [ - "secp256k1-sys 0.4.2", -] - [[package]] name = "secp256k1" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7649a0b3ffb32636e60c7ce0d70511eda9c52c658cd0634e194d5a19943aeff" dependencies = [ - "secp256k1-sys 0.6.0", -] - -[[package]] -name = "secp256k1-sys" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" -dependencies = [ - "cc", + "secp256k1-sys", ] [[package]] @@ -3036,7 +3014,7 @@ version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ - "itoa 1.0.3", + "itoa", "ryu", "serde", ] @@ -3109,12 +3087,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "signature" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb766570a2825fa972bceff0d195727876a9cdf2460ab2e52d455dc2de47fd9" - [[package]] name = "slab" version = "0.4.7" @@ -3157,9 +3129,9 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb4490364cb3b097a6755343e552495b0013778152300714be4647d107e9a2e" +checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" dependencies = [ "parity-scale-codec", "scale-info", @@ -3171,9 +3143,9 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef21f82cc10f75ed046b65e2f8048080ee76e59f1b8aed55c7150daebfd35b" +checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" dependencies = [ "integer-sqrt", "num-traits", @@ -3187,35 +3159,34 @@ dependencies = [ [[package]] name = "sp-core" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" +checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", - "hex", - "impl-serde 0.3.2", + "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", "num-traits", "parity-scale-codec", - "parity-util-mem", "parking_lot", "primitive-types", "rand 0.7.3", "regex", "scale-info", "schnorrkel", - "secp256k1 0.21.3", + "secp256k1", "secrecy", "serde", "sp-core-hashing", @@ -3234,23 +3205,24 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec864a6a67249f0c8dd3d5acab43623a61677e85ff4f2f9b04b802d2fe780e83" +checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" dependencies = [ - "blake2-rfc", + "blake2", "byteorder", - "sha2 0.9.9", + "digest 0.10.5", + "sha2 0.10.6", + "sha3", "sp-std", - "tiny-keccak", "twox-hash", ] [[package]] name = "sp-debug-derive" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" dependencies = [ "proc-macro2", "quote", @@ -3259,9 +3231,9 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" dependencies = [ "environmental", "parity-scale-codec", @@ -3271,17 +3243,18 @@ dependencies = [ [[package]] name = "sp-io" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "935fd3c71bad6811a7984cabb74d323b8ca3107024024c3eabb610e0182ba8d3" +checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" dependencies = [ + "bytes", "futures", "hash-db", "libsecp256k1", "log", "parity-scale-codec", "parking_lot", - "secp256k1 0.21.3", + "secp256k1", "sp-core", "sp-externalities", "sp-keystore", @@ -3297,9 +3270,9 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3261eddca8c8926e3e1de136a7980cb3afc3455247d9d6f3119d9b292f73aaee" +checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" dependencies = [ "async-trait", "futures", @@ -3314,31 +3287,20 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2101f3c555fceafcfcfb0e61c55ea9ed80dc60bd77d54d9f25b369edb029e9a4" +checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" dependencies = [ "backtrace", "lazy_static", "regex", ] -[[package]] -name = "sp-rpc" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6cadf2772480d8df7f90242bbc07fb978a3ac45cb6ec1eeadf0462306e86ea" -dependencies = [ - "rustc-hash", - "serde", - "sp-core", -] - [[package]] name = "sp-runtime" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d8a8d5ab5d349c6cf9300af1721b7b6446ba63401dbb11c10a1d65197aa5f" +checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" dependencies = [ "either", "hash256-std-hasher", @@ -3355,14 +3317,16 @@ dependencies = [ "sp-core", "sp-io", "sp-std", + "sp-weights", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158bf0305c75a50fc0e334b889568f519a126e32b87900c3f4251202dece7b4b" +checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", @@ -3377,9 +3341,9 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ecb916b9664ed9f90abef0ff5a3e61454c1efea5861b2997e03f39b59b955f" +checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" dependencies = [ "Inflector", "proc-macro-crate", @@ -3390,9 +3354,9 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecee3b33eb78c99997676a571656bcc35db6886abecfddd13e76a73b5871c6c1" +checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" dependencies = [ "hash-db", "log", @@ -3408,23 +3372,22 @@ dependencies = [ "sp-trie", "thiserror", "tracing", - "trie-db", "trie-root", ] [[package]] name = "sp-std" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" +checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" [[package]] name = "sp-storage" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" +checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" dependencies = [ - "impl-serde 0.3.2", + "impl-serde", "parity-scale-codec", "ref-cast", "serde", @@ -3434,9 +3397,9 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" dependencies = [ "parity-scale-codec", "sp-std", @@ -3447,25 +3410,33 @@ dependencies = [ [[package]] name = "sp-trie" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6fc34f4f291886914733e083b62708d829f3e6b8d7a7ca7fa8a55a3d7640b0b" +checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" dependencies = [ + "ahash", "hash-db", + "hashbrown", + "lazy_static", + "lru", "memory-db", + "nohash-hasher", "parity-scale-codec", + "parking_lot", "scale-info", "sp-core", "sp-std", + "thiserror", + "tracing", "trie-db", "trie-root", ] [[package]] name = "sp-wasm-interface" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d88debe690c2b24eaa9536a150334fcef2ae184c21a0e5b3e80135407a7d52" +checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" dependencies = [ "impl-trait-for-tuples", "log", @@ -3474,6 +3445,23 @@ dependencies = [ "wasmi", ] +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + [[package]] name = "spin" version = "0.5.2" @@ -3482,9 +3470,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "ss58-registry" -version = "1.31.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de151faef619cb7b5c26b32d42bc7ddccac0d202beb7a84344b44e9232b92f7" +checksum = "37a9821878e1f13aba383aa40a86fb1b33c7265774ec91e32563cb1dd1577496" dependencies = [ "Inflector", "num-format", @@ -3556,16 +3544,17 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "subxt" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a8757ee0e19f87e722577282ab1386c86592a4b13ff963b9c6ec4176348104c" +checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" dependencies = [ "bitvec", "derivative", "frame-metadata", "futures", + "getrandom 0.2.7", "hex", - "jsonrpsee 0.15.1", + "jsonrpsee", "parity-scale-codec", "parking_lot", "scale-decode", @@ -3583,13 +3572,15 @@ dependencies = [ [[package]] name = "subxt-codegen" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb77f93e11e6ff3ff95fe33e3d24c27c342e16feca8ef47759993614ebe90d2c" +checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" dependencies = [ "darling", "frame-metadata", "heck", + "hex", + "jsonrpsee", "parity-scale-codec", "proc-macro-error", "proc-macro2", @@ -3597,13 +3588,14 @@ dependencies = [ "scale-info", "subxt-metadata", "syn", + "tokio", ] [[package]] name = "subxt-macro" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051cc21d77a54ae944b872eafdf9edfe1d9134fdfcfc3477dc10f763c76564a9" +checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" dependencies = [ "darling", "proc-macro-error", @@ -3613,9 +3605,9 @@ dependencies = [ [[package]] name = "subxt-metadata" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed78d80db3a97d55e8b1cfecc1f6f9e21793a589d4e2e5f4fe2d6d5850c2e54" +checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -3729,15 +3721,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3760,7 +3743,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" dependencies = [ "autocfg", + "bytes", "libc", + "memchr", "mio", "num_cpus", "pin-project-lite", @@ -3803,6 +3788,7 @@ dependencies = [ "futures-sink", "pin-project-lite", "tokio", + "tracing", ] [[package]] @@ -3814,6 +3800,12 @@ dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -3847,16 +3839,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-log" version = "0.1.3" @@ -3920,9 +3902,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", "hashbrown", @@ -3940,6 +3922,12 @@ dependencies = [ "hash-db", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "twox-hash" version = "1.6.3" @@ -3947,6 +3935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", + "digest 0.10.5", "rand 0.8.5", "static_assertions", ] @@ -4091,6 +4080,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4212,26 +4211,35 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "memory_units", - "num-rational", - "num-traits", - "parity-wasm 0.42.2", + "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ - "parity-wasm 0.42.2", + "parity-wasm", +] + +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", ] [[package]] diff --git a/crates/cargo-contract/Cargo.toml b/crates/cargo-contract/Cargo.toml index cb4297e0b..49aca0c4c 100644 --- a/crates/cargo-contract/Cargo.toml +++ b/crates/cargo-contract/Cargo.toml @@ -45,9 +45,10 @@ wasm-opt = "0.110.2" # dependencies for extrinsics (deploying and calling a contract) async-std = { version = "1.12.0", features = ["attributes", "tokio1"] } -sp-core = "6.0.0" -pallet-contracts-primitives = "6.0.0" -subxt = "0.24.0" +sp-core = "7.0.0" +sp-weights = "4.0.0" +pallet-contracts-primitives = "7.0.0" +subxt = "0.25.0" hex = "0.4.3" jsonrpsee = { version = "0.16.0", features = ["ws-client"] } diff --git a/crates/cargo-contract/src/cmd/extrinsics/call.rs b/crates/cargo-contract/src/cmd/extrinsics/call.rs index b2dcf925d..c7659f325 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/call.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/call.rs @@ -17,10 +17,7 @@ use super::{ display_contract_exec_result, prompt_confirm_tx, - runtime_api::{ - api, - Weight, - }, + runtime_api::api, state_call, submit_extrinsic, Balance, @@ -31,6 +28,7 @@ use super::{ DefaultConfig, ExtrinsicOpts, PairSigner, + StorageDeposit, TokenMetadata, MAX_KEY_COL_WIDTH, }; @@ -49,11 +47,9 @@ use anyhow::{ Result, }; -use pallet_contracts_primitives::{ - ContractExecResult, - StorageDeposit, -}; +use pallet_contracts_primitives::ContractExecResult; use scale::Encode; +use sp_weights::Weight; use transcode::Value; use std::fmt::Debug; @@ -76,10 +72,14 @@ pub struct CallCommand { args: Vec, #[clap(flatten)] extrinsic_opts: ExtrinsicOpts, - /// Maximum amount of gas to be used for this command. - /// If not specified will perform a dry-run to estimate the gas consumed for the instantiation. + /// Maximum amount of gas (execution time) to be used for this command. + /// If not specified will perform a dry-run to estimate the gas consumed for the call. #[clap(name = "gas", long)] gas_limit: Option, + /// Maximum proof size for this call. + /// If not specified will perform a dry-run to estimate the proof size required for the call. + #[clap(long)] + proof_size: Option, /// The value to be transferred as part of the call. #[clap(name = "value", long, default_value = "0")] value: BalanceVariant, @@ -113,14 +113,16 @@ impl CallCommand { match result.result { Ok(ref ret_val) => { let value = transcoder - .decode_return(&self.message, &mut &ret_val.data.0[..])?; + .decode_return(&self.message, &mut &ret_val.data[..])?; let dry_run_result = CallDryRunResult { result: String::from("Success!"), reverted: ret_val.did_revert(), data: value, gas_consumed: result.gas_consumed, gas_required: result.gas_required, - storage_deposit: result.storage_deposit.clone(), + storage_deposit: StorageDeposit::from( + &result.storage_deposit, + ), }; if self.output_json { println!("{}", dry_run_result.to_json()?); @@ -159,7 +161,6 @@ impl CallCommand { signer: &PairSigner, ) -> Result> { let url = self.extrinsic_opts.url_to_string(); - let gas_limit = *self.gas_limit.as_ref().unwrap_or(&5_000_000_000_000); let token_metadata = TokenMetadata::query(client).await?; let storage_deposit_limit = self .extrinsic_opts @@ -171,7 +172,7 @@ impl CallCommand { origin: signer.account_id().clone(), dest: self.contract.clone(), value: self.value.denominate_balance(&token_metadata)?, - gas_limit: Weight::from_ref_time(gas_limit), + gas_limit: None, storage_deposit_limit, input_data, }; @@ -237,11 +238,11 @@ impl CallCommand { signer: &PairSigner, ) -> Result { if self.extrinsic_opts.skip_dry_run { - return match self.gas_limit { - Some(gas) => Ok(Weight::from_ref_time(gas)), - None => { + return match (self.gas_limit, self.proof_size) { + (Some(ref_time), Some(proof_size)) => Ok(Weight::from_parts(ref_time, proof_size)), + _ => { Err(anyhow!( - "Gas limit `--gas` argument required if `--skip-dry-run` specified" + "Weight args `--gas` and `--proof-size` required if `--skip-dry-run` specified" )) } } @@ -255,8 +256,14 @@ impl CallCommand { if !self.output_json { super::print_gas_required_success(call_result.gas_required); } - let gas_limit = self.gas_limit.unwrap_or(call_result.gas_required); - Ok(Weight::from_ref_time(gas_limit)) + // use user specified values where provided, otherwise use the estimates + let ref_time = self + .gas_limit + .unwrap_or_else(|| call_result.gas_required.ref_time()); + let proof_size = self + .proof_size + .unwrap_or_else(|| call_result.gas_required.proof_size()); + Ok(Weight::from_parts(ref_time, proof_size)) } Err(ref err) => { let object = ErrorVariant::from_dispatch_error(err, &client.metadata())?; @@ -280,7 +287,7 @@ pub struct CallRequest { origin: ::AccountId, dest: ::AccountId, value: Balance, - gas_limit: Weight, + gas_limit: Option, storage_deposit_limit: Option, input_data: Vec, } @@ -293,10 +300,10 @@ pub struct CallDryRunResult { /// Was the operation reverted pub reverted: bool, pub data: Value, - pub gas_consumed: u64, - pub gas_required: u64, + pub gas_consumed: Weight, + pub gas_required: Weight, /// Storage deposit after the operation - pub storage_deposit: StorageDeposit, + pub storage_deposit: StorageDeposit, } impl CallDryRunResult { diff --git a/crates/cargo-contract/src/cmd/extrinsics/error.rs b/crates/cargo-contract/src/cmd/extrinsics/error.rs index 7c7266d30..cc27a4efd 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/error.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/error.rs @@ -77,7 +77,7 @@ impl ErrorVariant { ) -> anyhow::Result { match error { DispatchError::Module(err) => { - let details = metadata.error(err.index, err.error)?; + let details = metadata.error(err.index, err.error[0])?; Ok(ErrorVariant::Module(ModuleError { pallet: details.pallet().to_owned(), error: details.error().to_owned(), diff --git a/crates/cargo-contract/src/cmd/extrinsics/events.rs b/crates/cargo-contract/src/cmd/extrinsics/events.rs index f335fbd53..5fcdb2cfb 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/events.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/events.rs @@ -35,8 +35,8 @@ use anyhow::Result; use std::fmt::Write; use subxt::{ self, + blocks::ExtrinsicEvents, events::StaticEvent, - tx::TxEvents, }; /// Field that represent data of an event from invoking a contract extrinsic. @@ -79,7 +79,7 @@ pub struct DisplayEvents(Vec); impl DisplayEvents { /// Parses events and returns an object which can be serialised pub fn from_events( - result: &TxEvents, + result: &ExtrinsicEvents, transcoder: &ContractMessageTranscoder, subxt_metadata: &subxt::Metadata, ) -> Result { diff --git a/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs b/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs index 9b8327c21..b91c035cc 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/instantiate.rs @@ -17,10 +17,7 @@ use super::{ display_contract_exec_result, prompt_confirm_tx, - runtime_api::{ - api, - Weight, - }, + runtime_api::api, state_call, submit_extrinsic, Balance, @@ -32,6 +29,7 @@ use super::{ DefaultConfig, ExtrinsicOpts, PairSigner, + StorageDeposit, MAX_KEY_COL_WIDTH, }; use crate::{ @@ -52,16 +50,14 @@ use anyhow::{ Result, }; -use pallet_contracts_primitives::{ - ContractInstantiateResult, - StorageDeposit, -}; +use pallet_contracts_primitives::ContractInstantiateResult; use scale::Encode; use sp_core::{ crypto::Ss58Codec, Bytes, }; +use sp_weights::Weight; use std::{ fs, path::{ @@ -70,7 +66,7 @@ use std::{ }, }; use subxt::{ - tx::TxEvents, + blocks::ExtrinsicEvents, Config, OnlineClient, }; @@ -102,6 +98,10 @@ pub struct InstantiateCommand { /// If not specified will perform a dry-run to estimate the gas consumed for the instantiation. #[clap(name = "gas", long)] gas_limit: Option, + /// Maximum proof size for this instantiation. + /// If not specified will perform a dry-run to estimate the proof size required. + #[clap(long)] + proof_size: Option, /// A salt used in the address derivation of the new contract. Use to create multiple instances /// of the same contract code from the same account. #[clap(long, value_parser = parse_hex_bytes)] @@ -179,7 +179,8 @@ impl InstantiateCommand { constructor: self.constructor.clone(), raw_args: self.args.clone(), value: self.value.denominate_balance(&token_metadata)?, - gas_limit: self.gas_limit.map(Weight::from_ref_time), + gas_limit: self.gas_limit, + proof_size: self.proof_size, storage_deposit_limit: self .extrinsic_opts .storage_deposit_limit @@ -210,7 +211,8 @@ struct InstantiateArgs { constructor: String, raw_args: Vec, value: Balance, - gas_limit: Option, + gas_limit: Option, + proof_size: Option, storage_deposit_limit: Option, data: Vec, salt: Vec, @@ -244,10 +246,10 @@ impl Exec { result: String::from("Success!"), contract: ret_val.account_id.to_ss58check(), reverted: ret_val.result.did_revert(), - data: ret_val.result.data.clone(), + data: ret_val.result.data.clone().into(), gas_consumed: result.gas_consumed, gas_required: result.gas_required, - storage_deposit: result.storage_deposit.clone(), + storage_deposit: StorageDeposit::from(&result.storage_deposit), }; if self.output_json { println!("{}", dry_run_result.to_json()?); @@ -357,7 +359,7 @@ impl Exec { async fn display_result( &self, - result: &TxEvents, + result: &ExtrinsicEvents, code_hash: Option, contract_address: sp_core::crypto::AccountId32, token_metadata: &TokenMetadata, @@ -397,15 +399,11 @@ impl Exec { code: Code, ) -> Result::AccountId, Balance>> { - let gas_limit = self - .args - .gas_limit - .unwrap_or_else(|| Weight::from_ref_time(5_000_000_000_000)); let storage_deposit_limit = self.args.storage_deposit_limit; let call_request = InstantiateRequest { origin: self.signer.account_id().clone(), value: self.args.value, - gas_limit, + gas_limit: None, storage_deposit_limit, code, data: self.args.data.clone(), @@ -417,12 +415,12 @@ impl Exec { /// Dry run the instantiation before tx submission. Returns the gas required estimate. async fn pre_submit_dry_run_gas_estimate(&self, code: Code) -> Result { if self.opts.skip_dry_run { - return match self.args.gas_limit { - Some(gas) => Ok(gas), - None => { + return match (self.args.gas_limit, self.args.proof_size) { + (Some(ref_time), Some(proof_size)) => Ok(Weight::from_parts(ref_time, proof_size)), + _ => { Err(anyhow!( - "Gas limit `--gas` argument required if `--skip-dry-run` specified" - )) + "Weight args `--gas` and `--proof-size` required if `--skip-dry-run` specified" + )) } } } @@ -433,10 +431,16 @@ impl Exec { match instantiate_result.result { Ok(_) => { super::print_gas_required_success(instantiate_result.gas_required); - let gas_limit = self.args.gas_limit.unwrap_or_else(|| { - Weight::from_ref_time(instantiate_result.gas_required) - }); - Ok(gas_limit) + // use user specified values where provided, otherwise use the estimates + let ref_time = self + .args + .gas_limit + .unwrap_or_else(|| instantiate_result.gas_required.ref_time()); + let proof_size = self + .args + .proof_size + .unwrap_or_else(|| instantiate_result.gas_required.proof_size()); + Ok(Weight::from_parts(ref_time, proof_size)) } Err(ref err) => { let object = @@ -484,10 +488,10 @@ pub struct InstantiateDryRunResult { /// Was the operation reverted pub reverted: bool, pub data: Bytes, - pub gas_consumed: u64, - pub gas_required: u64, + pub gas_consumed: Weight, + pub gas_required: Weight, /// Storage deposit after the operation - pub storage_deposit: StorageDeposit, + pub storage_deposit: StorageDeposit, } impl InstantiateDryRunResult { @@ -513,7 +517,7 @@ impl InstantiateDryRunResult { struct InstantiateRequest { origin: ::AccountId, value: Balance, - gas_limit: Weight, + gas_limit: Option, storage_deposit_limit: Option, code: Code, data: Vec, diff --git a/crates/cargo-contract/src/cmd/extrinsics/mod.rs b/crates/cargo-contract/src/cmd/extrinsics/mod.rs index 607a860fc..3eed57c10 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/mod.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/mod.rs @@ -63,7 +63,9 @@ use sp_core::{ sr25519, Bytes, }; +use sp_weights::Weight; use subxt::{ + blocks, tx, Config, OnlineClient, @@ -227,7 +229,7 @@ async fn submit_extrinsic( client: &OnlineClient, call: &Call, signer: &(dyn tx::Signer + Send + Sync), -) -> core::result::Result, subxt::Error> +) -> core::result::Result, subxt::Error> where T: Config, >::OtherParams: Default, @@ -283,7 +285,7 @@ fn print_dry_running_status(msg: &str) { ); } -fn print_gas_required_success(gas: u64) { +fn print_gas_required_success(gas: Weight) { println!( "{:>width$} Gas required estimated at {}", "Success!".green().bold(), @@ -291,3 +293,32 @@ fn print_gas_required_success(gas: u64) { width = DEFAULT_KEY_COL_WIDTH ); } + +/// Copy of `pallet_contracts_primitives::StorageDeposit` which implements `Serialize`, required +/// for json output. +#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, serde::Serialize)] +pub enum StorageDeposit { + /// The transaction reduced storage consumption. + /// + /// This means that the specified amount of balance was transferred from the involved + /// contracts to the call origin. + Refund(Balance), + /// The transaction increased overall storage usage. + /// + /// This means that the specified amount of balance was transferred from the call origin + /// to the contracts involved. + Charge(Balance), +} + +impl From<&pallet_contracts_primitives::StorageDeposit> for StorageDeposit { + fn from(deposit: &pallet_contracts_primitives::StorageDeposit) -> Self { + match deposit { + pallet_contracts_primitives::StorageDeposit::Refund(balance) => { + Self::Refund(*balance) + } + pallet_contracts_primitives::StorageDeposit::Charge(balance) => { + Self::Charge(*balance) + } + } + } +} diff --git a/crates/cargo-contract/src/cmd/extrinsics/runtime_api/contracts_runtime.scale b/crates/cargo-contract/src/cmd/extrinsics/runtime_api/contracts_runtime.scale index d36bc4541..89dcafa19 100644 Binary files a/crates/cargo-contract/src/cmd/extrinsics/runtime_api/contracts_runtime.scale and b/crates/cargo-contract/src/cmd/extrinsics/runtime_api/contracts_runtime.scale differ diff --git a/crates/cargo-contract/src/cmd/extrinsics/runtime_api/mod.rs b/crates/cargo-contract/src/cmd/extrinsics/runtime_api/mod.rs index ed1e575b6..39f69da7f 100644 --- a/crates/cargo-contract/src/cmd/extrinsics/runtime_api/mod.rs +++ b/crates/cargo-contract/src/cmd/extrinsics/runtime_api/mod.rs @@ -14,31 +14,12 @@ // You should have received a copy of the GNU General Public License // along with cargo-contract. If not, see . +#![allow(clippy::too_many_arguments)] + #[subxt::subxt( runtime_metadata_path = "src/cmd/extrinsics/runtime_api/contracts_runtime.scale" )] pub mod api { - #[subxt(substitute_type = "frame_support::weights::weight_v2::Weight")] - use crate::cmd::extrinsics::runtime_api::Weight; -} - -/// Copy of the `weight_v2::Weight` type defined in substrate. -/// -/// Allows for local trait and inherent impls. -#[derive(scale::Encode, scale::Decode, scale::CompactAs, Clone, Copy, Debug)] -pub struct Weight { - /// The weight of computational time used based on some reference hardware. - ref_time: u64, -} - -impl ToString for Weight { - fn to_string(&self) -> String { - self.ref_time.to_string() - } -} - -impl Weight { - pub fn from_ref_time(ref_time: u64) -> Self { - Self { ref_time } - } + #[subxt(substitute_type = "sp_weights::weight_v2::Weight")] + use ::sp_weights::Weight; } diff --git a/crates/transcode/Cargo.toml b/crates/transcode/Cargo.toml index f0770b3c0..9ae4499f9 100644 --- a/crates/transcode/Cargo.toml +++ b/crates/transcode/Cargo.toml @@ -33,8 +33,8 @@ scale = { package = "parity-scale-codec", version = "3.0.0", features = ["derive scale-info = { version = "2.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.147", default-features = false, features = ["derive"] } serde_json = "1.0.87" -sp-core = "6.0.0" -sp-runtime = "6.0.0" +sp-core = "7.0.0" +sp-runtime = "7.0.0" [dev-dependencies] assert_matches = "1.5.0"