-
Notifications
You must be signed in to change notification settings - Fork 290
Extrinsic construction should default to Era::mortal #202
Description
Currently, it looks like extrinsic construction with subxt defaults to Era::Immortal. Further, it looks like the subxt public api does not expose a way for a user to construct a mortal transaction.
Immortal transactions are dangerous as they expose a potential replay attack vector; thus I believe defaulting to (or even only allowing) mortal transactions is best practice for an extrinsic construction lib. Here is a section on the polkadot wiki that elaborates on the aforementioned .
If my understanding is correct, implementation wise one way to achieve this is by allowing Extrinsic::new() to accept an argument for Era, which could be constructed with this - passing in current block number, and period blocks the transaction should live for, with a reasonable default like 64. current block number could be fetched under the hood by RPC and period could be filled by a default value, which I think would result in no breaking changes for current users (not counting the change that the ext is now mortal).
cc @dvdplm, @joepetrowski