-
Notifications
You must be signed in to change notification settings - Fork 43
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
Public EnvBase
functions should be infallible in Guest
#1243
Comments
I think the issue needs addressing in the soroban-env repo, because the same issue occurs in the |
I don't think we can make the interface infallible because it can be fallible depending on implementation. But we also shouldn't expose the fallible functions via SDK's |
Ah interesting, so I was going to say EnvBase isn't exported from the SDK and so contract developers should never see it or know about it so from the SDK interface pov it doesn't matter. However, it looks like we did export the EnvBase recently to get access to some EnvBase functionality in generated code. I'll create an issue to rehide it, as it's all intended to be internal functionality. I still think this issue is primarily concerned with the guest, which is probably going to become an advanced low-level SDK in the future. |
Hiding the |
The methods should be exposed on SDK types yeah, I created an issue to refactor that in: But the infallible vs fallible issue is still relevant I think and specifically seems like a problem in the guest. This exact issue exists in the guest today:
|
Yeah, I guess that's a fair concern if someone uses guest. However, I don't have a good idea as to how this can be fixed. Maybe we should generate the infallible guest wrapper and hide the fallible versions. But I'm not sure we have time for that now. |
The interface for the guest doesn't have to be locked in today, as I think it makes no API guarantees. I'll transfer this issue to env and make it about the guest, and we can revisit in the future. |
EnvBase
functions should be infallibleEnvBase
functions should be infallible in Guest
I think
The SDK doesn't (visibly?) re-export But we can (and some of our tests do) explicitly import |
@graydon So in the example at the top of the issue where .is_err() is being called on a fn that'll never return error, that's a It's a shame that clippy isn't reporting that we're calling is_err on a infallible. |
@leighmcculloch Yes, it's a
Yeah (not even with WHO KNOWS. |
(given we're pretty much unable to "fix" this, closing) |
Currently the SDK implements
EnvBase
functions and exposes them publicly as is. However, these functions are declared as returningResult<>
, so this interface creates a false impression that these functions can return an error. This has been confusing enough to even slip into our own tests (rs-soroban-env/soroban-test-wasms/wasm-workspace/linear_memory/src/lib.rs
Line 50 in 7435744
We should hide
EnvBase
and add public infallible wrappers around its functions.The text was updated successfully, but these errors were encountered: