Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename MATIC to POL in genesis and tests #2503

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
// by the pricefeed daemon. This number was chosen to supply the minimum number of prices required to
// compute an index price for a market, given exchange unavailability due to exchange geo-fencing,
// downtime, etc.
MinimumRequiredExchangesPerMarket = 5
MinimumRequiredExchangesPerMarket = 4
chenyaoy marked this conversation as resolved.
Show resolved Hide resolved
)

// GenerateExchangeConfigJson generates human-readable exchange config json for each market based on the contents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package constants

import (
"github.com/dydxprotocol/v4-chain/protocol/testutil/daemons/pricefeed/exchange_config"
"testing"

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

"github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/types"
"github.com/dydxprotocol/v4-chain/protocol/testutil/daemons/pricefeed"
"github.com/dydxprotocol/v4-chain/protocol/testutil/json"
Expand All @@ -27,9 +28,9 @@ func TestGenerateExchangeConfigJson(t *testing.T) {
id: exchange_config.MARKET_LINK_USD,
expectedExchangeConfigJsonFile: "link_exchange_config.json",
},
"MATIC exchange config": {
id: exchange_config.MARKET_MATIC_USD,
expectedExchangeConfigJsonFile: "matic_exchange_config.json",
"POL exchange config": {
id: exchange_config.MARKET_POL_USD,
expectedExchangeConfigJsonFile: "pol_exchange_config.json",
Comment on lines +31 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Issues found: Remaining MATIC references detected in the codebase.

The verification script identified multiple instances of MATIC that were not renamed to POL. Please address these remaining references to ensure a complete and consistent rename throughout the codebase.

  • Examples of remaining references:
    • CurrencyPair: slinkytypes.CurrencyPair{Base: "MATIC", Quote: "USD"}
    • OffChainTicker: "MATICUSDT"
    • Various configurations in genesis related to POL/USD still reference MATIC.
🔗 Analysis chain

LGTM: POL test case added correctly.

The new test case for POL exchange config has been added correctly, replacing the previous MATIC test case. This change aligns with the PR objective of renaming MATIC to POL.

To ensure consistency, please run the following script to verify that all MATIC references have been replaced with POL throughout the codebase:

Please review the output of this script to ensure that:

  1. There are no unexpected MATIC references remaining.
  2. POL references exist where expected.
  3. The pol_exchange_config.json file exists in the appropriate location.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining MATIC references and confirm POL references exist

# Test 1: Search for any remaining MATIC references
echo "Searching for remaining MATIC references:"
rg --type-not binary "MATIC"

# Test 2: Confirm POL references exist
echo "Confirming POL references exist:"
rg --type-not binary "POL"

# Test 3: Check if pol_exchange_config.json exists
echo "Checking if pol_exchange_config.json exists:"
fd "pol_exchange_config.json"

Length of output: 492


Script:

#!/bin/bash
# Description: Check for any remaining MATIC references and confirm POL references exist

# Test 1: Search for any remaining MATIC references
echo "Searching for remaining MATIC references:"
rg -I "MATIC"

# Test 2: Confirm POL references exist
echo "Confirming POL references exist:"
rg -I "POL"

# Test 3: Check if pol_exchange_config.json exists
echo "Checking if pol_exchange_config.json exists:"
fd "pol_exchange_config.json"

Length of output: 7200

},
"CRV exchange config": {
id: exchange_config.MARKET_CRV_USD,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"exchanges": [
{
"exchangeName": "Bybit",
"ticker": "POLUSDT",
"adjustByMarket": "USDT-USD"
},
{
"exchangeName": "CoinbasePro",
"ticker": "POL-USD"
},
{
"exchangeName": "CryptoCom",
"ticker": "POL_USD"
},
{
"exchangeName": "Okx",
"ticker": "POL-USDT",
"adjustByMarket": "USDT-USD"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"errors"
"fmt"
"github.com/dydxprotocol/v4-chain/protocol/testutil/daemons/pricefeed/exchange_config"
"net/http"
"testing"
"time"

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

pf_constants "github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/constants"
"github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/price_function"
"github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/types"
Expand Down Expand Up @@ -310,7 +311,7 @@ func generateTestMarketPriceExponentMap() map[types.MarketId]types.Exponent {
marketExponents[exchange_config.MARKET_BTC_USD] = constants.BtcUsdExponent
marketExponents[exchange_config.MARKET_ETH_USD] = constants.EthUsdExponent
marketExponents[exchange_config.MARKET_LINK_USD] = constants.LinkUsdExponent
marketExponents[exchange_config.MARKET_MATIC_USD] = constants.MaticUsdExponent
marketExponents[exchange_config.MARKET_POL_USD] = constants.PolUsdExponent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Issue Found: Remaining References to MATIC in constants.go

Several instances of "MATIC" are still present in protocol/app/upgrades/v6.0.0/constants.go. Please update these constants to "POL" to ensure complete consistency across the codebase.

🔗 Analysis chain

LGTM: Market configuration updated from MATIC to POL.

The market configuration has been correctly updated from MATIC to POL in the generateTestMarketPriceExponentMap function. This change aligns with the PR objective and is consistent with the renaming process.

To ensure consistency across the codebase, please run the following script to check for any remaining references to MATIC:

If the script returns any results, please ensure that those occurrences are also updated to POL where appropriate.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to MATIC in the codebase.

# Search for MATIC in all files, excluding this PR's changes
git grep -i "MATIC" -- ':!protocol/daemons/pricefeed/client/handler/exchange_query_handler_test.go'

# Search for MARKET_MATIC in all files
git grep -i "MARKET_MATIC" 

# Check if there are any MATIC-related constants that need to be renamed
git grep -i "MaticUsd"

Length of output: 13958

marketExponents[exchange_config.MARKET_CRV_USD] = constants.CrvUsdExponent
marketExponents[unavailableId] = unavailableExponent
return marketExponents
Expand Down
Loading
Loading