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

bugfix/performance -> release/v0.4.43 #209

Merged
merged 64 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5c1c433
Merge pull request #171 from KiraCore/bugfix/tx_slow_issue
tj327 May 22, 2023
896615a
Merge pull request #172 from KiraCore/release/v0.4.33
asmodat May 22, 2023
723bdb0
fix double records issue
tj327 Jun 19, 2023
e616757
update version
tj327 Jun 19, 2023
c3041b2
Merge pull request #174 from KiraCore/bugfix/tx_double_record
tj327 Jun 19, 2023
428d641
Merge pull request #175 from KiraCore/release/v0.4.34
asmodat Jun 19, 2023
8e149b6
endpoints for querying pools and validators
tj327 Jul 10, 2023
0df4b63
update interx version
tj327 Jul 10, 2023
0f7a9d0
update readme
tj327 Jul 10, 2023
4c146a2
disable val query temporary
tj327 Jul 10, 2023
98079f9
Merge pull request #177 from KiraCore/feature/staking_endpoints
tj327 Jul 10, 2023
5007ebd
Merge pull request #178 from KiraCore/release/v0.4.35
asmodat Jul 10, 2023
d3186c0
add delegation endpoint
tj327 Jul 18, 2023
951702c
Merge pull request #180 from KiraCore/feature/delegation_endpoint
tj327 Jul 19, 2023
06cc6a3
Merge pull request #181 from KiraCore/release/v0.4.36
asmodat Jul 25, 2023
f222b21
updated proposals endpoint
tj327 Aug 14, 2023
63edf38
update release txt and fix a minor integration test issues
tj327 Aug 14, 2023
d4c3316
update metadata & types adjustments
tj327 Aug 16, 2023
34957a7
Merge pull request #183 from KiraCore/feature/proposal_endpoint
tj327 Aug 17, 2023
f581380
update sekai version
tj327 Aug 17, 2023
48d3361
update release note
tj327 Aug 17, 2023
214cf35
go mod tidy, fix minor issues
tj327 Aug 17, 2023
8769985
Merge pull request #186 from KiraCore/feature/proposal_endpoint
tj327 Aug 17, 2023
5245aaa
Merge pull request #187 from KiraCore/release/v0.4.37
asmodat Aug 18, 2023
b8334f9
fix stakingpool, valoper, identity record querying issues
tj327 Sep 4, 2023
488f88e
Merge pull request #189 from KiraCore/bugfix/staking_module
tj327 Sep 4, 2023
6658542
Merge pull request #190 from KiraCore/release/v0.4.38
asmodat Sep 5, 2023
57beb90
implementing custom denom & addr prefixes
tj327 Sep 12, 2023
4a76503
update interx version
tj327 Sep 12, 2023
2935648
Merge pull request #192 from KiraCore/feature/custom_prefix
tj327 Sep 12, 2023
6981553
Merge pull request #193 from KiraCore/release/v0.4.39
asmodat Sep 12, 2023
718a46a
fix mg conversion issues for transactions endpoint
tj327 Sep 18, 2023
e1bb8eb
Merge pull request #195 from KiraCore/bugfix/identity_registrar
tj327 Sep 18, 2023
4da240a
Merge pull request #196 from KiraCore/release/v0.4.40
kmlbgn Sep 22, 2023
acf5827
implement QueryUndelegation endpoint
tj327 Oct 27, 2023
b1c23c7
update proto for sekaiv0.3.36 & cosmos-sdkv0.47.5
tj327 Nov 2, 2023
4dcee73
update QueryUndelegation endpoint
tj327 Nov 13, 2023
c8ee528
update QueryUndelegation endpoint for string type token of sekai resp…
tj327 Nov 13, 2023
672dea6
update QueryUndelegation endpoint for amount field
tj327 Nov 13, 2023
bd2697d
remove debug logs
tj327 Nov 14, 2023
5767fd4
update interx version
tj327 Nov 14, 2023
b01e5d9
update proto-gen.sh go version
tj327 Nov 15, 2023
247b435
Update main.yml
MrLutik Nov 17, 2023
5f19621
Merge pull request #200 from KiraCore/bugfix/gf_cosign_installer_fix
MrLutik Nov 17, 2023
4239ee3
Merge branch 'master' into feature/undelegation
tj327 Nov 21, 2023
7f89b34
fix test conflict error
tj327 Nov 21, 2023
be38dd5
modify proto-gen-local script
tj327 Nov 21, 2023
58f43cb
fix test faucet issue
tj327 Nov 21, 2023
ac8c386
update sekai version
tj327 Nov 22, 2023
e4e3acb
remove broadcastmode in bank send cli
tj327 Nov 22, 2023
06205bd
update bank send cli params
tj327 Nov 22, 2023
fdabbf3
update go.mod sekai version
tj327 Nov 22, 2023
88bf72d
update getting block height by query
tj327 Nov 23, 2023
fc014ab
modify transactions integration test
tj327 Nov 23, 2023
c1fdf49
Merge pull request #199 from KiraCore/feature/undelegation
tj327 Nov 23, 2023
02e6ecf
Add yes flag to signing blob
MrLutik Nov 23, 2023
0e3da04
Merge branch 'master' into release/v0.4.41
tj327 Nov 23, 2023
2787f37
Merge pull request #201 from KiraCore/release/v0.4.41
kmlbgn Dec 13, 2023
7e78347
add defaultDenom&bech32Prefix to GetTokenAliases
tj327 Jan 6, 2024
5ff3889
update interx version
tj327 Jan 8, 2024
9055a71
Merge pull request #206 from KiraCore/feature/all-alias-query-update
kmlbgn Jan 8, 2024
17570cf
Merge pull request #207 from KiraCore/release/v0.4.42
asmodat Jan 8, 2024
cd4b614
make sleep interval for snapshot checksum
tj327 Jan 11, 2024
294dfc6
version update
tj327 Jan 11, 2024
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
14 changes: 8 additions & 6 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 @@ -189,7 +191,7 @@ jobs:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: |
echo "$KEY" > ../cosign.key
for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done
for FILE in *; do FILE_NAME=$(basename $FILE); cosign sign-blob --yes --key=../cosign.key --output-signature=./${FILE_NAME}.sig ./$FILE_NAME; done
rm -fv ../cosign.key
- name: Publish release
if: |
Expand Down Expand Up @@ -258,4 +260,4 @@ jobs:
env:
MERGE_LABELS: "automerge"
GITHUB_TOKEN: "${{ secrets.REPO_ACCESS }}"
LOG: "TRACE"
LOG: "TRACE"
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ cache/
faucet.mnemonic
interx.mnemonic
proto-gen
postman.json
third_party/proto
proto/cosmos
proto/kira
proto/
codec/
bin
nfpm_*
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

Features:

* Optimize transactions endpoint
* made sleep interval for snapshot checksum
16 changes: 9 additions & 7 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 Expand Up @@ -309,7 +309,7 @@ func GetBlockNanoTime(rpcAddr string, height int64) (int64, error) {
}

// GetTokenAliases is a function to get token aliases
func GetTokenAliases(gwCosmosmux *runtime.ServeMux, r *http.Request) []types.TokenAlias {
func GetTokenAliases(gwCosmosmux *runtime.ServeMux, r *http.Request) ([]types.TokenAlias, string, string) {
// tokens, err := database.GetTokenAliases()
// if err == nil {
// return tokens
Expand All @@ -320,16 +320,18 @@ func GetTokenAliases(gwCosmosmux *runtime.ServeMux, r *http.Request) []types.Tok
r.Method = "GET"

// GetLogger().Info("[grpc-call] Entering grpc call: ", r.URL.Path)

recorder := httptest.NewRecorder()
gwCosmosmux.ServeHTTP(recorder, r)
resp := recorder.Result()

type TokenAliasesResponse struct {
Data []types.TokenAlias `json:"data"`
Data []types.TokenAlias `json:"data"`
DefaultDenom string `json:"defaultDenom"`
Bech32Prefix string `json:"bech32Prefix"`
}

result := TokenAliasesResponse{}

err := json.NewDecoder(resp.Body).Decode(&result)
if err != nil {
GetLogger().Error("[grpc-call] Unable to decode response: ", err)
Expand All @@ -341,7 +343,7 @@ func GetTokenAliases(gwCosmosmux *runtime.ServeMux, r *http.Request) []types.Tok
GetLogger().Error("[grpc-call] Unable to save response")
}

return result.Data
return result.Data, result.DefaultDenom, result.Bech32Prefix
}

// GetTokenSupply is a function to get token supply
Expand Down
2 changes: 1 addition & 1 deletion common/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func WrapResponse(w http.ResponseWriter, request types.InterxRequest, response t
}
}

// ServeGRPC is a function to server GRPC
// ServeGRPC is a function to serve GRPC
func ServeGRPC(r *http.Request, gwCosmosmux *runtime.ServeMux) (interface{}, interface{}, int) {
recorder := httptest.NewRecorder()
gwCosmosmux.ServeHTTP(recorder, r)
Expand Down
175 changes: 175 additions & 0 deletions common/gov.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
package common

import (
"encoding/json"

govTypes "github.com/KiraCore/interx/types/kira/gov"
sdk "github.com/cosmos/cosmos-sdk/types"
)

type NetworkProperties struct {
MinTxFee string `json:"minTxFee"`
MaxTxFee string `json:"maxTxFee"`
VoteQuorum string `json:"voteQuorum"`
MinimumProposalEndTime string `json:"minimumProposalEndTime"`
ProposalEnactmentTime string `json:"proposalEnactmentTime"`
MinProposalEndBlocks string `json:"minProposalEndBlocks"`
MinProposalEnactmentBlocks string `json:"minProposalEnactmentBlocks"`
EnableForeignFeePayments bool `json:"enableForeignFeePayments"`
MischanceRankDecreaseAmount string `json:"mischanceRankDecreaseAmount"`
MaxMischance string `json:"maxMischance"`
MischanceConfidence string `json:"mischanceConfidence"`
InactiveRankDecreasePercent string `json:"inactiveRankDecreasePercent"`
MinValidators string `json:"minValidators"`
PoorNetworkMaxBankSend string `json:"poorNetworkMaxBankSend"`
UnjailMaxTime string `json:"unjailMaxTime"`
EnableTokenWhitelist bool `json:"enableTokenWhitelist"`
EnableTokenBlacklist bool `json:"enableTokenBlacklist"`
MinIdentityApprovalTip string `json:"minIdentityApprovalTip"`
UniqueIdentityKeys string `json:"uniqueIdentityKeys"`
UbiHardcap string `json:"ubiHardcap"`
ValidatorsFeeShare string `json:"validatorsFeeShare"`
InflationRate string `json:"inflationRate"`
InflationPeriod string `json:"inflationPeriod"`
UnstakingPeriod string `json:"unstakingPeriod"`
MaxDelegators string `json:"maxDelegators"`
MinDelegationPushout string `json:"minDelegationPushout"`
SlashingPeriod string `json:"slashingPeriod"`
MaxJailedPercentage string `json:"maxJailedPercentage"`
MaxSlashingPercentage string `json:"maxSlashingPercentage"`
MinCustodyReward string `json:"minCustodyReward"`
MaxCustodyBufferSize string `json:"maxCustodyBufferSize"`
MaxCustodyTxSize string `json:"maxCustodyTxSize"`
AbstentionRankDecreaseAmount string `json:"abstentionRankDecreaseAmount"`
MaxAbstention string `json:"maxAbstention"`
MinCollectiveBond string `json:"minCollectiveBond"`
MinCollectiveBondingTime string `json:"minCollectiveBondingTime"`
MaxCollectiveOutputs string `json:"maxCollectiveOutputs"`
MinCollectiveClaimPeriod string `json:"minCollectiveClaimPeriod"`
ValidatorRecoveryBond string `json:"validatorRecoveryBond"`
MaxAnnualInflation string `json:"maxAnnualInflation"`
MaxProposalTitleSize string `json:"maxProposalTitleSize"`
MaxProposalDescriptionSize string `json:"maxProposalDescriptionSize"`
MaxProposalPollOptionSize string `json:"maxProposalPollOptionSize"`
MaxProposalPollOptionCount string `json:"maxProposalPollOptionCount"`
MaxProposalReferenceSize string `json:"maxProposalReferenceSize"`
MaxProposalChecksumSize string `json:"maxProposalChecksumSize"`
MinDappBond string `json:"minDappBond"`
MaxDappBond string `json:"maxDappBond"`
DappBondDuration string `json:"dappBondDuration"`
DappVerifierBond string `json:"dappVerifierBond"`
DappAutoDenounceTime string `json:"dappAutoDenounceTime"`
}

type NetworkPropertiesResponse struct {
Properties *NetworkProperties `json:"properties"`
}

func QueryVotersFromGrpcResult(success interface{}) ([]govTypes.Voter, error) {
result := struct {
Voters []struct {
Address []byte `json:"address,omitempty"`
Roles []string `json:"roles,omitempty"`
Status string `json:"status,omitempty"`
Votes []string `json:"votes,omitempty"`
Permissions *govTypes.Permissions `json:"permissions,omitempty"`
Skin uint64 `json:"skin,string,omitempty"`
} `json:"voters,omitempty"`
}{}

byteData, err := json.Marshal(success)
if err != nil {
GetLogger().Error("[query-voters] Invalid response format: ", err)
return nil, err
}

err = json.Unmarshal(byteData, &result)
if err != nil {
GetLogger().Error("[query-voters] Invalid response format: ", err)
return nil, err
}

voters := make([]govTypes.Voter, 0)

for _, voter := range result.Voters {
newVoter := govTypes.Voter{}

newVoter.Address = sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), voter.Address)
newVoter.Roles = voter.Roles
newVoter.Status = voter.Status
newVoter.Votes = voter.Votes

newVoter.Permissions.Blacklist = make([]string, 0)
for _, black := range voter.Permissions.Blacklist {
newVoter.Permissions.Blacklist = append(newVoter.Permissions.Blacklist, govTypes.PermValue_name[int32(black)])
}
newVoter.Permissions.Whitelist = make([]string, 0)
for _, white := range voter.Permissions.Whitelist {
newVoter.Permissions.Whitelist = append(newVoter.Permissions.Whitelist, govTypes.PermValue_name[int32(white)])
}

newVoter.Skin = voter.Skin

voters = append(voters, newVoter)
}
return voters, nil
}

func QueryVotesFromGrpcResult(success interface{}) ([]govTypes.Vote, error) {
result := struct {
Votes []struct {
ProposalID uint64 `json:"proposalID,string,omitempty"`
Voter []byte `json:"voter,omitempty"`
Option string `json:"option,omitempty"`
} `json:"votes,omitempty"`
}{}

byteData, err := json.Marshal(success)
if err != nil {
GetLogger().Error("[query-votes] Invalid response format: ", err)
return nil, err
}

err = json.Unmarshal(byteData, &result)
if err != nil {
GetLogger().Error("[query-votes] Invalid response format: ", err)
return nil, err
}

votes := make([]govTypes.Vote, 0)

for _, vote := range result.Votes {
newVote := govTypes.Vote{}

newVote.ProposalID = vote.ProposalID
newVote.Voter = sdk.MustBech32ifyAddressBytes(sdk.GetConfig().GetBech32AccountAddrPrefix(), vote.Voter)
newVote.Option = vote.Option

votes = append(votes, newVote)
}

return votes, nil
}

func QueryNetworkPropertiesFromGrpcResult(success interface{}) (NetworkPropertiesResponse, error) {
result := NetworkPropertiesResponse{}
byteData, err := json.Marshal(success)
if err != nil {
GetLogger().Error("[query-network-properties] Invalid response format", err)
return NetworkPropertiesResponse{}, err
}
err = json.Unmarshal(byteData, &result)
if err != nil {
GetLogger().Error("[query-network-properties] Invalid response format", err)
return NetworkPropertiesResponse{}, err
}

result.Properties.InactiveRankDecreasePercent = ConvertRate(result.Properties.InactiveRankDecreasePercent)
result.Properties.ValidatorsFeeShare = ConvertRate(result.Properties.ValidatorsFeeShare)
result.Properties.InflationRate = ConvertRate(result.Properties.InflationRate)
result.Properties.MaxSlashingPercentage = ConvertRate(result.Properties.MaxSlashingPercentage)
result.Properties.MaxAnnualInflation = ConvertRate(result.Properties.MaxAnnualInflation)
result.Properties.DappVerifierBond = ConvertRate(result.Properties.DappVerifierBond)

return result, nil
}
26 changes: 26 additions & 0 deletions common/helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package common

import (
"fmt"
"strconv"
"strings"
)

func ConvertRate(rateString string) string {
rate, _ := strconv.ParseFloat(rateString, 64)
rate = rate / 1000000000000000000.0
rateString = fmt.Sprintf("%g", rate)
if !strings.Contains(rateString, ".") {
rateString = rateString + ".0"
}
return rateString
}

func Include(arr []string, el string) bool {
for _, elm := range arr {
if elm == el {
return true
}
}
return false
}
9 changes: 6 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.33"
SekaiVersion = "v0.3.13.38"
CosmosVersion = "v0.45.10"
InterxVersion = "v0.4.43"
SekaiVersion = "v0.3.40"
CosmosVersion = "v0.47.6"

QueryDashboard = "/api/dashboard"

Expand Down Expand Up @@ -42,6 +42,9 @@ const (
QueryIdentityRecordVerifyRequestsByApprover = "/api/kira/gov/identity_verify_requests_by_approver/{approver}"
QueryAllIdentityRecordVerifyRequests = "/api/kira/gov/all_identity_verify_requests"

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
4 changes: 4 additions & 0 deletions config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func getRPCSettings() RPCConfig {
config.API["GET"][QueryIdentityRecordVerifyRequestsByApprover] = defaultRPCSetting
config.API["GET"][QueryAllIdentityRecordVerifyRequests] = defaultRPCSetting
config.API["GET"][QuerySpendingPools] = defaultRPCSetting
config.API["GET"][QueryStakingPool] = defaultRPCSetting
config.API["GET"][QuerySpendingPoolProposals] = defaultRPCSetting
config.API["GET"][QueryUBIRecords] = defaultRPCSetting

Expand Down Expand Up @@ -230,6 +231,7 @@ func InitConfig(
nodeDiscoveryTendermintPort string,
nodeDiscoveryTimeout string,
nodeKey string,
snapshotInterval uint64,
) {
configFromFile := defaultConfig()

Expand Down Expand Up @@ -289,6 +291,8 @@ func InitConfig(
configFromFile.Faucet.FeeAmounts[denom] = amount
}

configFromFile.SnapshotInterval = snapshotInterval

bytes, err := json.MarshalIndent(&configFromFile, "", " ")
if err != nil {
panic(err)
Expand Down
Loading
Loading