x/ibc: alter id requirements (#6227)

* x/ibc: alter id requirements

* add regex to validations

* comment

* update error

* test all validators:

* fix tests

* check for only separators
This commit is contained in:
Federico Kunze
2020-05-15 17:24:31 +00:00
committed by GitHub
parent 34d9ed52b3
commit b2ad4d2a23
18 changed files with 196 additions and 58 deletions
-4
View File
@@ -1,15 +1,11 @@
package baseapp
import (
"regexp"
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var isAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString
func (app *BaseApp) Check(tx sdk.Tx) (sdk.GasInfo, *sdk.Result, error) {
return app.runTx(runTxModeCheck, nil, tx)
}
+1 -1
View File
@@ -22,7 +22,7 @@ func NewQueryRouter() *QueryRouter {
// AddRoute adds a query path to the router with a given Querier. It will panic
// if a duplicate route is given. The route must be alphanumeric.
func (qrt *QueryRouter) AddRoute(path string, q sdk.Querier) sdk.QueryRouter {
if !isAlphaNumeric(path) {
if !sdk.IsAlphaNumeric(path) {
panic("route expressions can only contain alphanumeric characters")
}
+1 -1
View File
@@ -22,7 +22,7 @@ func NewRouter() *Router {
// AddRoute adds a route path to the router with a given handler. The route must
// be alphanumeric.
func (rtr *Router) AddRoute(path string, h sdk.Handler) sdk.Router {
if !isAlphaNumeric(path) {
if !sdk.IsAlphaNumeric(path) {
panic("route expressions can only contain alphanumeric characters")
}
if rtr.routes[path] != nil {