Conversation
poc/extensions/src/dispatchable.rs
Outdated
| type MethodName; | ||
| type MethodIndex; | ||
| fn query_method(method_name: Self::MethodName) -> Self::MethodIndex; | ||
| fn dispatch(self) -> Vec<u8>; |
There was a problem hiding this comment.
it could be useful to make this return an Result
poc/extensions/src/extension_core.rs
Outdated
| use super::ExtensionTypeId; | ||
| use parity_scale_codec::{Decode, Encode}; | ||
| // SDK codes | ||
| pub trait ExtensionCore: Dispatchable + TryFrom<(u32, Vec<u8>)> { |
There was a problem hiding this comment.
TryFrom<(u32, Vec<u8>) is not correct. It should be something like TryFrom<(Dispatchable::MethodIndex, Dispatchable::MethodName)>
(you need to figure out the right syntax. maybe with a whare clause(
There was a problem hiding this comment.
and should have a trait Extension: Dispatchable + TryFrom<X, Y> and have other extensions conforming it
poc/extensions/src/extension_core.rs
Outdated
| }, | ||
| } | ||
|
|
||
| impl TryFrom<(u32, Vec<u8>)> for ExtensionCoreImpl { |
There was a problem hiding this comment.
actually should just use the Decode macro from parity_scale_codec to auto generate the decode logic
There was a problem hiding this comment.
Okay, so query_method is also redundant. The call details will embed in guest args.
|
The benefits of having indirect Enum implementations for extension functions are that we can implement some functionals later, like querying fees of the functions, right? |
|
I found accessing context in |
|
add trait bounds is fine |
| } | ||
|
|
||
| impl<Impl: ExtensionFungibles> ExtensionId for ExtensionFungiblesCall<Impl> { | ||
| const EXTENSION_ID: ExtensionIdTy = Impl::EXTENSION_ID; |
There was a problem hiding this comment.
extension id should be generated by this macro
| use core::marker::PhantomData; | ||
| use parity_scale_codec::{Decode, Encode}; | ||
|
|
||
| pub trait ExtensionFungibles: ExtensionId { |
There was a problem hiding this comment.
| pub trait ExtensionFungibles: ExtensionId { | |
| pub trait ExtensionFungibles { |
it is not up to the implementor of ExtensionFungibles to determine the extension id
poc/extensions/src/lib.rs
Outdated
|
|
||
| struct Context<E: ExtensionTuple, P: PermController> { | ||
| invoke_source: InvokeSource, | ||
| phantom_p: PhantomData<P>, |
There was a problem hiding this comment.
| phantom_p: PhantomData<P>, | |
| _marker: PhantomData<(P, E)>, |
so we don't need two of it
Close #8