Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
NagaTulasi committed Sep 17, 2024
2 parents 9c08ccf + e09bae5 commit c668243
Show file tree
Hide file tree
Showing 41 changed files with 502 additions and 414 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build

on:
pull_request:
push:
branches:
- main

concurrency:
group: ci-${{ github.ref }}-build
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.22"

- name: Display Go version
run: go version

- name: Build cada
run: make build
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint
# Lint runs golangci-lint over the entire repository
# This workflow is run on every pull request and push to main
# The `golangci` will pass without running if no *.{go, mod, sum} files have been changed.

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}-lint
cancel-in-progress: true

jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.22"

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61.0
args: --timeout 20m0s
79 changes: 79 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
run:
tests: true
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
sort-results: true
allow-parallel-runners: true

linters:
disable-all: true
enable:
# - depguard
- dogsled
# - copyloopvar
- goconst
- gocritic
- gci
- gofumpt
# - gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- staticcheck
- revive
- stylecheck
- typecheck
- unconvert
- unused

issues:
exclude-rules:
- text: "Use of weak random number generator"
linters:
- gosec
- text: "ST1003:"
linters:
- stylecheck
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: "ST1016:"
linters:
- stylecheck
- path: "migrations"
text: "SA1019:"
linters:
- staticcheck
- text: "previous case"
linters:
- typecheck
- text: "previous case"
linters:
- typecheck

max-issues-per-linter: 10000
max-same-issues: 10000

linters-settings:
misspell:
locale: US
gofumpt:
extra-rules: true
dogsled:
max-blank-identifiers: 3
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
gosimple:
checks: ["all"]

gocritic:
disabled-checks:
- regexpMust
19 changes: 9 additions & 10 deletions chainclient/broadcast_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import (
"fmt"
"log"
"os"
"path/filepath"

cometrpc "github.com/cometbft/cometbft/rpc/client/http"
clitx "github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/vitwit/avail-da-module/types"

"path/filepath"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/vitwit/avail-da-module/types"
)

func GetBinPath() string {
Expand All @@ -34,10 +32,6 @@ func ExecuteTX(ctx sdk.Context, msg types.MsgUpdateBlobStatusRequest, cdc codec.
// homePath := "/home/vitwit/.availsdk"
homePath := GetBinPath()
key := os.Getenv("KEY")
fmt.Println("get key namee.........", key)
if key == "" { //TODO : remove this later
key = "alice"
}
keyName := key

// Create a keyring
Expand All @@ -47,8 +41,13 @@ func ExecuteTX(ctx sdk.Context, msg types.MsgUpdateBlobStatusRequest, cdc codec.
}

info, err := kr.Key(keyName)
if err != nil {
return err
}
valAddr, err := info.GetAddress()
fmt.Println("after address................", valAddr)
if err != nil {
return fmt.Errorf("error while getting account address : %w", err)
}

// Create an RPC client
rpcClient, err := cometrpc.NewWithTimeout(rpcAddr, "/websocket", 3)
Expand Down
10 changes: 0 additions & 10 deletions chainclient/client.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
package chainclient

import (
"bytes"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
)

const (
KeyringBackendTest = "test"
)

// ChainClient is client to interact with SPN.
type ChainClient struct {
factory tx.Factory
clientCtx client.Context
out *bytes.Buffer
Address string `json:"address"`
AddressPrefix string `json:"account_address_prefix"`
RPC string `json:"rpc"`
Expand Down
10 changes: 4 additions & 6 deletions chainclient/create_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authTx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/go-bip39"

// "github.com/tendermint/starport/starport/pkg/xfilepath"

"github.com/cosmos/cosmos-sdk/types/module"
)

const (
Expand All @@ -31,7 +28,8 @@ const (
// var availdHomePath = xfilepath.JoinFromHome(xfilepath.Path("availsdk"))

func NewClientCtx(kr keyring.Keyring, c *cometrpc.HTTP, chainID string,
cdc codec.BinaryCodec, homepath string, fromAddress sdk.AccAddress) client.Context {
cdc codec.BinaryCodec, homepath string, fromAddress sdk.AccAddress,
) client.Context {
encodingConfig := MakeEncodingConfig()

broadcastMode := flags.BroadcastSync
Expand Down Expand Up @@ -106,7 +104,7 @@ func ImportMnemonic(keyName, mnemonic, hdPath string, c client.Context) (*keyrin
}

// AccountCreate creates an account by name and mnemonic (optional) in the keyring.
func AccountCreate(accountName, mnemonic, hdPath string, c client.Context) (*keyring.Record, error) {
func AccountCreate(accountName, mnemonic, _ string, c client.Context) (*keyring.Record, error) {
if mnemonic == "" {
entropySeed, err := bip39.NewEntropy(256)
if err != nil {
Expand Down
4 changes: 1 addition & 3 deletions client/cli/keys.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package cli

import (
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"

"github.com/spf13/cobra"
availblob "github.com/vitwit/avail-da-module"
)

Expand Down
6 changes: 3 additions & 3 deletions client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ func GetQueryCmd() *cobra.Command {
func GetLatestBlobStatusInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "get-da-status",
Short: "Show what range of blocks are being submitted and thier status",
Long: `Show what range of blocks are being submitted and thier status,
Short: "Show what range of blocks are being submitted and their status",
Long: `Show what range of blocks are being submitted and their status,
`,
Example: "simd query cada get-da-status",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
Expand Down
6 changes: 2 additions & 4 deletions client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ import (
"strconv"
"strings"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"

"github.com/spf13/cobra"
availblob "github.com/vitwit/avail-da-module"
"github.com/vitwit/avail-da-module/keeper"
"github.com/vitwit/avail-da-module/types"
)

// NewTxCmd
func NewTxCmd(keeper *keeper.Keeper) *cobra.Command {
func NewTxCmd(_ *keeper.Keeper) *cobra.Command {
txCmd := &cobra.Command{
Use: availblob.ModuleName,
Short: availblob.ModuleName + " transaction subcommands",
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ replace (
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.18.0 // Remove once cosmos-sdk fork has been updated to latest v0.50.6
github.com/prometheus/client_model => github.com/prometheus/client_model v0.6.0 // Remove once cosmos-sdk fork has been updated to latest v0.50.6
// github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v1.1.0
github.com/prometheus/common => github.com/prometheus/common v0.47.0
github.com/prometheus/procfs => github.com/prometheus/procfs v0.12.0 // Remove once cosmos-sdk fork has been updated to latest v0.50.6
// github.com/prometheus/common => github.com/prometheus/common v0.47.0
github.com/spf13/viper => github.com/spf13/viper v1.17.0 // v1.18+ breaks app overrides
)

Expand All @@ -24,7 +23,6 @@ require (
cosmossdk.io/log v1.3.1
cosmossdk.io/store v1.1.0
cosmossdk.io/x/upgrade v0.1.4
github.com/99designs/keyring v1.2.1
github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1
github.com/cometbft/cometbft v0.38.10
github.com/cosmos/cosmos-proto v1.0.0-beta.5
Expand All @@ -48,6 +46,7 @@ require (
cosmossdk.io/x/evidence v0.1.1 // indirect
cosmossdk.io/x/feegrant v0.1.1 // indirect
cosmossdk.io/x/nft v0.1.1 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/aws/aws-sdk-go v1.44.224 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
Expand Down Expand Up @@ -116,7 +115,7 @@ require (
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.1.2 // indirect
github.com/cosmos/iavl v1.1.4 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
Expand Down
Loading

0 comments on commit c668243

Please sign in to comment.