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

Prefer sending tx_bytes to Simulate gRPC endpoint #8926

Merged
merged 29 commits into from
Mar 25, 2021

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Mar 18, 2021

Description

closes: #8425
closes: #7726

This PR does 2 things, both around tx simulation:

  1. deprecate the tx field on SimulateRequest, prefer tx_bytes.
    • it's more consistent with the Broadcast gRPC endpoint, which also accepts tx_bytes
    • the old tx field has not been removed, as to not introduce any proto-breaking change
    • but if the old tx field is used, then there might be sig verification errors, as described in adr-020
  2. refactor CalculateGas to use the tx service gRPC query client (instead of hardcoding the path)

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@amaury1093 amaury1093 added the C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. label Mar 18, 2021
@orijbot
Copy link

orijbot commented Mar 18, 2021

@orijbot
Copy link

orijbot commented Mar 18, 2021

@orijbot
Copy link

orijbot commented Mar 18, 2021

@orijbot
Copy link

orijbot commented Mar 18, 2021

//
// TODO:/XXX: Using a package-level global isn't ideal and we should consider
// refactoring the module manager to allow passing in the correct module codec.
var Codec codec.Marshaler
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dead code

@orijbot
Copy link

orijbot commented Mar 18, 2021

@orijbot
Copy link

orijbot commented Mar 18, 2021

@amaury1093 amaury1093 marked this pull request as ready for review March 19, 2021 09:34
@orijbot
Copy link

orijbot commented Mar 19, 2021

@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #8926 (6412b30) into master (8ee9da7) will increase coverage by 0.00%.
The diff coverage is 52.00%.

❗ Current head 6412b30 differs from pull request most recent head 375b439. Consider uploading reports for the commit 375b439 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8926   +/-   ##
=======================================
  Coverage   58.88%   58.88%           
=======================================
  Files         571      571           
  Lines       32120    32111    -9     
=======================================
- Hits        18914    18910    -4     
+ Misses      10984    10981    -3     
+ Partials     2222     2220    -2     
Impacted Files Coverage Δ
simapp/simd/cmd/root.go 61.47% <ø> (-0.32%) ⬇️
x/auth/client/tx.go 39.28% <ø> (ø)
x/auth/tx/builder.go 74.24% <ø> (ø)
client/tx/tx.go 29.62% <43.75%> (+0.53%) ⬆️
x/auth/tx/service.go 73.61% <66.66%> (+0.75%) ⬆️
x/bank/keeper/send.go 83.62% <0.00%> (-0.87%) ⬇️
types/int.go 72.53% <0.00%> (-0.39%) ⬇️
x/bank/keeper/keeper.go 72.91% <0.00%> (-0.28%) ⬇️
simapp/test_helpers.go 0.49% <0.00%> (+<0.01%) ⬆️

Copy link
Contributor

@blushi blushi left a comment

Choose a reason for hiding this comment

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

It seems like a test is failing (related to sig verification, in the test that still uses Tx).
Should this also close #7726?

x/auth/tx/service.go Outdated Show resolved Hide resolved
x/auth/tx/service_test.go Outdated Show resolved Hide resolved
amaury1093 and others added 2 commits March 22, 2021 12:56
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Copy link
Contributor

@technicallyty technicallyty left a comment

Choose a reason for hiding this comment

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

lgtm, just one snippet to remove from a merge conflict

CHANGELOG.md Outdated Show resolved Hide resolved
@fdymylja fdymylja self-requested a review March 24, 2021 11:05
Copy link
Contributor

@fdymylja fdymylja left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

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

Good one. ACK from me.

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Mar 24, 2021
@orijbot
Copy link

orijbot commented Mar 24, 2021

@orijbot
Copy link

orijbot commented Mar 24, 2021

@orijbot
Copy link

orijbot commented Mar 24, 2021

@orijbot
Copy link

orijbot commented Mar 25, 2021

@orijbot
Copy link

orijbot commented Mar 25, 2021

@mergify mergify bot merged commit 1fa2c22 into master Mar 25, 2021
@mergify mergify bot deleted the am/8425-fix-simulation branch March 25, 2021 10:52
@orijbot
Copy link

orijbot commented Mar 25, 2021

@orijbot
Copy link

orijbot commented Mar 25, 2021

"errors"
"fmt"
"net/http"
"os"

gogogrpc "github.com/gogo/protobuf/grpc"
Copy link
Collaborator

Choose a reason for hiding this comment

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

typealias is not needed.

func WriteGeneratedTxResponse(
ctx client.Context, w http.ResponseWriter, br rest.BaseReq, msgs ...sdk.Msg,
clientCtx client.Context, w http.ResponseWriter, br rest.BaseReq, msgs ...sdk.Msg,
Copy link
Collaborator

Choose a reason for hiding this comment

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

usually we don't need to repeat a typename in the variable name.

larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
* First run

* Remove dead code

* Make test pass

* Proto gen

* Fix lint

* Add changelog

* Fix tests

* Fix test

* Update x/auth/tx/service.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* Remove protoTxProvider

* Add grpc-gateway test

* Add comment

* move to api breaking

* lesser diff

* remove conflict

* empty commit to rerun CI

* empty commit to rerun CI

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.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. C: gRPC Issues and PRs related to the gRPC service and HTTP gateway.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid simulation query on v0.40.1 Refactor CalculateGas to use proto-generated service client
8 participants