-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Migrate {x/auth, x/gov, x/staking} missing CLI queries to proto #6994
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6994 +/- ##
==========================================
- Coverage 55.17% 55.15% -0.03%
==========================================
Files 584 584
Lines 40538 40504 -34
==========================================
- Hits 22367 22340 -27
+ Misses 16301 16290 -11
- Partials 1870 1874 +4 |
Blocked on #7067, will update once I add tests. |
…k into sahith/update-query-cli
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested and not working.
- create a network (
$ make clean localnet-start
) - send a tx
- query for that tx by events
$ simd q txs --events="message.sender=cosmos13dtdcpyv0z2tda9vcv6e8unamkkah3zhxyafn8"
Error: cannot protobuf JSON encode unsupported type: *types.SearchTxsResult
Usage:
simd query txs [flags]
Flags:
--events string list of transaction events in the form of {eventType}.{eventAttribute}={value}
-h, --help help for txs
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
--limit int Query number of transactions results per page returned (default 30)
-n, --node string Node to connect to (default "tcp://localhost:26657")
--page int Query a specific page of paginated results (default 1)
Global Flags:
--chain-id string The network chain ID
--home string directory for config and data (default "/Users/aleksbez/.simapp")
--trace print out full stack trace on errors
Also, querying by hash fails too:
|
Migrated |
…k into sahith/update-query-cli
any, ok := txBuilder.(codectypes.IntoAny) | ||
s.Require().True(ok) | ||
cached := any.AsAny().GetCachedValue() | ||
txTx, ok := cached.(*txtypes.Tx) | ||
s.Require().True(ok) | ||
res, err := s.queryClient.Simulate( | ||
context.Background(), | ||
&simulate.SimulateRequest{Tx: txBuilder.GetProtoTx()}, | ||
&simulate.SimulateRequest{Tx: txTx}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetProtoTx()
is a little bit more verbose, but at least it makes sense in the StdTx case too.
var _, _ codectypes.UnpackInterfacesMessage = &Tx{}, &TxBody{} | ||
var _ sdk.Tx = &Tx{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove WrapTx now that tx.Tx implements sdk.Tx.
However, in this PR, I just modified the minimal code on Tx to make it work. For clarity, I propose to leave it to another PR (I can do it) to remove WrapTx, and also add GetGas on tx.Tx to make simulation work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think some of the tx indirection between types can get a bit confusing.
Also, all the tx wrapper stuff is being removed, correct?
@@ -50,7 +50,7 @@ func (any *Any) UnmarshalAmino(bz []byte) error { | |||
return nil | |||
} | |||
|
|||
func (any Any) MarshalJSON() ([]byte, error) { | |||
func (any *Any) MarshalJSON() ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a pointer reference when marshaling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Any, any.compat
(just below) is nil
. Using *Any, any.compat
is correct. I'm not 100% I understand why; it's set on this line btw.
I didn't dig too much into it, but anyways, without the reference, tests fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amaurymartiny , this could be some weird concurrency issue.
If you use Any
then a method receiver works on an object copy. Sometimes it's a source of errors in methods which modifies the object. Here all methods which modifies the object are using pointer receivers. So that's why my guess is that tests are doing something weird in parallel.
var _, _ codectypes.UnpackInterfacesMessage = &Tx{}, &TxBody{} | ||
var _ sdk.Tx = &Tx{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worked a bit on this PR, so approving.
Description
This PR updates queries using QueryByTxs to use proto.
Also:
tx.Tx
(the proto Message) now implements sdk.Txref: #6987
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.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes