Skip to content

Dev#511

Merged
yungwine merged 10 commits intomasterfrom
dev
Mar 9, 2026
Merged

Dev#511
yungwine merged 10 commits intomasterfrom
dev

Conversation

@yungwine
Copy link
Collaborator

@yungwine yungwine commented Mar 9, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes install/upgrade flows by removing legacy migration/rollback machinery and introducing an explicit Clang 21 installer to support TON builds, alongside a few CLI and subprocess output-handling tweaks.

Changes:

  • Add scripts/install_clang.sh and wire it into scripts/install.sh; adjust Debian/Ubuntu TON build deps accordingly.
  • Remove legacy migration + rollback code paths (Python + shell) and related CLI/translation entries.
  • Improve update submodule handling and adjust subprocess decoding error strategy in core wrappers.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
setup.py Stop packaging migration scripts under mytonctrl package data.
scripts/ton_installer.sh Remove Debian/Ubuntu clang package from dependencies list.
scripts/install_clang.sh New apt-based installer to provision Clang 21 and set it as default.
scripts/install.sh Download/run the new clang installer before building TON; remove VERSION migration stamping.
mytonctrl/scripts/update.sh Change clone/submodule update strategy (clone without recursive; later submodule update --init --recursive).
mytonctrl/resources/translate.json Remove rollback command translation.
mytonctrl/mytonctrl.py Remove rollback command + migrations bootstrap; improve download_archive_blocks arg handling.
mytonctrl/migrations/roll_back_001.sh Remove rollback migration script.
mytonctrl/migrations/migration_001.sh Remove migration script.
mytonctrl/migrate.py Remove migration runner module.
mytonctrl/console_cmd.py Add usage string for download_archive_blocks.
mytonctrl.py Remove legacy “migration entrypoint” script.
mytoncore/validator_console.py Change stdout/stderr decode error handling.
mytoncore/mytoncore.py Fix wallet address access ordering in ElectionEntry; remove rollback_modes.
mytoncore/liteclient.py Change stdout/stderr decode error handling.
mytoncore/fift.py Change stdout/stderr decode error handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

echo "Ubuntu/Debian Linux detected."
apt-get update
apt-get install -y build-essential curl git cmake clang libgflags-dev zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev python3-pip libsecp256k1-dev libsodium-dev liblz4-dev libjemalloc-dev automake libtool
apt-get install -y build-essential curl git cmake libgflags-dev zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev python3-pip libsecp256k1-dev libsodium-dev liblz4-dev libjemalloc-dev automake libtool
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Debian/Ubuntu you no longer install clang here, but the script later sets CC/CXX to clang/clang++ and requires them to be present. This works only when ton_installer.sh is invoked via scripts/install.sh (which runs install_clang.sh first), but ton_installer.sh can be run standalone and would then fail. Please either install clang here again (or verify clang is present and print actionable instructions / invoke install_clang.sh from within this Debian/Ubuntu branch).

Suggested change
apt-get install -y build-essential curl git cmake libgflags-dev zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev python3-pip libsecp256k1-dev libsodium-dev liblz4-dev libjemalloc-dev automake libtool
apt-get install -y build-essential curl git cmake clang libgflags-dev zlib1g-dev libssl-dev libreadline-dev libmicrohttpd-dev pkg-config libgsl-dev python3 python3-dev python3-pip libsecp256k1-dev libsodium-dev liblz4-dev libjemalloc-dev automake libtool

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +109
ln -sf /usr/bin/clang-21 /usr/bin/clang
ln -sf /usr/bin/clang++-21 /usr/bin/clang++
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script both registers clang-21 via update-alternatives and then force-overwrites /usr/bin/clang and /usr/bin/clang++ with symlinks. The symlinks can bypass alternatives and potentially break systems that manage clang via distro packages. Prefer using update-alternatives to select clang-21 (e.g., set the alternative) and avoid directly replacing /usr/bin/clang* symlinks.

Suggested change
ln -sf /usr/bin/clang-21 /usr/bin/clang
ln -sf /usr/bin/clang++-21 /usr/bin/clang++
update-alternatives --set clang /usr/bin/clang-21
update-alternatives --set clang++ /usr/bin/clang++-21

Copilot uses AI. Check for mistakes.
Comment on lines +216 to 219
wget https://raw.githubusercontent.com/${author}/${repo}/${branch}/scripts/install_clang.sh -O /tmp/install_clang.sh
bash /tmp/install_clang.sh
wget https://raw.githubusercontent.com/${author}/${repo}/${branch}/scripts/ton_installer.sh -O /tmp/ton_installer.sh
bash /tmp/ton_installer.sh -c ${config} -g ${ton_node_git_url} -v ${ton_node_version}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wget URLs here interpolate user-controlled --author/--repo/--branch without quoting, so values containing spaces can be split into additional wget arguments (e.g., altering output paths). Since this script runs as root and then executes the downloaded file, please quote the URL and consider validating these variables against an allowlist of safe characters (or disallow overriding entirely in non-dev installs).

Copilot uses AI. Check for mistakes.
Comment on lines +216 to +217
wget https://raw.githubusercontent.com/${author}/${repo}/${branch}/scripts/install_clang.sh -O /tmp/install_clang.sh
bash /tmp/install_clang.sh
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install_clang.sh is apt-based, but it's invoked unconditionally before ton_installer.sh. On non-Debian/Ubuntu distros supported by ton_installer.sh (e.g., RHEL/Arch), this will fail and abort the whole install due to set -e. Please gate the clang installer by distro/package-manager detection (or move clang installation logic into ton_installer.sh under the Debian/Ubuntu branch).

Suggested change
wget https://raw.githubusercontent.com/${author}/${repo}/${branch}/scripts/install_clang.sh -O /tmp/install_clang.sh
bash /tmp/install_clang.sh
# install_clang.sh is apt-based; only run it on systems with apt-get available
if command -v apt-get >/dev/null 2>&1; then
wget https://raw.githubusercontent.com/${author}/${repo}/${branch}/scripts/install_clang.sh -O /tmp/install_clang.sh
bash /tmp/install_clang.sh
fi

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +86
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 21 clang
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script downloads and executes llvm.sh directly from https://apt.llvm.org as root, which runs remote code without any integrity check beyond TLS and creates a supply-chain RCE risk if that endpoint or its trust chain is compromised. An attacker who can tamper with responses from apt.llvm.org could execute arbitrary commands on any host that runs this installer. Prefer installing LLVM via signed distro/LLVM APT packages configured explicitly (e.g., adding the repository and GPG key with verified checksums or pinned versions) instead of executing a mutable remote shell script.

Copilot uses AI. Check for mistakes.
@yungwine yungwine merged commit e298099 into master Mar 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants