Skip to content

Commit

Permalink
fix: allow empty public keys when setting signatures (#19106)
Browse files Browse the repository at this point in the history
(cherry picked from commit e621eb6)

# Conflicts:
#	x/auth/CHANGELOG.md
  • Loading branch information
cmwaters authored and mergify[bot] committed Jan 18, 2024
1 parent 60c6d9b commit c2933ab
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 4 deletions.
53 changes: 53 additions & 0 deletions x/auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!--
Guiding Principles:
Changelogs are for humans, not machines.
There should be an entry for every single version.
The same types of changes should be grouped.
Versions and sections should be linkable.
The latest version comes first.
The release date of each version is displayed.
Mention whether you follow Semantic Versioning.
Usage:
Change log entries are to be added to the Unreleased section under the
appropriate stanza (see below). Each entry should ideally include a tag and
the Github issue reference in the following format:
* (<tag>) [#<issue-number>] Changelog message.
Types of changes (Stanzas):
"Features" for new features.
"Improvements" for changes in existing functionality.
"Deprecated" for soon-to-be removed features.
"Bug Fixes" for any bug fixes.
"API Breaking" for breaking exported APIs used by developers building on SDK.
Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

## [Unreleased]

### Features

* [#18641](https://github.com/cosmos/cosmos-sdk/pull/18641) Support the ability to broadcast unordered transactions per ADR-070. See UPGRADING.md for more details on integration.
* [#18281](https://github.com/cosmos/cosmos-sdk/pull/18281) Support broadcasting multiple transactions.
* (vesting) [#17810](https://github.com/cosmos/cosmos-sdk/pull/17810) Add the ability to specify a start time for continuous vesting accounts.
* (tx) [#18772](https://github.com/cosmos/cosmos-sdk/pull/18772) Remove misleading gas wanted from tx simulation failure log.

### Improvements

* [#18780](https://github.com/cosmos/cosmos-sdk/pull/18780) Move sig verification out of the for loop, into the authenticate method.

### CLI Breaking Changes

* (vesting) [#18100](https://github.com/cosmos/cosmos-sdk/pull/18100) `appd tx vesting create-vesting-account` takes an amount of coin as last argument instead of second. Coins are space separated.

### API Breaking Changes

* [#17985](https://github.com/cosmos/cosmos-sdk/pull/17985) Remove `StdTxConfig`

### Consensus Breaking Changes

* [#18817](https://github.com/cosmos/cosmos-sdk/pull/18817) SigVerification, GasConsumption, IncreaseSequence ante decorators have all been joined into one SigVerification decorator. Gas consumption during TX validation flow has reduced.

### Bug Fixes

* [#19106](https://github.com/cosmos/cosmos-sdk/pull/19106) Allow empty public keys when setting signatures. Public keys aren't needed for every transaction.
14 changes: 10 additions & 4 deletions x/auth/tx/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,17 @@ func (w *wrapper) SetSignatures(signatures ...signing.SignatureV2) error {
rawSigs := make([][]byte, n)

for i, sig := range signatures {
var modeInfo *tx.ModeInfo
var (
modeInfo *tx.ModeInfo
pubKey *codectypes.Any
err error
)
modeInfo, rawSigs[i] = SignatureDataToModeInfoAndSig(sig.Data)
pubKey, err := codectypes.NewAnyWithValue(sig.PubKey)
if err != nil {
return err
if sig.PubKey != nil {
pubKey, err = codectypes.NewAnyWithValue(sig.PubKey)
if err != nil {
return err
}
}
signerInfos[i] = &tx.SignerInfo{
PublicKey: pubKey,
Expand Down
14 changes: 14 additions & 0 deletions x/auth/tx/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ func TestTxBuilder(t *testing.T) {
})
}

func TestSetSignaturesNoPublicKey(t *testing.T) {
_, pubkey, _ := testdata.KeyTestPubAddr()
txBuilder := newBuilder(nil)
sig2 := signing.SignatureV2{
Data: &signing.SingleSignatureData{
SignMode: signing.SignMode_SIGN_MODE_DIRECT,
Signature: legacy.Cdc.MustMarshal(pubkey),
},
Sequence: 1,
}
err := txBuilder.SetSignatures(sig2)
require.NoError(t, err)
}

func TestBuilderValidateBasic(t *testing.T) {
// keys and addresses
_, pubKey1, addr1 := testdata.KeyTestPubAddr()
Expand Down

0 comments on commit c2933ab

Please sign in to comment.