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

[gh-2385] add dry run check for run_function.rs. #2458

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

feliciss
Copy link
Collaborator

Summary

Add dry run check for run_function.rs.

Copy link

vercel bot commented Aug 18, 2024

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

Name Status Preview Comments Updated (UTC)
rooch-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 23, 2024 2:51pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Aug 23, 2024 2:51pm

Comment on lines 19 to 23

fn read_proxy_from_env() {
println!("cargo:rerun-if-env-changed=https_proxy");
println!("cargo:rerun-if-env-changed=all_proxy");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not about this feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not about this feature.

Sorry I committed wrong.

@@ -36,6 +36,11 @@ pub struct RequestCommand {
#[async_trait]
impl CommandAction<serde_json::Value> for RequestCommand {
async fn execute(self) -> RoochResult<serde_json::Value> {
let https_proxy = env::var("https_proxy").ok();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not about this feature

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not about this feature

Sorry I committed wrong.

@@ -81,15 +83,24 @@ impl CommandAction<ExecuteTransactionResponseView> for RunFunction {
})
.collect::<Result<Vec<_>>>()?;
let action = MoveAction::new_function_call(function_id, type_args, args);
match (self.tx_options.authenticator, self.tx_options.session_key) {

let dry_run_result = context
Copy link
Contributor

Choose a reason for hiding this comment

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

If the dry_run_result is an error, we should return the result and not try to execute the tx.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If the dry_run_result is an error, we should return the result and not try to execute the tx.

I have dong returning the error before giving the status result.

Comment on lines +166 to 168
if dry_run_result.raw_output.status != KeptVMStatusView::Executed {
result.error_info = Some(dry_run_result);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Put this check before execute(tx), or skip execute(tx) if dry_run_result is not KeptVMStatusView::Executed.

If the dry run result is not Executed, we should not try to execute it.

The publish command also has this mistake. cc @steelgeek091

Copy link
Collaborator Author

@feliciss feliciss Aug 23, 2024

Choose a reason for hiding this comment

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

Put this check before execute(tx), or skip execute(tx) if dry_run_result is not KeptVMStatusView::Executed.

If the dry run result is not Executed, we should not try to execute it.

The publish command also has this mistake. cc @steelgeek091

Shall I fix them together or submit another PR to fix this issue only?

@jolestar
Copy link
Contributor

I merge this first.

@jolestar jolestar merged commit 782cabe into rooch-network:main Aug 23, 2024
7 checks passed
@feliciss feliciss deleted the #2385 branch August 23, 2024 21:05
feliciss pushed a commit to feliciss/rooch that referenced this pull request Aug 24, 2024
feliciss pushed a commit to feliciss/rooch that referenced this pull request Aug 24, 2024
feliciss pushed a commit to feliciss/rooch that referenced this pull request Aug 24, 2024
feliciss pushed a commit to feliciss/rooch that referenced this pull request Aug 24, 2024
feliciss pushed a commit to feliciss/rooch that referenced this pull request Aug 24, 2024
feliciss pushed a commit to feliciss/rooch that referenced this pull request Aug 24, 2024
jolestar pushed a commit that referenced this pull request Aug 24, 2024
* [gh-2458] return dry run result before executing txs.

* [gh-2458] format code.

* [gh-2458] fix code lint issues.

---------

Co-authored-by: Feliciss <10203-feliciss@users.noreply.0xacab.org>
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.

Do the dry run when executing normal transaction
2 participants