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

fix: not fail on signature checks for dry-run txns #1081

Merged
merged 4 commits into from
Apr 26, 2023

Conversation

PinelliaC
Copy link
Contributor

@PinelliaC PinelliaC commented Apr 25, 2023

In this method, check_but_dont_fail is equivalent to whether the transaction is dry-run. However, when dry-run is true, authorization should not be checked.

@@ -559,7 +559,7 @@ namespace eosio { namespace chain {

}

if( !allow_unused_keys || check_but_dont_fail) {
if( !allow_unused_keys && !check_but_dont_fail) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the same change should be made at line 548 above, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.But EOS_ASSERT will only throw the error when the first argument is false. Since check_but_dont_fail should never throw the error when it is true, there is no need to modify at line 548.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yes, what was I thinking!

@greg7mdp greg7mdp requested a review from heifner April 25, 2023 14:44
Copy link
Member

@heifner heifner left a comment

Choose a reason for hiding this comment

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

Please update the PR description. check_but_dont_fail is a dry-run transaction not a read-only transaction.

@@ -559,7 +559,7 @@ namespace eosio { namespace chain {

}

if( !allow_unused_keys || check_but_dont_fail) {
if( !allow_unused_keys && !check_but_dont_fail) {
EOS_ASSERT( checker.all_keys_used(), tx_irrelevant_sig,
Copy link
Member

Choose a reason for hiding this comment

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

Instead, I think the EOS_ASSERT should be modified, since we would ideally want to include the time it takes for checker.all_keys_used()

      if( !allow_unused_keys ) {
         EOS_ASSERT( checker.all_keys_used() || check_but_dont_fail, tx_irrelevant_sig,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have resubmitted the code and updated the PR description

@heifner heifner mentioned this pull request Apr 25, 2023
@heifner
Copy link
Member

heifner commented Apr 25, 2023

Congratulation @PinelliaC on your first Leap PR. Thanks for the PR!

@linh2931 linh2931 changed the title fix: not fail on signature checks for read-only txns fix: not fail on signature checks for dry-run txns Apr 25, 2023
@linh2931
Copy link
Member

linh2931 commented Apr 25, 2023

Changed the PR title. I was surprised initially that read-only trxs called check_authorization. Thanks.

@spoonincode spoonincode merged commit 6184957 into AntelopeIO:main Apr 26, 2023
heifner added a commit that referenced this pull request Apr 26, 2023
[3.2] fix: not fail on signature checks for dry-run txns
heifner added a commit that referenced this pull request Apr 26, 2023
heifner added a commit that referenced this pull request Apr 26, 2023
[3.2 -> 4.0] fix: not fail on signature checks for dry-run txns
heifner added a commit that referenced this pull request Apr 26, 2023
heifner added a commit that referenced this pull request Apr 26, 2023
[4.0 -> main] fix: not fail on signature checks for dry-run txns
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.

5 participants