Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

per-baker toggle vote customization #552

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions charts/tezos/scripts/baker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ BAKER_EXTRA_ARGS_FROM_ENV=${BAKER_EXTRA_ARGS}

proto_command="{{ .command_in_tpl }}"

per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json
my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json

if [ $(cat $per_block_vote_file) == "null" ]; then
cat << EOF
You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example:
Expand All @@ -22,8 +25,6 @@ EOF
fi
extra_args="--votefile ${per_block_vote_file}"

my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

if [ "${my_baker_account}" == "" ]; then
while true; do
printf "This container is not baking, but exists "
Expand Down
6 changes: 4 additions & 2 deletions charts/tezos/templates/configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ metadata:
{{- if (include "tezos.hasPerBlockVotes" .) }}
apiVersion: v1
data:
{{- range .Values.protocols }}
{{ .command }}-per-block-votes.json: {{ .vote | toJson | quote }}
{{- range $k, $v := .Values.accounts }}
{{- range ( $v.protocols | default $.Values.protocols ) }}
{{ $k }}-{{ .command }}-per-block-votes.json: {{ .vote | toJson | quote }}
{{- end }}
{{- end }}
kind: ConfigMap
metadata:
Expand Down
11 changes: 10 additions & 1 deletion charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ bootstrap_mutez: "4000000000000"
accounts: {}
#
# `accounts` is a map where keys are account aliases and values are maps of
# fields `key`, `is_bootstrap_baker_account`, `bootstrap_balance` and `signer_url`.
# fields `key`, `is_bootstrap_baker_account`, `bootstrap_balance`, `signer_url`
# and `protocols`.
#
# The `key` field can be set to a public or private key. For a bootstrap baker,
# it must be set to a private key. The key type will be recognized automatically,
Expand All @@ -53,6 +54,10 @@ accounts: {}
# node but they will not be bootstrap accounts. If you don't set a bootstrap
# balance, it will default to the `bootstrap_mutez` field above.
#
# The `protocols` fields overrides the top-level `protocols` field described
# below and has the same syntax. This allows to set specific per-block votes per
# baker.
#
# Example:
#
# ```
Expand All @@ -66,6 +71,10 @@ accounts: {}
# key: edpk...
# is_bootstrap_baker_account: false
# bootstrap_balance: "4000000000000"
# protocols:
# - command: PtLimaPt
# vote:
# liquidity_baking_toggle_vote: "on"
# ```
#
# A public key account can contain a url to a remote signer that signs with the
Expand Down
36 changes: 20 additions & 16 deletions test/charts/private-chain.expect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ metadata:
# Source: tezos-chain/templates/configs.yaml
apiVersion: v1
data:
013-PtJakart-per-block-votes.json: "{\"liquidity_baking_toggle_vote\":\"pass\"}"
kind: ConfigMap
metadata:
name: per-block-votes
Expand Down Expand Up @@ -575,7 +574,10 @@ spec:

proto_command="013-PtJakart"

per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json
my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json

if [ $(cat $per_block_vote_file) == "null" ]; then
cat << EOF
You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example:
Expand All @@ -588,8 +590,6 @@ spec:
fi
extra_args="--votefile ${per_block_vote_file}"

my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

if [ "${my_baker_account}" == "" ]; then
while true; do
printf "This container is not baking, but exists "
Expand Down Expand Up @@ -642,7 +642,10 @@ spec:

proto_command="013-PtJakart"

per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json
my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json

if [ $(cat $per_block_vote_file) == "null" ]; then
cat << EOF
You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example:
Expand All @@ -655,8 +658,6 @@ spec:
fi
extra_args="--votefile ${per_block_vote_file}"

my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

if [ "${my_baker_account}" == "" ]; then
while true; do
printf "This container is not baking, but exists "
Expand Down Expand Up @@ -709,7 +710,10 @@ spec:

proto_command="013-PtJakart"

per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json
my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json

if [ $(cat $per_block_vote_file) == "null" ]; then
cat << EOF
You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example:
Expand All @@ -722,8 +726,6 @@ spec:
fi
extra_args="--votefile ${per_block_vote_file}"

my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

if [ "${my_baker_account}" == "" ]; then
while true; do
printf "This container is not baking, but exists "
Expand Down Expand Up @@ -776,7 +778,10 @@ spec:

proto_command="013-PtJakart"

per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json
my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json

if [ $(cat $per_block_vote_file) == "null" ]; then
cat << EOF
You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example:
Expand All @@ -789,8 +794,6 @@ spec:
fi
extra_args="--votefile ${per_block_vote_file}"

my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

if [ "${my_baker_account}" == "" ]; then
while true; do
printf "This container is not baking, but exists "
Expand Down Expand Up @@ -843,7 +846,10 @@ spec:

proto_command="013-PtJakart"

per_block_vote_file=/etc/tezos/per-block-votes/${proto_command}-per-block-votes.json
my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

per_block_vote_file=/etc/tezos/per-block-votes/${my_baker_account}-${proto_command}-per-block-votes.json

if [ $(cat $per_block_vote_file) == "null" ]; then
cat << EOF
You must pass per-block-votes (such as liquidity_baking_toggle_vote) in values.yaml, for example:
Expand All @@ -856,8 +862,6 @@ spec:
fi
extra_args="--votefile ${per_block_vote_file}"

my_baker_account="$(sed -n "$(($BAKER_INDEX + 1))p" < /etc/tezos/baker-account )"

if [ "${my_baker_account}" == "" ]; then
while true; do
printf "This container is not baking, but exists "
Expand Down