-
Notifications
You must be signed in to change notification settings - Fork 19
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
Implementing OmniAccount related native calls in the omni-executor #3250
Implementing OmniAccount related native calls in the omni-executor #3250
Conversation
adjusting subxt client usage
Add Hash generic type parameter to SubstrateRpcClient and related traits to properly handle block hash types across the codebase. This improves type safety and makes the RPC interface more flexible by allowing different hash types to be used. The change affects: - SubstrateRpcClient trait and implementations - SubstrateRpcClientFactory trait and implementations - Various dependent components that use these traits
Add new XtStatus enum and TransactionStatus wrapper to provide better control over transaction lifecycle monitoring. This allows clients to specify the desired transaction status level to watch for, from Ready to Finalized states. The implementation includes: - XtStatus enum for simplified transaction status tracking - TransactionStatus wrapper with status comparison functionality - Comprehensive test coverage for all status transitions
Add new RPC method to allow monitoring transaction status until a specific condition is met. This enables better control over transaction lifecycle and improves error handling with detailed status tracking. Changes include: - New ExtrinsicResult type to capture tx/block hashes - submit_and_watch_tx_until method on SubstrateRpcClient trait - Implementation for SubxtClient with full status monitoring
parentchain api-interface
Removes the custom TryFromSubxtType trait in favor of directly using parity_scale_codec's Encode/Decode traits. This simplifies the codebase by removing an unnecessary abstraction layer while maintaining the same functionality.
Updates NativeCallResponse and NativeCallOk to be generic over Hash type to support different types of transaction hashes. Also reorganizes native task handling code for better readability and adds new ExtrinsicReport variant for transaction status reporting.
Renames ExtrinsicResult to ExtrinsicReport and adds transaction status field to provide more detailed information about extrinsic execution. Also re-exports TransactionStatus and XtStatus types for better module organization.
Add ToSubxtType and ToPrimitiveType traits to handle conversions between primitive types and subxt types. This change simplifies type conversions across the codebase and removes duplicate conversion code. The changes include: - Add new type conversion traits and implementations - Update existing code to use the new traits - Add tests for the type conversions
Remove AccountId and Hash from generic parameters in SubstrateRpcClient and related traits/impls since they are now primitive types. This simplifies the type system and reduces complexity across the codebase. The changes include: - Update SubstrateRpcClient to only require Header type parameter - Remove unnecessary PhantomData fields - Update all implementations and usages to match new type signatures - Maintain same functionality while reducing generic complexity
Adds a new AES-256 key store implementation for the native task handler, including key generation, serialization, and storage functionality. This component helps manage encryption keys securely in the native environment.
BREAKING CHANGE: Renames keystore_path to substrate_keystore_path and adds new aes256_key_store_path parameter. This separates different key store types to improve key management and security by having dedicated paths for each key type.
Implements handling logic for add_account native calls including: - Identity verification for Web3 accounts - Member account encryption for private accounts - Permission management and validation - Transaction submission with proper error handling
Moves web3 identity verification logic to its own module and renames functions for better clarity: - get_expected_raw_message -> get_verification_message - verify_web3_identity -> verify_identity Improves code organization and maintainability.
Adds a new variant to NativeCall enum and implements the handler for removing accounts from an OmniAccount. This complements the add_account functionality, allowing management of member accounts within the system.
Implements new native call variant for setting permissions on member accounts within an OmniAccount. This allows dynamic permission management for member accounts after they have been added to the system.
Refactor native task handler to reduce code duplication by extracting common transaction submission and response handling logic.
…ounts-related-trustedcalls-to-omni-executor
…lls-to-omni-executor
…lls-to-omni-executor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
permissions, | ||
) => { | ||
let omni_account_storage = MemberOmniAccountStorage::new(ctx.storage_db.clone()); | ||
let Some(omni_account) = omni_account_storage.get(&sender_identity.hash()) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemberOmniAccountStorage stores a mapping where the key is MemberAccount and the value is OmniAccount, meaning MemberOmniAccountStorage.get(MemberAccount) = OmniAccount.
For NativeCall::add_account:
The identity represents MemberAccount, so sender_identity should correspond to OmniAccount.
Should omni_account_storage.get(&sender_identity.hash()) be omni_account_storage.get(&identity.hash())?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The identity
is the member account that the sender_identity
wants to add, so it's not yet a member of the OmniAccount. You need an existing member to get the OmniAccount
This PR add the OmniAccount related native calls. This is the initial migration of the
TrustedCall
s that are related to the OmniAccount, with only small modifications to adapt them to the omni-executor's code.Currently only Web3 and Email accounts are supported on
add_account
. More web2 identities will be added later.This PR also includes some small refactoring as well as some infrastructure code needed.
The scale file (metadata) have been updated to include
System
andBalances
pallet types.