Closed askucher closed 4 years ago
Tried second time. Got This
Looks like transaction has been sent but balance isn't changed
Tried web3-cli
web3 transfer 0.1 to 0x72396557B87D26FDDEACb7088E993E4f54B13a34
ERROR: Cannot create transaction: cannot get nonce: invalid argument 1: pending queries not implemented
Hi @askucher, yes pending queries are not an option currently as Cosmos handles state transitions differently than Ethereum so the "pending" block is never built. I will look into this as I didn't realize these uses relied on pending state as they do, but unfortunately I won't be able to look into this in the very near future.
In certain other scenarios which uses pending queries (which really shouldn't be relied upon anyway) it has helped to just point the "pending" tag as you linked to point to the "latest" state. This would cause inconsistencies if it is trying to fetch the data from a transaction just sent, but may work as an interim workaround.
@austinabell I have changed pending
to latest
. Now I have another issue
I got the transaction hash but cannot see transaction included in block. So as result the balance isn't changed. Nothing happens.
I expect: validTxs: 1, got validTxs: 0
Now I am checking this https://github.com/ChainSafe/ethermint/blob/development/rpc/eth_api.go#L296 -> https://github.com/ChainSafe/ethermint/blob/development/rpc/apis.go#L6 -> https://github.com/cosmos/cosmos-sdk/blob/master/client/context/broadcast.go#L19
This point is connected to cosmos-sdk. As far as I know cosmos-sdk has a stable version. Maybe should we just find that version?
@austinabell I have changed
pending
tolatest
. Now I have another issueI got the transaction hash but cannot see transaction included in block. So as result the balance isn't changed. Nothing happens.
I expect: validTxs: 1, got validTxs: 0
Just so you know, if a transaction fails the ante check, it does not show up as either a valid or invalid transaction, you would have to change the logging configuration to see that output
This point is connected to cosmos-sdk. As far as I know cosmos-sdk has a stable version. Maybe should we just find that version?
Can't until the changes I PRed in gets included in a release. Right now it is using a version more recent than their latest release but I doubt that is your issue. I can look into this use case speciically at a later time but make sure the transaction that is being sent is valid and should pass the ante check (my guess is maybe the sender address that is being defaulted to has insuficient funds)
@askucher iirc from followup discussion with @Kubemake, you didn't changed coin name, id and derivation path when dealing with the Ethermint's fork in question._
However we found a bigger, and possibly related blocking issue in recent test:
Apparently a transaction from/to address could be happening only once per node process lifetime, further TXs don't get included into any block up until restart, reporting all sorts of invalid nonce errors (4 required, 3 present - followed by 4 required, 3 present).
Also it gets reflected in getTransactionCount showing, for example, 10 after nofde start, then after first TX per process lifetime is committed,value goes to 9 and stays. (Sending TXs with adjusted nonce doesn't helps either)
Our current guesses are its either a mempool's replay protection kicking in on broadcasts, field indexing issue, but it could be also related to 157 "Ask a question about checking nonce in func ethAnteHandler".
Dec 25 20:11:07 COINcoin-node-1 p2p/p2p_1/22e5ddeeddaf[13700]: I[2019-12-25|19:11:07.114] Rejected bad transaction module=mempool tx=26B677DBC1D1C9A5E005C7EE6E32203D7474B3C07F8C9A2B8420540BAA82A362 peerID=186e48a3e2dafeb2725e281f96eaccd51549a0ad res="&{CheckTx:code:3 log:\"{\\"codespace\\":\\"sdk\\",\\"code\\":3,\\"message\\":\\"invalid nonce; got 3, expected 4\\"}\" gas_used:2594 }" err=null ... Dec 25 20:11:35 COINcoin-node-1 main/fulmain/74ed0e5ef66c[13700]: I[2019-12-25|19:11:35.793] HTTPJSONRPC module=rpc-server method=broadcast_tx_commit args="[<rpctypes.Context Value>
]" returns="[< core_types.ResultBroadcastTxCommit Value>]" Dec 25 20:11:35 COINcoin-node-1 main/fulmain/74ed0e5ef66c[13700]: I[2019-12-25|19:11:35.794] Served RPC HTTP response module=rpc-server method=POST url=/ status=200 duration=5 remoteAddr=- Dec 25 20:11:35 COINcoin-node-1 main/main_1/8aaa4b827569[13700]: {"codespace":"sdk","code":3,"message":"invalid nonce; got 4, expected 3"} Dec 25 20:11:35 COINcoin-node-1 main/main_1/8aaa4b827569[13700]: I[2019-12-25|19:11:35.796]
@austinabell any educated guess what could it possibly be?
@underthewaves Yeah, it's because I'm following the same logic as in Cosmos SDK which doesn't increment the nonce of the "pending" state in the ante handler. I'll look into testing this soon, and it may just be the one line fix, but I also would like the web3 API to be able to query this "pending" nonce as well. Sorry I didn't document this well and in its own issue.
Also it gets reflected in getTransactionCount showing, for example, 10 after nofde start, then after first TX per process lifetime is committed,value goes to 9 and stays. (Sending TXs with adjusted nonce doesn't helps either)
Also wrt this, I just tested this and nothing is wrong on my end (I stopped all processes and restarted multiple times before and after 10). I find it curious that it happens at 10 in your case, since that is when decimal and hex diverge. Make sure however you are using it that you are not just prefixing a decimal value with 0x. 0x10 is 16 which could cause an issue if that is the case
continue discussion about the transaction nonce defaults at #164 and pending state queries #156
Expected behavior: [What you expected to happen]
I expect to see sent token
Actual behavior: [What actually happened]
problem, you can see it above
Additional info: [Include gist of relevant config, logs, etc.]
maybe should start few nodes? but there is not any info