Skip to content

Commit

Permalink
feat: reduce oracle noise msgs (#365)
Browse files Browse the repository at this point in the history
* update test scripts

* reduce noise messages of pf

* add more providers to default

* add workflow for v1.0.x

* fix branch name
  • Loading branch information
RafilxTenfen authored Sep 21, 2022
1 parent 9e61be6 commit 13fb428
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 15 deletions.
9 changes: 9 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@ pull_request_rules:
backport:
branches:
- release/v0.4.x

- name: Backport patches to release/v1.0.x branch
conditions:
- base=main
- label=S:backport/v1.0.x
actions:
backport:
branches:
- release/v1.x.x
24 changes: 20 additions & 4 deletions cmd/peggo/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,26 @@ func getOrchestratorCmd() *cobra.Command {
cmd.Flags().Bool(flagRelayBatches, false, "Relay transaction batches to Ethereum")
cmd.Flags().Int64(flagEthBlocksPerLoop, 2000, "Number of Ethereum blocks to process per orchestrator loop")
cmd.Flags().String(flagCoinGeckoAPI, "https://api.coingecko.com/api/v3", "Specify the coingecko API endpoint")
//nolint: lll
cmd.Flags().StringSlice(flagOracleProviders, []string{string(umeepfprovider.ProviderBinance), string(umeepfprovider.ProviderKraken)},
fmt.Sprintf("Specify the providers to use in the oracle, options \"%s\"", strings.Join([]string{string(umeepfprovider.ProviderBinance), string(umeepfprovider.ProviderHuobi),
string(umeepfprovider.ProviderKraken), string(umeepfprovider.ProviderGate), string(umeepfprovider.ProviderOkx), string(umeepfprovider.ProviderOsmosis)}, ",")))

defaultProviders := []string{
umeepfprovider.ProviderOsmosis.String(),
umeepfprovider.ProviderHuobi.String(),
umeepfprovider.ProviderOkx.String(),
umeepfprovider.ProviderCoinbase.String(),
umeepfprovider.ProviderBinance.String(),
umeepfprovider.ProviderBitget.String(),
umeepfprovider.ProviderMexc.String(),
}

allProviders := append([]string{
umeepfprovider.ProviderKraken.String(),
umeepfprovider.ProviderGate.String(),
umeepfprovider.ProviderFTX.String(),
umeepfprovider.ProviderMock.String(),
}, defaultProviders...)

cmd.Flags().StringSlice(flagOracleProviders, defaultProviders,
fmt.Sprintf("Specify the providers to use in the oracle, options \"%s\"", strings.Join(allProviders, ",")))
cmd.Flags().Duration(flagEthPendingTXWait, 20*time.Minute, "Time for a pending tx to be considered stale")
cmd.Flags().String(flagEthAlchemyWS, "", "Specify the Alchemy websocket endpoint")
cmd.Flags().Float64(flagProfitMultiplier, 1.0, "Multiplier to apply to relayer profit")
Expand Down
12 changes: 10 additions & 2 deletions orchestrator/oracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"
"time"

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/rs/zerolog"
"golang.org/x/sync/errgroup"
Expand All @@ -14,6 +15,7 @@ import (
pfprovider "github.com/umee-network/umee/price-feeder/oracle/provider"
pftypes "github.com/umee-network/umee/price-feeder/oracle/types"
pfsync "github.com/umee-network/umee/price-feeder/pkg/sync"
umeeparams "github.com/umee-network/umee/v3/app/params"
)

const (
Expand Down Expand Up @@ -273,7 +275,8 @@ func (o *Oracle) setPrices() error {

if tickerErr != nil && candleErr != nil {
// only generates error if ticker and candle generate errors
return fmt.Errorf("ticker error: %+v\ncandle error: %+v", tickerErr, candleErr)
o.logger.Debug().Msgf("provider: %s ticker error: %+v\ncandle error: %+v", providerName, tickerErr, candleErr)
return nil
}

// flatten and collect prices based on the base currency per provider
Expand All @@ -300,12 +303,17 @@ func (o *Oracle) setPrices() error {
o.logger.Debug().Err(err).Msg("failed to get ticker prices from provider")
}

deviationTreshold := sdk.NewDecFromIntWithPrec(sdkmath.NewInt(15), 1)

computedPrices, err := pforacle.GetComputedPrices(
o.logger,
providerCandles,
providerPrices,
o.providerSubscribedPairs,
make(map[string]sdk.Dec, 0), // uses default deviation
map[string]sdk.Dec{
SymbolETH: deviationTreshold,
umeeparams.BondDenom: deviationTreshold,
}, // uses default deviation for other bases
)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion test/cosmos/multinode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fi # data dir check
# Start the instances
echo "Starting nodes..."

$NODE_BIN $home0 start --api.enable true --grpc.address="0.0.0.0:9090" --grpc-web.enable=false --log_level $LOG_LEVEL > $hdir.n0.log 2>&1 &
$NODE_BIN $home0 start --grpc.address="0.0.0.0:9090" --grpc-web.enable=false --log_level $LOG_LEVEL > $hdir.n0.log 2>&1 &
$NODE_BIN $home1 start --grpc.address="0.0.0.0:9091" --grpc-web.enable=false --log_level $LOG_LEVEL > $hdir.n1.log 2>&1 &
$NODE_BIN $home2 start --grpc.address="0.0.0.0:9092" --grpc-web.enable=false --log_level $LOG_LEVEL > $hdir.n2.log 2>&1 &

Expand Down
10 changes: 6 additions & 4 deletions test/eth/run_ganache.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
#!/bin/bash -eux

CWD="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
DATA_DIR=${DATA_DIR:-$CWD/data}

rm -rf $DATA_DIR
mkdir -p $DATA_DIR

ganache="ganache-cli"
ganache="ganache"

if pgrep -x $ganache >/dev/null
then
echo "$ganache is running, going to kill all"
ps -ef | grep $ganache | grep -v grep | awk '{print $2}' | xargs kill
fi

ganache-cli \
--chain-id 888 \
$ganache \
--chain.chainId 888 \
--account '0x88cbead91aee890d27bf06e003ade3d4e952427e88f88d31d61d3ef5e5d54305,1000000000000000000' \
--account '0x741de4f8988ea941d3ff0287911ca4074e62b7d45c991a51186455366f10b544,1000000000000000000' \
--account '0x39a4c898dda351d54875d5ebb3e1c451189116faa556c3c04adc860dd1000608,1000000000000000000' \
--account '0x6c212553111b370a8ffdc682954495b7b90a73cedab7106323646a4f2c4e668f,1000000000000000000' \
--blockTime 1 \
--blockTime 1 \
> $DATA_DIR/ganache.log 2>&1 &
11 changes: 7 additions & 4 deletions test/scripts/valset_update_2000_blocks.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash -eu
#!/bin/bash -eux

CWD="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ETH_RPC=${ETH_RPC:-"http://127.0.0.1:8545"}
UMMED_BUILD_PATH=$CWD/../umeed-builds
UMEED_BIN=${UMEED_BIN:-$UMMED_BUILD_PATH/umeed-main}
UMEED_BIN=${UMEED_BIN:-$UMMED_BUILD_PATH/umeed-rc4}
PEGGO_BUILD_PATH=$CWD/../../build
PEGGO_BIN=${PEGGO_BIN:-$PEGGO_BUILD_PATH/peggo}
CHAIN_ID="${CHAIN_ID:-888}"
Expand All @@ -18,7 +18,7 @@ n1dir="$hdir/n1"
n2dir="$hdir/n2"

umeeBasename=$(basename $UMEED_BIN)
ganache="ganache-cli"
ganache="ganache"

# Common flags
kbt="--keyring-backend test"
Expand Down Expand Up @@ -71,18 +71,21 @@ PEGGO_ETH_PK=$val0PrivateKey $PEGGO_BIN orchestrator $bridgeAddr \
$defaultFlags \
--cosmos-grpc="tcp://0.0.0.0:9090" \
--tendermint-rpc="http://0.0.0.0:26657" \
--oracle-providers="osmosis,huobi,okx,coinbase,binance,bitget,mexc" \
--cosmos-keyring-dir=$n0dir > $peggoLogPath/n0.peggo.log 2>&1 &

PEGGO_ETH_PK=$val1PrivateKey $PEGGO_BIN orchestrator $bridgeAddr \
# PEGGO_ETH_PK=$val1PrivateKey $PEGGO_BIN orchestrator $bridgeAddr \
$defaultFlags \
--cosmos-grpc="tcp://0.0.0.0:9091" \
--tendermint-rpc="http://0.0.0.0:26667" \
--oracle-providers="kraken,osmosis,huobi,okx,coinbase,binance,bitget,mexc" \
--cosmos-keyring-dir=$n1dir > $peggoLogPath/n1.peggo.log 2>&1 &

PEGGO_ETH_PK=$val2PrivateKey $PEGGO_BIN orchestrator $bridgeAddr \
$defaultFlags \
--cosmos-grpc="tcp://0.0.0.0:9092" \
--tendermint-rpc="http://0.0.0.0:26677" \
--oracle-providers="kraken,osmosis,huobi,okx,coinbase,binance,bitget,mexc" \
--cosmos-keyring-dir=$n2dir > $peggoLogPath/n2.peggo.log 2>&1 &

echo Wait for a few seconds to get the current valset
Expand Down

0 comments on commit 13fb428

Please sign in to comment.