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

bug: Common GRPC InactiveRpcError on v0.21 chain #241

Open
Unique-Divine opened this issue Jul 7, 2023 · 0 comments
Open

bug: Common GRPC InactiveRpcError on v0.21 chain #241

Unique-Divine opened this issue Jul 7, 2023 · 0 comments
Labels
type: bug Something isn't working

Comments

@Unique-Divine
Copy link
Member

Unique-Divine commented Jul 7, 2023

Background

InactiveRpcError is the only hurdle to all passing tests for v0.21

image

Context

Line that causes the error in our code base:

   tx_resp: abci_type.TxResponse = self.execute_tx(
     tx, gas_estimate, tx_config=tx_config
   )
   tx_resp: dict[str, Any] = MessageToDict(tx_resp)
   tx_output = self.client.tx_by_hash(tx_hash=tx_resp["txhash"]) 

The simulation succeeds, and the GRPC call of execute_tx also succeeeds, giving us the tx_hash. Note however that the deprecation of broadcast mode BLOCK and migration to SYNC has removed the tx_response.code from the abci_pb2.TxResponse type.

As a result, we manually query the tx using its hash. This is raising an
inactive RPC error in the GRPC call.

Stack trace (example):

nibiru/tx.py:102: in execute_msgs
    tx_output = self.client.tx_by_hash(tx_hash=tx_resp["txhash"])
nibiru/grpc_client.py:379: in tx_by_hash
    proto_output: tx_service.GetTxResponse = self.stubTx.GetTx(req)
.venv/lib/python3.8/site-packages/grpc/_channel.py:1030: in __call__
    return _end_unary_response_blocking(state, call, False, None)

state = <grpc._channel._RPCState object at 0x7f2de4107220>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f2de41c0d00>
with_call = False, deadline = None

Code where the error is raised:

    def _end_unary_response_blocking(
        state: _RPCState, call: cygrpc.SegregatedCall, with_call: bool,
        deadline: Optional[float]
    ) -> Union[ResponseType, Tuple[ResponseType, grpc.Call]]:
        if state.code is grpc.StatusCode.OK:
            if with_call:
                rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
                return state.response, rendezvous
            else:
                return state.response
        else:
>           raise _InactiveRpcError(state)  # pytype: disable=not-instantiable
E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E           	status = StatusCode.NOT_FOUND
E           	details = "tx not found: 7D1A949BC0DA3B7FA69BA7FF82D2F29170316448C2013D2001B8276BBA5F807F"
E           	debug_error_string = "UNKNOWN:Error received from peer ipv4:127.0.0.1:9090 {grpc_message:"tx not found: 7D1A949BC0DA3B7FA69BA7FF82D2F29170316448C2013D2001B8276BBA5F807F", grpc_status:5, created_time:"2023-07-06T19:35:56.154371464-05:00"}"
E           >

.venv/lib/python3.8/site-packages/grpc/_channel.py:910: _InactiveRpcError
@Unique-Divine Unique-Divine added the type: bug Something isn't working label Jul 7, 2023
Unique-Divine added a commit that referenced this issue Jul 9, 2023
## Migration complete! (needs cleanup refactor)

- epic(tmrpc,tx): All passing tests for v0.21!
- feat(jsonrpc): impement JSON-RPC 2.0 as a subpackage of nibiru
- chore(deps): add type stubs for the requests and urllib pkgs
- Closes #228

## `jsonrpc`

The `nibiru.jsonrpc` package implements the official [JSON-RPC 2.0
spec](https://www.jsonrpc.org/specification) in Python with strict
strong typing. All of the examples written in the spec are used as test
cases. A few real payloads from the chain are also mixed into the test
suites.

## `tmrpc`

The `nibiru.tmrpc` package implements classes for building valid queries
corresponding to the Tendermint v0.37 RPC API. These types are
JSON-RPC-compatible and inherit directly from the types in
`nibiru.jsonrpc`.

- feat(tm_rpc): implement jsonrpc version of broadcast tx with tests

---


![wk28-n1719-TabTip_DIV3](https://github.com/NibiruChain/py-sdk/assets/51418232/b976645e-00d3-4407-8a0d-109496d18c38)

---

## Related

- #241
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant