diff --git a/pkg/db/pgx.go b/pkg/db/pgx.go index 1d36261b..3a6197cb 100644 --- a/pkg/db/pgx.go +++ b/pkg/db/pgx.go @@ -71,7 +71,8 @@ func isValidNamespace(namespace string) error { // PostgreSQL identifiers must start with a letter or underscore if !allowedNamespaceRe.MatchString(namespace) { return fmt.Errorf( - "namespace must start with a letter or underscore and contain only letters, numbers, and underscores", + "namespace must start with a letter or underscore and contain only letters, numbers, and underscores. Instead is %s", + namespace, ) } return nil diff --git a/pkg/utils/namespace.go b/pkg/utils/namespace.go index 67276c16..0e2542b6 100644 --- a/pkg/utils/namespace.go +++ b/pkg/utils/namespace.go @@ -1,6 +1,8 @@ package utils import ( + "fmt" + ethcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/xmtp/xmtpd/pkg/config" ) @@ -11,5 +13,5 @@ func BuildNamespace(options config.ServerOptions) string { []byte(options.Contracts.NodesContractAddress), ) - return HexEncode(hash)[:12] + return fmt.Sprintf("xmtpd_%s", HexEncode(hash)[:12]) }