Offchain worker custom extension not working #1671
Labels
I2-bug
The node fails to follow expected behavior.
I10-unconfirmed
Issue might be valid, but it's not yet known.
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
Offchain worker configuration allows passing custom extensions in
node/src/service.rs
(as in substrate-template repo):polkadot-sdk/substrate/client/offchain/src/lib.rs
Line 140 in cfc6cc6
which are later registered:
polkadot-sdk/substrate/client/offchain/src/lib.rs
Line 261 in cfc6cc6
polkadot-sdk/substrate/client/offchain/src/lib.rs
Line 286 in cfc6cc6
However, since extensions are registered using
TypeId
, they would overwrite each other since they are all of the same typeBox<dyn Extension>
.polkadot-sdk/substrate/primitives/externalities/src/lib.rs
Lines 336 to 338 in cfc6cc6
Moreover, I wouldn't be able to retrieve them later in host function using
self.extension::<MyExtension>()
since the registered TypeId is a genericBox<dyn Extension>.type_id()
.Calling
self.extension::<MyExtension>().expect("should be registered")
just gets panic.Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: