-
Notifications
You must be signed in to change notification settings - Fork 125
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
Investigate: can the tip type be detected via metadata or Runtime? #344
Comments
Or maybe via Runtime (via PR #340) as Rust does not like type determination during runtime. |
I have investigated a little - and got to the following result:
pub struct SignedExtraWrapper<Runtime>
where
Runtime: GetRuntimeBlockType + frame_system::Config,
<Runtime::RuntimeBlock as Block>::Extrinsic: ExtrinsicMetadata,
{
pub extra: <<Runtime::RuntimeBlock as Block>::Extrinsic as ExtrinsicMetadata>::SignedExtensions,
// ^^^ That's the Extra which implements the Trait SignedExtension, e.g. the function:
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError>;
} And that might be enough. The compose macors would need to be adapted.
Useful substrate locations: |
Related issue : paritytech/substrate#12929 Via metadata (V14) it can be detected if the Conclusion: I think it's not worth to invest too much time to this. Let's wait for V15 and hope for a better world. If that takes too long, #406 might be a reasonable solution. |
You can't because encointer does not use the |
Happy news: Metadata v15 incoming soon! (checkout: paritytech/substrate#13287) 🥳 |
Metadata v15 is released, so this might not be blocked anymore. |
I've looked into it once again and came to the following conclusion: Yes, it would be possible to detect the tip during runtime with the metadata, but that would complicate a lot of things:
So long it's not a pressing user issue which has actual use cases, I don't see enough benefit on setting the Tip during runtime. |
@masapr what do you think? |
At some point, there might be some relevant information in this issue: leonardocustodio/polkadart#359 |
According to my understanding, they solve the problem by adding the extra input final payloadWithCustomSignedExtension = SigningPayload(
method: encodedCall,
specVersion: specVersion,
transactionVersion: transactionVersion,
genesisHash: genesisHash,
blockHash: blockHash,
blockNumber: blockNumber,
eraPeriod: 64,
nonce: 0, // Supposing it is this wallet first transaction
tip: 0,
customSignedExtensions: <String, dynamic>{
'PrevalidateAttests': 0, // A custom Signed Extensions
},
); I'm not sure if that's easier than adapting the
I believe we could start by adding sensible runtime checks against the metadata and print warnings if there's a mismatch. That way, the users will know what to adapt without first investigating some strange runtime errors. |
Yes, I think giving good warnings is probably the best in this case. Before we make it too complicated. |
Currently, it has to be manually chosen which type of tips are used in the runtime (AssetTip, PlainTip). That's a hassle. Shouldn't it be possible to determine that via the metadata?
The text was updated successfully, but these errors were encountered: