Minor improvement in the docker image.
This commit is contained in:
parent
b861d45b14
commit
c316dc00a8
100
.gitlab-ci.yml
100
.gitlab-ci.yml
@ -9,6 +9,7 @@ stages:
|
||||
- test
|
||||
- build_docker
|
||||
- publish
|
||||
- deploy
|
||||
- cleanup
|
||||
|
||||
build_deps:
|
||||
@ -156,13 +157,39 @@ build:docker:
|
||||
tags:
|
||||
- public_docker_builder
|
||||
script:
|
||||
- ./scripts/create_docker_image.sh "${CI_REGISTRY_IMAGE}" "${CI_BUILD_REF}" .
|
||||
- ./scripts/create_docker_image.sh
|
||||
"${CI_REGISTRY_IMAGE}" "${CI_BUILD_REF}" .
|
||||
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "${CI_REGISTRY}"
|
||||
- docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}"
|
||||
"${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
|
||||
- docker push "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
|
||||
- docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
|
||||
|
||||
build:docker:alphanet:
|
||||
stage: build_docker
|
||||
image: docker:latest
|
||||
tags:
|
||||
- public_docker_builder
|
||||
only:
|
||||
- alphanet@tezos/tezos
|
||||
script:
|
||||
- patch -p1 < scripts/alphanet_constants.patch
|
||||
- ./scripts/create_docker_image.sh
|
||||
"${CI_REGISTRY_IMAGE}" "${CI_BUILD_REF}.patched" .
|
||||
|
||||
build:docker:alphanet_next:
|
||||
stage: build_docker
|
||||
image: docker:latest
|
||||
tags:
|
||||
- public_docker_builder
|
||||
only:
|
||||
- master@tezos/tezos
|
||||
script:
|
||||
- patch -p1 < scripts/alphanet_constants.patch
|
||||
- patch -p1 < scripts/alphanet_next.patch
|
||||
- ./scripts/create_docker_image.sh
|
||||
"${CI_REGISTRY_IMAGE}" "${CI_BUILD_REF}.patched" .
|
||||
|
||||
publish:docker:
|
||||
stage: publish
|
||||
image: docker:latest
|
||||
@ -170,7 +197,6 @@ publish:docker:
|
||||
- public_docker_builder
|
||||
only:
|
||||
- master@tezos/tezos
|
||||
- alphanet@tezos/tezos
|
||||
script:
|
||||
- mkdir -p ~/.docker ;
|
||||
- echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ;
|
||||
@ -179,6 +205,39 @@ publish:docker:
|
||||
- docker push "${public_docker_image}:${CI_BUILD_REF_NAME}"
|
||||
- docker rmi "${public_docker_image}:${CI_BUILD_REF_NAME}"
|
||||
|
||||
publish:docker:alphanet:
|
||||
stage: publish
|
||||
image: docker:latest
|
||||
tags:
|
||||
- public_docker_builder
|
||||
only:
|
||||
- alphanet@tezos/tezos
|
||||
script:
|
||||
- mkdir -p ~/.docker ;
|
||||
- echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ;
|
||||
- docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}.patched"
|
||||
"${public_docker_image}:alphanet"
|
||||
- docker push "${public_docker_image}:alphanet"
|
||||
- docker rmi "${public_docker_image}:alphanet"
|
||||
- docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}.patched"
|
||||
|
||||
publish:docker:alphanet_next:
|
||||
stage: publish
|
||||
image: docker:latest
|
||||
tags:
|
||||
- public_docker_builder
|
||||
only:
|
||||
- master@tezos/tezos
|
||||
script:
|
||||
- mkdir -p ~/.docker ;
|
||||
- echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ;
|
||||
- docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}.patched"
|
||||
"${public_docker_image}:alphanet_next"
|
||||
- docker push "${public_docker_image}:alphanet_next"
|
||||
- docker rmi "${public_docker_image}:alphanet_next"
|
||||
- docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}.patched"
|
||||
|
||||
|
||||
publish:github:
|
||||
image: ocaml/opam
|
||||
stage: publish
|
||||
@ -195,7 +254,10 @@ publish:github:
|
||||
'git rm -r --cached --ignore-unmatch
|
||||
.gitlab-ci.yml
|
||||
"docs/proof of stake.md"
|
||||
src/client/embedded/bootstrap/mining/'
|
||||
src/client/embedded/bootstrap/mining/
|
||||
scripts/alphanet.sh
|
||||
scripts/alphanet_constants.patch
|
||||
scripts/alphanet_next.patch'
|
||||
--env-filter
|
||||
'if [ $GIT_COMMIT != "f42e9d12ac75d2876a4cf600d44976b7090d4533" ] ; then
|
||||
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" ;
|
||||
@ -207,6 +269,38 @@ publish:github:
|
||||
HEAD
|
||||
- git push git@github.com:tezos/tezos.git -f HEAD:master
|
||||
|
||||
deploy:alphanet:
|
||||
image: ocaml/opam
|
||||
stage: deploy
|
||||
tags:
|
||||
- tezos_builder
|
||||
only:
|
||||
- alphanet@tezos/tezos
|
||||
script:
|
||||
- echo "${CI_KH}" > ~/.ssh/known_hosts
|
||||
- echo "${CI_PK_ALPHANET}" > ~/.ssh/id_ed25519
|
||||
- chmod 400 ~/.ssh/id_ed25519
|
||||
- ssh greg@zo.gbzm.fr
|
||||
- ssh tezos@35.167.138.212
|
||||
- ssh tezos@35.165.227.4
|
||||
allow_failure: true
|
||||
|
||||
deploy:alphanet_next:
|
||||
image: ocaml/opam
|
||||
stage: deploy
|
||||
tags:
|
||||
- tezos_builder
|
||||
only:
|
||||
- master@tezos/tezos
|
||||
script:
|
||||
- echo "${CI_KH}" > ~/.ssh/known_hosts
|
||||
- echo "${CI_PK_ALPHANET_NEXT}" > ~/.ssh/id_ed25519
|
||||
- chmod 400 ~/.ssh/id_ed25519
|
||||
- ssh greg@zo.gbzm.fr
|
||||
- ssh tezos@35.167.138.212
|
||||
- ssh tezos@35.165.227.4
|
||||
allow_failure: true
|
||||
|
||||
cleanup:
|
||||
stage: cleanup
|
||||
image: docker:latest
|
||||
|
@ -21,4 +21,17 @@ RUN sudo chown root:root bin/* && \
|
||||
sudo mv bin/* /usr/local/bin && \
|
||||
rmdir bin
|
||||
|
||||
ENTRYPOINT [ "/bin/bash" ]
|
||||
RUN sudo cp scripts/docker_entrypoint.sh /usr/local/bin/tezos && \
|
||||
sudo cp scripts/docker_entrypoint.inc.sh \
|
||||
scripts/client_lib.inc.sh \
|
||||
/usr/local/bin/ && \
|
||||
sudo chmod a+rx /usr/local/bin/tezos
|
||||
|
||||
RUN sudo mkdir -p /var/run/tezos && \
|
||||
sudo chown tezos /var/run/tezos
|
||||
|
||||
ENV EDITOR=vi
|
||||
|
||||
VOLUME /var/run/tezos
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/tezos" ]
|
||||
|
@ -1,7 +1,8 @@
|
||||
FROM $base_name:$base_version
|
||||
|
||||
COPY . /home/opam/tezos
|
||||
COPY src /home/opam/tezos/src
|
||||
|
||||
RUN sudo chown -R opam /home/opam/tezos && \
|
||||
opam config exec -- make -C tezos -j4 && \
|
||||
opam config exec -- make -C tezos/src -j4 && \
|
||||
mkdir bin && \
|
||||
cp tezos/tezos-* bin
|
||||
|
625
scripts/alphanet.sh
Executable file
625
scripts/alphanet.sh
Executable file
@ -0,0 +1,625 @@
|
||||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! docker > /dev/null 2>&1 ; then
|
||||
echo "Docker does not seem to be installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker_version="$(docker version -f "{{ .Server.Version }}")"
|
||||
docker_major="$(echo "$docker_version" | cut -d . -f 1)"
|
||||
docker_minor="$(echo "$docker_version" | cut -d . -f 2)"
|
||||
|
||||
if ([ "$docker_major" -gt 1 ] ||
|
||||
( [ "$docker_major" -eq 1 ] && [ "$docker_minor" -ge 13 ] )) ; then
|
||||
docker_1_13=true
|
||||
else
|
||||
docker_1_13=false
|
||||
fi
|
||||
|
||||
src_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||
cd "$src_dir"
|
||||
|
||||
default_port=9732
|
||||
port="$default_port"
|
||||
|
||||
docker_image=docker.io/tezos/tezos:alphanet
|
||||
docker_volume=tezos-alphanet-data$suffix
|
||||
suffix=
|
||||
|
||||
data_dir="$HOME/.tezos-alphanet$suffix"
|
||||
docker_container="tezos-alphanet$suffix"
|
||||
|
||||
|
||||
## Saving state ############################################################
|
||||
|
||||
save_identity() {
|
||||
if [ ! -f "$data_dir/identity.json" ]; then
|
||||
echo "Saving the generated identity into '$data_dir/identity.json'..."
|
||||
mkdir -p "$data_dir/"
|
||||
fi
|
||||
docker cp "$docker_container:var/run/tezos/node/identity.json" \
|
||||
"$data_dir/"
|
||||
}
|
||||
|
||||
|
||||
may_restore_identity() {
|
||||
if [ -f "$data_dir/identity.json" ]; then
|
||||
echo "Restoring the peer identity from '$data_dir/identity.json'..."
|
||||
docker exec "$docker_container" mkdir -p /var/run/tezos/node/
|
||||
docker cp "$data_dir/identity.json" \
|
||||
"$docker_container:var/run/tezos/node/"
|
||||
docker exec "$docker_container" \
|
||||
sudo chown tezos "/var/run/tezos/node/identity.json"
|
||||
fi
|
||||
}
|
||||
|
||||
may_save_client_file() {
|
||||
if docker exec "$docker_container" \
|
||||
test -f "/var/run/tezos/client/$1" ; then
|
||||
docker cp "$docker_container:var/run/tezos/client/$1" \
|
||||
"$data_dir/$1"
|
||||
elif [ -f "$data_dir/$1" ] ; then
|
||||
mv "$data_dir/$1" "$data_dir/$1.bak"
|
||||
fi
|
||||
}
|
||||
|
||||
may_restore_client_file() {
|
||||
if [ -f "$data_dir/$1" ]; then
|
||||
docker cp "$data_dir/$1" \
|
||||
"$docker_container:var/run/tezos/client/"
|
||||
docker exec "$docker_container" \
|
||||
sudo chown tezos "/var/run/tezos/client/$1"
|
||||
fi
|
||||
}
|
||||
|
||||
save_accounts() {
|
||||
if ! docker exec "$docker_container" \
|
||||
test -f "/var/run/tezos/client/secret keys" ; then
|
||||
return
|
||||
fi
|
||||
if [ ! -f "$data_dir/secret keys" ]; then
|
||||
echo "Saving the secrets into '$data_dir/secret keys'..."
|
||||
echo
|
||||
echo "\033[33mWARNING: THE SECRET KEYS FILE IS UNENCRYPTED!!!\033[0m"
|
||||
echo
|
||||
mkdir -p "$data_dir/"
|
||||
fi
|
||||
docker cp "$docker_container:var/run/tezos/client/secret keys" \
|
||||
"$data_dir/"
|
||||
may_save_client_file "public key hashs"
|
||||
may_save_client_file "public keys"
|
||||
may_save_client_file "contracts"
|
||||
}
|
||||
|
||||
may_restore_accounts() {
|
||||
docker exec "$docker_container" mkdir -p /var/run/tezos/client/
|
||||
if [ -f "$data_dir/secret keys" ]; then
|
||||
echo "Restoring the secret keys from '$data_dir/secret keys'..."
|
||||
may_restore_client_file "secret keys"
|
||||
fi
|
||||
may_restore_client_file "public key hashs"
|
||||
may_restore_client_file "public keys"
|
||||
may_restore_client_file "contracts"
|
||||
}
|
||||
|
||||
|
||||
## Container ###############################################################
|
||||
|
||||
pull_image() {
|
||||
if [ "$TEZOS_ALPHANET_DO_NOT_PULL" = "yes" ] ; then
|
||||
return ;
|
||||
fi
|
||||
docker pull "$docker_image"
|
||||
}
|
||||
|
||||
check_container() {
|
||||
res=$(docker inspect \
|
||||
--format="{{ .State.Running }}" \
|
||||
--type=container "$docker_container" 2>/dev/null \
|
||||
|| echo false)
|
||||
[ "$res" = true ]
|
||||
}
|
||||
|
||||
check_volume() {
|
||||
docker volume inspect "$docker_volume" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
clear_volume() {
|
||||
if check_volume ; then
|
||||
docker volume rm "$docker_volume"
|
||||
echo "\033[32mThe blockchain data has been removed from the disk.\033[0m"
|
||||
else
|
||||
echo "\033[32mNo remaining data to be removed from the disk.\033[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
uptodate_container() {
|
||||
running_image=$(docker inspect \
|
||||
--format="{{ .Image }}" \
|
||||
--type=container "$docker_container")
|
||||
latest_image=$(docker inspect \
|
||||
--format="{{ .Id }}" \
|
||||
--type=image "$docker_image")
|
||||
[ "$latest_image" = "$running_image" ]
|
||||
}
|
||||
|
||||
assert_container_uptodate() {
|
||||
pull_image > /dev/null
|
||||
if ! uptodate_container; then
|
||||
echo "The current container is not the latest available."
|
||||
echo "Please restart."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
assert_container() {
|
||||
if ! check_container; then
|
||||
echo "\033[31mNo container currently running!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start_container() {
|
||||
if check_container; then
|
||||
assert_container_uptodate
|
||||
else
|
||||
if ! check_volume; then
|
||||
docker volume create $docker_volume
|
||||
fi
|
||||
docker rm "$docker_container" || true > /dev/null 2>&1
|
||||
echo "Launching the docker container..."
|
||||
docker run -dit -p "$port:$port" \
|
||||
-v $docker_volume:/var/run/tezos \
|
||||
--entrypoint /bin/sh \
|
||||
--name "$docker_container" \
|
||||
"$docker_image" > /dev/null
|
||||
may_restore_identity
|
||||
may_restore_accounts
|
||||
fi
|
||||
}
|
||||
|
||||
stop_container() {
|
||||
if ! check_container; then
|
||||
echo "\033[31mNo container to kill!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
save_identity ## Saving again, just in case...
|
||||
save_accounts
|
||||
printf "Stopping the container... "
|
||||
docker stop "$docker_container"
|
||||
echo " done"
|
||||
}
|
||||
|
||||
|
||||
## Node ####################################################################
|
||||
|
||||
init_node() {
|
||||
docker exec "$docker_container" tezos init "$@"
|
||||
save_identity
|
||||
}
|
||||
|
||||
check_node() {
|
||||
check_container && docker exec -it "$docker_container" tezos check_node
|
||||
}
|
||||
|
||||
assert_node() {
|
||||
if ! check_node; then
|
||||
echo "\033[31mNode is not running!\033[0m"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
status_node() {
|
||||
if check_node; then
|
||||
echo "\033[32mNode is running\033[0m"
|
||||
else
|
||||
echo "\033[33mNode is not running\033[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
start_node() {
|
||||
if check_node; then
|
||||
echo "\033[31mCannot run two nodes in the same container!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
if $docker_1_13; then
|
||||
tezos_log_env="-eTEZOS_LOG=${TEZOS_LOG:=* -> info}"
|
||||
fi
|
||||
docker exec -d "${tezos_log_env}" \
|
||||
"$docker_container" tezos run_node
|
||||
sleep 1
|
||||
docker exec "$docker_container" tezos wait_node
|
||||
echo "\033[32mThe node is now running.\033[0m"
|
||||
}
|
||||
|
||||
log_node() {
|
||||
docker exec -it "$docker_container" tezos log_node
|
||||
}
|
||||
|
||||
stop_node() {
|
||||
docker exec "$docker_container" tezos stop_node
|
||||
}
|
||||
|
||||
|
||||
## Baker ###################################################################
|
||||
|
||||
check_baker() {
|
||||
check_node && docker exec -it "$docker_container" tezos check_baker
|
||||
}
|
||||
|
||||
assert_baker() {
|
||||
if ! check_baker; then
|
||||
echo "\033[31mBaker is not running!\033[0m"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
status_baker() {
|
||||
if check_baker; then
|
||||
echo "\033[32mBaker is running\033[0m"
|
||||
else
|
||||
echo "\033[33mBaker is not running\033[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
start_baker() {
|
||||
if check_baker; then
|
||||
echo "\033[31mCannot run two bakers in the same container!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
TEZOS_LOG="${TEZOS_LOG:=* -> info}"
|
||||
docker exec -d "$docker_container" tezos run_baker
|
||||
echo "\033[32mThe baker is now running.\033[0m"
|
||||
}
|
||||
|
||||
log_baker() {
|
||||
docker exec -it "$docker_container" tezos log_baker
|
||||
}
|
||||
|
||||
stop_baker() {
|
||||
docker exec "$docker_container" tezos stop_baker
|
||||
}
|
||||
|
||||
## Baker ###################################################################
|
||||
|
||||
check_endorser() {
|
||||
check_node && docker exec -it "$docker_container" tezos check_endorser
|
||||
}
|
||||
|
||||
assert_endorser() {
|
||||
if ! check_baker; then
|
||||
echo "\033[31mEndorser is not running!\033[0m"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
status_endorser() {
|
||||
if check_endorser; then
|
||||
echo "\033[32mEndorser is running\033[0m"
|
||||
else
|
||||
echo "\033[33mEndorser is not running\033[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
start_endorser() {
|
||||
if check_endorser; then
|
||||
echo "\033[31mCannot run two endorsers in the same container!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
TEZOS_LOG="${TEZOS_LOG:=* -> info}"
|
||||
docker exec -d "$docker_container" tezos run_endorser
|
||||
echo "\033[32mThe endorser is now running.\033[0m"
|
||||
}
|
||||
|
||||
log_endorser() {
|
||||
docker exec -it "$docker_container" tezos log_endorser
|
||||
}
|
||||
|
||||
stop_endorser() {
|
||||
docker exec "$docker_container" tezos stop_endorser
|
||||
}
|
||||
|
||||
## Misc ####################################################################
|
||||
|
||||
|
||||
run_client() {
|
||||
docker exec -it "$docker_container" tezos client "$@"
|
||||
save_accounts
|
||||
}
|
||||
|
||||
run_shell() {
|
||||
docker exec -it "$docker_container" bash
|
||||
save_accounts
|
||||
}
|
||||
|
||||
display_head() {
|
||||
docker exec -it "$docker_container" tezos \
|
||||
client rpc call /blocks/head with '{}'
|
||||
docker exec -it "$docker_container" tezos \
|
||||
client rpc call /blocks/head/proto/context/level with '{}'
|
||||
}
|
||||
|
||||
## Main ####################################################################
|
||||
|
||||
start() {
|
||||
pull_image
|
||||
start_container
|
||||
init_node --net-addr "[::]:$port" "$@"
|
||||
start_node
|
||||
start_baker
|
||||
start_endorser
|
||||
save_accounts
|
||||
warn_script_uptodate
|
||||
}
|
||||
|
||||
go_alpha_go() {
|
||||
docker exec -it "$docker_container" tezos client \
|
||||
activate \
|
||||
protocol ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK \
|
||||
with fitness 1 \
|
||||
and key dictator
|
||||
}
|
||||
|
||||
stop() {
|
||||
stop_node || true
|
||||
stop_container
|
||||
}
|
||||
|
||||
status() {
|
||||
pull_image
|
||||
if ! uptodate_container; then
|
||||
echo "\033[31mThe container is running but not the latest available.\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo "\033[32mThe container is running and up to date.\033[0m"
|
||||
warn_script_uptodate verbose
|
||||
status_node
|
||||
status_baker
|
||||
status_endorser
|
||||
}
|
||||
|
||||
warn_script_uptodate() {
|
||||
docker cp "$docker_container:home/tezos/scripts/alphanet.sh" \
|
||||
".alphanet.sh.new"
|
||||
if ! diff .alphanet.sh.new "$0" >/dev/null 2>&1 ; then
|
||||
echo "\033[33mWarning: the container contains a new version of 'alphanet.sh'.\033[0m"
|
||||
echo "\033[33mYou might run '$0 update_script' to synchronize.\033[0m"
|
||||
elif [ "$1" = "verbose" ] ; then
|
||||
echo "\033[32mThe script is up to date.\033[0m"
|
||||
fi
|
||||
rm .alphanet.sh.new
|
||||
}
|
||||
|
||||
assert_uptodate() {
|
||||
assert_container
|
||||
assert_container_uptodate
|
||||
warn_script_uptodate
|
||||
}
|
||||
|
||||
update_script() {
|
||||
pull_image
|
||||
tmp="$(docker run -dit --entrypoint /bin/true "$docker_image")"
|
||||
docker cp "$tmp:home/tezos/scripts/alphanet.sh" "$0"
|
||||
docker stop "$tmp"
|
||||
echo "\033[32mThe script has been updated.\033[0m"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [GLOBAL_OPTIONS] <command> [OPTIONS]"
|
||||
echo " Main commands:"
|
||||
echo " $0 start [OPTIONS] (passed to tezos-node config init)"
|
||||
echo " Launch a full Tezos alphanet node in a docker container"
|
||||
echo " automatically generating a new network identity."
|
||||
echo " An account my_account for a manager my_identity is also"
|
||||
echo " created to be used via the client."
|
||||
echo " $0 <stop|kill>"
|
||||
echo " Friendly or brutally stop the node."
|
||||
echo " $0 restart"
|
||||
echo " Friendly stop the node, fetch the latest docker image and "
|
||||
echo " update this script, then start the node again."
|
||||
echo " The blockchain data are preserved."
|
||||
echo " $0 clear"
|
||||
echo " Remove all the blockchain data from the disk (except"
|
||||
echo " for secret keys and other configuration backup)."
|
||||
echo " $0 status"
|
||||
echo " Check that the running node is running and up to date."
|
||||
echo " Upgrade is automatically done by the start command."
|
||||
echo " $0 head"
|
||||
echo " Display info about the current head of the blockchain."
|
||||
echo " $0 client <COMMAND>"
|
||||
echo " Pass a command to the tezos client."
|
||||
echo " $0 update_script"
|
||||
echo " Replace 'alphanet.sh' with the one found in the docker image."
|
||||
echo " Advanced commands:"
|
||||
echo " $0 container <start|stop|status>"
|
||||
echo " $0 node <start|stop|status|log>"
|
||||
echo " $0 baker <start|stop|status|log>"
|
||||
echo " $0 endorser <start|stop|status|log>"
|
||||
echo " $0 shell"
|
||||
echo "Node configuration backup directory: $data_dir"
|
||||
echo "Global options are currently restricted to: '--port <int>'"
|
||||
}
|
||||
|
||||
## Dispatch ################################################################
|
||||
|
||||
if [ "$#" -ge 2 ] && [ "$1" = "--port" ] ; then
|
||||
port="$2"
|
||||
suffix=".$port"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
command="$1"
|
||||
if [ "$#" -eq 0 ] ; then usage ; exit 1; else shift ; fi
|
||||
|
||||
|
||||
case "$command" in
|
||||
|
||||
## Main
|
||||
|
||||
start)
|
||||
start "$@"
|
||||
;;
|
||||
restart)
|
||||
if check_container; then
|
||||
stop_container
|
||||
fi
|
||||
update_script
|
||||
export TEZOS_ALPHANET_DO_NOT_PULL=yes
|
||||
exec "$0" start "$@"
|
||||
;;
|
||||
clear)
|
||||
clear_volume
|
||||
;;
|
||||
status)
|
||||
assert_container
|
||||
status
|
||||
;;
|
||||
stop)
|
||||
assert_container
|
||||
stop
|
||||
;;
|
||||
kill)
|
||||
stop_container
|
||||
;;
|
||||
|
||||
## Container
|
||||
|
||||
container)
|
||||
subcommand="$1"
|
||||
if [ "$#" -eq 0 ] ; then usage ; exit 1 ; else shift ; fi
|
||||
case "$subcommand" in
|
||||
start)
|
||||
start_container
|
||||
warn_script_uptodate
|
||||
;;
|
||||
status)
|
||||
if check_container; then
|
||||
echo "\033[32mContainer is running\033[0m"
|
||||
else
|
||||
echo "\033[33mContainer is not running\033[0m"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
stop_container
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac ;;
|
||||
|
||||
## Node
|
||||
|
||||
node)
|
||||
subcommand="$1"
|
||||
if [ "$#" -eq 0 ] ; then usage ; exit 1; else shift ; fi
|
||||
case "$subcommand" in
|
||||
start)
|
||||
assert_uptodate
|
||||
start_node
|
||||
;;
|
||||
status)
|
||||
assert_uptodate
|
||||
status_node
|
||||
;;
|
||||
log)
|
||||
assert_uptodate
|
||||
log_node
|
||||
;;
|
||||
stop)
|
||||
assert_uptodate
|
||||
stop_node
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac ;;
|
||||
## Baker
|
||||
|
||||
baker)
|
||||
subcommand="$1"
|
||||
if [ "$#" -eq 0 ] ; then usage ; exit 1; else shift ; fi
|
||||
case "$subcommand" in
|
||||
status)
|
||||
assert_uptodate
|
||||
status_baker
|
||||
;;
|
||||
start)
|
||||
assert_uptodate
|
||||
assert_node
|
||||
start_baker
|
||||
;;
|
||||
log)
|
||||
assert_uptodate
|
||||
log_baker
|
||||
;;
|
||||
stop)
|
||||
assert_uptodate
|
||||
stop_baker
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac ;;
|
||||
|
||||
## Endorser
|
||||
|
||||
endorser)
|
||||
subcommand="$1"
|
||||
if [ "$#" -eq 0 ] ; then usage ; exit 1; else shift ; fi
|
||||
case "$subcommand" in
|
||||
status)
|
||||
assert_uptodate
|
||||
status_endorser
|
||||
;;
|
||||
start)
|
||||
assert_uptodate
|
||||
assert_node
|
||||
start_endorser
|
||||
;;
|
||||
log)
|
||||
assert_uptodate
|
||||
log_endorser
|
||||
;;
|
||||
stop)
|
||||
assert_uptodate
|
||||
stop_endorser
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac ;;
|
||||
|
||||
## Misc.
|
||||
|
||||
head)
|
||||
assert_uptodate
|
||||
assert_node
|
||||
display_head
|
||||
;;
|
||||
go_alpha_go)
|
||||
assert_uptodate
|
||||
assert_node
|
||||
go_alpha_go
|
||||
;;
|
||||
shell)
|
||||
assert_uptodate
|
||||
run_shell
|
||||
;;
|
||||
client)
|
||||
assert_uptodate
|
||||
assert_node
|
||||
run_client "$@"
|
||||
;;
|
||||
check_script)
|
||||
assert_uptodate
|
||||
;;
|
||||
update_script)
|
||||
update_script
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
36
scripts/alphanet_constants.patch
Normal file
36
scripts/alphanet_constants.patch
Normal file
@ -0,0 +1,36 @@
|
||||
diff --git a/src/proto/alpha/constants_repr.ml b/src/proto/alpha/constants_repr.ml
|
||||
--- a/src/proto/alpha/constants_repr.ml
|
||||
+++ b/src/proto/alpha/constants_repr.ml
|
||||
@@ -50,15 +50,14 @@ let read_public_key s =
|
||||
Ed25519.Public_key.of_bytes (Bytes.of_string (Hex_encode.hex_decode s))
|
||||
|
||||
let default = {
|
||||
- cycle_length = 2048l ;
|
||||
- voting_period_length = 32768l ;
|
||||
+ cycle_length = 64l ;
|
||||
+ voting_period_length = 1024l ;
|
||||
time_before_reward =
|
||||
Period_repr.of_seconds_exn
|
||||
- (* One year in seconds *)
|
||||
- Int64.(mul 365L (mul 24L 3600L)) ;
|
||||
+ Int64.(mul 12L 3600L) ;
|
||||
slot_durations =
|
||||
- List.map Period_repr.of_seconds_exn [ 60L ] ;
|
||||
- first_free_mining_slot = 16 ;
|
||||
+ List.map Period_repr.of_seconds_exn [ 60L ; 30L ; 30L ; 30L ; 10L ] ;
|
||||
+ first_free_mining_slot = 4 ;
|
||||
max_signing_slot = 15 ;
|
||||
instructions_per_transaction = 16 * 1024 ;
|
||||
proof_of_work_threshold =
|
||||
diff --git a/src/node/shell/distributed_db_message.ml b/src/node/shell/distributed_db_message.ml
|
||||
--- a/src/node/shell/distributed_db_message.ml
|
||||
+++ b/src/node/shell/distributed_db_message.ml
|
||||
@@ -144,7 +144,7 @@ let encoding =
|
||||
|
||||
let versions =
|
||||
let open P2p.Version in
|
||||
- [ { name = "TEZOS" ;
|
||||
+ [ { name = "TEZOS_ALPHANET" ;
|
||||
major = 0 ;
|
||||
minor = 5 ;
|
||||
}
|
48
scripts/alphanet_next.patch
Normal file
48
scripts/alphanet_next.patch
Normal file
@ -0,0 +1,48 @@
|
||||
diff --git a/src/node/shell/distributed_db_message.ml b/src/node/shell/distributed_db_message.ml
|
||||
--- a/src/node/shell/distributed_db_message.ml
|
||||
+++ b/src/node/shell/distributed_db_message.ml
|
||||
@@ -144,7 +144,7 @@ let encoding =
|
||||
|
||||
let versions =
|
||||
let open P2p.Version in
|
||||
- [ { name = "TEZOS_ALPHANET" ;
|
||||
+ [ { name = "TEZOS_ALPHANET_NEXT" ;
|
||||
major = 0 ;
|
||||
minor = 5 ;
|
||||
}
|
||||
diff --git a/scripts/alphanet.sh b/scripts/alphanet.sh
|
||||
--- a/scripts/alphanet.sh
|
||||
+++ b/scripts/alphanet.sh
|
||||
@@ -21,15 +21,15 @@ fi
|
||||
src_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||
cd "$src_dir"
|
||||
|
||||
-default_port=9732
|
||||
+default_port=19732
|
||||
port="$default_port"
|
||||
|
||||
-docker_image=docker.io/tezos/tezos:alphanet
|
||||
-docker_volume=tezos-alphanet-data$suffix
|
||||
+docker_image=docker.io/tezos/tezos:alphanet_next
|
||||
+docker_volume=tezos-alphanet-next-data$suffix
|
||||
suffix=
|
||||
|
||||
-data_dir="$HOME/.tezos-alphanet$suffix"
|
||||
-docker_container="tezos-alphanet$suffix"
|
||||
+data_dir="$HOME/.tezos-alphanet-next$suffix"
|
||||
+docker_container="tezos-alphanet-next$suffix"
|
||||
|
||||
|
||||
## Saving state ############################################################
|
||||
diff --git a/src/node/main/node_config_file.ml b/src/node/main/node_config_file.ml
|
||||
--- a/src/node/main/node_config_file.ml
|
||||
+++ b/src/node/main/node_config_file.ml
|
||||
@@ -16,7 +16,7 @@ let home =
|
||||
with Not_found -> "/root"
|
||||
|
||||
let default_data_dir = home // ".tezos-node"
|
||||
-let default_net_port = 9732
|
||||
+let default_net_port = 19732
|
||||
let default_rpc_port = 8732
|
||||
|
||||
type t = {
|
1
scripts/alphanet_version
Normal file
1
scripts/alphanet_version
Normal file
@ -0,0 +1 @@
|
||||
2017-04-17
|
@ -1,102 +1,130 @@
|
||||
#! /bin/bash
|
||||
#! /bin/sh
|
||||
|
||||
client=${client:=tezos-client}
|
||||
client_dir="${client_dir:=$HOME/.tezos-client}"
|
||||
client="${client:=tezos-client -base-dir $client_dir}"
|
||||
|
||||
function wait_for_the_node_to_be_ready() {
|
||||
local last_level
|
||||
local current_level
|
||||
while ! $client rpc call blocks/head/proto/context/level >/dev/null 2>&1
|
||||
## Waiter ##################################################################
|
||||
|
||||
wait_for_the_node_to_be_ready() {
|
||||
if $client rpc call blocks/head/hash >/dev/null 2>&1; then return; fi
|
||||
printf "Waiting for the node to initialize..."
|
||||
sleep 1
|
||||
while ! $client rpc call blocks/head/hash >/dev/null 2>&1
|
||||
do
|
||||
echo Waiting 10 seconds for the node to launch...
|
||||
sleep 10
|
||||
done
|
||||
## Wait for the level not to change for 30sec...
|
||||
last_level="$($client rpc call blocks/head/proto/context/level)"
|
||||
while [ "$last_level" != "$current_level" ]
|
||||
do
|
||||
echo Waiting 30 seconds for the node to synchronize...
|
||||
sleep 30
|
||||
last_level=$current_level
|
||||
current_level="$($client rpc call blocks/head/proto/context/level)"
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
echo " done."
|
||||
}
|
||||
|
||||
function wait_for_a_new_block() {
|
||||
local last_level
|
||||
local current_level
|
||||
last_level="$($client rpc call blocks/head/proto/context/level)"
|
||||
current_level="$last_level"
|
||||
while [ "$last_level" = "$current_level" ]
|
||||
do
|
||||
echo Waiting 10 seconds for a block to be baked...
|
||||
sleep 10
|
||||
current_level="$($client rpc call blocks/head/proto/context/level)"
|
||||
done
|
||||
wait_for_the_node_to_be_bootstraped() {
|
||||
wait_for_the_node_to_be_ready
|
||||
echo "Waiting for the node to synchronize with the network..."
|
||||
$client bootstrapped
|
||||
}
|
||||
|
||||
function create_identity() {
|
||||
if ! $client get balance my_identity 2> /dev/null 1> /dev/null
|
||||
then
|
||||
## Account #################################################################
|
||||
|
||||
may_create_identity() {
|
||||
if ! $client get balance "my_identity" >/dev/null 2>&1 ; then
|
||||
echo "Generating new manager key (known as 'my_identity')..."
|
||||
$client gen keys my_identity
|
||||
fi
|
||||
}
|
||||
|
||||
function create_account() {
|
||||
while ! $client get balance my_account 2> /dev/null 1> /dev/null
|
||||
do
|
||||
echo Emiting origination...
|
||||
$client forget contract my_account || true
|
||||
$client originate account my_account for my_identity \
|
||||
transfering 50,000.00 from bootstrap1
|
||||
wait_for_a_new_block
|
||||
done
|
||||
echo Adding some credit in the new account...
|
||||
$client transfer 50,000.00 from bootstrap2 to my_account
|
||||
$client transfer 50,000.00 from bootstrap3 to my_account
|
||||
$client transfer 50,000.00 from bootstrap4 to my_account
|
||||
echo Provisining some credit for bond deposit...
|
||||
$client transfer 50,000.00 from bootstrap5 to my_identity
|
||||
wait_for_a_new_block
|
||||
}
|
||||
|
||||
function wait_for_the_account() {
|
||||
local account
|
||||
while [ -z "$account" ]
|
||||
do
|
||||
echo Waiting 10 seconds for baker to create the account...
|
||||
sleep 10
|
||||
for contract in $($client list contracts \
|
||||
| grep -v "(default)" \
|
||||
| awk '{ print $1; }')
|
||||
do
|
||||
if $client get manager "$contract" | grep my_identity; then
|
||||
account=$($client get manager "$contract" | awk '{ print $1; }')
|
||||
echo account created
|
||||
fi
|
||||
done
|
||||
done
|
||||
$client remember contract my_account "$account"
|
||||
}
|
||||
|
||||
function start_baker() {
|
||||
declare -a identities
|
||||
if [ $# -eq 0 ]; then
|
||||
identities[0]=my_identity
|
||||
else
|
||||
identities=("$@")
|
||||
if ! $client get balance "my_account" >/dev/null 2>&1 ; then
|
||||
echo "Creating new account for 'my_identity' (known as 'my_account')..."
|
||||
$client forget contract my_account || true >/dev/null 2>&1
|
||||
$client originate free account my_account for my_identity
|
||||
fi
|
||||
echo "Start baking for ${identities[*]}..."
|
||||
$client launch daemon -mining -max-priority 64 "${identities[@]}"
|
||||
}
|
||||
|
||||
function start_endorser() {
|
||||
declare -a identities
|
||||
if [ $# -eq 0 ]; then
|
||||
identities[0]=my_identity
|
||||
else
|
||||
identities=("$@")
|
||||
## Baker ###################################################################
|
||||
|
||||
check_baker() {
|
||||
pids=$(pgrep -x tezos-client 2>/dev/null)
|
||||
for pid in $pids; do
|
||||
if grep -- "-mining" "/proc/$pid/cmdline" >/dev/null 2>&1 ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
run_baker() {
|
||||
if check_baker; then
|
||||
echo "Cannot run two bakers in the same container."
|
||||
exit 1
|
||||
fi
|
||||
echo "Start baker..."
|
||||
exec $client launch daemon -mining -max-priority 64 "$@" > "$client_dir/baker.log"
|
||||
}
|
||||
|
||||
stop_baker() {
|
||||
pids=$(pgrep -x tezos-client 2>/dev/null)
|
||||
for pid in $pids; do
|
||||
if grep -- "-mining" "/proc/$pid/cmdline" >/dev/null 2>&1 ; then
|
||||
echo "Killing the baker..."
|
||||
kill "$pid"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
log_baker() {
|
||||
if ! check_baker ; then
|
||||
echo
|
||||
echo "##############################################"
|
||||
echo "## ##"
|
||||
echo "## Warning: The tezos baker is not running! ##"
|
||||
echo "## ##"
|
||||
echo "##############################################"
|
||||
echo
|
||||
tail "$client_dir/baker.log"
|
||||
else
|
||||
tail -f "$client_dir/baker.log"
|
||||
fi
|
||||
}
|
||||
|
||||
## Endorser ################################################################
|
||||
|
||||
check_endorser() {
|
||||
pids=$(pgrep -x tezos-client 2>/dev/null)
|
||||
for pid in $pids; do
|
||||
if grep -- "-endorsement" "/proc/$pid/cmdline" > /dev/null 2>&1 ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
run_endorser() {
|
||||
if check_endorser; then
|
||||
echo "Cannot run two endorsers in the same container."
|
||||
exit 1
|
||||
fi
|
||||
echo "Start endorser..."
|
||||
exec $client launch daemon -endorsement "$@" > "$client_dir/endorser.log"
|
||||
}
|
||||
|
||||
stop_endorser() {
|
||||
pids=$(pgrep -x tezos-client 2>/dev/null)
|
||||
for pid in $pids; do
|
||||
if grep -- "-endorsement" "/proc/$pid/cmdline" > /dev/null 2>&1 ; then
|
||||
kill "$pid"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
log_endorser() {
|
||||
if ! check_endorser ; then
|
||||
echo
|
||||
echo "#################################################"
|
||||
echo "## ##"
|
||||
echo "## Warning: The tezos endorser is not running! ##"
|
||||
echo "## ##"
|
||||
echo "#################################################"
|
||||
echo
|
||||
tail "$client_dir/endorser.log"
|
||||
else
|
||||
tail -f "$client_dir/endorser.log"
|
||||
fi
|
||||
echo "Start endorsing for ${identities[*]}..."
|
||||
$client launch daemon -endorsement "${identities[@]}"
|
||||
}
|
||||
|
||||
|
97
scripts/docker_entrypoint.inc.sh
Normal file
97
scripts/docker_entrypoint.inc.sh
Normal file
@ -0,0 +1,97 @@
|
||||
#! /bin/sh
|
||||
|
||||
data_dir="/var/run/tezos"
|
||||
node_dir="${node_dir:=/var/run/tezos/node}"
|
||||
client_dir="${client_dir:=/var/run/tezos/client}"
|
||||
node="${node:=tezos-node}"
|
||||
client="${client:=tezos-client -base-dir \"$client_dir\"}"
|
||||
|
||||
init() {
|
||||
if [ -f "$data_dir/alphanet_version" ] && \
|
||||
[ "$(cat $data_dir/alphanet_version)" \
|
||||
!= "$(cat ~/scripts/alphanet_version)" ]; then
|
||||
echo "\033[33mThe alphanet chain has been reset\033[0m"
|
||||
mv "$node_dir/identity.json" /tmp
|
||||
mv "$client_dir/public key hashs" /tmp
|
||||
mv "$client_dir/public keys" /tmp
|
||||
mv "$client_dir/secret keys" /tmp
|
||||
rm -rf "$node_dir" "$client_dir"
|
||||
mkdir -p "$node_dir" "$client_dir"
|
||||
mv "/tmp/identity.json" "$node_dir/"
|
||||
mv "/tmp/public key hashs" "$client_dir/"
|
||||
mv "/tmp/public keys" "$client_dir/"
|
||||
mv "/tmp/secret keys" "$client_dir/"
|
||||
fi
|
||||
if [ ! -f "$node_dir/config.json" ]; then
|
||||
"$node" config init \
|
||||
--data-dir "$node_dir" \
|
||||
--rpc-addr "127.0.0.1:8732" \
|
||||
--log-output "$node_dir/log" \
|
||||
"$@"
|
||||
else
|
||||
"$node" config update \
|
||||
--data-dir "$node_dir" \
|
||||
"$@"
|
||||
fi
|
||||
if [ -f "$node_dir/identity.json" ]; then
|
||||
if ! "$node" identity check \
|
||||
--data-dir "$node_dir" 2> /dev/null; then
|
||||
echo "Ignoring the current peer identity (not enough proof of work)."
|
||||
rm "$node_dir/identity.json"
|
||||
fi
|
||||
fi
|
||||
if [ ! -f "$node_dir/identity.json" ]; then
|
||||
"$node" identity generate \
|
||||
--data-dir "$node_dir"
|
||||
fi
|
||||
}
|
||||
|
||||
check_node() {
|
||||
pgrep -x tezos-node > /dev/null 2>&1
|
||||
}
|
||||
|
||||
run_node() {
|
||||
TEZOS_LOG="${TEZOS_LOG:='* -> info'}"
|
||||
if check_node; then
|
||||
echo "Cannot run two node instances in the same container."
|
||||
exit 1
|
||||
fi
|
||||
## Temporary hack until Pierre has debugged Lwt...
|
||||
export LWT_ASYNC_METHOD=none
|
||||
## END of temporary hack
|
||||
exec "$node" run --data-dir "$node_dir" "$@"
|
||||
}
|
||||
|
||||
stop_node() {
|
||||
if ! check_node; then
|
||||
echo "No tezos node to kill!"
|
||||
exit 1 ;
|
||||
fi
|
||||
printf "Killing the tezos node..."
|
||||
pkill -x tezos-node
|
||||
sleep 1
|
||||
while check_node; do
|
||||
printf "."
|
||||
sleep 1
|
||||
done
|
||||
echo " done."
|
||||
}
|
||||
|
||||
log_node() {
|
||||
if ! check_node ; then
|
||||
echo
|
||||
echo "#############################################"
|
||||
echo "## ##"
|
||||
echo "## Warning: The tezos node is not running! ##"
|
||||
echo "## ##"
|
||||
echo "#############################################"
|
||||
echo
|
||||
tail "$node_dir/log"
|
||||
else
|
||||
tail -f "$node_dir/log"
|
||||
fi
|
||||
}
|
||||
|
||||
run_client() {
|
||||
exec $client "$@"
|
||||
}
|
87
scripts/docker_entrypoint.sh
Executable file
87
scripts/docker_entrypoint.sh
Executable file
@ -0,0 +1,87 @@
|
||||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||
src_dir="$(dirname "$script_dir")"
|
||||
cd "$src_dir"
|
||||
|
||||
data_dir="/var/run/tezos"
|
||||
export node_dir="$data_dir/node"
|
||||
export client_dir="$data_dir/client"
|
||||
export node="tezos-node"
|
||||
export client="tezos-client -base-dir $client_dir"
|
||||
|
||||
. "${script_dir}"/client_lib.inc.sh
|
||||
. "${script_dir}"/docker_entrypoint.inc.sh
|
||||
|
||||
usage() {
|
||||
echo "$0 command [options]"
|
||||
echo
|
||||
echo "where 'command' is one of:"
|
||||
echo " - run_node: ... "
|
||||
echo " - log_node: ... "
|
||||
echo " - run_baker: ... "
|
||||
echo " - log_baker: ... "
|
||||
echo " - run_endorser: ... "
|
||||
echo " - log_endorser: ... "
|
||||
}
|
||||
|
||||
command="$1"
|
||||
shift
|
||||
|
||||
case "$command" in
|
||||
init)
|
||||
init "$@"
|
||||
;;
|
||||
run_node)
|
||||
run_node "$@"
|
||||
;;
|
||||
check_node)
|
||||
check_node
|
||||
;;
|
||||
wait_node)
|
||||
if ! check_node; then
|
||||
echo "The tezos node is not running!"
|
||||
exit 1
|
||||
fi
|
||||
wait_for_the_node_to_be_bootstraped
|
||||
may_create_identity
|
||||
;;
|
||||
stop_node)
|
||||
stop_node
|
||||
;;
|
||||
log_node)
|
||||
log_node
|
||||
;;
|
||||
run_baker)
|
||||
run_baker "$@"
|
||||
;;
|
||||
check_baker)
|
||||
check_baker
|
||||
;;
|
||||
stop_baker)
|
||||
stop_baker
|
||||
;;
|
||||
log_baker)
|
||||
log_baker
|
||||
;;
|
||||
run_endorser)
|
||||
run_endorser "$@"
|
||||
;;
|
||||
check_endorser)
|
||||
check_endorser
|
||||
;;
|
||||
stop_endorser)
|
||||
stop_endorser
|
||||
;;
|
||||
log_endorser)
|
||||
log_endorser
|
||||
;;
|
||||
client)
|
||||
run_client "$@"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac
|
@ -25,11 +25,20 @@ let call_error_service1 rpc_config s block a1 =
|
||||
|
||||
let forge_block
|
||||
rpc_config block net_id ?(timestamp = Time.now ()) command fitness =
|
||||
let block =
|
||||
match block with
|
||||
| `Prevalidation -> `Head 0
|
||||
| block -> block in
|
||||
Client_blocks.get_block_hash rpc_config block >>=? fun pred ->
|
||||
Client_node_rpcs.Blocks.level rpc_config block >>=? fun level ->
|
||||
let proto_level =
|
||||
match command with
|
||||
| Data.Command.Activate _ -> 1
|
||||
| Data.Command.Activate_testnet (_,_) -> 0 in
|
||||
call_service1 rpc_config
|
||||
Services.Forge.block block
|
||||
((net_id, Int32.succ level, 1, pred, timestamp, fitness), command)
|
||||
((net_id, Int32.succ level, proto_level,
|
||||
pred, timestamp, fitness), command)
|
||||
|
||||
let mine rpc_config ?timestamp block command fitness seckey =
|
||||
Client_blocks.get_block_info rpc_config block >>=? fun bi ->
|
||||
|
@ -146,7 +146,7 @@ let versions =
|
||||
let open P2p.Version in
|
||||
[ { name = "TEZOS" ;
|
||||
major = 0 ;
|
||||
minor = 0 ;
|
||||
minor = 5 ;
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -54,8 +54,8 @@ let default = {
|
||||
voting_period_length = 32768l ;
|
||||
time_before_reward =
|
||||
Period_repr.of_seconds_exn
|
||||
(* One year in seconds *)
|
||||
Int64.(mul 365L (mul 24L 3600L)) ;
|
||||
(* One year in seconds *)
|
||||
Int64.(mul 365L (mul 24L 3600L)) ;
|
||||
slot_durations =
|
||||
List.map Period_repr.of_seconds_exn [ 60L ] ;
|
||||
first_free_mining_slot = 16 ;
|
||||
|
Loading…
Reference in New Issue
Block a user