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

Create new NativeQuery operation to get encrypted data from the omni-executor #3260

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from

Conversation

silva-fj
Copy link
Contributor

@silva-fj silva-fj commented Feb 18, 2025

  • This PR introduces a new structure to split calls and queries (NativeCall and NativeQuery).
  • get_account_store NativeQuery have been added.
  • TS type definitions and integration tests have been updated.
  • It also includes some small refactoring and improvements

Refactors the NativeCall concept into a more generic NativeOperation trait to better
represent different types of blockchain interactions. This change prepares the
codebase for supporting both state-modifying calls and read-only queries in a
consistent way.

The main changes include:
- Create NativeOperation trait with common behavior
- Rename native_call.rs to native_operation.rs
- Update all related imports and type references
- Refactor authentication to be generic over NativeOperation
Extends the executor's native operation system to support query operations for
reading blockchain state. This separates the concerns between state-modifying
calls and read-only queries.

Changes include:
- Add NativeQuery enum for read-only operations
- Create separate handlers for calls and queries
- Split RPC methods into call and query endpoints
- Refactor task handling to support both operation types
Changes the account store query response to return only Identity objects
instead of MemberAccount enum. This simplifies the response type and
reduces unnecessary wrapping since we always convert private accounts to
public identities during the query.
Removes the unused UnexpectedCall variant from NativeOperationError enum as
it's no longer needed after recent refactoring of the native operation
handling logic.
Renames createNativeCallOperation to createNativeAuthenticatedOperation
for better clarity and consistency with the new type system. Updates all
related imports and usages across integration tests.
Adds createNativeQuery helper function and extends
createNativeAuthenticatedOperation to handle both NativeCall and
NativeQuery operation types. This enables proper type creation and
authentication for native query operations in tests.
Adds sendPlainRequestFromNativeQuery helper function to handle plain
requests specifically for native query operations. This complements the
existing sendPlainRequestFromNativeCall for better separation of concerns.
Add generic type parameter to createNativeAuthenticatedOperation function to
provide better type safety and inference for different operation types
(NativeCall vs NativeQuery). This change allows TypeScript to properly
distinguish between operation types at compile time.
Add a new make target 'clean-data' that removes log and storage database
directories in the omni executor. This helps developers clean up test data
and reset the environment between test runs.
Move CPU-intensive operations in get_account_store handler to a blocking
task using tokio::task::spawn_blocking. This prevents blocking the async
runtime with database and crypto operations, improving overall system
responsiveness.
Move request decoding and verification into spawn_blocking tasks to prevent
blocking the async runtime. This improves performance by handling CPU and
crypto operations on dedicated threads while keeping the async RPC handlers
responsive.
@silva-fj silva-fj requested a review from a team February 18, 2025 17:45
Copy link

linear bot commented Feb 18, 2025

@silva-fj silva-fj changed the title Create new NativeQuery operation to get data from the omni-executor Create new NativeQuery operation to get encrypted data from the omni-executor Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant