-
Notifications
You must be signed in to change notification settings - Fork 279
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
[suggestion] Make illegal instructions unrepresentable #3612
Comments
If I understand you correctly, you're saying that we can have our expression system inherently strongly typed. Since we kinda already have this with
I don't see this as viable and we should discuss this separately from the previous point. You're basically just making What we can consider doing is:
|
but every query output type is known at compile time? |
Done in #4089 |
…essions Signed-off-by: Daniil Polyakov <[email protected]>
…essions Signed-off-by: Daniil Polyakov <[email protected]>
Signed-off-by: Daniil Polyakov <[email protected]>
…essions (hyperledger-iroha#4089) Signed-off-by: Daniil Polyakov <[email protected]>
…essions (hyperledger-iroha#4089) Signed-off-by: Daniil Polyakov <[email protected]> Signed-off-by: Asem-Abdelhady <[email protected]>
…essions (hyperledger-iroha#4089) Signed-off-by: Daniil Polyakov <[email protected]>
Feature request
Some combinations of instructions are not legal and never will be, for example
Mint<String>
. As such we may be able to constrain the expression language to prevent illegal values to be representable and as such stop them from being decoded.Motivation
This was not previously possible because of lack of GATs in stable Rust. Now that the support had been stabilised, we can express the correct constraints in the trait bounds. And perhaps refactor the
Expression
andInstruction
systems to be more strict.One suggestion is to rethink the expressions as not just something that generates data for an instruction, but an entire transaction. So instead of
we can have
This has the advantage of allowing us to use an optimised code path for common instructions. Removing the redundant top-level
Expression::Sequence
. Remove the need forExpression::Raw
. Allow injecting the expected type information into the expression and fail eagerly.More importantly, it allows us to clean out arithmetic from string-related code, string-related code from numerical asset logic, booleans from almost all places, and potentially inline queries whose type is known ahead of time. This is important, because we will then not have to deal with
FindAllAccounts
as an argument toTransfer
. Finally, this trivialises #2409.This has one significant drawback and I propose only considering it, if we are certain that the benefits outweigh the costs.
Who can help?
@
The text was updated successfully, but these errors were encountered: