Skip to content

Commit

Permalink
aux updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jan 21, 2025
1 parent ecc8240 commit 2b9ba06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/tx/aux_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (b *AuxTxBuilder) SetSignMode(mode apisigning.SignMode) error {
case apisigning.SignMode_SIGN_MODE_DIRECT_AUX, apisigning.SignMode_SIGN_MODE_LEGACY_AMINO_JSON:
default:
return sdkerrors.ErrInvalidRequest.Wrapf("AuxTxBuilder can only sign with %s or %s",
signing.SignMode_SIGN_MODE_DIRECT_AUX, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
apisigning.SignMode_SIGN_MODE_DIRECT_AUX, apisigning.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
}

b.auxSignerData.Mode, _ = signing.APISignModeToInternal(mode)
Expand Down
4 changes: 3 additions & 1 deletion client/tx/aux_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
typestx "github.com/cosmos/cosmos-sdk/types/tx"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
)

const (
Expand Down Expand Up @@ -248,6 +249,7 @@ func checkCorrectData(t *testing.T, cdc codec.Codec, auxSignerData typestx.AuxSi
require.Equal(t, chainID, auxSignerData.SignDoc.ChainId)
require.Equal(t, msgAny, body.GetMessages()[0])
require.Equal(t, pkAny, auxSignerData.SignDoc.PublicKey)
require.Equal(t, signMode, auxSignerData.Mode)
m, _ := signing.InternalSignModeToAPI(auxSignerData.Mode)
require.Equal(t, signMode, m)
require.Equal(t, rawSig, auxSignerData.Sig)
}
3 changes: 2 additions & 1 deletion types/tx/direct_aux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ func TestAuxSignerData(t *testing.T) {
require.NoError(t, err)
sigV2, err := tc.sd.GetSignatureV2()
require.NoError(t, err)
require.Equal(t, tc.sd.Mode, sigV2.Data.(*signing.SingleSignatureData).SignMode)
m, _ := signing.InternalSignModeToAPI(tc.sd.Mode)
require.Equal(t, m, sigV2.Data.(*signing.SingleSignatureData).SignMode)
require.Equal(t, tc.sd.Sig, sigV2.Data.(*signing.SingleSignatureData).Signature)
require.Equal(t, tc.sd.SignDoc.Sequence, sigV2.Sequence)
require.True(t, tc.sd.SignDoc.PublicKey.GetCachedValue().(cryptotypes.PubKey).Equals(sigV2.PubKey))
Expand Down

0 comments on commit 2b9ba06

Please sign in to comment.