Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
all:

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.54 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.69 --depth 1 --single-branch

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

copy-exchange-client: clone-injective-indexer
rm -rf exchange/*
Expand Down
5 changes: 3 additions & 2 deletions chain/exchange/types/exchange.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions chain/exchange/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type DistributionKeeper interface {
type StakingKeeper interface {
GetDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation, err error)
Validator(context.Context, sdk.ValAddress) (stakingtypes.ValidatorI, error) // get a particular validator by operator address
SetDelegationTransferReceiver(ctx context.Context, receiver sdk.AccAddress)
}
Comment on lines +70 to 71
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Interface addition is source-breaking for implementers; call out/update mocks

Adding SetDelegationTransferReceiver requires downstream implementers/mocks of StakingKeeper to add this method. Please call this out in release notes and update any local mocks/tests accordingly.

To find potential implementers/mocks that need updates (in this repo):


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
# Find concrete types that implement or mock StakingKeeper by name.
rg -n "type .*StakingKeeper|var _ .*StakingKeeper|mock.*StakingKeeper" 

Length of output: 167


Call out interface addition breaking change in release notes

We’ve added SetDelegationTransferReceiver(ctx context.Context, receiver sdk.AccAddress) to the StakingKeeper interface—a source-breaking change for any downstream implementers or mocks. A search revealed no local implementations or mocks of StakingKeeper in this repo, but consumers must:

  • Add SetDelegationTransferReceiver to their own StakingKeeper implementations
  • Update any mocks/tests that assert on this interface

Please document this change in the release notes so integrators can update their code accordingly.

🤖 Prompt for AI Agents
In chain/exchange/types/expected_keepers.go around lines 70-71, the
StakingKeeper interface was extended with SetDelegationTransferReceiver(ctx
context.Context, receiver sdk.AccAddress), which is a breaking API change;
update the release notes to call this out explicitly as a breaking change and
instruct consumers to (1) add SetDelegationTransferReceiver to any downstream
StakingKeeper implementations, (2) update mocks and tests that depend on the
interface to include the new method, and (3) update any integration
documentation or migration guides showing the new method signature and example
usage.


type WasmViewKeeper interface {
Expand Down
421 changes: 233 additions & 188 deletions chain/exchange/types/v2/exchange.pb.go

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions chain/exchange/types/v2/market.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion chain/exchange/types/v2/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ func (msg *MsgUpdateDerivativeMarket) ValidateBasic() error {
}
}


if msg.HasInitialMarginRatioUpdate() && msg.HasMaintenanceMarginRatioUpdate() {
if msg.NewInitialMarginRatio.LTE(msg.NewMaintenanceMarginRatio) {
return types.ErrMarginsRelation
Expand Down Expand Up @@ -2607,3 +2606,35 @@ func hasDuplicatesOrder(slice []*OrderData) bool {
}
return false
}

func (msg *MsgSetDelegationTransferReceivers) Route() string { return RouterKey }
func (msg *MsgSetDelegationTransferReceivers) Type() string { return "setDelegationTransferReceivers" }
func (msg *MsgSetDelegationTransferReceivers) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
return errors.Wrap(sdkerrors.ErrInvalidAddress, msg.Sender)
}

if len(msg.Receivers) == 0 {
return errors.Wrap(sdkerrors.ErrInvalidRequest, "receivers list cannot be empty")
}

for _, receiver := range msg.Receivers {
if _, err := sdk.AccAddressFromBech32(receiver); err != nil {
return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid receiver address: %s", receiver)
}
}

return nil
}

func (msg *MsgSetDelegationTransferReceivers) GetSignBytes() []byte {
bz, _ := json.Marshal(msg)
return sdk.MustSortJSON(bz)
}
Comment on lines +2630 to +2633
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use ModuleCdc for GetSignBytes to preserve JSON encoding consistency

Other messages use types.ModuleCdc.MustMarshalJSON for signing bytes. Using encoding/json directly can diverge if custom marshalling is introduced.

Apply this diff:

-func (msg *MsgSetDelegationTransferReceivers) GetSignBytes() []byte {
-	bz, _ := json.Marshal(msg)
-	return sdk.MustSortJSON(bz)
-}
+func (msg *MsgSetDelegationTransferReceivers) GetSignBytes() []byte {
+	return sdk.MustSortJSON(types.ModuleCdc.MustMarshalJSON(msg))
+}
🤖 Prompt for AI Agents
In chain/exchange/types/v2/msgs.go around lines 2630 to 2633, replace the direct
json.Marshal usage in GetSignBytes with the module codec to keep JSON encoding
consistent; call types.ModuleCdc.MustMarshalJSON(msg) to produce the canonical
JSON bytes and then pass those into sdk.MustSortJSON, ensuring imports and the
types.ModuleCdc reference are used instead of encoding/json.


func (msg *MsgSetDelegationTransferReceivers) GetSigners() []sdk.AccAddress {
sender, _ := sdk.AccAddressFromBech32(msg.Sender)
return []sdk.AccAddress{sender}
}
Comment on lines +2635 to +2638
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Don’t ignore bech32 parse errors in GetSigners; panic like the rest of the codebase

GetSigners is called prior to ValidateBasic during tx ante-handling. Ignoring the error here may return a nil signer and lead to subtle failures. Match the established pattern and panic on invalid sender.

Apply this diff:

-func (msg *MsgSetDelegationTransferReceivers) GetSigners() []sdk.AccAddress {
-	sender, _ := sdk.AccAddressFromBech32(msg.Sender)
-	return []sdk.AccAddress{sender}
-}
+func (msg *MsgSetDelegationTransferReceivers) GetSigners() []sdk.AccAddress {
+	sender, err := sdk.AccAddressFromBech32(msg.Sender)
+	if err != nil {
+		panic(err)
+	}
+	return []sdk.AccAddress{sender}
+}
📝 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
func (msg *MsgSetDelegationTransferReceivers) GetSigners() []sdk.AccAddress {
sender, _ := sdk.AccAddressFromBech32(msg.Sender)
return []sdk.AccAddress{sender}
}
func (msg *MsgSetDelegationTransferReceivers) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
panic(err)
}
return []sdk.AccAddress{sender}
}
🤖 Prompt for AI Agents
In chain/exchange/types/v2/msgs.go around lines 2635 to 2638, the GetSigners
implementation currently ignores the bech32 parse error which can yield a nil
signer; change it to panic on invalid sender consistent with the rest of the
codebase by using the SDK helper that panics on parse failure (or explicitly
check the error and panic), e.g. replace the silent parse with a Must-style
parse or a check that calls panic with the error so an invalid bech32 sender
fails fast.


var _ sdk.Msg = &MsgSetDelegationTransferReceivers{}
Loading
Loading