revert: Remove SIGN_MODE_AMINO_AUX (#10322)
<!-- The default pull request template is for types feat, fix, or refactor. For other templates, add one of the following parameters to the url: - template=docs.md - template=other.md --> ## Description Revert #10268 As part of the TX working group, we decided not to introduce a new sign mode for tipper signing. The tipper will use amino-json to sign via ledger (see #10346). Also, add `signing.SignerData#Address` (will be used in subsequent PR #10346) <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
parent
a95d659e6b
commit
99e2e0f060
@ -225,6 +225,7 @@ func Sign(txf Factory, name string, txBuilder client.TxBuilder, overwriteSig boo
|
||||
AccountNumber: txf.accountNumber,
|
||||
Sequence: txf.sequence,
|
||||
SignerIndex: signerIndex,
|
||||
Address: sdk.AccAddress(pubKey.Address()).String(),
|
||||
}
|
||||
|
||||
// For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on
|
||||
|
||||
@ -1279,7 +1279,7 @@ GrantAuthorization defines the GenesisState/GrantAuthorization type.
|
||||
<a name="cosmos.authz.v1beta1.QueryGranterGrantsRequest"></a>
|
||||
|
||||
### QueryGranterGrantsRequest
|
||||
QueryGranterGrantsRequest is the request type for the Query/Grants RPC method.
|
||||
QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
@ -9400,7 +9400,6 @@ SignMode represents a signing mode with its own security guarantees.
|
||||
| SIGN_MODE_DIRECT | 1 | SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is verified with raw bytes from Tx. |
|
||||
| SIGN_MODE_TEXTUAL | 2 | SIGN_MODE_TEXTUAL is a future signing mode that will verify some human-readable textual representation on top of the binary representation from SIGN_MODE_DIRECT. It is currently not supported. |
|
||||
| SIGN_MODE_DIRECT_AUX | 3 | SIGN_MODE_DIRECT_AUX specifies a signing mode which uses SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not require signers signing over other signers' `signer_info`. It also allows for adding Tips in transactions. |
|
||||
| SIGN_MODE_AMINO_AUX | 4 | SIGN_MODE_AMINO_AUX specifies a signing mode which uses SignDocAminoAux. |
|
||||
| SIGN_MODE_LEGACY_AMINO_JSON | 127 | SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses Amino JSON and will be removed in the future. |
|
||||
|
||||
|
||||
|
||||
@ -27,10 +27,6 @@ enum SignMode {
|
||||
// for adding Tips in transactions.
|
||||
SIGN_MODE_DIRECT_AUX = 3;
|
||||
|
||||
// SIGN_MODE_AMINO_AUX specifies a signing mode which uses
|
||||
// SignDocAminoAux.
|
||||
SIGN_MODE_AMINO_AUX = 4;
|
||||
|
||||
// SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
|
||||
// Amino JSON and will be removed in the future.
|
||||
SIGN_MODE_LEGACY_AMINO_JSON = 127;
|
||||
|
||||
@ -722,9 +722,11 @@ func (c converter) SigningComponents(tx authsigning.Tx, metadata *ConstructionMe
|
||||
|
||||
// set the signer data
|
||||
signerData := authsigning.SignerData{
|
||||
Address: signer.String(),
|
||||
ChainID: metadata.ChainID,
|
||||
AccountNumber: metadata.SignersData[i].AccountNumber,
|
||||
Sequence: metadata.SignersData[i].Sequence,
|
||||
SignerIndex: i,
|
||||
}
|
||||
|
||||
// get signature bytes
|
||||
|
||||
@ -57,9 +57,11 @@ func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, ch
|
||||
// 2nd round: once all signer infos are set, every signer can sign.
|
||||
for i, p := range priv {
|
||||
signerData := authsign.SignerData{
|
||||
Address: sdk.AccAddress(p.PubKey().Address()).String(),
|
||||
ChainID: chainID,
|
||||
AccountNumber: accNums[i],
|
||||
Sequence: accSeqs[i],
|
||||
SignerIndex: i,
|
||||
}
|
||||
signBytes, err := gen.SignModeHandler().GetSignBytes(signMode, signerData, tx.GetTx())
|
||||
if err != nil {
|
||||
|
||||
@ -43,9 +43,6 @@ const (
|
||||
// require signers signing over other signers' `signer_info`. It also allows
|
||||
// for adding Tips in transactions.
|
||||
SignMode_SIGN_MODE_DIRECT_AUX SignMode = 3
|
||||
// SIGN_MODE_AMINO_AUX specifies a signing mode which uses
|
||||
// SignDocAminoAux.
|
||||
SignMode_SIGN_MODE_AMINO_AUX SignMode = 4
|
||||
// SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
|
||||
// Amino JSON and will be removed in the future.
|
||||
SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127
|
||||
@ -56,7 +53,6 @@ var SignMode_name = map[int32]string{
|
||||
1: "SIGN_MODE_DIRECT",
|
||||
2: "SIGN_MODE_TEXTUAL",
|
||||
3: "SIGN_MODE_DIRECT_AUX",
|
||||
4: "SIGN_MODE_AMINO_AUX",
|
||||
127: "SIGN_MODE_LEGACY_AMINO_JSON",
|
||||
}
|
||||
|
||||
@ -65,7 +61,6 @@ var SignMode_value = map[string]int32{
|
||||
"SIGN_MODE_DIRECT": 1,
|
||||
"SIGN_MODE_TEXTUAL": 2,
|
||||
"SIGN_MODE_DIRECT_AUX": 3,
|
||||
"SIGN_MODE_AMINO_AUX": 4,
|
||||
"SIGN_MODE_LEGACY_AMINO_JSON": 127,
|
||||
}
|
||||
|
||||
@ -403,43 +398,42 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_9a54958ff3d0b1b9 = []byte{
|
||||
// 566 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x41, 0x4f, 0xd4, 0x4e,
|
||||
0x18, 0xc6, 0x5b, 0xb6, 0x10, 0x78, 0xf9, 0xe7, 0x9f, 0x3a, 0x2c, 0x71, 0xa9, 0xa6, 0x12, 0x3c,
|
||||
0x48, 0x4c, 0x98, 0x06, 0x38, 0x18, 0xbd, 0x95, 0xdd, 0xba, 0xac, 0xb0, 0x8b, 0xb6, 0x4b, 0x82,
|
||||
0x5e, 0x36, 0x6d, 0x77, 0xa8, 0x0d, 0xdb, 0x4e, 0xed, 0x4c, 0x0d, 0x3d, 0xf9, 0x15, 0xfc, 0x14,
|
||||
0x26, 0x7e, 0x0e, 0x2f, 0x1e, 0x39, 0x7a, 0x34, 0xf0, 0x19, 0xbc, 0x1b, 0xa6, 0xed, 0x16, 0x0d,
|
||||
0xc6, 0xb8, 0xa7, 0xcd, 0xbc, 0xcf, 0xd3, 0xdf, 0xfb, 0x4c, 0xde, 0x77, 0x16, 0x1e, 0xf9, 0x94,
|
||||
0x45, 0x94, 0x19, 0xfc, 0xdc, 0x60, 0x61, 0x10, 0x87, 0x71, 0x60, 0xbc, 0xdf, 0xf6, 0x08, 0x77,
|
||||
0xb7, 0xab, 0x33, 0x4e, 0x52, 0xca, 0x29, 0x5a, 0x2b, 0x8c, 0x98, 0x9f, 0xe3, 0x4a, 0x28, 0x8d,
|
||||
0xda, 0x56, 0xc9, 0xf0, 0xd3, 0x3c, 0xe1, 0xd4, 0x88, 0xb2, 0x09, 0x0f, 0x59, 0x58, 0x83, 0xaa,
|
||||
0x42, 0x41, 0xd2, 0xd6, 0x02, 0x4a, 0x83, 0x09, 0x31, 0xc4, 0xc9, 0xcb, 0x4e, 0x0d, 0x37, 0xce,
|
||||
0x0b, 0x69, 0xe3, 0x14, 0x9a, 0x4e, 0x18, 0xc4, 0x2e, 0xcf, 0x52, 0xd2, 0x21, 0xcc, 0x4f, 0xc3,
|
||||
0x84, 0xd3, 0x94, 0xa1, 0x01, 0x00, 0xab, 0xea, 0xac, 0x25, 0xaf, 0x37, 0x36, 0x97, 0x77, 0x30,
|
||||
0xfe, 0x63, 0x22, 0x7c, 0x0b, 0xc4, 0xbe, 0x41, 0xd8, 0xf8, 0xa1, 0xc0, 0xca, 0x2d, 0x1e, 0xb4,
|
||||
0x0b, 0x90, 0x64, 0xde, 0x24, 0xf4, 0x47, 0x67, 0x24, 0x6f, 0xc9, 0xeb, 0xf2, 0xe6, 0xf2, 0x4e,
|
||||
0x13, 0x17, 0x79, 0x71, 0x95, 0x17, 0x9b, 0x71, 0x6e, 0x2f, 0x15, 0xbe, 0x03, 0x92, 0xa3, 0x2e,
|
||||
0x28, 0x63, 0x97, 0xbb, 0xad, 0x39, 0x61, 0xdf, 0xfd, 0xb7, 0x58, 0xb8, 0xe3, 0x72, 0xd7, 0x16,
|
||||
0x00, 0xa4, 0xc1, 0x22, 0x23, 0xef, 0x32, 0x12, 0xfb, 0xa4, 0xd5, 0x58, 0x97, 0x37, 0x15, 0x7b,
|
||||
0x7a, 0xd6, 0xbe, 0x34, 0x40, 0xb9, 0xb6, 0xa2, 0x21, 0x2c, 0xb0, 0x30, 0x0e, 0x26, 0xa4, 0x8c,
|
||||
0xf7, 0x6c, 0x86, 0x7e, 0xd8, 0x11, 0x84, 0x7d, 0xc9, 0x2e, 0x59, 0xe8, 0x15, 0xcc, 0x8b, 0x29,
|
||||
0x95, 0x97, 0x78, 0x3a, 0x0b, 0xb4, 0x7f, 0x0d, 0xd8, 0x97, 0xec, 0x82, 0xa4, 0x8d, 0x60, 0xa1,
|
||||
0x68, 0x83, 0x9e, 0x80, 0x12, 0xd1, 0x71, 0x11, 0xf8, 0xff, 0x9d, 0x87, 0x7f, 0x61, 0xf7, 0xe9,
|
||||
0x98, 0xd8, 0xe2, 0x03, 0x74, 0x1f, 0x96, 0xa6, 0x43, 0x13, 0xc9, 0xfe, 0xb3, 0xeb, 0x82, 0xf6,
|
||||
0x59, 0x86, 0x79, 0xd1, 0x13, 0x1d, 0xc0, 0xa2, 0x17, 0x72, 0x37, 0x4d, 0xdd, 0x6a, 0x68, 0x46,
|
||||
0xd5, 0xa4, 0xd8, 0x49, 0x3c, 0x5d, 0xc1, 0xaa, 0x53, 0x9b, 0x46, 0x89, 0xeb, 0xf3, 0xbd, 0x90,
|
||||
0x9b, 0xd7, 0x9f, 0xd9, 0x53, 0x00, 0x72, 0x7e, 0xd9, 0xb5, 0x39, 0xb1, 0x6b, 0x33, 0x0d, 0xf5,
|
||||
0x06, 0x66, 0x6f, 0x1e, 0x1a, 0x2c, 0x8b, 0x1e, 0x7f, 0x92, 0x61, 0xb1, 0xba, 0x23, 0x5a, 0x83,
|
||||
0x55, 0xa7, 0xd7, 0x1d, 0x8c, 0xfa, 0x47, 0x1d, 0x6b, 0x74, 0x3c, 0x70, 0x5e, 0x5a, 0xed, 0xde,
|
||||
0xf3, 0x9e, 0xd5, 0x51, 0x25, 0xd4, 0x04, 0xb5, 0x96, 0x3a, 0x3d, 0xdb, 0x6a, 0x0f, 0x55, 0x19,
|
||||
0xad, 0xc2, 0x9d, 0xba, 0x3a, 0xb4, 0x4e, 0x86, 0xc7, 0xe6, 0xa1, 0x3a, 0x87, 0x5a, 0xd0, 0xfc,
|
||||
0xdd, 0x3c, 0x32, 0x8f, 0x4f, 0xd4, 0x06, 0xba, 0x0b, 0x2b, 0xb5, 0x62, 0xf6, 0x7b, 0x83, 0x23,
|
||||
0x21, 0x28, 0xe8, 0x01, 0xdc, 0xab, 0x85, 0x43, 0xab, 0x6b, 0xb6, 0x5f, 0x97, 0xfa, 0x0b, 0xe7,
|
||||
0x68, 0xa0, 0x7e, 0xd8, 0xeb, 0x7e, 0xbd, 0xd4, 0xe5, 0x8b, 0x4b, 0x5d, 0xfe, 0x7e, 0xa9, 0xcb,
|
||||
0x1f, 0xaf, 0x74, 0xe9, 0xe2, 0x4a, 0x97, 0xbe, 0x5d, 0xe9, 0xd2, 0x9b, 0xad, 0x20, 0xe4, 0x6f,
|
||||
0x33, 0x0f, 0xfb, 0x34, 0x32, 0xaa, 0x77, 0x2f, 0x7e, 0xb6, 0xd8, 0xf8, 0xcc, 0xe0, 0x79, 0x42,
|
||||
0x6e, 0xfe, 0x99, 0x78, 0x0b, 0xe2, 0xd5, 0xec, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x54, 0x1d,
|
||||
0xa5, 0xb2, 0x68, 0x04, 0x00, 0x00,
|
||||
// 558 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4c,
|
||||
0x10, 0xc7, 0xed, 0x26, 0xad, 0xda, 0xe9, 0xa7, 0x4f, 0x66, 0x49, 0xa5, 0xd4, 0x20, 0x53, 0x95,
|
||||
0x03, 0x15, 0x52, 0xd7, 0x6a, 0x72, 0x40, 0x70, 0x73, 0x12, 0x93, 0x86, 0x36, 0x09, 0xd8, 0x89,
|
||||
0x54, 0xb8, 0x58, 0xb6, 0xb3, 0x35, 0x56, 0x63, 0xaf, 0xf1, 0xae, 0x51, 0x7d, 0xe2, 0x09, 0x90,
|
||||
0x78, 0x0d, 0x9e, 0x83, 0x0b, 0xc7, 0x1e, 0x39, 0xa2, 0xe4, 0x19, 0xb8, 0xa3, 0xd8, 0x71, 0x12,
|
||||
0x50, 0x11, 0x22, 0x27, 0x6b, 0x66, 0xfe, 0xfb, 0x9b, 0xff, 0x6a, 0x66, 0x0d, 0x8f, 0x5c, 0xca,
|
||||
0x02, 0xca, 0x54, 0x7e, 0xad, 0x32, 0xdf, 0x0b, 0xfd, 0xd0, 0x53, 0xdf, 0x9f, 0x38, 0x84, 0xdb,
|
||||
0x27, 0x45, 0x8c, 0xa3, 0x98, 0x72, 0x8a, 0xf6, 0x73, 0x21, 0xe6, 0xd7, 0xb8, 0x28, 0xcc, 0x85,
|
||||
0xf2, 0xf1, 0x9c, 0xe1, 0xc6, 0x69, 0xc4, 0xa9, 0x1a, 0x24, 0x63, 0xee, 0x33, 0x7f, 0x09, 0x2a,
|
||||
0x12, 0x39, 0x49, 0xde, 0xf7, 0x28, 0xf5, 0xc6, 0x44, 0xcd, 0x22, 0x27, 0xb9, 0x54, 0xed, 0x30,
|
||||
0xcd, 0x4b, 0x87, 0x97, 0x50, 0x31, 0x7d, 0x2f, 0xb4, 0x79, 0x12, 0x93, 0x16, 0x61, 0x6e, 0xec,
|
||||
0x47, 0x9c, 0xc6, 0x0c, 0xf5, 0x00, 0x58, 0x91, 0x67, 0x55, 0xf1, 0xa0, 0x74, 0xb4, 0x5b, 0xc3,
|
||||
0xf8, 0x8f, 0x8e, 0xf0, 0x2d, 0x10, 0x63, 0x85, 0x70, 0xf8, 0xa3, 0x0c, 0x77, 0x6f, 0xd1, 0xa0,
|
||||
0x3a, 0x40, 0x94, 0x38, 0x63, 0xdf, 0xb5, 0xae, 0x48, 0x5a, 0x15, 0x0f, 0xc4, 0xa3, 0xdd, 0x5a,
|
||||
0x05, 0xe7, 0x7e, 0x71, 0xe1, 0x17, 0x6b, 0x61, 0x6a, 0xec, 0xe4, 0xba, 0x33, 0x92, 0xa2, 0x36,
|
||||
0x94, 0x47, 0x36, 0xb7, 0xab, 0x1b, 0x99, 0xbc, 0xfe, 0x6f, 0xb6, 0x70, 0xcb, 0xe6, 0xb6, 0x91,
|
||||
0x01, 0x90, 0x0c, 0xdb, 0x8c, 0xbc, 0x4b, 0x48, 0xe8, 0x92, 0x6a, 0xe9, 0x40, 0x3c, 0x2a, 0x1b,
|
||||
0x8b, 0x58, 0xfe, 0x52, 0x82, 0xf2, 0x4c, 0x8a, 0x06, 0xb0, 0xc5, 0xfc, 0xd0, 0x1b, 0x93, 0xb9,
|
||||
0xbd, 0x67, 0x6b, 0xf4, 0xc3, 0x66, 0x46, 0x38, 0x15, 0x8c, 0x39, 0x0b, 0xbd, 0x82, 0xcd, 0x6c,
|
||||
0x4a, 0xf3, 0x4b, 0x3c, 0x5d, 0x07, 0xda, 0x9d, 0x01, 0x4e, 0x05, 0x23, 0x27, 0xc9, 0x16, 0x6c,
|
||||
0xe5, 0x6d, 0xd0, 0x13, 0x28, 0x07, 0x74, 0x94, 0x1b, 0xfe, 0xbf, 0xf6, 0xf0, 0x2f, 0xec, 0x2e,
|
||||
0x1d, 0x11, 0x23, 0x3b, 0x80, 0xee, 0xc3, 0xce, 0x62, 0x68, 0x99, 0xb3, 0xff, 0x8c, 0x65, 0x42,
|
||||
0xfe, 0x2c, 0xc2, 0x66, 0xd6, 0x13, 0x9d, 0xc1, 0xb6, 0xe3, 0x73, 0x3b, 0x8e, 0xed, 0x62, 0x68,
|
||||
0x6a, 0xd1, 0x24, 0xdf, 0x49, 0xbc, 0x58, 0xc1, 0xa2, 0x53, 0x93, 0x06, 0x91, 0xed, 0xf2, 0x86,
|
||||
0xcf, 0xb5, 0xd9, 0x31, 0x63, 0x01, 0x40, 0xe6, 0x2f, 0xbb, 0xb6, 0x91, 0xed, 0xda, 0x5a, 0x43,
|
||||
0x5d, 0xc1, 0x34, 0x36, 0xa1, 0xc4, 0x92, 0xe0, 0xf1, 0x47, 0x11, 0xb6, 0x8b, 0x3b, 0xa2, 0x7d,
|
||||
0xd8, 0x33, 0x3b, 0xed, 0x9e, 0xd5, 0xed, 0xb7, 0x74, 0x6b, 0xd8, 0x33, 0x5f, 0xea, 0xcd, 0xce,
|
||||
0xf3, 0x8e, 0xde, 0x92, 0x04, 0x54, 0x01, 0x69, 0x59, 0x6a, 0x75, 0x0c, 0xbd, 0x39, 0x90, 0x44,
|
||||
0xb4, 0x07, 0x77, 0x96, 0xd9, 0x81, 0x7e, 0x31, 0x18, 0x6a, 0xe7, 0xd2, 0x06, 0xaa, 0x42, 0xe5,
|
||||
0x77, 0xb1, 0xa5, 0x0d, 0x2f, 0xa4, 0x12, 0x7a, 0x00, 0xf7, 0x96, 0x95, 0x73, 0xbd, 0xad, 0x35,
|
||||
0x5f, 0x5b, 0x5a, 0xb7, 0xd3, 0xeb, 0x5b, 0x2f, 0xcc, 0x7e, 0x4f, 0xfa, 0xd0, 0x68, 0x7f, 0x9d,
|
||||
0x28, 0xe2, 0xcd, 0x44, 0x11, 0xbf, 0x4f, 0x14, 0xf1, 0xd3, 0x54, 0x11, 0x6e, 0xa6, 0x8a, 0xf0,
|
||||
0x6d, 0xaa, 0x08, 0x6f, 0x8e, 0x3d, 0x9f, 0xbf, 0x4d, 0x1c, 0xec, 0xd2, 0x40, 0x2d, 0x9e, 0x77,
|
||||
0xf6, 0x39, 0x66, 0xa3, 0x2b, 0x95, 0xa7, 0x11, 0x59, 0xfd, 0x67, 0x38, 0x5b, 0xd9, 0xe3, 0xa8,
|
||||
0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xda, 0x51, 0x6b, 0x5b, 0x4f, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error) {
|
||||
|
||||
@ -127,13 +127,15 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) {
|
||||
return fmt.Errorf("set the chain id with either the --chain-id flag or config file")
|
||||
}
|
||||
|
||||
signingData := signing.SignerData{
|
||||
ChainID: txFactory.ChainID(),
|
||||
AccountNumber: txFactory.AccountNumber(),
|
||||
Sequence: txFactory.Sequence(),
|
||||
}
|
||||
for j, sig := range sigs {
|
||||
signingData := signing.SignerData{
|
||||
Address: sdk.AccAddress(sig.PubKey.Address()).String(),
|
||||
ChainID: txFactory.ChainID(),
|
||||
AccountNumber: txFactory.AccountNumber(),
|
||||
Sequence: txFactory.Sequence(),
|
||||
SignerIndex: j,
|
||||
}
|
||||
|
||||
for _, sig := range sigs {
|
||||
err = signing.VerifySignature(sig.PubKey, signingData, sig.Data, txCfg.SignModeHandler(), txBuilder.GetTx())
|
||||
if err != nil {
|
||||
addr, _ := sdk.AccAddressFromHex(sig.PubKey.Address().String())
|
||||
@ -322,9 +324,11 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error {
|
||||
multisigPub := pubKey.(*kmultisig.LegacyAminoPubKey)
|
||||
multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys))
|
||||
signingData := signing.SignerData{
|
||||
Address: sdk.AccAddress(pubKey.Address()).String(),
|
||||
ChainID: txFactory.ChainID(),
|
||||
AccountNumber: txFactory.AccountNumber(),
|
||||
Sequence: txFactory.Sequence(),
|
||||
SignerIndex: i,
|
||||
}
|
||||
|
||||
for _, sig := range signatureBatch {
|
||||
|
||||
@ -106,9 +106,11 @@ func printAndValidateSigs(
|
||||
}
|
||||
|
||||
signingData := authsigning.SignerData{
|
||||
Address: sigAddr.String(),
|
||||
ChainID: chainID,
|
||||
AccountNumber: accNum,
|
||||
Sequence: accSeq,
|
||||
SignerIndex: i,
|
||||
}
|
||||
err = authsigning.VerifySignature(pubKey, signingData, sig.Data, signModeHandler, sigTx)
|
||||
if err != nil {
|
||||
|
||||
@ -212,9 +212,11 @@ func genTxWithFeeGranter(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins,
|
||||
// 2nd round: once all signer infos are set, every signer can sign.
|
||||
for i, p := range priv {
|
||||
signerData := authsign.SignerData{
|
||||
Address: sdk.AccAddress(p.PubKey().Address()).String(),
|
||||
ChainID: chainID,
|
||||
AccountNumber: accNums[i],
|
||||
Sequence: accSeqs[i],
|
||||
SignerIndex: i,
|
||||
}
|
||||
signBytes, err := gen.SignModeHandler().GetSignBytes(signMode, signerData, tx.GetTx())
|
||||
if err != nil {
|
||||
|
||||
@ -481,10 +481,13 @@ func (svm sigVerificationTxHandler) sigVerify(ctx context.Context, tx sdk.Tx, is
|
||||
if !genesis {
|
||||
accNum = acc.GetAccountNumber()
|
||||
}
|
||||
|
||||
signerData := authsigning.SignerData{
|
||||
Address: signerAddrs[i].String(),
|
||||
ChainID: chainID,
|
||||
AccountNumber: accNum,
|
||||
Sequence: acc.GetSequence(),
|
||||
SignerIndex: i,
|
||||
}
|
||||
|
||||
if !simulate {
|
||||
|
||||
@ -139,9 +139,11 @@ func (s *MWTestSuite) createTestTx(txBuilder client.TxBuilder, privs []cryptotyp
|
||||
sigsV2 = []signing.SignatureV2{}
|
||||
for i, priv := range privs {
|
||||
signerData := xauthsigning.SignerData{
|
||||
Address: sdk.AccAddress(priv.PubKey().Address()).String(),
|
||||
ChainID: chainID,
|
||||
AccountNumber: accNums[i],
|
||||
Sequence: accSeqs[i],
|
||||
SignerIndex: i,
|
||||
}
|
||||
sigV2, err := tx.SignWithPrivKey(
|
||||
s.clientCtx.TxConfig.SignModeHandler().DefaultMode(), signerData,
|
||||
|
||||
@ -46,9 +46,11 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
|
||||
|
||||
handler := stdTxSignModeHandler{}
|
||||
signingData := signing.SignerData{
|
||||
Address: addr1.String(),
|
||||
ChainID: chainId,
|
||||
AccountNumber: accNum,
|
||||
Sequence: seqNum,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
package legacytx
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
type StdSignDocAux struct {
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
TimeoutHeight uint64 `json:"timeout_height,omitempty" yaml:"timeout_height"`
|
||||
ChainID string `json:"chain_id" yaml:"chain_id"`
|
||||
Memo string `json:"memo" yaml:"memo"`
|
||||
Msgs []json.RawMessage `json:"msgs" yaml:"msgs"`
|
||||
Tip sdk.Coins `json:"tip" yaml:"tip"`
|
||||
}
|
||||
|
||||
// StdSignBytes returns the bytes to sign for a transaction.
|
||||
func StdSignAuxBytes(chainID string, accnum, sequence, timeout uint64, tip sdk.Coins, msgs []sdk.Msg, memo string) []byte {
|
||||
msgsBytes := make([]json.RawMessage, 0, len(msgs))
|
||||
for _, msg := range msgs {
|
||||
legacyMsg, ok := msg.(LegacyMsg)
|
||||
if !ok {
|
||||
panic(fmt.Errorf("expected %T when using AMINO_AUX", (*LegacyMsg)(nil)))
|
||||
}
|
||||
|
||||
msgsBytes = append(msgsBytes, json.RawMessage(legacyMsg.GetSignBytes()))
|
||||
}
|
||||
|
||||
bz, err := legacy.Cdc.MarshalJSON(StdSignDocAux{
|
||||
AccountNumber: accnum,
|
||||
ChainID: chainID,
|
||||
Memo: memo,
|
||||
Msgs: msgsBytes,
|
||||
Sequence: sequence,
|
||||
TimeoutHeight: timeout,
|
||||
Tip: tip,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return sdk.MustSortJSON(bz)
|
||||
}
|
||||
@ -60,9 +60,11 @@ func TestHandlerMap_GetSignBytes(t *testing.T) {
|
||||
aminoJSONHandler := legacytx.NewStdTxSignModeHandler()
|
||||
|
||||
signingData := signing.SignerData{
|
||||
Address: addr1.String(),
|
||||
ChainID: chainId,
|
||||
AccountNumber: accNum,
|
||||
Sequence: seqNum,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -23,6 +23,9 @@ type SignModeHandler interface {
|
||||
// SignerData is the specific information needed to sign a transaction that generally
|
||||
// isn't included in the transaction body itself
|
||||
type SignerData struct {
|
||||
// The address of the signer.
|
||||
Address string
|
||||
|
||||
// ChainID is the chain that this transaction is targeted
|
||||
ChainID string
|
||||
|
||||
@ -35,6 +38,6 @@ type SignerData struct {
|
||||
// info.
|
||||
Sequence uint64
|
||||
|
||||
// SignerIndex index of signer in the signer_infos array
|
||||
// SignerIndex index of signer in the signer_infos array.
|
||||
SignerIndex int
|
||||
}
|
||||
|
||||
@ -49,9 +49,11 @@ func TestVerifySignature(t *testing.T) {
|
||||
msgs := []sdk.Msg{testdata.NewTestMsg(addr)}
|
||||
fee := legacytx.NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)})
|
||||
signerData := signing.SignerData{
|
||||
Address: addr.String(),
|
||||
ChainID: chainId,
|
||||
AccountNumber: acc.GetAccountNumber(),
|
||||
Sequence: acc.GetSequence(),
|
||||
SignerIndex: 0,
|
||||
}
|
||||
signBytes := legacytx.StdSignBytes(signerData.ChainID, signerData.AccountNumber, signerData.Sequence, 10, fee, msgs, memo)
|
||||
signature, err := priv.Sign(signBytes)
|
||||
|
||||
@ -127,9 +127,11 @@ func (s *TxConfigTestSuite) TestTxBuilderSetSignatures() {
|
||||
|
||||
// sign transaction
|
||||
signerData := signing.SignerData{
|
||||
Address: addr.String(),
|
||||
ChainID: "test",
|
||||
AccountNumber: 1,
|
||||
Sequence: seq1,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
signBytes, err := signModeHandler.GetSignBytes(signModeHandler.DefaultMode(), signerData, sigTx)
|
||||
s.Require().NoError(err)
|
||||
@ -137,9 +139,11 @@ func (s *TxConfigTestSuite) TestTxBuilderSetSignatures() {
|
||||
s.Require().NoError(err)
|
||||
|
||||
signerData = signing.SignerData{
|
||||
Address: msigAddr.String(),
|
||||
ChainID: "test",
|
||||
AccountNumber: 3,
|
||||
Sequence: mseq,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
mSignBytes, err := signModeHandler.GetSignBytes(signModeHandler.DefaultMode(), signerData, sigTx)
|
||||
s.Require().NoError(err)
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
package tx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
)
|
||||
|
||||
var _ signing.SignModeHandler = signModeAminoAuxHandler{}
|
||||
|
||||
// signModeAminoAuxHandler defines the SIGN_MODE_AMINO_AUX SignModeHandler
|
||||
type signModeAminoAuxHandler struct{}
|
||||
|
||||
// DefaultMode implements SignModeHandler.DefaultMode
|
||||
func (signModeAminoAuxHandler) DefaultMode() signingtypes.SignMode {
|
||||
return signingtypes.SignMode_SIGN_MODE_AMINO_AUX
|
||||
}
|
||||
|
||||
// Modes implements SignModeHandler.Modes
|
||||
func (signModeAminoAuxHandler) Modes() []signingtypes.SignMode {
|
||||
return []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_AMINO_AUX}
|
||||
}
|
||||
|
||||
// GetSignBytes implements SignModeHandler.GetSignBytes
|
||||
func (signModeAminoAuxHandler) GetSignBytes(
|
||||
mode signingtypes.SignMode, data signing.SignerData, tx sdk.Tx,
|
||||
) ([]byte, error) {
|
||||
|
||||
if mode != signingtypes.SignMode_SIGN_MODE_AMINO_AUX {
|
||||
return nil, fmt.Errorf("expected %s, got %s", signingtypes.SignMode_SIGN_MODE_AMINO_AUX, mode)
|
||||
}
|
||||
|
||||
protoTx, ok := tx.(*wrapper)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("can only handle a protobuf Tx, got %T", tx)
|
||||
}
|
||||
|
||||
if protoTx.txBodyHasUnknownNonCriticals {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, aminoNonCriticalFieldsError)
|
||||
}
|
||||
|
||||
body := protoTx.tx.Body
|
||||
|
||||
if len(body.ExtensionOptions) != 0 || len(body.NonCriticalExtensionOptions) != 0 {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "SIGN_MODE_AMINO_AUX does not support protobuf extension options.")
|
||||
}
|
||||
|
||||
return legacytx.StdSignAuxBytes(
|
||||
data.ChainID, data.AccountNumber, data.Sequence, protoTx.GetTimeoutHeight(),
|
||||
protoTx.tx.AuthInfo.Tip.Amount, tx.GetMsgs(), protoTx.GetMemo(),
|
||||
), nil
|
||||
}
|
||||
@ -1,141 +0,0 @@
|
||||
package tx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
)
|
||||
|
||||
func TestAminoAuxHandler(t *testing.T) {
|
||||
privKey, pubkey, addr := testdata.KeyTestPubAddr()
|
||||
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
||||
interfaceRegistry.RegisterImplementations((*sdk.Msg)(nil), &testdata.TestMsg{})
|
||||
marshaler := codec.NewProtoCodec(interfaceRegistry)
|
||||
|
||||
txConfig := NewTxConfig(marshaler, []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_AMINO_AUX})
|
||||
txBuilder := txConfig.NewTxBuilder()
|
||||
|
||||
accountNumber := uint64(1)
|
||||
chainId := "test-chain"
|
||||
memo := "sometestmemo"
|
||||
msgs := []sdk.Msg{testdata.NewTestMsg(addr)}
|
||||
accSeq := uint64(2) // Arbitrary account sequence
|
||||
timeout := uint64(10)
|
||||
fee := txtypes.Fee{Amount: sdk.NewCoins(sdk.NewInt64Coin("atom", 150)), GasLimit: 20000}
|
||||
tip := sdk.NewCoins(sdk.NewCoin("regen", sdk.NewInt(1000)))
|
||||
|
||||
err := txBuilder.SetMsgs(msgs...)
|
||||
require.NoError(t, err)
|
||||
txBuilder.SetMemo(memo)
|
||||
txBuilder.SetFeeAmount(fee.Amount)
|
||||
txBuilder.SetGasLimit(fee.GasLimit)
|
||||
txBuilder.SetTimeoutHeight(timeout)
|
||||
txBuilder.SetTip(&txtypes.Tip{
|
||||
Amount: tip,
|
||||
Tipper: addr.String(), // Not needed when signing using AMINO_AUX, but putting here for clarity.
|
||||
})
|
||||
|
||||
sigData := &signingtypes.SingleSignatureData{
|
||||
SignMode: signingtypes.SignMode_SIGN_MODE_AMINO_AUX,
|
||||
}
|
||||
|
||||
sig := signingtypes.SignatureV2{
|
||||
PubKey: pubkey,
|
||||
Data: sigData,
|
||||
Sequence: accSeq,
|
||||
}
|
||||
err = txBuilder.SetSignatures(sig)
|
||||
require.NoError(t, err)
|
||||
|
||||
signingData := signing.SignerData{
|
||||
ChainID: chainId,
|
||||
AccountNumber: accountNumber,
|
||||
Sequence: accSeq,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
|
||||
handler := signModeAminoAuxHandler{}
|
||||
signBytes, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_AMINO_AUX, signingData, txBuilder.GetTx())
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, signBytes)
|
||||
|
||||
expectedSignBytes := legacytx.StdSignAuxBytes(chainId, accountNumber, accSeq, timeout, tip, msgs, memo)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedSignBytes, signBytes)
|
||||
|
||||
t.Log("verify that setting signature doesn't change sign bytes")
|
||||
sigData.Signature, err = privKey.Sign(signBytes)
|
||||
require.NoError(t, err)
|
||||
err = txBuilder.SetSignatures(sig)
|
||||
require.NoError(t, err)
|
||||
signBytes, err = handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_AMINO_AUX, signingData, txBuilder.GetTx())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedSignBytes, signBytes)
|
||||
|
||||
// expect error with wrong sign mode
|
||||
_, err = handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_DIRECT, signingData, txBuilder.GetTx())
|
||||
require.Error(t, err)
|
||||
|
||||
// expect error with extension options
|
||||
bldr := newBuilder()
|
||||
buildTx(t, bldr)
|
||||
any, err := codectypes.NewAnyWithValue(testdata.NewTestMsg())
|
||||
require.NoError(t, err)
|
||||
bldr.tx.Body.ExtensionOptions = []*codectypes.Any{any}
|
||||
tx := bldr.GetTx()
|
||||
_, err = handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_AMINO_AUX, signingData, tx)
|
||||
require.Error(t, err)
|
||||
|
||||
// expect error with non-critical extension options
|
||||
bldr = newBuilder()
|
||||
buildTx(t, bldr)
|
||||
bldr.tx.Body.NonCriticalExtensionOptions = []*codectypes.Any{any}
|
||||
tx = bldr.GetTx()
|
||||
_, err = handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_AMINO_AUX, signingData, tx)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestAminoAuxHandler_DefaultMode(t *testing.T) {
|
||||
handler := signModeAminoAuxHandler{}
|
||||
require.Equal(t, signingtypes.SignMode_SIGN_MODE_AMINO_AUX, handler.DefaultMode())
|
||||
}
|
||||
|
||||
func TestAminoAuxModeHandler_nonDIRECT_MODE(t *testing.T) {
|
||||
invalidModes := []signingtypes.SignMode{
|
||||
signingtypes.SignMode_SIGN_MODE_DIRECT,
|
||||
signingtypes.SignMode_SIGN_MODE_TEXTUAL,
|
||||
signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON,
|
||||
signingtypes.SignMode_SIGN_MODE_UNSPECIFIED,
|
||||
signingtypes.SignMode_SIGN_MODE_DIRECT_AUX,
|
||||
}
|
||||
for _, invalidMode := range invalidModes {
|
||||
t.Run(invalidMode.String(), func(t *testing.T) {
|
||||
var dh signModeAminoAuxHandler
|
||||
var signingData signing.SignerData
|
||||
_, err := dh.GetSignBytes(invalidMode, signingData, nil)
|
||||
require.Error(t, err)
|
||||
wantErr := fmt.Errorf("expected %s, got %s", signingtypes.SignMode_SIGN_MODE_AMINO_AUX, invalidMode)
|
||||
require.Equal(t, err, wantErr)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAminoAuxModeHandler_nonProtoTx(t *testing.T) {
|
||||
var ah signModeAminoAuxHandler
|
||||
var signingData signing.SignerData
|
||||
tx := new(nonProtoTx)
|
||||
_, err := ah.GetSignBytes(signingtypes.SignMode_SIGN_MODE_AMINO_AUX, signingData, tx)
|
||||
require.Error(t, err)
|
||||
wantErr := fmt.Errorf("can only handle a protobuf Tx, got %T", tx)
|
||||
require.Equal(t, err, wantErr)
|
||||
}
|
||||
@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
types "github.com/cosmos/cosmos-sdk/types/tx"
|
||||
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
)
|
||||
|
||||
@ -39,6 +39,11 @@ func (signModeDirectAuxHandler) GetSignBytes(
|
||||
return nil, fmt.Errorf("can only handle a protobuf Tx, got %T", tx)
|
||||
}
|
||||
|
||||
signerInfo := protoTx.tx.AuthInfo.SignerInfos[data.SignerIndex]
|
||||
if signerInfo == nil || signerInfo.PublicKey == nil {
|
||||
return nil, sdkerrors.ErrInvalidRequest.Wrapf("got empty pubkey for signer #%d in %s handler", data.SignerIndex, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX)
|
||||
}
|
||||
|
||||
signDocDirectAux := types.SignDocDirectAux{
|
||||
BodyBytes: protoTx.getBodyBytes(),
|
||||
ChainId: data.ChainID,
|
||||
|
||||
@ -53,8 +53,10 @@ func TestDirectAuxHandler(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
signingData := signing.SignerData{
|
||||
Address: addr.String(),
|
||||
ChainID: "test-chain",
|
||||
AccountNumber: 1,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
|
||||
modeHandler := signModeDirectAuxHandler{}
|
||||
|
||||
@ -69,8 +69,10 @@ func TestDirectModeHandler(t *testing.T) {
|
||||
require.Len(t, modeHandler.Modes(), 1)
|
||||
|
||||
signingData := signing.SignerData{
|
||||
Address: addr.String(),
|
||||
ChainID: "test-chain",
|
||||
AccountNumber: 1,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
|
||||
signBytes, err := modeHandler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_DIRECT, signingData, txBuilder.GetTx())
|
||||
|
||||
@ -43,7 +43,7 @@ func (s signModeLegacyAminoJSONHandler) GetSignBytes(mode signingtypes.SignMode,
|
||||
body := protoTx.tx.Body
|
||||
|
||||
if len(body.ExtensionOptions) != 0 || len(body.NonCriticalExtensionOptions) != 0 {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "SIGN_MODE_LEGACY_AMINO_JSON does not support protobuf extension options.")
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "%s does not support protobuf extension options", signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
|
||||
}
|
||||
|
||||
return legacytx.StdSignBytes(
|
||||
|
||||
@ -45,9 +45,11 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
|
||||
|
||||
handler := signModeLegacyAminoJSONHandler{}
|
||||
signingData := signing.SignerData{
|
||||
Address: addr1.String(),
|
||||
ChainID: chainId,
|
||||
AccountNumber: accNum,
|
||||
Sequence: seqNum,
|
||||
SignerIndex: 0,
|
||||
}
|
||||
signBz, err := handler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, signingData, tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -11,10 +11,11 @@ import (
|
||||
var DefaultSignModes = []signingtypes.SignMode{
|
||||
signingtypes.SignMode_SIGN_MODE_DIRECT,
|
||||
signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON,
|
||||
signingtypes.SignMode_SIGN_MODE_DIRECT_AUX,
|
||||
}
|
||||
|
||||
// makeSignModeHandler returns the default protobuf SignModeHandler supporting
|
||||
// SIGN_MODE_DIRECT and SIGN_MODE_LEGACY_AMINO_JSON.
|
||||
// SIGN_MODE_DIRECT, SIGN_MODE_DIRECT_AUX and SIGN_MODE_LEGACY_AMINO_JSON.
|
||||
func makeSignModeHandler(modes []signingtypes.SignMode) signing.SignModeHandler {
|
||||
if len(modes) < 1 {
|
||||
panic(fmt.Errorf("no sign modes enabled"))
|
||||
@ -30,8 +31,6 @@ func makeSignModeHandler(modes []signingtypes.SignMode) signing.SignModeHandler
|
||||
handlers[i] = signModeLegacyAminoJSONHandler{}
|
||||
case signingtypes.SignMode_SIGN_MODE_DIRECT_AUX:
|
||||
handlers[i] = signModeDirectAuxHandler{}
|
||||
case signingtypes.SignMode_SIGN_MODE_AMINO_AUX:
|
||||
handlers[i] = signModeAminoAuxHandler{}
|
||||
default:
|
||||
panic(fmt.Errorf("unsupported sign mode %+v", mode))
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ func (m *QueryGrantsResponse) GetPagination() *query.PageResponse {
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryGranterGrantsRequest is the request type for the Query/Grants RPC method.
|
||||
// QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method.
|
||||
type QueryGranterGrantsRequest struct {
|
||||
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
|
||||
// pagination defines an pagination for the request.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user