Skip to content

Commit

Permalink
Add execute_read_only_call
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-François <[email protected]>
  • Loading branch information
bilboquet committed Dec 22, 2023
1 parent cb83cb2 commit 0f1ad9a
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion massa_test_framework/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

import betterproto
from grpclib.client import Channel
from massa_proto_python.massa.model.v1 import ReadOnlyExecutionOutput

# internal
from massa_test_framework import massa_jsonrpc_api
from massa_proto_python.massa.api.v1 import (
ExecuteReadOnlyCallRequest,
ExecuteReadOnlyCallResponse,
GetMipStatusRequest,
GetMipStatusResponse,
PublicServiceStub,
Expand Down Expand Up @@ -513,7 +516,29 @@ def get_stakers_grpc(self) -> GetStakersResponse:

return get_stakers_response

def wait_ready(self, timeout=20) -> None:
def execute_read_only_call(
self, request: ExecuteReadOnlyCallRequest
) -> ReadOnlyExecutionOutput:
"""
Executes a read-only call using the specified request.
Args:
request (ExecuteReadOnlyCallRequest): The request object for the read-only call.
Returns:
ReadOnlyExecutionOutput: The output of the read-only call.
"""
response: ExecuteReadOnlyCallResponse = asyncio.run(
self._public_grpc_call(
self.grpc_host,
self.pub_grpc_port,
"execute_read_only_call",
request,
)
)
return response.output

def wait_ready(self, timeout: int = 20) -> None:
"""Wait for node to be ready
Blocking wait for node to be ready
Expand Down

0 comments on commit 0f1ad9a

Please sign in to comment.