-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Vision: Add validation syntax for extrinsics enforced on transactions #6866
Comments
Essentially, your domain of access in Also, I think the name can be better and is encouraging the user to "you don't need to understand this, it is magic". I prefer making sure the user understand what they are doing: |
While the general idea is nice. I'm not sure we really should provide an easy way for this. The problem is that no one is gone pay for this. These checks should always be very lightweight, which we can not ensure as the user could do anything in there. Normally when we reject such stuff on chain, the sender pays for it. Now, no one is gonna pay for it. If we implement this, we should do a lot of education around this and what is bad etc! |
I think we can already achieve this via SignedExtension so this will just be a syntax sugar. Another question is when does the validation happen? Before entering tx pool? During block production? After tx inclusion? We have dry run RPC so we can use it to prevent people from submitting bad tx already. So unless the plan is to also expose the constraint via metadata, I don't really see why we need this. We already have enough macro magics. |
As you already said, this is just syntactic sugar around |
I don't think the runtime can and should specify that. The runtime provides the cheap checks via |
Sure, we will need to educate, but as mentioned by others we need to do that for ValidateUnsigned and SignedExtensions as well. |
Yes, but there is a difference between putting the shotgun on the table and putting them into some locker :P :D |
I wonder whether we disagree on the tradeoff between pruning txs before they enter the tx pool (which this would make easier IIUC) vs making sure that attackers pay for traffic they cause. |
If I can send you tons of transactions that you reject before they enter the pool, you still pay the validation price and if there is some heavy computation hidden in this validation, it doesn't end good for you. We already have seen that a lot struggled with custom Let's take your example:
Why should an UI send a value which is zero, when we know that zero isn't accepted? Correct, a good behaving UI wouldn't do this. However, when I'm trying to do be evil and sending transactions manually I would start sending with a value of zero. In my opinion you should pay for this, because this is misbehavior. |
I feel there are two separate issues here:
While I'm a huge fan of 1. (see below) for some more details, I don't like 2:
Ad.1: |
I agree that this opens the nodes to risk of DoS if the checks are too heavy. |
As a polemic example: You won't propagate a transaction whose encoding is wrong or which is not signed correctly. |
This is sensible from an engineering pov, but not economically. Validators would love to include lots of transactions that would fail on ensure, as they pay the full fee with a bit less work. |
The network in overall? - perhaps. A single node that receives such transactions? - not really.
Yes, we do draw a line at some point, but do it extremely carefully (on the safe side) to prevent DoS attacks.
And it is via |
I think instead on focusing on way to express more logic to reject extrinsic when validating them in the transaction. We should rather focus on making those checks easily identifiable to the UI so that they never send such invalid transaction, probably using metadata. Similar to what is proposed in paritytech/polkadot-sdk#349 |
👍 FWIW we have a pretty expressive Rust type system at our disposal. As an example: maybe instead of having |
But we already provide means for free transactions via unsigned transactions and also |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
would be a nice luxury to have someday maybe. |
interestingly, flies in the face of paritytech/polkadot-sdk#32 |
Substrate could provide some syntax to move (or copy) simple
ensure!
checks into transaction validation "automatically"/very easily.e.g. with this mock syntax:
or complementarily:
Related to paritytech/polkadot-sdk#349 (could maybe be a way of implementing it?)
Depends on #5678
The text was updated successfully, but these errors were encountered: