-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Implement Clone
and Default
for Config
#12397
Conversation
I don't see any reason for this and it should be reverted. You should also not forget that this is Substrate and not Polkadot. Meaning the executor is used for executing runtimes and there are currently different default values. TLDR, everything should just define its own |
@bkchr I'm totally aware it's Substrate and the executor may be used anywhere. I see your point, there's no good in introducing some Poltadot-related defaults to Substrate. I believe it is not about that but somewhat wider. Executor is assigned to execute an arbitrary runtime. A user often wants a component just to do its job only falling back to modifying specific config settings when he has to. @pepyakin what's your opinion? |
Yeah, when I was reading the PR had the same thought as Basti. Default configuration is a very elusive concept IMO. It might be OK, for a general purpose execution environment which is wasmtime, since it may try to serve a need of an average user so that it just works. Here, we deal with 2 (two) users with greatly varying needs. What is the default in this case? I also think that configuration, esp. if it is important should live closer to where it's needed, in this case it's the Polkadot repo. I don't see any benefit of it living here.
|
Okay, if you guys both tell that it shouldn't be there, then it shouldn't be there ;) |
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.
Adding only Clone
is fine by me.
bot merge |
Waiting for commit status. |
This is a preparation stage for polkadot#4212. It does not affect any existing functionality.
What?
This PR contains two closely related but separate changes:
Clone
forConfig
;Default
forConfig
which is returning not just an empty structure but some reasonable fallback defaults.Why?
sc_executor_wasmtime
is designed to consume the config instead of borrowing it. I believe this is due to the possibility of replacement of instantiation strategy inside it in some cases. It works fine while config is set by a constant value. The task of execution environment parametrization introduces a need to hold that config as a part of abstract executor structure, owned by that structure. Option are either to rewritesc_executor_wasmtime
code to borrow the config instead of consuming it, or to make it possible to create config clones. By the principle of least impact, the latter approach was chosen.