Skip to content

Commit

Permalink
[TRA-513] Deprecate exchange config json and min exchanges (#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy authored Oct 28, 2024
1 parent 4ccfe2b commit 338f1ce
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 554 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface 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.
*/

/** @deprecated */
Expand All @@ -28,6 +28,8 @@ export interface MarketParam {
/**
* 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.
*/

minExchanges: number;
Expand All @@ -40,6 +42,8 @@ export interface MarketParam {
/**
* A string of json that encodes the configuration for resolving the price
* of this market on various exchanges.
*
* Deprecated since v8.x. This is now determined from the marketmap.
*/

exchangeConfigJson: string;
Expand All @@ -63,7 +67,7 @@ export interface MarketParamSDKType {
* 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.
*/

/** @deprecated */
Expand All @@ -72,6 +76,8 @@ export interface MarketParamSDKType {
/**
* 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.
*/

min_exchanges: number;
Expand All @@ -84,6 +90,8 @@ export interface MarketParamSDKType {
/**
* A string of json that encodes the configuration for resolving the price
* of this market on various exchanges.
*
* Deprecated since v8.x. This is now determined from the marketmap.
*/

exchange_config_json: string;
Expand Down
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. This 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
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
Loading

0 comments on commit 338f1ce

Please sign in to comment.