Skip to content

Commit

Permalink
handle string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradStaniec committed Jan 9, 2025
1 parent 32d5b12 commit 1118fa6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cmd/stakercli/pop/pop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pop
import (
"encoding/base64"
"fmt"
"strconv"

"github.com/babylonlabs-io/btc-staker/babylonclient/keyringcontroller"
"github.com/babylonlabs-io/btc-staker/cmd/stakercli/helpers"
Expand Down Expand Up @@ -181,6 +182,11 @@ var generateDeletePopCmd = cli.Command{
Usage: "Baby address to delete proof of possession for",
Required: true,
},
cli.StringFlag{
Name: msgFlag,
Usage: "message to sign",
Required: true,
},
cli.StringFlag{
Name: babyAddressPrefixFlag,
Usage: "Baby address prefix",
Expand Down Expand Up @@ -248,11 +254,19 @@ func generateDeletePop(c *cli.Context) error {
return err
}

msg := c.String(msgFlag)

// We are assuming we are receiving string literal with escape characters
interpretedMsg, err := strconv.Unquote(`"` + msg + `"`)
if err != nil {
return err
}

signature, err := staker.SignCosmosAdr36(

Check failure on line 265 in cmd/stakercli/pop/pop.go

View workflow job for this annotation

GitHub Actions / lint_test / lint

ineffectual assignment to err (ineffassign)
keyring,
record.Name,
sdkAddress.String(),
[]byte(btcAddress.String()),
[]byte(interpretedMsg),
)

payload := DeletePopPayload{
Expand Down

0 comments on commit 1118fa6

Please sign in to comment.