feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent 286de54384
commit 1c0e57d984
9084 changed files with 997839 additions and 997557 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env sh
# Script for building only the WASM binary of the given project.
set -e
PROJECT_ROOT=`git rev-parse --show-toplevel`
if [ "$#" -lt 1 ]; then
echo "You need to pass the name of the crate you want to compile!"
exit 1
fi
WASM_BUILDER_RUNNER="$PROJECT_ROOT/target/release/wbuild-runner/$1"
if [ -z "$2" ]; then
export WASM_TARGET_DIRECTORY=$(pwd)
else
export WASM_TARGET_DIRECTORY=$2
fi
if [ -d $WASM_BUILDER_RUNNER ]; then
export DEBUG=false
export OUT_DIR="$PROJECT_ROOT/target/release/build"
cargo run --release --manifest-path="$WASM_BUILDER_RUNNER/Cargo.toml" \
| grep -vE "cargo:rerun-if-|Executing build command"
else
cargo build --release -p $1
fi
+55
View File
@@ -0,0 +1,55 @@
<%
const capFirst = s => (s && s[0].toUpperCase() + s.slice(1)) || "";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= capFirst(repo_name) %> Rustdocs</title>
<meta name="description" content="Nothing here." />
<meta name="robots" content="noindex">
<style>
body {
font-family: Helvetica, Arial, Sans Serif;
margin: 0;
}
.center-me {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.content {
display: block;
}
.content li {
font-size: 1em;
line-height: .4em;
padding: .8em 0;
}
</style>
</head>
<body>
<div class="center-me">
<div class="content">
<h1><%= capFirst(repo_name) %> Rustdocs</h1>
<section>
<ul>
<%_ deploy_refs.split(/\s+/).forEach(ref => { _%>
<li>
<a href="/<%= repo_name _%>/<%= ref _%>"><%- ref -%></a>
<%_ if (latest && latest.trim() !== '' && latest === ref) { _%>
(<a href="/<%= repo_name _%>/latest">latest</a>)
<%_ } _%>
</li>
<%_ }) _%>
</ul>
</section>
</div>
</div>
</body>
</html>
@@ -0,0 +1,138 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{{header}}
//! Autogenerated weights for `{{pallet}}`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION {{version}}
//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}`
//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}`
//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}`
// Executed Command:
{{#each args as |arg|}}
// {{arg}}
{{/each}}
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
#![allow(dead_code)]
use frame::weights_prelude::*;
/// Weight functions needed for `{{pallet}}`.
pub trait WeightInfo {
{{#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{c.name}}: u32, {{/each~}}
) -> Weight;
{{/each}}
}
/// Weights for `{{pallet}}` using the Bizinikiwi node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
{{#if (or (eq pallet "frame_system") (eq pallet "frame_system_extensions"))}}
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
{{else}}
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{/if}}
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
// For backwards compatibility and tests.
impl WeightInfo for () {
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
@@ -0,0 +1,139 @@
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{{header}}
//! Autogenerated weights for `{{pallet}}`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION {{version}}
//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}`
//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}`
//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}`
// Executed Command:
{{#each args as |arg|}}
// {{arg}}
{{/each}}
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
#![allow(dead_code)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::marker::PhantomData;
/// Weight functions needed for `{{pallet}}`.
pub trait WeightInfo {
{{#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{c.name}}: u32, {{/each~}}
) -> Weight;
{{/each}}
}
/// Weights for `{{pallet}}` using the Bizinikiwi node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
{{#if (or (eq pallet "frame_system") (eq pallet "frame_system_extensions"))}}
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
{{else}}
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{/if}}
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
// For backwards compatibility and tests.
impl WeightInfo for () {
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
@@ -0,0 +1,153 @@
# Docker compose file to start a multi node local test network.
#
# # Nodes
#
# - Validator node A
# - Validator node B
# - Light client C
#
# # Auxiliary nodes
#
# - Prometheus monitoring each node.
# - Grafana pointed at the Prometheus node, configured with all dashboards.
#
# # Usage
#
# 1. Build `target/release/bizinikiwi` binary: `cargo build --release`
# 2. Start networks and containers:
# `sudo docker-compose -f .maintain/sentry-node/docker-compose.yml up`
# 3. Connect to nodes:
# - validator-a: localhost:9944
# - validator-b: localhost:9945
# - light-c: localhost:9946
# - via polkadot.js/apps: https://pezkuwichain.io/?rpc=ws%3A%2F%2Flocalhost%3A<NODE_PORT>#/explorer
# - grafana: localhost:3001
# - prometheus: localhost:9090
version: "3.7"
services:
validator-a:
ports:
- "9944:9944"
- "9615:9615"
volumes:
- ../../target/release/bizinikiwi:/usr/local/bin/bizinikiwi
image: pezkuwichain/bizinikiwi
networks:
- internet
command:
- "--node-key"
- "0000000000000000000000000000000000000000000000000000000000000001"
- "--base-path"
- "/tmp/alice"
- "--chain=local"
- "--port"
- "30333"
- "--validator"
- "--alice"
- "--bootnodes"
- "/dns/validator-b/tcp/30333/p2p/12D3KooWHdiAxVd8uMQR1hGWXccidmfCwLqcMpGwR6QcTP6QRMuD"
# Not only bind to localhost.
- "--unsafe-ws-external"
- "--unsafe-rpc-external"
- "--log"
- "sub-libp2p=trace"
- "--no-telemetry"
- "--rpc-cors"
- "all"
- "--prometheus-external"
validator-b:
image: pezkuwichain/bizinikiwi
ports:
- "9945:9944"
volumes:
- ../../target/release/bizinikiwi:/usr/local/bin/bizinikiwi
networks:
- internet
command:
- "--node-key"
- "0000000000000000000000000000000000000000000000000000000000000002"
- "--base-path"
- "/tmp/bob"
- "--chain=local"
- "--port"
- "30333"
- "--validator"
- "--bob"
- "--bootnodes"
- "/dns/validator-a/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--no-telemetry"
- "--rpc-cors"
- "all"
# Not only bind to localhost.
- "--unsafe-ws-external"
- "--unsafe-rpc-external"
- "--log"
- "sub-libp2p=trace"
- "--prometheus-external"
light-c:
image: pezkuwichain/bizinikiwi
ports:
- "9946:9944"
volumes:
- ../../target/release/bizinikiwi:/usr/local/bin/bizinikiwi
networks:
- internet
command:
- "--node-key"
- "0000000000000000000000000000000000000000000000000000000000000003"
- "--base-path"
- "/tmp/light"
- "--chain=local"
- "--port"
- "30333"
- "--light"
- "--bootnodes"
- "/dns/validator-a/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"
- "--bootnodes"
- "/dns/validator-b/tcp/30333/p2p/12D3KooWHdiAxVd8uMQR1hGWXccidmfCwLqcMpGwR6QcTP6QRMuD"
- "--no-telemetry"
- "--rpc-cors"
- "all"
# Not only bind to localhost.
- "--unsafe-ws-external"
- "--unsafe-rpc-external"
- "--log"
- "sub-libp2p=trace"
- "--prometheus-external"
prometheus:
image: prom/prometheus
networks:
- internet
ports:
- "9090:9090"
links:
- validator-a:validator-a
- validator-b:validator-b
- light-c:light-c
volumes:
- ./prometheus/:/etc/prometheus/
restart: always
grafana:
image: grafana/grafana
user: "104"
depends_on:
- prometheus
networks:
- internet
ports:
- 3001:3000
volumes:
- ./grafana/provisioning/:/etc/grafana/provisioning
- ../monitoring/grafana-dashboards/:/etc/grafana/provisioning/dashboard-definitions
restart: always
networks:
network-a:
internet:
@@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: 'Prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: false
options:
path: /etc/grafana/provisioning/dashboard-definitions
@@ -0,0 +1,50 @@
# config file version
apiVersion: 1
# list of datasources that should be deleted from the database
deleteDatasources:
- name: Prometheus
orgId: 1
# list of datasources to insert/update depending
# whats available in the database
datasources:
# <string, required> name of the datasource. Required
- name: Prometheus
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. direct or proxy. Required
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://prometheus:9090
# <string> database password, if used
password:
# <string> database user, if used
user:
# <string> database name, if used
database:
# <bool> enable/disable basic auth
basicAuth: false
# <string> basic auth username, if used
basicAuthUser:
# <string> basic auth password, if used
basicAuthPassword:
# <bool> enable/disable with credentials headers
withCredentials:
# <bool> mark as default datasource. Max one per org
isDefault: true
# <map> fields that will be converted to json and stored in json_data
jsonData:
graphiteVersion: "1.1"
tlsAuth: false
tlsAuthWithCACert: false
# <string> json object of data that will be encrypted.
secureJsonData:
tlsCACert: "..."
tlsClientCert: "..."
tlsClientKey: "..."
version: 1
# <bool> allow users to edit datasources from the UI.
editable: true
@@ -0,0 +1,15 @@
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'bizinikiwi-nodes'
static_configs:
- targets: ['validator-a:9615']
labels:
network: dev
- targets: ['validator-b:9615']
labels:
network: dev
- targets: ['light-c:9615']
labels:
network: dev
+126
View File
@@ -0,0 +1,126 @@
#!/usr/bin/env 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
# post initial rename fixes
"sc-application-crypto sp-application-crypto"
"sp-transaction-pool-api sp-transaction-pool"
"sp-transaction-pool-runtime-api sp-transaction-pool"
"sp-core-storage sp-storage"
"transaction-factory node-transaction-factory"
"sp-finality-granpda sp-finality-grandpa"
"sp-sesssion sp-session"
"sp-tracing-pool sp-transaction-pool"
"sc-basic-authority sc-basic-authorship"
"sc-api sc-client-api"
"sc-database sc-client-db"
# PRIMITIVES
"bizinikiwi-application-crypto sp-application-crypto"
"bizinikiwi-authority-discovery-primitives sp-authority-discovery"
"bizinikiwi-block-builder-runtime-api sp-block-builder"
"bizinikiwi-consensus-aura-primitives sp-consensus-aura"
"bizinikiwi-consensus-babe-primitives sp-consensus-babe"
"bizinikiwi-consensus-common sp-consensus"
"bizinikiwi-consensus-pow-primitives sp-consensus-pow"
"bizinikiwi-primitives sp-core"
"bizinikiwi-debug-derive sp-debug-derive"
"bizinikiwi-primitives-storage sp-storage"
"bizinikiwi-externalities sp-externalities"
"bizinikiwi-finality-grandpa-primitives sp-finality-grandpa"
"bizinikiwi-inherents sp-inherents"
"bizinikiwi-keyring sp-keyring"
"bizinikiwi-offchain-primitives sp-offchain"
"bizinikiwi-panic-handler sp-panic-handler"
"bizinikiwi-phragmen sp-npos-elections"
"bizinikiwi-rpc-primitives sp-rpc"
"bizinikiwi-runtime-interface sp-runtime-interface"
"bizinikiwi-runtime-interface-proc-macro sp-runtime-interface-proc-macro"
"bizinikiwi-runtime-interface-test-wasm sp-runtime-interface-test-wasm"
"bizinikiwi-serializer sp-serializer"
"bizinikiwi-session sp-session"
"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"
"bizinikiwi-state-machine sp-state-machine"
"bizinikiwi-transaction-pool-runtime-api sp-transaction-pool"
"bizinikiwi-trie sp-trie"
"bizinikiwi-wasm-interface sp-wasm-interface"
# # CLIENT
"bizinikiwi-client sc-client"
"bizinikiwi-client-api sc-client-api"
"bizinikiwi-authority-discovery sc-authority-discovery"
"bizinikiwi-basic-authorship sc-basic-authorship"
"bizinikiwi-block-builder sc-block-builder"
"bizinikiwi-chain-spec sc-chain-spec"
"bizinikiwi-chain-spec-derive sc-chain-spec-derive"
"bizinikiwi-cli sc-cli"
"bizinikiwi-consensus-aura sc-consensus-aura"
"bizinikiwi-consensus-babe sc-consensus-babe"
"bizinikiwi-consensus-pow sc-consensus-pow"
"bizinikiwi-consensus-slots sc-consensus-slots"
"bizinikiwi-consensus-uncles sc-consensus-uncles"
"bizinikiwi-client-db sc-client-db"
"bizinikiwi-executor sc-executor"
"bizinikiwi-runtime-test sc-runtime-test"
"bizinikiwi-finality-grandpa sc-finality-grandpa"
"bizinikiwi-keystore sc-keystore"
"bizinikiwi-network sc-network"
"bizinikiwi-offchain sc-offchain"
"bizinikiwi-peerset sc-peerset"
"bizinikiwi-rpc-servers sc-rpc-server"
"bizinikiwi-rpc sc-rpc"
"bizinikiwi-service sc-service"
"bizinikiwi-service-test sc-service-test"
"bizinikiwi-state-db sc-state-db"
"bizinikiwi-telemetry sc-telemetry"
"bizinikiwi-test-primitives sp-test-primitives"
"bizinikiwi-tracing sc-tracing"
);
for rule in "${TO_RENAME[@]}"
do
rename "$rule";
done
+245
View File
@@ -0,0 +1,245 @@
#!/usr/bin/env bash
# set -x
# This script used to manage the deployment of Bizinikiwi rustdocs to https://paritytech.github.io/bizinikiwi/.
# It is no longer used anywhere, and only here for historical/demonstration purposes.
# - With `deploy` sub-command, it will checkout the passed-in branch/tag ref, build the rustdocs
# locally (this takes some time), update the `index.html` index page, and push it to remote
# `gh-pages` branch. So users running this command need to have write access to the remote
# `gh-pages` branch. This sub-command depends on [@bizinikiwi/index-tpl-crud](https://www.npmjs.com/package/@bizinikiwi/index-tpl-crud)
# to update the DOM of index.html page.
# - With `remove` sub-command, it will remove the deployed rustdocs from `gh-pages`, and update the
# index.html page as necessary. It may remove the `latest` symbolic link.
#
# Examples:
# # Showing help text
# rustdocs-release.sh -h
#
# # Deploy rustdocs of `monthly-2021-10` tag
# rustdocs-release.sh deploy monthly-2021-10
#
# # In addition to the above, the `latest` symlink will point to this version of rustdocs
# rustdocs-release.sh deploy -l monthly-2021-10
#
# # Remove the rustdocs of `monthly-2021-10` from `gh-pages`.
# rustdocs-release.sh remove monthly-2021-10
#
# Dependencies:
# - @bizinikiwi/index-tpl-crud - https://www.npmjs.com/package/@bizinikiwi/index-tpl-crud
#
# Script setting
# The git repo http URL
REMOTE_REPO="https://github.com/paritytech/bizinikiwi.git"
TMP_PREFIX="/tmp" # tmp location that the built doc is copied to.
DOC_INDEX_PAGE="sc_service/index.html"
# Set to `true` if using cargo `nightly` toolchain to build the doc.
# Set to `false` to use the default cargo toolchain. This is preferred if you want to build
# the rustdocs with a pinned nightly version set to your default toolchain.
CARGO_NIGHTLY=false
# Set the git remote name. Most of the time the default is `origin`.
GIT_REMOTE="origin"
LATEST=false
# Setting the help text
declare -A HELP_TXT
HELP_TXT["deploy"]=$(cat <<-EOH
Build and deploy the rustdocs of the specified branch/tag to \`gh-pages\` branch.
usage: $0 deploy [-l] <git_branch_ref>
example: $0 deploy -l monthly-2021-10
options:
-l The \`latest\` path will be sym'linked to this rustdocs version
EOH
)
HELP_TXT["remove"]=$(cat <<-EOH
Remove the rustdocs of the specified version from \`gh-pages\` branch.
usage: $0 remove <git_branch_ref>
example: $0 remove monthly-2021-10
EOH
)
set_and_check_rustdoc_ref() {
[[ -z "$1" ]] && {
echo -e "git branch_ref is not specified.\n"
echo "${HELP_TXT[$2]}"
exit 1
}
BUILD_RUSTDOC_REF=$1
}
check_local_change() {
# Check there is no local changes before proceeding
[[ -n $(git status --porcelain) ]] \
&& echo "Local changes exist, please either discard or commit them as this command will change the current checkout branch." \
&& exit 1
}
build_rustdocs() {
# Build the docs
time cargo $($CARGO_NIGHTLY && echo "+nightly") doc --workspace --all-features --verbose \
|| { echo "Generate $1 rustdocs failed" && exit 1; }
rm -f target/doc/.lock
# Moving the built doc to the tmp location
mv target/doc "${2}"
[[ -n "${DOC_INDEX_PAGE}" ]] \
&& echo "<meta http-equiv=refresh content=0;url=${DOC_INDEX_PAGE}>" > "${2}/index.html"
}
upsert_index_page() {
# Check if `index-tpl-crud` exists
which index-tpl-crud &> /dev/null || yarn global add @bizinikiwi/index-tpl-crud
index-tpl-crud upsert $($1 && echo "-l") ./index.html "$2"
}
rm_index_page() {
which index-tpl-crud &> /dev/null || yarn global add @bizinikiwi/index-tpl-crud
index-tpl-crud rm ./index.html "$1"
}
git_add_commit_push() {
git add --all
git commit -m "$1" || echo "Nothing to commit"
git push "${GIT_REMOTE}" gh-pages --force
}
import_gh_key() {
[[ -n $GITHUB_SSH_PRIV_KEY ]] && {
eval $(ssh-agent)
ssh-add - <<< $GITHUB_SSH_PRIV_KEY
}
# Adding github.com as known_hosts
ssh-keygen -F github.com &>/dev/null || {
[[ -e ~/.ssh ]] || mkdir ~/.ssh
[[ -e ~/.ssh/known_hosts ]] || touch ~/.ssh/known_hosts
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
}
}
deploy_main() {
check_local_change
import_gh_key
CURRENT_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
TMP_PROJECT_PATH="${TMP_PREFIX}/${PROJECT_NAME}"
DOC_PATH="${TMP_PROJECT_PATH}/${BUILD_RUSTDOC_REF}"
# Build the tmp project path
rm -rf "${TMP_PROJECT_PATH}" && mkdir "${TMP_PROJECT_PATH}"
# Copy .gitignore file to tmp
[[ -e "${PROJECT_PATH}/.gitignore" ]] && cp "${PROJECT_PATH}/.gitignore" "${TMP_PROJECT_PATH}"
git fetch --all
git checkout -f ${BUILD_RUSTDOC_REF} || { echo "Checkout \`${BUILD_RUSTDOC_REF}\` error." && exit 1; }
build_rustdocs "${BUILD_RUSTDOC_REF}" "${DOC_PATH}"
# git checkout `gh-pages` branch
git fetch "${GIT_REMOTE}" gh-pages
git checkout gh-pages
# Move the built back
[[ -e "${TMP_PROJECT_PATH}/.gitignore" ]] && cp -f "${TMP_PROJECT_PATH}/.gitignore" .
# Ensure the destination dir doesn't exist under current path.
rm -rf "${BUILD_RUSTDOC_REF}"
mv -f "${DOC_PATH}" "${BUILD_RUSTDOC_REF}"
upsert_index_page $LATEST "${BUILD_RUSTDOC_REF}"
# Add the latest symlink
$LATEST && rm -rf latest && ln -sf "${BUILD_RUSTDOC_REF}" latest
git_add_commit_push "___Deployed rustdocs of ${BUILD_RUSTDOC_REF}___"
# Clean up
# Remove the tmp asset created
rm -rf "${TMP_PROJECT_PATH}"
# Resume back previous checkout branch.
git checkout -f "$CURRENT_GIT_BRANCH"
}
remove_main() {
check_local_change
import_gh_key
CURRENT_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# git checkout `gh-pages` branch
git fetch "${GIT_REMOTE}" gh-pages
git checkout gh-pages
rm -rf "${BUILD_RUSTDOC_REF}"
rm_index_page "${BUILD_RUSTDOC_REF}"
# check if the destination of `latest` exists and rmove if not.
[[ -e "latest" ]] || rm latest
git_add_commit_push "___Removed rustdocs of ${BUILD_RUSTDOC_REF}___"
# Resume back previous checkout branch.
git checkout -f "$CURRENT_GIT_BRANCH"
}
# ---- The script execution entry point starts here ----
# Arguments handling
SUBCMD=$1
[[ $SUBCMD == "deploy" || $SUBCMD == "remove" ]] \
|| { echo "Please specify a subcommand of \`deploy\` or \`remove\`" && exit 1 ;}
shift
# After removing the subcommand, there could only be 1 or 2 parameters afterward
[[ $# -lt 1 || $# -gt 2 ]] && {
echo "${HELP_TXT[${SUBCMD}]}"
exit 1
}
# Parsing options and argument for `deploy` subcommand
[[ $SUBCMD == "deploy" ]] && {
while getopts :lh opt; do
case $opt in
l)
LATEST=true
;;
h)
echo "${HELP_TXT[$SUBCMD]}"
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
}
# Parsing options and argument for `remove` subcommand
[[ $SUBCMD == "remove" ]] && {
while getopts :h opt; do
case $opt in
h)
echo "${HELP_TXT[$SUBCMD]}"
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
}
shift $(($OPTIND - 1))
set_and_check_rustdoc_ref ${1:-''} $SUBCMD
SCRIPT=$(realpath $0)
SCRIPT_PATH=$(dirname $SCRIPT)
PROJECT_PATH=$(dirname ${SCRIPT_PATH})
PROJECT_NAME=$(basename "$PROJECT_PATH")
pushd "${PROJECT_PATH}" &>/dev/null
[[ $SUBCMD == "deploy" ]] && deploy_main
[[ $SUBCMD == "remove" ]] && remove_main
popd &>/dev/null