Skip to content

Commit 6bd2670

Browse files
authored
fix: cli with malformed height (#4107)
1 parent 1acbb24 commit 6bd2670

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

nodebuilder/blob/cmd/blob.go

+7-10
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ var getCmd = &cobra.Command{
4343
Short: "Returns the blob for the given namespace by commitment at a particular height.\n" +
4444
"Note:\n* Both namespace and commitment input parameters are expected to be in their hex representation.",
4545
PreRunE: func(_ *cobra.Command, args []string) error {
46-
if !strings.HasPrefix(args[0], "0x") {
47-
args[0] = "0x" + args[0]
48-
}
4946
if !strings.HasPrefix(args[1], "0x") {
5047
args[1] = "0x" + args[1]
5148
}
49+
if !strings.HasPrefix(args[2], "0x") {
50+
args[2] = "0x" + args[2]
51+
}
5252
return nil
5353
},
5454
RunE: func(cmd *cobra.Command, args []string) error {
@@ -84,9 +84,6 @@ var getAllCmd = &cobra.Command{
8484
Short: "Returns all blobs for the given namespace at a particular height.\n" +
8585
"Note:\n* Namespace input parameter is expected to be in its hex representation.",
8686
PreRunE: func(_ *cobra.Command, args []string) error {
87-
if !strings.HasPrefix(args[0], "0x") {
88-
args[0] = "0x" + args[0]
89-
}
9087
if !strings.HasPrefix(args[1], "0x") {
9188
args[1] = "0x" + args[1]
9289
}
@@ -150,7 +147,7 @@ var submitCmd = &cobra.Command{
150147
"returns the header height in which the blob(s) was/were include + the respective commitment(s).\n" +
151148
"User can use namespace and blobData as argument for single blob submission \n" +
152149
"or use --input-file flag with the path to a json file for multiple blobs submission, \n" +
153-
`where the json file contains:
150+
`where the json file contains:
154151
155152
{
156153
"Blobs": [
@@ -241,12 +238,12 @@ var getProofCmd = &cobra.Command{
241238
Short: "Retrieves the blob in the given namespaces at the given height by commitment and returns its Proof.\n" +
242239
"Note:\n* Both namespace and commitment input parameters are expected to be in their hex representation.",
243240
PreRunE: func(_ *cobra.Command, args []string) error {
244-
if !strings.HasPrefix(args[0], "0x") {
245-
args[0] = "0x" + args[0]
246-
}
247241
if !strings.HasPrefix(args[1], "0x") {
248242
args[1] = "0x" + args[1]
249243
}
244+
if !strings.HasPrefix(args[2], "0x") {
245+
args[2] = "0x" + args[2]
246+
}
250247
return nil
251248
},
252249
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)