Use Extensions to register offchain worker custom extensions#1719
Use Extensions to register offchain worker custom extensions#1719skunert merged 5 commits intoparitytech:masterfrom
Extensions to register offchain worker custom extensions#1719Conversation
|
Just an idea, but what about adding a method to the And then use that id to populate the map For sure using the |
bkchr
left a comment
There was a problem hiding this comment.
We should probably remove the Any supertrait from Extension. Then we can forward the type_id function of Box<dyn Extension to the wrapped type. This would ensure that we don't take the TypeId of Box<Extension>. This should then probably fix this issue without requiring any of the changes in this pr.
|
Good suggestions guys, code is now simpler 👍 |
Co-authored-by: Bastian Köcher <git@kchr.de>
* master: (24 commits) Init System Parachain storage versions and add migration check jobs to CI (#1344) no-bound derives: Use absolute path for `core` (#1763) migrate alliance, fast-unstake and bags list to use derive-impl (#1636) Tvl pool staking (#1322) improve service error (#1734) frame-support: `RuntimeDebug\Eq\PartialEq` impls for `Imbalance` (#1717) Point documentation links to monorepo (#1741) [NPoS] Fix for Reward Deficit in the pool (#1255) Move import queue from `ChainSync` to `SyncingEngine` (#1736) Enable mocking contracts (#1331) Revert "fix(review-bot): pull secrets from `master` environment" (#1748) Remove kusama and polkadot runtime crates (#1731) Use `Extensions` to register offchain worker custom extensions (#1719) [RPC-Spec-V2] chainHead: use integer for block index and adjust RuntimeVersion JSON format (#1666) fix(review-bot): pull secrets from `master` environment (#1745) Fix `subkey inspect` output text padding (#1744) archive: Implement height, hashByHeight and call (#1582) rpc/client: Propagate `rpc_methods` method to reported methods (#1713) rococo-runtime: `RococoGenesisExt` removed (#1490) PVF: more filesystem sandboxing (#1373) ...
* tsv-disabling-node-side: (24 commits) Init System Parachain storage versions and add migration check jobs to CI (#1344) no-bound derives: Use absolute path for `core` (#1763) migrate alliance, fast-unstake and bags list to use derive-impl (#1636) Tvl pool staking (#1322) improve service error (#1734) frame-support: `RuntimeDebug\Eq\PartialEq` impls for `Imbalance` (#1717) Point documentation links to monorepo (#1741) [NPoS] Fix for Reward Deficit in the pool (#1255) Move import queue from `ChainSync` to `SyncingEngine` (#1736) Enable mocking contracts (#1331) Revert "fix(review-bot): pull secrets from `master` environment" (#1748) Remove kusama and polkadot runtime crates (#1731) Use `Extensions` to register offchain worker custom extensions (#1719) [RPC-Spec-V2] chainHead: use integer for block index and adjust RuntimeVersion JSON format (#1666) fix(review-bot): pull secrets from `master` environment (#1745) Fix `subkey inspect` output text padding (#1744) archive: Implement height, hashByHeight and call (#1582) rpc/client: Propagate `rpc_methods` method to reported methods (#1713) rococo-runtime: `RococoGenesisExt` removed (#1490) PVF: more filesystem sandboxing (#1373) ...
…ytech#1719) Closes paritytech#1671 Adds a `type_id` function to the `Extension` trait, allowing to properly store an retrieve boxed `Extensions`. --------- Co-authored-by: Bastian Köcher <git@kchr.de>
Closes #1671
As discovered correctly in that issue, custom externality extensions passed in from the outside as
Box<dyn Extension>have some limitations. We store them inExtensionswere the key is aTypeId, so multiple extensions are overriding each other.I think the solution proposed in the issue is reasonable, so I changed the return type of the
custom_extensionsclosure to returnExtensions. They can then be passed to the runtime instance and merged with the existing extensions.