Skip to content

Commit

Permalink
fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Jan 14, 2025
1 parent 84dc866 commit a2cf22c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion indexer/services/comlink/public/api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5420,7 +5420,7 @@ or
|openInterestLowerCap|string|false|none|none|
|openInterestUpperCap|string|false|none|none|
|baseOpenInterest|string|true|none|none|
|defaultFundingRate1H|string|true|none|none|
|defaultFundingRate1H|string|false|none|none|

## PerpetualMarketResponse

Expand Down
3 changes: 1 addition & 2 deletions indexer/services/comlink/public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,7 @@
"stepBaseQuantums",
"subticksPerTick",
"marketType",
"baseOpenInterest",
"defaultFundingRate1H"
"baseOpenInterest"
],
"type": "object",
"additionalProperties": false
Expand Down
2 changes: 1 addition & 1 deletion indexer/services/comlink/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export interface PerpetualMarketResponseObject {
openInterestLowerCap?: string,
openInterestUpperCap?: string,
baseOpenInterest: string,
defaultFundingRate1H: string,
defaultFundingRate1H?: string,
}

/* ------- ORDERBOOK TYPES ------- */
Expand Down
2 changes: 1 addition & 1 deletion protocol/indexer/events/perpetual.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
perptypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types"
)

// NewUpdatePerpetualEvent creates a UpdatePerpetualEventV2 representing
// NewUpdatePerpetualEvent creates a UpdatePerpetualEventV3 representing
// update of a perpetual.
func NewUpdatePerpetualEvent(
id uint32,
Expand Down
17 changes: 9 additions & 8 deletions protocol/indexer/events/perpetual_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ func TestNewUpdatePerpetualEvent_Success(t *testing.T) {
-8,
2,
perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS,
0,
100, // defaultFundingPpm
)
expectedUpdatePerpetualEventProto := &UpdatePerpetualEventV2{
Id: 5,
Ticker: "BTC-ETH",
MarketId: 5,
AtomicResolution: -8,
LiquidityTier: 2,
MarketType: v1types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS,
expectedUpdatePerpetualEventProto := &UpdatePerpetualEventV3{
Id: 5,
Ticker: "BTC-ETH",
MarketId: 5,
AtomicResolution: -8,
LiquidityTier: 2,
MarketType: v1types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS,
DefaultFunding8HrPpm: 100,
}
require.Equal(t, expectedUpdatePerpetualEventProto, updatePerpetualEvent)
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,17 @@ func TestMsgUpgradeIsolatedPerpetualToCross(t *testing.T) {
// Verify that expected indexer event was emitted.
perpetual, err = perpetualsKeeper.GetPerpetual(ctx, tc.msg.PerpetualId)
require.NoError(t, err)
expectedIndexerEvent := &indexerevents.UpdatePerpetualEventV2{
Id: perpetual.Params.Id,
Ticker: perpetual.Params.Ticker,
MarketId: perpetual.Params.MarketId,
AtomicResolution: perpetual.Params.AtomicResolution,
LiquidityTier: perpetual.Params.LiquidityTier,
MarketType: v1.ConvertToPerpetualMarketType(perpetualtypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS),
expectedIndexerEvent := &indexerevents.UpdatePerpetualEventV3{
Id: perpetual.Params.Id,
Ticker: perpetual.Params.Ticker,
MarketId: perpetual.Params.MarketId,
AtomicResolution: perpetual.Params.AtomicResolution,
LiquidityTier: perpetual.Params.LiquidityTier,
MarketType: v1.ConvertToPerpetualMarketType(perpetualtypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS),
DefaultFunding8HrPpm: perpetual.Params.DefaultFundingPpm,
}
emittedIndexerEvents := getUpdatePerpetualEventsFromIndexerBlock(ctx, keeper)
require.Equal(t, emittedIndexerEvents, []*indexerevents.UpdatePerpetualEventV2{expectedIndexerEvent})
require.Equal(t, emittedIndexerEvents, []*indexerevents.UpdatePerpetualEventV3{expectedIndexerEvent})
},
)
}
Expand All @@ -246,15 +247,15 @@ func TestMsgUpgradeIsolatedPerpetualToCross(t *testing.T) {
func getUpdatePerpetualEventsFromIndexerBlock(
ctx sdk.Context,
listingKeeper *listingkeeper.Keeper,
) []*indexerevents.UpdatePerpetualEventV2 {
) []*indexerevents.UpdatePerpetualEventV3 {
block := listingKeeper.GetIndexerEventManager().ProduceBlock(ctx)
var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV2
var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV3
for _, event := range block.Events {
if event.Subtype != indexerevents.SubtypeUpdatePerpetual {
continue
}
if _, ok := event.OrderingWithinBlock.(*indexer_manager.IndexerTendermintEvent_TransactionIndex); ok {
var updatePerpetualEvent indexerevents.UpdatePerpetualEventV2
var updatePerpetualEvent indexerevents.UpdatePerpetualEventV3
err := proto.Unmarshal(event.DataBytes, &updatePerpetualEvent)
if err != nil {
panic(err)
Expand Down
10 changes: 5 additions & 5 deletions protocol/x/perpetuals/keeper/perpetual_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestModifyPerpetual_Success(t *testing.T) {
// Create liquidity tiers and perpetuals,
perps := keepertest.CreateLiquidityTiersAndNPerpetuals(t, pc.Ctx, pc.PerpetualsKeeper, pc.PricesKeeper, 100)
numMarkets := keepertest.GetNumMarkets(t, pc.Ctx, pc.PricesKeeper)
expectedIndexerEvents := make([]*indexerevents.UpdatePerpetualEventV2, len(perps))
expectedIndexerEvents := make([]*indexerevents.UpdatePerpetualEventV3, len(perps))
for i, item := range perps {
// Modify each field arbitrarily and
// verify the fields were modified in state.
Expand All @@ -61,7 +61,7 @@ func TestModifyPerpetual_Success(t *testing.T) {
require.NoError(t, err)

// Record the indexer event expected to emit from above `ModifyPerpetual`.
expectedIndexerEvents[i] = &indexerevents.UpdatePerpetualEventV2{
expectedIndexerEvents[i] = &indexerevents.UpdatePerpetualEventV3{
Id: item.Params.Id,
Ticker: ticker,
MarketId: marketId,
Expand Down Expand Up @@ -115,15 +115,15 @@ func TestModifyPerpetual_Success(t *testing.T) {
func getUpdatePerpetualEventsFromIndexerBlock(
ctx sdk.Context,
perpetualsKeeper *keeper.Keeper,
) []*indexerevents.UpdatePerpetualEventV2 {
) []*indexerevents.UpdatePerpetualEventV3 {
block := perpetualsKeeper.GetIndexerEventManager().ProduceBlock(ctx)
var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV2
var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV3
for _, event := range block.Events {
if event.Subtype != indexerevents.SubtypeUpdatePerpetual {
continue
}
if _, ok := event.OrderingWithinBlock.(*indexer_manager.IndexerTendermintEvent_TransactionIndex); ok {
var updatePerpetualEvent indexerevents.UpdatePerpetualEventV2
var updatePerpetualEvent indexerevents.UpdatePerpetualEventV3
err := proto.Unmarshal(event.DataBytes, &updatePerpetualEvent)
if err != nil {
panic(err)
Expand Down

0 comments on commit a2cf22c

Please sign in to comment.