forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR cosmos#4790: Fix multisig output
- Loading branch information
1 parent
8c989fd
commit 7c70912
Showing
5 changed files
with
82 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#4338 fix multisig key output for CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package keys | ||
|
||
import ( | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/require" | ||
"github.com/tendermint/tendermint/crypto" | ||
"github.com/tendermint/tendermint/crypto/multisig" | ||
"github.com/tendermint/tendermint/crypto/secp256k1" | ||
) | ||
|
||
func TestBech32KeysOutput(t *testing.T) { | ||
tmpKey := secp256k1.GenPrivKey().PubKey() | ||
bechTmpKey := sdk.MustBech32ifyAccPub(tmpKey) | ||
tmpAddr := sdk.AccAddress(tmpKey.Address().Bytes()) | ||
|
||
multisigPks := multisig.NewPubKeyMultisigThreshold(1, []crypto.PubKey{tmpKey}) | ||
multiInfo := NewMultiInfo("multisig", multisigPks) | ||
accAddr := sdk.AccAddress(multiInfo.GetPubKey().Address().Bytes()) | ||
bechPubKey := sdk.MustBech32ifyAccPub(multiInfo.GetPubKey()) | ||
|
||
expectedOutput := NewKeyOutput(multiInfo.GetName(), multiInfo.GetType().String(), accAddr.String(), bechPubKey) | ||
expectedOutput.Threshold = 1 | ||
expectedOutput.PubKeys = []multisigPubKeyOutput{{tmpAddr.String(), bechTmpKey, 1}} | ||
|
||
outputs, err := Bech32KeysOutput([]Info{multiInfo}) | ||
require.NoError(t, err) | ||
require.Equal(t, expectedOutput, outputs[0]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters