-
Notifications
You must be signed in to change notification settings - Fork 61
release/v1_58_3 #331
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
release/v1_58_3 #331
Conversation
…and indexer v1.16.91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Updates proto definitions to match injective-core v1.16.4 and indexer v1.16.91, introducing new features including post-only mode functionality and downtime detection, along with enhanced auction capabilities.
- Added new exchange functionality for canceling post-only mode with corresponding message types
- Introduced downtime detector module with duration enums and query capabilities
- Enhanced auction module with bidder whitelist support and new auction v2 endpoints
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| proto/injective/exchange/v2/tx.proto | Added MsgCancelPostOnlyMode message and RPC endpoint |
| proto/injective/exchange/v2/exchange.proto | Added post-only mode parameters and deprecated legacy field |
| proto/injective/downtimedetector/v1beta1/*.proto | New downtime detector module definitions |
| proto/injective/auction/v1beta1/auction.proto | Added bidders whitelist parameter |
| exchange/auction_rpc/pb/*.go | Added new auction v2 RPC endpoints and message types |
| injective_data/chain_messages_list.json | Added MsgCancelPostOnlyMode to supported messages |
| examples/chain/exchange/*/example.go | Updated oracle scale factor from 6 to 0 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
WalkthroughAdd a downtime‑detector module (proto + Go types), wire its codecs into the client, extend exchange v2 with Post‑Only mode params and a CancelPostOnlyMode message, add auction bidders whitelist, adjust market/validation logic and examples, update Makefile copy/clone targets and dependency versions. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant MsgSvc as exchange.v2 Msg
participant Keeper as Exchange Keeper
participant Store as KV Store
Client->>MsgSvc: MsgCancelPostOnlyMode{sender}
MsgSvc->>Keeper: CancelPostOnlyMode(ctx, msg)
Note right of Keeper #F0F7FF: mark cancellation for next BeginBlock (set flag)
Keeper->>Store: Set(`PostOnlyModeCancellationKey`, true)
Keeper-->>Client: MsgCancelPostOnlyModeResponse
sequenceDiagram
autonumber
actor Client
participant QuerySvc as downtimedetector.v1beta1 Query
participant DK as Downtime Keeper
participant Store as KV Store
Client->>QuerySvc: RecoveredSinceDowntimeOfLength{downtime, recovery}
QuerySvc->>DK: GetLastDowntimeOfLength(ctx, downtime)
DK->>Store: Read last downtime key
DK-->>QuerySvc: lastDowntime
QuerySvc->>QuerySvc: compute (now - lastDowntime) >= recovery
QuerySvc-->>Client: RecoveredSinceDowntimeOfLengthResponse{successfully_recovered}
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ 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)
Comment |
There was a problem hiding this 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
🧹 Nitpick comments (15)
proto/injective/auction/v1beta1/auction.proto (1)
27-30: Add param validation for bidders_whitelist (bech32, dedupe, size limits).Proto addition is fine. Ensure Params.Validate enforces valid bech32 addresses, no duplicates, and optional max length to prevent large params.
If not present in the module, add validation in the auction params’ Validate() and tests covering:
- invalid address
- duplicates
- empty vs non-empty semantics
chain/exchange/types/key.go (1)
125-126: Approve: PostOnlyModeCancellationKey (0x87) — no prefix collision foundSearch of chain/exchange/types shows only the declaration at chain/exchange/types/key.go:125; other 0x87 hits are autogenerated .pb.go byte arrays, not store key constants.
- Add a brief comment in the keeper logic where this key is set/cleared for traceability.
chain/exchange/types/expected_keepers.go (1)
86-89: Interface surface LGTM; consider “not found” semantics.If “no recorded downtime” is a normal condition, consider returning (time.Time, bool) to avoid error-as-control-flow. Optional.
Makefile (1)
7-7: Pin injective-core to an immutable ref for reproducible builds.Using a moving branch (release/v1.16.x) makes artifacts non-deterministic across time. Prefer a tag or commit SHA.
Apply:
-clone-injective-core: - git clone https://github.com/InjectiveLabs/injective-core.git -b release/v1.16.x --depth 1 --single-branch +INJECTIVE_CORE_REF ?= v1.16.4 +clone-injective-core: + git clone https://github.com/InjectiveLabs/injective-core.git -b $(INJECTIVE_CORE_REF) --depth 1 --single-branch(Define INJECTIVE_CORE_REF near the top.)
chain/downtime-detector/types/keys.go (1)
7-15: Keys are fine; minor allocation nit.Formatting keys with fmt.Sprintf allocates each call. If hot, consider byte prefix concatenation.
Apply:
-var ( - lastBlockTimestampKey = []byte("last_block_timestamp") - lastDowntimeOfLengthPrefix = "last_downtime_of_length/%s" -) +var ( + lastBlockTimestampKey = []byte("last_block_timestamp") + lastDowntimeOfLengthPrefix = []byte("last_downtime_of_length/") +) func GetLastBlockTimestampKey() []byte { return lastBlockTimestampKey } -func GetLastDowntimeOfLengthKey(downtimeDur Downtime) []byte { - return []byte(fmt.Sprintf(lastDowntimeOfLengthPrefix, downtimeDur.String())) -} +func GetLastDowntimeOfLengthKey(downtimeDur Downtime) []byte { + return append(append([]byte(nil), lastDowntimeOfLengthPrefix...), []byte(downtimeDur.String())...) +}proto/injective/exchange/v2/exchange.proto (1)
197-206: Prefer a typed enum — but changing it is a breaking proto/param-store change, so choose migrate or keep & validate.Repo currently uses a string for min_post_only_mode_downtime_duration and validates against the downtime mappings (DowntimeToDuration / DowntimeStrings); changing to a protobuf enum will be wire-incompatible and requires a proto + codegen + state/genesis/params migration.
- If you switch to an enum: import injective/downtimedetector/v1beta1/downtime_duration.proto and change the field to injective.downtimedetector.v1beta1.Downtime in proto/injective/exchange/v2/exchange.proto; regenerate protos and add migrations/updates for params and genesis (update chain/exchange/types/v2/params.go, chain/exchange/types/v2/exchange.pb.go, chain/downtime-detector/types/constants.go, chain/downtime-detector/types/genesis.go).
- If you keep the string for compatibility: enforce strict validation and document allowed literals (Params.Validate already rejects unknown values; use DowntimeStrings() as the canonical list).
chain/downtime-detector/types/genesis.go (2)
5-17: Small perf/readability tweak in DefaultGenesis.Pre-allocate and reuse the helper ctor for entries.
Apply:
func DefaultGenesis() *GenesisState { - genDowntimes := []GenesisDowntimeEntry{} - for _, downtime := range DowntimeToDuration.Keys() { - genDowntimes = append(genDowntimes, GenesisDowntimeEntry{ - Duration: downtime, - LastDowntime: DefaultLastDowntime, - }) - } + keys := DowntimeToDuration.Keys() + genDowntimes := make([]GenesisDowntimeEntry, 0, len(keys)) + for _, downtime := range keys { + genDowntimes = append(genDowntimes, NewGenesisDowntimeEntry(downtime, DefaultLastDowntime)) + } return &GenesisState{ Downtimes: genDowntimes, LastBlockTime: time.Unix(0, 0), } }
19-21: Consider validating genesis invariants.E.g., ensure all known enum values are present once and timestamps are sane.
Example (outside this hunk):
func (g *GenesisState) Validate() error { seen := map[Downtime]struct{}{} for _, d := range g.Downtimes { if _, ok := DowntimeToDuration.Get(d.Duration); !ok { return fmt.Errorf("unknown downtime: %v", d.Duration) } if _, dup := seen[d.Duration]; dup { return fmt.Errorf("duplicate downtime: %v", d.Duration) } seen[d.Duration] = struct{}{} } return nil }proto/injective/downtimedetector/v1beta1/downtime_duration.proto (1)
9-33: Consider dropping enumvalue_customname to avoid generator coupling.Generated Go uses
Downtime_DURATION_*(per pb.go), while custom names aim forDURATION_*. Keeping both risks drift if generator flags change. Recommend removing the per-value customname options to match actual constants used in Go.Example (apply to all values):
- DURATION_10M = 6 [ (gogoproto.enumvalue_customname) = "DURATION_10M" ]; + DURATION_10M = 6;chain/downtime-detector/types/constants.go (2)
25-27: Comment nit: reference the correct enum name.Use “Downtime enum” (not “Duration enum”) for clarity.
-// from the Duration enum values to their corresponding +// from the Downtime enum values to their corresponding
67-83: Optional: avoid O(n) scan in DowntimeByDuration.Tiny set now, but you can precompute a reverse map in init for O(1) lookup and simpler code.
var ( DowntimeToDuration = btree.NewMap[Downtime, time.Duration](16) DefaultLastDowntime = time.Unix(0, 0) ) +var durationToDowntime = map[time.Duration]Downtime{} @@ func init() { @@ 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 + }) } @@ 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) }proto/injective/downtimedetector/v1beta1/query.proto (1)
8-15: Prune unused imports to satisfy buf lint.Only annotations.proto and duration.proto are used here. Removing the rest reduces noise and lint warnings.
-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";proto/injective/downtimedetector/v1beta1/genesis.proto (1)
22-22: Docstring module name is wrong.Replace “twap” with “downtime-detector”.
-// GenesisState defines the twap module's genesis state. +// GenesisState defines the downtime-detector module's genesis state.chain/exchange/types/v2/params.go (2)
263-273: Unify validator usage to avoid divergence.ParamSetPairs uses types.ValidateAtomicMarketOrderAccessLevel, while Validate() uses the local version. Prefer one implementation everywhere.
- types.ValidateAtomicMarketOrderAccessLevel, + ValidateAtomicMarketOrderAccessLevel,Or delete the local function and use the types version consistently.
287-302: Minor UX: accept lowercase and surface allowed values.Normalize input to uppercase and include valid options in the error message.
func ValidateMinPostOnlyModeDowntimeDuration(downtimeDuration any) error { v, ok := downtimeDuration.(string) if !ok { return fmt.Errorf("invalid parameter type: %T", downtimeDuration) } if v == "" { return errors.New("MinPostOnlyModeDowntimeDuration cannot be empty") } - if _, exists := downtimetypes.Downtime_value[v]; !exists { - return fmt.Errorf("invalid MinPostOnlyModeDowntimeDuration value: %s", v) + up := strings.ToUpper(v) + if _, exists := downtimetypes.Downtime_value[up]; !exists { + // build sorted list once if needed; inline here for simplicity + opts := make([]string, 0, len(downtimetypes.Downtime_value)) + for k := range downtimetypes.Downtime_value { opts = append(opts, k) } + sort.Strings(opts) + return fmt.Errorf("invalid MinPostOnlyModeDowntimeDuration value: %s (allowed: %s)", v, strings.Join(opts, ", ")) } return nil }(Remember to add imports: strings, sort.)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
chain/auction/types/auction.pb.gois excluded by!**/*.pb.gochain/downtime-detector/types/downtime_duration.pb.gois excluded by!**/*.pb.gochain/downtime-detector/types/genesis.pb.gois excluded by!**/*.pb.gochain/downtime-detector/types/query.pb.gois excluded by!**/*.pb.gochain/exchange/types/v2/exchange.pb.gois excluded by!**/*.pb.gochain/exchange/types/v2/tx.pb.gois excluded by!**/*.pb.goexchange/auction_rpc/pb/goadesign_goagen_injective_auction_rpc.pb.gois excluded by!**/*.pb.goexchange/auction_rpc/pb/goadesign_goagen_injective_auction_rpc_grpc.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (21)
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)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)injective_data/chain_messages_list.json(1 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/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/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/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)
chain/exchange/types/expected_keepers.go (1)
chain/downtime-detector/types/downtime_duration.pb.go (2)
Downtime(24-24)Downtime(114-116)
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/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)
🪛 Buf (1.55.1)
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 (19)
examples/chain/exchange/13_MsgInstantBinaryOptionsMarketLaunch/example.go (1)
77-78: Verify OracleScaleFactor = 0 matches feeder decimals and tick sizesAll example launch msgs set OracleScaleFactor: 0 (examples/chain/exchange/4_MsgInstantPerpetualMarketLaunch/example.go; examples/chain/exchange/5_MsgInstantExpiryFuturesMarketLaunch/example.go; examples/chain/exchange/13_MsgInstantBinaryOptionsMarketLaunch/example.go). Confirm the feeder/oracle decimals for INJ/USDC and the UFC provider and ensure MinPriceTickSize / MinQuantityTickSize are correct with scale=0.
examples/chain/exchange/5_MsgInstantExpiryFuturesMarketLaunch/example.go (1)
77-78: LGTM: OracleScaleFactor set to 0.Consistent with the other example changes.
chain/exchange/types/msgs.go (1)
1640-1642: LGTM — liquidation-order guard mirrored in v2.
Exists in chain/exchange/types/msgs.go (lines 1640–1642) and chain/exchange/types/v2/msgs.go (lines 1810–1812).examples/chain/exchange/4_MsgInstantPerpetualMarketLaunch/example.go (1)
77-78: LGTM: OracleScaleFactor = 0.Matches the updated examples set.
chain/exchange/types/market.go (1)
16-16: Binary options market ID derivation changed (delimiter prefix) — verify cross-version compatibility.
- NewBinaryOptionsMarketID now includes BO_MARKET_STRING_DELIMITER = "-BO-MARKET-" in the hash preimage; this changes derived market IDs. (chain/exchange/types/market.go)
- Repo contains many hard-coded market IDs in examples/tests (examples/exchange/**, client/chain/markets_assistant_test_support.go) — update consumers that derive IDs locally instead of using chain-provided IDs.
- Confirm whether the upstream injective-core release you target (e.g., v1.16.4) also changed the derivation; if so add a CHANGELOG entry and a doc comment warning that derived market IDs are not stable across SDK/chain versions.
injective_data/chain_messages_list.json (1)
70-71: Registered injective.exchange.v2.MsgCancelPostOnlyMode — verifiedProto definition + RPC, generated Go types/RPC stubs and proto.RegisterType are present; entry exists in injective_data/chain_messages_list.json. Files: proto/injective/exchange/v2/tx.proto; chain/exchange/types/v2/tx.pb.go; injective_data/chain_messages_list.json
chain/exchange/types/v2/msgs.go (1)
1810-1812: Tighter liquidation validation looks correct.Ensuring liquidation orders are vanilla limit (BUY/SELL) prevents PO/conditional/atomic misuse. No further issues spotted here.
If there are existing clients sending non-vanilla liquidation orders, confirm they gracefully handle the new rejection.
chain/exchange/types/expected_keepers.go (1)
16-16: New downtime-detector import is appropriate.Importing the downtime-detector types at the types layer is consistent with the new params usage.
Makefile (2)
4-4: Indexer ref bumped to v1.16.91 — verify pb.go origin & SDK helpers compile.rg over proto shows only go_package = "github.com/InjectiveLabs/injective-core/..." and no "injective-indexer" matches; confirm pb.go were actually copied from [email protected] and that SDK-generated helpers still compile.
- Run:
- find . -name '*.pb.go' -print
- git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.91 --depth 1 /tmp/injective-indexer-v1.16.91
- for f in $(find . -name '*.pb.go'); do diff -u "$f" "/tmp/injective-indexer-v1.16.91/${f#./}" || true; done
- go test ./... (or go build ./... if tests not available)
54-59: Copying downtime-detector types — confirm sed import rewrites appliedSandbox verification failed (no output / nl missing); cannot confirm imports were rewritten. Check Makefile sed lines 154–155 and ensure they run over chain/downtime-detector/types/.go. Locally run: rg -n 'github.com/InjectiveLabs/injective-core/injective-chain/modules' chain || true and inspect chain/downtime-detector/types/.go.
chain/downtime-detector/types/codec.go (1)
1-26: Minimal codec wiring LGTM.ModuleCdc setup and authz Amino registration are fine for a types-only module.
proto/injective/exchange/v2/tx.proto (3)
225-227: New RPC CancelPostOnlyMode added — OK.Service surface addition is clear and consistent with existing style.
1539-1550: MsgCancelPostOnlyMode message: OK.Single-signer message matches the service addition. No concerns.
1552-1553: Empty response type: OK.Follows existing patterns for admin-style toggles.
proto/injective/downtimedetector/v1beta1/query.proto (2)
16-16: Verify go_package path alignment (sdk-go vs injective-core).Ensure proto generation/imports won’t point at injective-core inside sdk-go builds.
See the downtime_duration.proto go_package verification script.
4-4: No Buf fix required — gogoproto dependency is present.proto/buf.yaml includes buf.build/cosmos/gogo-proto and go.mod contains github.com/cosmos/gogoproto v1.7.0 (buf.lock also references gogo-proto), so the import "gogoproto/gogo.proto" in proto/injective/downtimedetector/v1beta1/query.proto is already covered.
proto/injective/downtimedetector/v1beta1/genesis.proto (2)
11-11: Verify go_package path alignment (sdk-go vs injective-core).Same concern as other protos; please confirm generation/import strategy.
4-4: ```shell
#!/usr/bin/env bashVerify presence of gogoproto import and buf deps / vendored file
echo "PWD: $(pwd)"
echo
echo "---- Check file proto/injective/downtimedetector/v1beta1/genesis.proto ----"
if [ -f proto/injective/downtimedetector/v1beta1/genesis.proto ]; then
sed -n '1,200p' proto/injective/downtimedetector/v1beta1/genesis.proto
else
echo "MISSING: proto/injective/downtimedetector/v1beta1/genesis.proto"
fi
echo
echo "---- Search repo for 'gogoproto' and 'gogo.proto' ----"
if command -v rg >/dev/null 2>&1; then
rg -n --hidden -S 'gogoproto|gogo.proto' || true
else
grep -RIn --exclude-dir=.git -e 'gogoproto' -e 'gogo.proto' . || true
fi
echo
echo "---- Locate buf config files ----"
for f in buf.yaml buf.work.yaml buf.yaml.base; do
if [ -f "$f" ]; then
echo "---- $f ----"
sed -n '1,200p' "$f"
fi
done
echo
echo "---- Search buf.yaml for deps referencing cosmos/gogo-proto or gogo-proto ----"
if [ -f buf.yaml ]; then
if command -v rg >/dev/null 2>&1; then
rg -n --hidden -S 'cosmos/gogo-proto|cosmos/gogoproto|gogo-proto' buf.yaml || true
else
grep -In --exclude-dir=.git -e 'cosmos/gogo-proto' -e 'cosmos/gogoproto' -e 'gogo-proto' buf.yaml || true
fi
else
echo "no buf.yaml at repo root"
fi
echo
echo "---- Search entire repo for 'cosmos/gogo-proto' or 'cosmos/gogoproto' ----"
if command -v rg >/dev/null 2>&1; then
rg -n --hidden -S 'cosmos/gogo-proto|cosmos/gogoproto|gogo-proto' || true
else
grep -RIn --exclude-dir=.git -e 'cosmos/gogo-proto' -e 'cosmos/gogoproto' -e 'gogo-proto' . || true
fi
echo
echo "---- Find any gogo.proto file in repo ----"
find . -type f -name 'gogo.proto' -print || true
echo
echo "Done"</blockquote></details> <details> <summary>chain/exchange/types/v2/params.go (1)</summary><blockquote> `168-170`: **Sane defaults for Post-Only mode.** 2000 blocks and DURATION_10M look reasonable as starting points. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
| paramtypes.NewParamSetPair( | ||
| KeyPostOnlyModeBlocksAmount, | ||
| &p.PostOnlyModeBlocksAmount, | ||
| ValidatePostOnlyModeBlocksAmount, | ||
| ), | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Param not wired: KeyMinPostOnlyModeDowntimeDuration is missing from ParamSetPairs.
Without this, the param store cannot set/get the value. Add a ParamSetPair.
paramtypes.NewParamSetPair(
KeyPostOnlyModeBlocksAmount,
&p.PostOnlyModeBlocksAmount,
ValidatePostOnlyModeBlocksAmount,
),
+ paramtypes.NewParamSetPair(
+ KeyMinPostOnlyModeDowntimeDuration,
+ &p.MinPostOnlyModeDowntimeDuration,
+ ValidateMinPostOnlyModeDowntimeDuration,
+ ),📝 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.
| paramtypes.NewParamSetPair( | |
| KeyPostOnlyModeBlocksAmount, | |
| &p.PostOnlyModeBlocksAmount, | |
| ValidatePostOnlyModeBlocksAmount, | |
| ), | |
| } | |
| paramtypes.NewParamSetPair( | |
| KeyPostOnlyModeBlocksAmount, | |
| &p.PostOnlyModeBlocksAmount, | |
| ValidatePostOnlyModeBlocksAmount, | |
| ), | |
| paramtypes.NewParamSetPair( | |
| KeyMinPostOnlyModeDowntimeDuration, | |
| &p.MinPostOnlyModeDowntimeDuration, | |
| ValidateMinPostOnlyModeDowntimeDuration, | |
| ), | |
| } |
🤖 Prompt for AI Agents
In chain/exchange/types/v2/params.go around lines 126 to 131, the ParamSetPairs
slice is missing an entry for KeyMinPostOnlyModeDowntimeDuration so the param
store cannot set/get that value; add a param pair using
paramtypes.NewParamSetPair(KeyMinPostOnlyModeDowntimeDuration,
&p.MinPostOnlyModeDowntimeDuration, ValidateMinPostOnlyModeDowntimeDuration)
(ensure the field name exactly matches the struct field and the validator
function exists/ is referenced correctly).
| syntax = "proto3"; | ||
| package injective.downtimedetector.v1beta1; | ||
|
|
||
| import "gogoproto/gogo.proto"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
Fix Buf compile: missing gogoproto dependency.
Buf reports “import gogoproto/gogo.proto: file does not exist”. Add the gogo-proto module to buf deps or vendor the file.
Example (buf.yaml):
deps:
+ - buf.build/cosmos/gogo-protoThen run:
🏁 Script executed:
#!/bin/bash
buf mod update && buf build && buf lintLength of output: 272
Fix Buf build: add gogo-proto dependency (missing gogoproto/gogo.proto).
Buf fails with: import "gogoproto/gogo.proto": file does not exist. Add the gogo-proto module to buf deps or vendor the gogoproto files.
Affected files (examples to fix):
- proto/injective/downtimedetector/v1beta1/downtime_duration.proto:4
- proto/injective/auction/v1beta1/auction.proto:4
Suggested change (buf.yaml):
deps:
+ - buf.build/cosmos/gogo-protoThen verify:
buf mod update && buf build && buf lint🧰 Tools
🪛 Buf (1.55.1)
4-4: import "gogoproto/gogo.proto": file does not exist
(COMPILE)
🤖 Prompt for AI Agents
proto/injective/downtimedetector/v1beta1/downtime_duration.proto (line 4) and
proto/injective/auction/v1beta1/auction.proto (line 4): Buf build fails because
gogoproto/gogo.proto is missing; add the gogo-proto dependency to your buf
module (buf.yaml) under deps (or vendor the gogoproto files into
proto/gogoproto) so the import resolves, then run buf mod update && buf build &&
buf lint to verify; ensure the dependency uses the correct module path/version
for gogo-proto used by your project.
|
|
||
| import "gogoproto/gogo.proto"; | ||
|
|
||
| option go_package = "github.com/InjectiveLabs/injective-core/injective-chain/modules/downtime-detector/types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify go_package path aligns with sdk-go imports.
go_package points to injective-core, while this repo imports downtimetypes from sdk-go. Ensure your proto-gen or copy step won’t emit imports targeting injective-core into sdk-go builds.
Run:
🏁 Script executed:
#!/bin/bash
rg -n 'option go_package' proto/injective/downtimedetector/v1beta1
rg -nP 'github\.com/InjectiveLabs/injective-core/.+downtime-detector/types' -g '!**/*.proto'Length of output: 662
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== proto go_package in downtime-detector v1beta1 ==="
rg -n "option go_package" proto/injective/downtimedetector/v1beta1 -S || true
echo
echo "=== search for exact go_package import path across repo ==="
rg -n --hidden --no-ignore -S "github.com/InjectiveLabs/injective-core/injective-chain/modules/downtime-detector/types" || true
echo
echo "=== search for any occurrences of 'downtime-detector/types' across repo ==="
rg -n --hidden --no-ignore -S "downtime-detector/types" || true
echo
echo "=== search for 'InjectiveLabs/injective-core' imports in non-proto files ==="
rg -n --hidden --no-ignore -S "github.com/InjectiveLabs/injective-core" -g '!*/*.proto' || true
echo
echo "=== search for sdk-go references (to compare) ==="
rg -n --hidden --no-ignore -S "github.com/InjectiveLabs/sdk-go" || true
echo
echo "=== list files in the proto dir ==="
ls -la proto/injective/downtimedetector/v1beta1 || trueLength of output: 125898
Update proto go_package to sdk-go import path
- proto/injective/downtimedetector/v1beta1/{downtime_duration.proto:6, genesis.proto:11, query.proto:16} currently set to "github.com/InjectiveLabs/injective-core/injective-chain/modules/downtime-detector/types" — change to "github.com/InjectiveLabs/sdk-go/chain/downtime-detector/types".
- Makefile currently copies pb.go from injective-core (Makefile lines 54–59) and runs sed to rewrite imports (Makefile lines 154–155); do not rely on that fragile workaround — fix the proto go_package or ensure codegen/copy+sed runs in CI and is validated.
🤖 Prompt for AI Agents
In proto/injective/downtimedetector/v1beta1 around line 6 (and similarly in
proto/injective/downtimedetector/v1beta1/genesis.proto line 11 and query.proto
line 16), the proto file go_package is pointing to
"github.com/InjectiveLabs/injective-core/injective-chain/modules/downtime-detector/types";
update these go_package options to
"github.com/InjectiveLabs/sdk-go/chain/downtime-detector/types". After updating
the proto files, remove or stop relying on the Makefile copy+sed workaround and
instead regenerate PB Go code from the corrected protos, and ensure the
Makefile/CI runs codegen and validates that generated imports match the new
go_package so the sed step is unnecessary.
There was a problem hiding this 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
🧹 Nitpick comments (2)
go.mod (1)
255-255: Replace to cosmos-sdk inj.6 is fine; optionally align require for visibility.Not required, but updating the
require github.com/cosmos/cosmos-sdkline tov0.50.13mirrors the effective version after replace.injective_data/ofac.json (1)
8-8: Optional: add provenance metadata.Consider adding a small metadata file (e.g., injective_data/ofac.meta.json) with source URL, snapshot date, and upstream version to aid audits.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (3)
Makefile(2 hunks)go.mod(4 hunks)injective_data/ofac.json(4 hunks)
🔇 Additional comments (7)
go.mod (4)
94-94: LGTM: iavl bumped to v1.2.6 (indirect).
238-247: Replacements aligned to evm-comet1-inj.6 — no require drift foundgo.mod only contains a replace mapping github.com/cosmos/cosmos-sdk => github.com/InjectiveLabs/cosmos-sdk v0.50.13-evm-comet1-inj.6 (line 255); there's no top-level require pinned to v0.50.9, so no require bump is needed.
Likely an incorrect or invalid review comment.
253-253: Confirm API compatibility: CometBFT core bumped to inj.3 but api is inj.2go.mod has replacements: core => github.com/InjectiveLabs/cometbft v1.0.1-inj.3 and api => github.com/injectivelabs/cometbft/api v1.0.0-inj.2 (go.mod lines 253–254). Confirm v1.0.1-inj.3 is API-compatible with the inj.2 api; if not, update the api replacement to a matching inj.3 version or adjust dependent code.
33-33: Keepgithub.com/tidwall/btreeas a direct dependency.
Direct import found at chain/downtime-detector/types/constants.go:8 — go.mod entry is correct.injective_data/ofac.json (1)
8-8: LGTM — OFAC addresses validatedValidation: TOTAL=84; no case-sensitive or case-insensitive duplicates; all entries match ^0x[0-9a-fA-F]{40}$.
Makefile (2)
7-7: Centralize and pin core tag — v1.16.4 not found upstreamgh API returned 404 for refs/tags/v1.16.4; confirm the tag name or provide the target commit SHA. Still recommend centralizing the tag and optionally pinning a SHA.
Proposed Makefile snippet:
At top
CORE_TAG ?= v1.16.4
clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b $(CORE_TAG) --depth 1 --single-branch
54-59: LGTM — downtime-detector types copy complete. Confirmed chain/downtime-detector/types has codec.go, constants.go, genesis.go, keys.go and proto files (downtime_duration.pb.go, genesis.pb.go, query.pb.go); no other non-pb .go files found.
| go 1.23.5 | ||
|
|
||
| toolchain go1.23.8 | ||
| go 1.23.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Fix invalid go directive (must be major.minor, not patch).
go 1.23.9 is invalid. The go line only accepts major.minor. If you want to pin the patch toolchain, add a separate toolchain directive.
Apply this diff:
-go 1.23.9
+go 1.23
+toolchain go1.23.9🏁 Script executed:
#!/bin/bash
# Verify 'go' directive format and presence of toolchain.
awk '/^go /{print $2}' go.mod | grep -P '^\d+\.\d+$' >/dev/null || { echo "Invalid go directive (expect major.minor)"; awk '/^go /{print "found:",$2}' go.mod; exit 1; }
rg -n '^toolchain\s+go1\.' go.mod || echo "Note: no toolchain directive found (optional)."Length of output: 55
Fix invalid go directive — must be major.minor
go 1.23.9 is invalid; change to go 1.23. To pin the patch toolchain, add toolchain go1.23.9.
-go 1.23.9
+go 1.23
+toolchain go1.23.9📝 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.
| go 1.23.9 | |
| go 1.23 | |
| toolchain go1.23.9 |
🤖 Prompt for AI Agents
In go.mod around line 3, the go directive "go 1.23.9" is invalid; change it to
the major.minor form "go 1.23" and, if you need to pin the patch toolchain, add
a separate toolchain directive line "toolchain go1.23.9" (place the toolchain
line near the top of the file, keeping go 1.23 as the go directive).
|
|
||
| github.com/cometbft/cometbft => github.com/InjectiveLabs/cometbft v1.0.1-inj.2 | ||
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Fix module path casing for InjectiveLabs org.
Using github.com/injectivelabs/... may break because the module path must match the module’s declared path (typically github.com/InjectiveLabs/... here).
Apply this diff:
- github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.0-inj.2
+ github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2🏁 Script executed:
#!/bin/bash
# Fail if any lowercase 'github.com/injectivelabs/' remains in replace lines.
if rg -n '^(\s*)[A-Za-z0-9\.\-_/]+ => github\.com/injectivelabs/' go.mod; then
echo "Found lowercase 'injectivelabs' in replace block; fix casing to 'InjectiveLabs'."
exit 1
else
echo "No casing mismatches found in replace block."
fiLength of output: 172
Fix module path casing in go.mod (line 254)
Change the replace directive to use the correct GitHub org casing to match the module's declared path.
- github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.0-inj.2
+ github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2📝 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.
| github.com/cometbft/cometbft/api => github.com/injectivelabs/cometbft/api v1.0.0-inj.2 | |
| github.com/cometbft/cometbft/api => github.com/InjectiveLabs/cometbft/api v1.0.0-inj.2 |
🤖 Prompt for AI Agents
In go.mod around line 254, the replace directive uses incorrect casing for the
GitHub module path; update the replace line so the module path exactly matches
the module's declared path (use the correct org/name casing as declared in that
module) — modify the left-hand path in the replace directive to the exact casing
used by the upstream module and keep the version/tail unchanged.
|
|
||
| clone-injective-indexer: | ||
| git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.69 --depth 1 --single-branch | ||
| git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.91 --depth 1 --single-branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Version bump looks fine; consider pinning to a commit SHA and centralizing the version.
To prevent tag retargeting and ease future bumps, prefer a variable and/or a commit SHA.
Proposed Makefile snippet (outside this line range):
# At top
INDEXER_TAG ?= v1.16.91
clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b $(INDEXER_TAG) --depth 1 --single-branch
Verify the tag exists and resolve its SHA:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
gh api repos/InjectiveLabs/injective-indexer/git/ref/tags/v1.16.91 -q .object.shaLength of output: 138
Pin upstream clone to an immutable ref and centralize the version — tag v1.16.91 not found
gh API returned 404 for refs/tags/v1.16.91; Makefile line 4 currently runs git clone ... -b v1.16.91 — this will fail or be unsafe. Replace the hardcoded tag with a variable and pin to a commit SHA (or fix the tag). Example:
INDEXER_TAG ?= v1.16.91
clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b $(INDEXER_TAG) --depth 1 --single-branch
For immutability prefer INDEXER_SHA and fetch+checkout that SHA instead of relying on a floating tag. Makefile:4
🤖 Prompt for AI Agents
Makefile lines ~4: the Makefile currently clones InjectiveLabs/injective-indexer
using a hardcoded tag v1.16.91 which 404s and is unsafe; replace the hardcoded
tag with a centralized variable (e.g., INDEXER_TAG or preferably INDEXER_SHA)
defined at the top of the Makefile, update the clone target to use that
variable, and if using a SHA perform a shallow clone or clone+fetch and then
checkout the specific SHA to ensure immutability; ensure the tag/sha is
documented in the variable comment so future updates are centralized.
Solves CP-618
Summary by CodeRabbit
New Features
Improvements
Chores