Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmjs test vectors #7

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ build-simd-all: go.sum
--name latest-build cosmossdk/rbuilder:latest
docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/

build-simd-darwin: go.sum $(BUILDDIR)/
docker rm latest-build || true
docker run --volume=$(CURDIR):/sources:ro \
--env TARGET_PLATFORMS='darwin/amd64' \
--env APP=simd \
--env VERSION=$(VERSION) \
--env COMMIT=$(COMMIT) \
--env LEDGER_ENABLED=$(LEDGER_ENABLED) \
--name latest-build cosmossdk/rbuilder:latest
docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
cp artifacts/simd-*-darwin-amd64 $(BUILDDIR)/simd

build-simd-linux: go.sum $(BUILDDIR)/
docker rm latest-build || true
docker run --volume=$(CURDIR):/sources:ro \
Expand Down
3 changes: 3 additions & 0 deletions client/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ func Sign(txf Factory, name string, txBuilder client.TxBuilder) error {
// use the SignModeHandler's default mode if unspecified
signMode = txf.txConfig.SignModeHandler().DefaultMode()
}
fmt.Printf("Sign Mode: %s\n\n", signMode)

key, err := txf.keybase.Key(name)
if err != nil {
Expand Down Expand Up @@ -426,12 +427,14 @@ func Sign(txf Factory, name string, txBuilder client.TxBuilder) error {
if err != nil {
return err
}
fmt.Printf("Sign Bytes: %x\n\n", signBytes)

// Sign those bytes
sigBytes, _, err := txf.keybase.Sign(name, signBytes)
if err != nil {
return err
}
fmt.Printf("Signature: %x\n\n", sigBytes)

// Construct the SignatureV2 struct
sigData = signing.SingleSignatureData{
Expand Down
7 changes: 7 additions & 0 deletions x/auth/client/cli/tx_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ func makeSignCmd() func(cmd *cobra.Command, args []string) error {
return err
}

// print out the protobuf format
proto, err := txCfg.TxEncoder()(txBuilder.GetTx())
if err != nil {
return err
}
fmt.Printf("Signed TX Bytes: %x\n", proto)

json, err := marshalSignatureJSON(txCfg, txBuilder, generateSignatureOnly)
if err != nil {
return err
Expand Down