Skip to content

Commit

Permalink
Merge branch 'main' into store/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-develope committed Jul 25, 2024
2 parents e99168d + 897f4f8 commit 77d0533
Show file tree
Hide file tree
Showing 61 changed files with 215 additions and 144 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.35.0
- uses: bufbuild/buf-setup-action@v1.35.1
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.35.0
- uses: bufbuild/buf-setup-action@v1.35.1
- uses: bufbuild/buf-breaking-action@v1
with:
input: "proto"
Expand Down
67 changes: 29 additions & 38 deletions .github/workflows/sims-052.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout to fetch code
runs-on: large-sdk-runner
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v4
Expand All @@ -25,26 +27,9 @@ jobs:
check-latest: true
- run: make build

install-runsim:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary

test-sim-import-export:
runs-on: ubuntu-latest
needs: [build, install-runsim]
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand All @@ -54,17 +39,14 @@ jobs:
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-import-export
run: |
make test-sim-import-export
test-sim-after-import:
runs-on: ubuntu-latest
needs: [build, install-runsim]
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -73,17 +55,14 @@ jobs:
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-after-import
run: |
make test-sim-after-import
test-sim-multi-seed-short:
runs-on: ubuntu-latest
needs: [build, install-runsim]
test-sim-deterministic:
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -92,18 +71,30 @@ jobs:
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
- name: test-sim-nondeterminism-streaming
run: |
make test-sim-nondeterminism-streaming
test-sim-multi-seed-short:
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
ref: "release/v0.52.x"
- uses: actions/setup-go@v5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
go-version: "1.22"
check-latest: true
- name: test-sim-multi-seed-short
run: |
make test-sim-multi-seed-short
sims-notify-success:
needs:
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
runs-on: ubuntu-latest
runs-on: large-sdk-runner
if: ${{ success() }}
steps:
- uses: actions/checkout@v4
Expand All @@ -130,7 +121,7 @@ jobs:
contents: none
needs:
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
runs-on: ubuntu-latest
runs-on: large-sdk-runner
if: ${{ failure() }}
steps:
- name: Notify Slack on failure
Expand Down
3 changes: 2 additions & 1 deletion baseapp/grpcrouter_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package baseapp

import (
gocontext "context"
"errors"
"fmt"

abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
Expand Down Expand Up @@ -60,5 +61,5 @@ func (q *QueryServiceTestHelper) Invoke(_ gocontext.Context, method string, args

// NewStream implements the grpc ClientConn.NewStream method
func (q *QueryServiceTestHelper) NewStream(gocontext.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error) {
return nil, fmt.Errorf("not supported")
return nil, errors.New("not supported")
}
2 changes: 1 addition & 1 deletion client/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err

if keyType == keyring.TypeLedger && clientCtx.SignModeStr == flags.SignModeTextual {
if !slices.Contains(clientCtx.TxConfig.SignModeHandler().SupportedModes(), signingv1beta1.SignMode_SIGN_MODE_TEXTUAL) {
return clientCtx, fmt.Errorf("SIGN_MODE_TEXTUAL is not available")
return clientCtx, errors.New("SIGN_MODE_TEXTUAL is not available")
}
}

Expand Down
4 changes: 2 additions & 2 deletions client/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package client

import (
gocontext "context"
"fmt"
"errors"
"reflect"
"strconv"

Expand Down Expand Up @@ -123,7 +123,7 @@ func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, req, reply i

// NewStream implements the grpc ClientConn.NewStream method
func (Context) NewStream(gocontext.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error) {
return nil, fmt.Errorf("streaming rpc not supported")
return nil, errors.New("streaming rpc not supported")
}

// gRPCCodec checks if Context's Codec is codec.GRPCCodecProvider
Expand Down
4 changes: 2 additions & 2 deletions client/snapshot/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ func LoadArchiveCmd() *cobra.Command {

savedSnapshot := <-quitChan
if savedSnapshot == nil {
return fmt.Errorf("failed to save snapshot")
return errors.New("failed to save snapshot")
}

if !reflect.DeepEqual(&snapshot, savedSnapshot) {
_ = snapshotStore.Delete(snapshot.Height, snapshot.Format)
return fmt.Errorf("invalid archive, the saved snapshot is not equal to the original one")
return errors.New("invalid archive, the saved snapshot is not equal to the original one")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (f Factory) BuildSimTx(msgs ...sdk.Msg) ([]byte, error) {

encoder := f.txConfig.TxEncoder()
if encoder == nil {
return nil, fmt.Errorf("cannot simulate tx: tx encoder is nil")
return nil, errors.New("cannot simulate tx: tx encoder is nil")
}

return encoder(txb.GetTx())
Expand Down
3 changes: 2 additions & 1 deletion client/tx/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tx

import (
"context"
"errors"
"fmt"
"strings"
"testing"
Expand Down Expand Up @@ -44,7 +45,7 @@ type mockContext struct {

func (m mockContext) Invoke(_ context.Context, _ string, _, reply interface{}, _ ...grpc.CallOption) (err error) {
if m.wantErr {
return fmt.Errorf("mock err")
return errors.New("mock err")
}

*(reply.(*txtypes.SimulateResponse)) = txtypes.SimulateResponse{
Expand Down
4 changes: 2 additions & 2 deletions client/v2/autocli/flag/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package flag

import (
"context"
"fmt"
"errors"
"strings"

"google.golang.org/protobuf/reflect/protoreflect"
Expand Down Expand Up @@ -38,7 +38,7 @@ func (c *coinValue) String() string {

func (c *coinValue) Set(stringValue string) error {
if strings.Contains(stringValue, ",") {
return fmt.Errorf("coin flag must be a single coin, specific multiple coins with multiple flags or spaces")
return errors.New("coin flag must be a single coin, specific multiple coins with multiple flags or spaces")
}

coin, err := coins.ParseCoin(stringValue)
Expand Down
6 changes: 3 additions & 3 deletions client/v2/internal/coins/format.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package coins

import (
"fmt"
"errors"
"regexp"
"strings"

Expand All @@ -19,13 +19,13 @@ func ParseCoin(input string) (*basev1beta1.Coin, error) {
input = strings.TrimSpace(input)

if input == "" {
return nil, fmt.Errorf("empty input when parsing coin")
return nil, errors.New("empty input when parsing coin")
}

matches := coinRegex.FindStringSubmatch(input)

if len(matches) == 0 {
return nil, fmt.Errorf("invalid input format")
return nil, errors.New("invalid input format")
}

return &basev1beta1.Coin{
Expand Down
3 changes: 2 additions & 1 deletion client/v2/internal/prompt/validation.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package prompt

import (
"errors"
"fmt"
"net/url"

Expand All @@ -10,7 +11,7 @@ import (
// ValidatePromptNotEmpty validates that the input is not empty.
func ValidatePromptNotEmpty(input string) error {
if input == "" {
return fmt.Errorf("input cannot be empty")
return errors.New("input cannot be empty")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion client/v2/offchain/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func verifySignature(
return err
}
if !pubKey.VerifySignature(signBytes, data.Signature) {
return fmt.Errorf("unable to verify single signer signature")
return errors.New("unable to verify single signer signature")
}
return nil
default:
Expand Down
3 changes: 2 additions & 1 deletion collections/iter_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package collections

import (
"errors"
"fmt"
"testing"

Expand Down Expand Up @@ -188,7 +189,7 @@ func TestWalk(t *testing.T) {
})
require.NoError(t, err)

sentinelErr := fmt.Errorf("sentinel error")
sentinelErr := errors.New("sentinel error")
err = m.Walk(ctx, nil, func(key, value uint64) (stop bool, err error) {
require.LessOrEqual(t, key, uint64(3)) // asserts that after the number three we stop
if key == 3 {
Expand Down
4 changes: 2 additions & 2 deletions collections/map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package collections

import (
"context"
"fmt"
"errors"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestMap_Clear(t *testing.T) {
err := m.Clear(ctx, nil)
require.NoError(t, err)
err = m.Walk(ctx, nil, func(key, value uint64) (bool, error) {
return false, fmt.Errorf("should never be called")
return false, errors.New("should never be called")
})
require.NoError(t, err)
})
Expand Down
3 changes: 2 additions & 1 deletion depinject/appconfig/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package appconfig

import (
"errors"
"fmt"
"reflect"
"strings"
Expand Down Expand Up @@ -95,7 +96,7 @@ func Compose(appConfig gogoproto.Message) depinject.Config {

for _, module := range appConfigConcrete.Modules {
if module.Name == "" {
return depinject.Error(fmt.Errorf("module is missing name"))
return depinject.Error(errors.New("module is missing name"))
}

if module.Config == nil {
Expand Down
5 changes: 3 additions & 2 deletions depinject/container_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package depinject_test

import (
"errors"
"fmt"
"os"
"testing"
Expand Down Expand Up @@ -300,7 +301,7 @@ func TestCyclic(t *testing.T) {
}

func TestErrorOption(t *testing.T) {
err := depinject.Inject(depinject.Error(fmt.Errorf("an error")))
err := depinject.Inject(depinject.Error(errors.New("an error")))
require.Error(t, err)
}

Expand Down Expand Up @@ -606,7 +607,7 @@ func ProvideTestOutput() (TestOutput, error) {
}

func ProvideTestOutputErr() (TestOutput, error) {
return TestOutput{}, fmt.Errorf("error")
return TestOutput{}, errors.New("error")
}

func TestStructArgs(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions depinject/internal/codegen/file.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package codegen

import (
"fmt"
"errors"
"go/ast"
"go/token"
"strconv"
Expand Down Expand Up @@ -61,7 +61,7 @@ func NewFileGen(file *ast.File, codegenPkgPath string) (*FileGen, error) {
if spec.Name != nil {
name := spec.Name.Name
if name == "." {
return nil, fmt.Errorf(". package imports are not allowed")
return nil, errors.New(". package imports are not allowed")
}

info = &importInfo{importPrefix: name, ImportSpec: spec}
Expand Down
Loading

0 comments on commit 77d0533

Please sign in to comment.