From 56dca50ab3bbad89a48c5d742bdf8ce2b2e52d9b Mon Sep 17 00:00:00 2001 From: Valeriy Stoyanov Date: Thu, 20 Nov 2025 13:22:20 +0200 Subject: [PATCH 1/3] issues/14 --- manager/gateway/cosmos_agregated.go | 4 ++-- manager/gateway/cosmos_agregated2.go | 10 ++++++---- manager/gateway/cosmos_agregated4.go | 10 +++++----- manager/types/cosmos.go | 19 +++++++++++-------- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/manager/gateway/cosmos_agregated.go b/manager/gateway/cosmos_agregated.go index 09764d3..c2a6615 100644 --- a/manager/gateway/cosmos_agregated.go +++ b/manager/gateway/cosmos_agregated.go @@ -385,7 +385,7 @@ func (g *CosmosGateway) validators(req types.InboundRequest) (*types.ValidatorsR return g.filterAndPaginateValidators(validatorsResponse, req.Payload) } -func (g *CosmosGateway) account(address string) (*types.AccountResponse, error) { +func (g *CosmosGateway) account(address string) (*types.AccountInfo, error) { accountReq := types.InboundRequest{ Method: "GET", Path: "/cosmos/auth/v1beta1/accounts/" + address, @@ -406,5 +406,5 @@ func (g *CosmosGateway) account(address string) (*types.AccountResponse, error) return nil, err } - return accountResponse, nil + return accountResponse.Account, nil } diff --git a/manager/gateway/cosmos_agregated2.go b/manager/gateway/cosmos_agregated2.go index 0e9648a..48cf41b 100644 --- a/manager/gateway/cosmos_agregated2.go +++ b/manager/gateway/cosmos_agregated2.go @@ -209,7 +209,7 @@ func (g *CosmosGateway) blocks(req types.InboundRequest) (*types.BlocksResultRes return &result, nil } -func (g *CosmosGateway) balances(req types.InboundRequest, accountID string) ([]sdk.Coin, error) { +func (g *CosmosGateway) balances(req types.InboundRequest, accountID string) (*types.BalancesResponse, error) { type BalancesRequest struct { Limit int `json:"limit,string,omitempty"` Offset int `json:"offset,string,omitempty"` @@ -252,15 +252,17 @@ func (g *CosmosGateway) balances(req types.InboundRequest, accountID string) ([] return nil, err } - var result types.BalancesResponse + var result = new(types.BalancesResponse) - err = json.Unmarshal(grpcBytes, &result) + err = json.Unmarshal(grpcBytes, result) if err != nil { logger.Logger.Error("[query-balances] Invalid response format", zap.Error(err)) return nil, err } - return result.Balances, nil + result.Pagination.Total = len(result.Balances) + + return result, nil } func (g *CosmosGateway) delegations(req types.InboundRequest) (interface{}, error) { diff --git a/manager/gateway/cosmos_agregated4.go b/manager/gateway/cosmos_agregated4.go index f5d0ec9..0685957 100644 --- a/manager/gateway/cosmos_agregated4.go +++ b/manager/gateway/cosmos_agregated4.go @@ -419,7 +419,7 @@ func (g *CosmosGateway) faucet(req types.InboundRequest) (interface{}, error) { var info = types.FaucetAccountInfo{ Address: faucetAddress, - Balances: balances, + Balances: balances.Balances, } return info, nil @@ -493,7 +493,7 @@ func (g *CosmosGateway) processFaucet(req types.InboundRequest) (interface{}, er availableAmount := new(big.Int) availableAmount.SetString("0", 10) - for _, balance := range faucetBalances { + for _, balance := range faucetBalances.Balances { if balance.Denom == request.Token { availableAmount.Set(balance.Amount.BigInt()) } @@ -501,7 +501,7 @@ func (g *CosmosGateway) processFaucet(req types.InboundRequest) (interface{}, er claimAmount := new(big.Int) claimAmount.SetString("0", 10) - for _, balance := range claimBalances { + for _, balance := range claimBalances.Balances { if balance.Denom == request.Token { claimAmount.Set(balance.Amount.BigInt()) } @@ -562,13 +562,13 @@ func (g *CosmosGateway) processFaucet(req types.InboundRequest) (interface{}, er return nil, err } - accountNumber, err := strconv.ParseUint(accountInfo.Account.AccountNumber, 10, 64) + accountNumber, err := strconv.ParseUint(accountInfo.AccountNumber, 10, 64) if err != nil { logger.Logger.Error("[faucet] Invalid account response format", zap.Error(err)) return nil, err } - sequence, err := strconv.ParseUint(accountInfo.Account.Sequence, 10, 64) + sequence, err := strconv.ParseUint(accountInfo.Sequence, 10, 64) if err != nil { logger.Logger.Error("[faucet] Invalid account response format", zap.Error(err)) return nil, err diff --git a/manager/types/cosmos.go b/manager/types/cosmos.go index c01cfe4..a9eed89 100644 --- a/manager/types/cosmos.go +++ b/manager/types/cosmos.go @@ -352,7 +352,8 @@ type FaucetAccountInfo struct { } type BalancesResponse struct { - Balances []sdk.Coin `json:"balances"` + Balances []sdk.Coin `json:"balances"` + Pagination *Pagination `json:"pagination,omitempty"` } type FaucetRequest struct { @@ -380,12 +381,14 @@ type CosmosConfig struct { RateLimit int `json:"rate_limit,float64"` } +type AccountInfo struct { + Type string `json:"@type"` + Address string `json:"address"` + PubKey interface{} `json:"pubKey"` + AccountNumber string `json:"accountNumber"` + Sequence string `json:"sequence"` +} + type AccountResponse struct { - Account struct { - Type string `json:"@type"` - Address string `json:"address"` - PubKey interface{} `json:"pubKey"` - AccountNumber string `json:"accountNumber"` - Sequence string `json:"sequence"` - } `json:"account"` + Account *AccountInfo `json:"account"` } From 28084c6dfd64eb3e007b981adc478a0e3ea22457 Mon Sep 17 00:00:00 2001 From: Valeriy Stoyanov Date: Thu, 20 Nov 2025 12:26:55 +0200 Subject: [PATCH 2/3] https://github.com/KiraCore/interx/issues/18 --- manager/config.yml | 2 ++ manager/gateway/cosmos_agregated2.go | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manager/config.yml b/manager/config.yml index 2d7545b..ba84a41 100644 --- a/manager/config.yml +++ b/manager/config.yml @@ -6,6 +6,8 @@ common: enabled: false port: 8881 +version: "v0.4.48" + storage: token: "" url: "http://worker-sai-storage:8880" diff --git a/manager/gateway/cosmos_agregated2.go b/manager/gateway/cosmos_agregated2.go index 48cf41b..05fe961 100644 --- a/manager/gateway/cosmos_agregated2.go +++ b/manager/gateway/cosmos_agregated2.go @@ -5,12 +5,13 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/saiset-co/sai-storage-mongo/external/adapter" "math" "net/http" "strconv" "strings" + "github.com/saiset-co/sai-storage-mongo/external/adapter" + sekaitypes "github.com/KiraCore/sekai/types" tmjson "github.com/cometbft/cometbft/libs/json" types2 "github.com/cometbft/cometbft/types" @@ -50,12 +51,12 @@ func (g *CosmosGateway) statusAPI() (interface{}, error) { result.InterxInfo.LatestBlockHeight = sentryStatus.SyncInfo.LatestBlockHeight result.InterxInfo.CatchingUp = sentryStatus.SyncInfo.CatchingUp - //result.InterxInfo.Node = config.Config.Node - //result.InterxInfo.KiraAddr = g.address + //result.InterxInfo.Node = sentryStatus.NodeInfo.Other.RpcAddress + result.InterxInfo.KiraAddr = sentryStatus.ValidatorInfo.Address result.InterxInfo.KiraPubKey = g.PubKey.String() result.InterxInfo.FaucetAddr = g.PubKey.Address().String() - //result.InterxInfo.InterxVersion = config.Config.InterxVersion - //result.InterxInfo.SekaiVersion = config.Config.SekaiVersion + result.InterxInfo.InterxVersion = cast.ToString(g.context.GetConfig("version", "")) + result.InterxInfo.SekaiVersion = sentryStatus.NodeInfo.Version return result, nil } From 8c8dab4d03c0d550d3430938a506f4f7990b3794 Mon Sep 17 00:00:00 2001 From: mrlutik Date: Mon, 24 Nov 2025 20:03:57 +0100 Subject: [PATCH 3/3] fix(ci): Add version auto bumping logic fix #18; fix #14 --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e84651..b575fee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,58 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + # Use REPO_ACCESS token if available for pushing to protected branches + token: ${{ secrets.REPO_ACCESS || secrets.GITHUB_TOKEN }} + + - name: Determine next version + id: get_version + uses: mathieudutour/github-tag-action@v6.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + release_branches: master + default_bump: minor + dry_run: true + + - name: Update version in manager/config.yml + run: | + # Update the version in manager/config.yml + VERSION="${{ steps.get_version.outputs.new_tag }}" + echo "Updating manager/config.yml with version: $VERSION" + + # Check if manager/config.yml exists + if [ ! -f manager/config.yml ]; then + echo "Warning: manager/config.yml does not exist. Skipping version update." + exit 0 + fi + + # Use sed to update the version line in the config file + sed -i "s/^version:.*$/version: \"$VERSION\"/" manager/config.yml + + # Verify the update + echo "Updated manager/config.yml content:" + grep "^version:" manager/config.yml || echo "No version field found in manager/config.yml" + + # Configure git + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + # Check if there are changes to commit + if git diff --quiet manager/config.yml; then + echo "No changes to manager/config.yml" + else + # Commit the version update + git add manager/config.yml + git commit -m "ci: bump version to $VERSION in manager/config.yml [skip ci]" + + # Try to push to master + echo "Attempting to push version update to master..." + if git push origin HEAD:master; then + echo "Successfully pushed version update to master" + else + echo "Warning: Could not push to master (may be protected). Version in config.yml may not match release tag." + echo "Consider using a Personal Access Token with appropriate permissions in REPO_ACCESS secret." + fi + fi - name: Create and Push Tag id: create_tag @@ -35,6 +87,7 @@ jobs: release_branches: master default_bump: minor create_annotated_tag: true + custom_tag: ${{ steps.get_version.outputs.new_tag }} - name: Print the new tag run: |