-
Notifications
You must be signed in to change notification settings - Fork 431
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
Return NotCallable
if contract hasn't method with selector X and hasn't a fallback function
#1002
Comments
Are you suggesting that ink! encoded an error in it's output buffer and sets the |
It is a good question how better to implement that. I think maybe we can add an additional flag to |
Wrong. It is precisely the reason for the existence of
There already exists a mechanic to pass along output. It is called |
I understand. The problem that means that we will have 3 levels of error:
And the output in that case should be Right now it is
If you think that better to create additional |
I see your problem. However, adding more and more policy into the privileged code is a slippery slope when this is basically an ABI problem. Nesting The contracts pallet has no notion of messages. On purpose. So transmitting this information makes no sense. |
Yep, the problem is that other languages also should do it in the same way and It will affect current standards because return data changed.
I understand that and I think it is a good idea to be agnostic to that information because. It allows having a My thoughts are that it is okay to provide an API that allows returning any kind of error from the contract like |
We already have The reason why you are asking for this is because the ABI is lacking some semantic: Having some general errors defined in the ABI in addition to the custom errors of the contract. You need to push for a new ABI version that includes this semantic. Adding redundant information to pallet contracts just to ease the pain of a ABI version migration isn't something I am aboard with. It doesn't need to be represented as |
I don't see how we can implement it without The problem is that it should by additional information for the contract's language, that can be represented somehow useful. But that means that on the Are you sure that it is better? |
The contracts pallet does not and will never deal with "languages". It just sees a wasm blob. Making a distinction between "contract errors" and "language errors" is a completely made up concept by ink!. It is within in the languages/ABIs responsibility to do things differently if that is needed. And this is exactly where it would be accomplished. All the mechanics are there.
We change the ABI so that the return type of any message/constructor is enum Error<E> {
UnknownMessage,
Custom(E),
}
type Result<T, E> = std::result::Result<T, Error<E>>; We already match on |
Is the same as It is breaking change and the main problem is that it affects standards on ABI level=( |
Yes. It doesn't avoid breaking the ABI but it is less annoying in that it doesn't require a double
I think we can agree that this would be the right thing to do even though it is messy. The mechanism you ask for to be added to pallet-contracts would only serve the purpose of avoiding this breaking change by adding a work around on top. We will add something that serves no real purpose. It is just there forever because we didn't want to break ABI. I also don't see how your standard wouldn't change with a new side channel in pallet-contracts. You would still need to amend the standard to include this semantic. I think now is still time to make this ABI change. It isn't as bad as it sounds. |
Replaced by #1207 |
If during cross contract call the callee contract hasn't a selector, ink! will panic and cross contract call will return
CalleTrapped
.I think we should return another error, for example,
NotCallable
in this case to identify to the caller, that call can't be processed.In the future, ink! will have a fallback function. So the rule is: "if contract hasn't method with selector X and hasn't a fallback function it will return
Some_Error_Here
".What do you think?
The text was updated successfully, but these errors were encountered: