Repository: terra-money/core
File: x/smartaccount/ante/auth.go (Go)

Code before:
	account sdk.AccAddress,
) (
	senderAddrs []string,
	signatureBzs [][]byte,
	signedBytes [][]byte,
	err error,
) {
	signatures, err := sigTx.GetSignaturesV2()
	if err != nil {
		return nil, nil, nil, err
	}
	if len(signatures) == 0 {
		return nil, nil, nil, sdkerrors.ErrNoSignatures.Wrap("no signatures found")
	}

	for _, signature := range signatures {
		// This is to get the list of signers that contributed to the signatures
		sas, err := GetSignerAddrStrings(signature.PubKey)
		if err != nil {
			return nil, nil, nil, err
		}
		senderAddrs = append(senderAddrs, sas...)

		// This is to get the address of the signer (either a multisig or a single sig)
		// For multisig, the address to generated from the json encoded list of signers
		// See: cosmos-sdk: crypto/keys/multisig/multisig.go
		senderAddr, err := sdk.AccAddressFromHexUnsafe(signature.PubKey.Address().String())
		if err != nil {
			return nil, nil, nil, err
		}

		senderAcc, err := authante.GetSignerAcc(ctx, sad.accountKeeper, senderAddr)
		if err != nil {
			return nil, nil, nil, err
		}
		var senderAccNum uint64
		if ctx.BlockHeight() != 0 {
			senderAccNum = senderAcc.GetAccountNumber()
		}

		signerData := authsigning.SignerData{
			Address:       senderAddr.String(),
			ChainID:       ctx.ChainID(),
			AccountNumber: senderAccNum,
			Sequence:      senderAcc.GetSequence(),
			PubKey:        signature.PubKey,
		}

		signatureBz, err := signatureDataToBz(signature.Data)
		if err != nil {
			return nil, nil, nil, err

Review comment (suggestion):
```suggestion
		// See: https://github.com/cosmos/cosmos-sdk/blob/v0.47.10/crypto/keys/multisig/multisig.go
```

Code after:
	account sdk.AccAddress,
) (
	senderAddrs []string,
	signatureBzs [][]byte,
	signedBzs [][]byte,
	err error,
) {
	signatures, err := sigTx.GetSignaturesV2()
	if err != nil {
		return nil, nil, nil, err
	}
	if len(signatures) == 0 {
		return nil, nil, nil, sdkerrors.ErrNoSignatures.Wrap("no signatures found")
	}

	for _, signature := range signatures {
		// This is to get the list of signers that contributed to the signatures
		sas, err := GetSignerAddrStrings(signature.PubKey)
		if err != nil {
			return nil, nil, nil, err
		}
		senderAddrs = append(senderAddrs, sas...)

		// This is to get the address of the signer (either a multisig or a single sig)
		// For multisig, the address to generated from the json encoded list of signers
		// See: https://github.com/cosmos/cosmos-sdk/blob/v0.47.10/crypto/keys/multisig/multisig.go
		senderAddr, err := sdk.AccAddressFromHexUnsafe(signature.PubKey.Address().String())
		if err != nil {
			return nil, nil, nil, err
		}

		senderAcc, err := authante.GetSignerAcc(ctx, sad.accountKeeper, senderAddr)
		if err != nil {
			return nil, nil, nil, err
		}
		var senderAccNum uint64
		if ctx.BlockHeight() != 0 {
			senderAccNum = senderAcc.GetAccountNumber()
		}

		signerData := authsigning.SignerData{
			Address:       senderAddr.String(),
			ChainID:       ctx.ChainID(),
			AccountNumber: senderAccNum,
			Sequence:      senderAcc.GetSequence(),
			PubKey:        signature.PubKey,
		}

		signatureBz, err := signatureDataToBz(signature.Data)
		if err != nil {
			return nil, nil, nil, err