Implements require_transactional#7261
Conversation
c245ee5 to
3aa19de
Compare
bkchr
left a comment
There was a problem hiding this comment.
Some comments and docs are also missing
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
bkchr
left a comment
There was a problem hiding this comment.
Sorry for being soo slow.
I think these are the last required changes, after that we can merge it.
|
|
||
| #[test] | ||
| #[should_panic(expected = "Require transaction not called within with_transaction")] | ||
| fn require_transactional_panic() { |
There was a problem hiding this comment.
This test will not panic on a local cargo test --all --release and that is bad.
I think the solution would be that we disable the test if debug_assertions are not enabled? Or do you got a better idea?
There was a problem hiding this comment.
test cfg check won't work for this so I think all we can do is disable it when debug_assertions is not enabled.
There was a problem hiding this comment.
In the end is that test here doing the same as the one from frame-support and we could just remove it.
bkchr
left a comment
There was a problem hiding this comment.
Some last nitpicks + merge master to make tests works.
After that it is okay.
|
|
||
| #[test] | ||
| #[should_panic(expected = "Require transaction not called within with_transaction")] | ||
| fn require_transactional_panic() { |
There was a problem hiding this comment.
In the end is that test here doing the same as the one from frame-support and we could just remove it.
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Closes #7004
This introduces
require_transactionand#[require_transactional], which under release build is nop, so for document purpose only.Under debug build, it will check if it is been called under
with_transactionand panic if not. This is useful to catch unintended usage of methods that are unsafe to be called withoutwith_transaction.TODOs: