Add USE_PRYSM_MODERN environment variable ()

* Add USE_PRYSM_MODERN environment variable

* fix deepsource

* change naming convention

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Potuz 2022-03-09 18:00:12 -03:00 committed by GitHub
parent 7ce712bb5e
commit 329a4a600c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 7 deletions

View File

@ -23,6 +23,11 @@ echo To specify a specific release version:
echo set USE_PRYSM_VERSION=v1.0.0-alpha3
echo to resume using the latest release:
echo set USE_PRYSM_VERSION=
echo.
echo To specify a non-portable version of BLST:
echo set USE_PRYSM_MODERN=1
echo to resume using the portable version:
echo unset USE_PRYSM_MODERN=
echo.
echo To automatically restart crashed processes:
echo set PRYSM_AUTORESTART=true^& .\prysm.bat beacon-chain
@ -58,7 +63,11 @@ IF defined USE_PRYSM_VERSION (
)
echo Using prysm version %prysm_version%.
set BEACON_CHAIN_REAL=%wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%
IF defined USE_PRYSM_MODERN (
set BEACON_CHAIN_REAL=%wrapper_dir%\beacon-chain-%prysm_version%-modern-%system%-%arch%
) else (
set BEACON_CHAIN_REAL=%wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%
)
set VALIDATOR_REAL=%wrapper_dir%\validator-%prysm_version%-%system%-%arch%
set CLIENT_STATS_REAL=%wrapper_dir%\client-stats-%prysm_version%-%system%-%arch%
@ -67,14 +76,25 @@ if "%~1"=="beacon-chain" (
echo Beacon chain is up to date.
) else (
echo Downloading beacon chain %prysm_version% to %BEACON_CHAIN_REAL% %reason%
for /f "delims=" %%i in ('curl --silent -o nul -w "%%{http_code}" https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch% ') do set "http=%%i" && echo %%i
if defined USE_PRYSM_MODERN (
for /f "delims=" %%i in ('curl --silent -o nul -w "%%{http_code}" https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-modern-%system%-%arch% ') do set "http=%%i" && echo %%i
) else (
for /f "delims=" %%i in ('curl --silent -o nul -w "%%{http_code}" https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch% ') do set "http=%%i" && echo %%i
)
if "!http!"=="404" (
echo No prysm beacon chain found for %prysm_version%
exit /b 1
)
curl -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch% -o %BEACON_CHAIN_REAL%
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sha256 -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sha256
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sig -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sig
if defined USE_PRYSM_MODERN (
curl -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-modern-%system%-%arch% -o %BEACON_CHAIN_REAL%
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-modern-%system%-%arch%.sha256 -o %wrapper_dir%\beacon-chain-%prysm_version%-modern-%system%-%arch%.sha256
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-modern-%system%-%arch%.sig -o %wrapper_dir%\beacon-chain-%prysm_version%-modern-%system%-%arch%.sig
) else (
curl -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch% -o %BEACON_CHAIN_REAL%
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sha256 -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sha256
curl --silent -L https://prysmaticlabs.com/releases/beacon-chain-%prysm_version%-%system%-%arch%.sig -o %wrapper_dir%\beacon-chain-%prysm_version%-%system%-%arch%.sig
)
)
)

View File

@ -11,6 +11,8 @@ set -eu
# Downloaded binaries are saved to ./dist.
# Use USE_PRYSM_VERSION to specify a specific release version.
# Example: USE_PRYSM_VERSION=v0.3.3 ./prysm.sh beacon-chain
# Use USE_PRYSM_MODERN to specify a non-portable version of BLST
# Example: USE_PRYSM_MODERN=true ./prysm.sh beacon-chain
readonly PRYLABS_SIGNING_KEY=0AE0051D647BA3C1A917AF4072E33E4DF1A5036E
@ -173,14 +175,22 @@ get_prysm_version
color "37" "Latest Prysm version is $prysm_version."
BEACON_CHAIN_REAL="${wrapper_dir}/beacon-chain-${prysm_version}-${system}-${arch}"
if [ "${USE_PRYSM_MODERN:=false}" = "true" ]; then
BEACON_CHAIN_REAL="${wrapper_dir}/beacon-chain-${prysm_version}-modern-${system}-${arch}"
else
BEACON_CHAIN_REAL="${wrapper_dir}/beacon-chain-${prysm_version}-${system}-${arch}"
fi
VALIDATOR_REAL="${wrapper_dir}/validator-${prysm_version}-${system}-${arch}"
CLIENT_STATS_REAL="${wrapper_dir}/client-stats-${prysm_version}-${system}-${arch}"
if [[ $1 == beacon-chain ]]; then
if [[ ! -x $BEACON_CHAIN_REAL ]]; then
color "34" "Downloading beacon chain@${prysm_version} to ${BEACON_CHAIN_REAL} (${reason})"
file=beacon-chain-${prysm_version}-${system}-${arch}
if [ "${USE_PRYSM_MODERN}" = "true" ]; then
file=beacon-chain-${prysm_version}-modern-${system}-${arch}
else
file=beacon-chain-${prysm_version}-${system}-${arch}
fi
res=$(curl -w '%{http_code}\n' -f -L "https://prysmaticlabs.com/releases/${file}" -o "$BEACON_CHAIN_REAL" | ( grep 404 || true ) )
if [[ $res == 404 ]];then
echo "No prysm beacon chain found for ${prysm_version},(${file}) exit"