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

Add execute_read_only_call #27

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading