mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 23:01:01 +00:00
Fix CI on master (#4160)
* fix runtime check script * fix subkey deploy * fix rustdoc-header path * Remove vulnerable rust-yaml by directly parsing clap in subkey * Make network and password optional as the test requires
This commit is contained in:
committed by
Bastian Köcher
parent
872c04b304
commit
8185ee925d
@@ -296,7 +296,7 @@ build-linux-subkey:
|
|||||||
variables:
|
variables:
|
||||||
- $DEPLOY_TAG
|
- $DEPLOY_TAG
|
||||||
script:
|
script:
|
||||||
- cd ./subkey
|
- cd ./bin/subkey
|
||||||
- BUILD_DUMMY_WASM_BINARY=1 time cargo build --release --verbose
|
- BUILD_DUMMY_WASM_BINARY=1 time cargo build --release --verbose
|
||||||
- cd -
|
- cd -
|
||||||
- sccache -s
|
- sccache -s
|
||||||
@@ -323,7 +323,7 @@ build-rust-doc-release:
|
|||||||
<<: *build-only
|
<<: *build-only
|
||||||
script:
|
script:
|
||||||
- rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds
|
- rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds
|
||||||
- BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd).maintain/rustdoc-header.html" time cargo +nightly doc --release --all --verbose
|
- BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/.maintain/rustdoc-header.html" time cargo +nightly doc --release --all --verbose
|
||||||
- cp -R ./target/doc ./crate-docs
|
- cp -R ./target/doc ./crate-docs
|
||||||
- echo "<meta http-equiv=refresh content=0;url=substrate_service/index.html>" > ./crate-docs/index.html
|
- echo "<meta http-equiv=refresh content=0;url=substrate_service/index.html>" > ./crate-docs/index.html
|
||||||
- sccache -s
|
- sccache -s
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# check for any changes in the node/src/runtime, palette/ and core/sr_* trees. if
|
# check for any changes in the node/src/runtime, palette/ and primitives/sr_* trees. if
|
||||||
# there are any changes found, it should mark the PR breaksconsensus and
|
# there are any changes found, it should mark the PR breaksconsensus and
|
||||||
# "auto-fail" the PR if there isn't a change in the runtime/src/lib.rs file
|
# "auto-fail" the PR if there isn't a change in the runtime/src/lib.rs file
|
||||||
# that alters the version.
|
# that alters the version.
|
||||||
@@ -12,9 +12,7 @@ set -e # fail on any error
|
|||||||
# give some context
|
# give some context
|
||||||
git log --graph --oneline --decorate=short -n 10
|
git log --graph --oneline --decorate=short -n 10
|
||||||
|
|
||||||
|
VERSIONS_FILE="bin/node/runtime/src/lib.rs"
|
||||||
RUNTIME="node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm"
|
|
||||||
VERSIONS_FILE="node/runtime/src/lib.rs"
|
|
||||||
|
|
||||||
github_label () {
|
github_label () {
|
||||||
echo
|
echo
|
||||||
@@ -29,10 +27,9 @@ github_label () {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# check if the wasm sources changed
|
# check if the wasm sources changed
|
||||||
if ! git diff --name-only origin/master...${CI_COMMIT_SHA} \
|
if ! git diff --name-only origin/master...${CI_COMMIT_SHA} \
|
||||||
| grep -q -e '^node/src/runtime' -e '^palette/' -e '^core/sr-' | grep -v -e '^core/sr-arithmetic/fuzzer'
|
| grep -q -e '^bin/node/src/runtime' -e '^palette/' -e '^primitives/sr-' | grep -v -e '^primitives/sr-arithmetic/fuzzer'
|
||||||
then
|
then
|
||||||
cat <<-EOT
|
cat <<-EOT
|
||||||
|
|
||||||
@@ -66,7 +63,7 @@ then
|
|||||||
changes to the runtime sources and changes in the spec version.
|
changes to the runtime sources and changes in the spec version.
|
||||||
|
|
||||||
spec_version: ${sub_spec_version} -> ${add_spec_version}
|
spec_version: ${sub_spec_version} -> ${add_spec_version}
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@@ -101,9 +98,9 @@ else
|
|||||||
If they do change logic, bump 'spec_version' and rebuild wasm.
|
If they do change logic, bump 'spec_version' and rebuild wasm.
|
||||||
|
|
||||||
source file directories:
|
source file directories:
|
||||||
- node/src/runtime
|
- bin/node/src/runtime
|
||||||
- palette
|
- palette
|
||||||
- core/sr-*
|
- primitives/sr-*
|
||||||
|
|
||||||
versions file: ${VERSIONS_FILE}
|
versions file: ${VERSIONS_FILE}
|
||||||
|
|
||||||
|
|||||||
Generated
+331
-296
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ node-runtime = { version = "*", path = "../node/runtime" }
|
|||||||
node-primitives = { version = "*", path = "../node/primitives" }
|
node-primitives = { version = "*", path = "../node/primitives" }
|
||||||
sr-primitives = { version = "*", path = "../../primitives/sr-primitives" }
|
sr-primitives = { version = "*", path = "../../primitives/sr-primitives" }
|
||||||
rand = "0.7.2"
|
rand = "0.7.2"
|
||||||
clap = { version = "2.33.0", features = ["yaml"] }
|
clap = "2.33.0"
|
||||||
tiny-bip39 = "0.6.2"
|
tiny-bip39 = "0.6.2"
|
||||||
rustc-hex = "2.0.1"
|
rustc-hex = "2.0.1"
|
||||||
substrate-bip39 = "0.3.1"
|
substrate-bip39 = "0.3.1"
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
name: subkey
|
|
||||||
author: "Parity Team <admin@parity.io>"
|
|
||||||
about: Utility for generating and restoring with Substrate keys
|
|
||||||
args:
|
|
||||||
- ed25519:
|
|
||||||
short: e
|
|
||||||
long: ed25519
|
|
||||||
help: Use Ed25519/BIP39 cryptography
|
|
||||||
takes_value: false
|
|
||||||
- sr25519:
|
|
||||||
short: s
|
|
||||||
long: sr25519
|
|
||||||
help: Use Schnorr/Ristretto x25519/BIP39 cryptography
|
|
||||||
takes_value: false
|
|
||||||
- secp256k1:
|
|
||||||
short: k
|
|
||||||
long: secp256k1
|
|
||||||
help: Use SECP256k1/ECDSA/BIP39 cryptography
|
|
||||||
takes_value: false
|
|
||||||
- password:
|
|
||||||
short: p
|
|
||||||
long: password
|
|
||||||
takes_value: true
|
|
||||||
required: false
|
|
||||||
help: The password for the key
|
|
||||||
- network:
|
|
||||||
short: n
|
|
||||||
long: network
|
|
||||||
takes_value: true
|
|
||||||
required: false
|
|
||||||
help: Specify a network. One of substrate (default), polkadot, kusama, or dothereum.
|
|
||||||
subcommands:
|
|
||||||
- generate:
|
|
||||||
about: Generate a random account
|
|
||||||
args:
|
|
||||||
- words:
|
|
||||||
short: w
|
|
||||||
long: words
|
|
||||||
help: The number of words in the phrase to generate. One of 12 (default), 15, 18, 21 and 24.
|
|
||||||
takes_value: true
|
|
||||||
- inspect:
|
|
||||||
about: Gets a public key and a SS58 address from the provided Secret URI
|
|
||||||
args:
|
|
||||||
- uri:
|
|
||||||
index: 1
|
|
||||||
required: true
|
|
||||||
help: A Key URI to be inspected. May be a secret seed, secret URI (with derivation paths and password), SS58 or public URI.
|
|
||||||
- sign:
|
|
||||||
about: Sign a message, provided on STDIN, with a given (secret) key
|
|
||||||
args:
|
|
||||||
- suri:
|
|
||||||
index: 1
|
|
||||||
required: true
|
|
||||||
help: The secret key URI.
|
|
||||||
- hex:
|
|
||||||
short: h
|
|
||||||
long: hex
|
|
||||||
help: The message on STDIN is hex-encoded data
|
|
||||||
takes_value: false
|
|
||||||
- transfer:
|
|
||||||
about: Author and sign a Node balances::Transfer transaction with a given (secret) key
|
|
||||||
args:
|
|
||||||
- from:
|
|
||||||
index: 1
|
|
||||||
required: true
|
|
||||||
help: The signing secret key URI.
|
|
||||||
- to:
|
|
||||||
index: 2
|
|
||||||
required: true
|
|
||||||
help: The destination account public key URI.
|
|
||||||
- amount:
|
|
||||||
index: 3
|
|
||||||
required: true
|
|
||||||
help: The number of units to transfer.
|
|
||||||
- index:
|
|
||||||
index: 4
|
|
||||||
required: true
|
|
||||||
help: The signing account's transaction index.
|
|
||||||
- genesis:
|
|
||||||
short: g
|
|
||||||
long: genesis
|
|
||||||
help: The genesis hash or a recognised chain identifier (dev, elm, alex).
|
|
||||||
takes_value: true
|
|
||||||
- verify:
|
|
||||||
about: Verify a signature for a message, provided on STDIN, with a given (public or secret) key
|
|
||||||
args:
|
|
||||||
- sig:
|
|
||||||
index: 1
|
|
||||||
required: true
|
|
||||||
help: Signature, hex-encoded.
|
|
||||||
- uri:
|
|
||||||
index: 2
|
|
||||||
required: true
|
|
||||||
help: The public or secret key URI.
|
|
||||||
- hex:
|
|
||||||
short: h
|
|
||||||
long: hex
|
|
||||||
help: The message on STDIN is hex-encoded data
|
|
||||||
takes_value: false
|
|
||||||
- vanity:
|
|
||||||
about: Generate a seed that provides a vanity address
|
|
||||||
args:
|
|
||||||
- pattern:
|
|
||||||
index: 1
|
|
||||||
help: Desired pattern
|
|
||||||
- number:
|
|
||||||
short: n
|
|
||||||
long: number
|
|
||||||
help: Number of keys to generate
|
|
||||||
takes_value: true
|
|
||||||
default_value: "1"
|
|
||||||
- sign-transaction:
|
|
||||||
about: Sign transaction from encoded Call. Returns a signed and encoded UncheckedMortalCompactExtrinsic as hex.
|
|
||||||
args:
|
|
||||||
- call:
|
|
||||||
short: c
|
|
||||||
long: call
|
|
||||||
help: The call, hex-encoded.
|
|
||||||
takes_value: true
|
|
||||||
required: true
|
|
||||||
- nonce:
|
|
||||||
short: n
|
|
||||||
long: nonce
|
|
||||||
help: The nonce.
|
|
||||||
takes_value: true
|
|
||||||
required: true
|
|
||||||
- suri:
|
|
||||||
long: suri
|
|
||||||
short: s
|
|
||||||
help: The secret key URI.
|
|
||||||
takes_value: true
|
|
||||||
required: true
|
|
||||||
- password:
|
|
||||||
short: p
|
|
||||||
long: password
|
|
||||||
takes_value: true
|
|
||||||
help: The password for the key.
|
|
||||||
required: true
|
|
||||||
- prior-block-hash:
|
|
||||||
short: h
|
|
||||||
long: prior-block-hash
|
|
||||||
help: The prior block hash, hex-encoded.
|
|
||||||
takes_value: true
|
|
||||||
required: true
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
use bip39::{Language, Mnemonic, MnemonicType};
|
use bip39::{Language, Mnemonic, MnemonicType};
|
||||||
use clap::{load_yaml, App, ArgMatches};
|
use clap::{App, ArgMatches, SubCommand};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use hex_literal::hex;
|
use hex_literal::hex;
|
||||||
use node_primitives::{Balance, Hash, Index, AccountId, Signature};
|
use node_primitives::{Balance, Hash, Index, AccountId, Signature};
|
||||||
@@ -155,11 +155,76 @@ impl PublicT for sr25519::Public { fn into_runtime(self) -> AccountPublic { self
|
|||||||
impl PublicT for ed25519::Public { fn into_runtime(self) -> AccountPublic { self.into() } }
|
impl PublicT for ed25519::Public { fn into_runtime(self) -> AccountPublic { self.into() } }
|
||||||
impl PublicT for ecdsa::Public { fn into_runtime(self) -> AccountPublic { self.into() } }
|
impl PublicT for ecdsa::Public { fn into_runtime(self) -> AccountPublic { self.into() } }
|
||||||
|
|
||||||
fn main() {
|
fn get_app<'a, 'b>() -> App<'a, 'b> {
|
||||||
let yaml = load_yaml!("cli.yml");
|
App::new("subkey")
|
||||||
let matches = App::from_yaml(yaml)
|
.author("Parity Team <admin@parity.io>")
|
||||||
|
.about("Utility for generating and restoring with Substrate keys")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.get_matches();
|
.args_from_usage("
|
||||||
|
-e, --ed25519 'Use Ed25519/BIP39 cryptography'
|
||||||
|
-k, --secp256k1 'Use SECP256k1/ECDSA/BIP39 cryptography'
|
||||||
|
-s, --sr25519 'Use Schnorr/Ristretto x25519/BIP39 cryptography'
|
||||||
|
[network] -n, --network <network> 'Specify a network. One of substrate \
|
||||||
|
(default), polkadot, kusama, or dothereum.'
|
||||||
|
[password] -p, --password <password> 'The password for the key'
|
||||||
|
")
|
||||||
|
.subcommands(vec![
|
||||||
|
SubCommand::with_name("generate")
|
||||||
|
.about("Generate a random account")
|
||||||
|
.args_from_usage("[words] -w, --words <words> \
|
||||||
|
'The number of words in the phrase to generate. One of 12 \
|
||||||
|
(default), 15, 18, 21 and 24.'
|
||||||
|
"),
|
||||||
|
SubCommand::with_name("inspect")
|
||||||
|
.about("Gets a public key and a SS58 address from the provided Secret URI")
|
||||||
|
.args_from_usage("<uri> 'A Key URI to be inspected. May be a secret seed, \
|
||||||
|
secret URI (with derivation paths and password), SS58 or public URI.'
|
||||||
|
"),
|
||||||
|
SubCommand::with_name("sign")
|
||||||
|
.about("Sign a message, provided on STDIN, with a given (secret) key")
|
||||||
|
.args_from_usage("
|
||||||
|
-h, --hex 'The message on STDIN is hex-encoded data'
|
||||||
|
<suri> 'The secret key URI.'
|
||||||
|
"),
|
||||||
|
SubCommand::with_name("sign-transaction")
|
||||||
|
.about("Sign transaction from encoded Call. Returns a signed and encoded \
|
||||||
|
UncheckedMortalCompactExtrinsic as hex.")
|
||||||
|
.args_from_usage("
|
||||||
|
-c, --call <call> 'The call, hex-encoded.'
|
||||||
|
-n, --nonce <nonce> 'The nonce.'
|
||||||
|
-p, --password <password> 'The password for the key.'
|
||||||
|
-h, --prior-block-hash <prior-block-hash> 'The prior block hash, hex-encoded.'
|
||||||
|
-s, --suri <suri> 'The secret key URI.'
|
||||||
|
"),
|
||||||
|
SubCommand::with_name("transfer")
|
||||||
|
.about("Author and sign a Node balances::Transfer transaction with a given (secret) key")
|
||||||
|
.args_from_usage("
|
||||||
|
<genesis> -g, --genesis <genesis> 'The genesis hash or a recognised \
|
||||||
|
chain identifier (dev, elm, alex).'
|
||||||
|
<from> 'The signing secret key URI.'
|
||||||
|
<to> 'The destination account public key URI.'
|
||||||
|
<amount> 'The number of units to transfer.'
|
||||||
|
<index> 'The signing account's transaction index.'
|
||||||
|
"),
|
||||||
|
SubCommand::with_name("vanity")
|
||||||
|
.about("Generate a seed that provides a vanity address")
|
||||||
|
.args_from_usage("
|
||||||
|
-n, --number <number> 'Number of keys to generate'
|
||||||
|
<pattern> 'Desired pattern'
|
||||||
|
"),
|
||||||
|
SubCommand::with_name("verify")
|
||||||
|
.about("Verify a signature for a message, provided on STDIN, with a given \
|
||||||
|
(public or secret) key")
|
||||||
|
.args_from_usage("
|
||||||
|
-h, --hex 'The message on STDIN is hex-encoded data'
|
||||||
|
<sig> 'Signature, hex-encoded.'
|
||||||
|
<uri> 'The public or secret key URI.'
|
||||||
|
"),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let matches = get_app().get_matches();
|
||||||
|
|
||||||
if matches.is_present("ed25519") {
|
if matches.is_present("ed25519") {
|
||||||
return execute::<Ed25519>(matches)
|
return execute::<Ed25519>(matches)
|
||||||
@@ -470,8 +535,7 @@ mod tests {
|
|||||||
SignatureOf<CryptoType>: SignatureT,
|
SignatureOf<CryptoType>: SignatureT,
|
||||||
PublicOf<CryptoType>: PublicT,
|
PublicOf<CryptoType>: PublicT,
|
||||||
{
|
{
|
||||||
let yaml = load_yaml!("cli.yml");
|
let app = get_app();
|
||||||
let app = App::from_yaml(yaml);
|
|
||||||
let password = None;
|
let password = None;
|
||||||
|
|
||||||
// Generate public key and seed.
|
// Generate public key and seed.
|
||||||
@@ -499,7 +563,7 @@ mod tests {
|
|||||||
// Verify the previous signature.
|
// Verify the previous signature.
|
||||||
let arg_vec = vec!["subkey", "verify", &signature[..], &public_key[..]];
|
let arg_vec = vec!["subkey", "verify", &signature[..], &public_key[..]];
|
||||||
|
|
||||||
let matches = App::from_yaml(yaml).get_matches_from(arg_vec);
|
let matches = get_app().get_matches_from(arg_vec);
|
||||||
let matches = matches.subcommand().1.unwrap();
|
let matches = matches.subcommand().1.unwrap();
|
||||||
assert!(do_verify::<CryptoType>(matches, message));
|
assert!(do_verify::<CryptoType>(matches, message));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user