diff --git a/nodebuilder/blob/cmd/blob.go b/nodebuilder/blob/cmd/blob.go index 504533d2fc..17eec5bbf1 100644 --- a/nodebuilder/blob/cmd/blob.go +++ b/nodebuilder/blob/cmd/blob.go @@ -43,11 +43,11 @@ var getCmd = &cobra.Command{ Short: "Returns the blob for the given namespace by commitment at a particular height.\n" + "Note:\n* Both namespace and commitment input parameters are expected to be in their hex representation.", PreRunE: func(_ *cobra.Command, args []string) error { - if !strings.HasPrefix(args[1], "0x") { - return fmt.Errorf("only hex namespace is supported") + if !strings.HasPrefix(args[0], "0x") { + args[0] = "0x" + args[0] } - if !strings.HasPrefix(args[2], "0x") { - return fmt.Errorf("only hex commitment is supported") + if !strings.HasPrefix(args[1], "0x") { + args[1] = "0x" + args[1] } return nil }, @@ -84,8 +84,11 @@ var getAllCmd = &cobra.Command{ Short: "Returns all blobs for the given namespace at a particular height.\n" + "Note:\n* Namespace input parameter is expected to be in its hex representation.", PreRunE: func(_ *cobra.Command, args []string) error { + if !strings.HasPrefix(args[0], "0x") { + args[0] = "0x" + args[0] + } if !strings.HasPrefix(args[1], "0x") { - return fmt.Errorf("only hex namespace is supported") + args[1] = "0x" + args[1] } return nil }, @@ -136,7 +139,10 @@ var submitCmd = &cobra.Command{ }, PreRunE: func(_ *cobra.Command, args []string) error { if !strings.HasPrefix(args[0], "0x") { - return fmt.Errorf("only hex namespace is supported") + args[0] = "0x" + args[0] + } + if !strings.HasPrefix(args[1], "0x") { + args[1] = "0x" + args[1] } return nil }, @@ -235,11 +241,11 @@ var getProofCmd = &cobra.Command{ Short: "Retrieves the blob in the given namespaces at the given height by commitment and returns its Proof.\n" + "Note:\n* Both namespace and commitment input parameters are expected to be in their hex representation.", PreRunE: func(_ *cobra.Command, args []string) error { - if !strings.HasPrefix(args[1], "0x") { - return fmt.Errorf("only hex namespace is supported") + if !strings.HasPrefix(args[0], "0x") { + args[0] = "0x" + args[0] } - if !strings.HasPrefix(args[2], "0x") { - return fmt.Errorf("only hex commitment is supported") + if !strings.HasPrefix(args[1], "0x") { + args[1] = "0x" + args[1] } return nil },