Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: EIP191 sign mode #11533

Merged
merged 8 commits into from Apr 5, 2022
Merged

feat: EIP191 sign mode #11533

merged 8 commits into from Apr 5, 2022

Conversation

fedekunze
Copy link
Collaborator

@fedekunze fedekunze commented Apr 4, 2022

Description

Adds EIP-191 as a supported sign mode.

Ref: #10553 (comment)


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 in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • 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 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)

@github-actions github-actions bot added C:CLI C:x/auth C:x/distribution distribution module related labels Apr 4, 2022
@fedekunze fedekunze marked this pull request as ready for review April 4, 2022 11:33
@fedekunze fedekunze added backport/0.45.x backport/0.46.x PR scheduled for inclusion in the v0.46's next stable release labels Apr 4, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love to see some docs on this, in a follow-up!

x/auth/tx/config.go Outdated Show resolved Hide resolved
proto/cosmos/tx/signing/v1beta1/signing.proto Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor

Let's also wait for Aaron's approval

@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #11533 (0b971b5) into master (44a1293) will decrease coverage by 1.05%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11533      +/-   ##
==========================================
- Coverage   66.09%   65.03%   -1.06%     
==========================================
  Files         715      679      -36     
  Lines       72876    70814    -2062     
==========================================
- Hits        48165    46052    -2113     
- Misses      21762    22091     +329     
+ Partials     2949     2671     -278     
Impacted Files Coverage Δ
client/cmd.go 55.67% <ø> (ø)
client/flags/flags.go 20.68% <ø> (ø)
client/tx/factory.go 25.86% <0.00%> (-0.23%) ⬇️
x/bank/types/send_authorization.go 55.55% <0.00%> (ø)
x/group/client/cli/tx.go 0.00% <0.00%> (ø)
x/group/client/cli/util.go 6.97% <40.00%> (ø)
crypto/keyring/keyring.go 62.39% <50.00%> (ø)
x/auth/tx/config.go 89.65% <100.00%> (+0.76%) ⬆️
x/authz/client/testutil/tx.go 98.25% <100.00%> (+0.02%) ⬆️
x/staking/types/authz.go 87.37% <100.00%> (+0.37%) ⬆️
... and 47 more

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine.

@amaury1093 amaury1093 self-assigned this Apr 4, 2022
@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Apr 5, 2022
@amaury1093
Copy link
Contributor

Got an offline ack from Aaron, I just added some proto comments to clarify. Thanks @fedekunze for this PR!

@mergify mergify bot merged commit dc66ddd into master Apr 5, 2022
@mergify mergify bot deleted the fedekunze/eip191 branch April 5, 2022 08:44
mergify bot pushed a commit that referenced this pull request Apr 5, 2022
## Description

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: #10553 (comment)

---

### 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
- [x] 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)

(cherry picked from commit dc66ddd)

# Conflicts:
#	CHANGELOG.md
#	go.sum
mergify bot pushed a commit that referenced this pull request Apr 5, 2022
## Description

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: #10553 (comment)

---

### 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
- [x] 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)

(cherry picked from commit dc66ddd)

# Conflicts:
#	CHANGELOG.md
#	api/cosmos/distribution/v1beta1/tx.pulsar.go
#	api/cosmos/tx/signing/v1beta1/signing.pulsar.go
#	client/cmd.go
#	client/flags/flags.go
#	client/tx/factory.go
#	go.sum
#	types/tx/signing/signing.pb.go
#	x/distribution/types/tx.pb.go
amaury1093 pushed a commit that referenced this pull request Apr 5, 2022
* feat: EIP191 sign mode (#11533)

## Description

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: #10553 (comment)

---

### 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
- [x] 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)

(cherry picked from commit dc66ddd)

# Conflicts:
#	CHANGELOG.md
#	api/cosmos/distribution/v1beta1/tx.pulsar.go
#	api/cosmos/tx/signing/v1beta1/signing.pulsar.go
#	client/cmd.go
#	client/flags/flags.go
#	client/tx/factory.go
#	go.sum
#	types/tx/signing/signing.pb.go
#	x/distribution/types/tx.pb.go

* fix conflicts

* fix conflicts++

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
@sunnya97
Copy link
Member

sunnya97 commented Apr 8, 2022

I don't think this should be called simply Sign Mode "EIP191". EIP 191 simply refers to a method of encoding a string data to be signed.

However, the Sign Mode concept in Cosmos SDK also refers to how to encode a tx into a string in the first place.

For this reason, in the osmosis-labs version of this, we specifically call this "EIP191LegacyJSON" to signal that it is the EIP191 re-encoded version of the Amino JSON string.

In the future, we will probably want more EIP191 sign modes, such as an EIP191Textual which wraps SignModeTextual.

I think any new sign modes should have an associated ADR for them. For example, in the case of EIP191LegacyJSON, we would also need to standardize how to format the amino json (such as adding new lines and indents) before putting it through the EIP191 conversion.

@amaury1093
Copy link
Contributor

Ah I wasn't aware of this. That's unfortunate, we just released this in v0.45.2. I don't think we'll be able to rename, but we can always deprecate and create new enum variants.

I think any new sign modes should have an associated ADR for them. For example, in the case of EIP191LegacyJSON, we would also need to standardize how to format the amino json (such as adding new lines and indents) before putting it through the EIP191 conversion.

Agreed. The current PR doesn't introduce EIP-191, just technically a new enum variant, and any chain can use it and put whatever sign mode handler they want in this enum.

The day we decide that the SDK should fully support a EIP191-based sign mode, we should definitely create an ADR, and define the payload format.

@alexanderbez
Copy link
Contributor

Let's be sure to create an issue for this @AmauryM

@amaury1093
Copy link
Contributor

Let's be sure to create an issue for this @AmauryM

@sunnya97 would you like to create this issue, and explain how osmosis is doing it currently?

@sunnya97 sunnya97 mentioned this pull request Apr 29, 2022
4 tasks
JimLarson pushed a commit to agoric-labs/cosmos-sdk that referenced this pull request Jul 7, 2022
* feat: EIP191 sign mode (cosmos#11533)

## Description

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: cosmos#10553 (comment)

---

### 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
- [x] 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)

(cherry picked from commit dc66ddd)

# Conflicts:
#	CHANGELOG.md
#	api/cosmos/distribution/v1beta1/tx.pulsar.go
#	api/cosmos/tx/signing/v1beta1/signing.pulsar.go
#	client/cmd.go
#	client/flags/flags.go
#	client/tx/factory.go
#	go.sum
#	types/tx/signing/signing.pb.go
#	x/distribution/types/tx.pb.go

* fix conflicts

* fix conflicts++

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
randy75828 pushed a commit to Switcheo/cosmos-sdk that referenced this pull request Aug 10, 2022
* feat: EIP191 sign mode (cosmos#11533)

## Description

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: cosmos#10553 (comment)

---

### 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
- [x] 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)

(cherry picked from commit dc66ddd)

# Conflicts:
#	CHANGELOG.md
#	api/cosmos/distribution/v1beta1/tx.pulsar.go
#	api/cosmos/tx/signing/v1beta1/signing.pulsar.go
#	client/cmd.go
#	client/flags/flags.go
#	client/tx/factory.go
#	go.sum
#	types/tx/signing/signing.pb.go
#	x/distribution/types/tx.pb.go

* fix conflicts

* fix conflicts++

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
randy75828 pushed a commit to Switcheo/cosmos-sdk that referenced this pull request Aug 10, 2022
* feat: EIP191 sign mode (cosmos#11533)

## Description

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: cosmos#10553 (comment)

---

### 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
- [x] 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)

(cherry picked from commit dc66ddd)

# Conflicts:
#	CHANGELOG.md
#	api/cosmos/distribution/v1beta1/tx.pulsar.go
#	api/cosmos/tx/signing/v1beta1/signing.pulsar.go
#	client/cmd.go
#	client/flags/flags.go
#	client/tx/factory.go
#	go.sum
#	types/tx/signing/signing.pb.go
#	x/distribution/types/tx.pb.go

* fix conflicts

* fix conflicts++

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Eengineer1 pushed a commit to cheqd/cosmos-sdk that referenced this pull request Aug 26, 2022
* feat: EIP191 sign mode (cosmos#11533)

Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode.

Ref: cosmos#10553 (comment)

---

*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
- [x] 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

*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)

(cherry picked from commit dc66ddd)

* fix conflicts

* fix conflicts++

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. backport/0.46.x PR scheduled for inclusion in the v0.46's next stable release C:CLI C:x/auth C:x/distribution distribution module related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants