Skip to content

Commit

Permalink
Merge branch 'main' into release/v5.0.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	server/start.go
#	types/version.go
  • Loading branch information
devon-chain committed Aug 18, 2023
2 parents b257a1f + 7f8203b commit e0fbda5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
2 changes: 2 additions & 0 deletions cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ func checkBlockchainData(bc blockchain, genesisId, privValidatorKeyFile string)
fmt.Printf("%sVersion: V2\n", SPACE)
} else if blockHeight < fxtypes.MainnetBlockHeightV4 {
fmt.Printf("%sVersion: v3\n", SPACE)
} else if blockHeight < fxtypes.MainnetBlockHeightV5 {
fmt.Printf("%sVersion: V4\n", SPACE)
}
}
if chainId == fxtypes.TestnetChainId {
Expand Down
21 changes: 15 additions & 6 deletions contrib/stats/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ function calc_upgrade_time() {

function show_validator_reward() {
local decimals=18
staking_token_denom=$(curl -s "$REST_RPC/cosmos/staking/v1beta1/params" | jq -r '.params.bond_denom')
{
echo "moniker#operator_address#jailed#status#commission_rate#self_delegated#3rd_party_delegated#block_reward#tx_fee_reward"
if [ "$staking_token_denom" == "$MINT_DENOM" ]; then
echo "operator_address#jailed#status#commission_rate#self_delegated#3rd_party_delegated#block_reward#moniker"
else
echo "operator_address#jailed#status#commission_rate#self_delegated#3rd_party_delegated#block_reward#tx_fee_reward#moniker"
fi
while read -r operator_address jailed status tokens commission_rate moniker; do
acc_address=$(curl -s "$REST_RPC/fx/auth/v1/bech32/$operator_address?prefix=${BECH32_PREFIX}" | jq -r '.address')
self_delegated=$(curl -s "$REST_RPC/cosmos/staking/v1beta1/delegations/$acc_address" | jq -r '.delegation_responses[]|select(.delegation.validator_address == "'"$operator_address"'")|.balance.amount')
Expand All @@ -100,12 +105,16 @@ function show_validator_reward() {
party_delegated=$(echo "$tokens-$self_delegated" | bc)

commission_rate=$(printf "%.2f" "$(echo "scale=2;($commission_rate * 100)/1" | bc -l)")
self_delegated=$(echo "$self_delegated / 10^$decimals" | bc)
party_delegated=$(echo "$party_delegated / 10^$decimals" | bc)
block_reward=$(echo "$block_reward / 10^$decimals" | bc)
echo "$moniker#$operator_address#$jailed#$status#$commission_rate%#$self_delegated#$party_delegated#$block_reward#$tx_fee_reward"
self_delegated=$(echo "scale=2;$self_delegated / 10^$decimals" | bc)
party_delegated=$(echo "scale=2;$party_delegated / 10^$decimals" | bc)
block_reward=$(echo "scale=2;$block_reward / 10^$decimals" | bc)
if [ "$staking_token_denom" == "$MINT_DENOM" ]; then
echo "$operator_address#$jailed#$status#$commission_rate%#$self_delegated#$party_delegated#$block_reward#$moniker"
else
echo "$operator_address#$jailed#$status#$commission_rate%#$self_delegated#$party_delegated#$block_reward#$tx_fee_reward#$moniker"
fi
done < <(curl -s "$REST_RPC/cosmos/staking/v1beta1/validators" | jq -r '.validators[]|"\(.operator_address) \(.jailed) \(.status) \(.tokens) \(.commission.commission_rates.rate) \(.description.moniker)"')
} | column -t -s"#"
} | column -t -R -s"#"
}

function show_validator_vote() {
Expand Down
7 changes: 5 additions & 2 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ func checkMainnetAndBlock(genesisDoc *tmtypes.GenesisDoc, config *tmcfg.Config)
return nil
}
if blockStore.Height() < fxtypes.MainnetBlockHeightV2 {
return errors.New("invalid version: The current block height is less than the fxv2 upgrade height(8_756_000), " +
return errors.New("invalid version: The current block height is less than the fxv2 upgrade height(5_713_000), " +
"sync block from scratch please use use fxcored v1.x.x")
}
if blockStore.Height() < fxtypes.MainnetBlockHeightV3 {
Expand All @@ -660,7 +660,10 @@ func checkMainnetAndBlock(genesisDoc *tmtypes.GenesisDoc, config *tmcfg.Config)
return errors.New("invalid version: The current block height is less than the v4.2.0 upgrade height(10_477_500)," +
" please use the v3.x.x version to synchronize the block or download the latest snapshot")
}
return errors.New("invalid version: The current version is not released, please use the corresponding version")
if blockStore.Height() < fxtypes.MainnetBlockHeightV5 {
return errors.New("invalid version: The current block height is less than the v5.0.0 upgrade height(11_601_700)," +
" please use the v4.x.x version to synchronize the block or download the latest snapshot")
}
}
return nil
}
13 changes: 7 additions & 6 deletions types/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ const (
MainnetBlockHeightV2 = 5_713_000
MainnetBlockHeightV3 = 8_756_000
MainnetBlockHeightV4 = 10_477_500
MainnetBlockHeightV5 = 11_601_700
)

// testnet
const (
TestnetChainId = "dhobyghaut"
testnetEvmChainID = 90001
TestnetGenesisHash = "06D0A9659E1EC5B0E57E8E2E5F1B1266094808BC9B4081E1A55011FEF4586ACE"
TestnetBlockHeightV2 = 3418880
TestnetBlockHeightV3 = 6578000
TestnetBlockHeightV4 = 8088000
TestnetBlockHeightV41 = 8376000
TestnetBlockHeightV42 = 8481000
TestnetBlockHeightV5 = 9773000
TestnetBlockHeightV2 = 3_418_880
TestnetBlockHeightV3 = 6_578_000
TestnetBlockHeightV4 = 8_088_000
TestnetBlockHeightV41 = 8_376_000
TestnetBlockHeightV42 = 8_481_000
TestnetBlockHeightV5 = 9_773_000
)

var (
Expand Down

0 comments on commit e0fbda5

Please sign in to comment.