-
Notifications
You must be signed in to change notification settings - Fork 555
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
refactor evm origin with DispatchContext #2481
Comments
the way the DispatchContext API is structured may not make it possible for evm origin use case |
What is the problem? What do you need? |
I think we need to implement it to know if more changes are required. Here are two use cases we have currently: Set origin for tx in pre_dispatch for signed tx Lines 2021 to 2041 in 1cf443e
Set origin for xcm call Acala/runtime/common/src/xcm_impl.rs Lines 250 to 269 in 1cf443e
|
Yeah those would not work, as they are still outside the dispatch context! Not sure if you could set store these origins in some call. |
We cannot set origin in some call. Because for example a swap can trigger ERC20 transfer. This means we need to set it on every call. |
If wanted, we could also let the initial dispatch context being created in |
Yeah that will be lot more useful. It will be great if you can have it cover initialize/finalize hook and xcm execution as well so we don't need to do special handling in our runtime. |
That goes a little bit against the idea of the "dispatch context". It should be in the context of calling |
The idea is there is always a context for any code execution. In our use case, evm execution always requires an origin and we can’t rule out the possibility that someone may want to propose a governance call that executes evm call. In that case it will try to access the dispatch context. It could return None and we do special handling knowing it means the call must be dispatched by a hook. Or there could e a dispatch context API allow me define a default context. Then we could create a context with some special evm address as the origin. |
But that means that this will be some kind of |
In the example of governance, the call is created by democracy or referendum pallet, executed by scheduler pallet. There is no place for me to inject context. Unless we create special variant of call for the purpose of governance which I think will work but make generic governance UI harder to implement. |
Democracy and Referenda are using |
I see. I guess it could work. We just need to give it a try and see. |
new feature from paritytech/substrate#13468
we can use this to implement evm origin
The text was updated successfully, but these errors were encountered: