refactor!: Add context arg to sign mode handler GetSignBytes (#13701)

* refactor!: Add context arg to sign mode handler `GetSignBytes`

* fix build

* fix tests

* Fix goling

* fix lint

* Fix lint

* Fix test

* Update CHANGELOG.md

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>

* Fix tests

* Fix rosetta deps

* fix

* go mod tidy all

* go mod tidy

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
Amaury
2022-11-29 18:49:51 +00:00
committed by GitHub
co-authored by Aleksandr Bezobchuk Marko Julien Robert
parent 5a1fa2ee02
commit fffc9d07d5
37 changed files with 88 additions and 60 deletions
+5 -2
View File
@@ -1,6 +1,7 @@
package cli
import (
"context"
"fmt"
"os"
"strings"
@@ -136,7 +137,8 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) {
PubKey: sig.PubKey,
}
err = signing.VerifySignature(sig.PubKey, signingData, sig.Data, txCfg.SignModeHandler(), txBuilder.GetTx())
// When Textual is wired up, the context argument should be retrieved from the client context.
err = signing.VerifySignature(context.TODO(), sig.PubKey, signingData, sig.Data, txCfg.SignModeHandler(), txBuilder.GetTx())
if err != nil {
addr, _ := sdk.AccAddressFromHexUnsafe(sig.PubKey.Address().String())
return fmt.Errorf("couldn't verify signature for address %s", addr)
@@ -323,7 +325,8 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error {
}
for _, sig := range signatureBatch {
err = signing.VerifySignature(sig[i].PubKey, signingData, sig[i].Data, txCfg.SignModeHandler(), txBldr.GetTx())
// When Textual is wired up, the context argument should be retrieved from the client context.
err = signing.VerifySignature(context.TODO(), sig[i].PubKey, signingData, sig[i].Data, txCfg.SignModeHandler(), txBldr.GetTx())
if err != nil {
return fmt.Errorf("couldn't verify signature: %w %v", err, sig)
}
+3 -1
View File
@@ -1,6 +1,7 @@
package cli
import (
"context"
"fmt"
"github.com/spf13/cobra"
@@ -111,7 +112,8 @@ func printAndValidateSigs(
Sequence: accSeq,
PubKey: pubKey,
}
err = authsigning.VerifySignature(pubKey, signingData, sig.Data, signModeHandler, sigTx)
// When Textual is wired up, the context argument should be retrieved from the client context.
err = authsigning.VerifySignature(context.TODO(), pubKey, signingData, sig.Data, signModeHandler, sigTx)
if err != nil {
return false
}