Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into td-signed-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw committed Dec 2, 2019
2 parents f8c9540 + d8d5da2 commit f85b890
Show file tree
Hide file tree
Showing 584 changed files with 12,980 additions and 9,144 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
**/*.rs.bk
*.swp
.wasm-binaries
polkadot/runtime/wasm/target/
core/executor/wasm/target/
core/test-runtime/wasm/target/
pwasm-alloc/target/
pwasm-libc/target/
pwasm-alloc/Cargo.lock
pwasm-libc/Cargo.lock
node/runtime/wasm/target/
bin/node/runtime/wasm/target/
**/._*
**/.criterion/
.vscode
Expand Down
19 changes: 9 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ test-linux-stable: &test-linux
test-dependency-rules: &test-linux
stage: test
<<: *docker-env
allow_failure: true
except:
variables:
- $DEPLOY_TAG
Expand Down Expand Up @@ -219,14 +218,14 @@ check-web-wasm:
script:
# WASM support is in progress. As more and more crates support WASM, we
# should add entries here. See https://github.com/paritytech/substrate/issues/2416
- time cargo build --target=wasm32-unknown-unknown -p sr-io
- time cargo build --target=wasm32-unknown-unknown -p sr-primitives
- time cargo build --target=wasm32-unknown-unknown -p sr-std
- time cargo build --target=wasm32-unknown-unknown -p substrate-client
- time cargo build --target=wasm32-unknown-unknown -p substrate-consensus-aura
- time cargo build --target=wasm32-unknown-unknown -p substrate-consensus-babe
- time cargo build --target=wasm32-unknown-unknown -p substrate-consensus-common
- time cargo build --target=wasm32-unknown-unknown -p substrate-telemetry
- time cargo build --target=wasm32-unknown-unknown -p sp-io
- time cargo build --target=wasm32-unknown-unknown -p sp-runtime
- time cargo build --target=wasm32-unknown-unknown -p sp-std
- time cargo build --target=wasm32-unknown-unknown -p sc-client
- time cargo build --target=wasm32-unknown-unknown -p sc-consensus-aura
- time cargo build --target=wasm32-unknown-unknown -p sc-consensus-babe
- time cargo build --target=wasm32-unknown-unknown -p sp-consensus
- time cargo build --target=wasm32-unknown-unknown -p sc-telemetry
# Note: the command below is a bit weird because several Cargo issues prevent us from compiling the node in a more straight-forward way.
- time cargo build --manifest-path=bin/node/cli/Cargo.toml --no-default-features --features "browser" --target=wasm32-unknown-unknown
- sccache -s
Expand Down Expand Up @@ -370,7 +369,7 @@ check_polkadot:
- git grep -l "polkadot-master" | grep toml | xargs sed -i "s/branch.*=.*\"polkadot-master\"/rev = \"$COMMIT_HASH\"/; s~https://github.com/paritytech/substrate~file://$SUBSTRATE_PATH~; s/,\s*}/ }/"
# Make sure 'Cargo.lock' matches 'Cargo.toml'. It's enough to update one
# package, others are updated along the way.
- cargo update -p sr-io
- cargo update -p sp-io
# Check whether Polkadot 'master' branch builds with this Substrate commit.
- time cargo check
- cd -
Expand Down
21 changes: 0 additions & 21 deletions .maintain/common.sh

This file was deleted.

49 changes: 34 additions & 15 deletions .maintain/ensure-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,62 @@
# The script is meant to check if the rules regarding packages
# dependencies are satisfied.
# The general format is:
# [top-lvl-dir]<[crate-name-prefix]
# [top-lvl-dir] MESSAGE/[other-top-dir]

# For instance no crate within `./client` directory
# is allowed to import any crate with a directory path containing `frame`.
# Such rule is just: `client<frame`.
# Such rule is just: `client crates must not depend on anything in /frame`.

# The script should be run from the main repo directory!

set -u

# HARD FAILING
MUST_NOT=(
"client crates must not depend on anything in /frame"
"client crates must not depend on anything in /node"
"frame crates must not depend on anything in /node"
"frame crates must not depend on anything in /client"
"primitives crates must not depend on anything in /frame"
)

# ONLY DISPLAYED, script still succeeds
PLEASE_DONT=(
"client<frame"
"client<node"
"frame<node"
"frame<client"
"primitives<frame"
"primitives<client"
"primitives crates should not depend on anything in /client"
)

VIOLATIONS=()
PACKAGES=()

for rule in "${PLEASE_DONT[@]}"
do
from=$(echo $rule | cut -f1 -d\<)
to=$(echo $rule | cut -f2 -d\<)
function check_rule() {
rule=$1
from=$(echo $rule | cut -f1 -d\ )
to=$(echo $rule | cut -f2 -d\/)

cd $from
echo "Checking rule $rule"
packages=$(find -name Cargo.toml | xargs grep -wn "path.*$to")
echo "Checking rule '$rule'"
packages=$(find -name Cargo.toml | xargs grep -wn "path.*\.\.\/$to")
has_references=$(echo -n $packages | wc -c)
if [ "$has_references" != "0" ]; then
VIOLATIONS+=("$rule")
# Find packages that violate:
PACKAGES+=("$packages")
fi
cd - > /dev/null
}

for rule in "${MUST_NOT[@]}"
do
check_rule "$rule";
done

# Only the MUST NOT will be counted towards failure
HARD_VIOLATIONS=${#VIOLATIONS[@]}


for rule in "${PLEASE_DONT[@]}"
do
check_rule "$rule";
done

# Display violations and fail
Expand All @@ -58,4 +77,4 @@ EOF
I=$I+1
done

exit ${#VIOLATIONS[@]}
exit $HARD_VIOLATIONS
112 changes: 112 additions & 0 deletions .maintain/rename-crates-for-2.0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash

function rust_rename() {
sed -i "s/$1/$2/g" `grep -Rl --include="*.rs" --include="*.stderr" "$1" *` > /dev/null
}

function cargo_rename() {
find . -name "Cargo.toml" -exec sed -i "s/\(^\|[^\/]\)$1/\1$2/g" {} \;
}

function rename_gitlabci() {
sed -i "s/$1/$2/g" .gitlab-ci.yml
}

function rename() {
old=$(echo $1 | cut -f1 -d\ );
new=$(echo $1 | cut -f2 -d\ );

echo "Renaming $old to $new"
# rename in Cargo.tomls
cargo_rename $old $new
rename_gitlabci $old $new
# and it appears, we have the same syntax in rust files
rust_rename $old $new

# but generally we have the snail case syntax in rust files
old=$(echo $old | sed s/-/_/g );
new=$(echo $new | sed s/-/_/g );

echo " > $old to $new"
rust_rename $old $new
}

TO_RENAME=(
# OLD-CRATE-NAME NEW-CRATE-NAME

# PRIMITIVES
"substrate-application-crypto sc-application-crypto"
"substrate-authority-discovery-primitives sp-authority-discovery"
"substrate-block-builder-runtime-api sp-block-builder"
"substrate-consensus-aura-primitives sp-consensus-aura"
"substrate-consensus-babe-primitives sp-consensus-babe"
"substrate-consensus-common sp-consensus"
"substrate-consensus-pow-primitives sp-consensus-pow"
"substrate-primitives sp-core"
"substrate-debug-derive sp-debug-derive"
"substrate-primitives-storage sp-storage"
"substrate-externalities sp-externalities"
"substrate-finality-grandpa-primitives sp-finality-granpda"
"substrate-inherents sp-inherents"
"substrate-keyring sp-keyring"
"substrate-offchain-primitives sp-offchain"
"substrate-panic-handler sp-panic-handler"
"substrate-phragmen sp-phragmen"
"substrate-rpc-primitives sp-rpc"
"substrate-runtime-interface sp-runtime-interface"
"substrate-runtime-interface-proc-macro sp-runtime-interface-proc-macro"
"substrate-runtime-interface-test-wasm sp-runtime-interface-test-wasm"
"substrate-serializer sp-serializer"
"substrate-session sp-sesssion"
"sr-api sp-api"
"sr-api-proc-macro sp-api-proc-macro"
"sr-api-test sp-api-test"
"sr-arithmetic sp-arithmetic"
"sr-arithmetic-fuzzer sp-arithmetic-fuzzer"
"sr-io sp-io"
"sr-primitives sp-runtime"
"sr-sandbox sp-sandbox"
"sr-staking-primitives sp-staking"
"sr-std sp-std"
"sr-version sp-version"
"substrate-state-machine sp-state-machine"
"substrate-transaction-pool-runtime-api sp-transaction-pool"
"substrate-trie sp-trie"
"substrate-wasm-interface sp-wasm-interface"

# # CLIENT
"substrate-client sc-client"
"substrate-client-api sc-api"
"substrate-authority-discovery sc-authority-discovery"
"substrate-basic-authorship sc-basic-authority"
"substrate-block-builder sc-block-builder"
"substrate-chain-spec sc-chain-spec"
"substrate-chain-spec-derive sc-chain-spec-derive"
"substrate-cli sc-cli"
"substrate-consensus-aura sc-consensus-aura"
"substrate-consensus-babe sc-consensus-babe"
"substrate-consensus-pow sc-consensus-pow"
"substrate-consensus-slots sc-consensus-slots"
"substrate-consensus-uncles sc-consensus-uncles"
"substrate-client-db sc-database"
"substrate-executor sc-executor"
"substrate-runtime-test sc-runtime-test"
"substrate-finality-grandpa sc-finality-grandpa"
"substrate-keystore sc-keystore"
"substrate-network sc-network"
"substrate-offchain sc-offchain"
"substrate-peerset sc-peerset"
"substrate-rpc-servers sc-rpc-server"
"substrate-rpc sc-rpc"
"substrate-service sc-service"
"substrate-service-test sc-service-test"
"substrate-state-db sc-state-db"
"substrate-telemetry sc-telemetry"
"substrate-tracing sc-tracing"

);

for rule in "${TO_RENAME[@]}"
do
rename "$rule";
done
29 changes: 0 additions & 29 deletions .maintain/update.sh

This file was deleted.

Loading

0 comments on commit f85b890

Please sign in to comment.