Skip to content

Commit

Permalink
chore: some debugging print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
adamewozniak committed Nov 27, 2023
1 parent 689ca36 commit 84ec5ae
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 1 deletion.
36 changes: 36 additions & 0 deletions join_canon_4.sh
Original file line number Diff line number Diff line change
@@ -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="[email protected]:10000,[email protected]:10001,[email protected]: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
57 changes: 56 additions & 1 deletion x/oracle/abci.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package oracle

import (
"fmt"
"strings"
"time"

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -151,6 +198,14 @@ func Tally(
claim.Weight += tallyVote.Power
claim.TokensVoted++
validatorClaimMap[key] = claim
} else {

Check failure on line 201 in x/oracle/abci.go

View workflow job for this annotation

GitHub Actions / Analyze

elseif: can replace 'else {if cond {}}' with 'else if cond {}' (gocritic)

Check failure on line 201 in x/oracle/abci.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

elseif: can replace 'else {if cond {}}' with 'else if cond {}' (gocritic)
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))
}
}
}

Expand Down

0 comments on commit 84ec5ae

Please sign in to comment.