Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
680fe94
Release/v1.57 for chain v1.15 (#302)
aarmoa Apr 16, 2025
5824e4e
chore: Updated all proto dependencies to the latest version of `maste…
aarmoa May 7, 2025
cbc585b
chore: updated the branch with the latest version of `master` in inje…
aarmoa May 7, 2025
14bc7ef
chore: updated the branch with the latest version of in injective co…
aarmoa May 12, 2025
5066aa5
fix: fixed lint errors
aarmoa May 12, 2025
6f2486d
fix: update lint configuration
aarmoa May 12, 2025
6e0faea
fix: fix errors in ling config yml file
aarmoa May 12, 2025
922829c
fix: fix lint errors
aarmoa May 12, 2025
1362b2e
fix: fix lint errors
aarmoa May 13, 2025
de0458f
fix: fixed issues when creating rpchttp connections to the tendermint…
aarmoa May 14, 2025
fec751e
fix: fixed lint errors
aarmoa May 15, 2025
8f2dda0
chore: updated market's logic to convert values now that markets have…
aarmoa May 20, 2025
6dc05e3
feat: updated examples and helper functions for GTB orders and the ne…
aarmoa May 21, 2025
0da105a
chore: updated indexer version to v1.16.0-rc2
aarmoa May 21, 2025
0495311
Merge pull request #263 from InjectiveLabs/feat/add_exchange_v2_support
aarmoa May 22, 2025
948c59f
Merge branch 'master' of https://github.com/InjectiveLabs/sdk-go into…
aarmoa May 26, 2025
7173b32
chore: updated proto definitions
aarmoa May 26, 2025
7d8fb1f
Merge pull request #307 from InjectiveLabs/chore/sync_dev_with_master…
aarmoa May 26, 2025
79e8f9b
cp-395: added support for the new evm and erc20 modules queries. Adde…
aarmoa May 27, 2025
07a2d52
Merge branch 'dev' into cp-395/add_support_for_v1_16
aarmoa May 27, 2025
1a0a621
Merge pull request #308 from InjectiveLabs/cp-395/add_support_for_v1_16
aarmoa May 27, 2025
b77d838
feat: added logic in Makefile to generate a list of all chain message…
aarmoa May 29, 2025
78016d6
fix: applied the changes suggested in the rabbit review
aarmoa May 29, 2025
678af51
Merge pull request #309 from InjectiveLabs/feat/add_chain_messages_list
aarmoa May 29, 2025
127cdaf
feat: add evm precompiles (bank, exchange, staking) Go bindings
maxim-inj Jun 1, 2025
32735a8
chore: update evm precompiles bindings
maxim-inj Jun 12, 2025
370ebb7
chore: copy-chain-types
dbrajovic Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
version: v2.1.6

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
92 changes: 48 additions & 44 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
version: "2"
run:
tests: false
linters:
fast: false
enable:
- errcheck
- errorlint
- gas
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- megacheck
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unparam
disable:
- unused

linters-settings:
revive:
enable-all-rules: true
settings:
gocritic:
disabled-checks:
- singleCaseSwitch
- deferInLoop
- hugeParam
- unnamedResult
enabled-tags:
- performance
- diagnostic
- style
- opinionated
- experimental
revive:
enable-all-rules: true
rules:
- name: var-naming
arguments:
- - ID
- name: add-constant
disabled: true
- name: line-length-limit
arguments:
- 140
- name: cognitive-complexity
arguments:
- 20
disabled: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- name: var-naming
arguments:
- ["ID"]
- name: add-constant
disabled: true
- name: line-length-limit
arguments:
- 140
gocritic:
enabled-tags:
- performance
- diagnostic
- style
- opinionated
- experimental
disabled-checks:
- singleCaseSwitch
- deferInLoop
- hugeParam
- unnamedResult
- linters:
- revive
text: ALL_CAPS
paths:
- chain
- exchange
- injective_data
- proto
- client/keyring/testdata
- client/chain/chain_test_support.go
issues:
exclude-rules:
- linters:
- revive
text: ALL_CAPS
exclude-dirs:
- chain
- exchange
- injective_data
- proto
- client/keyring/testdata
max-issues-per-linter: 0

run:
tests: false
49 changes: 45 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
all:

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

# todo(dusan): update after official chain rc
clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b cp-253/reduce-margin-ratio --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-core.git -b cp-477/peggy-ratelimits --depth 1 --single-branch

copy-exchange-client: clone-injective-indexer
rm -rf exchange/*
Expand Down Expand Up @@ -51,6 +52,28 @@ copy-chain-types: clone-injective-core
mkdir -p chain/auction/types && \
cp injective-core/injective-chain/modules/auction/types/*.pb.go chain/auction/types && \
cp injective-core/injective-chain/modules/auction/types/codec.go chain/auction/types
mkdir -p chain/erc20/types && \
cp injective-core/injective-chain/modules/erc20/types/*.pb.go chain/erc20/types && \
cp injective-core/injective-chain/modules/erc20/types/codec.go chain/erc20/types
mkdir -p chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/*.pb.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/access_list.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/access_list_tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/chain_config.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/codec.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/dynamic_fee_tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/errors.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/eth.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/events.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/key.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/legacy_tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/logs.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/msg.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/params.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/storage.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/tx_data.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/utils.go chain/evm/types
mkdir -p chain/exchange/types && \
cp injective-core/injective-chain/modules/exchange/types/*.go chain/exchange/types && \
rm -rf chain/exchange/types/*test.go && rm -rf chain/exchange/types/*gw.go
Expand Down Expand Up @@ -117,7 +140,9 @@ copy-chain-types: clone-injective-core
mkdir -p chain/types && \
cp injective-core/injective-chain/types/*.pb.go injective-core/injective-chain/types/config.go chain/types && \
cp injective-core/injective-chain/types/codec.go chain/types && \
cp injective-core/injective-chain/types/util.go chain/types
cp injective-core/injective-chain/types/int.go chain/types && \
cp injective-core/injective-chain/types/util.go chain/types && \
cp injective-core/injective-chain/types/validation.go chain/types

@find ./chain -type f -name "*.go" -exec sed -i "" -e "s|github.com/InjectiveLabs/injective-core/injective-chain/modules|github.com/InjectiveLabs/sdk-go/chain|g" {} \;
@find ./chain -type f -name "*.go" -exec sed -i "" -e "s|github.com/InjectiveLabs/injective-core/injective-chain|github.com/InjectiveLabs/sdk-go/chain|g" {} \;
Expand All @@ -126,6 +151,18 @@ copy-chain-types: clone-injective-core
cp -r injective-core/proto ./

rm -rf injective-core
make extract-message-names

extract-message-names:
@echo "Extracting message names from tx.pb.go files..."
@mkdir -p injective_data
@find ./chain -name "tx.pb.go" -exec grep -h "proto\.RegisterType" {} \; | \
sed -n 's/.*proto\.RegisterType([^"]*"\([^"]*\)".*/\1/p' | \
grep -v 'Response$$' | \
sort -u | \
jq -R -s 'split("\n")[:-1]' > injective_data/chain_messages_list.json
@echo "Message names extracted to injective_data/chain_messages_list.json (excluding Response messages)"
@echo "Total messages found: $$(jq length injective_data/chain_messages_list.json)"

#gen: gen-proto
#
Expand Down Expand Up @@ -173,4 +210,8 @@ lint-master: export GOPROXY=direct
lint-master:
golangci-lint run --timeout=15m -v --new-from-rev=master

.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master
lint-all: export GOPROXY=direct
lint-all:
golangci-lint run --timeout=15m -v

.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all extract-message-names
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Address missing .PHONY targets.

The static analysis correctly identifies missing standard .PHONY targets that improve Makefile reliability.

Add the missing .PHONY targets:

-.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all extract-message-names
+.PHONY: all clean test copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all extract-message-names

You'll also need to define the missing targets:

+all: copy-exchange-client copy-chain-types
+
+clean:
+	rm -rf chain exchange proto injective_data
+
+test: tests
+
 copy-exchange-client: clone-injective-indexer
📝 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
.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all extract-message-names
.PHONY: all clean test copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all extract-message-names
all: copy-exchange-client copy-chain-types
clean:
<tab>rm -rf chain exchange proto injective_data
test: tests
copy-exchange-client: clone-injective-indexer
🧰 Tools
🪛 checkmake (0.2.2)

[warning] 217-217: Missing required phony target "all"

(minphony)


[warning] 217-217: Missing required phony target "clean"

(minphony)


[warning] 217-217: Missing required phony target "test"

(minphony)

🤖 Prompt for AI Agents
In the Makefile at line 217, the .PHONY declaration is missing some standard
targets which can cause issues with Makefile reliability. Add all missing
standard .PHONY targets to the list on line 217 to ensure they are treated as
phony targets. Additionally, define the corresponding missing targets in the
Makefile to avoid errors when these targets are invoked.

3 changes: 2 additions & 1 deletion auth_vote/authz_vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

//revive:disable:function-length // this is an example script
func main() {
network := common.LoadNetwork("testnet", "lb")
tmClient, err := rpchttp.New(network.TmEndpoint, "/websocket")
tmClient, err := rpchttp.New(network.TmEndpoint)
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions chain/auction/types/tx.pb.go

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

4 changes: 2 additions & 2 deletions chain/crypto/hd/algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const (
)

var (
// SupportedAlgorithms defines the list of signing algorithms used on Ethermint:
// SupportedAlgorithms defines the list of signing algorithms used on Injective:
// - eth_secp256k1 (Ethereum)
// - secp256k1 (Tendermint)
SupportedAlgorithms = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1}
// SupportedAlgorithmsLedger defines the list of signing algorithms used on Ethermint for the Ledger device:
// SupportedAlgorithmsLedger defines the list of signing algorithms used on Injective for the Ledger device:
// - eth_secp256k1 (Ethereum)
// - secp256k1 (Tendermint)
SupportedAlgorithmsLedger = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1}
Expand Down
32 changes: 32 additions & 0 deletions chain/crypto/hd/hd_path.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package hd

import (
ethaccounts "github.com/ethereum/go-ethereum/accounts"
)

var (
// Bip44CoinType satisfies EIP84. See https://github.com/ethereum/EIPs/issues/84 for more info.
Bip44CoinType uint32 = 60

// BIP44HDPath is the default BIP44 HD path used on Ethereum.
BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)

type (
PathIterator func() ethaccounts.DerivationPath
)

// NewPathIterator receives a base path as a string and a boolean for the desired iterator type and
// returns a function that iterates over the base HD path, returning the string.
func NewPathIterator(basePath string, ledgerIter bool) (PathIterator, error) {
hdPath, err := ethaccounts.ParseDerivationPath(basePath)
if err != nil {
return nil, err
}

if ledgerIter {
return ethaccounts.LedgerLiveIterator(hdPath), nil
}

return ethaccounts.DefaultIterator(hdPath), nil
}
42 changes: 42 additions & 0 deletions chain/erc20/types/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package types

import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authzcdc "github.com/cosmos/cosmos-sdk/x/authz/codec"

// this line is used by starport scaffolding # 1
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

const ModuleName = "erc20"

func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, "erc20/MsgUpdateParams", nil)
cdc.RegisterConcrete(&MsgCreateTokenPair{}, "erc20/MsgCreateTokenPair", nil)
cdc.RegisterConcrete(&MsgDeleteTokenPair{}, "erc20/MsgDeleteTokenPair", nil)
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgUpdateParams{},
&MsgCreateTokenPair{},
&MsgDeleteTokenPair{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
ModuleCdc = codec.NewLegacyAmino()
)

func init() {
RegisterCodec(ModuleCdc)
// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
sdk.RegisterLegacyAminoCodec(ModuleCdc)
RegisterCodec(authzcdc.Amino)
ModuleCdc.Seal()
}
Loading
Loading