Skip to content
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

[bug] Check the module is exist before execute the view function #1700

Merged
merged 3 commits into from
May 20, 2024

Conversation

vegetabledogdog
Copy link
Contributor

rooch move view --function 0x3::noexist_module::noexist_function
Module does not exist error: noexist_module

#1004

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-rooch-portal-v1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 3:56am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 3:56am

@@ -50,6 +50,23 @@ impl CommandAction<AnnotatedFunctionResultView> for RunViewFunction {
async fn execute(self) -> RoochResult<AnnotatedFunctionResultView> {
let context = self.context.build()?;
let address_mapping = context.address_mapping();
let module_id = self
.function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check it on the RPC server side, not the client side.

@vegetabledogdog
Copy link
Contributor Author

rooch move view --function 0x3::noexist_module::noexist_function
View function error: RPC call failed: ErrorObject { code: ServerError(-32000), message: "Module does not exist: 0000000000000000000000000000000000000000000000000000000000000003::noexist_module", data: None }

@jolestar jolestar linked an issue May 18, 2024 that may be closed by this pull request
@jolestar
Copy link
Contributor

Please help to fix the clippy error

error: using clone on type AccountAddress which implements the Copy trait
--> crates/rooch-rpc-server/src/service/rpc_service.rs:84:17
|
84 | module_id.address().clone(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: *module_id.address()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: -D clippy::clone-on-copy implied by -D warnings
= help: to override -D warnings add #[allow(clippy::clone_on_copy)]

@jolestar jolestar merged commit bcb3056 into rooch-network:main May 20, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Check the module is exist before execute the view function
2 participants