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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user