Some RPCs fail on Granada Protocol
Environment (Mainnet, test network, build from source, ...)
Tezos sandbox (granabox) in docker (image: registry.gitlab.com/tezos/flextesa:master-run)
Summary
Hi! I have troubles interacting with some RPCs from Java application after Granada Protocol release. The problem is simillar to this issue - I am working on the same Java project.
So I have basically changed the command in Tezos docker from 'flobox start' to 'granabox start', and ran some tests in Java application.
When calling /chains/main/blocks/head/helpers/forge/operations the client was throwing the exception NoHttpResponseException.
I tried this rpc with curl and tezos-client, but no issues occurred.
Long story short, I figured out that the connection to Tezos node is somehow broken on these RPCs:
- /chains/main/blocks/head/helpers/forge/operations
- /chains/main/blocks/head/helpers/preapply/operations
- /injection/operation
- /chains/main/blocks/head/helpers/scripts/run_operation
When our RestTemplate is calling one of these RPCs, it is getting NoHttpResponseException. But on the second attempt (retry policy) the request passes ok. I assume that there are some issues with connection re-usage, since these RPCs are affected in Granada Protocol release.
Expected behavior
RPCs requests work
Actual behavior
RPCs requests fail on first try, passes on second
Steps to reproduce
Same as here.
I cannot share my java code, but basically our application is built on Spring Boot. Http requests are handled by RestTemplate, which is a standard library for REST client. We do not customize it much.
Instead, I can share curl command:
$ cat tezos-forge-post-body.json
{"branch":"BLwpfQXCi9C4CkJPUTaixCw4DQPVkZ6m1vmb13PCTxRqxsBiDkR","contents":[{"kind":"origination","source":"tz1aSEPhU8TqhuZhLiSpQMfRozcQHVRD1rJ8","fee":"2840","counter":"146661","gas_limit":"10600","storage_limit":"60000","balance":"0","script":{"code":[{"prim":"parameter","args":[{"prim":"or","args":[{"prim":"unit","annots":["%default"]},{"prim":"pair","args":[{"prim":"pair","args":[{"prim":"nat","annots":["%counter"]},{"prim":"or","args":[{"prim":"pair","args":[{"prim":"mutez","annots":["%amount"]},{"prim":"contract","args":[{"prim":"unit"}],"annots":["%dest"]}],"annots":[":transfer"]},{"prim":"or","args":[{"prim":"option","args":[{"prim":"key_hash"}],"annots":["%delegate"]},{"prim":"pair","args":[{"prim":"nat","annots":["%threshold"]},{"prim":"list","args":[{"prim":"key"}],"annots":["%keys"]}],"annots":["%change_keys"]}]}],"annots":[":action"]}],"annots":[":payload"]},{"prim":"list","args":[{"prim":"option","args":[{"prim":"signature"}]}],"annots":["%sigs"]}],"annots":["%main"]}]}]},{"prim":"storage","args":[{"prim":"pair","args":[{"prim":"nat","annots":["%stored_counter"]},{"prim":"pair","args":[{"prim":"nat","annots":["%threshold"]},{"prim":"list","args":[{"prim":"key"}],"annots":["%keys"]}]}]}]},{"prim":"code","args":[[[[{"prim":"DUP"},{"prim":"CAR"},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]],{"prim":"IF_LEFT","args":[[{"prim":"DROP"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"PAIR"}],[{"prim":"SWAP"},{"prim":"DUP"},{"prim":"DIP","args":[[{"prim":"SWAP"}]]},{"prim":"DIP","args":[[[[{"prim":"DUP"},{"prim":"CAR"},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]],{"prim":"DUP"},{"prim":"SELF"},{"prim":"ADDRESS"},{"prim":"CHAIN_ID"},{"prim":"PAIR"},{"prim":"PAIR"},{"prim":"PACK"},{"prim":"DIP","args":[[[[{"prim":"DUP"},{"prim":"CAR","annots":["@counter"]},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]],{"prim":"DIP","args":[[{"prim":"SWAP"}]]}]]},{"prim":"SWAP"}]]},[[{"prim":"DUP"},{"prim":"CAR","annots":["@stored_counter"]},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]],{"prim":"DIP","args":[[{"prim":"SWAP"}]]},[[{"prim":"COMPARE"},{"prim":"EQ"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"}]]]}],{"prim":"DIP","args":[[{"prim":"SWAP"}]]},[[{"prim":"DUP"},{"prim":"CAR","annots":["@threshold"]},{"prim":"DIP","args":[[{"prim":"CDR","annots":["@keys"]}]]}]],{"prim":"DIP","args":[[{"prim":"PUSH","args":[{"prim":"nat"},{"int":"0"}],"annots":["@valid"]},{"prim":"SWAP"},{"prim":"ITER","args":[[{"prim":"DIP","args":[[{"prim":"SWAP"}]]},{"prim":"SWAP"},{"prim":"IF_CONS","args":[[[{"prim":"IF_NONE","args":[[{"prim":"SWAP"},{"prim":"DROP"}],[{"prim":"SWAP"},{"prim":"DIP","args":[[{"prim":"SWAP"},{"prim":"DIP","args":[{"int":"2"},[[{"prim":"DIP","args":[[{"prim":"DUP"}]]},{"prim":"SWAP"}]]]},[[{"prim":"DIP","args":[{"int":"2"},[{"prim":"DUP"}]]},{"prim":"DIG","args":[{"int":"3"}]}],{"prim":"DIP","args":[[{"prim":"CHECK_SIGNATURE"}]]},{"prim":"SWAP"},{"prim":"IF","args":[[{"prim":"DROP"}],[{"prim":"FAILWITH"}]]}],{"prim":"PUSH","args":[{"prim":"nat"},{"int":"1"}]},{"prim":"ADD","annots":["@valid"]}]]}]]}]],[[{"prim":"UNIT"},{"prim":"FAILWITH"}]]]},{"prim":"SWAP"}]]}]]},[[{"prim":"COMPARE"},{"prim":"LE"}],{"prim":"IF","args":[[],[[{"prim":"UNIT"},{"prim":"FAILWITH"}]]]}],{"prim":"DROP"},{"prim":"DROP"},{"prim":"DIP","args":[[[[{"prim":"DUP"},{"prim":"CAR"},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]],{"prim":"PUSH","args":[{"prim":"nat"},{"int":"1"}]},{"prim":"ADD","annots":["@new_counter"]},{"prim":"PAIR"}]]},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"SWAP"},{"prim":"IF_LEFT","args":[[[[{"prim":"DUP"},{"prim":"CAR"},{"prim":"DIP","args":[[{"prim":"CDR"}]]}]],{"prim":"UNIT"},{"prim":"TRANSFER_TOKENS"},{"prim":"CONS"}],[{"prim":"IF_LEFT","args":[[{"prim":"SET_DELEGATE"},{"prim":"CONS"}],[{"prim":"DIP","args":[[{"prim":"SWAP"},{"prim":"CAR"}]]},{"prim":"SWAP"},{"prim":"PAIR"},{"prim":"SWAP"}]]}]]},{"prim":"PAIR"}]]}]]}],"storage":{"prim":"Pair","args":[{"int":"0"},{"prim":"Pair","args":[{"int":"2"},[{"string":"edpku5Ax6DT1UgtU8CcYhoEsvFPjzYLRCXpVouJGWLLia6upeZBEYq"},{"string":"edpku4oPk1uDgRKJG6q94pWwRvymGSyTk1jqGUyAaeRPFfNEZgXGB7"},{"string":"edpkuXLqzhPyctR8pXt8PqQCN5XBa4VvuUVXvnGGGmR8cXLHuzoCyw"}]]}]}}}]}
$ curl -vvv -H "Content-Type: application/json" -d @tezos-forge-post-body.json http://<masked>:18732/chains/main/blocks/head/helpers/forge/operations
The url command passes, but the same request from Java code fails on first attempt.
History
History mode
full by default