Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add #[without_storage_layer] tag which explicitly allows an extrinsic to not have a storage layer #11533

Closed
shawntabrizi opened this issue May 26, 2022 · 6 comments
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects

Comments

@shawntabrizi
Copy link
Member

Left over from: #10806

Now that: #11431 is merged, all extrinsics will have a transactional layer by default.

However, there may be situations you explicitly do not want a transactional layer, for example when you know that there is no need for it, or if you may even want to abuse this behavior(?)

We need to introduce a new attribute tag which can allow a user to note that an extrinsic should not have a storage layer, and then we skip adding the layer to the extrinsic.

This should be an easy task for anyone who is familiar with writing Rust macros.

@shawntabrizi shawntabrizi added Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder labels May 26, 2022
@shawntabrizi shawntabrizi added this to Backlog in Runtime via automation May 26, 2022
@Szegoo
Copy link
Contributor

Szegoo commented Jun 4, 2022

I would like to work on this.

@shawntabrizi
Copy link
Member Author

@Szegoo yup all yours! Presumably you are familiar with writing Rust macros?

Let me know if you need any help with finding the appropriate parts of code.

@Szegoo
Copy link
Contributor

Szegoo commented Jun 5, 2022

@shawntabrizi Yes, I am familiar with writing rust macros, I will let you know if I need any help 😀.

@Szegoo
Copy link
Contributor

Szegoo commented Jun 5, 2022

@shawntabrizi I have added a mode tag, that shows whether an extrinsic is gonna have a storage layer. So AFAIU I need now to write code that checks whether transactional is being used in the with_transaction and with_transaction_unchecked functions. Is this correct? If this is correct, what should I return when transactional is not being used?

@bkchr
Copy link
Member

bkchr commented Jul 28, 2022

I think we should not do this. The point here being that Pallet developers should be aware of what is the standard, aka either always transactional or not transactional. As we want transactional, I would vote for transactional as the default and this default should not be configurable. Otherwise we may open some attack vectors/bugs when it comes to nested calls where a developer needs to do some assumptions about the nested calls and their transactional behavior.

@shawntabrizi
Copy link
Member Author

agreed with basti here, best to have only one behavior

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
Status: Done
Runtime
  
Backlog
Development

Successfully merging a pull request may close this issue.

3 participants