update keytype ID prefix to 'wevr' for validator consistency
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
d43c616749
commit
4842fc5108
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -4114,7 +4114,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ghost-weaver"
|
name = "ghost-weaver"
|
||||||
version = "0.0.24"
|
version = "0.0.25"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"frame-benchmarking",
|
"frame-benchmarking",
|
||||||
"frame-support",
|
"frame-support",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ghost-weaver"
|
name = "ghost-weaver"
|
||||||
version = "0.0.24"
|
version = "0.0.25"
|
||||||
description = "Weaving a secure cryptographic tapestry across different external chains."
|
description = "Weaving a secure cryptographic tapestry across different external chains."
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|||||||
@ -66,7 +66,7 @@ pub use pallet::*;
|
|||||||
pub mod sr25519 {
|
pub mod sr25519 {
|
||||||
mod app_sr25519 {
|
mod app_sr25519 {
|
||||||
use sp_application_crypto::{app_crypto, sr25519, KeyTypeId};
|
use sp_application_crypto::{app_crypto, sr25519, KeyTypeId};
|
||||||
const WEAVER: KeyTypeId = KeyTypeId(*b"weav");
|
const WEAVER: KeyTypeId = KeyTypeId(*b"wevr");
|
||||||
app_crypto!(sr25519, WEAVER);
|
app_crypto!(sr25519, WEAVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -284,7 +284,7 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
sp_io::crypto::sr25519_generate(
|
sp_io::crypto::sr25519_generate(
|
||||||
sp_core::crypto::KeyTypeId(*b"weav"),
|
sp_core::crypto::KeyTypeId(*b"wevr"),
|
||||||
Some(b"//Alice".to_vec()),
|
Some(b"//Alice".to_vec()),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -465,7 +465,7 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
sp_io::crypto::sr25519_generate(
|
sp_io::crypto::sr25519_generate(
|
||||||
sp_core::crypto::KeyTypeId(*b"weav"),
|
sp_core::crypto::KeyTypeId(*b"wevr"),
|
||||||
Some(b"//Alice".to_vec()),
|
Some(b"//Alice".to_vec()),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9,6 +9,7 @@ UNIT_FILE=false
|
|||||||
SKIP_BUILD=false
|
SKIP_BUILD=false
|
||||||
SET_ENVIRONMENT=false
|
SET_ENVIRONMENT=false
|
||||||
VALIDATE=false
|
VALIDATE=false
|
||||||
|
FIX_WEAVER_KEYSTORE=false
|
||||||
EXECUTABLE_PATH="/usr/bin/"
|
EXECUTABLE_PATH="/usr/bin/"
|
||||||
SPECIFICATION_PATH="/etc/ghost/"
|
SPECIFICATION_PATH="/etc/ghost/"
|
||||||
BASE_PATH="/var/lib/ghost"
|
BASE_PATH="/var/lib/ghost"
|
||||||
@ -120,7 +121,8 @@ help() {
|
|||||||
echo -e "-s, --base-path\n\tPath to the folder with chain database ('/var/lib/ghost' is default)."
|
echo -e "-s, --base-path\n\tPath to the folder with chain database ('/var/lib/ghost' is default)."
|
||||||
echo -e "-c, --specification-path\n\tPath to specification ('/etc/ghost' is default)."
|
echo -e "-c, --specification-path\n\tPath to specification ('/etc/ghost' is default)."
|
||||||
echo -e "-n, --specification-name\n\tSpecification name to be used ('casper' is default)."
|
echo -e "-n, --specification-name\n\tSpecification name to be used ('casper' is default)."
|
||||||
echo -e "-g, --generate-genesis\n\tGenerate keys to participate in the genesis file."
|
echo -e "--generate-genesis\n\tGenerate keys to participate in the genesis file."
|
||||||
|
echo -e "--fix-weaver-keystore\n\tFix keystore prefixes (weav -> wevr) to ensure the offchain worker can find the key."
|
||||||
echo -e "--hard-reset-i-know-what-im-doing\n\tWill completely remove ledger along with associated session keys."
|
echo -e "--hard-reset-i-know-what-im-doing\n\tWill completely remove ledger along with associated session keys."
|
||||||
echo -e "-h, --help\n\tPrints help information."
|
echo -e "-h, --help\n\tPrints help information."
|
||||||
}
|
}
|
||||||
@ -192,9 +194,12 @@ while [ $# -gt 0 ]; do
|
|||||||
--hard-reset-i-know-what-im-doing)
|
--hard-reset-i-know-what-im-doing)
|
||||||
HARD_RESET=true
|
HARD_RESET=true
|
||||||
;;
|
;;
|
||||||
--generate-genesis|-g)
|
--generate-genesis)
|
||||||
GENERATE_GENESIS=true
|
GENERATE_GENESIS=true
|
||||||
;;
|
;;
|
||||||
|
--check-keys)
|
||||||
|
FIX_WEAVER_KEYSTORE=true
|
||||||
|
;;
|
||||||
--help|-h)
|
--help|-h)
|
||||||
help
|
help
|
||||||
exit 0
|
exit 0
|
||||||
@ -528,6 +533,51 @@ if [ $UNIT_FILE = true ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $FIX_WEAVER_KEYSTORE = true ]; then
|
||||||
|
echo "[+] Starting keystore prefix fix (weav -> wevr)..."
|
||||||
|
|
||||||
|
KEYSTORE_DIR="${BASE_PATH%/}/chains/${SPECIFICATION_NAME}_staging_testnet/keystore"
|
||||||
|
|
||||||
|
echo "[+] Requesting sudo privileges to modify keystore files..."
|
||||||
|
sudo -v
|
||||||
|
|
||||||
|
if ! sudo test -d "$KEYSTORE_DIR"; then
|
||||||
|
echo "[-] Keystore directory not found at: $KEYSTORE_DIR"
|
||||||
|
echo "[-] Please check your --base-path and --specification-name settings."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WRONG_PREFIX="77656176" # "weav"
|
||||||
|
CORRECT_PREFIX="77657672" # "wevr"
|
||||||
|
CHANGES_MADE=0
|
||||||
|
|
||||||
|
while IFS= read -r file; do
|
||||||
|
if sudo test -f "$file"; then
|
||||||
|
filename=$(basename "$file")
|
||||||
|
if [[ "$filename" == "$WRONG_PREFIX"* ]]; then
|
||||||
|
new_filename="${CORRECT_PREFIX}${filename#$WRONG_PREFIX}"
|
||||||
|
new_file_path="$KEYSTORE_DIR/$new_filename"
|
||||||
|
|
||||||
|
if sudo test -f "$new_file_path"; then
|
||||||
|
echo "[!] WARNING: File with correct prefix already exists: $new_filename. Skipping."
|
||||||
|
else
|
||||||
|
sudo mv "$file" "$new_file_path"
|
||||||
|
echo "[+] Renamed: $filename -> $new_filename"
|
||||||
|
CHANGES_MADE=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < <(sudo find "$KEYSTORE_DIR" -maxdepth 1 -type f)
|
||||||
|
|
||||||
|
if [ $CHANGES_MADE -eq 1 ]; then
|
||||||
|
echo "[+] Keystore fix applied successfully."
|
||||||
|
echo "[+] IMPORTANT: You must restart the ghost-node service for changes to take effect."
|
||||||
|
echo "[+] Run: sudo systemctl restart ghost-node"
|
||||||
|
else
|
||||||
|
echo "[+] No files with the wrong 'weav' prefix were found. Everything is fine."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$GENERATE_GENESIS" = true ]; then
|
if [ "$GENERATE_GENESIS" = true ]; then
|
||||||
echo "[+] Generating keys for genesis configuration..."
|
echo "[+] Generating keys for genesis configuration..."
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user