Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Add wait for max stake command #13532

Merged
merged 1 commit into from
Nov 12, 2020
Merged

Conversation

sakridge
Copy link
Contributor

Problem

Bash logic of wait for stake to come down below 66% is broken and causing all the automation tests to fail.

Summary of Changes

Implement wait-for-max-stake as a CLI function and use that for the automation script.

Fixes #

Comment on lines -74 to -82
bootstrap_validator_validator_info="$(ssh "${sshOptions[@]}" "${validatorIpList[0]}" '$HOME/.cargo/bin/solana --url http://127.0.0.1:8899 validators | grep "$($HOME/.cargo/bin/solana-keygen pubkey ~/solana/config/bootstrap-validator/identity.json)"')"
bootstrap_validator_stake_percentage="$(echo "$bootstrap_validator_validator_info" | awk '{gsub(/[\(,\),\%]/,""); print $9}')"

if [[ $(echo "$bootstrap_validator_stake_percentage < $max_stake" | bc) -ne 0 ]]; then
echo "Bootstrap validator stake has fallen below $max_stake to $bootstrap_validator_stake_percentage"
break
fi
echo "Max bootstrap validator stake: $max_stake. Current stake: $bootstrap_validator_stake_percentage. Sleeping 30s for stake to distribute."
sleep 30
Copy link
Contributor

Choose a reason for hiding this comment

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

👢 glad to see this go

Copy link
Contributor

Choose a reason for hiding this comment

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

Same 🎉

Though I thought I replaced that awk/gsub with something more resilient a few weeks ago 🤔

@sakridge sakridge force-pushed the wait-for-stake branch 2 times, most recently from b2274b7 to 93d6724 Compare November 11, 2020 20:18
cli/src/cli.rs Outdated Show resolved Hide resolved
Comment on lines -74 to -82
bootstrap_validator_validator_info="$(ssh "${sshOptions[@]}" "${validatorIpList[0]}" '$HOME/.cargo/bin/solana --url http://127.0.0.1:8899 validators | grep "$($HOME/.cargo/bin/solana-keygen pubkey ~/solana/config/bootstrap-validator/identity.json)"')"
bootstrap_validator_stake_percentage="$(echo "$bootstrap_validator_validator_info" | awk '{gsub(/[\(,\),\%]/,""); print $9}')"

if [[ $(echo "$bootstrap_validator_stake_percentage < $max_stake" | bc) -ne 0 ]]; then
echo "Bootstrap validator stake has fallen below $max_stake to $bootstrap_validator_stake_percentage"
break
fi
echo "Max bootstrap validator stake: $max_stake. Current stake: $bootstrap_validator_stake_percentage. Sleeping 30s for stake to distribute."
sleep 30
Copy link
Contributor

Choose a reason for hiding this comment

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

Same 🎉

Though I thought I replaced that awk/gsub with something more resilient a few weeks ago 🤔

system-test/automation_utils.sh Outdated Show resolved Hide resolved
client/src/rpc_client.rs Show resolved Hide resolved
@sakridge sakridge force-pushed the wait-for-stake branch 6 times, most recently from c3e25f9 to ffa0669 Compare November 11, 2020 21:56
@codecov
Copy link

codecov bot commented Nov 12, 2020

Codecov Report

Merging #13532 (7e5a3f3) into master (38f15e4) will decrease coverage by 0.0%.
The diff coverage is 16.2%.

@@            Coverage Diff            @@
##           master   #13532     +/-   ##
=========================================
- Coverage    82.1%    82.1%   -0.1%     
=========================================
  Files         378      378             
  Lines       90604    90641     +37     
=========================================
+ Hits        74424    74426      +2     
- Misses      16180    16215     +35     

@sakridge sakridge merged commit 598e5f5 into solana-labs:master Nov 12, 2020
@sakridge sakridge deleted the wait-for-stake branch November 12, 2020 21:48
t-nelson added a commit to t-nelson/solana that referenced this pull request Nov 30, 2020
@t-nelson t-nelson added the v1.4 label Dec 15, 2020
mergify bot pushed a commit that referenced this pull request Dec 15, 2020
t-nelson pushed a commit that referenced this pull request Dec 16, 2020
mergify bot added a commit that referenced this pull request Dec 16, 2020
(cherry picked from commit 598e5f5)

Co-authored-by: sakridge <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants