Skip to content

Commit

Permalink
Merge pull request #812 from serokell/krendelhoff/#800-add-support-24.04
Browse files Browse the repository at this point in the history
[#800] Add support for ubuntu 24.04 and fedora 40
  • Loading branch information
krendelhoff2 authored Jul 18, 2024
2 parents 7782dd0 + 8990783 commit 6fddcca
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 96 deletions.
1 change: 0 additions & 1 deletion baking/src/tezos_baking/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def pprint_options(self):
networks = {
"mainnet": "Main Tezos network",
"ghostnet": "Long running test network, currently using the Paris Tezos protocol",
"paris2net": "Test network using the PtParisB Tezos protocol",
"pariscnet": "Test network using the PsParisC Tezos protocol",
}

Expand Down
105 changes: 42 additions & 63 deletions baking/src/tezos_baking/tezos_setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ def network_name_or_teztnets_url(network):
id="network",
prompt="Which Tezos network would you like to use?\nCurrently supported:",
help="The selected network will be used to set up all required services.\n"
"The currently supported protocol is PtParisB (used on `paris2net`, `ghostnet, and `mainnet`)\n"
"and PsParisC (used on `pariscnet`, is going to be used on `ghostnet`, and `mainnet`).\n"
"The currently supported protocol is PsParisC (used on `pariscnet`, `ghostnet`, and `mainnet`).\n"
"Keep in mind that you must select the test network (e.g. ghostnet)\n"
"if you plan on baking with a faucet JSON file.\n",
options=networks,
Expand Down Expand Up @@ -861,81 +860,61 @@ def get_staked_balance(pkh):
).stdout.decode("utf-8")
return json.loads(output)

def get_adaptive_issuance_launch_cycle():
output = get_proc_output(
f"curl {self.config['node_rpc_endpoint']}/chains/main/blocks/head/context/adaptive_issuance_launch_cycle"
).stdout.decode("utf-8")
return json.loads(output)

def get_current_cycle():
output = get_proc_output(
f"curl {self.config['node_rpc_endpoint']}/chains/main/blocks/head/metadata"
).stdout.decode("utf-8")
return json.loads(output)["level_info"]["cycle"]

tezos_client_options = self.get_tezos_client_options()
baker_alias = self.config["baker_alias"]
baker_key_hash = self.config["baker_key_hash"]

adaptive_issuance_launch_cycle = get_adaptive_issuance_launch_cycle()

current_cycle = get_current_cycle()
minimal_frozen_stake = get_minimal_frozen_stake()

# TODO remove this check when ParisB protocol is activated at mainnet
if adaptive_issuance_launch_cycle is not None and int(current_cycle) >= int(
adaptive_issuance_launch_cycle
):
minimal_frozen_stake = get_minimal_frozen_stake()
staked_balance = get_staked_balance(baker_key_hash)

staked_balance = get_staked_balance(baker_key_hash)
if int(staked_balance) < int(minimal_frozen_stake):

if int(staked_balance) < int(minimal_frozen_stake):
print()

self.query_step(
get_stake_tez_query(staked_balance, minimal_frozen_stake)
)
self.query_step(get_stake_tez_query(staked_balance, minimal_frozen_stake))

print_and_log(f"Staking {self.config['stake_tez']}Tz...")
print_and_log(f"Staking {self.config['stake_tez']}Tz...")

if self.check_ledger_use():
ledger_app = "Wallet"
print(f"Please open the Tezos {ledger_app} app on your ledger.")
print(
color(
"Please note, that if you are using Tezos Wallet app of version 3.0.0 or higher,\n"
'you need to enable "expert mode" in the Tezos Wallet app settings on the Ledger device.',
color_yellow,
)
)
print(
color(
f"Waiting for the Tezos {ledger_app} to be opened...",
color_green,
),
if self.check_ledger_use():
ledger_app = "Wallet"
print(f"Please open the Tezos {ledger_app} app on your ledger.")
print(
color(
"Please note, that if you are using Tezos Wallet app of version 3.0.0 or higher,\n"
'you need to enable "expert mode" in the Tezos Wallet app settings on the Ledger device.',
color_yellow,
)
wait_for_ledger_app(ledger_app, self.config["client_data_dir"])
print(
color(
"Waiting for your response to the prompt on your Ledger Device...",
color_green,
)
)
print(
color(
f"Waiting for the Tezos {ledger_app} to be opened...",
color_green,
),
)
wait_for_ledger_app(ledger_app, self.config["client_data_dir"])
print(
color(
"Waiting for your response to the prompt on your Ledger Device...",
color_green,
)

get_proc_output(
f"sudo -u tezos {suppress_warning_text} octez-client {tezos_client_options} "
f"stake {self.config['stake_tez']} for {baker_alias}"
)

if self.check_ledger_use():
ledger_app = "Baking"
print(f"Please reopen the Tezos {ledger_app} app on your ledger.")
print(
color(
f"Waiting for the Tezos {ledger_app} to be opened...",
color_green,
),
)
wait_for_ledger_app(ledger_app, self.config["client_data_dir"])
get_proc_output(
f"sudo -u tezos {suppress_warning_text} octez-client {tezos_client_options} "
f"stake {self.config['stake_tez']} for {baker_alias}"
)

if self.check_ledger_use():
ledger_app = "Baking"
print(f"Please reopen the Tezos {ledger_app} app on your ledger.")
print(
color(
f"Waiting for the Tezos {ledger_app} to be opened...",
color_green,
),
)
wait_for_ledger_app(ledger_app, self.config["client_data_dir"])

def register_baker(self):
print()
Expand Down
2 changes: 1 addition & 1 deletion baking/src/tezos_baking/tezos_voting_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def fill_voting_period_info(self):
raise KeyboardInterrupt

self.config["amendment_phase"] = (
re.search(b'Current period: "(\w+)"', info).group(1).decode("utf-8")
re.search(b'Current period: "(\\w+)"', info).group(1).decode("utf-8")
)
self.config["proposal_hashes"] = [
phash.decode() for phash in re.findall(protocol_hash_regex, info)
Expand Down
12 changes: 6 additions & 6 deletions baking/src/tezos_baking/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

# Regexes

secret_key_regex = b"(encrypted|unencrypted):(?:\w{54}|\w{88})"
address_regex = b"tz[123]\w{33}"
secret_key_regex = b"(encrypted|unencrypted):(?:\\w{54}|\\w{88})"
address_regex = b"tz[123]\\w{33}"
protocol_hash_regex = (
b"P[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{50}"
)
signer_uri_regex = b"((?:tcp|unix|https|http):\/\/.+)\/(tz[123]\w{33})\/?"
ledger_regex = b"ledger:\/\/[\w\-]+\/[\w\-]+\/[\w']+\/[\w']+"
derivation_path_regex = b"(?:bip25519|ed25519|secp256k1|P-256)\/[0-9]+h\/[0-9]+h"
signer_uri_regex = b"((?:tcp|unix|https|http):\\/\\/.+)\\/(tz[123]\\w{33})\\/?"
ledger_regex = b"ledger:\\/\\/[\\w\\-]+\\/[\\w\\-]+\\/[\\w']+\\/[\\w']+"
derivation_path_regex = b"(?:bip25519|ed25519|secp256k1|P-256)\\/[0-9]+h\\/[0-9]+h"


# Utilities
Expand Down Expand Up @@ -65,7 +65,7 @@ def get_systemd_service_env(service_name):
for env_file in find_systemd_env_files(sys_show):
with open(env_file, "r") as f:
for line in f:
env_def = re.search("^(\w+)=(.*)\n", line)
env_def = re.search("^(\\w+)=(.*)\n", line)
if env_def is not None:
env_var = env_def.group(1)
var_val = env_def.group(2).strip('"')
Expand Down
2 changes: 1 addition & 1 deletion baking/src/tezos_baking/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def unencrypted_secret_key(input):
# To be validated, the input should adhere to the derivation path format:
# [0-9]+h/[0-9]+h
def derivation_path(input):
derivation_path_regex_str = "[0-9]+h\/[0-9]+h"
derivation_path_regex_str = "[0-9]+h\\/[0-9]+h"
match = re.match(derivation_path_regex_str, input.strip())
if not bool(match):
raise ValueError(
Expand Down
4 changes: 2 additions & 2 deletions baking/src/tezos_baking/wizard_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_key_address(tezos_client_options, key_alias):
+ ledger_regex
+ b")|(?:"
+ secret_key_regex
+ b")|(?:remote\:"
+ b")|(?:remote\\:"
+ address_regex
+ b")"
)
Expand All @@ -76,7 +76,7 @@ def wait_for_ledger_app(ledger_app, client_dir):
ledgers_derivations = {}
for ledger_derivation in re.findall(ledger_regex, output):
ledger_url = (
re.search(b"ledger:\/\/[\w\-]+\/", ledger_derivation).group(0).decode()
re.search(b"ledger:\\/\\/[\\w\\-]+\\/", ledger_derivation).group(0).decode()
)
derivation_path = (
re.search(derivation_path_regex, ledger_derivation).group(0).decode()
Expand Down
2 changes: 1 addition & 1 deletion docker/build/fedora/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def build_fedora(args=None) -> List[str]:

# copr build infrastructure uses latest stable fedora and `mock` for builds
# so we should also keep that way
images = ["39"]
images = ["40"]

packages_to_build = get_packages_to_build(args.packages)

Expand Down
2 changes: 1 addition & 1 deletion docker/package/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN if [ "$dist" = "focal" ]; then apt-get install -y dh-systemd; fi

RUN install -m 0755 /usr/bin/python3 /usr/bin/builder

RUN add-apt-repository ppa:ubuntu-mozilla-security/rust-next -y && apt-get update -y
RUN if [ "$dist" != "noble"]; then add-apt-repository ppa:ubuntu-mozilla-security/rust-next -y && apt-get update -y; fi
RUN apt-get -y install cargo opam

ENV USER dockerbuilder
Expand Down
6 changes: 3 additions & 3 deletions docker/package/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def gen_control_file(self, build_deps, run_deps, ubuntu_version, out):
Section: utils
Priority: optional
Maintainer: {self.meta.maintainer}
Build-Depends: debhelper (>=9), {"dh-systemd (>= 1.5), " if ubuntu_version != "jammy" else ""} autotools-dev, {str_build_deps}
Build-Depends: debhelper (>=9), {"dh-systemd (>= 1.5), " if ubuntu_version == "focal" else ""} autotools-dev, {str_build_deps}
Standards-Version: 3.9.6
Homepage: https://gitlab.com/tezos/tezos/
Expand Down Expand Up @@ -506,7 +506,7 @@ def gen_control_file(self, build_deps, run_deps, ubuntu_version, out):
Section: utils
Priority: optional
Maintainer: {self.meta.maintainer}
Build-Depends: debhelper (>=9), {"dh-systemd (>= 1.5), " if ubuntu_version != "jammy" else ""} autotools-dev, wget
Build-Depends: debhelper (>=9), {"dh-systemd (>= 1.5), " if ubuntu_version == "focal" else ""} autotools-dev, wget
Standards-Version: 3.9.6
Homepage: https://gitlab.com/tezos/tezos/
Expand Down Expand Up @@ -693,7 +693,7 @@ def gen_control_file(self, build_deps, run_deps, ubuntu_version, out):
Section: utils
Priority: optional
Maintainer: {self.meta.maintainer}
Build-Depends: debhelper (>=11), {"dh-systemd (>= 1.5), " if ubuntu_version != "jammy" else ""} python3-all, autotools-dev, dh-python, python3-setuptools
Build-Depends: debhelper (>=11), {"dh-systemd (>= 1.5), " if ubuntu_version == "focal" else ""} python3-all, autotools-dev, dh-python, python3-setuptools
Standards-Version: 3.9.6
Homepage: https://gitlab.com/tezos/tezos/
X-Python3-Version: >= 3.8
Expand Down
2 changes: 0 additions & 2 deletions docker/package/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
networks = {
"mainnet": "mainnet",
"ghostnet": "ghostnet",
"paris2net": "https://teztnets.com/paris2net",
"pariscnet": "https://teztnets.com/pariscnet",
}
networks_protos = {
"mainnet": ["PtParisB", "PsParisC"],
"ghostnet": ["PtParisB", "PsParisC"],
"paris2net": ["PtParisB"],
"pariscnet": ["PsParisC"],
}

Expand Down
6 changes: 4 additions & 2 deletions docker/supported_versions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"ubuntu": [
"focal",
"jammy"
"jammy",
"noble"
],
"fedora": [
"39"
"39",
"40"
]
}
2 changes: 1 addition & 1 deletion docs/baking.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ that you can use by following the [installation instructions](https://www.raspbe
In order to run a baking instance, you'll need the following Tezos binaries:
`tezos-client`, `tezos-node`, `tezos-baker-<proto>`.

The currently supported protocol is `ParisB` (used on `paris2net`, `ghostnet` and `mainnet`) and PsParisC (used on `pariscnet`, is going to be used on `ghostnet`, and `mainnet`).
The currently supported protocol is `PsParisC` (used on `pariscnet`, `ghostnet`, and `mainnet`).
Also, note that the corresponding packages have protocol
suffix in lowercase, e.g. the list of available baker packages can be found
[here](https://launchpad.net/~serokell/+archive/ubuntu/tezos/+packages?field.name_filter=tezos-baker&field.status_filter=published).
Expand Down
3 changes: 2 additions & 1 deletion docs/support-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ supported by Canonical.
Currently, these are versions:
* 20.04 LTS (Focal Fossa)
* 22.04 LTS (Jammy Jellyfish)
* 24.04 LTS (Noble Numbat)

There are packages for `arm64` and `amd64` architectures.

Expand All @@ -37,8 +38,8 @@ There are packages for `arm64` and `amd64` architectures.
We aim to provide packages for all [currently supported Fedora releases](https://docs.fedoraproject.org/en-US/releases/).

Currently, these are versions:
* Fedora 38
* Fedora 39
* Fedora 40

There are packages for `x86_64` and `aarch64` architectures.

Expand Down
3 changes: 1 addition & 2 deletions docs/systemd.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ networks.

`tezos-node` packages provide multiple services out of the box:
- `tezos-node-pariscnet`
- `tezos-node-paris2net`
- `tezos-node-ghostnet`
- `tezos-node-mainnet`

Expand All @@ -78,7 +77,7 @@ Also, there are `tezos-node-<network>` binary aliases that are equivalent to
running `tezos-node` with [the service options](./configuration.md) given.

In addition to node services where the config is predefined to a specific network
(e.g. `tezos-node-mainnet` or `tezos-node-paris2net`), it's possible to run
(e.g. `tezos-node-mainnet` or `tezos-node-pariscnet`), it's possible to run
`tezos-node-custom` service.

Another case for running multiple similar systemd services is when one wants to have
Expand Down
10 changes: 1 addition & 9 deletions tests/systemd/services_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,8 @@ def test_node_mainnet_service():
node_service_test("mainnet")


def test_node_paris2net_service():
node_service_test("paris2net")


def test_baking_paris2net_service():
baking_service_test("paris2net", ["PtParisB"])


def test_baking_mainnet_service():
baking_service_test("mainnet", ["PtParisB"])
baking_service_test("mainnet", ["PsParisC"])


def test_node_pariscnet_service():
Expand Down

0 comments on commit 6fddcca

Please sign in to comment.