Skip to content

Commit

Permalink
Use local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Jun 13, 2023
1 parent 38dcc88 commit 0841c06
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions core/packages/test/scripts/configure-beacon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ source scripts/xcm-helper.sh
config_beacon_checkpoint()
{
pushd $root_dir
check_point_call=$($relay_bin generate-beacon-checkpoint --spec $active_spec --url $beacon_endpoint_http)
local check_point_call=$($relay_bin generate-beacon-checkpoint --spec $active_spec --url $beacon_endpoint_http)
popd
send_governance_transact_from_relaychain $bridgehub_para_id "$check_point_call" 180000000000 900000
}

wait_beacon_chain_ready()
{
initial_beacon_block=""
local initial_beacon_block=""
while [ -z "$initial_beacon_block" ] || [ "$initial_beacon_block" == "0x0000000000000000000000000000000000000000000000000000000000000000" ]
do
echo "Waiting for beacon chain to finalize to get initial block..."
Expand Down
16 changes: 8 additions & 8 deletions core/packages/test/scripts/configure-beefy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ configure_beefy()

npx ts-node ./scripts/configure-beefy.ts

current_id=$(jq .validatorSets.current.id $beefy_state_file)
current_length=$(jq .validatorSets.current.length $beefy_state_file)
current_root=$(jq .validatorSets.current.root $beefy_state_file)
local current_id=$(jq .validatorSets.current.id $beefy_state_file)
local current_length=$(jq .validatorSets.current.length $beefy_state_file)
local current_root=$(jq .validatorSets.current.root $beefy_state_file)

next_id=$(jq .validatorSets.next.id $beefy_state_file)
next_length=$(jq .validatorSets.next.length $beefy_state_file)
next_root=$(jq .validatorSets.next.root $beefy_state_file)
local next_id=$(jq .validatorSets.next.id $beefy_state_file)
local next_length=$(jq .validatorSets.next.length $beefy_state_file)
local next_root=$(jq .validatorSets.next.root $beefy_state_file)

# remove double quote before cast
current_root=$(sed -e 's/^"//' -e 's/"$//' <<< $current_root)
next_root=$(sed -e 's/^"//' -e 's/"$//' <<< $next_root)
local current_root=$(sed -e 's/^"//' -e 's/"$//' <<< $current_root)
local next_root=$(sed -e 's/^"//' -e 's/"$//' <<< $next_root)

echo "Transact call to initialize BeefyClient"
# sometimes sending transact with cast will fail on the goerli network
Expand Down
7 changes: 4 additions & 3 deletions core/packages/test/scripts/deploy-ethereum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ start_geth() {
start_lodestar() {
if [ "$eth_network" == "localhost" ]; then
echo "Starting lodestar local node"
genesisHash=$(curl $eth_endpoint_http \
local genesisHash=$(curl $eth_endpoint_http \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": "1", "method": "eth_getBlockByNumber","params": ["0x0", false]}' | jq -r '.result.hash')
echo "genesisHash is: $genesisHash"
# use gdate here for raw macos without nix
local timestamp=""
if [[ "$(uname)" == "Darwin" && -z "${IN_NIX_SHELL:-}" ]]; then
timestamp=$(gdate -d'+10second' +%s)
else
Expand Down Expand Up @@ -69,7 +70,7 @@ start_lodestar() {
hack_beacon_client()
{
echo "Hack lodestar for faster slot time"
preset_minimal_config_file="$core_dir/node_modules/.pnpm/@lodestar+config@$lodestar_version/node_modules/@lodestar/config/lib/chainConfig/presets/minimal.js"
local preset_minimal_config_file="$core_dir/node_modules/.pnpm/@lodestar+config@$lodestar_version/node_modules/@lodestar/config/lib/chainConfig/presets/minimal.js"
if [[ "$(uname)" == "Darwin" && -z "${IN_NIX_SHELL:-}" ]]; then
gsed -i "s/SECONDS_PER_SLOT: 6/SECONDS_PER_SLOT: 1/g" $preset_minimal_config_file
else
Expand All @@ -82,7 +83,7 @@ deploy_local()
# 1. deploy execution client
echo "Starting execution node"
start_geth

echo "Waiting for geth API to be ready"
sleep 3

Expand Down
2 changes: 1 addition & 1 deletion core/packages/test/scripts/set-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ check_tool() {
}

wait_contract_deployed() {
ready=""
local ready=""
while [ -z "$ready" ]
do
if [ -f "$output_dir/contracts.json" ]; then
Expand Down

0 comments on commit 0841c06

Please sign in to comment.