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

Multisig approve call should return error data back to the user #1422

Merged
merged 3 commits into from
Oct 3, 2023

Conversation

aarshkshah1992
Copy link
Contributor

Closes #1251 .

if let Some(r) = e.take_data() {
out = RawBytes::new(r.data);
}

Copy link
Contributor Author

@aarshkshah1992 aarshkshah1992 Oct 2, 2023

Choose a reason for hiding this comment

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

@arajasek One question:

Why does this function "succeed" i.e. we return an Ok value from this function even though the transaction fails ?

Copy link
Member

Choose a reason for hiding this comment

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

Because we successfully fail. If we returned an error, we'd revert the multisig's state leaving the pending message in the state. The user would then have to send a second message to "abort" it.

This is one of the many reasons we want to let users deploy their own smart contracts/actors. Because there's no "one size fits all" answer here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Expanding just a bit, I think "philosophically" it makes sense to succeed here. When this method is called (or a top-level "approve and execute" method is called), you're asked to execute the transaction, if possible. If for some reason the transaction isn't executable, that's a failure.

But if the transaction executes-and-fails, that's not really a failure for the top-level viewer. We were asked to execute the tx, we were able to do so, and the result of that execution happened to be a failure.

But @Stebalien is right, there are definitely users who won't want this behaviour, so getting this out of built-in actors would be great.

@codecov-commenter
Copy link

Codecov Report

Merging #1422 (d31a116) into master (582b0be) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1422      +/-   ##
==========================================
+ Coverage   91.03%   91.10%   +0.06%     
==========================================
  Files         145      145              
  Lines       27848    27850       +2     
==========================================
+ Hits        25352    25373      +21     
+ Misses       2496     2477      -19     
Files Coverage Δ
actors/multisig/src/lib.rs 95.50% <100.00%> (+0.77%) ⬆️

... and 6 files with indirect coverage changes

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

LGTM although, if we follow the process, this should wait until nv22. On the other hand, I'd kind of like to just merge it... (it doesn't change any APIs and may make debugging smart contracts controlled by multisigs easier).

if let Some(r) = e.take_data() {
out = RawBytes::new(r.data);
}

Copy link
Member

Choose a reason for hiding this comment

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

Because we successfully fail. If we returned an error, we'd revert the multisig's state leaving the pending message in the state. The user would then have to send a second message to "abort" it.

This is one of the many reasons we want to let users deploy their own smart contracts/actors. Because there's no "one size fits all" answer here.

@Stebalien
Copy link
Member

@arajasek thoughts on merging/punting?

Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

LGTM, but I do think it should wait till nv22 -- so merge now (into master), and it'll get carried into the next network upgrade.

if let Some(r) = e.take_data() {
out = RawBytes::new(r.data);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Expanding just a bit, I think "philosophically" it makes sense to succeed here. When this method is called (or a top-level "approve and execute" method is called), you're asked to execute the transaction, if possible. If for some reason the transaction isn't executable, that's a failure.

But if the transaction executes-and-fails, that's not really a failure for the top-level viewer. We were asked to execute the tx, we were able to do so, and the result of that execution happened to be a failure.

But @Stebalien is right, there are definitely users who won't want this behaviour, so getting this out of built-in actors would be great.

@arajasek arajasek added this pull request to the merge queue Oct 3, 2023
Merged via the queue into master with commit 89679e2 Oct 3, 2023
@arajasek arajasek deleted the feat/1251 branch October 3, 2023 15:28
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.

Multisig: Propegate error value on failure
4 participants