Skip to content
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

Feature/undelegation #199

Merged
merged 20 commits into from
Nov 23, 2023
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
12 changes: 7 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
id-token: write
pull-requests: write
container:
image: ghcr.io/kiracore/docker/base-image:v0.11.2
image: ghcr.io/kiracore/docker/base-image:v0.13.5
steps:
# Work around https://github.com/actions/checkout/issues/760
- name: Add safe.directory
Expand Down Expand Up @@ -120,11 +120,13 @@ jobs:
pull-requests: write
steps:
# Install the cosign tool
# ref.: https://github.com/sigstore/cosign-installer, v2.2.0
# ref.: https://github.com/sigstore/cosign-installer, v3.2.0
- name: Install cosign
uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605
uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8
with:
cosign-release: 'v1.7.2'
cosign-release: 'v2.0.0'
- name: Confirm installation!
run: cosign version
- name: Download artifacts
uses: actions/[email protected]
with:
Expand Down Expand Up @@ -258,4 +260,4 @@ jobs:
env:
MERGE_LABELS: "automerge"
GITHUB_TOKEN: "${{ secrets.REPO_ACCESS }}"
LOG: "TRACE"
LOG: "TRACE"
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ interx.mnemonic
proto-gen
postman.json
third_party/proto
proto/cosmos
proto/kira
proto/
codec/
bin
nfpm_*
Expand Down
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

Features:

* Fix minor issues for QueryTransactions endpoint
* Implement QueryUndelegations endpoint
* Bump sekai version to v0.3.38
6 changes: 3 additions & 3 deletions common/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
"github.com/KiraCore/interx/database"
"github.com/KiraCore/interx/global"
"github.com/KiraCore/interx/types"
tmjson "github.com/cometbft/cometbft/libs/json"
tmTypes "github.com/cometbft/cometbft/rpc/core/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
tmjson "github.com/tendermint/tendermint/libs/json"
tmTypes "github.com/tendermint/tendermint/rpc/core/types"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
)

// MakeTendermintRPCRequest is a function to make GET request
Expand Down
7 changes: 4 additions & 3 deletions config/constants.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package config

const (
InterxVersion = "v0.4.40"
SekaiVersion = "v0.3.29"
CosmosVersion = "v0.45.10"
InterxVersion = "v0.4.41"
SekaiVersion = "v0.3.38"
CosmosVersion = "v0.47.5"

QueryDashboard = "/api/dashboard"

Expand Down Expand Up @@ -44,6 +44,7 @@ const (

QueryStakingPool = "/api/kira/staking-pool"
QueryDelegations = "/api/kira/delegations"
QueryUndelegations = "/api/kira/undelegations"
QuerySpendingPools = "/api/kira/spending-pools"
QuerySpendingPoolProposals = "/api/kira/spending-pool-proposals"

Expand Down
6 changes: 3 additions & 3 deletions config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"github.com/KiraCore/interx/types"
sekaiapp "github.com/KiraCore/sekai/app"
sekaiappparams "github.com/KiraCore/sekai/app/params"
"github.com/cometbft/cometbft/crypto"
"github.com/cometbft/cometbft/crypto/sr25519"
"github.com/cometbft/cometbft/p2p"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
bytesize "github.com/inhies/go-bytesize"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/sr25519"
"github.com/tendermint/tendermint/p2p"
"github.com/tyler-smith/go-bip39"
)

Expand Down
2 changes: 1 addition & 1 deletion config/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package config

import (
"github.com/KiraCore/interx/types"
"github.com/cometbft/cometbft/p2p"
crypto "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/tendermint/tendermint/p2p"
)

// FaucetConfig is a struct to be used for Faucet configuration
Expand Down
Binary file added cosmos_proto.tar.xz
Binary file not shown.
2 changes: 1 addition & 1 deletion database/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/KiraCore/interx/config"
"github.com/KiraCore/interx/global"
tmTypes "github.com/tendermint/tendermint/rpc/core/types"
tmTypes "github.com/cometbft/cometbft/rpc/core/types"
)

// GetTransactions is a function to get user transactions from cache
Expand Down
85 changes: 85 additions & 0 deletions functions/interx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,91 @@ func RegisterInterxFunctions() {
}`,
)

AddInterxFunction(
"QueryUndelegations",
config.QueryUndelegations,
`{
"description": "QueryUnelegations is a function to query all undelegation records for a delegator.",
"parameters": {
"undelegatorAddress": {
"type": "string",
"description": "This is the delegator's address.",
"optional": true
},
"offset": {
"type": "string",
"description": "This is an option for pagination. offset is a numeric offset that specifies the starting point of the result set. If left empty it will default to a value to be set by each app.",
"optional": true
},
"limit": {
"type": "string",
"description": "This is an option for pagination. limit is the total number of results to be returned in the result page. If left empty it will default to a value to be set by each app.",
"optional": true
},
"countTotal": {
"type": "string",
"description": "This is an option for pagination. count_total is set to true to indicate that the result set should include a count of the total number of items available for pagination in UIs.",
"optional": true
}
},
"response": {
"undelegations": {
"type": "array",
"description": "The undelegations records info",
"fields": {
"validator_info": {
"type": "struct",
"description": "The validator information",
"fields": {
"moniker": {
"type": "string",
"description": "The validator's moniker"
},
"address": {
"type": "string",
"description": "The validator's address"
},
"logo_url": {
"type": "string",
"description": "The validator's logo"
},
"valkey": {
"type": "string",
"description": "Validator’s valkey, required for MsgClaimUndelegation"
}
}
},
"tokens": {
"type": "array",
"description": "The token information",
"fields": {
"denom": {
"type": "string",
"description": "The token name"
},
"amount": {
"type": "number",
"description": "The token amount"
}
}
},
"expiry": {
"type": "string",
"description": "Epoch time value. After it passes, the tokens can be claimed"
},
"id": {
"type": "number",
"description": "Unique record marking, required for MsgClaimUndelegation"
}
}
},
"pagination": {
"description": "The pagination response information that includes total count"
}
}
}`,
)

AddInterxFunction(
"QueryDelegations",
config.QueryDelegations,
Expand Down
4 changes: 2 additions & 2 deletions gateway/cosmos/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/KiraCore/interx/common"
"github.com/KiraCore/interx/config"
"github.com/KiraCore/interx/types"
legacytx "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
legacytx "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
)
Expand Down Expand Up @@ -160,7 +160,7 @@ func encodeTransactionHandle(r *http.Request, request types.InterxRequest, rpcAd
return common.ServeError(0, "failed to unmarshal", err.Error(), http.StatusBadRequest)
}

signBytes := legacytx.StdSignBytes(req.ChainID, req.AccountNumber, req.Sequence, 0, req.Tx.Fee, req.Tx.Msgs, req.Tx.Memo)
signBytes := legacytx.StdSignBytes(req.ChainID, req.AccountNumber, req.Sequence, 0, req.Tx.Fee, req.Tx.Msgs, req.Tx.Memo, req.Tx.GetTip())

// TxEncodeResponse defines base64 encoded transaction.
type TxEncodeResponse struct {
Expand Down
4 changes: 2 additions & 2 deletions gateway/interx/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
"github.com/KiraCore/interx/types"
kiratypes "github.com/KiraCore/sekai/types"
multistaking "github.com/KiraCore/sekai/x/multistaking/types"
abciTypes "github.com/cometbft/cometbft/abci/types"
tmTypes "github.com/cometbft/cometbft/rpc/core/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
bank "github.com/cosmos/cosmos-sdk/x/bank/types"
distribution "github.com/cosmos/cosmos-sdk/x/distribution/types"
staking "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
abciTypes "github.com/tendermint/tendermint/abci/types"
tmTypes "github.com/tendermint/tendermint/rpc/core/types"
)

// RegisterBlockRoutes registers block/transaction query routers.
Expand Down
8 changes: 4 additions & 4 deletions gateway/interx/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"github.com/KiraCore/interx/database"
"github.com/KiraCore/interx/test"
"github.com/KiraCore/interx/types"
tmjson "github.com/cometbft/cometbft/libs/json"
tmRPCTypes "github.com/cometbft/cometbft/rpc/core/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
tmTypes "github.com/cometbft/cometbft/types"
"github.com/stretchr/testify/suite"
tmjson "github.com/tendermint/tendermint/libs/json"
tmRPCTypes "github.com/tendermint/tendermint/rpc/core/types"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
tmTypes "github.com/tendermint/tendermint/types"
)

type BlockQueryTestSuite struct {
Expand Down
6 changes: 4 additions & 2 deletions gateway/interx/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
"github.com/KiraCore/interx/database"
"github.com/KiraCore/interx/types"
sdk "github.com/cosmos/cosmos-sdk/types"
legacytx "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
"github.com/cosmos/cosmos-sdk/types/tx"
legacytx "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
bank "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
Expand Down Expand Up @@ -158,9 +159,10 @@ func serveFaucet(r *http.Request, gwCosmosmux *runtime.ServeMux, request types.I
msgs := []sdk.Msg{msgSend}
fee := legacytx.NewStdFee(200000, sdk.NewCoins(feeAmount)) //Fee handling
memo := "Faucet Transfer"
tip := &tx.Tip{Amount: msgSend.Amount, Tipper: "test"}

sigs := make([]legacytx.StdSignature, 1)
signBytes := legacytx.StdSignBytes(common.NodeStatus.Chainid, accountNumber, sequence, 0, fee, msgs, memo)
signBytes := legacytx.StdSignBytes(common.NodeStatus.Chainid, accountNumber, sequence, 0, fee, msgs, memo, tip)

sig, err := config.Config.Faucet.PrivKey.Sign(signBytes)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions gateway/interx/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/KiraCore/interx/common"
"github.com/KiraCore/interx/config"
"github.com/KiraCore/interx/global"
tmjson "github.com/cometbft/cometbft/libs/json"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"
)

// RegisterGenesisQueryRoutes registers genesis query routers.
Expand Down
8 changes: 4 additions & 4 deletions gateway/interx/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

"github.com/KiraCore/interx/config"
"github.com/KiraCore/interx/test"
tmjson "github.com/cometbft/cometbft/libs/json"
tmRPCTypes "github.com/cometbft/cometbft/rpc/core/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
tmTypes "github.com/cometbft/cometbft/types"
"github.com/stretchr/testify/suite"
tmjson "github.com/tendermint/tendermint/libs/json"
tmRPCTypes "github.com/tendermint/tendermint/rpc/core/types"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
tmTypes "github.com/tendermint/tendermint/types"
)

type GenesisChecksumResponse struct {
Expand Down
6 changes: 3 additions & 3 deletions gateway/interx/interx.tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import (
"github.com/KiraCore/interx/database"
"github.com/KiraCore/interx/types"
kiratypes "github.com/KiraCore/sekai/types"
tmjson "github.com/cometbft/cometbft/libs/json"
tmTypes "github.com/cometbft/cometbft/rpc/core/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
tmjson "github.com/tendermint/tendermint/libs/json"
tmTypes "github.com/tendermint/tendermint/rpc/core/types"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"golang.org/x/exp/slices"
)

Expand Down
8 changes: 4 additions & 4 deletions gateway/interx/interx.tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"github.com/KiraCore/interx/database"
"github.com/KiraCore/interx/test"
"github.com/KiraCore/interx/types"
tmjson "github.com/cometbft/cometbft/libs/json"
tmRPCTypes "github.com/cometbft/cometbft/rpc/core/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
tmTypes "github.com/cometbft/cometbft/types"
"github.com/stretchr/testify/suite"
tmjson "github.com/tendermint/tendermint/libs/json"
tmRPCTypes "github.com/tendermint/tendermint/rpc/core/types"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
tmTypes "github.com/tendermint/tendermint/types"
)

type InterxTxTestSuite struct {
Expand Down
8 changes: 4 additions & 4 deletions gateway/interx/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import (
"github.com/KiraCore/interx/test"
"github.com/KiraCore/interx/types"
"github.com/KiraCore/interx/types/kira"
tmjson "github.com/cometbft/cometbft/libs/json"
tmRPCTypes "github.com/cometbft/cometbft/rpc/core/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
tmTypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/go-bip39"
"github.com/stretchr/testify/suite"
tmjson "github.com/tendermint/tendermint/libs/json"
tmRPCTypes "github.com/tendermint/tendermint/rpc/core/types"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
tmTypes "github.com/tendermint/tendermint/types"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion gateway/interx/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"github.com/KiraCore/interx/tasks"
"github.com/KiraCore/interx/types"
"github.com/KiraCore/interx/types/kira"
tmRPCTypes "github.com/cometbft/cometbft/rpc/core/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
tmRPCTypes "github.com/tendermint/tendermint/rpc/core/types"
)

// RegisterValidatorsQueryRoutes registers validators query routers.
Expand Down
2 changes: 1 addition & 1 deletion gateway/interx/validators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
multiStakingTypes "github.com/KiraCore/sekai/x/multistaking/types"
slashingTypes "github.com/KiraCore/sekai/x/slashing/types"
stakingTypes "github.com/KiraCore/sekai/x/staking/types"
tmJsonRPCTypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
"github.com/stretchr/testify/suite"
tmJsonRPCTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
"google.golang.org/grpc"
)

Expand Down
Loading
Loading