Skip to content

Conversation

aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented Sep 24, 2025

  • Sync dev branch with master after v1.58.3 release

Summary by CodeRabbit

  • New Features

    • Introduced downtime monitoring support with new query/genesis types and parameters.
    • Added post-only mode controls plus a CancelPostOnlyMode transaction.
    • Enabled bidder whitelisting in auctions.
    • Extended derivative market info to include funding details.
  • Bug Fixes

    • Liquidation now restricted to vanilla limit buy/sell orders.
    • Adjusted binary options market ID construction for consistency.
  • Chores

    • Updated token list URLs and OFAC address list.
    • Upgraded dependencies/toolchain and example defaults.

@aarmoa aarmoa requested a review from Copilot September 24, 2025 02:56
Copy link

coderabbitai bot commented Sep 24, 2025

Walkthrough

Adds a downtime-detector module (protos and Go types), integrates downtime params/keeper with the exchange module, adds MsgCancelPostOnlyMode, updates exchange types/validation and market ID composition, registers new interfaces, bumps deps/tooling, updates examples and data files.

Changes

Cohort / File(s) Summary
Build & Dependencies
Makefile, go.mod
Update clone branches; bump Go toolchain to 1.23.9; add direct tidwall/btree; update indirect deps and module replacements to inj.6 / inj.3 variants.
Downtime Detector (Go types)
chain/downtime-detector/types/*
Add new module types: codec.go, constants.go, genesis.go, keys.go — codec registration, Downtime↔duration map, genesis helpers, store key accessors, defaults and utilities.
Downtime Detector Protos
proto/injective/downtimedetector/v1beta1/*
Add downtime_duration.proto (Downtime enum), genesis.proto (GenesisDowntimeEntry, GenesisState), and query.proto with RecoveredSinceDowntimeOfLength RPC and messages.
Exchange Types & Validation
chain/exchange/types/*, chain/exchange/types/v2/*
Add DowntimeKeeper interface; new PostOnlyModeCancellationKey; add post-only params & validators; add field DerivativeMarketInfo.Funding; modify NewBinaryOptionsMarketID to prefix BO delimiter; tighten MsgLiquidatePosition to require vanilla limit orders.
Exchange v2 Protos / RPCs
proto/injective/exchange/v2/exchange.proto, proto/injective/exchange/v2/tx.proto
Deprecate human_readable_upgrade_block_height; add post_only_mode_blocks_amount and min_post_only_mode_downtime_duration params; add MsgCancelPostOnlyMode RPC and messages.
Client Wiring & Config
client/chain/context.go, client/common/network.go
Register downtime-detector interfaces in proto codec; update token list URLs to json/tokens/....
Examples
examples/chain/exchange/*
Change OracleScaleFactor from 6 to 0 in several instant market launch examples.
Data Files
injective_data/chain_messages_list.json, injective_data/ofac.json
Add injective.exchange.v2.MsgCancelPostOnlyMode to messages list; append several OFAC addresses.
Auction Proto
proto/injective/auction/v1beta1/auction.proto
Add Params.bidders_whitelist (repeated string) to auction params.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Operator as Operator/Params
  participant Exchange as Exchange Module
  participant Downtime as Downtime-Detector
  participant KV as KV Store

  Note over Exchange,Downtime: Auto Post-Only Mode evaluation (new params)
  Operator->>Exchange: Set Params(post_only_mode_blocks_amount, min_post_only_mode_downtime_duration)
  loop BeginBlock
    Exchange->>Downtime: Query RecoveredSinceDowntimeOfLength(min_downtime, recovery_window)
    Downtime-->>Exchange: successfully_recovered (bool)
    alt Not recovered
      Exchange->>KV: Set Post-Only Mode flag (enable for N blocks)
    else Recovered
      Exchange->>KV: No change
    end
  end
Loading
sequenceDiagram
  autonumber
  actor User as User
  participant MsgSvc as Msg Service (exchange.v2)
  participant Exchange as Exchange Keeper
  participant KV as KV Store

  Note over MsgSvc,Exchange: CancelPostOnlyMode flow (new RPC)
  User->>MsgSvc: MsgCancelPostOnlyMode{sender}
  MsgSvc->>Exchange: CancelPostOnlyMode(msg)
  Exchange->>KV: Set PostOnlyModeCancellationKey
  Exchange-->>User: MsgCancelPostOnlyModeResponse{}
  Note over Exchange: Next BeginBlock reads key and cancels post-only mode
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

A rabbit taps the ledger’s code,
I map the downtimes on the road.
Params set, a gentle hop—
Cancel whispers stop the block.
Carrots, keys, and hashes stored—
Hop, commit, the markets roar. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Feat/sync dev with master after v1.58.3" clearly states the PR's purpose—synchronizing dev with master following the v1.58.3 release—and the provided changeset shows multiple upstream updates consistent with a branch sync. It is a single, concise sentence that relates directly to the main change rather than listing files or using vague terms. Therefore it meets the checklist criteria for relevance and clarity.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/sync_dev_with_master_after_v1_58_3

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR syncs the dev branch with master after the v1.58.3 release, bringing together a significant amount of changes across multiple modules and functionality areas.

Key changes include:

  • Addition of new downtime detector module with query capabilities
  • Enhancement of auction module with whitelist support and new RPC endpoints
  • Post-only mode functionality for exchange operations
  • Updates to Go version, dependencies, and token list URLs

Reviewed Changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
proto/injective/exchange/v2/tx.proto Adds MsgCancelPostOnlyMode RPC and message definitions
proto/injective/exchange/v2/exchange.proto Adds post-only mode configuration parameters and deprecates human_readable_upgrade_block_height
proto/injective/downtimedetector/v1beta1/*.proto New downtime detector module with query, genesis, and duration types
proto/injective/auction/v1beta1/auction.proto Adds bidders_whitelist parameter to auction configuration
injective_data/ofac.json Updates OFAC blocked addresses list with new entries
injective_data/chain_messages_list.json Adds MsgCancelPostOnlyMode to supported message types
go.mod Updates Go version and dependency versions
exchange/auction_rpc/pb/*.go Generated code for new auction RPC endpoints (V2 APIs)
examples/chain/exchange/*/example.go Updates OracleScaleFactor from 6 to 0 in market launch examples
client/common/network.go Updates token list URLs to new repository structure
client/chain/context.go Registers downtime detector types in codec

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@aarmoa aarmoa force-pushed the feat/sync_dev_with_master_after_v1_58_3 branch from ca4abcb to 05bd437 Compare September 24, 2025 03:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
chain/exchange/types/v2/params.go (1)

49-131: Missing ParamSetPair for MinPostOnlyModeDowntimeDuration

The new param key is defined but not registered in ParamSetPairs, so it won’t be persisted or changeable via params subspace.

Add the ParamSetPair:

 		paramtypes.NewParamSetPair(
 			KeyPostOnlyModeBlocksAmount,
 			&p.PostOnlyModeBlocksAmount,
 			ValidatePostOnlyModeBlocksAmount,
 		),
+		paramtypes.NewParamSetPair(
+			KeyMinPostOnlyModeDowntimeDuration,
+			&p.MinPostOnlyModeDowntimeDuration,
+			ValidateMinPostOnlyModeDowntimeDuration,
+		),
🧹 Nitpick comments (13)
chain/exchange/types/key.go (1)

125-126: New key for post-only mode cancellation looks fine; consider clarifying store usage.

Name and sequencing are consistent. Optional: add a brief comment if this is intended for transient store (TStore) vs persistent to avoid misuse.

chain/downtime-detector/types/keys.go (2)

11-11: Return a copy to avoid accidental mutation of the global key slice

Exposing the package-level []byte allows callers to mutate it. Return a copy to keep the key immutable.

-func GetLastBlockTimestampKey() []byte { return lastBlockTimestampKey }
+func GetLastBlockTimestampKey() []byte { return append([]byte(nil), lastBlockTimestampKey...) }

8-8: Use enum numeric value in keys (avoid renames breaking store layout)

Relying on Downtime.String() bakes the symbol name into store keys. Prefer the stable numeric value.

-	lastDowntimeOfLengthPrefix = "last_downtime_of_length/%s"
+	lastDowntimeOfLengthPrefix = "last_downtime_of_length/%d"
-func GetLastDowntimeOfLengthKey(downtimeDur Downtime) []byte {
-	return []byte(fmt.Sprintf(lastDowntimeOfLengthPrefix, downtimeDur.String()))
+func GetLastDowntimeOfLengthKey(downtimeDur Downtime) []byte {
+	return []byte(fmt.Sprintf(lastDowntimeOfLengthPrefix, int32(downtimeDur)))
 }

Also applies to: 14-15

chain/downtime-detector/types/genesis.go (2)

5-17: Preallocate and reuse keys slice to reduce allocations

Tiny but clean: capture Keys() once and preallocate the result slice.

-func DefaultGenesis() *GenesisState {
-	genDowntimes := []GenesisDowntimeEntry{}
-	for _, downtime := range DowntimeToDuration.Keys() {
+func DefaultGenesis() *GenesisState {
+	keys := DowntimeToDuration.Keys()
+	genDowntimes := make([]GenesisDowntimeEntry, 0, len(keys))
+	for _, downtime := range keys {
 		genDowntimes = append(genDowntimes, GenesisDowntimeEntry{
 			Duration:     downtime,
 			LastDowntime: DefaultLastDowntime,
 		})
 	}
 	return &GenesisState{
 		Downtimes:     genDowntimes,
 		LastBlockTime: time.Unix(0, 0),
 	}
 }

19-21: Add minimal validation to catch malformed genesis

Consider verifying non-zero downtimes length and that last_block_time is not negative.

proto/injective/downtimedetector/v1beta1/genesis.proto (1)

4-9: Remove unused imports to fix lint/compile noise

any.proto, cosmos.proto, and duration.proto aren’t used here.

 import "gogoproto/gogo.proto";
-import "google/protobuf/any.proto";
-import "cosmos_proto/cosmos.proto";
-import "google/protobuf/duration.proto";
 import "google/protobuf/timestamp.proto";
 import "injective/downtimedetector/v1beta1/downtime_duration.proto";
proto/injective/exchange/v2/exchange.proto (1)

197-206: Consider using the Downtime enum for type-safety; runtime validation already present

chain/exchange/types/v2/params.go — ValidateMinPostOnlyModeDowntimeDuration casts the param to string, rejects empty values, and checks existence in downtimetypes.Downtime_value (default "DURATION_10M"). Switching the proto field to injective.downtimedetector.v1beta1.Downtime is still recommended but optional.

chain/downtime-detector/types/constants.go (3)

20-23: Avoid exposing mutable global map; make it private or freeze it

Exporting DowntimeToDuration invites accidental mutation and potential concurrency hazards. Prefer an unexported map with read-only helpers, or expose a copy.

Apply this diff to make the map private and add a read-only getter:

-var (
-	DowntimeToDuration  = btree.NewMap[Downtime, time.Duration](16)
-	DefaultLastDowntime = time.Unix(0, 0)
-)
+var (
+	downtimeToDuration  = btree.NewMap[Downtime, time.Duration](16)
+	DefaultLastDowntime = time.Unix(0, 0)
+)
+
+// GetDowntimeToDuration returns a snapshot copy to prevent external mutation.
+func GetDowntimeToDuration() map[Downtime]time.Duration {
+	out := make(map[Downtime]time.Duration)
+	downtimeToDuration.Ascend(Downtime(0), func(k Downtime, v time.Duration) bool {
+		out[k] = v
+		return true
+	})
+	return out
+}

Note: update internal references (init/DowntimeStrings/DowntimeByDuration) from DowntimeToDuration to downtimeToDuration.


25-54: Initialize a reverse lookup to avoid O(n) scans

DowntimeByDuration does a full scan each call. Build a reverse map once in init for O(1) lookups.

Apply this diff to add and populate a reverse map:

+var durationToDowntime = map[time.Duration]Downtime{}
 
 func init() {
-	DowntimeToDuration.Set(Downtime_DURATION_30S, 30*time.Second)
-	...
-	DowntimeToDuration.Set(Downtime_DURATION_48H, 48*time.Hour)
+	downtimeToDuration.Set(Downtime_DURATION_30S, 30*time.Second)
+	// ... keep existing sets, but on downtimeToDuration ...
+	downtimeToDuration.Set(Downtime_DURATION_48H, 48*time.Hour)
+
+	// build reverse map
+	downtimeToDuration.Ascend(Downtime(0), func(k Downtime, v time.Duration) bool {
+		durationToDowntime[v] = k
+		return true
+	})
 }

And simplify DowntimeByDuration:

 func DowntimeByDuration(duration time.Duration) (Downtime, error) {
-	var result Downtime
-	found := false
-	DowntimeToDuration.Ascend(Downtime(0), func(k Downtime, v time.Duration) bool {
-		if v == duration {
-			result = k
-			found = true
-			return false
-		}
-		return true
-	})
-	if found {
-		return result, nil
-	}
+	if v, ok := durationToDowntime[duration]; ok {
+		return v, nil
+	}
 	downtimeOptions := strings.Join(DowntimeStrings(), ", ")
-	return result, fmt.Errorf("downtime of %s does not exist. Chain-provided downtimes [%s]", duration.String(), downtimeOptions)
+	return 0, fmt.Errorf("downtime of %s does not exist. Chain-provided downtimes [%s]", duration.String(), downtimeOptions)
 }

56-65: Minor: preallocate result slice

Preallocate for the known size to avoid reallocations.

-func DowntimeStrings() []string {
-	arr := []string{}
-	DowntimeToDuration.Ascend(Downtime(0), func(_ Downtime, v time.Duration) bool {
+func DowntimeStrings() []string {
+	arr := make([]string, 0, downtimeToDuration.Len())
+	downtimeToDuration.Ascend(Downtime(0), func(_ Downtime, v time.Duration) bool {
 		s := strings.Replace(v.String(), "m0s", "m", 1)
 		s = strings.Replace(s, "h0m", "h", 1)
 		arr = append(arr, s)
 		return true
 	})
 	return arr
 }
proto/injective/downtimedetector/v1beta1/query.proto (2)

8-15: Remove unused imports to satisfy linters

These imports are unused in this file and may trigger buf/compile or lint failures.

-import "cosmos/base/v1beta1/coin.proto";
-import "cosmos/base/query/v1beta1/pagination.proto";
 import "google/api/annotations.proto";
-import "google/protobuf/any.proto";
-import "cosmos_proto/cosmos.proto";
 import "google/protobuf/duration.proto";
-import "google/protobuf/timestamp.proto";

22-25: HTTP path style

Consider a lowercase, kebab/snake-cased resource path to align with typical REST conventions and existing Cosmos APIs.

-      post : "/injective/downtime-detector/v1beta1/"
-             "RecoveredSinceDowntimeOfLength"
+      post : "/injective/downtime-detector/v1beta1/recovered_since_downtime_of_length"
chain/exchange/types/v2/params.go (1)

116-125: Consistency: use local validator for AtomicMarketOrderAccessLevel or remove duplication

ParamSetPairs uses types.ValidateAtomicMarketOrderAccessLevel while this file defines ValidateAtomicMarketOrderAccessLevel. Prefer one source to avoid drift.

Option A: switch ParamSetPairs to the local function.

-			types.ValidateAtomicMarketOrderAccessLevel,
+			ValidateAtomicMarketOrderAccessLevel,

Option B: delete the local function and consistently use types.ValidateAtomicMarketOrderAccessLevel everywhere (including in Params.Validate()).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 830a467 and 05bd437.

⛔ Files ignored due to path filters (9)
  • chain/auction/types/auction.pb.go is excluded by !**/*.pb.go
  • chain/downtime-detector/types/downtime_duration.pb.go is excluded by !**/*.pb.go
  • chain/downtime-detector/types/genesis.pb.go is excluded by !**/*.pb.go
  • chain/downtime-detector/types/query.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/v2/exchange.pb.go is excluded by !**/*.pb.go
  • chain/exchange/types/v2/tx.pb.go is excluded by !**/*.pb.go
  • exchange/auction_rpc/pb/goadesign_goagen_injective_auction_rpc.pb.go is excluded by !**/*.pb.go
  • exchange/auction_rpc/pb/goadesign_goagen_injective_auction_rpc_grpc.pb.go is excluded by !**/*.pb.go
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (25)
  • Makefile (2 hunks)
  • chain/downtime-detector/types/codec.go (1 hunks)
  • chain/downtime-detector/types/constants.go (1 hunks)
  • chain/downtime-detector/types/genesis.go (1 hunks)
  • chain/downtime-detector/types/keys.go (1 hunks)
  • chain/exchange/types/expected_keepers.go (2 hunks)
  • chain/exchange/types/key.go (1 hunks)
  • chain/exchange/types/market.go (2 hunks)
  • chain/exchange/types/msgs.go (1 hunks)
  • chain/exchange/types/v2/msgs.go (1 hunks)
  • chain/exchange/types/v2/params.go (6 hunks)
  • client/chain/context.go (2 hunks)
  • client/common/network.go (1 hunks)
  • examples/chain/exchange/13_MsgInstantBinaryOptionsMarketLaunch/example.go (1 hunks)
  • examples/chain/exchange/4_MsgInstantPerpetualMarketLaunch/example.go (1 hunks)
  • examples/chain/exchange/5_MsgInstantExpiryFuturesMarketLaunch/example.go (1 hunks)
  • go.mod (4 hunks)
  • injective_data/chain_messages_list.json (1 hunks)
  • injective_data/ofac.json (4 hunks)
  • proto/injective/auction/v1beta1/auction.proto (1 hunks)
  • proto/injective/downtimedetector/v1beta1/downtime_duration.proto (1 hunks)
  • proto/injective/downtimedetector/v1beta1/genesis.proto (1 hunks)
  • proto/injective/downtimedetector/v1beta1/query.proto (1 hunks)
  • proto/injective/exchange/v2/exchange.proto (1 hunks)
  • proto/injective/exchange/v2/tx.proto (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
chain/downtime-detector/types/keys.go (1)
chain/downtime-detector/types/downtime_duration.pb.go (2)
  • Downtime (24-24)
  • Downtime (114-116)
chain/exchange/types/msgs.go (2)
chain/exchange/types/exchange.pb.go (4)
  • OrderType (97-97)
  • OrderType (145-147)
  • OrderType_BUY (101-101)
  • OrderType_SELL (102-102)
chain/exchange/types/errors.go (1)
  • ErrInvalidOrderTypeForMessage (68-68)
chain/exchange/types/v2/msgs.go (2)
chain/exchange/types/exchange.pb.go (4)
  • OrderType (97-97)
  • OrderType (145-147)
  • OrderType_BUY (101-101)
  • OrderType_SELL (102-102)
chain/exchange/types/errors.go (1)
  • ErrInvalidOrderTypeForMessage (68-68)
chain/downtime-detector/types/constants.go (1)
chain/downtime-detector/types/downtime_duration.pb.go (27)
  • Downtime (24-24)
  • Downtime (114-116)
  • Downtime_DURATION_30S (27-27)
  • Downtime_DURATION_1M (28-28)
  • Downtime_DURATION_2M (29-29)
  • Downtime_DURATION_3M (30-30)
  • Downtime_DURATION_4M (31-31)
  • Downtime_DURATION_5M (32-32)
  • Downtime_DURATION_10M (33-33)
  • Downtime_DURATION_20M (34-34)
  • Downtime_DURATION_30M (35-35)
  • Downtime_DURATION_40M (36-36)
  • Downtime_DURATION_50M (37-37)
  • Downtime_DURATION_1H (38-38)
  • Downtime_DURATION_1_5H (39-39)
  • Downtime_DURATION_2H (40-40)
  • Downtime_DURATION_2_5H (41-41)
  • Downtime_DURATION_3H (42-42)
  • Downtime_DURATION_4H (43-43)
  • Downtime_DURATION_5H (44-44)
  • Downtime_DURATION_6H (45-45)
  • Downtime_DURATION_9H (46-46)
  • Downtime_DURATION_12H (47-47)
  • Downtime_DURATION_18H (48-48)
  • Downtime_DURATION_24H (49-49)
  • Downtime_DURATION_36H (50-50)
  • Downtime_DURATION_48H (51-51)
chain/exchange/types/expected_keepers.go (1)
chain/downtime-detector/types/downtime_duration.pb.go (2)
  • Downtime (24-24)
  • Downtime (114-116)
chain/exchange/types/v2/params.go (2)
chain/exchange/types/v2/exchange.pb.go (3)
  • Params (71-169)
  • Params (173-173)
  • Params (174-176)
chain/downtime-detector/types/downtime_duration.pb.go (1)
  • Downtime_value (82-108)
chain/downtime-detector/types/genesis.go (3)
chain/downtime-detector/types/genesis.pb.go (6)
  • GenesisState (86-89)
  • GenesisState (93-93)
  • GenesisState (94-96)
  • GenesisDowntimeEntry (33-36)
  • GenesisDowntimeEntry (40-40)
  • GenesisDowntimeEntry (41-43)
chain/downtime-detector/types/constants.go (2)
  • DowntimeToDuration (21-21)
  • DefaultLastDowntime (22-22)
chain/downtime-detector/types/downtime_duration.pb.go (2)
  • Downtime (24-24)
  • Downtime (114-116)
🪛 Buf (1.57.2)
proto/injective/downtimedetector/v1beta1/genesis.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

proto/injective/downtimedetector/v1beta1/query.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

proto/injective/downtimedetector/v1beta1/downtime_duration.proto

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: run-tests
  • GitHub Check: lint
🔇 Additional comments (26)
proto/injective/auction/v1beta1/auction.proto (1)

27-30: LGTM! Well-documented bidder access control feature.

The addition of bidders_whitelist provides clear access control functionality with comprehensive documentation. The field is appropriately typed as repeated string for address lists, and the comments clearly explain the behavior for both empty and populated lists.

examples/chain/exchange/13_MsgInstantBinaryOptionsMarketLaunch/example.go (1)

77-77: Provider feed scale: confirm 0 is correct

For OracleType_Provider, 0 is correct only if the provider emits unscaled prices. Double‑check provider docs to avoid 10^n mispricing.

examples/chain/exchange/5_MsgInstantExpiryFuturesMarketLaunch/example.go (1)

77-77: Expiry futures: confirm scale factor = 0 for Band

Same note as perp: ensure Band’s INJ/USDC price decimals require no scaling; otherwise adjust to the feed’s scale to avoid price shifts and unintended liquidations. Market ID will differ with scale changes—update any references.

examples/chain/exchange/4_MsgInstantPerpetualMarketLaunch/example.go (1)

77-77: OracleScaleFactor = 0: confirm oracle decimals and market-ID implications

Examples set OracleScaleFactor: 0 while other files use 6 — a 0/6 mismatch will scale index prices by 10^6 and can cause bad fills/liquidations and change MarketId composition. Non-zero (6) occurrences found: client/core/market_v1_test.go and client/chain/markets_assistant_test_support.go (multiple). oracleScaleFactor is also propagated from proposals/marketInfo (chain/exchange/types/**) and passed through client/chain/markets_assistant.go and client/exchange/exchange.go. Align examples with the expected oracle decimals (or document/ensure the feed returns already‑scaled prices) and verify MarketId generation.

go.mod (5)

3-3: LGTM! Latest Go version upgrade.

This upgrade from the previous Go version to 1.23.9 aligns with keeping dependencies current.


94-94: LGTM! IAVL upgrade for bug fixes and improvements.

The upgrade of github.com/cosmos/iavl from v1.2.2 to v1.2.6 is a patch version bump that likely includes bug fixes and performance improvements for the IAVL tree implementation.


33-33: Dependency promotion OK — btree is used directly.

chain/downtime-detector/types/constants.go imports github.com/tidwall/btree and uses btree.NewMapDowntime, time.Duration; promoting it to a direct dependency is justified.


238-247: Verify compatibility of evm-comet1-inj.6 upgrades.
Repo search found no migration guides, changelogs, or code references to evm-comet1-inj.6 — compatibility cannot be confirmed.
Location: go.mod (lines 238–247).


253-255: Verify CometBFT (inj.3) ↔ Cosmos SDK (inj.6) compatibility

No Injective-published compatibility matrix found; check Injective Labs release notes/upgrade guides for the specific per-release pairings and confirm with integration/upgrade tests (genesis migration, cosmovisor, API/ABI changes).

Location: go.mod lines 253-255

	github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.3
	github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.0-inj.2
	github.com/cosmos/cosmos-sdk => github.com/InjectiveLabs/cosmos-sdk v0.50.13-evm-comet1-inj.6
injective_data/ofac.json (1)

8-8: Validate new OFAC addresses (format, dedupe, casing, sort)

  • File: injective_data/ofac.json — ensure each entry is 0x+40 hex, enforce a single casing policy (recommend all-lowercase or EIP‑55 checksummed), check case-insensitive duplicates, and sort case-insensitively to reduce merge conflicts; add a CI check.

Run the corrected validator below and paste the output:

#!/bin/bash
set -euo pipefail
FILE="injective_data/ofac.json"
if [ ! -f "$FILE" ]; then
  echo "MISSING_FILE"
  exit 2
fi

python - <<'PY'
import json, re, sys, collections

path = "injective_data/ofac.json"
try:
    data = json.load(open(path))
except Exception as e:
    print("JSON_ERROR", e)
    sys.exit(3)

if not isinstance(data, list):
    print("ROOT_NOT_LIST", type(data).__name__)
    sys.exit(4)

invalid = []
not_strings = []
for i, v in enumerate(data):
    if not isinstance(v, str):
        not_strings.append((i+1, v))
        continue
    if not (v.startswith("0x") and len(v) == 42 and re.fullmatch(r"0x[0-9a-fA-F]{40}", v)):
        invalid.append((i+1, v))

lowered = [v.lower() for v in data if isinstance(v, str)]
ctr = collections.Counter(lowered)
dups = [addr for addr, count in ctr.items() if count > 1]

has_upper = any(any(c.isalpha() and c.isupper() for c in v[2:]) for v in data if isinstance(v, str))
sorted_lower = sorted(lowered)

print("TOTAL_ENTRIES", len(data))
if not_strings:
    print("NOT_STRINGS_SAMPLE", not_strings[:10])
if invalid:
    print("INVALID_ADDRESSES_SAMPLE", invalid[:10])
if dups:
    print("CASE_INSENSITIVE_DUPLICATES", dups[:20])
print("CASING_POLICY", "mixed-case" if has_upper else "all-lowercase")
print("SORTED_CASE_INSENSITIVE", "yes" if lowered == sorted_lower else "no")
print("FIRST_20_ENTRIES")
for v in data[:20]:
    print(v)
PY
chain/exchange/types/msgs.go (1)

1640-1643: LGTM: enforce vanilla limit orders for liquidation.

Clear, explicit check preventing PO/atomic/conditional orders during liquidation. Consistent with error semantics.

chain/exchange/types/v2/msgs.go (1)

1810-1813: LGTM: v2 mirrors vanilla limit requirement for liquidation.

Parity with v1 path; good defensive validation.

injective_data/chain_messages_list.json (1)

70-70: Message added matches new proto surface.

MsgCancelPostOnlyMode inclusion aligns with tx.proto changes.

client/chain/context.go (1)

47-47: Registering downtime-detector interfaces — good catch.

Prevents Any/codec issues when handling downtime-detector types.

Also applies to: 157-158

Makefile (1)

54-59: Downtime-detector types copy step — looks correct.

Copies pb + codec + constants + genesis + keys; matches module wiring elsewhere.

chain/exchange/types/expected_keepers.go (1)

16-16: DowntimeKeeper interface: clean, minimal surface.

Signatures are practical for exchange module checks.

Also applies to: 86-89

client/common/network.go (1)

16-20: Token list endpoints verified — live and returning valid JSON.
All three URLs (mainnet/testnet/devnet) return HTTP 200 and parse as valid JSON; no change required.

chain/downtime-detector/types/codec.go (1)

18-26: LGTM

Codec scaffolding and sealing look standard for a Cosmos SDK module.

proto/injective/exchange/v2/tx.proto (2)

1543-1550: LGTM: message definitions and annotations are consistent

amino name and signer annotations look correct.

Also applies to: 1552-1553


225-226: Implement Msg server + register MsgCancelPostOnlyMode in codec

Generated protobuf includes MsgCancelPostOnlyMode (chain/exchange/types/v2/tx.pb.go), but I couldn't find a non-generated MsgServer implementation or codec registrations for it. Actions required:

  • Add cdc.RegisterConcrete(&MsgCancelPostOnlyMode{}, "exchange/v2/MsgCancelPostOnlyMode", nil) to RegisterLegacyAminoCodec in chain/exchange/types/v2/codec.go.
  • Include &MsgCancelPostOnlyMode{} (and response types if needed) in registry.RegisterImplementations((*sdk.Msg)(nil), ...) inside RegisterInterfaces in chain/exchange/types/v2/codec.go.
  • Implement CancelPostOnlyMode on your module's msg server (add method on msgServer / NewMsgServerImpl in the keeper/msg server file) and ensure types.RegisterMsgServer(srv, keeper.NewMsgServerImpl(k)) is invoked in the module's RegisterServices/app wiring.
chain/exchange/types/market.go (2)

53-55: Be aware: Hash input change modifies computed market IDs

This is likely intended to prevent collisions, but it’s a breaking change for any code deriving IDs from attributes. Verify no paths compute IDs for existing markets instead of using stored IDs.


16-16: Heads-up: changing binary options MarketID composition — verify compatibility

BO_MARKET_STRING_DELIMITER is added and used in NewBinaryOptionsMarketID (chain/exchange/types/market.go); repo-wide search found no other callers of NewBinaryOptionsMarketID. Confirm whether on-chain MarketId values or external services/indexers/clients re-derive IDs at runtime — if they do, this change will break compatibility and must be gated by a migration or network/version bump.

proto/injective/downtimedetector/v1beta1/downtime_duration.proto (1)

4-4: Resolved — buf.yaml already includes gogo-proto

buf.yaml lists buf.build/cosmos/gogo-proto (along with googleapis and cosmos-proto), so the import "gogoproto/gogo.proto" is satisfied.

proto/injective/downtimedetector/v1beta1/genesis.proto (1)

4-4: Verify buf deps include gogo-proto (cannot auto-verify — buf.yaml missing)

proto/injective/downtimedetector/v1beta1/genesis.proto imports "gogoproto/gogo.proto" — confirm your buf config (buf.yaml, buf.work or buf.lock) lists the gogo-proto buf dependency or that the proto is vendored so the import resolves. The automated check failed with "buf.yaml: No such file or directory".

proto/injective/downtimedetector/v1beta1/query.proto (1)

16-16: Verify go_package correctness across repos

go_package points to injective-core path, while SDK code imports downtime types from sdk-go. Confirm this target is intentional and consistent with codegen and module wiring.

chain/exchange/types/v2/params.go (1)

287-302: Validation logic looks good

Checks type, emptiness, and membership in enum map. This aligns with the Downtime_value map in downtime-detector types.

Please ensure MinPostOnlyModeDowntimeDuration default ("DURATION_10M") matches the enum strings in generated PB (case and value).

Comment on lines +4 to +7
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.91 --depth 1 --single-branch

clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.16.3 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.16.4 --depth 1 --single-branch
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Verify tag/branch availability for reproducible clones.

Ensure these refs exist to avoid CI flakes.


🏁 Script executed:

#!/bin/bash
set -euo pipefail
git ls-remote --tags https://github.com/InjectiveLabs/injective-indexer.git "v1.16.91"
git ls-remote --tags https://github.com/InjectiveLabs/injective-core.git "v1.16.4"

Length of output: 115


🏁 Script executed:

#!/bin/bash
set -euo pipefail
repos=(
  "https://github.com/InjectiveLabs/injective-indexer|v1.16.91"
  "https://github.com/InjectiveLabs/injective-core|v1.16.4"
)
for entry in "${repos[@]}"; do
  url="${entry%%|*}"
  tag="${entry##*|}"
  echo "---- Checking repo page: $url  tag/branch: $tag ----"
  echo "- HTTP status for repo page:"
  curl -sSL -o /dev/null -w "%{http_code}\n" "$url" || true
  echo "- HTTP status for repo.git endpoint:"
  curl -sSL -o /dev/null -w "%{http_code}\n" "${url}.git" || true
  echo "- git ls-remote for tag/branch refs:"
  git ls-remote --heads --tags "${url}.git" "refs/tags/${tag}" "refs/heads/${tag}" || true
  echo "- sample tags (first 20 lines) from git ls-remote --tags:"
  git ls-remote --tags "${url}.git" | sed -n '1,20p' || true
  echo
done

Length of output: 999


Fix unreachable repo URLs referenced in Makefile clones

Both referenced repos/tags (InjectiveLabs/[email protected] and InjectiveLabs/[email protected]) return HTTP 404 and git ls-remote failed — CI will fail to clone. Update the Makefile to point to valid repo URLs/tags (or use mirrors/commit SHAs) and re-verify with git ls-remote.

Location: Makefile lines 4-7

🤖 Prompt for AI Agents
In Makefile around lines 4 to 7, the git clone targets for
InjectiveLabs/[email protected] and
InjectiveLabs/[email protected] are returning 404s; replace those
unreachable tags with valid references or mirrors (preferred: a verified tag or
commit SHA) and update the clone commands accordingly, then run git ls-remote
<repo> <ref> for each to confirm accessibility; ensure you keep --depth 1
--single-branch and update only the URL or ref (or point to a maintained mirror)
so CI can successfully clone.

];
}

// GenesisState defines the twap module's genesis state.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix copy-paste doc: references the wrong module (“twap”)

User-facing proto docs should say “downtime-detector”.

-// GenesisState defines the twap module's genesis state.
+// GenesisState defines the downtime-detector module's genesis state.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// GenesisState defines the twap module's genesis state.
// GenesisState defines the downtime-detector module's genesis state.
🤖 Prompt for AI Agents
In proto/injective/downtimedetector/v1beta1/genesis.proto around line 22, the
comment for GenesisState incorrectly references the "twap" module; update the
docstring to reference "downtime-detector" (e.g., change "twap module's genesis
state" to "downtime-detector module's genesis state") to correct the copy-paste
error and ensure user-facing docs mention the proper module name.

syntax = "proto3";
package injective.downtimedetector.v1beta1;

import "gogoproto/gogo.proto";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Buf compile error: missing gogoproto dependency

Buf reports: import "gogoproto/gogo.proto": file does not exist. Ensure buf deps include gogoproto, or vendor the file.

Two options:

  • Add to buf.yaml:
    deps:
    • buf.build/cosmos/gogoproto
    • buf.build/cosmos/cosmos-proto
  • Or adjust your module configuration to provide gogoproto/gogo.proto.
🧰 Tools
🪛 Buf (1.57.2)

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

🤖 Prompt for AI Agents
In proto/injective/downtimedetector/v1beta1/query.proto around line 4, the
import of "gogoproto/gogo.proto" fails because Buf can't find the gogoproto
dependency; fix by updating your repository's buf configuration to include the
gogoproto dependency (for example add buf.build/cosmos/gogoproto and
buf.build/cosmos/cosmos-proto under deps in buf.yaml) or alternatively vendor
the gogoproto/gogo.proto file into your proto tree or ensure your module's proto
include paths provide that file so the import resolves during buf compile.

@aarmoa aarmoa merged commit 56d001c into dev Sep 24, 2025
6 checks passed
@aarmoa aarmoa deleted the feat/sync_dev_with_master_after_v1_58_3 branch September 24, 2025 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant