Skip to content

Commit

Permalink
Deprecate exchangeConfigJSON and minExchanges
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy committed Oct 21, 2024
1 parent 0eff57c commit 679f9f2
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 474 deletions.
6 changes: 5 additions & 1 deletion proto/dydxprotocol/prices/market_param.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ message MarketParam {
// represents ``$10,000`. Therefore `10 ^ Exponent` represents the smallest
// price step (in dollars) that can be recorded.
//
// Deprecated since v7.1.x. This value is now determined from the marketmap.
// Deprecated since v8.x. This value is now determined from the marketmap.
sint32 exponent = 3 [ deprecated = true ];

// The minimum number of exchanges that should be reporting a live price for
// a price update to be considered valid.
//
// Deprecated since v8.x. This value is now determined from the marketmap.
uint32 min_exchanges = 4;

// The minimum allowable change in `price` value that would cause a price
Expand All @@ -32,5 +34,7 @@ message MarketParam {

// A string of json that encodes the configuration for resolving the price
// of this market on various exchanges.
//
// Deprecated since v8.x. The exchange config is now determined from the marketmap.
string exchange_config_json = 6;
}
10 changes: 4 additions & 6 deletions protocol/app/ante/market_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,10 @@ var (
}

testMarketParams = prices_types.MarketParam{
Id: 0,
Pair: "TESTING-USD",
Exponent: -8,
MinExchanges: 1,
MinPriceChangePpm: 10,
ExchangeConfigJson: `{"test_config_placeholder":{}}`,
Id: 0,
Pair: "TESTING-USD",
Exponent: -8,
MinPriceChangePpm: 10,
}
)

Expand Down
4 changes: 0 additions & 4 deletions protocol/app/testdata/default_genesis_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,18 +405,14 @@
"prices": {
"market_params": [
{
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"\\\"BTCUSDT\\\"\"},{\"exchangeName\":\"BinanceUS\",\"ticker\":\"\\\"BTCUSD\\\"\"},{\"exchangeName\":\"Bitfinex\",\"ticker\":\"tBTCUSD\"},{\"exchangeName\":\"Bitstamp\",\"ticker\":\"BTC/USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"BTCUSDT\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BTC-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"BTC_USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XXBTZUSD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"BTC-USDT\"}]}",
"exponent": -5,
"id": 0,
"min_exchanges": 1,
"min_price_change_ppm": 1000,
"pair": "BTC-USD"
},
{
"exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"\\\"ETHUSDT\\\"\"},{\"exchangeName\":\"BinanceUS\",\"ticker\":\"\\\"ETHUSD\\\"\"},{\"exchangeName\":\"Bitfinex\",\"ticker\":\"tETHUSD\"},{\"exchangeName\":\"Bitstamp\",\"ticker\":\"ETH/USD\"},{\"exchangeName\":\"Bybit\",\"ticker\":\"ETHUSDT\"},{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"ETH-USD\"},{\"exchangeName\":\"CryptoCom\",\"ticker\":\"ETH_USD\"},{\"exchangeName\":\"Kraken\",\"ticker\":\"XETHZUSD\"},{\"exchangeName\":\"Okx\",\"ticker\":\"ETH-USDT\"}]}",
"exponent": -6,
"id": 1,
"min_exchanges": 1,
"min_price_change_ppm": 1000,
"pair": "ETH-USD"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package types_test
import (
"errors"
"fmt"
"github.com/dydxprotocol/v4-chain/protocol/testutil/daemons/pricefeed"
"testing"

"github.com/dydxprotocol/v4-chain/protocol/testutil/daemons/pricefeed"

"github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/types"
"github.com/dydxprotocol/v4-chain/protocol/mocks"
"github.com/dydxprotocol/v4-chain/protocol/testutil/constants"
Expand Down Expand Up @@ -199,31 +200,6 @@ func TestValidateAndTransformParams_Mixed(t *testing.T) {
expectedMutableMarketConfigs: testEmptyMarketConfigs,
expectedMutableExchangeConfigs: testEmptyExchangeMarketConfigs,
},
"Invalid: invalid exchangeConfigJson (empty, fails marketParams.Validate)": {
marketParams: []prices_types.MarketParam{{
Id: 1,
Exponent: -2,
Pair: "BTC-USD",
MinExchanges: 1,
MinPriceChangePpm: 1,
ExchangeConfigJson: "",
}},
expectedMarketParamErrors: map[types.MarketId]error{
1: errors.New("ExchangeConfigJson string is not valid"),
},
expectedMutableMarketConfigs: testEmptyMarketConfigs,
expectedMutableExchangeConfigs: testEmptyExchangeMarketConfigs,
},
"Invalid: invalid exchangeConfigJson (not json, fails marketParams.Validate)": {
marketParams: []prices_types.MarketParam{
validMarketParamWithExchangeConfig("invalid"),
},
expectedMarketParamErrors: map[types.MarketId]error{
1: errors.New("ExchangeConfigJson string is not valid"),
},
expectedMutableMarketConfigs: testEmptyMarketConfigs,
expectedMutableExchangeConfigs: testEmptyExchangeMarketConfigs,
},
"Invalid: invalid exchangeConfigJson (does not conform to schema)": {
marketParams: []prices_types.MarketParam{
validMarketParamWithExchangeConfig(`{"exchanges":"invalid"}`),
Expand Down
70 changes: 0 additions & 70 deletions protocol/scripts/genesis/sample_pregenesis.json

Large diffs are not rendered by default.

Loading

0 comments on commit 679f9f2

Please sign in to comment.