Skip to content

Commit

Permalink
Merge branch 'master' into robert/cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba authored Oct 21, 2021
2 parents a3a389c + c7a933c commit eba95c7
Show file tree
Hide file tree
Showing 18 changed files with 1,407 additions and 27 deletions.
14 changes: 14 additions & 0 deletions testutil/testdata/table.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package testdata

import "github.com/cosmos/cosmos-sdk/types/errors"

var (
ErrTest = errors.Register("table_testdata", 2, "test")
)

func (g TableModel) ValidateBasic() error {
if g.Name == "" {
return errors.Wrap(ErrTest, "name")
}
return nil
}
255 changes: 231 additions & 24 deletions testutil/testdata/testdata.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions testutil/testdata/testdata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ message BadMultiSignature {
repeated bytes signatures = 1;
bytes malicious_field = 5;
}

message TableModel {
uint64 id = 1;
string name = 2;
}
21 changes: 21 additions & 0 deletions types/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const UndefinedCodespace = "undefined"
// mathCodespace is the codespace for all errors defined in math package
const mathCodespace = "math"

// mathCodespace is the codespace for all errors defined in orm package
const ormCodespace = "orm"

var (
// errInternal should never be exposed, but we reserve this code for non-specified errors
errInternal = Register(UndefinedCodespace, 1, "internal")
Expand Down Expand Up @@ -153,6 +156,24 @@ var (

// ErrInvalidDecString defines an error for an invalid decimal string
ErrInvalidDecString = Register(mathCodespace, 41, "invalid decimal string")

// ErrORMIteratorDone defines an error when an iterator is done
ErrORMIteratorDone = Register(ormCodespace, 42, "iterator done")

// ErrORMInvalidIterator defines an error for an invalid iterator
ErrORMInvalidIterator = Register(ormCodespace, 43, "invalid iterator")

// ErrORMUniqueConstraint defines an error when a value already exists at a given key
ErrORMUniqueConstraint = Register(ormCodespace, 44, "unique constraint violation")

// ErrORMEmptyModel defines an error when an empty model is provided for building a table
ErrORMEmptyModel = Register(ormCodespace, 45, "invalid argument")

// ErrORMKeyMaxLength defines an error when a key exceeds max length
ErrORMKeyMaxLength = Register(ormCodespace, 46, "index key exceeds max length")

// ErrORMEmptyKey defines an error for an empty key
ErrORMEmptyKey = Register(ormCodespace, 47, "cannot use empty key")
)

// Register returns an error instance that should be used as the base for
Expand Down
6 changes: 5 additions & 1 deletion x/group/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ require (
pgregory.net/rapid v0.4.7
)

require github.com/tendermint/tm-db v0.6.4

require (
github.com/DataDog/zstd v1.4.5 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
Expand All @@ -22,6 +24,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/confio/ics23/go v0.6.6 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/iavl v0.17.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
github.com/dgraph-io/ristretto v0.0.3 // indirect
Expand All @@ -33,6 +36,7 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
Expand All @@ -45,6 +49,7 @@ require (
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand All @@ -65,7 +70,6 @@ require (
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/tendermint v0.34.13 // indirect
github.com/tendermint/tm-db v0.6.4 // indirect
go.etcd.io/bbolt v1.3.5 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
Expand Down
Loading

0 comments on commit eba95c7

Please sign in to comment.