Skip to content

Commit

Permalink
revert: Revert SIGN_MODE_DIRECT_JSON proto files (cosmos#10305)
Browse files Browse the repository at this point in the history
<!--
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

Closes: cosmos#10252 

<!-- 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)
  • Loading branch information
likhita-809 authored Oct 5, 2021
1 parent fb78bbf commit 0b6f3b9
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 622 deletions.
28 changes: 2 additions & 26 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@
- [ModeInfo.Single](#cosmos.tx.v1beta1.ModeInfo.Single)
- [SignDoc](#cosmos.tx.v1beta1.SignDoc)
- [SignDocDirectAux](#cosmos.tx.v1beta1.SignDocDirectAux)
- [SignDocJSON](#cosmos.tx.v1beta1.SignDocJSON)
- [SignerInfo](#cosmos.tx.v1beta1.SignerInfo)
- [Tip](#cosmos.tx.v1beta1.Tip)
- [Tx](#cosmos.tx.v1beta1.Tx)
Expand Down Expand Up @@ -9365,9 +9364,8 @@ SignMode represents a signing mode with its own security guarantees.
| SIGN_MODE_UNSPECIFIED | 0 | SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be rejected. |
| 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_JSON | 3 | SIGN_MODE_DIRECT_JSON specifies a signing mode which uses SignDocJSON. It is verified using a canonical JSON representation of the bytes used in SIGN_MODE_DIRECT. It is currently not supported. |
| SIGN_MODE_DIRECT_AUX | 4 | 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 | 5 | SIGN_MODE_AMINO_AUX specifies a signing mode which uses SignDocAminoAux. |
| 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. |


Expand Down Expand Up @@ -9512,28 +9510,6 @@ SIGN_MODE_DIRECT_AUX.



<a name="cosmos.tx.v1beta1.SignDocJSON"></a>

### SignDocJSON
SignDocJSON is the type used for generating sign bytes for
SIGN_MODE_DIRECT_JSON. It is designed to be serialized as proto3 JSON
following the rules defined here:
https://github.com/regen-network/canonical-proto3/blob/master/README.md#json.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `body` | [TxBody](#cosmos.tx.v1beta1.TxBody) | | body is the processable content of the transaction |
| `auth_info` | [AuthInfo](#cosmos.tx.v1beta1.AuthInfo) | | auth_info is the authorization related content of the transaction, specifically signers, signer modes and fee |
| `chain_id` | [string](#string) | | chain_id is the identifier of the chain this transaction targets. It prevents signed transactions from being used on another chain by an attacker |
| `account_number` | [uint64](#uint64) | | account_number is the account number of the signing account in state |
| `sign_doc_sha256_hash` | [bytes](#bytes) | | sign_doc_sha256_hash is the SHA-256 hash of SignDoc. It is included here to reduce the malleability attack surface of SIGN_MODE_DIRECT_JSON vs SIGN_MODE_DIRECT to zero. Basically this means that any discrepancy between protobuf bytes over the wire and protobuf bytes that are signed cannot be exploited. This information is obviously redundant with information already in SignDocJSON, but is included as a security check for scenarios where this information may have inadvertently been excluded. We include the hash of SignDoc rather than the full SignDoc bytes to reduce the size of SignDocJSON for scenarios where large payloads could cause problems for hardware wallets. |






<a name="cosmos.tx.v1beta1.SignerInfo"></a>

### SignerInfo
Expand Down
9 changes: 2 additions & 7 deletions proto/cosmos/tx/signing/v1beta1/signing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ enum SignMode {
// from SIGN_MODE_DIRECT. It is currently not supported.
SIGN_MODE_TEXTUAL = 2;

// SIGN_MODE_DIRECT_JSON specifies a signing mode which uses SignDocJSON. It
// is verified using a canonical JSON representation of the bytes used in
// SIGN_MODE_DIRECT. It is currently not supported.
SIGN_MODE_DIRECT_JSON = 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_DIRECT_AUX = 4;
SIGN_MODE_DIRECT_AUX = 3;

// SIGN_MODE_AMINO_AUX specifies a signing mode which uses
// SignDocAminoAux.
SIGN_MODE_AMINO_AUX = 5;
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.
Expand Down
33 changes: 0 additions & 33 deletions proto/cosmos/tx/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,6 @@ message SignDoc {
uint64 account_number = 4;
}

// SignDocJSON is the type used for generating sign bytes for
// SIGN_MODE_DIRECT_JSON. It is designed to be serialized as proto3 JSON
// following the rules defined here:
// https://github.com/regen-network/canonical-proto3/blob/master/README.md#json.
message SignDocJSON {
// body is the processable content of the transaction
TxBody body = 1;

// auth_info is the authorization related content of the transaction,
// specifically signers, signer modes and fee
AuthInfo auth_info = 2;

// chain_id is the identifier of the chain this transaction targets.
// It prevents signed transactions from being used on another chain by an
// attacker
string chain_id = 3;

// account_number is the account number of the signing account in state
uint64 account_number = 4;

// sign_doc_sha256_hash is the SHA-256 hash of SignDoc. It is included here to
// reduce the malleability attack surface of SIGN_MODE_DIRECT_JSON vs
// SIGN_MODE_DIRECT to zero. Basically this means that any discrepancy between
// protobuf bytes over the wire and protobuf bytes that are signed cannot be
// exploited. This information is obviously redundant with information already
// in SignDocJSON, but is included as a security check for scenarios where
// this information may have inadvertently been excluded. We include the hash
// of SignDoc rather than the full SignDoc bytes to reduce the size of
// SignDocJSON for scenarios where large payloads could cause problems for
// hardware wallets.
bytes sign_doc_sha256_hash = 5;
}

// SignDocDirectAux is the type used for generating sign bytes for
// SIGN_MODE_DIRECT_AUX.
message SignDocDirectAux {
Expand Down
92 changes: 43 additions & 49 deletions types/tx/signing/signing.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b6f3b9

Please sign in to comment.