From 84ec5aed5e492589315bfc6fc912b4a28a257034 Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:14:55 -0800 Subject: [PATCH] chore: some debugging print statements --- join_canon_4.sh | 36 ++++++++++++++++++++++++++++++ x/oracle/abci.go | 57 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100755 join_canon_4.sh diff --git a/join_canon_4.sh b/join_canon_4.sh new file mode 100755 index 0000000000..6b296f678a --- /dev/null +++ b/join_canon_4.sh @@ -0,0 +1,36 @@ +if [ -z "$1" ]; then + echo "Please provide a moniker" + exit 1 +fi + +read -r -p "Are you sure you want to reset your .umee folder? [y/n]" response +if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]] +then + umeed tendermint unsafe-reset-all + rm -r $HOME/.umee + umeed init $1 + + content=$(curl https://canon-4.rpc.network.umee.cc/genesis) + genesis=$(jq '.result.genesis' <<<"$content") + + rm -r $HOME/.umee/config/genesis.json + echo "$genesis" > $HOME/.umee/config/genesis.json + + # update and replace state sync, seeds + + SNAP_RPC="https://canon-4.rpc.network.umee.cc:443/" ; \ + BLOCK_HEIGHT=630000 ; \ + TRUST_HASH="EB7DF8672C9725C9E65AE055D6EFD0983ADEFB9344C4914226D32E7FDAA569E9" ; \ + PEERS="ee7d691781717cbd1bf6f965dc45aad19c7af05f@canon-4.network.umee.cc:10000,dfd1d83b668ff2e59dc1d601a4990d1bd95044ba@canon-4.network.umee.cc:10001,e25008728d8f800383561d5ce68cff2d6bfc3826@canon-4.network.umee.cc:10002" + + sed -i.bak -e "s/^seeds *=.*/seeds = \"$PEERS\"/" $HOME/.umee/config/config.toml + sed -i '' 's/enable = false/enable = true/g' $HOME/.umee/config/config.toml + sed -i '' "s|rpc_servers = \"\"|rpc_servers = \"$SNAP_RPC,$SNAP_RPC\"|g" $HOME/.umee/config/config.toml + sed -i '' "s/trust_height = 0/trust_height = $BLOCK_HEIGHT/g" $HOME/.umee/config/config.toml + sed -i '' "s|trust_hash = \"\"|trust_hash = \"$TRUST_HASH\"|g" $HOME/.umee/config/config.toml + sed -i '' 's|minimum-gas-prices = ""|minimum-gas-prices = "0.01uumee"|g' $HOME/.umee/config/app.toml + + umeed start +else + exit 1 +fi diff --git a/x/oracle/abci.go b/x/oracle/abci.go index ccd14f89a8..66b513245c 100644 --- a/x/oracle/abci.go +++ b/x/oracle/abci.go @@ -1,6 +1,7 @@ package oracle import ( + "fmt" "strings" "time" @@ -65,10 +66,49 @@ func CalcPrices(ctx sdk.Context, params types.Params, k keeper.Keeper) error { // same multiplier as the `threshold` computed above support := ballotDenom.Ballot.Power() * types.MaxVoteThresholdMultiplier / totalBondedPower if support < threshold { - ctx.Logger().Info("Ballot voting power is under vote threshold, dropping ballot", "denom", ballotDenom) + // ctx.Logger().Info("Ballot voting power is under vote threshold, dropping ballot", "denom", ballotDenom) + for _, v := range ballotDenom.Ballot { + fmt.Print("mark C") + fmt.Println("not enough support has been achieved for an asset") + fmt.Println("denom:", v.Denom) + fmt.Println("power in ballot:", v.Power) + fmt.Println("support:", support) + fmt.Println("threshold:", threshold) + + // get votes for each of the major 4 validators + val1, _ := sdk.ValAddressFromBech32("umeevaloper1hd4zwgmu2uax5pp43mqdnn09720qmvuqjenkr4") + val2, _ := sdk.ValAddressFromBech32("umeevaloper1aswcvpju7ff2gturf2r6whx25p0j0apu5kuvg0") + val3, _ := sdk.ValAddressFromBech32("umeevaloper16952kyr062e7l0a7ssxfzmur05tjmknvh7kax3") + vote, err := k.GetAggregateExchangeRateVote(ctx, val1) + if err != nil || len(vote.ExchangeRateTuples) == 0 { + fmt.Println("val 1 did not vote!") + } else { + fmt.Println("val 1 voted!") + } + vote, err = k.GetAggregateExchangeRateVote(ctx, val2) + if err != nil || len(vote.ExchangeRateTuples) == 0 { + fmt.Println("val 2 did not vote!") + } else { + fmt.Println("val 2 voted!") + } + vote, err = k.GetAggregateExchangeRateVote(ctx, val3) + if err != nil || len(vote.ExchangeRateTuples) == 0 { + fmt.Println("val 3 did not vote!") + } else { + fmt.Println("val 3 voted!") + } + + } + continue } + fmt.Println("mark D") + fmt.Println("ballot made it through!") + fmt.Println("denom:", ballotDenom.Denom) + fmt.Println("support:", support) + fmt.Println("threshold:", threshold) + denom := strings.ToUpper(ballotDenom.Denom) // Get weighted median of exchange rates exchangeRate, err := Tally(ballotDenom.Ballot, params.RewardBand, validatorClaimMap) @@ -100,6 +140,13 @@ func CalcPrices(ctx sdk.Context, params types.Params, k keeper.Keeper) error { continue } + if claim.Validator.String() == "umeevaloper13s987upqqy3cqkvy4gtclwej2kljg39qyajv7m" { + fmt.Println("mark A") + fmt.Println(claim.Validator.String()) + fmt.Println(claim.TokensVoted) + fmt.Println(voteTargetsLen) + } + // Increase miss counter k.SetMissCounter(ctx, claim.Validator, k.GetMissCounter(ctx, claim.Validator)+1) } @@ -151,6 +198,14 @@ func Tally( claim.Weight += tallyVote.Power claim.TokensVoted++ validatorClaimMap[key] = claim + } else { + if tallyVote.Voter.String() == "umeevaloper13s987upqqy3cqkvy4gtclwej2kljg39qyajv7m" { + fmt.Print("mark B") + fmt.Println(tallyVote.Voter.String()) + fmt.Println(tallyVote.ExchangeRate) + fmt.Println(weightedMedian.Sub(rewardSpread)) + fmt.Println(weightedMedian.Add(rewardSpread)) + } } }