diff --git a/.github/workflows/crates-io.yml b/.github/workflows/crates-io.yml
index eb7c0fd1b0f..130f2c24041 100644
--- a/.github/workflows/crates-io.yml
+++ b/.github/workflows/crates-io.yml
@@ -9,6 +9,7 @@ on:
default: false
version:
description: "Workspace version to publish"
+ required: true
type: string
pull_request:
branches: [master]
diff --git a/Cargo.lock b/Cargo.lock
index fbcc3c93ae3..a6825d87dcf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -285,12 +285,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "asn1_der"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247"
-
[[package]]
name = "assert_matches"
version = "1.5.0"
@@ -483,12 +477,6 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
-[[package]]
-name = "base16ct"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce"
-
[[package]]
name = "base16ct"
version = "0.2.0"
@@ -1015,7 +1003,7 @@ checksum = "b9b68e3193982cd54187d71afdb2a271ad4cf8af157858e9cb911b91321de143"
dependencies = [
"core2",
"multibase",
- "multihash 0.17.0",
+ "multihash",
"serde",
"unsigned-varint",
]
@@ -2380,16 +2368,6 @@ dependencies = [
"wabt",
]
-[[package]]
-name = "der"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de"
-dependencies = [
- "const-oid",
- "zeroize",
-]
-
[[package]]
name = "der"
version = "0.7.8"
@@ -2682,12 +2660,12 @@ version = "0.16.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
dependencies = [
- "der 0.7.8",
+ "der",
"digest 0.10.7",
"elliptic-curve",
"rfc6979",
"signature 2.1.0",
- "spki 0.7.2",
+ "spki",
]
[[package]]
@@ -2705,7 +2683,7 @@ version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d"
dependencies = [
- "pkcs8 0.10.2",
+ "pkcs8",
"signature 2.1.0",
]
@@ -2717,8 +2695,6 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
dependencies = [
"curve25519-dalek 3.2.0",
"ed25519 1.5.3",
- "rand 0.7.3",
- "serde",
"sha2 0.9.9",
"zeroize",
]
@@ -2763,15 +2739,15 @@ version = "0.13.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9775b22bc152ad86a0cf23f0f348b884b26add12bf741e7ffc4d4ab2ab4d205"
dependencies = [
- "base16ct 0.2.0",
+ "base16ct",
"crypto-bigint",
"digest 0.10.7",
"ff",
"generic-array 0.14.7",
"group",
- "pkcs8 0.10.2",
+ "pkcs8",
"rand_core 0.6.4",
- "sec1 0.7.3",
+ "sec1",
"subtle",
"zeroize",
]
@@ -3698,7 +3674,7 @@ dependencies = [
"jsonrpsee 0.16.3",
"keyring",
"lazy_static",
- "libp2p 0.50.1",
+ "libp2p",
"log",
"nacl",
"rand 0.8.5",
@@ -4414,7 +4390,6 @@ version = "1.0.5"
dependencies = [
"derive_more",
"enum-iterator 1.4.1",
- "gear-core",
"gwasm-instrument",
"wasmparser-nostd 0.100.1",
"wat",
@@ -4699,7 +4674,7 @@ version = "1.0.5"
[[package]]
name = "gtest"
-version = "0.1.0"
+version = "1.0.5"
dependencies = [
"colored",
"demo-custom",
@@ -5656,27 +5631,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "libp2p"
-version = "0.50.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c7b0104790be871edcf97db9bd2356604984e623a08d825c3f27852290266b8"
-dependencies = [
- "bytes",
- "futures",
- "futures-timer",
- "getrandom 0.2.10",
- "instant",
- "libp2p-core 0.38.0",
- "libp2p-identify 0.41.1",
- "libp2p-metrics 0.11.0",
- "libp2p-swarm 0.41.1",
- "multiaddr 0.16.0",
- "parking_lot 0.12.1",
- "pin-project",
- "smallvec",
-]
-
[[package]]
name = "libp2p"
version = "0.51.4"
@@ -5690,23 +5644,23 @@ dependencies = [
"instant",
"libp2p-allow-block-list",
"libp2p-connection-limits",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-dns",
- "libp2p-identify 0.42.2",
+ "libp2p-identify",
"libp2p-identity",
"libp2p-kad",
"libp2p-mdns",
- "libp2p-metrics 0.12.0",
+ "libp2p-metrics",
"libp2p-noise",
"libp2p-ping",
"libp2p-quic",
"libp2p-request-response",
- "libp2p-swarm 0.42.2",
+ "libp2p-swarm",
"libp2p-tcp",
"libp2p-wasm-ext",
"libp2p-websocket",
"libp2p-yamux",
- "multiaddr 0.17.1",
+ "multiaddr",
"pin-project",
]
@@ -5716,9 +5670,9 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "510daa05efbc25184458db837f6f9a5143888f1caa742426d92e1833ddd38a50"
dependencies = [
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
- "libp2p-swarm 0.42.2",
+ "libp2p-swarm",
"void",
]
@@ -5728,46 +5682,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0"
dependencies = [
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
- "libp2p-swarm 0.42.2",
+ "libp2p-swarm",
"void",
]
-[[package]]
-name = "libp2p-core"
-version = "0.38.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f"
-dependencies = [
- "asn1_der",
- "bs58 0.4.0",
- "ed25519-dalek 1.0.1",
- "either",
- "fnv",
- "futures",
- "futures-timer",
- "instant",
- "log",
- "multiaddr 0.16.0",
- "multihash 0.16.3",
- "multistream-select",
- "once_cell",
- "parking_lot 0.12.1",
- "pin-project",
- "prost",
- "prost-build",
- "rand 0.8.5",
- "rw-stream-sink",
- "sec1 0.3.0",
- "sha2 0.10.8",
- "smallvec",
- "thiserror",
- "unsigned-varint",
- "void",
- "zeroize",
-]
-
[[package]]
name = "libp2p-core"
version = "0.39.2"
@@ -5781,8 +5701,8 @@ dependencies = [
"instant",
"libp2p-identity",
"log",
- "multiaddr 0.17.1",
- "multihash 0.17.0",
+ "multiaddr",
+ "multihash",
"multistream-select",
"once_cell",
"parking_lot 0.12.1",
@@ -5803,34 +5723,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554"
dependencies = [
"futures",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"log",
"parking_lot 0.12.1",
"smallvec",
"trust-dns-resolver",
]
-[[package]]
-name = "libp2p-identify"
-version = "0.41.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c052d0026f4817b44869bfb6810f4e1112f43aec8553f2cb38881c524b563abf"
-dependencies = [
- "asynchronous-codec",
- "futures",
- "futures-timer",
- "libp2p-core 0.38.0",
- "libp2p-swarm 0.41.1",
- "log",
- "lru 0.8.1",
- "prost",
- "prost-build",
- "prost-codec",
- "smallvec",
- "thiserror",
- "void",
-]
-
[[package]]
name = "libp2p-identify"
version = "0.42.2"
@@ -5841,11 +5740,11 @@ dependencies = [
"either",
"futures",
"futures-timer",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
- "libp2p-swarm 0.42.2",
+ "libp2p-swarm",
"log",
- "lru 0.10.1",
+ "lru",
"quick-protobuf",
"quick-protobuf-codec",
"smallvec",
@@ -5862,8 +5761,8 @@ dependencies = [
"bs58 0.4.0",
"ed25519-dalek 2.0.0",
"log",
- "multiaddr 0.17.1",
- "multihash 0.17.0",
+ "multiaddr",
+ "multihash",
"quick-protobuf",
"rand 0.8.5",
"sha2 0.10.8",
@@ -5885,9 +5784,9 @@ dependencies = [
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
- "libp2p-swarm 0.42.2",
+ "libp2p-swarm",
"log",
"quick-protobuf",
"rand 0.8.5",
@@ -5908,9 +5807,9 @@ dependencies = [
"data-encoding",
"futures",
"if-watch",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
- "libp2p-swarm 0.42.2",
+ "libp2p-swarm",
"log",
"rand 0.8.5",
"smallvec",
@@ -5920,30 +5819,18 @@ dependencies = [
"void",
]
-[[package]]
-name = "libp2p-metrics"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55"
-dependencies = [
- "libp2p-core 0.38.0",
- "libp2p-identify 0.41.1",
- "libp2p-swarm 0.41.1",
- "prometheus-client 0.18.1",
-]
-
[[package]]
name = "libp2p-metrics"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46"
dependencies = [
- "libp2p-core 0.39.2",
- "libp2p-identify 0.42.2",
+ "libp2p-core",
+ "libp2p-identify",
"libp2p-kad",
"libp2p-ping",
- "libp2p-swarm 0.42.2",
- "prometheus-client 0.19.0",
+ "libp2p-swarm",
+ "prometheus-client",
]
[[package]]
@@ -5955,7 +5842,7 @@ dependencies = [
"bytes",
"curve25519-dalek 3.2.0",
"futures",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
"log",
"once_cell",
@@ -5979,8 +5866,8 @@ dependencies = [
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.39.2",
- "libp2p-swarm 0.42.2",
+ "libp2p-core",
+ "libp2p-swarm",
"log",
"rand 0.8.5",
"void",
@@ -5996,7 +5883,7 @@ dependencies = [
"futures",
"futures-timer",
"if-watch",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
"libp2p-tls",
"log",
@@ -6017,31 +5904,11 @@ dependencies = [
"async-trait",
"futures",
"instant",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
- "libp2p-swarm 0.42.2",
- "rand 0.8.5",
- "smallvec",
-]
-
-[[package]]
-name = "libp2p-swarm"
-version = "0.41.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0"
-dependencies = [
- "either",
- "fnv",
- "futures",
- "futures-timer",
- "instant",
- "libp2p-core 0.38.0",
- "log",
- "pin-project",
+ "libp2p-swarm",
"rand 0.8.5",
"smallvec",
- "thiserror",
- "void",
]
[[package]]
@@ -6055,7 +5922,7 @@ dependencies = [
"futures",
"futures-timer",
"instant",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
"libp2p-swarm-derive",
"log",
@@ -6086,7 +5953,7 @@ dependencies = [
"futures-timer",
"if-watch",
"libc",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"log",
"socket2 0.4.9",
"tokio",
@@ -6100,7 +5967,7 @@ checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781"
dependencies = [
"futures",
"futures-rustls",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"libp2p-identity",
"rcgen",
"ring",
@@ -6119,7 +5986,7 @@ checksum = "77dff9d32353a5887adb86c8afc1de1a94d9e8c3bc6df8b2201d7cdf5c848f43"
dependencies = [
"futures",
"js-sys",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"parity-send-wrapper",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -6134,7 +6001,7 @@ dependencies = [
"either",
"futures",
"futures-rustls",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"log",
"parking_lot 0.12.1",
"quicksink",
@@ -6151,7 +6018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda"
dependencies = [
"futures",
- "libp2p-core 0.39.2",
+ "libp2p-core",
"log",
"thiserror",
"yamux",
@@ -6325,15 +6192,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "lru"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909"
-dependencies = [
- "hashbrown 0.12.3",
-]
-
[[package]]
name = "lru"
version = "0.10.1"
@@ -6648,24 +6506,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389"
-[[package]]
-name = "multiaddr"
-version = "0.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e"
-dependencies = [
- "arrayref",
- "byteorder",
- "data-encoding",
- "multibase",
- "multihash 0.16.3",
- "percent-encoding",
- "serde",
- "static_assertions",
- "unsigned-varint",
- "url",
-]
-
[[package]]
name = "multiaddr"
version = "0.17.1"
@@ -6677,7 +6517,7 @@ dependencies = [
"data-encoding",
"log",
"multibase",
- "multihash 0.17.0",
+ "multihash",
"percent-encoding",
"serde",
"static_assertions",
@@ -6696,19 +6536,6 @@ dependencies = [
"data-encoding-macro",
]
-[[package]]
-name = "multihash"
-version = "0.16.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc"
-dependencies = [
- "core2",
- "digest 0.10.7",
- "multihash-derive",
- "sha2 0.10.8",
- "unsigned-varint",
-]
-
[[package]]
name = "multihash"
version = "0.17.0"
@@ -8592,24 +8419,14 @@ dependencies = [
"futures-io",
]
-[[package]]
-name = "pkcs8"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba"
-dependencies = [
- "der 0.6.1",
- "spki 0.6.0",
-]
-
[[package]]
name = "pkcs8"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
dependencies = [
- "der 0.7.8",
- "spki 0.7.2",
+ "der",
+ "spki",
]
[[package]]
@@ -8825,18 +8642,6 @@ dependencies = [
"thiserror",
]
-[[package]]
-name = "prometheus-client"
-version = "0.18.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c"
-dependencies = [
- "dtoa",
- "itoa",
- "parking_lot 0.12.1",
- "prometheus-client-derive-text-encode",
-]
-
[[package]]
name = "prometheus-client"
version = "0.19.0"
@@ -8860,17 +8665,6 @@ dependencies = [
"syn 2.0.41",
]
-[[package]]
-name = "prometheus-client-derive-text-encode"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
[[package]]
name = "proptest"
version = "1.4.0"
@@ -8923,19 +8717,6 @@ dependencies = [
"which",
]
-[[package]]
-name = "prost-codec"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0"
-dependencies = [
- "asynchronous-codec",
- "bytes",
- "prost",
- "thiserror",
- "unsigned-varint",
-]
-
[[package]]
name = "prost-derive"
version = "0.11.9"
@@ -10193,7 +9974,7 @@ dependencies = [
"futures",
"futures-timer",
"ip_network",
- "libp2p 0.51.4",
+ "libp2p",
"linked_hash_set",
"log",
"mockall",
@@ -10264,7 +10045,7 @@ dependencies = [
"ahash 0.8.6",
"futures",
"futures-timer",
- "libp2p 0.51.4",
+ "libp2p",
"log",
"sc-network",
"sc-network-common",
@@ -10303,7 +10084,7 @@ dependencies = [
"array-bytes",
"async-channel",
"futures",
- "libp2p 0.51.4",
+ "libp2p",
"log",
"parity-scale-codec",
"sc-network",
@@ -10324,7 +10105,7 @@ dependencies = [
"fork-tree",
"futures",
"futures-timer",
- "libp2p 0.51.4",
+ "libp2p",
"log",
"mockall",
"parity-scale-codec",
@@ -10354,7 +10135,7 @@ source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v1
dependencies = [
"array-bytes",
"futures",
- "libp2p 0.51.4",
+ "libp2p",
"log",
"parity-scale-codec",
"sc-network",
@@ -10377,7 +10158,7 @@ dependencies = [
"futures-timer",
"hyper",
"hyper-rustls",
- "libp2p 0.51.4",
+ "libp2p",
"log",
"num_cpus",
"once_cell",
@@ -10619,7 +10400,7 @@ source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v1
dependencies = [
"chrono",
"futures",
- "libp2p 0.51.4",
+ "libp2p",
"log",
"parking_lot 0.12.1",
"pin-project",
@@ -10929,29 +10710,16 @@ version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
-[[package]]
-name = "sec1"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928"
-dependencies = [
- "base16ct 0.1.1",
- "der 0.6.1",
- "generic-array 0.14.7",
- "pkcs8 0.9.0",
- "zeroize",
-]
-
[[package]]
name = "sec1"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
dependencies = [
- "base16ct 0.2.0",
- "der 0.7.8",
+ "base16ct",
+ "der",
"generic-array 0.14.7",
- "pkcs8 0.10.2",
+ "pkcs8",
"subtle",
"zeroize",
]
@@ -11388,7 +11156,7 @@ dependencies = [
"hex",
"itertools",
"log",
- "lru 0.10.1",
+ "lru",
"parking_lot 0.12.1",
"rand 0.8.5",
"serde",
@@ -12201,16 +11969,6 @@ dependencies = [
"strum 0.24.1",
]
-[[package]]
-name = "spki"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b"
-dependencies = [
- "base64ct",
- "der 0.6.1",
-]
-
[[package]]
name = "spki"
version = "0.7.2"
@@ -12218,7 +11976,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a"
dependencies = [
"base64ct",
- "der 0.7.8",
+ "der",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 762d1f62513..38648f27ec6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -430,7 +430,7 @@ impl-trait-for-tuples = "0.2.2" # pall
indexmap = "2.1.0" # utils/weight-diff
indicatif = "*" # utils/wasm-gen
keyring = "1.2.1" # gcli
-libp2p = "=0.50.1" # gcli (same version as sc-consensus)
+libp2p = "=0.51.4" # gcli (same version as sc-consensus)
mimalloc = { version = "0.1.39", default-features = false } # node/cli
nacl = "0.5.3" # gcli
nonempty = "0.8.1" # utils/utils
diff --git a/common/src/pallet_tests.rs b/common/src/pallet_tests.rs
index 8fdb6b1a044..430084a134b 100644
--- a/common/src/pallet_tests.rs
+++ b/common/src/pallet_tests.rs
@@ -20,9 +20,8 @@
//! for various pallets of Substrate.
//! All used types should be in scope.
-use frame_support::{pallet_prelude::*, weights::RuntimeDbWeight};
+use frame_support::{pallet_prelude::*, sp_runtime::Perbill, weights::RuntimeDbWeight};
use frame_system::limits::BlockWeights;
-use sp_arithmetic::Perbill;
#[macro_export]
macro_rules! impl_pallet_balances {
diff --git a/gcli/src/cmd/key.rs b/gcli/src/cmd/key.rs
index f4ea4d5f715..a2959b5ef4d 100644
--- a/gcli/src/cmd/key.rs
+++ b/gcli/src/cmd/key.rs
@@ -161,10 +161,7 @@ impl Key {
let pair = Keypair::generate();
println!("Secret: 0x{}", hex::encode(pair.secret().as_ref()));
- println!(
- "Peer ID: {}",
- PublicKey::Ed25519(pair.public()).to_peer_id()
- );
+ println!("Peer ID: {}", PublicKey::from(pair.public()).to_peer_id());
}
fn info
(title: &str, signer: &P, seed: Option>)
@@ -203,14 +200,11 @@ impl Key {
PublicKey,
};
let pair = Keypair::from(
- SecretKey::from_bytes(&mut hex::decode(secret)?)
+ SecretKey::try_from_bytes(&mut hex::decode(secret)?)
.map_err(|_| crate::result::Error::BadNodeKey)?,
);
- println!(
- "Peer ID: {}",
- PublicKey::Ed25519(pair.public()).to_peer_id()
- );
+ println!("Peer ID: {}", PublicKey::from(pair.public()).to_peer_id());
Ok(())
}
diff --git a/gtest/Cargo.toml b/gtest/Cargo.toml
index c091b9b977a..73f8817e787 100644
--- a/gtest/Cargo.toml
+++ b/gtest/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "gtest"
-version = "0.1.0"
+description = "Testing utils for developing Gear programs."
+version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/utils/crates-io/src/handler.rs b/utils/crates-io/src/handler.rs
new file mode 100644
index 00000000000..9788aa8dbab
--- /dev/null
+++ b/utils/crates-io/src/handler.rs
@@ -0,0 +1,232 @@
+// This file is part of Gear.
+
+// Copyright (C) 2021-2023 Gear Technologies Inc.
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+//! Handlers for patching manifests.
+
+use crate::Manifest;
+use anyhow::Result;
+use cargo_metadata::Package;
+use toml_edit::Document;
+
+/// Get the crates-io name of the provided package.
+pub fn crates_io_name(pkg: &str) -> &str {
+ // `gear-core-processor` is taken by others, see the docs
+ // of [`core-processor::patch_workspace`] for more details.
+ if pkg == "gear-core-processor" {
+ "core-processor"
+ } else {
+ pkg
+ }
+}
+
+/// Patch specified manifest by provided name.
+pub fn patch(pkg: &Package) -> Result {
+ let mut manifest = Manifest::new(pkg)?;
+ let doc = &mut manifest.manifest;
+
+ match manifest.name.as_str() {
+ "gear-core-processor" => core_processor::patch(doc),
+ "gear-runtime-interface" => runtime_interface::patch(doc),
+ "gear-sandbox" => sandbox::patch(doc),
+ "gear-sandbox-host" => sandbox_host::patch(doc),
+ "gmeta" => gmeta::patch(doc),
+ "gmeta-codegen" => gmeta_codegen::patch(doc),
+ _ => {}
+ }
+
+ Ok(manifest)
+}
+
+/// Patch package alias.
+pub fn patch_alias(index: &mut Vec<&str>) {
+ for (package, alias) in crate::PACKAGE_ALIAS {
+ if index.contains(&package) {
+ index.push(alias);
+ }
+ }
+}
+
+/// Patch the workspace manifest.
+pub fn patch_workspace(name: &str, table: &mut toml_edit::InlineTable) {
+ match name {
+ "core-processor" | "gear-core-processor" => core_processor::patch_workspace(name, table),
+ sub if sub.starts_with("sp-") => substrate::patch_workspace(name, table),
+ _ => {}
+ }
+}
+
+// Trim the version of dev dependency.
+//
+// issue: https://github.com/rust-lang/cargo/issues/4242
+fn trim_dev_dep(name: &str, manifest: &mut Document) {
+ if let Some(dep) = manifest["dev-dependencies"][name].as_inline_table_mut() {
+ dep.remove("workspace");
+ dep.insert("version", "~1".into());
+ }
+
+ if let Some(dep) = manifest["dev-dependencies"][name].as_table_like_mut() {
+ dep.remove("workspace");
+ dep.insert("version", toml_edit::value("~1"));
+ }
+}
+
+/// gear-core-processor handler.
+mod core_processor {
+ use toml_edit::{Document, InlineTable};
+
+ /// Pointing the package name of core-processor to
+ /// `core-processor` on `crates-io` since this is
+ /// the one we own.
+ pub fn patch_workspace(name: &str, table: &mut InlineTable) {
+ match name {
+ // Remove the path definition to point core-processor to
+ // crates-io.
+ "core-processor" => {
+ table.remove("package");
+ }
+ // Points to `core-processor` for the one on crates-io.
+ "gear-core-processor" => {
+ table.insert("package", "core-processor".into());
+ }
+ _ => {}
+ }
+ }
+
+ /// Patch the manifest of core-processor.
+ pub fn patch(manifest: &mut Document) {
+ manifest["package"]["name"] = toml_edit::value("core-processor");
+ }
+}
+
+/// gmeta handler
+mod gmeta {
+ use super::trim_dev_dep;
+ use toml_edit::Document;
+
+ /// Patch the manifest of gmetadata.
+ pub fn patch(manifest: &mut Document) {
+ trim_dev_dep("gstd", manifest);
+ trim_dev_dep("gear-wasm-builder", manifest);
+ }
+}
+
+/// gmeta handler
+mod gmeta_codegen {
+ use super::trim_dev_dep;
+ use toml_edit::Document;
+
+ /// Patch the manifest of gmeta.
+ pub fn patch(manifest: &mut Document) {
+ trim_dev_dep("gstd", manifest);
+ trim_dev_dep("gmeta", manifest);
+ }
+}
+
+mod runtime_interface {
+ use crate::GP_RUNTIME_INTERFACE_VERSION;
+ use toml_edit::Document;
+
+ /// Patch the manifest of runtime-interface.
+ ///
+ /// We need to patch the manifest of package again because
+ /// `sp_runtime_interface_proc_macro` includes some hardcode
+ /// that could not locate alias packages.
+ pub fn patch(manifest: &mut Document) {
+ let Some(wi) = manifest["dependencies"]["sp-runtime-interface"].as_table_mut() else {
+ return;
+ };
+ wi.insert("version", toml_edit::value(GP_RUNTIME_INTERFACE_VERSION));
+ wi.insert("package", toml_edit::value("gp-runtime-interface"));
+ wi.remove("workspace");
+ }
+}
+
+/// sandbox handler.
+mod sandbox {
+ use toml_edit::Document;
+
+ /// Replace the wasmi module to the crates-io version.
+ pub fn patch(manifest: &mut Document) {
+ let Some(wasmi) = manifest["dependencies"]["wasmi"].as_inline_table_mut() else {
+ return;
+ };
+ wasmi.insert("package", "gwasmi".into());
+ wasmi.insert("version", "0.30.0".into());
+ wasmi.remove("branch");
+ wasmi.remove("git");
+ }
+}
+
+/// sandbox_host handler.
+mod sandbox_host {
+ use toml_edit::Document;
+
+ /// Replace the wasmi module to the crates-io version.
+ pub fn patch(manifest: &mut Document) {
+ let Some(wasmi) = manifest["dependencies"]["wasmi"].as_inline_table_mut() else {
+ return;
+ };
+ wasmi.insert("version", "0.13.2".into());
+ wasmi.remove("branch");
+ wasmi.remove("git");
+ }
+}
+
+/// substrate handler.
+mod substrate {
+ use crate::GP_RUNTIME_INTERFACE_VERSION;
+ use toml_edit::InlineTable;
+
+ /// Patch the substrate packages in the manifest of workspace.
+ ///
+ /// NOTE: The packages inside of this function are located at
+ /// .
+ pub fn patch_workspace(name: &str, table: &mut InlineTable) {
+ match name {
+ // sp-allocator is outdated on crates.io, last
+ // 3.0.0 forever, here we use gp-allocator instead.
+ "sp-allocator" => {
+ table.insert("version", "4.1.1".into());
+ table.insert("package", "gp-allocator".into());
+ }
+ // Our sp-wasm-interface is different from the
+ // original one.
+ "sp-wasm-interface" => {
+ table.insert("package", "gp-wasm-interface".into());
+ table.insert("version", "7.0.1".into());
+ }
+ // Related to sp-wasm-interface.
+ "sp-wasm-interface-common" => {
+ table.insert("version", "7.0.1".into());
+ }
+ // Related to sp-wasm-interface.
+ "sp-runtime-interface" => {
+ table.insert("version", GP_RUNTIME_INTERFACE_VERSION.into());
+ table.insert("package", "gp-runtime-interface".into());
+ }
+ // The versions of these packages on crates.io are incorrect.
+ "sp-arithmetic" | "sp-core" | "sp-rpc" | "sp-version" => {
+ table.insert("version", "21.0.0".into());
+ }
+ _ => {}
+ }
+
+ table.remove("branch");
+ table.remove("git");
+ }
+}
diff --git a/utils/crates-io/src/lib.rs b/utils/crates-io/src/lib.rs
index 454b60615c0..f75d37b77cb 100644
--- a/utils/crates-io/src/lib.rs
+++ b/utils/crates-io/src/lib.rs
@@ -19,6 +19,7 @@
//! crates-io-manager library
#![deny(missing_docs)]
+mod handler;
mod manifest;
mod publisher;
mod version;
@@ -28,12 +29,14 @@ use anyhow::Result;
use std::process::{Command, ExitStatus};
/// Required Packages without local dependencies.
-pub const SAFE_DEPENDENCIES: [&str; 10] = [
+pub const SAFE_DEPENDENCIES: [&str; 12] = [
"actor-system-error",
"galloc",
"gear-stack-buffer",
"gear-core-errors",
"gear-common-codegen",
+ "gear-runtime-primitives",
+ "gear-sandbox-env",
"gear-wasm-instrument",
"gmeta-codegen",
"gsdk-codegen",
@@ -42,16 +45,50 @@ pub const SAFE_DEPENDENCIES: [&str; 10] = [
];
/// Required packages with local dependencies.
-pub const STACKED_DEPENDENCIES: [&str; 5] =
- ["gcore", "gmeta", "gear-core", "gear-utils", "gear-common"];
+///
+/// NOTE: DO NOT change the order of this array.
+pub const STACKED_DEPENDENCIES: [&str; 13] = [
+ "gcore",
+ "gmeta",
+ "gear-core",
+ "gear-utils",
+ "gear-common",
+ "gear-sandbox-host",
+ "gear-lazy-pages-common",
+ "gear-lazy-pages",
+ "gear-runtime-interface",
+ "gear-lazy-pages-interface",
+ "gear-sandbox",
+ "gear-core-backend",
+ "gear-core-processor",
+];
/// Packages need to be published.
-pub const PACKAGES: [&str; 5] = ["gear-wasm-builder", "gstd", "gsdk", "gclient", "gcli"];
+///
+/// NOTE: DO NOT change the order of this array.
+pub const PACKAGES: [&str; 6] = [
+ "gear-wasm-builder",
+ "gstd",
+ "gtest",
+ "gsdk",
+ "gclient",
+ "gcli",
+];
+
+/// Alias for packages.
+pub const PACKAGE_ALIAS: [(&str, &str); 2] = [
+ ("gear-core-processor", "core-processor"),
+ ("gear-runtime-primitives", "runtime-primitives"),
+];
+
+/// The working version of sp-wasm-interface.
+pub const GP_RUNTIME_INTERFACE_VERSION: &str = "7.0.5";
/// Check the input package
pub fn check(manifest: &str) -> Result {
Command::new("cargo")
.arg("check")
+ .arg("--lib")
.arg("--manifest-path")
.arg(manifest)
.status()
diff --git a/utils/crates-io/src/main.rs b/utils/crates-io/src/main.rs
index 15fc0b0fe85..896a1946073 100644
--- a/utils/crates-io/src/main.rs
+++ b/utils/crates-io/src/main.rs
@@ -52,10 +52,10 @@ fn main() -> Result<()> {
let publisher = Publisher::new()?;
match command {
- Command::Check => publisher.build(None)?.check(),
- Command::Publish { version } => publisher.build(version)?.publish(),
+ Command::Check => publisher.build(false, None)?.check(),
+ Command::Publish { version } => publisher.build(true, version)?.publish(),
Command::Build => {
- publisher.build(None)?;
+ publisher.build(false, None)?;
Ok(())
}
}
diff --git a/utils/crates-io/src/manifest.rs b/utils/crates-io/src/manifest.rs
index 942a43118cc..99555655808 100644
--- a/utils/crates-io/src/manifest.rs
+++ b/utils/crates-io/src/manifest.rs
@@ -18,28 +18,24 @@
//! Manifest utils for crates-io-manager
+use crate::{handler, version};
use anyhow::{anyhow, Result};
use cargo_metadata::Package;
-use std::{fs, path::PathBuf};
+use std::{
+ fs,
+ ops::{Deref, DerefMut},
+ path::PathBuf,
+};
use toml_edit::Document;
-use crate::version;
-
const WORKSPACE_NAME: &str = "__gear_workspace";
-/// Cargo manifest with path
-pub struct Manifest {
- /// Crate name
- pub name: String,
- /// Cargo manifest
- pub manifest: Document,
- /// Path of the manifest
- pub path: PathBuf,
-}
+/// Workspace instance, which is a wrapper of [`Manifest`].
+pub struct Workspace(Manifest);
-impl Manifest {
- /// Get the workspace manifest
- pub fn workspace() -> Result {
+impl Workspace {
+ /// Get the workspace manifest with version overridden.
+ pub fn lookup(version: Option) -> Result {
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.ancestors()
.nth(2)
@@ -47,35 +43,34 @@ impl Manifest {
.ok_or_else(|| anyhow::anyhow!("Could not find workspace manifest"))?
.canonicalize()?;
- Ok(Self {
+ let mut workspace: Self = Manifest {
name: WORKSPACE_NAME.to_string(),
manifest: fs::read_to_string(&path)?.parse()?,
path,
- })
- }
-
- /// Complete the manifest of the specified crate from
- /// the workspace manifest
- pub fn manifest(&self, pkg: &Package) -> Result {
- self.ensure_workspace()?;
+ }
+ .into();
+
+ // NOTE: renaming version here is required because it could
+ // be easy to publish incorrect version to crates.io by mistake
+ // in testing.
+ {
+ let version = if let Some(version) = version {
+ version
+ } else {
+ workspace.version()? + "-" + &version::hash()?
+ };
- // Complete documentation as from
- let mut manifest: Document = fs::read_to_string(&pkg.manifest_path)?.parse()?;
- let name = pkg.name.clone();
- manifest["package"]["documentation"] = toml_edit::value(format!("https://docs.rs/{name}"));
+ workspace.manifest["workspace"]["package"]["version"] = toml_edit::value(version);
+ }
- Ok(Self {
- name,
- manifest,
- path: pkg.manifest_path.clone().into(),
- })
+ Ok(workspace)
}
/// complete the versions of the specified crates
- pub fn complete_versions(&mut self, index: &[&str]) -> Result<()> {
- self.ensure_workspace()?;
+ pub fn complete(&mut self, mut index: Vec<&str>) -> Result<()> {
+ handler::patch_alias(&mut index);
- let version = self.manifest["workspace"]["package"]["version"]
+ let version = self.0.manifest["workspace"]["package"]["version"]
.clone()
.as_str()
.ok_or_else(|| anyhow!("Could not find version in workspace manifest"))?
@@ -97,29 +92,12 @@ impl Manifest {
dep["version"] = toml_edit::value(version.clone());
}
- self.rename_deps()?;
+ self.rename()?;
Ok(())
}
- /// Set version for the workspace.
- pub fn with_version(mut self, version: Option) -> Result {
- self.ensure_workspace()?;
-
- let version = if let Some(version) = version {
- version
- } else {
- self.version()? + "-" + &version::hash()?
- };
-
- self.manifest["workspace"]["package"]["version"] = toml_edit::value(version);
-
- Ok(self)
- }
-
/// Get version from the current manifest.
pub fn version(&self) -> Result {
- self.ensure_workspace()?;
-
Ok(self.manifest["workspace"]["package"]["version"]
.as_str()
.ok_or_else(|| {
@@ -131,58 +109,79 @@ impl Manifest {
.to_string())
}
- /// Write manifest to disk.
- pub fn write(&self) -> Result<()> {
- fs::write(&self.path, self.manifest.to_string()).map_err(Into::into)
- }
-
- /// Rename dependencies
- fn rename_deps(&mut self) -> Result<()> {
- self.ensure_workspace()?;
-
+ /// Rename worskapce manifest.
+ fn rename(&mut self) -> Result<()> {
let Some(deps) = self.manifest["workspace"]["dependencies"].as_table_like_mut() else {
return Ok(());
};
for (name, dep) in deps.iter_mut() {
let name = name.get();
- if !name.starts_with("sp-") {
+ let Some(table) = dep.as_inline_table_mut() else {
continue;
- }
-
- // Format dotted values into inline table.
- if let Some(table) = dep.as_table_mut() {
- table.remove("branch");
- table.remove("git");
- table.remove("workspace");
-
- if name == "sp-arithmetic" {
- // NOTE: the required version of sp-arithmetic is 6.0.0 in
- // git repo, but 7.0.0 in crates.io, so we need to fix it.
- table.insert("version", toml_edit::value("7.0.0"));
- }
-
- // Force the dep to be inline table in case of losing
- // documentation.
- let mut inline = table.clone().into_inline_table();
- inline.fmt();
- *dep = toml_edit::value(inline);
};
+
+ handler::patch_workspace(name, table);
}
Ok(())
}
+}
- /// Ensure the current function is called on the workspace manifest
- ///
- /// TODO: remove this interface after #3565
- fn ensure_workspace(&self) -> Result<()> {
- if self.name != WORKSPACE_NAME {
- return Err(anyhow!(
- "This method can only be called on the workspace manifest"
- ));
- }
+impl From for Workspace {
+ fn from(manifest: Manifest) -> Self {
+ Self(manifest)
+ }
+}
- Ok(())
+impl Deref for Workspace {
+ type Target = Manifest;
+
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+impl DerefMut for Workspace {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+
+/// Cargo manifest with path
+pub struct Manifest {
+ /// Crate name
+ pub name: String,
+ /// Cargo manifest
+ pub manifest: Document,
+ /// Path of the manifest
+ pub path: PathBuf,
+}
+
+impl Manifest {
+ /// Complete the manifest of the specified crate from
+ /// the workspace manifest
+ pub fn new(pkg: &Package) -> Result {
+ // Complete documentation as from
+ let mut manifest: Document = fs::read_to_string(&pkg.manifest_path)?.parse()?;
+ let name = pkg.name.clone();
+ manifest["package"]["documentation"] = toml_edit::value(format!("https://docs.rs/{name}"));
+
+ Ok(Self {
+ name,
+ manifest,
+ path: pkg.manifest_path.clone().into(),
+ })
+ }
+
+ /// Write manifest to disk.
+ pub fn write(&self) -> Result<()> {
+ fs::write(&self.path, self.manifest.to_string()).map_err(Into::into)
+ }
+}
+
+impl From for Manifest {
+ fn from(workspace: Workspace) -> Self {
+ workspace.0
}
}
diff --git a/utils/crates-io/src/publisher.rs b/utils/crates-io/src/publisher.rs
index 0155eea94c8..2153cdac6f8 100644
--- a/utils/crates-io/src/publisher.rs
+++ b/utils/crates-io/src/publisher.rs
@@ -18,7 +18,9 @@
//! Packages publisher
-use crate::{Manifest, PACKAGES, SAFE_DEPENDENCIES, STACKED_DEPENDENCIES};
+use crate::{
+ handler, manifest::Workspace, Manifest, PACKAGES, SAFE_DEPENDENCIES, STACKED_DEPENDENCIES,
+};
use anyhow::Result;
use cargo_metadata::{Metadata, MetadataCommand, Package};
use std::collections::{BTreeMap, HashMap};
@@ -59,9 +61,9 @@ impl Publisher {
/// 1. Replace git dependencies to crates-io dependencies.
/// 2. Rename version of all local packages
/// 3. Patch dependencies if needed
- pub fn build(mut self, version: Option) -> Result {
+ pub fn build(mut self, verify: bool, version: Option) -> Result {
let index = self.index.keys().map(|s| s.as_ref()).collect::>();
- let mut workspace = Manifest::workspace()?.with_version(version)?;
+ let mut workspace = Workspace::lookup(version)?;
let version = workspace.version()?;
for pkg @ Package { name, .. } in &self.metadata.packages {
@@ -69,20 +71,20 @@ impl Publisher {
continue;
}
- println!("Verifying {}@{} ...", &name, &version);
- if crate::verify(name, &version)? {
+ if verify && crate::verify(name, &version)? {
println!("Package {}@{} already published .", &name, &version);
continue;
}
self.graph
- .insert(self.index.get(name).cloned(), workspace.manifest(pkg)?);
+ .insert(self.index.get(name).cloned(), handler::patch(pkg)?);
}
- // Flush new manifests to disk
- workspace.complete_versions(&index)?;
- let mut manifests = self.graph.values().collect::>();
- manifests.push(&workspace);
+ workspace.complete(index)?;
+
+ // write manifests to disk.
+ let manifest = workspace.into();
+ let manifests = [self.graph.values().collect::>(), vec![&manifest]].concat();
manifests
.iter()
.map(|m| m.write())
diff --git a/utils/crates-io/src/version.rs b/utils/crates-io/src/version.rs
index 4986ef927fc..b5fd0e657f7 100644
--- a/utils/crates-io/src/version.rs
+++ b/utils/crates-io/src/version.rs
@@ -22,6 +22,8 @@ use anyhow::{anyhow, Result};
use serde::Deserialize;
use std::process::Command;
+use crate::handler;
+
#[derive(Debug, Deserialize)]
struct Resp {
pub versions: Vec,
@@ -34,16 +36,24 @@ struct Version {
/// Verify if the package has already been published.
pub fn verify(name: &str, version: &str) -> Result {
+ println!("Verifying {}@{} ...", &name, &version);
+
let client = reqwest::blocking::Client::builder()
.user_agent("gear-crates-io-manager")
.build()?;
- let resp = client
- .get(format!("https://crates.io/api/v1/crates/{name}/versions"))
+ if let Ok(resp) = client
+ .get(format!(
+ "https://crates.io/api/v1/crates/{}/versions",
+ handler::crates_io_name(name)
+ ))
.send()?
- .json::()?;
+ .json::()
+ {
+ return Ok(resp.versions.into_iter().any(|v| v.num == version));
+ }
- Ok(resp.versions.into_iter().any(|v| v.num == version))
+ Ok(false)
}
/// Get the short hash of the current commit.
diff --git a/utils/wasm-instrument/Cargo.toml b/utils/wasm-instrument/Cargo.toml
index b3dc15dfe39..f1df578f9b6 100644
--- a/utils/wasm-instrument/Cargo.toml
+++ b/utils/wasm-instrument/Cargo.toml
@@ -18,7 +18,6 @@ enum-iterator.workspace = true
[dev-dependencies]
wasmparser.workspace = true
wat.workspace = true
-gear-core.workspace = true
[features]
default = ["std"]