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/finding #21 - Emit Events for Failed Try Execution in execute #127

Conversation

Aboudjem
Copy link
Contributor

@Aboudjem Aboudjem commented Aug 1, 2024

Description:

  • When calling execute() with EXECTYPE_TRY and either CALLTYPE_SINGLE or CALLTYPE_DELEGATECALL, no event is emitted if the try fails.
  • With CALLTYPE_BATCH, the TryExecuteUnsuccessful event is emitted for each failure.
  • In executeFromExecutor, TryDelegateCallUnsuccessful and TryExecuteUnsuccessful events are emitted appropriately.

@Aboudjem Aboudjem changed the title Fix/finding-21 - Emit Events for Failed Try Execution in execute Fix/finding #21 - Emit Events for Failed Try Execution in execute Aug 1, 2024
@Aboudjem Aboudjem self-assigned this Aug 1, 2024
Copy link

openzeppelin-code bot commented Aug 1, 2024

Fix/finding #21 - Emit Events for Failed Try Execution in execute

Generated at commit: 4c05522745d346ef58842c80a2a9f0e1967bd864

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
1
0
6
24
31

For more details view the full report in OpenZeppelin Code Inspector

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 72.54%. Comparing base (4d0c119) to head (9c2537d).

Files Patch % Lines
contracts/base/ExecutionHelper.sol 58.33% 5 Missing ⚠️
Additional details and impacted files
@@                              Coverage Diff                               @@
##           fix/finding-19-enable-mode-validator-check     #127      +/-   ##
==============================================================================
- Coverage                                       72.68%   72.54%   -0.14%     
==============================================================================
  Files                                              13       13              
  Lines                                             659      663       +4     
  Branches                                          149      151       +2     
==============================================================================
+ Hits                                              479      481       +2     
- Misses                                            180      182       +2     
Files Coverage Δ
contracts/base/ExecutionHelper.sol 52.12% <58.33%> (-0.10%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d0c119...9c2537d. Read the comment docs.

else revert UnsupportedExecType(execType);
else if (execType == EXECTYPE_TRY) {
(bool success, bytes memory result) = _tryExecute(target, value, callData);
if (!success) emit TryExecuteUnsuccessful(0, result);
Copy link
Contributor

Choose a reason for hiding this comment

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

I had also gotten feedback that the information we emit for these internal success or failure got to make more sense. for example it should emit calldata and not emit things like indexes

I will share the finding description

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

why there are two prs with same work?

@@ -16,6 +16,7 @@ contract EventsAndErrors {
event PreCheckCalled();
event PostCheckCalled();
event TryExecuteUnsuccessful(uint256 batchExecutionindex, bytes result);
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 rethink what should be emitted..

Copy link
Contributor

Choose a reason for hiding this comment

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

this is updated right?

Copy link
Contributor

@livingrockrises livingrockrises left a comment

Choose a reason for hiding this comment

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

review i

@Aboudjem
Copy link
Contributor Author

review i

@livingrockrises @VGabriel45

Should we close this since Gabi has opened an PR for the same?

Base automatically changed from fix/finding-19-enable-mode-validator-check to fix/finding-18-withdraw-deposit-memory August 12, 2024 19:35
Copy link

🤖 Slither Analysis Report 🔎

Slither report

# Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

constable-states

Impact: Optimization
🔴 Confidence: High

base/RegistryAdapter.sol#L12

factory/RegistryFactory.sol#L39

_This comment was automatically generated by the GitHub Actions workflow._

Copy link

Changes to gas cost

Generated at commit: e596ba9ac1bac5a9cfc2c308bfef48b46c10d149, compared to commit: 96d926150df1b79a95ccb9c0fa24addf5cb1886b

🧾 Summary (5% most significant diffs)

Contract Method Avg (+/-) %
NexusAccountFactory computeAccountAddress -87 ✅ -6.84%
Nexus executeFromExecutor +20 ❌ +0.10%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
NexusAccountFactory 766,546 (+22,987) computeAccountAddress
createAccount
1,185 (-87)
211,585 (-55)
-6.84%
-0.03%
1,185 (-87)
229,206 (-55)
-6.84%
-0.02%
1,185 (-87)
231,725 (-55)
-6.84%
-0.02%
1,185 (-87)
231,725 (-55)
-6.84%
-0.02%
609 (0)
8 (0)
Nexus 5,429,924 (+8,493) execute
executeFromExecutor
6,197 (-15)
14,527 (-2)
-0.24%
-0.01%
48,972 (-13)
19,823 (+20)
-0.03%
+0.10%
37,897 (-15)
19,653 (+43)
-0.04%
+0.22%
142,975 (-15)
25,459 (-6)
-0.01%
-0.02%
76 (0)
4 (0)

@VGabriel45
Copy link

review i

@livingrockrises @VGabriel45

Should we close this since Gabi has opened an PR for the same?

Pushed changes in this PR, will close #135

@livingrockrises livingrockrises merged commit b0f009a into fix/finding-18-withdraw-deposit-memory Aug 13, 2024
6 of 9 checks passed
@livingrockrises livingrockrises deleted the fix/finding-21-emit-events branch August 13, 2024 15:45
@Aboudjem Aboudjem restored the fix/finding-21-emit-events branch August 13, 2024 17:32
@Aboudjem Aboudjem deleted the fix/finding-21-emit-events branch August 13, 2024 17:34
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.

None yet

5 participants