Alphanet: script for reseting the chain data
This commit is contained in:
parent
891f2093ef
commit
d339ada6fb
@ -1,14 +1,55 @@
|
|||||||
#use "topfind";;
|
#use "topfind";;
|
||||||
|
#thread;;
|
||||||
|
#require "threads";;
|
||||||
#require "stringext";;
|
#require "stringext";;
|
||||||
#require "lwt";;
|
#require "lwt";;
|
||||||
|
#require "lwt.unix";;
|
||||||
#require "zarith";;
|
#require "zarith";;
|
||||||
#require "nocrypto";;
|
#require "nocrypto";;
|
||||||
#mod_use "../src/minutils/utils.ml";;
|
#require "calendar";;
|
||||||
#mod_use "../src/utils/base58.ml";;
|
#mod_use "../src/lib_stdlib/tzString.ml";;
|
||||||
let prefix = "BLockGenesisGenesisGenesisGenesisGenesis"
|
#mod_use "../src/lib_stdlib/option.ml";;
|
||||||
let suffix = "FFFFF"
|
#mod_use "../src/lib_stdlib/tzList.ml";;
|
||||||
let p = Base58.raw_decode (prefix ^ suffix ^ "crcCRC")
|
#mod_use "../src/lib_stdlib/utils.ml";;
|
||||||
let p = String.sub p 0 (String.length p - 4)
|
#mod_use "../src/lib_crypto/base58.ml";;
|
||||||
let p = Base58.safe_encode p
|
|
||||||
let () = print_endline p
|
|
||||||
|
|
||||||
|
let date =
|
||||||
|
Lwt_main.run (Lwt_process.pread_line (Lwt_process.shell "date +%FT%TZ --utc"))
|
||||||
|
|
||||||
|
let int_date =
|
||||||
|
Lwt_main.run (Lwt_process.pread_line (Lwt_process.shell "date +%y%m%d "))
|
||||||
|
|
||||||
|
let prefix = "BLockGenesisGenesisGenesisGenesisGenesis"
|
||||||
|
let suffix = String.sub Digest.(to_hex (string date)) 0 5
|
||||||
|
let p =
|
||||||
|
match Base58.raw_decode (prefix ^ suffix ^ "crcCRC") with
|
||||||
|
| None -> assert false
|
||||||
|
| Some s -> s
|
||||||
|
let p = String.sub p 0 (String.length p - 4)
|
||||||
|
let genesis = Base58.safe_encode p
|
||||||
|
|
||||||
|
let () =
|
||||||
|
Lwt_main.run (Lwt_io.lines_to_file "alphanet_version"
|
||||||
|
(Lwt_stream.of_list [date]))
|
||||||
|
|
||||||
|
let sed =
|
||||||
|
Format.sprintf
|
||||||
|
"sed -i \
|
||||||
|
-e 's/Time.of_notation_exn \"[^\\\"]*\"/Time.of_notation_exn \"%s\"/' \
|
||||||
|
-e 's/BLockGenesisGenesisGenesisGenesisGenesis.........../%s/' \
|
||||||
|
../src/bin_node/node_run_command.ml"
|
||||||
|
date
|
||||||
|
genesis
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
Lwt_main.run (Lwt_process.exec (Lwt_process.shell sed))
|
||||||
|
|
||||||
|
let sed =
|
||||||
|
Format.sprintf
|
||||||
|
"sed -i \
|
||||||
|
-e 's/minor = [0-9]* ;/minor = %s ;/' \
|
||||||
|
../src/lib_shell/distributed_db_message.ml"
|
||||||
|
int_date
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
Lwt_main.run (Lwt_process.exec (Lwt_process.shell sed))
|
||||||
|
23
scripts/reset_chain.sh
Executable file
23
scripts/reset_chain.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
cd "$script_dir"/..
|
||||||
|
|
||||||
|
branch=$1
|
||||||
|
has_git() {
|
||||||
|
which git && [ -d .git ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if has_git && ! [ -z "$(git status -s)" ] ; then
|
||||||
|
echo "This script cannot be applied within a dirty git directory,"
|
||||||
|
echo "you need 'stash' or 'commit' your changes before."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd scripts
|
||||||
|
|
||||||
|
utop gen_genesis.ml
|
||||||
|
|
||||||
|
git commit -a -m "Reset the chain"
|
Loading…
Reference in New Issue
Block a user